[Scummvm-git-logs] scummvm master -> 43cf2d5babeaae215aa270819d6979d3c691426a
sev-
noreply at scummvm.org
Tue Jul 14 23:14:07 UTC 2026
This automated email contains information about 165 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
5b1b0d5de6 FOOL: Initial commit
9399b5438b FOOL: Initial translation of fool_prologue
fb98a16555 FOOL: More porting
23fbab5097 FOOL: Even more porting
7a5c359355 FOOL: Yet more porting
4f5739bcfb FOOL: It continues
d7a1d78c5f FOOL: Fix first lot of compile errors
6bf2e3f7ef FOOL: Stub out everything
8d3003200f FOOL: Almost working
38142cd973 COMMON: Add MacResMan::getResID()
cda196c322 FOOL: Implement more of ResMan API
beb94c42f1 FOOL: First graphics displaying
7f7fa5f190 FOOL: Add type alias for BitMap
665bd27971 FOOL: Split QuickDraw methods
888fecc4c2 FOOL: Implement GrafPort commands
95a9a8f617 FOOL: Add blitter
bdcb2fa4f8 MAGCUI: Allow thickness to be specified for x and y dimensions
d154de8924 MACGUI: Fix MacWindowManager::setScreen to always set _screenDims
1c5d358a01 FOOL: Implement some draw commands
7496d549b4 FOOL: Offscreen pages working
6593d180c8 FOOL: Fix raindrop blitting
22205c5d52 MACGUI: Fix pattern fill for thick pen
5b9ace2765 FOOL: Implement FrameOval and FrameRect
d4bb8b3848 FOOL: Fix FillRect
c7eb7cf630 FOOL: Initial implementation of text drawing
d9fc6f5cef MACGUI: Fix font colour downconversion
17cdd2cb66 FOOL: Add per-pixel copy mode to blitter
91bac769c4 MACGUI: Search font registry even if classicmacfonts is missing
39642d486f FOOL: Fix pattern offset on intermediate surfaces
79bcf56c69 FOOL: Fix CopyBits for out-of-bounds rects
2adcfe99c8 FOOL: More prologue tweaks
7b2fa0ef13 FOOL: Fix disasterous off-by-four error in homemade disassembler
7d1020e63a FOOL: Initial translation of game module
c58cbfd39c FOOL: More porting
d9542fbbf4 FOOL: Rework PicHandle to support masked drawing
a4b9b99159 FOOL: More porting
6cbe311de7 FOOL: More porting, add missing stubs
50666287fc FOOL: More grist for the porting mill
f286d0fea9 FOOL: Scroll visible
0f960091a5 FOOL: More porting
5909b79848 FOOL: Fix rendering regressions in introduction
60699d9b6a FOOL: Implement ZBasic file read
f8c426bfe2 FOOL: Implement more loader
ed05481cca GRAPHICS: MACGUI: Allow masks for custom cursors
409d9dba6a FOOL: Loader complete, story invisible
d717a6581a MACGUI: Fix insert, allow font overrides for MacMenu
2105262841 FOOL: Menu now renders
e597fa5bf0 MACGUI: Allow externally-owned surface for MacWidget
257b8bd25f FOOL: Add quit event
798f58d87e FOOL: Menu events wired up
bca38ee631 FOOL: Fix story text layout
7e328ddb5d MACGUI: Add MacMenu::appendMenu
b5e4b427c6 FOOL: Menu mostly works, story looks good
14a66db023 FOOL: Add story buttons, giant switch statement
9214cb0a8d FOOL: First pass of jigsaw module
95dfb3af0a FOOL: Fix screen fill when clicking story button
ff732b5a52 FOOL: Jigsaw working
9a03c10a47 FOOL: Add save/load
2f44bfa90a FOOL: Fix menu indexing
30d8f1b6d5 FOOL: Fixed post-puzzle story actions
e7422f8f2e MACGUI: Slightly modify drawPolygonScan code
4533a36ed8 COMMON: Add method for extending Rect with a Point
eec7025a87 FOOL: Implement polygon draw methods
eb7bd647a7 FOOL: First pass of reveal puzzle
bab032b684 FOOL: First pass at sound API
8cfa24bd69 FOOL: First pass at QuickDraw-backed PICT decoder
69631cde63 FOOL: More PICT drawing pipeline
448b91de70 FOOL: More polyomino fixes
ad6ff77b87 FOOL: Polyominos working, add wordsearch
0ff58fcc46 FOOL: Fix ZBasic::rightStr implementation
b22ecdaa0b FOOL: Word search working
66fad4b7fe FOOL: Fix About and Quit menu options
48ce975c51 FOOL: Tidy font face references
a1226ada32 GRAPHICS: Fix Mac font rendering for shadow | outline
d5408dca0f FOOL: Fix inf symbol appearing on wrong chapters
5680733a99 FOOL: First pass of card game
83e0a56906 FOOL: Cards working
fb0247f8f5 MACGUI: Shift large submenus left to fit on the screen
80f1b8598d FOOL: First pass of death
c26619f589 FOOL: Death game working
6eeecdcae5 FOOL: Add first pass of Sun's map
43cd712be0 FOOL: Sun's map mostly working
52148a2130 FOOL: First half of jumble
23a479049b FOOL: Jumble mostly working
6e51d948a6 MACGUI: Adjust MacMenu to use _composeSurface from the base class
7cef1a0725 MACGUI: Allow MacMenu surface to be blitted without changes
851843aef6 FOOL: Enable menu bar prompt messages
02b011d576 FOOL: Fix serialization bug
fcfe7303dc FOOL: Refactoring
cb083c21dc MACGUI: Add MacMenu::getMenuShortCut
31fe5b77d3 FOOL: Add Toolbox::MenuKey
a5d2f84497 FOOL: Fix uninitialised memory in page arrays
5051bba496 FOOL: Fix cross-encoding losses in save games
d1c4b064e5 FOOL: Always use software framelimiter
5b42890f33 FOOL: Fix memory overflow for puzzle completion status data
3b7d2ad4ca FOOL: Fix King Of ... page visibility
dc4004278a FOOL: Name more state flags
c5df8951da FOOL: Fix missing screen buffer copies
e01bdd20d8 FOOL: Remove extra screen redraws
fa8e71fba1 FOOL: Fix ever-growing save game names
627962046e FOOL: Fix word square being unsolvable
26ad7f8ac5 FOOL: Add sentence game
633f0e2a16 FOOL: Add big chunk of Book of Thoth
c767064461 FOOL: Book of Thoth mostly working
4b876e850c FOOL: Clean up Thoth a bit
7fe4f61739 FOOL: Humbug working
e519df4a45 FOOL: Justice entered in mostly
7df7f3fb4a FOOL: Break justice and humbug into files
ae9c51d710 FOOL: Use raw strings for puzzle data
5a03144ffc FOOL: Book of Thoth working
18d321dd0e FOOL: Fix checkbox next to completed thoth puzzles
a6ad01b387 FOOL: Fix Wheel of Fortune + High Priestess completion
4526581315 AUDIO: Allow PCSpeakerStream commands to adjust volume
45d977aa86 FOOL: Add sound, first pass of maze engine
a596b26113 FOOL: Maze not crashing anymore
942dbf9352 FOOL: Archway completable
a23d1443a6 FOOL: Fix blend mode for oval draw routines
8cb802a46a FOOL: Add large chunk of metapuzzle
4f3b69662d FOOL: Fix uninitialised memory bugs
465f9cedb2 FOOL: Ignore pen size for filled ovals/rects
c56409021a FOOL: Clear state index on new game
26235071b2 FOOL: Fix metapuzzle hover feature
b877fc7962 FOOL: Add straight path challenge
1c1463ec19 FOOL: Fix bugs in maze save code
d4ba34e541 FOOL: Change autosave to use dedicated file
a84e101b7d FOOL: Game completable
697ccb529b FOOL: Begin cleanup + refactoring
92faa181ad FOOL: Slightly more finale
d41983b4f3 FOOL: Move ZBasic state to local var
1df8eb89b6 FOOL: Fix Maze of Thorns sound bug
5dcdc0c6ee FOOL: Fix puzzle fade-in of hermit
23999986fd FOOL: First pass at version adaptation
8d60be8474 FOOL: Naming cleanup
ba8ce93cd7 FOOL: More naming cleanup
6200023318 FOOL: More naming cleanup
7414a69c7e MACGUI: Add MacMenu::setFont
b7d039aff5 FOOL: Fix ZBasic::setMenuFont
23068b708a MACGUI: Allow injection of custom FOND information
5426c7bd8a FOOL: Fix font rendering on Fool's Errand v1.1
dc2c1549ad FOOL: Make prologue accessible from about menu
91f4ca6fcc FOOL: Add more finale
0b60d052b3 FOOL: More finale
4c674d9a08 FOOL: Fix memory leak
940a9a4967 FOOL: Light refactoring
d9d7b2173a FOOL: Finish transcribing finale
766f700bed FOOL: Clean up variables
cdfb997431 FOOL: More cleanup
ff26de495f FOOL: Fix prologue and finale for all versions
01560e161c FOOL: Strip remaining uses of 'this'
3ddae716dd FOOL: Remove all generic var names in prologue/finale
e0e4897d8e FOOL: Return to story after finale plays
7581d3b884 FOOL: Cleanup based on feedback
61e2c40055 GRAPHICS: Move MacToolbox into common code
d9280f27f2 MACTOOLBOX: Replace warnings with debug messages
97f806e45a FOOL: More cleanup
0b338a70ea FOOL: Fix letter trails in finale
26fb10390e COMMON: Add MacResMan::writeMacBinary
4debf03128 FOOL: Output MacBinary save files compatible with original game
f7b4217cd9 FOOL: Use INFINITY instead of bithacks
257e0e00c0 MACTOOLBOX: Fix compile error
c2a6ac61c8 FOOL: Fix maze save game logic
4fd79d496b FOOL: Use standard save system instead of FileBrowserDialog
7a91f04770 FOOL: Use punycode to allow non-ASCII game descriptions
e421b49280 MACGUI: Add custom checkmarks for menu items
43cf2d5bab FOOL: Move remaining warnings into debug level
Commit: 5b1b0d5de6b7aaeb77f943c8ac9163f44a91bd9c
https://github.com/scummvm/scummvm/commit/5b1b0d5de6b7aaeb77f943c8ac9163f44a91bd9c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:39+02:00
Commit Message:
FOOL: Initial commit
Changed paths:
A engines/fool/POTFILES
A engines/fool/configure.engine
A engines/fool/console.cpp
A engines/fool/console.h
A engines/fool/credits.pl
A engines/fool/detection.cpp
A engines/fool/detection.h
A engines/fool/detection_tables.h
A engines/fool/events.cpp
A engines/fool/events.h
A engines/fool/fool.cpp
A engines/fool/fool.h
A engines/fool/messages.cpp
A engines/fool/messages.h
A engines/fool/metaengine.cpp
A engines/fool/metaengine.h
A engines/fool/module.mk
A engines/fool/view1.cpp
A engines/fool/view1.h
A engines/fool/views.h
diff --git a/engines/fool/POTFILES b/engines/fool/POTFILES
new file mode 100644
index 00000000000..bb56210f4b2
--- /dev/null
+++ b/engines/fool/POTFILES
@@ -0,0 +1 @@
+engines/fool/metaengine.cpp
diff --git a/engines/fool/configure.engine b/engines/fool/configure.engine
new file mode 100644
index 00000000000..743859e715d
--- /dev/null
+++ b/engines/fool/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine fool "The Fool's Errand" no "" "" "highres"
diff --git a/engines/fool/console.cpp b/engines/fool/console.cpp
new file mode 100644
index 00000000000..3363b8777b3
--- /dev/null
+++ b/engines/fool/console.cpp
@@ -0,0 +1,38 @@
+/* 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 "fool/console.h"
+
+namespace Fool {
+
+Console::Console() : GUI::Debugger() {
+ registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_test(int argc, const char **argv) {
+ debugPrintf("Test\n");
+ return true;
+}
+
+} // End of namespace Fool
diff --git a/engines/fool/console.h b/engines/fool/console.h
new file mode 100644
index 00000000000..0c16428c175
--- /dev/null
+++ b/engines/fool/console.h
@@ -0,0 +1,40 @@
+
+/* 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 FOOL_CONSOLE_H
+#define FOOL_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Fool {
+
+class Console : public GUI::Debugger {
+private:
+ bool Cmd_test(int argc, const char **argv);
+public:
+ Console();
+ ~Console() override;
+};
+
+} // End of namespace Fool
+
+#endif // FOOL_CONSOLE_H
diff --git a/engines/fool/credits.pl b/engines/fool/credits.pl
new file mode 100644
index 00000000000..4301369bead
--- /dev/null
+++ b/engines/fool/credits.pl
@@ -0,0 +1,3 @@
+begin_section("Fool");
+ add_person("Scott Percival", "moralrecordings", "");
+end_section();
diff --git a/engines/fool/detection.cpp b/engines/fool/detection.cpp
new file mode 100644
index 00000000000..b285bc1df27
--- /dev/null
+++ b/engines/fool/detection.cpp
@@ -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/>.
+ *
+ */
+
+#include "base/plugins.h"
+#include "common/config-manager.h"
+#include "common/file.h"
+#include "common/md5.h"
+#include "common/str-array.h"
+#include "common/translation.h"
+#include "common/util.h"
+#include "fool/detection.h"
+#include "fool/detection_tables.h"
+
+const DebugChannelDef FoolMetaEngineDetection::debugFlagList[] = {
+ { Fool::kDebugGraphics, "Graphics", "Graphics debug level" },
+ { Fool::kDebugPath, "Path", "Pathfinding debug level" },
+ { Fool::kDebugFilePath, "FilePath", "File path debug level" },
+ { Fool::kDebugScan, "Scan", "Scan for unrecognised games" },
+ { Fool::kDebugScript, "Script", "Enable debug script dump" },
+ DEBUG_CHANNEL_END
+};
+
+FoolMetaEngineDetection::FoolMetaEngineDetection() : AdvancedMetaEngineDetection(Fool::gameDescriptions,
+ sizeof(ADGameDescription), Fool::foolGames) {
+}
+
+REGISTER_PLUGIN_STATIC(FOOL_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, FoolMetaEngineDetection);
diff --git a/engines/fool/detection.h b/engines/fool/detection.h
new file mode 100644
index 00000000000..99238eedea1
--- /dev/null
+++ b/engines/fool/detection.h
@@ -0,0 +1,69 @@
+/* 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 FOOL_DETECTION_H
+#define FOOL_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Fool {
+
+enum FoolDebugChannels {
+ kDebugGraphics = 1 << 0,
+ kDebugPath = 1 << 1,
+ kDebugScan = 1 << 2,
+ kDebugFilePath = 1 << 3,
+ kDebugScript = 1 << 4,
+};
+
+extern const PlainGameDescriptor foolGames[];
+
+extern const ADGameDescription gameDescriptions[];
+
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+
+} // End of namespace Fool
+
+class FoolMetaEngineDetection : public AdvancedMetaEngineDetection {
+ static const DebugChannelDef debugFlagList[];
+
+public:
+ FoolMetaEngineDetection();
+ ~FoolMetaEngineDetection() override {}
+
+ const char *getName() const override {
+ return "fool";
+ }
+
+ const char *getEngineName() const override {
+ return "Fool";
+ }
+
+ const char *getOriginalCopyright() const override {
+ return "Fool (C)";
+ }
+
+ const DebugChannelDef *getDebugChannels() const override {
+ return debugFlagList;
+ }
+};
+
+#endif // FOOL_DETECTION_H
diff --git a/engines/fool/detection_tables.h b/engines/fool/detection_tables.h
new file mode 100644
index 00000000000..1b46b651a32
--- /dev/null
+++ b/engines/fool/detection_tables.h
@@ -0,0 +1,47 @@
+/* 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/platform.h"
+namespace Fool {
+
+const PlainGameDescriptor foolGames[] = {
+ { "fool", "The Fool's Errand" },
+ { "atc", "At The Carnival" },
+ { "3inthree", "3 in Three" },
+ { 0, 0 }
+};
+
+const ADGameDescription gameDescriptions[] = {
+ // The Fool's Errand - Version 2.0 July 25, 1988
+ {
+ "fool",
+ nullptr,
+ AD_ENTRY1s("file1.bin", "00000000000000000000000000000000", 11111),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Fool
diff --git a/engines/fool/events.cpp b/engines/fool/events.cpp
new file mode 100644
index 00000000000..62eae35d908
--- /dev/null
+++ b/engines/fool/events.cpp
@@ -0,0 +1,341 @@
+/* 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/config-manager.h"
+#include "graphics/screen.h"
+#include "fool/events.h"
+#include "fool/fool.h"
+#include "fool/views.h"
+
+namespace Fool {
+
+Events *g_events;
+
+Events::Events() : UIElement("Root", nullptr) {
+ g_events = this;
+}
+
+Events::~Events() {
+ g_events = nullptr;
+}
+
+void Events::runGame() {
+ uint currTime, nextFrameTime = 0;
+ _screen = new Graphics::Screen();
+ Views views; // Loads all views in the structure
+
+ // Run the game
+ int saveSlot = ConfMan.getInt("save_slot");
+ if (saveSlot != -1)
+ g_engine->loadGameState(saveSlot);
+
+ addView("View1");
+
+ Common::Event e;
+ while (!_views.empty() && !shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ if (e.type == Common::EVENT_QUIT ||
+ e.type == Common::EVENT_RETURN_TO_LAUNCHER) {
+ _views.clear();
+ break;
+ } else {
+ processEvent(e);
+ }
+ }
+
+ if (_views.empty())
+ break;
+
+ g_system->delayMillis(10);
+ if ((currTime = g_system->getMillis()) >= nextFrameTime) {
+ nextFrameTime = currTime + FRAME_DELAY;
+ tick();
+ drawElements();
+ _screen->update();
+ }
+ }
+
+ delete _screen;
+}
+
+void Events::processEvent(Common::Event &ev) {
+ switch (ev.type) {
+ case Common::EVENT_KEYDOWN:
+ if (ev.kbd.keycode < Common::KEYCODE_NUMLOCK)
+ msgKeypress(KeypressMessage(ev.kbd));
+ break;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ msgAction(ActionMessage(ev.customType));
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
+ //case Common::EVENT_MBUTTONDOWN:
+ msgMouseDown(MouseDownMessage(ev.type, ev.mouse));
+ break;
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
+ //case Common::EVENT_MBUTTONUP:
+ msgMouseUp(MouseUpMessage(ev.type, ev.mouse));
+ break;
+ default:
+ break;
+ }
+}
+
+void Events::replaceView(UIElement *ui, bool replaceAllViews) {
+ assert(ui);
+ UIElement *priorView = focusedView();
+
+ if (replaceAllViews) {
+ clearViews();
+
+ } else if (!_views.empty()) {
+ priorView->msgUnfocus(UnfocusMessage());
+ _views.pop();
+ }
+
+ _views.push(ui);
+ ui->redraw();
+ ui->msgFocus(FocusMessage(priorView));
+}
+
+void Events::replaceView(const Common::String &name, bool replaceAllViews) {
+ replaceView(findView(name));
+}
+
+void Events::addView(UIElement *ui) {
+ assert(ui);
+ UIElement *priorView = focusedView();
+
+ if (!_views.empty())
+ priorView->msgUnfocus(UnfocusMessage());
+
+ _views.push(ui);
+ ui->redraw();
+ ui->msgFocus(FocusMessage(priorView));
+}
+
+void Events::addView(const Common::String &name) {
+ addView(findView(name));
+}
+
+void Events::popView() {
+ UIElement *priorView = focusedView();
+ priorView->msgUnfocus(UnfocusMessage());
+ _views.pop();
+
+ for (int i = 0; i < (int)_views.size() - 1; ++i) {
+ _views[i]->redraw();
+ _views[i]->draw();
+ }
+
+ if (!_views.empty()) {
+ UIElement *view = focusedView();
+ view->msgFocus(FocusMessage(priorView));
+ view->redraw();
+ view->draw();
+ }
+}
+
+void Events::redrawViews() {
+ for (uint i = 0; i < _views.size(); ++i) {
+ _views[i]->redraw();
+ _views[i]->draw();
+ }
+}
+
+bool Events::isPresent(const Common::String &name) const {
+ for (uint i = 0; i < _views.size(); ++i) {
+ if (_views[i]->_name == name)
+ return true;
+ }
+
+ return false;
+}
+
+void Events::clearViews() {
+ if (!_views.empty())
+ focusedView()->msgUnfocus(UnfocusMessage());
+
+ _views.clear();
+}
+
+void Events::addKeypress(const Common::KeyCode kc) {
+ Common::KeyState ks;
+ ks.keycode = kc;
+ if (kc >= Common::KEYCODE_SPACE && kc <= Common::KEYCODE_TILDE)
+ ks.ascii = kc;
+
+ focusedView()->msgKeypress(KeypressMessage(ks));
+}
+
+/*------------------------------------------------------------------------*/
+
+Bounds::Bounds(Common::Rect &innerBounds) :
+ _bounds(0, 0, 320, 200),
+ _innerBounds(innerBounds),
+ left(_bounds.left), top(_bounds.top),
+ right(_bounds.right), bottom(_bounds.bottom) {
+}
+
+Bounds &Bounds::operator=(const Common::Rect &r) {
+ _bounds = r;
+ _innerBounds = r;
+ _innerBounds.grow(-_borderSize);
+ return *this;
+}
+
+void Bounds::setBorderSize(size_t borderSize) {
+ _borderSize = borderSize;
+ _innerBounds = *this;
+ _innerBounds.grow(-_borderSize);
+}
+
+/*------------------------------------------------------------------------*/
+
+UIElement::UIElement(const Common::String &name) :
+ _name(name), _parent(g_engine), _bounds(_innerBounds) {
+ g_engine->_children.push_back(this);
+}
+
+UIElement::UIElement(const Common::String &name, UIElement *uiParent) :
+ _name(name), _parent(uiParent),
+ _bounds(_innerBounds) {
+ if (_parent)
+ _parent->_children.push_back(this);
+}
+
+void UIElement::redraw() {
+ _needsRedraw = true;
+
+ for (size_t i = 0; i < _children.size(); ++i)
+ _children[i]->redraw();
+}
+
+void UIElement::drawElements() {
+ if (_needsRedraw) {
+ draw();
+ _needsRedraw = false;
+ }
+
+ for (size_t i = 0; i < _children.size(); ++i)
+ _children[i]->drawElements();
+}
+
+UIElement *UIElement::findViewGlobally(const Common::String &name) {
+ return g_events->findView(name);
+}
+
+void UIElement::focus() {
+ g_events->replaceView(this);
+}
+
+void UIElement::close() {
+ assert(g_events->focusedView() == this);
+ g_events->popView();
+}
+
+bool UIElement::isFocused() const {
+ return g_events->focusedView() == this;
+}
+
+void UIElement::clearSurface() {
+ Graphics::ManagedSurface s = getSurface();
+ s.fillRect(Common::Rect(s.w, s.h), 0);
+}
+
+void UIElement::draw() {
+ for (size_t i = 0; i < _children.size(); ++i) {
+ _children[i]->draw();
+ }
+}
+
+bool UIElement::tick() {
+ if (_timeoutCtr && --_timeoutCtr == 0) {
+ timeout();
+ }
+
+ for (size_t i = 0; i < _children.size(); ++i) {
+ if (_children[i]->tick())
+ return true;
+ }
+
+ return false;
+}
+
+UIElement *UIElement::findView(const Common::String &name) {
+ if (_name.equalsIgnoreCase(name))
+ return this;
+
+ UIElement *result;
+ for (size_t i = 0; i < _children.size(); ++i) {
+ if ((result = _children[i]->findView(name)) != nullptr)
+ return result;
+ }
+
+ return nullptr;
+}
+
+void UIElement::replaceView(UIElement *ui, bool replaceAllViews) {
+ g_events->replaceView(ui, replaceAllViews);
+}
+
+void UIElement::replaceView(const Common::String &name, bool replaceAllViews) {
+ g_events->replaceView(name, replaceAllViews);
+}
+
+void UIElement::addView(UIElement *ui) {
+ g_events->addView(ui);
+}
+
+void UIElement::addView(const Common::String &name) {
+ g_events->addView(name);
+}
+
+void UIElement::addView() {
+ g_events->addView(this);
+}
+
+Graphics::ManagedSurface UIElement::getSurface() const {
+ return Graphics::ManagedSurface(*g_events->getScreen(), _bounds);
+}
+
+int UIElement::getRandomNumber(int minNumber, int maxNumber) {
+ return g_engine->getRandomNumber(maxNumber - minNumber + 1) + minNumber;
+}
+
+int UIElement::getRandomNumber(int maxNumber) {
+ return g_engine->getRandomNumber(maxNumber);
+}
+
+void UIElement::delaySeconds(uint seconds) {
+ _timeoutCtr = seconds * FRAME_RATE;
+}
+
+void UIElement::delayFrames(uint frames) {
+ _timeoutCtr = frames;
+}
+
+void UIElement::timeout() {
+ redraw();
+}
+
+} // namespace Fool
diff --git a/engines/fool/events.h b/engines/fool/events.h
new file mode 100644
index 00000000000..65e6176eef3
--- /dev/null
+++ b/engines/fool/events.h
@@ -0,0 +1,386 @@
+/* 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 FOOL_EVENTS_H
+#define FOOL_EVENTS_H
+
+#include "common/array.h"
+#include "common/stack.h"
+#include "graphics/screen.h"
+#include "fool/messages.h"
+
+namespace Fool {
+
+#define FRAME_RATE 20
+#define FRAME_DELAY (1000 / FRAME_RATE)
+
+class Events;
+
+/**
+ * Implements a thunk layer around an element's bounds,
+ * allowing access to it as if it were a simple Common::Rect,
+ * but any changes to it will also be applied to a linked inner bounds
+ */
+struct Bounds {
+private:
+ Common::Rect _bounds;
+ Common::Rect &_innerBounds;
+ int _borderSize = 0;
+public:
+ const int16 &left;
+ const int16 ⊤
+ const int16 &right;
+ const int16 ⊥
+public:
+ Bounds(Common::Rect &innerBounds);
+ operator const Common::Rect &() const { return _bounds; }
+ Bounds &operator=(const Common::Rect &r);
+ void setBorderSize(size_t borderSize);
+ size_t borderSize() const { return _borderSize; }
+ int16 width() const { return _bounds.width(); }
+ int16 height() const { return _bounds.height(); }
+};
+
+/**
+ * User interface element
+ */
+class UIElement {
+ friend class Events;
+private:
+ int _timeoutCtr = 0;
+protected:
+ UIElement *_parent;
+ Common::Array<UIElement *> _children;
+ Common::Rect _innerBounds;
+ Bounds _bounds;
+ bool _needsRedraw = true;
+ Common::String _name;
+protected:
+ /**
+ * Set a delay countdown in seconds, after which timeout() is called
+ */
+ void delaySeconds(uint seconds);
+
+ /**
+ * Set a delay countdown in frames, after which timeout() is called
+ */
+ void delayFrames(uint frames);
+
+ /**
+ * Returns true if a delay is active
+ */
+ bool isDelayActive() const {
+ return _timeoutCtr != 0;
+ }
+
+ /**
+ * Cancels any active delay
+ */
+ void cancelDelay() {
+ _timeoutCtr = 0;
+ }
+
+ /**
+ * Called when an active timeout countdown expired
+ */
+ virtual void timeout();
+
+private:
+ /**
+ * Outer method for doing drawing
+ *
+ */
+ void drawElements();
+
+ /**
+ * Finds a view globally
+ */
+ static UIElement *findViewGlobally(const Common::String &name);
+public:
+ UIElement(const Common::String &name, UIElement *uiParent);
+ UIElement(const Common::String &name);
+ virtual ~UIElement() {}
+
+ /**
+ * Returns true if the elements needs to be redrawn
+ */
+ bool needsRedraw() const { return _needsRedraw; }
+
+ /**
+ * Sets that the element needs to be redrawn
+ */
+ void redraw();
+
+ /**
+ * Focuses the element as the current view
+ */
+ void focus();
+
+ /**
+ * Closes the current view. The view must have been added
+ * via addView, so there's a remaining view afterwards
+ */
+ virtual void close();
+
+ /*
+ * Returns true if the view is focused
+ */
+ bool isFocused() const;
+
+ /**
+ * Sets the focus to a new view
+ */
+ void replaceView(UIElement *ui, bool replaceAllViews = false);
+ void replaceView(const Common::String &name, bool replaceAllViews = false);
+
+ /**
+ * Adds a focused view to the view stack without replacing current one
+ */
+ void addView(UIElement *ui);
+ void addView(const Common::String &name);
+ void addView();
+ void open() { addView(); }
+
+ /**
+ * Returns a random number
+ */
+ int getRandomNumber(int minNumber, int maxNumber);
+ int getRandomNumber(int maxNumber);
+
+ /**
+ * Sets the element's bounds
+ */
+ virtual void setBounds(const Common::Rect &r) {
+ _bounds = r;
+ }
+
+ /**
+ * Gets the element's bounds
+ */
+ Common::Rect getBounds() const {
+ return _bounds;
+ }
+
+ /**
+ * Returns a surface for drawing the element
+ */
+ Graphics::ManagedSurface getSurface() const;
+
+ /**
+ * Clear the surface
+ */
+ virtual void clearSurface();
+
+ /**
+ * Draws the element
+ */
+ virtual void draw();
+
+ /**
+ * Called for game frame ticks
+ */
+ virtual bool tick();
+
+ /**
+ * Find a view by name
+ */
+ virtual UIElement *findView(const Common::String &name);
+
+ /**
+ * Handles events
+ */
+ #define MESSAGE(NAME) \
+ protected: \
+ virtual bool msg##NAME(const NAME##Message &e) { \
+ for (Common::Array<UIElement *>::iterator it = _children.begin(); \
+ it != _children.end(); ++it) { \
+ if ((*it)->msg##NAME(e)) return true; \
+ } \
+ return false; \
+ } \
+ public: \
+ bool send(const Common::String &viewName, const NAME##Message &msg) { \
+ UIElement *view = UIElement::findViewGlobally(viewName); \
+ assert(view); \
+ return view->msg##NAME(msg); \
+ } \
+ bool send(const NAME##Message &msg) { \
+ return send("Root", msg); \
+ } \
+
+ MESSAGE(Focus);
+ MESSAGE(Unfocus);
+ MESSAGE(Keypress);
+ MESSAGE(MouseDown);
+ MESSAGE(MouseUp);
+ MESSAGE(Action);
+ MESSAGE(Game);
+ MESSAGE(Value);
+ #undef MESSAGE
+};
+
+/**
+ * Main events and view manager. This is kept separate from the engine
+ * class because the engine may add a lot of globals and bring in other
+ * classes. So to save on compilation time, classes that only need to
+ * access basic view management methods like addView or replaceView
+ * only need to include events.h rather than the whole engine.
+ */
+class Events : public UIElement {
+private:
+ Graphics::Screen *_screen = nullptr;
+ Common::Stack<UIElement *> _views;
+protected:
+ /**
+ * Process an event
+ */
+ void processEvent(Common::Event &ev);
+
+ /**
+ * Returns true if the game should quit
+ */
+ virtual bool shouldQuit() const = 0;
+
+ /**
+ * Overrides events we want to only go to the focused view
+ */
+ #define MESSAGE(NAME) \
+ bool msg##NAME(const NAME##Message &e) override { \
+ return !_views.empty() ? focusedView()->msg##NAME(e) : false; \
+ }
+ MESSAGE(Action);
+ MESSAGE(Focus);
+ MESSAGE(Unfocus);
+ MESSAGE(Keypress);
+ MESSAGE(MouseDown);
+ MESSAGE(MouseUp);
+ #undef MESSAGE
+public:
+ Events();
+ virtual ~Events();
+
+ /**
+ * Main game loop
+ */
+ void runGame();
+
+ /**
+ * Sets the focus to a new view
+ */
+ void replaceView(UIElement *ui, bool replaceAllViews = false);
+ void replaceView(const Common::String &name, bool replaceAllViews = false);
+
+ /**
+ * Adds a focused view to the view stack without replacing current one
+ */
+ void addView(UIElement *ui);
+ void addView(const Common::String &name);
+
+ /**
+ * Clears the view list
+ */
+ void clearViews();
+
+ /**
+ * Pops a view from the view stack
+ */
+ void popView();
+
+ /**
+ * Redraws the views in order. This is used in rare cases
+ * where a view draws outside it's defined area, and needs
+ * to restore whether the background was before
+ */
+ void redrawViews();
+
+ /**
+ * Returns the currently focused view, if any
+ */
+ UIElement *focusedView() const {
+ return _views.empty() ? nullptr : _views.top();
+ }
+
+ /**
+ * Returns the view prior to the current view, if any
+ */
+ UIElement *priorView() const {
+ return _views.size() < 2 ? nullptr :
+ _views[_views.size() - 2];
+ }
+
+ /**
+ * Returns true if a view of a given name is present
+ * at all in the visible view stack
+ */
+ bool isPresent(const Common::String &name) const;
+
+ /**
+ * Returns true if combat is active
+ */
+ bool isInCombat() const {
+ return isPresent("Combat");
+ }
+
+ /**
+ * Returns the underlying screen
+ */
+ Graphics::Screen *getScreen() const {
+ return _screen;
+ }
+
+ /**
+ * Draws the focused view
+ */
+ void drawElements() {
+ if (!_views.empty())
+ focusedView()->drawElements();
+ }
+
+ /**
+ * Add a keypress to the event queue
+ */
+ void addKeypress(const Common::KeyCode kc);
+
+ /**
+ * Events manager doesn't have any intrinsic drawing
+ */
+ void draw() override {}
+
+ /**
+ * Called once every game frame
+ */
+ bool tick() override {
+ return !_views.empty() ? focusedView()->tick() : false;
+ }
+
+ /**
+ * Calling the close method for g_events closes the active view
+ */
+ void close() override {
+ focusedView()->close();
+ }
+};
+
+extern Events *g_events;
+
+} // namespace Fool
+
+#endif
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
new file mode 100644
index 00000000000..6ec04fb7fc5
--- /dev/null
+++ b/engines/fool/fool.cpp
@@ -0,0 +1,76 @@
+/* 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 "fool/fool.h"
+#include "fool/detection.h"
+#include "fool/console.h"
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "engines/util.h"
+#include "graphics/palette.h"
+
+namespace Fool {
+
+FoolEngine *g_engine;
+
+FoolEngine::FoolEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
+ _gameDescription(gameDesc), _randomSource("Fool") {
+ g_engine = this;
+}
+
+FoolEngine::~FoolEngine() {
+}
+
+uint32 FoolEngine::getFeatures() const {
+ return _gameDescription->flags;
+}
+
+Common::String FoolEngine::getGameId() const {
+ return _gameDescription->gameId;
+}
+
+Common::Error FoolEngine::run() {
+ // Initialize 320x200 paletted graphics mode
+ initGraphics(320, 200);
+
+ // Set the engine's debugger console
+ setDebugger(new Console());
+
+ runGame();
+
+ return Common::kNoError;
+}
+
+Common::Error FoolEngine::syncGame(Common::Serializer &s) {
+ // The Serializer has methods isLoading() and isSaving()
+ // if you need to specific steps; for example setting
+ // an array size after reading it's length, whereas
+ // for saving it would write the existing array's length
+ int dummy = 0;
+ s.syncAsUint32LE(dummy);
+
+ return Common::kNoError;
+}
+
+} // End of namespace Fool
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
new file mode 100644
index 00000000000..8de978fd4ba
--- /dev/null
+++ b/engines/fool/fool.h
@@ -0,0 +1,112 @@
+/* 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 FOOL_H
+#define FOOL_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/hash-str.h"
+#include "common/random.h"
+#include "common/serializer.h"
+#include "common/util.h"
+#include "engines/engine.h"
+#include "engines/savestate.h"
+#include "graphics/screen.h"
+
+#include "fool/detection.h"
+#include "fool/events.h"
+
+namespace Fool {
+
+struct FoolGameDescription;
+
+class FoolEngine : public Engine, public Events {
+private:
+ const ADGameDescription *_gameDescription;
+ Common::RandomSource _randomSource;
+protected:
+ // Engine APIs
+ Common::Error run() override;
+
+ /**
+ * Returns true if the game should quit
+ */
+ bool shouldQuit() const override {
+ return Engine::shouldQuit();
+ }
+
+public:
+ FoolEngine(OSystem *syst, const ADGameDescription *gameDesc);
+ ~FoolEngine() override;
+
+ uint32 getFeatures() const;
+
+ /**
+ * Returns the game Id
+ */
+ Common::String getGameId() const;
+
+ /**
+ * Gets a random number
+ */
+ uint32 getRandomNumber(uint maxNum) {
+ return _randomSource.getRandomNumber(maxNum);
+ }
+
+ bool hasFeature(EngineFeature f) const override {
+ return
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsReturnToLauncher);
+ };
+
+ bool canLoadGameStateCurrently() override {
+ return true;
+ }
+ bool canSaveGameStateCurrently() override {
+ return true;
+ }
+
+ /**
+ * Uses a serializer to allow implementing savegame
+ * loading and saving using a single method
+ */
+ Common::Error syncGame(Common::Serializer &s);
+
+ Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
+ Common::Serializer s(nullptr, stream);
+ return syncGame(s);
+ }
+ Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
+ Common::Serializer s(stream, nullptr);
+ return syncGame(s);
+ }
+};
+
+extern FoolEngine *g_engine;
+#define SHOULD_QUIT ::Fool::g_engine->shouldQuit()
+
+} // End of namespace Fool
+
+#endif // FOOL_H
diff --git a/engines/fool/messages.cpp b/engines/fool/messages.cpp
new file mode 100644
index 00000000000..9884ea13f1a
--- /dev/null
+++ b/engines/fool/messages.cpp
@@ -0,0 +1,41 @@
+/* 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 "fool/messages.h"
+
+namespace Fool {
+
+MouseMessage::MouseMessage(Common::EventType type,
+ const Common::Point &pos) : Message(), _pos(pos) {
+ switch (type) {
+ case Common::EVENT_RBUTTONUP:
+ _button = MB_RIGHT;
+ break;
+ case Common::EVENT_MBUTTONUP:
+ _button = MB_MIDDLE;
+ break;
+ default:
+ _button = MB_LEFT;
+ break;
+ }
+}
+
+} // namespace Fool
diff --git a/engines/fool/messages.h b/engines/fool/messages.h
new file mode 100644
index 00000000000..00cd94c260e
--- /dev/null
+++ b/engines/fool/messages.h
@@ -0,0 +1,108 @@
+/* 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 FOOL_MESSAGES_H
+#define FOOL_MESSAGES_H
+
+#include "common/array.h"
+#include "common/events.h"
+#include "common/str.h"
+
+namespace Fool {
+
+class UIElement;
+
+struct Message {};
+
+struct FocusMessage : public Message {
+ UIElement *_priorView = nullptr;
+ FocusMessage() : Message() {}
+ FocusMessage(UIElement *priorView) : Message(),
+ _priorView(priorView) {}
+};
+
+struct UnfocusMessage : public Message {};
+
+struct KeypressMessage : public Message, public Common::KeyState {
+ KeypressMessage() : Message() {}
+ KeypressMessage(const Common::KeyState &ks) :
+ Message(), Common::KeyState(ks) {}
+};
+
+struct MouseMessage : public Message {
+ enum Button { MB_LEFT, MB_RIGHT, MB_MIDDLE };
+ Button _button;
+ Common::Point _pos;
+
+ MouseMessage() : Message(), _button(MB_LEFT) {}
+ MouseMessage(Button btn, const Common::Point &pos) :
+ Message(), _button(btn), _pos(pos) {}
+ MouseMessage(Common::EventType type, const Common::Point &pos);
+};
+struct MouseDownMessage : public MouseMessage {
+ MouseDownMessage() : MouseMessage() {}
+ MouseDownMessage(Button btn, const Common::Point &pos) :
+ MouseMessage(btn, pos) {}
+ MouseDownMessage(Common::EventType type, const Common::Point &pos) :
+ MouseMessage(type, pos) {}
+};
+struct MouseUpMessage : public MouseMessage {
+ MouseUpMessage() : MouseMessage() {}
+ MouseUpMessage(Button btn, const Common::Point &pos) :
+ MouseMessage(btn, pos) {}
+ MouseUpMessage(Common::EventType type, const Common::Point &pos) :
+ MouseMessage(type, pos) {}
+};
+
+struct GameMessage : public Message {
+ Common::String _name;
+ int _value;
+ Common::String _stringValue;
+
+ GameMessage() : Message(), _value(-1) {}
+ GameMessage(const Common::String &name) : Message(),
+ _name(name), _value(-1) {}
+ GameMessage(const Common::String &name, int value) : Message(),
+ _name(name), _value(value) {}
+ GameMessage(const Common::String &name, const Common::String &value) :
+ Message(), _name(name), _stringValue(value) {}
+};
+
+struct ValueMessage : public Message {
+ int _value;
+
+ ValueMessage() : Message(), _value(0) {}
+ ValueMessage(int value) : Message(),
+ _value(value) {}
+};
+
+struct ActionMessage : public Message {
+ int _action;
+ ActionMessage() : Message(), _action(0) {
+ }
+ ActionMessage(int action) : Message(),
+ _action(action) {
+ }
+};
+
+} // namespace Fool
+
+#endif
diff --git a/engines/fool/metaengine.cpp b/engines/fool/metaengine.cpp
new file mode 100644
index 00000000000..15127cf711b
--- /dev/null
+++ b/engines/fool/metaengine.cpp
@@ -0,0 +1,69 @@
+/* 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/translation.h"
+
+#include "fool/metaengine.h"
+#include "fool/detection.h"
+#include "fool/fool.h"
+
+namespace Fool {
+
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_ORIGINAL_SAVELOAD,
+ {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens instead of the ScummVM ones"),
+ "original_menus",
+ false,
+ 0,
+ 0
+ }
+ },
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
+} // End of namespace Fool
+
+const char *FoolMetaEngine::getName() const {
+ return "fool";
+}
+
+const ADExtraGuiOptionsMap *FoolMetaEngine::getAdvancedExtraGuiOptions() const {
+ return Fool::optionsList;
+}
+
+Common::Error FoolMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ *engine = new Fool::FoolEngine(syst, desc);
+ return Common::kNoError;
+}
+
+bool FoolMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return checkExtendedSaves(f) ||
+ (f == kSupportsLoadingDuringStartup);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(FOOL)
+REGISTER_PLUGIN_DYNAMIC(FOOL, PLUGIN_TYPE_ENGINE, FoolMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(FOOL, PLUGIN_TYPE_ENGINE, FoolMetaEngine);
+#endif
diff --git a/engines/fool/metaengine.h b/engines/fool/metaengine.h
new file mode 100644
index 00000000000..10b87326aab
--- /dev/null
+++ b/engines/fool/metaengine.h
@@ -0,0 +1,43 @@
+/* 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 FOOL_METAENGINE_H
+#define FOOL_METAENGINE_H
+
+#include "engines/advancedDetector.h"
+
+class FoolMetaEngine : public AdvancedMetaEngine {
+public:
+ const char *getName() const override;
+
+ Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+
+ /**
+ * Determine whether the engine supports the specified MetaEngine feature.
+ *
+ * Used by e.g. the launcher to determine whether to enable the Load button.
+ */
+ bool hasFeature(MetaEngineFeature f) const override;
+
+ const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+};
+
+#endif // FOOL_METAENGINE_H
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
new file mode 100644
index 00000000000..c1d4d898025
--- /dev/null
+++ b/engines/fool/module.mk
@@ -0,0 +1,20 @@
+MODULE := engines/fool
+
+MODULE_OBJS = \
+ fool.o \
+ console.o \
+ events.o \
+ messages.o \
+ metaengine.o \
+ view1.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_FOOL), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
diff --git a/engines/fool/view1.cpp b/engines/fool/view1.cpp
new file mode 100644
index 00000000000..d6707f4859e
--- /dev/null
+++ b/engines/fool/view1.cpp
@@ -0,0 +1,64 @@
+/* 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/system.h"
+#include "graphics/palette.h"
+#include "fool/view1.h"
+
+namespace Fool {
+
+bool View1::msgFocus(const FocusMessage &msg) {
+ Common::fill(&_pal[0], &_pal[256 * 3], 0);
+ _offset = 128;
+ return true;
+}
+
+bool View1::msgKeypress(const KeypressMessage &msg) {
+ // Any keypress to close the view
+ close();
+ return true;
+}
+
+void View1::draw() {
+ // Draw a bunch of squares on screen
+ Graphics::ManagedSurface s = getSurface();
+
+ for (int i = 0; i < 100; ++i)
+ s.frameRect(Common::Rect(i, i, 320 - i, 200 - i), i);
+}
+
+bool View1::tick() {
+ // Cycle the palette
+ ++_offset;
+ for (int i = 0; i < 256; ++i)
+ _pal[i * 3 + 1] = (i + _offset) % 256;
+ g_system->getPaletteManager()->setPalette(_pal, 0, 256);
+
+ // Below is redundant since we're only cycling the palette, but it demonstrates
+ // how to trigger the view to do further draws after the first time, since views
+ // don't automatically keep redrawing unless you tell it to
+ if ((_offset % 256) == 0)
+ redraw();
+
+ return true;
+}
+
+} // namespace Fool
diff --git a/engines/fool/view1.h b/engines/fool/view1.h
new file mode 100644
index 00000000000..67dd33fc603
--- /dev/null
+++ b/engines/fool/view1.h
@@ -0,0 +1,46 @@
+/* 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 FOOL_VIEW1_H
+#define FOOL_VIEW1_H
+
+#include "fool/events.h"
+
+namespace Fool {
+
+class View1 : public UIElement {
+private:
+ byte _pal[256 * 3] = { 0 };
+ int _offset = 0;
+
+public:
+ View1() : UIElement("View1") {}
+ virtual ~View1() {}
+
+ bool msgFocus(const FocusMessage &msg) override;
+ bool msgKeypress(const KeypressMessage &msg) override;
+ void draw() override;
+ bool tick() override;
+};
+
+} // namespace Fool
+
+#endif
diff --git a/engines/fool/views.h b/engines/fool/views.h
new file mode 100644
index 00000000000..2745813eef2
--- /dev/null
+++ b/engines/fool/views.h
@@ -0,0 +1,35 @@
+/* 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 FOOL_VIEWS_H
+#define FOOL_VIEWS_H
+
+#include "fool/view1.h"
+
+namespace Fool {
+
+struct Views {
+ View1 _view1;
+};
+
+} // namespace Fool
+
+#endif
Commit: 9399b5438b07bf133e6b7cd72f8c59f0ba8583c2
https://github.com/scummvm/scummvm/commit/9399b5438b07bf133e6b7cd72f8c59f0ba8583c2
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:44+02:00
Commit Message:
FOOL: Initial translation of fool_prologue
Changed paths:
A engines/fool/fool_prologue.cpp
A engines/fool/fool_prologue.h
A engines/fool/toolbox.cpp
A engines/fool/toolbox.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
new file mode 100644
index 00000000000..cde9f824e07
--- /dev/null
+++ b/engines/fool/fool_prologue.cpp
@@ -0,0 +1,2772 @@
+/* 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 <cstdint>
+#include <cstdlib>
+
+#include "fool/fool_prologue.h"
+
+namespace Fool {
+
+void FoolPrologue::run() {
+
+/*
+Found custom CODE block 128
+0x0004: JSR - "ZBASIC_176"
+0x0008: TRAP - _ClearMenuBar
+0x000a: TRAP - _HideCursor
+0x000c: PUSH.W - 0 (unsafe)
+0x000e: TRAP - _CurResFile
+0x0010: POP.W - D0
+0x0012: EXT.L - D0
+0x0014: MOVE.W - D0,VAR(0x0)
+0x0018: PUSH.W - VAR(0x0)
+0x001c: TRAP - _UseResFile
+*/
+ g_toolbox->ClearMenuBar();
+ g_toolbox->HideCursor();
+
+/*
+0x001e: MOVEQ - 0x0,D0
+0x0020: MOVE.W - D0,VAR(0x74)
+
+0x0024: MOVE.W - VAR(0x74),D0
+0x0028: EXT.L - D0
+0x002a: LSL.L - 0x2,D0
+0x002c: ADDI.L - HEAP(0x41296),D0
+0x0036: PUSH.L - D0
+0x0038: MOVE.W - VAR(0x74),D0
+0x003c: EXT.L - D0
+0x003e: MOVE.L - D0,D1
+0x0040: MOVE.L - 0x2ac0,D0
+0x0046: JSR - "MUL_INT"
+0x004a: LSL.L - 0x1,D0
+0x004c: ADDI.L - HEAP(0xb54),D0
+0x0056: POP.L - A0
+0x0058: MOVE.L - D0,(A0)
+0x005a: MOVEQ - 0xb,D0
+0x005c: ADDQ.W - 0x1,VAR(0x74)
+0x0060: CMP.W - VAR(0x74),D0
+0x0064: BGE - [0x0024]
+*/
+ // 128:001e
+ // b54 must be the 1-bit screen double buffer?
+ for (int i = 0; i < 12; i++) {
+ this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i]
+
+ }
+/*
+0x0066: MOVE.L - HEAP(0x412c2),D0
+0x0070: MOVEA.L - D0,A0
+0x0072: MOVE.L - (A0),D0
+0x0074: MOVE.L - D0,VAR(0x4e)
+*/
+ // 128:0066
+ this->var_i32_4e = this->arr_i32_412c2[0];
+ /*
+0x0078: MOVEQ - 0x0,D0
+0x007a: MOVE.W - D0,VAR(0x74)
+
+0x007e: MOVEQ - 0x0,D0
+0x0080: MOVEA.W - VAR(0x74),A0
+0x0084: ADD.L - A0,D0
+0x0086: LSL.L - 0x1,D0
+0x0088: ADDI.L - HEAP(0x194),D0
+0x0092: MOVEA.L - D0,A0
+0x0094: CLR.W - (A0)
+
+0x0096: MOVEQ - 0x4,D0
+0x0098: MOVEA.W - VAR(0x74),A0
+0x009c: ADD.L - A0,D0
+0x009e: LSL.L - 0x1,D0
+0x00a0: ADDI.L - HEAP(0x194),D0
+0x00aa: MOVEA.L - D0,A0
+0x00ac: MOVE.W - 0xaa55,(A0)
+
+0x00b0: MOVEQ - 0x8,D0
+0x00b2: MOVEA.W - VAR(0x74),A0
+0x00b6: ADD.L - A0,D0
+0x00b8: LSL.L - 0x1,D0
+0x00ba: ADDI.L - HEAP(0x194),D0
+0x00c4: MOVEA.L - D0,A0
+0x00c6: MOVEQ - -0x1,D0
+0x00c8: MOVE.W - D0,(A0)
+
+0x00ca: MOVEQ - 0x3,D0
+0x00cc: ADDQ.W - 0x1,VAR(0x74)
+0x00d0: CMP.W - VAR(0x74),D0
+0x00d4: BGE - [0x007e]
+*/
+ // 128:0078
+ // stipple pattern buffer?
+ for (int i = 0; i < 3; i++) {
+ this->arr_i16_194[i] = 0;
+ this->arr_i16_194[i+4] = 0xaa55;
+ this->arr_i16_194[i+8] = 0xffff;
+ }
+
+ /*
+0x00d6: MOVE.L - HEAP(0x1ac),D0
+0x00e0: MOVEA.L - D0,A0
+0x00e2: MOVE.W - 0x107,(A0)
+
+0x00e6: MOVEQ - 0xc,D0
+0x00e8: ADDQ.L - 0x1,D0
+0x00ea: LSL.L - 0x1,D0
+0x00ec: ADDI.L - HEAP(0x194),D0
+0x00f6: MOVEA.L - D0,A0
+0x00f8: MOVE.W - 0xe0c,(A0)
+
+0x00fc: MOVEQ - 0xc,D0
+0x00fe: ADDQ.L - 0x2,D0
+0x0100: LSL.L - 0x1,D0
+0x0102: ADDI.L - HEAP(0x194),D0
+0x010c: MOVEA.L - D0,A0
+0x010e: MOVE.W - 0x7c70,(A0)
+
+0x0112: MOVEQ - 0xc,D0
+0x0114: ADDQ.L - 0x3,D0
+0x0116: LSL.L - 0x1,D0
+0x0118: ADDI.L - HEAP(0x194),D0
+0x0122: MOVEA.L - D0,A0
+0x0124: MOVE.W - 0xc0c0,(A0)
+
+0x0128: MOVE.L - HEAP(0x1b4),D0
+0x0132: MOVEA.L - D0,A0
+0x0134: MOVE.W - 0x8800,(A0)
+
+0x0138: MOVEQ - 0x10,D0
+0x013a: ADDQ.L - 0x1,D0
+0x013c: LSL.L - 0x1,D0
+0x013e: ADDI.L - HEAP(0x194),D0
+0x0148: MOVEA.L - D0,A0
+0x014a: MOVE.W - 0x2200,(A0)
+
+0x014e: MOVEQ - 0x10,D0
+0x0150: ADDQ.L - 0x2,D0
+0x0152: LSL.L - 0x1,D0
+0x0154: ADDI.L - HEAP(0x194),D0
+0x015e: MOVEA.L - D0,A0
+0x0160: MOVE.W - 0x8800,(A0)
+
+0x0164: MOVEQ - 0x10,D0
+0x0166: ADDQ.L - 0x3,D0
+0x0168: LSL.L - 0x1,D0
+0x016a: ADDI.L - HEAP(0x194),D0
+0x0174: MOVEA.L - D0,A0
+0x0176: MOVE.W - 0x2200,(A0)
+
+*/
+ // 128:00d6
+ this->arr_i16_1ac[0] = 0x0107;
+ this->arr_i16_194[0xd] = 0x0e0c;
+ this->arr_i16_194[0xe] = 0x7c70;
+ this->arr_i16_194[0xf] = 0xc0c0;
+ this->arr_i16_1b4[0] = 0x8800;
+ this->arr_i16_194[0x11] = 0x2200;
+ this->arr_i16_194[0x12] = 0x8800;
+ this->arr_i16_194[0x13] = 0x2200;
+
+ /*
+0x017a: MOVEA.L - STR(0x0),A0 # b'\xa9 1987 by Cliff Johnson ALL RIGHTS RESERVED'
+0x0182: JSR - "BUFFER_CONCAT"
+0x0186: LEA - VAR(0x76),A0
+0x018a: JSR - "BUFFER_FLUSH"
+0x018e: MOVEA.L - STR(0x2c),A0 # b'This software was created using the ZBasic\xaa compiler.'
+0x0196: JSR - "BUFFER_CONCAT"
+0x019a: LEA - VAR(0x76),A0
+0x019e: JSR - "BUFFER_FLUSH"
+0x01a2: MOVEA.L - STR(0x62),A0 # b'Portions of this code are \xa9 Copyrighted, 1985 by Zedcor Inc.'
+0x01aa: JSR - "BUFFER_CONCAT"
+0x01ae: LEA - VAR(0x76),A0
+0x01b2: JSR - "BUFFER_FLUSH"
+*/
+ //this->var_str_76 = STR(0x0);
+ //this->var_str_76 = STR(0x2c);
+ //this->var_str_76 = STR(0x62);
+}
+
+/*
+0x01b6: JMP - [0x1f0]
+--------
+*/
+/*
+0x01ba: MOVE.W - D0,VAR(0x176)
+0x01be: MOVE.W - VAR(0x176),D0
+0x01c2: EXT.L - D0
+0x01c4: LSL.L - 0x2,D0
+0x01c6: ADDI.L - HEAP(0x41296),D0
+0x01d0: MOVEA.L - D0,A0
+0x01d2: MOVE.L - (A0),D0
+0x01d4: MOVE.L - D0,VAR(0x40)
+0x01d8: PEA - VAR(0x32)
+0x01dc: PEA - VAR(0x40)
+0x01e0: PEA - VAR(0x38)
+0x01e4: PEA - VAR(0x38)
+0x01e8: PUSH.W - 0
+0x01ea: PUSH.L - 0
+0x01ec: TRAP - _CopyBits
+0x01ee: RTS
+*/
+void FoolPrologue::sub_128_1ba(int16_t screen_page) {
+ this->var_40 = &this->arr_i32_41296[screen_page];
+ g_toolbox->CopyBits(this->var_32, this->var_40, this->var_38, this->var_38, 0, 0);
+}
+ /*
+--------
+0x01f0: JMP - [0x21a]
+--------
+0x01f4: MOVE.W - D0,VAR(0x176)
+0x01f8: MOVE.W - VAR(0x176),D0
+0x01fc: EXT.L - D0
+0x01fe: LSL.L - 0x2,D0
+0x0200: ADDI.L - HEAP(0x41296),D0
+0x020a: MOVEA.L - D0,A0
+0x020c: MOVE.L - (A0),D0
+0x020e: MOVE.L - D0,VAR(0x40)
+0x0212: PEA - VAR(0x40)
+0x0216: TRAP - _SetPortBits
+0x0218: RTS
+--------
+*/
+void FoolPrologue::sub_128_1f4(int16_t screen_page) {
+ this->var_40 = &this->arr_i32_41296[screen_page];
+ g_toolbox->SetPortBits(this->var_40);
+}
+/*
+
+0x021a: JMP - [0x246]
+--------
+0x021e: MOVE.W - D0,VAR(0x178)
+0x0222: PUSH.L - 0 (unsafe)
+0x0224: TRAP - _TickCount
+0x0226: POP.L - D0
+0x0228: MOVE.L - D0,VAR(0x17a)
+0x022c: PUSH.L - 0 (unsafe)
+0x022e: TRAP - _TickCount
+0x0230: POP.L - D0
+0x0232: PUSH.L - D0
+0x0234: MOVE.L - VAR(0x17a),D0
+0x0238: MOVEA.W - VAR(0x178),A0
+0x023c: ADD.L - A0,D0
+0x023e: POP.L - D1
+0x0240: CMP.L - D0,D1
+0x0242: BLT - [0x022c]
+0x0244: RTS
+--------
+*/
+void FoolPrologue::sub_128_21e(int16_t numTicks) {
+ // original code would poll TickCount in a loop,
+ // effectively the same as Delay
+ g_toolbox->Delay(numTicks);
+}
+/*
+
+0x0246: JMP - [0x268]
+--------
+0x024a: MOVE.W - D0,VAR(0x17e)
+0x024e: PUSH.L - 0 (unsafe)
+0x0250: TRAP - _TickCount
+0x0252: POP.L - D0
+0x0254: PUSH.L - D0
+0x0256: MOVE.L - VAR(0x2),D0
+0x025a: MOVEA.W - VAR(0x17e),A0
+0x025e: ADD.L - A0,D0
+0x0260: POP.L - D1
+0x0262: CMP.L - D0,D1
+0x0264: BLE - [0x024e]
+0x0266: RTS
+--------
+*/
+void FoolPrologue::sub_128_24a(int16_t numTicks) {
+ int32_t delay = MAX(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
+ g_toolbox->Delay(delay);
+}
+/*
+0x0268: JMP - [0x2a2]
+--------
+0x026c: MOVE.W - D0,VAR(0x180)
+0x0270: POP.L - D0
+0x0272: MOVE.W - D0,VAR(0x176)
+0x0276: PUSH.W - 0 (unsafe)
+0x0278: PEA - VAR(0x76)
+0x027c: TRAP - _StringWidth
+0x027e: POP.W - D0
+0x0280: EXT.L - D0
+0x0282: MOVE.W - D0,VAR(0x182)
+0x0286: MOVE.W - VAR(0x176),D0
+0x028a: EXT.L - D0
+0x028c: MOVEA.W - VAR(0x182),A0
+0x0290: SUB.L - A0,D0
+0x0292: PUSH.W - D0
+0x0294: PUSH.W - VAR(0x180)
+0x0298: TRAP - _MoveTo
+0x029a: PEA - VAR(0x76)
+0x029e: TRAP - _DrawString
+0x02a0: RTS
+*/
+void FoolPrologue::sub_128_26c(int16_t unk1, int16_t unk2) {
+ this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
+ g_toolbox->MoveTo(this->var_i32_182 - unk2, unk1);
+ g_toolbox->DrawString(this->var_str_76);
+}
+/*
+--------
+0x02a2: JMP - [0x2ec]
+--------
+0x02a6: MOVE.W - D0,VAR(0x180)
+0x02aa: POP.L - D0
+0x02ac: MOVE.W - D0,VAR(0x176)
+0x02b0: PUSH.W - 0 (unsafe)
+0x02b2: PEA - VAR(0x76)
+0x02b6: TRAP - _StringWidth
+0x02b8: POP.W - D0
+0x02ba: EXT.L - D0
+0x02bc: MOVE.W - D0,VAR(0x182)
+0x02c0: MOVE.W - VAR(0x176),D0
+0x02c4: EXT.L - D0
+0x02c6: PUSH.L - D0
+0x02c8: MOVE.W - VAR(0x182),D0
+0x02cc: EXT.L - D0
+0x02ce: MOVE.L - D0,D1
+0x02d0: MOVEQ - 0x2,D0
+0x02d2: JSR - "DIV_INT"
+0x02d6: POP.L - D1
+0x02d8: EXG - D0,D1
+0x02da: SUB.L - D1,D0
+0x02dc: PUSH.W - D0
+0x02de: PUSH.W - VAR(0x180)
+0x02e2: TRAP - _MoveTo
+0x02e4: PEA - VAR(0x76)
+0x02e8: TRAP - _DrawString
+0x02ea: RTS
+--------
+*/
+void FoolPrologue::sub_128_2a6(int16_t unk1, int16_t unk2) {
+ this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
+ g_toolbox->MoveTo(unk2 - (this->var_i32_182 / 2), unk1);
+ g_toolbox->DrawString(this->var_str_76);
+}
+
+/*
+
+0x02ec: JMP - [0x350]
+--------
+0x02f0: MOVE.W - D0,VAR(0x186)
+0x02f4: POP.L - D0
+0x02f6: MOVE.W - D0,VAR(0x184)
+0x02fa: POP.L - D0
+0x02fc: MOVE.W - D0,VAR(0x182)
+0x0300: POP.L - D0
+0x0302: MOVE.W - D0,VAR(0x180)
+0x0306: POP.L - D0
+0x0308: MOVE.W - D0,VAR(0x176)
+0x030c: MOVE.L - HEAP(0x41af4),D0
+0x0316: PUSH.L - D0
+0x0318: PUSH.W - VAR(0x180)
+0x031c: PUSH.W - VAR(0x176)
+0x0320: PUSH.W - VAR(0x184)
+0x0324: PUSH.W - VAR(0x182)
+0x0328: TRAP - _SetRect
+0x032a: MOVE.L - HEAP(0x41af4),D0
+0x0334: PUSH.L - D0
+0x0336: MOVE.W - VAR(0x186),D0
+0x033a: EXT.L - D0
+0x033c: LSL.L - 0x2,D0
+0x033e: LSL.L - 0x1,D0
+0x0340: ADDI.L - HEAP(0x194),D0
+0x034a: PUSH.L - D0
+0x034c: TRAP - _FillRect
+0x034e: RTS
+--------
+*/
+void FoolPrologue::sub_128_2f0(int16_t unk, int16_t right, int16_t bottom, int16_t left, int16_t top) {
+ g_toolbox->SetRect(this->rect_41af4, left, top, right, bottom);
+ g_toolbox->FillRect(this->rect_41af4, &this->arr_i16_194[unk*4])
+}
+/*
+
+0x0350: JMP - [0x3ea]
+--------
+0x0354: MOVE.W - D0,VAR(0x18a)
+0x0358: POP.L - D0
+0x035a: MOVE.W - D0,VAR(0x188)
+0x035e: MOVE.L - HEAP(0x1bc),D0
+0x0368: PUSH.L - D0
+0x036a: PUSH.W - 0
+0x036c: PUSH.W - 0
+0x036e: PUSH.W - 0x200
+0x0372: PUSH.W - 0x156
+0x0376: TRAP - _SetRect
+
+0x0378: MOVE.W - VAR(0x188),D0
+0x037c: EXT.L - D0
+0x037e: LSL.L - 0x2,D0
+0x0380: LSL.L - 0x1,D0
+0x0382: ADDI.L - HEAP(0x194),D0
+0x038c: PUSH.L - D0
+0x038e: TRAP - _PenPat
+
+0x0390: PUSH.W - VAR(0x18a)
+0x0394: TRAP - _PenMode
+0x0396: MOVEQ - 0x6,D0
+0x0398: PUSH.W - D0
+0x039a: MOVEQ - 0x4,D0
+0x039c: PUSH.W - D0
+0x039e: TRAP - _PenSize
+
+0x03a0: MOVEQ - 0x0,D0
+0x03a2: MOVE.W - D0,VAR(0x74)
+0x03a6: PUSH.L - 0 (unsafe)
+0x03a8: TRAP - _TickCount
+0x03aa: POP.L - D0
+0x03ac: MOVE.L - D0,VAR(0x2)
+
+0x03b0: MOVE.L - HEAP(0x1bc),D0
+0x03ba: PUSH.L - D0
+0x03bc: TRAP - _FrameRect
+0x03be: MOVE.L - HEAP(0x1bc),D0
+0x03c8: PUSH.L - D0
+0x03ca: MOVEQ - 0x6,D0
+0x03cc: PUSH.W - D0
+0x03ce: MOVEQ - 0x4,D0
+0x03d0: PUSH.W - D0
+0x03d2: TRAP - _InsetRect
+0x03d4: MOVEQ - 0x1,D0
+0x03d6: BSR - [0x024a]
+0x03da: ADDQ.W - 0x3,VAR(0x74)
+0x03de: CMPI.W - 0x82,VAR(0x74)
+0x03e4: BLE - [0x03a6]
+0x03e6: TRAP - _PenNormal
+0x03e8: RTS
+--------
+*/
+void FoolPrologue::sub_128_354(int16_t unk1, int16_t unk2) {
+ g_toolbox->SetRect(this->rect_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->PenPat(this->arr_i16_194[unk2*4]);
+ g_toolbox->PenMode(unk1);
+ g_toolbox->PenSize(6, 4);
+
+ for (int i = 0; i < 130 i += 3) {
+ this->var_i32_2 = g_toolbox->TickCount();
+
+ g_toolbox->FrameRect(this->rect_1bc);
+ g_toolbox->InsetRect(this->rect_1bc, 6, 4);
+ this->sub_128_24a(1);
+ }
+ g_toolbox->PenNormal();
+}
+
+/*
+
+0x03ea: JMP - [0x506]
+--------
+0x03ee: MOVE.W - D0,VAR(0x176)
+0x03f2: MOVEQ - 0x5,D0
+0x03f4: MOVE.W - D0,VAR(0x18c)
+0x03f8: CMPI.W - 0x28,VAR(0x18e)
+0x03fe: BLE - [0x0408]
+
+0x0402: MOVEQ - 0x8,D0
+0x0404: MOVE.W - D0,VAR(0x18c)
+0x0408: CMPI.W - 0x50,VAR(0x18e)
+0x040e: BLE - [0x0418]
+
+0x0412: MOVEQ - 0xb,D0
+0x0414: MOVE.W - D0,VAR(0x18c)
+0x0418: CMPI.W - 0x64,VAR(0x18e)
+0x041e: BLE - [0x0428]
+
+0x0422: MOVEQ - 0xe,D0
+0x0424: MOVE.W - D0,VAR(0x18c)
+
+0x0428: MOVEQ - 0x1,D0
+0x042a: MOVE.W - D0,VAR(0x74)
+0x042e: PUSH.L - 0 (unsafe)
+0x0430: TRAP - _TickCount
+0x0432: POP.L - D0
+0x0434: MOVE.L - D0,VAR(0x2)
+
+0x0438: MOVEQ - 0x0,D0
+0x043a: MOVEA.W - VAR(0x74),A0
+0x043e: ADD.L - A0,D0
+0x0440: LSL.L - 0x1,D0
+0x0442: ADDI.L - HEAP(0x1e8),D0
+0x044c: MOVEA.L - D0,A0
+0x044e: MOVE.W - (A0),D0
+0x0450: EXT.L - D0
+0x0452: MOVEA.W - VAR(0x176),A0
+0x0456: SUB.L - A0,D0
+0x0458: PUSH.W - D0
+
+0x045a: MOVE.L - 0x1f6,D0
+0x0460: MOVEA.W - VAR(0x74),A0
+0x0464: ADD.L - A0,D0
+0x0466: LSL.L - 0x1,D0
+0x0468: ADDI.L - HEAP(0x1e8),D0
+0x0472: MOVEA.L - D0,A0
+0x0474: MOVE.W - (A0),D0
+0x0476: EXT.L - D0
+0x0478: MOVEA.W - VAR(0x176),A0
+0x047c: SUB.L - A0,D0
+0x047e: PUSH.W - D0
+0x0480: TRAP - _MoveTo
+
+0x0482: MOVE.L - 0xfb,D0
+0x0488: MOVEA.W - VAR(0x74),A0
+0x048c: ADD.L - A0,D0
+0x048e: LSL.L - 0x1,D0
+0x0490: ADDI.L - HEAP(0x1e8),D0
+0x049a: MOVEA.L - D0,A0
+0x049c: MOVE.W - (A0),D0
+0x049e: EXT.L - D0
+0x04a0: MOVEA.W - VAR(0x176),A0
+0x04a4: ADD.L - A0,D0
+0x04a6: PUSH.W - D0
+
+0x04a8: MOVE.L - 0x1f6,D0
+0x04ae: MOVEA.W - VAR(0x74),A0
+0x04b2: ADD.L - A0,D0
+0x04b4: LSL.L - 0x1,D0
+0x04b6: ADDI.L - HEAP(0x1e8),D0
+0x04c0: MOVEA.L - D0,A0
+0x04c2: MOVE.W - (A0),D0
+0x04c4: EXT.L - D0
+0x04c6: MOVEA.W - VAR(0x176),A0
+0x04ca: SUB.L - A0,D0
+0x04cc: PUSH.W - D0
+0x04ce: TRAP - _LineTo
+
+0x04d0: MOVE.W - VAR(0x74),D0
+0x04d4: EXT.L - D0
+0x04d6: MOVE.L - D0,D1
+0x04d8: MOVE.W - VAR(0x18c),D0
+0x04dc: EXT.L - D0
+0x04de: JSR - "MOD_INT"
+0x04e2: CMPI.L - 0x0,D0
+0x04e8: BNE - [0x04f2]
+0x04ec: MOVEQ - 0x0,D0
+0x04ee: BSR - [0x024a]
+0x04f2: MOVE.W - VAR(0x18e),D0
+0x04f6: EXT.L - D0
+0x04f8: ADDQ.W - 0x1,VAR(0x74)
+0x04fc: CMP.W - VAR(0x74),D0
+0x0500: BGE - [0x042e]
+
+0x0504: RTS
+--------
+*/
+void FoolPrologue::sub_128_3ee(int16_t unk1) {
+ this->var_18c = 0x5;
+ if (this->var_i16_18e > 0x28) {
+ this->var_i16_18c = 0x8;
+ }
+ if (this->var_i16_18e > 0x50) {
+ this->var_i16_18c = 0xb;
+ }
+ if (this->var_i16_18e > 0x64) {
+ this->var_i16_18c = 0xe;
+ }
+ for (int i = 1; i < this->var_i16_18e + 1; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->MoveTo(
+ unk1 - this->arr_i16_1e8[i],
+ unk1 - this->arr_i16_1e8[i + 0x1f6],
+ );
+ g_toolbox->LineTo(
+ unk1 + this->arr_i16_1e8[i + 0xfb],
+ unk1 - this->arr_i16_1e8[i + 0x1f6],
+ );
+ if (i % this->var_i16_18c == 0) {
+ this->sub_128_24a(0);
+ };
+ }
+
+}
+/*
+
+0x0506: JMP - [0x60c]
+--------
+0x050a: MOVE.W - D0,VAR(0x184)
+0x050e: POP.L - D0
+0x0510: MOVE.W - D0,VAR(0x182)
+0x0514: POP.L - D0
+0x0516: MOVE.W - D0,VAR(0x180)
+0x051a: POP.L - D0
+0x051c: MOVE.W - D0,VAR(0x176)
+0x0520: MOVE.W - VAR(0x176),D0
+0x0524: EXT.L - D0
+0x0526: LSL.L - 0x2,D0
+0x0528: ADDI.L - HEAP(0x41296),D0
+0x0532: MOVEA.L - D0,A0
+0x0534: MOVE.L - (A0),D0
+0x0536: MOVE.L - D0,VAR(0x40)
+
+0x053a: MOVE.W - VAR(0x180),VAR(0x5e)
+0x0540: MOVE.W - VAR(0x182),VAR(0x62)
+0x0546: MOVE.W - VAR(0x184),D0
+0x054a: BNE - [0x0554]
+0x054e: MOVEQ - 0x14,D0
+0x0550: MOVE.W - D0,VAR(0x184)
+
+0x0554: CMPI.W - 0x1,VAR(0x184)
+0x055a: BNE - [0x0564]
+0x055e: MOVEQ - 0x8,D0
+0x0560: MOVE.W - D0,VAR(0x184)
+
+0x0564: CMPI.W - 0x2,VAR(0x184)
+0x056a: BNE - [0x0574]
+0x056e: MOVEQ - 0x6,D0
+0x0570: MOVE.W - D0,VAR(0x184)
+
+0x0574: CMPI.W - 0x3,VAR(0x184)
+0x057a: BNE - [0x0584]
+0x057e: MOVEQ - 0x5,D0
+0x0580: MOVE.W - D0,VAR(0x184)
+
+0x0584: MOVEQ - 0x1,D0
+0x0586: MOVE.W - D0,VAR(0x190)
+0x058a: PUSH.L - 0 (unsafe)
+0x058c: TRAP - _TickCount
+0x058e: POP.L - D0
+0x0590: MOVE.L - D0,VAR(0x2)
+
+0x0594: MOVEA.W - VAR(0x190),A0
+0x0598: ADDA.L - A0,A0
+0x059a: ADDA.L - HEAP(0x412ea),A0
+0x05a4: MOVE.W - (A0),D0
+0x05a6: EXT.L - D0
+0x05a8: SUBQ.L - 0x1,D0
+0x05aa: MOVE.W - D0,VAR(0x5c)
+
+0x05ae: MOVEA.W - VAR(0x190),A0
+0x05b2: ADDA.L - A0,A0
+0x05b4: ADDA.L - HEAP(0x412ea),A0
+0x05be: MOVE.W - (A0),D0
+0x05c0: EXT.L - D0
+0x05c2: MOVE.W - D0,VAR(0x60)
+
+0x05c6: PEA - VAR(0x40)
+0x05ca: PEA - VAR(0x32)
+0x05ce: PEA - VAR(0x5c)
+0x05d2: PEA - VAR(0x5c)
+0x05d6: PUSH.W - 0
+0x05d8: PUSH.L - 0
+0x05da: TRAP - _CopyBits
+
+0x05dc: MOVE.W - VAR(0x190),D0
+0x05e0: EXT.L - D0
+0x05e2: MOVE.L - D0,D1
+0x05e4: MOVE.W - VAR(0x184),D0
+0x05e8: EXT.L - D0
+0x05ea: JSR - "MOD_INT"
+
+0x05ee: CMPI.L - 0x0,D0
+0x05f4: BNE - [0x05fe]
+0x05f8: MOVEQ - 0x0,D0
+0x05fa: BSR - [0x024a]
+0x05fe: ADDQ.W - 0x1,VAR(0x190)
+0x0602: CMPI.W - 0x156,VAR(0x190)
+0x0608: BLE - [0x058a]
+
+0x060a: RTS
+--------
+*/
+void FoolPrologue::sub_128_50a(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4) {
+ this->var_i32_40 = this->arr_i32_41296[unk4];
+ this->var_i16_5e = unk3;
+ this->var_i16_62 = unk2;
+ if (unk1 == 0) {
+ unk1 = 0x14;
+ }
+ if (unk1 == 1) {
+ unk1 = 0x8;
+ }
+ if (unk1 == 2) {
+ unk1 = 0x6;
+ }
+ if (unk1 == 3) {
+ unk1 = 0x5;
+ }
+ for (int i = 1; i < SCREEN_HEIGHT; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i16_5c = this->arr_i16_412ea[i] - 1;
+ this->var_i16_60 = this->arr_i16_412ea[i];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ if (i % unk1 == 0) {
+ this->sub_128_24a(0);
+ }
+ }
+}
+
+/*
+
+0x060c: JMP - [0x646]
+--------
+0x0610: MOVE.W - D0,VAR(0x176)
+0x0614: MOVE.W - VAR(0x176),D0
+0x0618: EXT.L - D0
+0x061a: LSL.L - 0x2,D0
+0x061c: ADDI.L - HEAP(0x41296),D0
+0x0626: MOVEA.L - D0,A0
+0x0628: MOVE.L - (A0),D0
+0x062a: MOVE.L - D0,VAR(0x40)
+0x062e: PEA - VAR(0x40)
+0x0632: PEA - VAR(0x32)
+0x0636: PEA - VAR(0x38)
+0x063a: PEA - VAR(0x38)
+0x063e: PUSH.W - 0
+0x0640: PUSH.L - 0
+0x0642: TRAP - _CopyBits
+0x0644: RTS
+--------
+*/
+void FoolPrologue::sub_128_610(int16_t unk) {
+ this->var_i32_40 = this->arr_i32_41296[unk];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_32, this->var_38, this->var_38, 0, 0);
+}
+
+/*
+
+0x0646: JMP - [0x6e0]
+--------
+0x064a: MOVE.W - D0,VAR(0x176)
+0x064e: TRAP - _PenNormal
+0x0650: MOVE.W - VAR(0x176),D0
+0x0654: EXT.L - D0
+0x0656: LSL.L - 0x2,D0
+0x0658: LSL.L - 0x1,D0
+0x065a: ADDI.L - HEAP(0x194),D0
+0x0664: PUSH.L - D0
+0x0666: TRAP - _PenPat
+
+0x0668: MOVEQ - 0x0,D0
+0x066a: MOVE.W - D0,VAR(0x192)
+
+0x066e: PUSH.L - 0 (unsafe)
+0x0670: TRAP - _TickCount
+0x0672: POP.L - D0
+0x0674: MOVE.L - D0,VAR(0x2)
+
+0x0678: PUSH.W - 0
+0x067a: MOVEA.W - VAR(0x192),A0
+0x067e: ADDA.L - A0,A0
+0x0680: ADDA.L - HEAP(0x412ea),A0
+0x068a: MOVE.W - (A0),D0
+0x068c: EXT.L - D0
+0x068e: SUBQ.L - 0x1,D0
+0x0690: PUSH.W - D0
+0x0692: TRAP - _MoveTo
+
+0x0694: PUSH.W - 0x200
+0x0698: MOVEA.W - VAR(0x192),A0
+0x069c: ADDA.L - A0,A0
+0x069e: ADDA.L - HEAP(0x412ea),A0
+0x06a8: MOVE.W - (A0),D0
+0x06aa: EXT.L - D0
+0x06ac: SUBQ.L - 0x1,D0
+0x06ae: PUSH.W - D0
+0x06b0: TRAP - _LineTo
+
+0x06b2: MOVE.W - VAR(0x192),D0
+0x06b6: EXT.L - D0
+0x06b8: MOVE.L - D0,D1
+0x06ba: MOVEQ - 0x5,D0
+0x06bc: JSR - "MOD_INT"
+0x06c0: CMPI.L - 0x0,D0
+0x06c6: BNE - [0x06d0]
+0x06ca: MOVEQ - 0x0,D0
+0x06cc: BSR - [0x024a]
+0x06d0: ADDQ.W - 0x1,VAR(0x192)
+0x06d4: CMPI.W - 0x156,VAR(0x192)
+0x06da: BLE - [0x066e]
+0x06dc: TRAP - _PenNormal
+0x06de: RTS
+--------
+*/
+void FoolPrologue::sub_128_64a(int16_t unk1) {
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(&this->arr_i16_194[unk1*4]);
+ for (int i = 0; i < SCREEN_HEIGHT; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->MoveTo(0, this->arr_i16_412ea[i] - 1);
+ g_toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i] - 1);
+ if (i % 5 == 0) {
+ this->sub_128_24a(0);
+ }
+ }
+ g_toolbox->PenNormal();
+}
+
+/*
+
+0x06e0: JMP - [0x7fc]
+--------
+0x06e4: MOVE.W - D0,VAR(0x176)
+0x06e8: MOVE.W - VAR(0x176),D0
+0x06ec: EXT.L - D0
+0x06ee: LSL.L - 0x2,D0
+0x06f0: ADDI.L - HEAP(0x41296),D0
+0x06fa: MOVEA.L - D0,A0
+0x06fc: MOVE.L - (A0),D0
+0x06fe: MOVE.L - D0,VAR(0x40)
+
+0x0702: MOVEQ - 0x1,D0
+0x0704: MOVE.W - D0,VAR(0x74)
+
+0x0708: PUSH.L - 0 (unsafe)
+0x070a: TRAP - _TickCount
+0x070c: POP.L - D0
+0x070e: MOVE.L - D0,VAR(0x2)
+
+0x0712: MOVE.L - 0xab,D0
+0x0718: PUSH.L - D0
+0x071a: MOVE.W - VAR(0x74),D0
+0x071e: EXT.L - D0
+0x0720: JSR - "BCD_FROM_INT"
+0x0724: JSR - "BCD_PUSH_LHS"
+0x0728: JSR - "BCD_FROM_CONST" 3.33
+0x0732: JSR - "BCD_PUSH_RHS"
+0x0736: JSR - "MUL_BCD"
+0x073a: JSR - "CAST_INT"
+0x073e: POP.L - D1
+0x0740: EXG - D0,D1
+0x0742: SUB.L - D1,D0
+0x0744: MOVE.W - D0,VAR(0x5c)
+
+0x0748: MOVE.L - 0x100,D0
+0x074e: PUSH.L - D0
+0x0750: MOVE.W - VAR(0x74),D0
+0x0754: EXT.L - D0
+0x0756: MOVE.L - D0,D1
+0x0758: MOVEQ - 0x5,D0
+0x075a: JSR - "MUL_INT"
+0x075e: POP.L - D1
+0x0760: EXG - D0,D1
+0x0762: SUB.L - D1,D0
+0x0764: MOVE.W - D0,VAR(0x5e)
+
+0x0768: MOVE.L - 0xab,D0
+0x076e: PUSH.L - D0
+0x0770: MOVE.W - VAR(0x74),D0
+0x0774: EXT.L - D0
+0x0776: JSR - "BCD_FROM_INT"
+0x077a: JSR - "BCD_PUSH_LHS"
+0x077e: JSR - "BCD_FROM_CONST" 3.33
+0x0788: JSR - "BCD_PUSH_RHS"
+0x078c: JSR - "MUL_BCD"
+0x0790: JSR - "CAST_INT"
+0x0794: POP.L - D1
+0x0796: ADD.L - D1,D0
+0x0798: MOVE.W - D0,VAR(0x60)
+
+0x079c: MOVE.L - 0x100,D0
+0x07a2: PUSH.L - D0
+0x07a4: MOVE.W - VAR(0x74),D0
+0x07a8: EXT.L - D0
+0x07aa: MOVE.L - D0,D1
+0x07ac: MOVEQ - 0x5,D0
+0x07ae: JSR - "MUL_INT"
+0x07b2: POP.L - D1
+0x07b4: ADD.L - D1,D0
+0x07b6: MOVE.W - D0,VAR(0x62)
+
+0x07ba: PEA - VAR(0x40)
+0x07be: PEA - VAR(0x32)
+0x07c2: PEA - VAR(0x5c)
+0x07c6: PEA - VAR(0x5c)
+0x07ca: PUSH.W - 0
+0x07cc: PUSH.L - 0
+0x07ce: TRAP - _CopyBits
+
+0x07d0: MOVEQ - 0x1,D0
+0x07d2: BSR - [0x024a]
+0x07d6: MOVEQ - 0x34,D0
+0x07d8: ADDQ.W - 0x1,VAR(0x74)
+0x07dc: CMP.W - VAR(0x74),D0
+0x07e0: BGE - [0x0708]
+
+0x07e4: PEA - VAR(0x40)
+0x07e8: PEA - VAR(0x32)
+0x07ec: PEA - VAR(0x38)
+0x07f0: PEA - VAR(0x38)
+0x07f4: PUSH.W - 0
+0x07f6: PUSH.L - 0
+0x07f8: TRAP - _CopyBits
+0x07fa: RTS
+--------
+*/
+void FoolPrologue::sub_128_6e4(int16_t unk) {
+ this->var_40 = this->arr_i32_41296[unk];
+ for (int i = 0; i < 0x36; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i16_5c = (SCREEN_HEIGHT/2) - (int)(i*3.33);
+ this->var_i16_5e = (SCREEN_WIDTH/2) - i*5;
+ this->var_i16_60 = (SCREEN_HEIGHT/2) + (int)(i*3.33);
+ this->var_i16_62 = (SCREEN_WIDTH/2) + i*5;
+ g_toolbox->CopyBits(this->var_40, this->var_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ }
+ g_toolbox->CopyBits(this->var_40, this->var_32, this->var_38, this->var_38, 0, 0);
+}
+
+/*
+
+0x07fc: JMP - [0xa68]
+--------
+0x0800: MOVE.W - D0,VAR(0x1a2)
+0x0804: POP.L - D0
+0x0806: MOVE.W - D0,VAR(0x1a0)
+0x080a: POP.L - D0
+0x080c: MOVE.W - D0,VAR(0x19e)
+0x0810: POP.L - D0
+0x0812: MOVE.W - D0,VAR(0x19c)
+0x0816: POP.L - D0
+0x0818: MOVE.W - D0,VAR(0x19a)
+0x081c: POP.L - D0
+0x081e: MOVE.W - D0,VAR(0x198)
+0x0822: POP.L - D0
+0x0824: MOVE.W - D0,VAR(0x196)
+0x0828: POP.L - D0
+0x082a: MOVE.W - D0,VAR(0x194)
+0x082e: POP.L - D0
+0x0830: MOVE.W - D0,VAR(0x178)
+
+0x0834: MOVE.L - HEAP(0x41af4),D0
+0x083e: MOVEA.L - D0,A0
+0x0840: MOVE.W - VAR(0x178),(A0)
+
+0x0844: MOVE.L - HEAP(0x41af6),D0
+0x084e: MOVEA.L - D0,A0
+0x0850: MOVE.W - VAR(0x194),(A0)
+
+0x0854: MOVE.L - HEAP(0x41af8),D0
+0x085e: MOVEA.L - D0,A0
+0x0860: MOVE.W - VAR(0x196),(A0)
+
+0x0864: MOVE.L - HEAP(0x41afa),D0
+0x086e: MOVEA.L - D0,A0
+0x0870: MOVE.W - VAR(0x198),(A0)
+
+0x0874: MOVE.L - HEAP(0x41afc),D0
+0x087e: MOVEA.L - D0,A0
+0x0880: MOVE.W - VAR(0x19a),(A0)
+
+0x0884: MOVE.L - HEAP(0x41afe),D0
+0x088e: MOVEA.L - D0,A0
+0x0890: MOVE.W - VAR(0x19c),(A0)
+
+0x0894: MOVE.L - HEAP(0x41b00),D0
+0x089e: MOVEA.L - D0,A0
+0x08a0: MOVE.W - VAR(0x19e),(A0)
+
+0x08a4: MOVE.L - HEAP(0x41b02),D0
+0x08ae: MOVEA.L - D0,A0
+0x08b0: MOVE.W - VAR(0x1a0),(A0)
+
+0x08b4: TRAP - _PenNormal
+0x08b6: MOVEQ - 0xa,D0
+0x08b8: PUSH.W - D0
+0x08ba: TRAP - _PenMode
+
+0x08bc: MOVEQ - 0x0,D0
+0x08be: MOVE.W - D0,VAR(0x74)
+0x08c2: MOVE.W - VAR(0x74),D0
+0x08c6: EXT.L - D0
+0x08c8: LSL.L - 0x2,D0
+0x08ca: ADDI.L - HEAP(0x41bbe),D0
+0x08d4: PUSH.L - D0
+
+0x08d6: MOVEA.W - VAR(0x74),A0
+0x08da: ADDA.L - A0,A0
+0x08dc: ADDA.L - HEAP(0x41af4),A0
+0x08e6: MOVE.W - (A0),D0
+0x08e8: EXT.L - D0
+0x08ea: JSR - "BCD_FROM_INT"
+0x08ee: POP.L - A0
+0x08f0: JSR - "BCD_TO_VAR"
+
+0x08f4: MOVE.W - VAR(0x74),D0
+0x08f8: EXT.L - D0
+0x08fa: ADDQ.L - 0x4,D0
+0x08fc: LSL.L - 0x2,D0
+0x08fe: ADDI.L - HEAP(0x41bbe),D0
+0x0908: PUSH.L - D0
+
+0x090a: MOVE.W - VAR(0x74),D0
+0x090e: EXT.L - D0
+0x0910: ADDQ.L - 0x4,D0
+0x0912: LSL.L - 0x1,D0
+0x0914: ADDI.L - HEAP(0x41af4),D0
+0x091e: MOVEA.L - D0,A0
+0x0920: MOVE.W - (A0),D0
+0x0922: EXT.L - D0
+0x0924: PUSH.L - D0
+0x0926: MOVEA.W - VAR(0x74),A0
+0x092a: ADDA.L - A0,A0
+0x092c: ADDA.L - HEAP(0x41af4),A0
+0x0936: MOVE.W - (A0),D0
+0x0938: EXT.L - D0
+0x093a: POP.L - D1
+
+0x093c: EXG - D0,D1
+0x093e: SUB.L - D1,D0
+0x0940: JSR - "BCD_FROM_INT"
+0x0944: JSR - "BCD_PUSH_LHS"
+0x0948: MOVE.W - VAR(0x1a2),D0
+0x094c: EXT.L - D0
+0x094e: JSR - "BCD_FROM_INT"
+0x0952: JSR - "BCD_PUSH_RHS"
+0x0956: JSR - "DIV_BCD"
+0x095a: POP.L - A0
+0x095c: JSR - "BCD_TO_VAR"
+0x0960: MOVEQ - 0x3,D0
+0x0962: ADDQ.W - 0x1,VAR(0x74)
+0x0966: CMP.W - VAR(0x74),D0
+0x096a: BGE - [0x08c2]
+
+0x096e: MOVE.L - HEAP(0x41af4),D0
+0x0978: PUSH.L - D0
+0x097a: TRAP - _PaintRect
+
+0x097c: MOVEQ - 0x1,D0
+0x097e: MOVE.W - D0,VAR(0x192)
+0x0982: PUSH.L - 0 (unsafe)
+0x0984: TRAP - _TickCount
+0x0986: POP.L - D0
+0x0988: MOVE.L - D0,VAR(0x2)
+
+0x098c: MOVEQ - 0x0,D0
+0x098e: MOVE.W - D0,VAR(0x74)
+0x0992: MOVE.W - VAR(0x74),D0
+0x0996: EXT.L - D0
+0x0998: LSL.L - 0x2,D0
+0x099a: ADDI.L - HEAP(0x41bbe),D0
+0x09a4: PUSH.L - D0
+0x09a6: MOVE.W - VAR(0x74),D0
+0x09aa: EXT.L - D0
+0x09ac: LSL.L - 0x2,D0
+0x09ae: ADDI.L - HEAP(0x41bbe),D0
+0x09b8: MOVEA.L - D0,A0
+0x09ba: JSR - "BCD_FROM_VAR"
+0x09be: JSR - "BCD_PUSH_LHS"
+0x09c2: MOVE.W - VAR(0x74),D0
+0x09c6: EXT.L - D0
+0x09c8: ADDQ.L - 0x4,D0
+0x09ca: LSL.L - 0x2,D0
+0x09cc: ADDI.L - HEAP(0x41bbe),D0
+0x09d6: MOVEA.L - D0,A0
+0x09d8: JSR - "BCD_FROM_VAR"
+0x09dc: JSR - "ADD_BCD"
+0x09e0: POP.L - A0
+0x09e2: JSR - "BCD_TO_VAR"
+
+0x09e6: MOVE.W - VAR(0x74),D0
+0x09ea: EXT.L - D0
+0x09ec: ADDI.L - 0x0000000b,D0
+0x09f2: LSL.L - 0x1,D0
+0x09f4: ADDI.L - HEAP(0x41af4),D0
+0x09fe: PUSH.L - D0
+0x0a00: MOVE.W - VAR(0x74),D0
+0x0a04: EXT.L - D0
+0x0a06: LSL.L - 0x2,D0
+0x0a08: ADDI.L - HEAP(0x41bbe),D0
+0x0a12: MOVEA.L - D0,A0
+0x0a14: JSR - "BCD_FROM_VAR"
+0x0a18: JSR - "CAST_INT"
+0x0a1c: POP.L - A0
+0x0a1e: MOVE.W - D0,(A0)
+0x0a20: MOVEQ - 0x3,D0
+0x0a22: ADDQ.W - 0x1,VAR(0x74)
+0x0a26: CMP.W - VAR(0x74),D0
+0x0a2a: BGE - [0x0992]
+
+0x0a2e: MOVE.L - HEAP(0x41b0a),D0
+0x0a38: PUSH.L - D0
+0x0a3a: TRAP - _PaintRect
+0x0a3c: MOVEQ - 0x0,D0
+0x0a3e: BSR - [0x024a]
+0x0a42: MOVE.W - VAR(0x1a2),D0
+0x0a46: EXT.L - D0
+0x0a48: SUBQ.L - 0x1,D0
+0x0a4a: ADDQ.W - 0x1,VAR(0x192)
+0x0a4e: CMP.W - VAR(0x192),D0
+0x0a52: BGE - [0x0982]
+
+0x0a56: MOVE.L - HEAP(0x41afc),D0
+0x0a60: PUSH.L - D0
+0x0a62: TRAP - _PaintRect
+0x0a64: TRAP - _PenNormal
+0x0a66: RTS
+--------
+*/
+void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
+ this->arr_i16_41af4[0] = unk9;
+ this->arr_i16_41af4[1] = unk8;
+ this->arr_i16_41af4[2] = unk7;
+ this->arr_i16_41af4[3] = unk6;
+ this->arr_i16_41af4[4] = unk5;
+ this->arr_i16_41af4[5] = unk4;
+ this->arr_i16_41af4[6] = unk3;
+ this->arr_i16_41af4[7] = unk2;
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(0xa);
+ for (int i = 0; i < 4; i++) {
+ this->arr_f64_41bbe[i] = (double)this->arr_i16_41af4[i];
+ this->arr_f64_41bbe[i+4] = (double)(this->arr_i16_41af4[i] - this->arr_i16_41af4[i+4])/(double)(this->var_i32_182);
+ }
+ g_toolbox->PaintRect(&this->arr_i16_41af4);
+ for (int i = 1; i < unk1 + 1; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+
+ for (int j = 0; j < 4; j++) {
+ this->arr_f64_41bbe[j] = this->arr_f64_41bbe[j] + this->arr_f64_41bbe[j+4];
+ this->arr_i16_41af4[j+11] = (int16_t)this->arr_f64_41bbe[j];
+ }
+ g_toolbox->PaintRect(&this->arr_i16_41b0a);
+ this->sub_128_24a(0);
+ }
+ g_toolbox->PaintRect(&this->arr_i16_41afc);
+ g_toolbox->PenNormal();
+}
+
+/*
+
+0x0a68: JMP - [0xa88]
+--------
+0x0a6c: MOVE.W - D0,VAR(0x194)
+0x0a70: POP.L - D0
+0x0a72: MOVE.W - D0,VAR(0x178)
+0x0a76: PUSH.W - VAR(0x178)
+0x0a7a: PUSH.W - VAR(0x194)
+0x0a7e: TRAP - _MoveTo
+0x0a80: PEA - VAR(0x76)
+0x0a84: TRAP - _DrawString
+0x0a86: RTS
+--------
+*/
+void FoolPrologue::sub_128_a6c(int16_t unk1, int16_t unk2) {
+ g_toolbox->MoveTo(unk2, unk1);
+ g_toolbox->DrawString(this->var_str_76);
+}
+/*
+0x0a88: JMP - [0xc8a]
+--------
+0x0a8c: MOVE.W - D0,VAR(0x1a4)
+0x0a90: MOVEQ - 0xa,D0
+0x0a92: PUSH.W - D0
+0x0a94: TRAP - _PenMode
+0x0a96: JSR - 130,0xe82
+0x0a9a: MOVEQ - 0x0,D0
+0x0a9c: MOVEA.W - VAR(0x6),A0
+0x0aa0: ADD.L - A0,D0
+0x0aa2: LSL.L - 0x1,D0
+0x0aa4: ADDI.L - HEAP(0x1e8),D0
+0x0aae: PUSH.L - D0
+0x0ab0: MOVEQ - 0x0,D0
+0x0ab2: MOVEA.W - VAR(0x6),A0
+0x0ab6: ADD.L - A0,D0
+0x0ab8: LSL.L - 0x1,D0
+0x0aba: ADDI.L - HEAP(0x1e8),D0
+0x0ac4: MOVEA.L - D0,A0
+0x0ac6: MOVE.W - (A0),D0
+0x0ac8: EXT.L - D0
+0x0aca: PUSH.L - D0
+0x0acc: MOVE.L - 0x2f1,D0
+0x0ad2: MOVEA.W - VAR(0x6),A0
+0x0ad6: ADD.L - A0,D0
+0x0ad8: LSL.L - 0x1,D0
+0x0ada: ADDI.L - HEAP(0x1e8),D0
+0x0ae4: MOVEA.L - D0,A0
+0x0ae6: MOVE.W - (A0),D0
+0x0ae8: EXT.L - D0
+0x0aea: POP.L - D1
+0x0aec: ADD.L - D1,D0
+0x0aee: POP.L - A0
+0x0af0: MOVE.W - D0,(A0)
+
+0x0af2: MOVE.L - 0xfb,D0
+0x0af8: MOVEA.W - VAR(0x6),A0
+0x0afc: ADD.L - A0,D0
+0x0afe: LSL.L - 0x1,D0
+0x0b00: ADDI.L - HEAP(0x1e8),D0
+0x0b0a: PUSH.L - D0
+0x0b0c: MOVE.L - 0xfb,D0
+0x0b12: MOVEA.W - VAR(0x6),A0
+0x0b16: ADD.L - A0,D0
+0x0b18: LSL.L - 0x1,D0
+0x0b1a: ADDI.L - HEAP(0x1e8),D0
+0x0b24: MOVEA.L - D0,A0
+0x0b26: MOVE.W - (A0),D0
+0x0b28: EXT.L - D0
+0x0b2a: PUSH.L - D0
+0x0b2c: MOVE.L - 0x2f1,D0
+0x0b32: MOVEA.W - VAR(0x6),A0
+0x0b36: ADD.L - A0,D0
+0x0b38: LSL.L - 0x1,D0
+0x0b3a: ADDI.L - HEAP(0x1e8),D0
+0x0b44: MOVEA.L - D0,A0
+0x0b46: MOVE.W - (A0),D0
+0x0b48: EXT.L - D0
+0x0b4a: POP.L - D1
+0x0b4c: ADD.L - D1,D0
+0x0b4e: POP.L - A0
+0x0b50: MOVE.W - D0,(A0)
+
+*/
+void FoolPrologue::sub_128_a8c(int16_t unk) {
+ this->var_i16_1a4 = unk;
+ g_toolbox->PenMode(0xa);
+ do {
+ // 128:0a96
+ this->sub_130_e82();
+ this->arr_i16_1e8[this->var_i16_6] =
+ this->arr_i16_1e8[0x2f1+this->var_i16_6]
+ + this->arr_i16_1e8[this->var_i16_6];
+
+ this->arr_i16_1e8[0xfb+this->var_i16_6] =
+ this->arr_i16_1e8[0xfb+this->var_i16_6]
+ + this->arr_i16_1e8[0x2f1+this->var_i16_6];
+
+ // 128:0b52
+ if ((this->arr_i16_1e8[this->var_i16_6] < 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] < 0x140)) {
+
+/*
+0x0b52: MOVEQ - 0x0,D0
+0x0b54: MOVEA.W - VAR(0x6),A0
+0x0b58: ADD.L - A0,D0
+0x0b5a: LSL.L - 0x1,D0
+0x0b5c: ADDI.L - HEAP(0x1e8),D0
+0x0b66: MOVEA.L - D0,A0
+0x0b68: MOVE.W - (A0),D0
+
+0x0b6a: EXT.L - D0
+0x0b6c: CMPI.L - 0x1f4,D0
+0x0b72: SGT - D0
+0x0b74: EXT.W - D0
+0x0b76: EXT.L - D0
+0x0b78: PUSH.L - D0
+
+0x0b7a: MOVE.L - 0xfb,D0
+0x0b80: MOVEA.W - VAR(0x6),A0
+0x0b84: ADD.L - A0,D0
+0x0b86: LSL.L - 0x1,D0
+0x0b88: ADDI.L - HEAP(0x1e8),D0
+0x0b92: MOVEA.L - D0,A0
+0x0b94: MOVE.W - (A0),D0
+0x0b96: EXT.L - D0
+0x0b98: CMPI.L - 0x140,D0
+0x0b9e: SGT - D0
+
+0x0ba0: EXT.W - D0
+0x0ba2: EXT.L - D0
+0x0ba4: POPOR.L - D0
+0x0ba6: TST.L - D0
+0x0ba8: BNE - [0x0bae]
+0x0baa: JMP - [0xc56]
+--------
+
+
+0x0bae: MOVEQ - 0x0,D0
+0x0bb0: MOVEA.W - VAR(0x6),A0
+0x0bb4: ADD.L - A0,D0
+0x0bb6: LSL.L - 0x1,D0
+0x0bb8: ADDI.L - HEAP(0x1e8),D0
+0x0bc2: PUSH.L - D0
+0x0bc4: MOVE.L - 0x264,D0
+0x0bca: JSR - "RND_INT"
+0x0bce: SUBI.L - 0xc8,D0
+0x0bd4: POP.L - A0
+0x0bd6: MOVE.W - D0,(A0)
+
+0x0bd8: MOVE.L - 0xfb,D0
+0x0bde: MOVEA.W - VAR(0x6),A0
+0x0be2: ADD.L - A0,D0
+0x0be4: LSL.L - 0x1,D0
+0x0be6: ADDI.L - HEAP(0x1e8),D0
+0x0bf0: PUSH.L - D0
+0x0bf2: MOVE.L - 0x1ba,D0
+0x0bf8: JSR - "RND_INT"
+0x0bfc: SUBI.L - 0xc8,D0
+0x0c02: POP.L - A0
+0x0c04: MOVE.W - D0,(A0)
+
+0x0c06: MOVE.L - 0x1f6,D0
+0x0c0c: MOVEA.W - VAR(0x6),A0
+0x0c10: ADD.L - A0,D0
+0x0c12: LSL.L - 0x1,D0
+0x0c14: ADDI.L - HEAP(0x1e8),D0
+0x0c1e: PUSH.L - D0
+0x0c20: MOVEQ - 0x5,D0
+0x0c22: JSR - "RND_INT"
+0x0c26: ADDQ.L - 0x1,D0
+0x0c28: POP.L - A0
+0x0c2a: MOVE.W - D0,(A0)
+
+0x0c2c: MOVE.L - 0x2f1,D0
+0x0c32: MOVEA.W - VAR(0x6),A0
+0x0c36: ADD.L - A0,D0
+0x0c38: LSL.L - 0x1,D0
+0x0c3a: ADDI.L - HEAP(0x1e8),D0
+0x0c44: PUSH.L - D0
+0x0c46: MOVEQ - 0xa,D0
+0x0c48: JSR - "RND_INT"
+0x0c4c: ADDI.L - 0x00000019,D0
+0x0c52: POP.L - A0
+0x0c54: MOVE.W - D0,(A0)
+
+0x0c56: JSR - 130,0xe82
+
+0x0c5a: ADDQ.W - 0x1,VAR(0x6)
+0x0c5e: CMPI.W - 0xb5,VAR(0x6)
+0x0c64: BLE - [0x0c6e]
+0x0c68: MOVEQ - 0x1,D0
+0x0c6a: MOVE.W - D0,VAR(0x6)
+
+0x0c6e: PUSH.L - 0 (unsafe)
+0x0c70: TRAP - _TickCount
+0x0c72: POP.L - D0
+0x0c74: PUSH.L - D0
+0x0c76: MOVE.L - VAR(0x2),D0
+0x0c7a: MOVEA.W - VAR(0x1a4),A0
+0x0c7e: ADD.L - A0,D0
+0x0c80: POP.L - D1
+0x0c82: CMP.L - D0,D1
+0x0c84: BLE - [0x0a96]
+0x0c88: RTS
+--------
+*/
+ // 128:0bae
+ this->arr_i16_1e8[this->var_i16_6] = _vm->_rnd->getRandomNumber(0x264) - 0xc8;
+ this->arr_i16_1e8[0xfb + this->var_i16_6] = (std::rand() % 0x1ba) - 0xc8;
+ this->arr_i16_1e8[0x1f6 + this->var_i16_6] = (std::rand() % 0x5) + 0x1;
+ this->arr_i16_1e8[0x2f1 + this->var_i16_6] = (std::rand() % 0xa) + 0x19;
+ }
+ // 128:0c56
+ this->sub_130_e82();
+ this->var_i16_6 += 1;
+ if (this->var_i16_6 > 0xb5) {
+ this->var_i16_6 = 0;
+ }
+ } while (this->var_i32_2 + this->var_i16_1a4 <= g_toolbox->TickCount())
+}
+
+/*
+
+0x0c8a: JSR - 129,0x4
+0x0c8e: MOVEQ - -0x1,D0
+0x0c90: JSR - "MEM"
+0x0c94: MOVE.L - D0,VAR(0x1a6)
+0x0c98: CMPI.W - 0x1,VAR(0x1aa)
+0x0c9e: BNE - [0x0cb0]
+0x0ca2: JSR - 130,0x4
+0x0ca6: MOVEQ - -0x1,D0
+0x0ca8: JSR - "MEM"
+0x0cac: MOVE.L - D0,VAR(0x1a6)
+0x0cb0: CMPI.W - 0x2,VAR(0x1aa)
+0x0cb6: BNE - [0x0cc8]
+0x0cba: JSR - 131,0x4
+0x0cbe: MOVEQ - -0x1,D0
+0x0cc0: JSR - "MEM"
+0x0cc4: MOVE.L - D0,VAR(0x1a6)
+0x0cc8: JMP - "ZBASIC_UNK4"
+0x0ccc: JSR - "ZBASIC_20"
+0x0cd0: MOVE.L - HEAP(0x41598),D0
+0x0cda: MOVE.L - D0,VAR(0x1ac)
+0x0cde: MOVE.L - HEAP(0x41846),D0
+0x0ce8: MOVE.L - D0,VAR(0x1b0)
+0x0cec: MOVE.W - VAR(0x18e),D0
+0x0cf0: EXT.L - D0
+0x0cf2: MOVE.L - D0,D1
+0x0cf4: MOVEQ - 0x2,D0
+0x0cf6: JSR - "MUL_INT"
+0x0cfa: ADDQ.L - 0x2,D0
+0x0cfc: MOVE.W - D0,VAR(0x1b4)
+
+0x0d00: MOVEQ - 0x1,D0
+0x0d02: MOVE.W - D0,VAR(0x74)
+0x0d06: MOVEA.W - VAR(0x74),A0
+0x0d0a: ADDA.L - A0,A0
+0x0d0c: ADDA.L - HEAP(0x41598),A0
+0x0d16: MOVE.W - VAR(0x74),(A0)
+0x0d1a: MOVE.W - VAR(0x18e),D0
+0x0d1e: EXT.L - D0
+0x0d20: ADDQ.W - 0x1,VAR(0x74)
+0x0d24: CMP.W - VAR(0x74),D0
+0x0d28: BGE - [0x0d06]
+
+0x0d2a: MOVE.W - VAR(0x18e),VAR(0x74)
+0x0d30: MOVE.W - VAR(0x74),D0
+0x0d34: EXT.L - D0
+0x0d36: JSR - "RND_INT"
+0x0d3a: MOVE.W - D0,VAR(0x1b6)
+
+0x0d3e: MOVE.W - VAR(0x74),D0
+0x0d42: EXT.L - D0
+0x0d44: LSL.L - 0x1,D0
+0x0d46: ADDI.L - HEAP(0x412ea),D0
+0x0d50: PUSH.L - D0
+0x0d52: MOVEA.W - VAR(0x1b6),A0
+0x0d56: ADDA.L - A0,A0
+0x0d58: ADDA.L - HEAP(0x41598),A0
+0x0d62: MOVE.W - (A0),D0
+0x0d64: EXT.L - D0
+0x0d66: POP.L - A0
+0x0d68: MOVE.W - D0,(A0)
+
+0x0d6a: MOVE.W - VAR(0x1b6),D0
+0x0d6e: EXT.L - D0
+0x0d70: MOVE.L - D0,D1
+0x0d72: MOVEQ - 0x2,D0
+0x0d74: JSR - "MUL_INT"
+0x0d78: ADDQ.L - 0x2,D0
+0x0d7a: MOVE.W - D0,VAR(0x1b8)
+
+0x0d7e: MOVE.L - VAR(0x1ac),D0
+0x0d82: MOVEA.W - VAR(0x1b8),A0
+0x0d86: ADD.L - A0,D0
+0x0d88: PUSH.L - D0
+0x0d8a: MOVE.L - VAR(0x1b0),D0
+0x0d8e: MOVEA.W - VAR(0x1b8),A0
+0x0d92: ADD.L - A0,D0
+0x0d94: PUSH.L - D0
+0x0d96: MOVE.W - VAR(0x1b4),D0
+0x0d9a: EXT.L - D0
+0x0d9c: MOVEA.W - VAR(0x1b8),A0
+0x0da0: SUB.L - A0,D0
+0x0da2: JSR - "BLOCKMOVE"
+
+0x0da6: MOVE.L - VAR(0x1b0),D0
+0x0daa: MOVEA.W - VAR(0x1b8),A0
+0x0dae: ADD.L - A0,D0
+0x0db0: PUSH.L - D0
+0x0db2: MOVE.L - VAR(0x1ac),D0
+0x0db6: MOVEA.W - VAR(0x1b8),A0
+0x0dba: ADD.L - A0,D0
+0x0dbc: SUBQ.L - 0x2,D0
+0x0dbe: PUSH.L - D0
+0x0dc0: MOVE.W - VAR(0x1b4),D0
+0x0dc4: EXT.L - D0
+0x0dc6: MOVEA.W - VAR(0x1b8),A0
+0x0dca: SUB.L - A0,D0
+0x0dcc: JSR - "BLOCKMOVE"
+
+0x0dd0: MOVEQ - 0x1,D0
+0x0dd2: ADDI.W - 0xffff,VAR(0x74)
+0x0dd8: CMP.W - VAR(0x74),D0
+0x0ddc: BLE - [0x0d30]
+0x0de0: RTS
+--------
+*/
+
+void FoolPrologue::sub_128_c8a() {
+ this->sub_129_004();
+ this->var_i32_1a6 = zbasic_mem(-1);
+ if (this->var_i16_1aa == 1) {
+ this->sub_130_004();
+ this->var_i32_1a6 = zbasic_mem(-1);
+ }
+ // 128:0cb0
+ if (this->var_i16_1aa == 2) {
+ this->sub_131_004();
+ this->var_i32_1a6 = zbasic_mem(-1);
+ }
+ // 128:0cc8
+ zbasic_unk4();
+ zbasic_20();
+ this->arr_i32_1ac = this->arr_i32_41598;
+ this->arr_i32_1b0 = this->arr_i32_41846;
+ this->var_i16_1b4 = this->var_i16_18e * 2 + 2;
+ // 128:0d00
+ for (int i=1; i < this->var_i16_18e; i++) {
+ this->arr_i16_41598[i] = i;
+ }
+ // 128:0d2a
+ for (int i=this->var_i16_18e; i<=1; i--) {
+ this->var_i16_1b6 = _vm->_rnd->getRandomNumber(i);
+ this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
+ this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
+ zbasic_blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8);
+ zbasic_blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8);
+
+ }
+}
+
+/*
+
+0x0de2: PUSH.W - 0xfb
+0x0de6: MOVEQ - 0x9,D0
+0x0de8: PUSH.W - D0
+0x0dea: PUSH.W - 0
+0x0dec: MOVEQ - 0x2,D0
+0x0dee: PUSH.W - D0
+0x0df0: JSR - "TEXT"
+0x0df4: MOVEA.L - STR(0xa0),A0 # b'Click Mouse to Continue'
+0x0dfc: JSR - "BUFFER_CONCAT"
+0x0e00: LEA - VAR(0x76),A0
+0x0e04: JSR - "BUFFER_FLUSH"
+0x0e08: PEA - [0x0e1a]
+0x0e0c: MOVEQ - 0x5,D0
+0x0e0e: PUSH.L - D0
+0x0e10: MOVE.L - 0x151,D0
+0x0e16: BRA - [0x0a6c]
+0x0e1a: RTS
+--------
+*/
+void FoolPrologue::sub_128_de2() {
+ zbasic_text(0xfb, 0x9, 0x0, 0x2);
+ this->var_str_76 = STR(0xa0); // "Click Mouse to Continue"
+ this->sub_128_a6c(0x151, 0x5);
+}
+
+/*
+
+0x0e1c: PUSH.W - 0xfb
+0x0e20: MOVEQ - 0x9,D0
+0x0e22: PUSH.W - D0
+0x0e24: PUSH.W - 0
+0x0e26: MOVEQ - 0x2,D0
+0x0e28: PUSH.W - D0
+0x0e2a: JSR - "TEXT"
+0x0e2e: MOVEA.L - STR(0xb8),A0 # b'Click Mouse to Continue'
+0x0e36: JSR - "BUFFER_CONCAT"
+0x0e3a: LEA - VAR(0x76),A0
+0x0e3e: JSR - "BUFFER_FLUSH"
+0x0e42: PEA - [0x0e56]
+0x0e46: PUSH.L - 0x000001f7
+0x0e4c: MOVE.L - 0x154,D0
+0x0e52: BRA - [0x026c]
+0x0e56: RTS
+--------
+*/
+void FoolPrologue::sub_128_e1c() {
+ zbasic_text(0xfb, 0x9, 0x0, 0x2);
+ this->var_str_76 = "Click Mouse to Continue"; // STR(0xb8)
+ this->sub_128_26c(0x154, 0x1f7);
+}
+
+/*
+0x0e58: JSR - [0xe80]
+0x0e5c: PUSH.W - 0 (unsafe)
+0x0e5e: MOVEQ - 0x2,D0
+0x0e60: PUSH.W - D0
+0x0e62: PEA - VAR(0x22)
+0x0e66: TRAP - _GetNextEvent
+0x0e68: POP.B - D0
+0x0e6a: EXT.W - D0
+0x0e6c: EXT.L - D0
+0x0e6e: MOVE.W - D0,VAR(0x1ba)
+0x0e72: CMPI.W - 0x1,VAR(0x22)
+0x0e78: BNE - [0x0e5c]
+0x0e7a: JSR - [0xe80]
+0x0e7e: RTS
+--------
+*/
+
+void FoolPrologue::sub_128_e58() {
+ this->sub_128_e80();
+ while (true) {
+ this->var_i16_1ba = g_toolbox->GetNextEvent(0, 0x2, &this->var_22);
+ if (this->var_22 == 1)
+ break;
+ }
+ this->sub_128_e80();
+}
+
+/*
+
+0x0e80: PUSH.W - 0 (unsafe)
+0x0e82: MOVEQ - -0x1,D0
+0x0e84: PUSH.W - D0
+0x0e86: PEA - VAR(0x22)
+0x0e8a: TRAP - _GetNextEvent
+0x0e8c: POP.B - D0
+0x0e8e: EXT.W - D0
+0x0e90: EXT.L - D0
+0x0e92: MOVE.W - D0,VAR(0x1ba)
+0x0e96: CMPI.W - 0x6,VAR(0x22)
+0x0e9c: BNE - [0x0ea4]
+0x0ea0: JSR - [0xed2]
+0x0ea4: CMPI.W - 0x7,VAR(0x22)
+0x0eaa: BNE - [0x0eb2]
+0x0eae: JSR - [0xee0]
+0x0eb2: MOVE.W - VAR(0x22),D0
+0x0eb6: SEQ - D0
+0x0eb8: EXT.W - D0
+0x0eba: EXT.L - D0
+0x0ebc: PUSH.L - D0
+0x0ebe: MOVE.W - VAR(0x30),D0
+0x0ec2: EXT.L - D0
+0x0ec4: ANDI.L - 0x80,D0
+0x0eca: POPAND.L - D0
+0x0ecc: TST.L - D0
+0x0ece: BEQ - [0x0e80]
+0x0ed0: RTS
+--------
+*/
+void FoolPrologue::sub_128_e80() {
+ while (true) {
+ this->var_i16_1ba = (int)g_toolbox->GetNextEvent(-1, &this->var_22);
+ if (this->var_22 == 6) {
+ this->sub_128_ed2();
+ }
+ if (this->var_22 == 7) {
+ this->sub_128_ee0();
+ }
+ if ((this->var_i16_30 & 0x80) && (this->var_22 == 0)) {
+ break;
+ }
+ }
+
+}
+
+/*
+0x0ed2: PUSH.L - VAR(0x24)
+0x0ed6: TRAP - _BeginUpdate
+0x0ed8: PUSH.L - VAR(0x24)
+0x0edc: TRAP - _EndUpdate
+0x0ede: RTS
+--------
+*/
+void FoolPrologue::sub_128_ed2() {
+ g_toolbox->BeginUpdate(this->var_window_24);
+ g_toolbox->EndUpdate(this->var_window_24);
+}
+
+/*
+0x0ee0: LEA - VAR(0x24),A0
+0x0ee4: EXG - D0,A0
+0x0ee6: JSR - "PEEKWORD"
+0x0eea: MOVE.W - D0,VAR(0x1bc)
+0x0eee: LEA - VAR(0x24),A0
+0x0ef2: EXG - D0,A0
+0x0ef4: ADDQ.L - 0x2,D0
+0x0ef6: JSR - "PEEKWORD"
+0x0efa: MOVE.W - D0,VAR(0x1be)
+0x0efe: MOVE.W - VAR(0x1be),D0
+0x0f02: EXT.L - D0
+0x0f04: JSR - "ZBASIC_UNK11"
+0x0f08: RTS
+--------
+*/
+void FoolPrologue::sub_128_ee0() {
+ this->var_i16_1bc = this->var_window_24.port;
+ this->var_i16_1be = this->var_window_24.windowKind;
+ zbasic_unk11(this->var_i16_1be);
+}
+/*
+
+0x0f0a: MOVE.W - 0x80,D1
+0x0f0e: JMP - "ZBASIC_199"
+0x0f12: JMP - 129,0x4
+*/
+
+// Sources:
+// QuickDraw types, Inside Macintosh I-201
+// QuickDraw global list, Inside Macintosh I-162
+
+// QuickDraw globals; offset below the A5 address.
+// GrafPtr thePort = 0x00
+// Pattern white = 0x04
+// Pattern black = 0x0c
+// Pattern gray = 0x14
+// Pattern ltGray = 0x1c
+// Pattern dkGray = 0x24
+// Arrow cursor = 0x2c
+// - Bits16 cursor.data = 0x2c
+// - Bits16 cursor.mask = 0x4c
+// - Point cursor.hotSpot = 0x6c
+// BitMap screenBits = 0x70
+// - Ptr screenBits.baseAddr = 0x70
+// - INTEGER screenBits.rowBytes = 0x74
+// - Rect screenBits.bounds = 0x76
+// LONGINT randSeed = 0x7e
+/*
+Found custom CODE block 129
+0x0004: MOVE.L - 0x904,D0
+0x000a: JSR - "PEEKLONG" # current A5
+0x000e: SUBI.L - 0x72,D0
+0x0014: JSR - "PEEKWORD" # quickdraw globals,
+0x0018: MOVE.W - D0,VAR(0x10)
+
+0x001c: MOVE.L - 0x904,D0
+0x0022: JSR - "PEEKLONG" # current A5
+0x0026: SUBI.L - 0x74,D0
+0x002c: JSR - "PEEKWORD"
+0x0030: MOVE.W - D0,VAR(0x12)
+*/
+
+void FoolPrologue::sub_129_004() {
+ // get the screen width and height from QuickDraw
+ this->var_i16_10 = SCREEN_WIDTH; // window width?
+ this->var_i16_12 = SCREEN_HEIGHT; // window height?
+
+/*
+0x0034: MOVE.W - VAR(0x10),D0
+0x0038: EXT.L - D0
+0x003a: SUBI.L - 0x200,D0
+0x0040: MOVE.L - D0,D1
+0x0042: MOVEQ - 0x2,D0
+0x0044: JSR - "DIV_INT"
+0x0048: MOVE.W - D0,VAR(0x14)
+
+0x004c: MOVE.W - VAR(0x12),D0
+0x0050: EXT.L - D0
+0x0052: SUBI.L - 0x156,D0
+0x0058: MOVE.L - D0,D1
+0x005a: MOVEQ - 0x2,D0
+0x005c: JSR - "DIV_INT"
+0x0060: MOVE.W - D0,VAR(0x16)
+*/
+ // 129:0034
+ // set left and top offsets based on a drawable area of 512x342
+ this->var_i16_14 = (this->var_i16_10 - 0x200)/2;
+ this->var_i16_16 = (this->var_i16_12 - 0x156)/2;
+
+ /*
+0x0064: MOVEQ - 0x1,D0
+0x0066: PUSH.W - D0
+0x0068: PEA - STR(0xd0) # b''
+0x0070: PUSH.W - 0
+0x0072: PUSH.W - 0
+0x0074: MOVEQ - -0x1,D0
+0x0076: PUSH.W - D0
+0x0078: PUSH.W - VAR(0x10)
+0x007c: PUSH.W - VAR(0x12)
+0x0080: MOVEQ - -0x1,D0
+0x0082: PUSH.W - D0
+0x0084: MOVEQ - 0x3,D0
+0x0086: PUSH.W - D0
+0x0088: JSR - "WINDOW"
+0x008c: JSR - "COORDINATE_WINDOW"
+0x0090: MOVEQ - 0x0,D0
+0x0092: MOVE.W - D0,VAR(0x1c)
+0x0096: MOVEQ - 0x0,D0
+0x0098: MOVE.W - D0,VAR(0x1e)
+0x009c: MOVEQ - 0x0,D0
+0x009e: MOVE.W - D0,VAR(0x20)
+*/
+ // 129:0064
+ zbasic_window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, 3);
+ zbasic_coordinate_window();
+
+ this->var_i16_1c = 0;
+ this->var_i16_1e = 0;
+ this->var_i16_20 = 0;
+/*
+0x00a2: MOVE.L - 0x28e,D0 # ROM85
+0x00a8: JSR - "BCD_FROM_INT"
+0x00ac: JSR - "CAST_INT"
+0x00b0: JSR - "PEEKWORD"
+0x00b4: CMPI.L - 0x3fff,D0
+0x00ba: BEQ - [0x00c0]
+0x00bc: JMP - [0xee]
+--------
+0x00c0: MOVE.W - 0x4e20,VAR(0x1c)
+0x00c6: MOVE.W - 0x4e20,VAR(0x1e)
+0x00cc: MOVE.W - 0x4e20,VAR(0x20)
+0x00d2: MOVEQ - 0x64,D0
+0x00d4: PUSH.W - D0
+0x00d6: MOVEQ - 0x64,D0
+0x00d8: PUSH.W - D0
+0x00da: PEA - VAR(0x1c)
+0x00de: TRAP - _SetCPixel
+0x00e0: MOVEQ - 0x64,D0
+0x00e2: PUSH.W - D0
+0x00e4: MOVEQ - 0x64,D0
+0x00e6: PUSH.W - D0
+0x00e8: PEA - VAR(0x1c)
+0x00ec: TRAP - _GetCPixel
+
+ */
+ // code checks Rom85 for presence of 128K ROM before doing next bit
+ // 129:00a2
+ if (true) {
+ this->var_i16_1c = 0x4e20;
+ this->var_i16_1e = 0x4e20;
+ this->var_i16_20 = 0x4e20;
+ g_toolbox->SetCPixel(0x64, 0x64, &this->var_i16_1c);
+ g_toolbox->GetCPixel(0x64, 0x64, &this->var_i16_1c);
+ }
+
+/*
+0x00ee: MOVE.L - HEAP(0xa8a),D0
+0x00f8: MOVE.L - D0,VAR(0xc)
+0x00fc: PUSH.L - VAR(0xc)
+0x0100: TRAP - _OpenPort
+0x0102: MOVE.L - HEAP(0x9c0),D0
+0x010c: MOVE.L - D0,VAR(0x8)
+0x0110: PUSH.L - VAR(0x8)
+0x0114: TRAP - _OpenPort
+0x0116: CMPI.W - 0x200,VAR(0x10)
+0x011c: SNE - D0
+0x011e: EXT.W - D0
+0x0120: EXT.L - D0
+0x0122: PUSH.L - D0
+0x0124: CMPI.W - 0x156,VAR(0x12)
+0x012a: SNE - D0
+0x012c: EXT.W - D0
+0x012e: EXT.L - D0
+0x0130: POPOR.L - D0
+0x0132: TST.L - D0
+0x0134: BNE - [0x013a]
+0x0136: JMP - [0x1b0]
+--------
+ */
+
+ // 129:00ee
+ this->var_i32_c = this->arr_i21_a8a[0];
+ g_toolbox->OpenPort(this->var_i32_c);
+ this->var_i32_8 = this->arr_i21_9c0[0];
+ g_toolbox->OpenPort(this->var_i32_8);
+
+ if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
+
+/*
+
+0x013a: PEA - [0x0156]
+0x013e: MOVEQ - 0x14,D0
+0x0140: PUSH.L - D0
+0x0142: PUSH.L - 0
+0x0144: MOVEA.W - VAR(0x12),A0
+0x0148: PUSH.L - A0
+0x014a: MOVEA.W - VAR(0x10),A0
+0x014e: PUSH.L - A0
+0x0150: MOVEQ - 0x2,D0
+0x0152: JMP - 128,0x2f0
+
+0x0156: MOVE.L - HEAP(0x1bc),D0
+0x0160: PUSH.L - D0
+0x0162: MOVE.W - VAR(0x14),D0
+0x0166: EXT.L - D0
+0x0168: SUBQ.L - 0x2,D0
+0x016a: PUSH.W - D0
+0x016c: MOVE.W - VAR(0x16),D0
+0x0170: EXT.L - D0
+0x0172: SUBQ.L - 0x2,D0
+0x0174: PUSH.W - D0
+0x0176: MOVE.W - VAR(0x14),D0
+0x017a: EXT.L - D0
+0x017c: ADDI.L - 0x00000202,D0
+0x0182: PUSH.W - D0
+0x0184: MOVE.W - VAR(0x16),D0
+0x0188: EXT.L - D0
+0x018a: ADDI.L - 0x00000158,D0
+0x0190: PUSH.W - D0
+0x0192: TRAP - _SetRect
+
+0x0194: MOVE.L - HEAP(0x19c),D0
+0x019e: PUSH.L - D0
+0x01a0: TRAP - _PenPat
+0x01a2: MOVE.L - HEAP(0x1bc),D0
+0x01ac: PUSH.L - D0
+0x01ae: TRAP - _FrameRect
+ * */
+ // 129:013a
+ this->sub_128_2f0(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
+ g_toolbox->SetRect(this->arr_i32_1bc[0], this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
+ g_toolbox->PenPat(this->arr_i32_19c[0]);
+ g_toolbox->FrameRect(this->arr_i32_1bc[0]);
+ }
+
+/*
+0x01b0: PUSH.L - VAR(0x8)
+0x01b4: TRAP - _SetPort
+
+0x01b6: PUSH.W - 0x200
+0x01ba: PUSH.W - 0x156
+0x01be: TRAP - _PortSize
+
+0x01c0: PUSH.W - VAR(0x14)
+0x01c4: PUSH.W - VAR(0x16)
+0x01c8: TRAP - _MovePortTo
+
+0x01ca: MOVE.L - HEAP(0x1bc),D0
+0x01d4: PUSH.L - D0
+0x01d6: PUSH.W - 0
+0x01d8: PUSH.W - 0
+0x01da: PUSH.W - 0x200
+0x01de: PUSH.W - 0x156
+0x01e2: TRAP - _SetRect
+
+0x01e4: MOVE.L - HEAP(0x1bc),D0
+0x01ee: PUSH.L - D0
+0x01f0: TRAP - _ClipRect
+ */
+
+ // 129:01b0
+ g_toolbox->SetPort(this->var_i32_8);
+ g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->MovePortTo(this->var_i16_14, this->var_i16_16);
+ g_toolbox->SetRect(this->arr_i32_1bc[0], 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->ClipRect(this->arr_i32_1bc[0]);
+/*
+0x01f2: CMPI.W - 0x156,VAR(0x12)
+0x01f8: BEQ - [0x01fe]
+0x01fa: JMP - [0x238]
+--------
+0x01fe: MOVE.L - HEAP(0x1bc),D0
+0x0208: PUSH.L - D0
+0x020a: PUSH.W - 0
+0x020c: MOVEQ - 0x14,D0
+0x020e: PUSH.W - D0
+0x0210: PUSH.W - 0x200
+0x0214: PUSH.W - 0x156
+0x0218: TRAP - _SetRect
+0x021a: MOVE.L - HEAP(0x1bc),D0
+0x0224: PUSH.L - D0
+0x0226: MOVE.L - HEAP(0x19c),D0
+0x0230: PUSH.L - D0
+0x0232: TRAP - _FillRect
+0x0234: JMP - [0x26c]
+--------
+0x0238: MOVE.L - HEAP(0x1bc),D0
+0x0242: PUSH.L - D0
+0x0244: PUSH.W - 0
+0x0246: PUSH.W - 0
+0x0248: PUSH.W - 0x200
+0x024c: PUSH.W - 0x156
+0x0250: TRAP - _SetRect
+0x0252: MOVE.L - HEAP(0x1bc),D0
+0x025c: PUSH.L - D0
+0x025e: MOVE.L - HEAP(0x19c),D0
+0x0268: PUSH.L - D0
+0x026a: TRAP - _FillRect
+ * */
+ // 129:01f2
+ if (this->var_i16_12 == SCREEN_HEIGHT) {
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(this->arr_i32_1bc, this->arr_i32_19c);
+ } else {
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(this->arr_i32_1bc, this->arr_i32_19c);
+ }
+
+ /*
+0x026c: MOVE.L - VAR(0x8),D0
+0x0270: ADDQ.L - 0x2,D0
+0x0272: JSR - "PEEKLONG"
+0x0276: MOVE.L - D0,VAR(0x32)
+
+0x027a: MOVEQ - 0x40,D0
+0x027c: MOVE.W - D0,VAR(0x36)
+
+0x0280: MOVE.W - VAR(0x16),D0
+0x0284: EXT.L - D0
+0x0286: NEG.L - D0
+0x0288: MOVE.W - D0,VAR(0x38)
+
+0x028c: MOVE.W - VAR(0x14),D0
+0x0290: EXT.L - D0
+0x0292: NEG.L - D0
+0x0294: MOVE.W - D0,VAR(0x3a)
+
+0x0298: MOVE.W - VAR(0x16),D0
+0x029c: EXT.L - D0
+0x029e: ADDI.L - 0x00000156,D0
+0x02a4: MOVE.W - D0,VAR(0x3c)
+
+0x02a8: MOVE.W - VAR(0x14),D0
+0x02ac: EXT.L - D0
+0x02ae: ADDI.L - 0x00000200,D0
+0x02b4: MOVE.W - D0,VAR(0x3e)
+
+0x02b8: MOVEQ - 0x40,D0
+0x02ba: MOVE.W - D0,VAR(0x44)
+
+0x02be: MOVEQ - 0x0,D0
+0x02c0: MOVE.W - D0,VAR(0x46)
+
+0x02c4: MOVEQ - 0x0,D0
+0x02c6: MOVE.W - D0,VAR(0x48)
+
+0x02ca: MOVE.W - 0x156,VAR(0x4a)
+
+0x02d0: MOVE.W - 0x200,VAR(0x4c)
+
+0x02d6: MOVEQ - 0x40,D0
+0x02d8: MOVE.W - D0,VAR(0x52)
+
+0x02dc: MOVEQ - 0x0,D0
+0x02de: MOVE.W - D0,VAR(0x54)
+
+0x02e2: MOVEQ - 0x0,D0
+0x02e4: MOVE.W - D0,VAR(0x56)
+
+0x02e8: MOVE.W - 0x156,VAR(0x58)
+
+0x02ee: MOVE.W - 0x200,VAR(0x5a)
+
+0x02f4: MOVEQ - -0x1,D0
+0x02f6: JSR - "MEM"
+0x02fa: MOVE.L - D0,VAR(0x1c0)
+*/
+ // 129:026c
+ this->var_i32_32 = this->var_i32_8.portBits;
+ this->var_i16_36 = 0x40;
+ this->var_i16_38 = -this->var_i16_16;
+ this->var_i16_3a = -this->var_i16_14;
+ this->var_i16_3c = this->var_i16_16 + SCREEN_HEIGHT;
+ this->var_i16_3e = this->var_i16_14 + SCREEN_WIDTH;
+ this->var_i16_44 = 0x40;
+ this->var_i16_46 = 0x0;
+ this->var_i16_48 = 0x0;
+ this->var_i16_4a = SCREEN_HEIGHT;
+ this->var_i16_4c = SCREEN_WIDTH;
+ this->var_i16_52 = 0x40;
+ this->var_i16_54 = 0x0;
+ this->var_i16_56 = 0x0;
+ this->var_i16_58 = SCREEN_HEIGHT;
+ this->var_i16_5a = SCREEN_WIDTH;
+
+ this->var_i32_1c0 = zbasic_mem(-1);
+ /*
+
+0x02fe: CMPI.L - 0xd6d8,VAR(0x1c0)
+0x0306: BLT - [0x030c]
+0x0308: JMP - [0x4a0]
+--------
+0x030c: TRAP - _InitCursor
+0x030e: MOVEQ - 0x0,D0
+0x0310: MOVE.L - D0,D1
+0x0312: MOVEQ - 0x14,D0
+0x0314: JSR - "GET_FROM"
+
+0x0318: PUSH.L - 0x000001fc
+0x031e: PUSH.L - 0x00000152
+0x0324: MOVE.L - HEAP(0xb54),D0
+0x032e: MOVEA.L - D0,A0
+0x0330: POP.L - D0
+0x0332: POP.L - D1
+0x0334: JSR - "GET_TO"
+
+0x0338: MOVEQ - 0x19,D0
+0x033a: PUSH.W - D0
+0x033c: MOVEQ - 0x64,D0
+0x033e: PUSH.L - D0
+0x0340: PUSH.W - 0xff
+0x0344: PUSH.W - 0
+0x0346: JSR - "ZBASIC_UNK6"
+
+0x034a: PEA - [0x0368]
+0x034e: MOVEQ - 0x46,D0
+0x0350: PUSH.L - D0
+0x0352: MOVEQ - 0x64,D0
+0x0354: PUSH.L - D0
+0x0356: PUSH.L - 0x000000d8
+0x035c: PUSH.L - 0x00000198
+0x0362: MOVEQ - 0x2,D0
+0x0364: JMP - 128,0x2f0
+
+0x0368: PEA - [0x0386]
+0x036c: MOVEQ - 0x4b,D0
+0x036e: PUSH.L - D0
+0x0370: MOVEQ - 0x69,D0
+0x0372: PUSH.L - D0
+0x0374: PUSH.L - 0x000000d3
+0x037a: PUSH.L - 0x00000193
+0x0380: MOVEQ - 0x1,D0
+0x0382: JMP - 128,0x2f0
+
+*/
+ // 129:02fe
+ if (this->var_i32_1c0 < 0xd6d8) {
+ g_toolbox->InitCursor();
+ zbasic_get_from(0x0, 0x14);
+ zbasic_get_to(0x1fc, 0x152, this->arr_i32_b54);
+ zbasic_unk6(0x19, 0x64, 0xff, 0x0);
+ this->sub_128_2f0(2, 0x46, 0x64, 0xd8, 0x198);
+ this->sub_128_2f0(1, 0x4b, 0x69, 0xd3, 0x193);
+ /*
+
+
+0x0386: PEA - [0x03a4]
+0x038a: MOVEQ - 0x50,D0
+0x038c: PUSH.L - D0
+0x038e: MOVEQ - 0x6e,D0
+0x0390: PUSH.L - D0
+0x0392: PUSH.L - 0x000000ce
+0x0398: PUSH.L - 0x0000018e
+0x039e: MOVEQ - 0x2,D0
+0x03a0: JMP - 128,0x2f0
+
+0x03a4: PUSH.W - 0
+0x03a6: MOVEQ - 0xc,D0
+0x03a8: PUSH.W - D0
+0x03aa: PUSH.W - 0
+0x03ac: MOVEQ - 0x3,D0
+0x03ae: PUSH.W - D0
+0x03b0: JSR - "TEXT"
+
+0x03b4: MOVEA.L - STR(0xd2),A0 # b'There is not enough available memory'
+0x03bc: JSR - "BUFFER_CONCAT"
+0x03c0: LEA - VAR(0x76),A0
+0x03c4: JSR - "BUFFER_FLUSH"
+0x03c8: PEA - [0x03d8]
+0x03cc: PUSH.L - 0x000000fc
+0x03d2: MOVEQ - 0x64,D0
+0x03d4: JMP - 128,0x2a6
+
+0x03d8: MOVEA.L - STR(0xf8),A0 # b'to run the program at this time.'
+0x03e0: JSR - "BUFFER_CONCAT"
+0x03e4: LEA - VAR(0x76),A0
+0x03e8: JSR - "BUFFER_FLUSH"
+0x03ec: PEA - [0x03fc]
+0x03f0: PUSH.L - 0x000000fc
+0x03f6: MOVEQ - 0x78,D0
+0x03f8: JMP - 128,0x2a6
+
+0x03fc: MOVEA.L - STR(0x11a),A0 # b'Check your instruction manual for '
+0x0404: JSR - "BUFFER_CONCAT"
+0x0408: LEA - VAR(0x76),A0
+0x040c: JSR - "BUFFER_FLUSH"
+0x0410: PEA - [0x0424]
+0x0414: PUSH.L - 0x000000fc
+0x041a: MOVE.L - 0x96,D0
+0x0420: JMP - 128,0x2a6
+
+0x0424: MOVEA.L - STR(0x13e),A0 # b'for possible solutions.'
+0x042c: JSR - "BUFFER_CONCAT"
+0x0430: LEA - VAR(0x76),A0
+0x0434: JSR - "BUFFER_FLUSH"
+0x0438: PEA - [0x044c]
+0x043c: PUSH.L - 0x000000fc
+0x0442: MOVE.L - 0xaa,D0
+0x0448: JMP - 128,0x2a6
+
+0x044c: MOVEA.L - STR(0x156),A0 # b'(click mouse to quit)'
+0x0454: JSR - "BUFFER_CONCAT"
+0x0458: LEA - VAR(0x76),A0
+0x045c: JSR - "BUFFER_FLUSH"
+0x0460: PEA - [0x0474]
+0x0464: PUSH.L - 0x000000fc
+0x046a: MOVE.L - 0xcb,D0
+0x0470: JMP - 128,0x2a6
+
+0x0474: JSR - 128,0xe58
+
+0x0478: MOVEQ - 0x0,D0
+0x047a: MOVE.L - D0,D1
+0x047c: MOVEQ - 0x14,D0
+0x047e: JSR - "GET_FROM"
+
+0x0482: PUSH.W - 0
+0x0484: MOVE.L - HEAP(0xb54),D0
+0x048e: PUSH.L - D0
+0x0490: MOVEQ - 0x0,D0
+0x0492: JSR - "ZBASIC_194"
+
+0x0496: MOVEQ - 0x0,D0
+0x0498: MOVE.W - D0,VAR(0x1aa)
+0x049c: JMP - [0x772]
+--------
+*/
+ // 129:0386
+ this->sub_128_2f0(2, 0x50, 0x6e, 0xc3, 0x18e);
+ zbasic_text(0, 0xc, 0, 3);
+ this->var_str_76 = STR(0xd2);
+ this->sub_128_2a6(0x64, 0xfc);
+ this->var_str_76 = STR(0xf8);
+ this->sub_128_2a6(0x78, 0xfc);
+ this->var_str_76 = STR(0x11a);
+ this->sub_128_2a6(0x96, 0xfc);
+ this->var_str_76 = STR(0x13e);
+ this->sub_128_2a6(0xaa, 0xfc);
+ this->var_str_76 = STR(0x156);
+ this->sub_128_2a6(0xcb, 0xfc);
+ this->sub_128_e58();
+ zbasic_get_from(0x0, 0x14);
+
+ zbasic_194(0, 0, this->arr_i32_b54);
+ this->var_i16_1aa = 0;
+
+ } else {
+ // 129:04a0
+ this->var_i16_180 = 1;
+ this->var_i16_1aa = 1;
+ this->var_i16_176 = zbasic_249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
+ if (zbasic_106(STR(0x16c), &this->var_i16_1c4)) {
+ // 129:04de
+ this->var_str_76 = STR(0x16e);
+ for (int i = 1; i < 0xa; i++) {
+ this->var_str_76 += zbasic_chr(this->var_i16_74);
+ }
+
+ // 129:0522
+ this->var_i16_2ca = this->var_str_76.size();
+ this->var_i16_2cc = 0;
+ // 129:0534
+ // ??????
+/*
+0x0534: LEA - [0x0764],A0
+0x0538: MOVE.L - A0,-0x8ee(A5)
+0x053c: SF - 0x8,D0
+0x053e: MOVEQ - 0x1,D0
+0x0540: PUSH.W - D0
+0x0542: PEA - VAR(0x1c4)
+0x0546: PUSH.L - 0x000003fc
+0x054c: PUSH.W - VAR(0x2c8)
+0x0550: JSR - "ZBASIC_135"
+
+0x0554: MOVEQ - 0x1,D0
+0x0556: MOVE.W - D0,-0x914(A5)
+0x055a: PEA - VAR(0x2ce)
+0x055e: MOVE.W - VAR(0x2ca),D0
+0x0562: EXT.L - D0
+0x0564: POP.L - A0
+0x0566: JSR - "ZBASIC_163"
+
+0x056a: MOVEQ - 0x1,D0
+0x056c: JSR - "CLOSE"
+
+0x0570: CLR.L - -0x8ee(A5)
+0x0574: PEA - VAR(0x76)
+0x0578: LEA - VAR(0x2ce),A0
+0x057c: POP.L - A1
+0x057e: JSR - "ZBASIC_103"
+
+0x0582: PUSH.L - D0
+0x0584: MOVE.W - VAR(0x2cc),D0
+0x0588: SEQ - D0
+0x058a: EXT.W - D0
+0x058c: EXT.L - D0
+0x058e: POPAND.L - D0
+0x0590: TST.L - D0
+0x0592: BEQ - [0x05a0]
+0x0596: MOVEQ - 0x2,D0
+0x0598: MOVE.W - D0,VAR(0x1aa)
+0x059c: BRA - [0x05a6]
+0x05a0: MOVEQ - 0x0,D0
+0x05a2: MOVE.W - D0,VAR(0x1aa)
+ */
+
+ }
+ // 129:05a6
+ if (this->var_i16_1c + this->var_i16_20 + this->var_i16_1e != 0) {
+ g_toolbox->InitCursor();
+ zbasic_get_from(0x0, 0x14);
+ zbasic_get_to(0x1fc, 0x152, this->arr_i32_b54);
+ zbasic_unk6(0x19, 0x64, 0xff, 0x00);
+ this->sub_128_2f0(2, 0x64, 0x7e, 0xd8, 0x17a);
+ this->sub_128_2f0(1, 0x69, 0x83, 0xd3, 0x175);
+ this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
+ // 129:0662
+ zbasic_text(0, 0xc, 0, 0x3);
+ this->var_str_76 = STR(0x1ac);
+ this->sub_128_2a6(0x82, 0xfc);
+ this->var_str_76 = STR(0x1c0);
+ this->sub_128_2a6(0x96, 0xfc);
+
+ this->var_str_76 = STR(0x1d8); // start the prologue again
+ if (this->var_i16_1aa == 2) {
+ this->var_str_76 = STR(0x1f6); // start the finale again
+ }
+ this->sub_128_2a6(0xaa, 0xfc);
+
+ this->var_str_76 = STR(0x212);
+ this->sub_128_2a6(0xcb, 0xfc);
+ // 129:0730
+ this->sub_128_e58();
+ zbasic_get_from(0x0, 0x14);
+ zbasic_194(0x0, 0x0, this->arr_i32_b54);
+ this->var_i16_1aa = 0;
+ } else {
+ // 129:075c
+ this->sub_128_e80();
+ }
+ // 129:0772
+ zbasic_199(0x81);
+ this->sub_130_004();
+
+/*
+0x04a0: MOVEQ - 0x1,D0
+0x04a2: MOVE.W - D0,VAR(0x180)
+0x04a6: MOVEQ - 0x1,D0
+0x04a8: MOVE.W - D0,VAR(0x1aa)
+0x04ac: PEA - VAR(0x180)
+0x04b0: PEA - VAR(0x1c4)
+0x04b4: PEA - VAR(0x2c4)
+0x04b8: PEA - VAR(0x2c8)
+0x04bc: JSR - "ZBASIC_249"
+0x04c0: MOVE.W - D0,VAR(0x176)
+
+0x04c4: PEA - VAR(0x1c4)
+0x04c8: MOVEA.L - STR(0x16c),A0 # b''
+0x04d0: POP.L - A1
+0x04d2: JSR - "ZBASIC_106"
+0x04d6: TST.L - D0
+0x04d8: BNE - [0x04de]
+0x04da: JMP - [0x5a6]
+--------
+
+0x04de: MOVEA.L - STR(0x16e),A0 # b"And now it is time to show the Finale for the Fool's Errand."
+0x04e6: JSR - "BUFFER_CONCAT"
+0x04ea: LEA - VAR(0x76),A0
+0x04ee: JSR - "BUFFER_FLUSH"
+0x04f2: MOVEQ - 0x1,D0
+0x04f4: MOVE.W - D0,VAR(0x74)
+
+0x04f8: LEA - VAR(0x76),A0
+0x04fc: JSR - "BUFFER_CONCAT"
+
+0x0500: MOVE.W - VAR(0x74),D0
+0x0504: EXT.L - D0
+0x0506: JSR - "CHR$"
+0x050a: JSR - "BUFFER_CONCAT"
+0x050e: LEA - VAR(0x76),A0
+0x0512: JSR - "BUFFER_FLUSH"
+
+0x0516: MOVEQ - 0xa,D0
+0x0518: ADDQ.W - 0x1,VAR(0x74)
+0x051c: CMP.W - VAR(0x74),D0
+0x0520: BGE - [0x04f8]
+
+0x0522: LEA - VAR(0x76),A0
+0x0526: JSR - "LEN"
+0x052a: MOVE.W - D0,VAR(0x2ca)
+
+0x052e: MOVEQ - 0x0,D0
+0x0530: MOVE.W - D0,VAR(0x2cc)
+
+
+0x05a6: MOVE.W - VAR(0x1c),D0
+0x05aa: EXT.L - D0
+0x05ac: MOVEA.W - VAR(0x20),A0
+0x05b0: ADD.L - A0,D0
+0x05b2: MOVEA.W - VAR(0x1e),A0
+0x05b6: ADD.L - A0,D0
+0x05b8: CMPI.L - 0x0,D0
+0x05be: BNE - [0x05c4]
+0x05c0: JMP - [0x75c]
+--------
+0x05c4: TRAP - _InitCursor
+0x05c6: MOVEQ - 0x0,D0
+0x05c8: MOVE.L - D0,D1
+0x05ca: MOVEQ - 0x14,D0
+0x05cc: JSR - "GET_FROM"
+0x05d0: PUSH.L - 0x000001fc
+0x05d6: PUSH.L - 0x00000152
+0x05dc: MOVE.L - HEAP(0xb54),D0
+0x05e6: MOVEA.L - D0,A0
+0x05e8: POP.L - D0
+0x05ea: POP.L - D1
+0x05ec: JSR - "GET_TO"
+
+0x05f0: MOVEQ - 0x19,D0
+0x05f2: PUSH.W - D0
+0x05f4: MOVEQ - 0x64,D0
+0x05f6: PUSH.L - D0
+0x05f8: PUSH.W - 0xff
+0x05fc: PUSH.W - 0
+0x05fe: JSR - "ZBASIC_UNK6"
+
+0x0602: PEA - [0x0622]
+0x0606: MOVEQ - 0x64,D0
+0x0608: PUSH.L - D0
+0x060a: PUSH.L - 0x0000007e
+0x0610: PUSH.L - 0x000000d8
+0x0616: PUSH.L - 0x0000017a
+0x061c: MOVEQ - 0x2,D0
+0x061e: JMP - 128,0x2f0
+
+0x0622: PEA - [0x0642]
+0x0626: MOVEQ - 0x69,D0
+0x0628: PUSH.L - D0
+0x062a: PUSH.L - 0x00000083
+0x0630: PUSH.L - 0x000000d3
+0x0636: PUSH.L - 0x00000175
+0x063c: MOVEQ - 0x1,D0
+0x063e: JMP - 128,0x2f0
+
+0x0642: PEA - [0x0662]
+0x0646: MOVEQ - 0x6e,D0
+0x0648: PUSH.L - D0
+0x064a: PUSH.L - 0x00000088
+0x0650: PUSH.L - 0x000000ce
+0x0656: PUSH.L - 0x00000170
+0x065c: MOVEQ - 0x2,D0
+0x065e: JMP - 128,0x2f0
+
+0x0662: PUSH.W - 0
+0x0664: MOVEQ - 0xc,D0
+0x0666: PUSH.W - D0
+0x0668: PUSH.W - 0
+0x066a: MOVEQ - 0x3,D0
+0x066c: PUSH.W - D0
+0x066e: JSR - "TEXT"
+
+0x0672: MOVEA.L - STR(0x1ac),A0 # b'Set your monitor to'
+0x067a: JSR - "BUFFER_CONCAT"
+0x067e: LEA - VAR(0x76),A0
+0x0682: JSR - "BUFFER_FLUSH"
+0x0686: PEA - [0x069a]
+0x068a: PUSH.L - 0x000000fc
+0x0690: MOVE.L - 0x82,D0
+0x0696: JMP - 128,0x2a6
+
+0x069a: MOVEA.L - STR(0x1c0),A0 # b'2 color black and white'
+0x06a2: JSR - "BUFFER_CONCAT"
+0x06a6: LEA - VAR(0x76),A0
+0x06aa: JSR - "BUFFER_FLUSH"
+0x06ae: PEA - [0x06c2]
+0x06b2: PUSH.L - 0x000000fc
+0x06b8: MOVE.L - 0x96,D0
+0x06be: JMP - 128,0x2a6
+
+0x06c2: MOVEA.L - STR(0x1d8),A0 # b'and start the Prologue again.'
+0x06ca: JSR - "BUFFER_CONCAT"
+0x06ce: LEA - VAR(0x76),A0
+0x06d2: JSR - "BUFFER_FLUSH"
+0x06d6: CMPI.W - 0x2,VAR(0x1aa)
+0x06dc: BNE - [0x06f4]
+0x06e0: MOVEA.L - STR(0x1f6),A0 # b'and start the Finale again.'
+0x06e8: JSR - "BUFFER_CONCAT"
+0x06ec: LEA - VAR(0x76),A0
+0x06f0: JSR - "BUFFER_FLUSH"
+0x06f4: PEA - [0x0708]
+0x06f8: PUSH.L - 0x000000fc
+0x06fe: MOVE.L - 0xaa,D0
+0x0704: JMP - 128,0x2a6
+
+0x0708: MOVEA.L - STR(0x212),A0 # b'(click mouse to quit)'
+0x0710: JSR - "BUFFER_CONCAT"
+0x0714: LEA - VAR(0x76),A0
+0x0718: JSR - "BUFFER_FLUSH"
+0x071c: PEA - [0x0730]
+0x0720: PUSH.L - 0x000000fc
+0x0726: MOVE.L - 0xcb,D0
+0x072c: JMP - 128,0x2a6
+
+0x0730: JSR - 128,0xe58
+0x0734: MOVEQ - 0x0,D0
+0x0736: MOVE.L - D0,D1
+0x0738: MOVEQ - 0x14,D0
+0x073a: JSR - "GET_FROM"
+
+0x073e: PUSH.W - 0
+0x0740: MOVE.L - HEAP(0xb54),D0
+0x074a: PUSH.L - D0
+0x074c: MOVEQ - 0x0,D0
+0x074e: JSR - "ZBASIC_194"
+0x0752: MOVEQ - 0x0,D0
+0x0754: MOVE.W - D0,VAR(0x1aa)
+0x0758: JMP - [0x772]
+--------
+
+
+0x075c: JSR - 128,0xe80
+0x0760: JMP - [0x772]
+--------
+0x0764: MOVEQ - 0x1,D0
+0x0766: MOVE.W - D0,VAR(0x2cc)
+0x076a: MOVEQ - 0x0,D0
+0x076c: JSR - "ZBASIC_130"
+0x0770: RTS
+--------
+0x0772: MOVE.W - 0x81,D1
+0x0776: JMP - "ZBASIC_199"
+0x077a: JMP - 130,0x4
+ */
+ }
+}
+
+void FoolPrologue::sub_129_764() {
+ this->var_i16_2cc = 1;
+ zbasic_130(0);
+}
+
+
+void FoolPrologue::sub_130_004() {
+ this->var_i16_3ce = 5;
+ this->sub_130_d28();
+ this->var_i16_18e = 0x156;
+ this->sub_128_ccc();
+
+ this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
+ this->var_i16_3ce = 0xa;
+ this->sub_130_d28();
+ this->sub_128_1f4(0xb);
+ this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0x74, 0xaa, 0x00, 0x00, this->glob_i32_2ce);
+ g_toolbox->ReleaseResource(*this->glob_i32_2ce);
+
+ // 130:007a
+ zbasic_text(0xfb, 0x9, 0x0, 0x3);
+ this->var_str_76 = STR(0x228);
+ this->sub_128_2a6(0x10d, 0xdd);
+ g_toolbox->SetPortBits(&this->var_i32_32);
+ for (int i = 1; i < 5; i++) {
+ this->sub_130_cea();
+ }
+ this->sub_128_1f4(7);
+
+ // 130:00d6
+ this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0, 0x96, 0, this->arr_u8_4);
+ g_toolbox->ReleaseResource(*this->arr_u8_4);
+ this->sub_128_1f4(8);
+
+ // 130:011c
+ this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0, 0x96, 0, this->arr_u8_8);
+ g_toolbox->ReleaseResource(*this->arr_u8_8);
+
+ // 130:015c
+ for (int i = 3; i < 5; i++) {
+ zbasic_blockmove(this->arr_i32_412b2[0], this->arr_i32_41296[i], 0x5580);
+ }
+ this->sub_130_cea();
+ this->sub_128_1f4(0);
+
+ // 130:01aa
+ zbasic_picture(0, 0, 0, this->arr_u8_18);
+ g_toolbox->ReleaseResource(*this->arr_u8_18);
+ this->sub_130_cea();
+
+ zbasic_blockmove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
+ this->sub_128_1f4(1);
+
+ // 130:0202
+ zbasic_picture(0xa2, 0x3c, 0, this->arr_u8_1c);
+ g_toolbox->ReleaseResource(*this->arr_u8_1c);
+ this->sub_130_cea();
+ this->sub_128_1f4(2);
+
+ // 130:0234
+ this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0x5a, 0x2e, 0, this->arr_u8_20);
+ g_toolbox->ReleaseResource(*this->arr_u8_20);
+
+ // 130:0276
+ for (int j = 9; j < 0xb; j++) {
+ this->sub_130_cea();
+
+ if (j == 9) {
+ this->var_i16_74 = 0;
+ } else {
+ this->var_i16_74 = 0x81;
+ }
+
+ // 130:029a
+ this->sub_128_1f4(j - 6);
+ zbasic_picture(0, 0, 0, this->arr_i32_0[j]);
+ zbasic_picture(this->var_i16_74, 0x96, 0, this->arr_i32_0[j - 6]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[j]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[j - 6]);
+ }
+ this->sub_130_cea();
+
+ // 130:0320
+ this->sub_128_1f4(6);
+ zbasic_picture(0, 0, 0, this->arr_i32_0[0xc]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[0xc]);
+
+ // 130:034a
+ for (int i = 0xd; i < 0x12; i++) {
+ this->sub_130_cea();
+ }
+
+ this->arr_i32_120[0] = g_toolbox->GetPicture(0x48);
+ g_toolbox->SetPortBits(&this->var_i32_32);
+
+ // 130:0380
+ if ((this->var_i16_10 == 0x200) && (this->var_i16_12 == 0x156)) {
+ this->sub_128_2f0(1, 0, 0, 0x14, 0x1fc);
+ } else {
+ g_toolbox->SetPort(this->var_i32_c);
+ this->sub_128_2f0(2, 0, 0, 0x14, this->var_i16_10);
+ g_toolbox->SetPort(this->var_i32_8);
+ }
+ // 130:03e4
+ this->sub_128_21e(0x3c);
+ this->sub_128_64a(0x2);
+ this->sub_128_21e(0x1e);
+ this->sub_128_610(0xb);
+ this->sub_128_21e(0x5a);
+ this->sub_130_db0();
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, 0x200, 0x156);
+ g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, 0x200, 0x118);
+
+ // 130:043c
+ for (int i = 1; i < 2; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->sub_128_a8c(0xb4);
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(this->arr_i32_1bc);
+ this->sub_128_24a(1);
+ g_toolbox->InvertRect(this->arr_i32_1bc);
+ // 130:04ca
+ for (int j = 0; j < 3; j++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_40 = this->arr_i32_412b2[1];
+ // 130:049e
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->sub_128_a8c(4);
+ this->var_i16_192 = 0;
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_40 = *this->arr_i32_412a2;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->sub_128_a8c(5);
+ // 130:0518
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_40 = *this->arr_i32_412a6;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->sub_128_a8c(5);
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_40 = *this->arr_i32_412aa;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->sub_128_a8c(5);
+ }
+ // 130:05b6
+ this->var_i32_40 = *this->arr_i32_412b2;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+
+ }
+
+ // 130:05fc
+ this->sub_128_610(0);
+ this->sub_130_db0();
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->sub_128_a8c(0xb4);
+ this->var_i32_40 = *this->arr_i32_4129a;
+
+ // 130:062c
+ this->var_i16_74 = 0;
+ while (this->var_i16_74 != 0x156) {
+ this->var_i16_62 = 0x200;
+ this->var_i32_2 = g_toolbox->TickCount();
+ for (int j = 1; j < 0x7; j++) {
+ this->var_i16_192 = 1;
+ if (this->var_i16_74 < 0x156) {
+ this->var_i16_74 += 1;
+ }
+ this->var_i16_5c = this->arr_i16_412ea[this->var_i16_74] - 1;
+ this->var_i16_60 = this->arr_i16_412ea[this->var_i16_74];
+ // 130:068e
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_5c, this->arr_i32_5c, 0, 0);
+ }
+ // 130:06b0
+ this->sub_128_a8c(1);
+ }
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->sub_128_a8c(0xa);
+ this->sub_128_610(1);
+ // 130:06d4
+ for (int i = 1; i < 4; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(this->arr_i32_1bc);
+ this->sub_128_a8c(0x2);
+ }
+ // 130:0704
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(this->arr_i32_1bc);
+ this->sub_128_a8c(0xf);
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(this->arr_i32_1bc);
+ this->sub_128_a8c(0x78);
+ this->sub_128_610(2);
+ this->sub_130_db0();
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
+
+ // 130:0778
+ for (int j = 0; j < 8; j++) {
+ for (int i = 3; i < 5; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_40 = this->arr_i32_41296[i];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->sub_128_a8c(3);
+ }
+ }
+ // 130:07ec
+ this->sub_128_610(6);
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, 0x200, 0x156);
+ for (int i = 0; i < 0x2d; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->sub_128_24a(1);
+ }
+ // 130:083c
+ zbasic_picture(0, 0, 0, this->arr_i32_34);
+ zbasic_picture(5, 0, 0, this->arr_i32_38);
+ g_toolbox->ReleaseResource(*this->arr_i32_34);
+ g_toolbox->ReleaseResource(*this->arr_i32_38);
+ this->var_i32_2 = g_toolbox->TickCount();
+ // 130:0890
+ zbasic_52(0);
+ this->sub_128_1f4(0);
+ this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0, 0x17, 0, this->arr_i32_3c);
+ g_toolbox->ReleaseResource(*this->arr_i32_3c);
+ // 130:08dc
+ this->sub_130_f48();
+ this->sub_128_de2();
+ this->sub_128_1f4(1);
+ this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0xf0, 0xba, 0, this->arr_i32_40);
+ g_toolbox->ReleaseResource(*this->arr_i32_40);
+ this->sub_130_f48();
+ this->sub_128_de2();
+ // 130:0934
+ for (int i = 2; i < 5; i++) {
+ zbasic_blockmove(*this->arr_i32_4129a, this->arr_i32_41296[i], 0x5580);
+ }
+ // 130:0978
+ for (int i = 1; i < 5; i++) {
+ this->sub_128_1f4(i);
+ g_toolbox->PenPat(this->arr_i32_19c);
+ g_toolbox->SetRect(this->arr_i32_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
+ g_toolbox->FrameOval(this->arr_i32_1bc);
+ g_toolbox->PenPat(this->arr_i16_1b4);
+ // 130:09d0
+ g_toolbox->InsetRect(this->arr_i32_1bc, -i, -i);
+ for (int j = 2; j < 0xd; j++) {
+ g_toolbox->InsetRect(this->arr_i32_1bc, -j, -j);
+ g_toolbox->FrameOval(this->arr_i32_1bc);
+ }
+ }
+ // 130:0a42
+ this->sub_128_1f4(6);
+ this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ zbasic_picture(0x166, 0x77, 0, this->arr_i32_44);
+ this->sub_128_de2();
+ zbasic_blockmove(*this->arr_i32_412ae, *this->arr_i32_412b2, 0x5580);
+ this->sub_130_f48();
+ g_toolbox->ReleaseResource(*this->arr_i32_44);
+ this->sub_128_1f4(7);
+ // 130:0ac2
+ zbasic_picture(-0x14, -0x1e, 0, this->arr_i32_48);
+ this->sub_128_1f4(8);
+ zbasic_blockmove(*this->arr_i32_412b2, *this->arr_i32_412b6, 0x5580);
+ this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
+ zbasic_picture(0x16d, 0x80, 0, this->arr_i32_120);
+ g_toolbox->ReleaseResource(*this->arr_i32_120);
+ g_toolbox->SetPortBits(&this->var_i32_32);
+ // 130:0b74
+ this->sub_128_24a(0xd2);
+ this->sub_128_e80();
+ this->sub_128_64a(1);
+ this->sub_128_21e(0x14);
+ this->sub_128_6e4(0);
+ this->sub_128_e58();
+ // 130:0b98
+
+}
+
+} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
new file mode 100644
index 00000000000..a9969414a2d
--- /dev/null
+++ b/engines/fool/fool_prologue.h
@@ -0,0 +1,41 @@
+/* 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 FOOL_PROLOGUE_H
+#define FOOL_PROLOGUE_H
+
+#define SCREEN_WIDTH 512
+#define SCREEN_HEIGHT 342
+#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8/2)
+
+namespace Fool {
+
+class FoolPrologue {
+public:
+ FoolPrologue();
+ ~FoolPrologue();
+
+ void run();
+};
+
+} // End of namespace Fool
+
+#endif // FOOL_PROLOGUE_H
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
new file mode 100644
index 00000000000..7bf740473f1
--- /dev/null
+++ b/engines/fool/toolbox.cpp
@@ -0,0 +1,28 @@
+/* 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 "fool/toolbox.h"
+
+namespace Fool {
+
+
+
+} // namespace Fool
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
new file mode 100644
index 00000000000..9c1c91424e4
--- /dev/null
+++ b/engines/fool/toolbox.h
@@ -0,0 +1,265 @@
+/* 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 FOOL_TOOLBOX_H
+#define FOOL_TOOLBOX_H
+
+#include "common/array.h"
+#include "common/events.h"
+#include "common/str.h"
+
+namespace Fool {
+
+class Toolbox {
+
+public:
+ // PROCEDURE BeginUpdate (theWindow: WindowPtr);
+ // Call BeginUpdate when an update event occurs for theWindow. BeginUpdate replaces the
+ // visRgn of the window's grafPort with the intersection of the visRgn and the update region and
+ // then sets the window's update region to an empty region. You would then usually draw the
+ // entire content region, though it suffices to draw only the visRgn; in either case, only the parts of
+ // the window that require updating will actually be drawn on the screen. Every call to
+ // BeginUpdate must be balanced by a call to EndUpdate. (See "How a Window is Drawn".)
+
+ // PROCEDURE ClearMenuBar;
+ // Call ClearMenuBar to remove all menus from the menu list when you want to start afresh with all
+ // new menus. Be sure to call DrawMenuBar to update the menu bar.
+
+ // PROCEDURE ClipRect (r: Rect);
+ // ClipRect changes the clipping region of the current grafPort to a rectangle that's equivalent to the
+ // given rectangle. Note that this doesn't change the region handle, but affects the clipping region
+ // itself.
+
+ // PROCEDURE ClosePoly;
+ // ClosePoly tells QuickDraw to stop saving the definition of the currently open polygon and computes
+ // the polyBBox rectangle. You should perform one and only one ClosePoly for every OpenPoly.
+ // ClosePoly calls ShowPen, balancing the HidePen call made by OpenPoly.
+
+ // PROCEDURE CopyBits (srcBits,dstBits: BitMap; srcRect,dstRect: Rect; mode: INTEGER; maskRgn: RgnHandle);
+ // CopyBits transfers a bit image between any two bit maps and clips the result to the area specified
+ // by the maskRgn parameter. The transfer may be performed in any of the eight source transfer
+ // modes. The result is always clipped to the maskRgn and the boundary rectangle of the
+ // destination bit map; if the destination bit map is the current grafPort's portBits, it's also clipped to
+ // the intersection of the grafPort's clipRgn and visRgn. If you don't want to clip to a maskRgn,
+ // just pass NIL for the maskRgn parameter. The dstRect and maskRgn coordinates are in terms of
+ // the dstBits.bounds coordinate system, and the srcRect coordinates are in terms of the
+ // srcBits.bounds coordinates.
+
+ // FUNCTION CurResFile: INTEGER;
+ // CurResFile returns the reference number of the current resource file. You can call it when the
+ // application starts up to get the reference number of its resource file.
+
+ // PROCEDURE DrawChar (ch: CHAR);
+ // DrawChar places the given character to the right of the pen location, with the left end of its base
+ // line at the pen's location, and advances the pen accordingly. If the character isn't in the font, the
+ // font's missing symbol is drawn.
+
+ // PROCEDURE DrawString (s: Str255);
+ // DrawString calls DrawChar for each character in the given string. The string is placed beginning
+ // at the current pen location and extending right. No formatting (such as carriage returns and line
+ // feeds) is performed by QuickDraw. The pen location ends up to the right of the last character in
+ // the string.
+
+ // PROCEDURE EndUpdate (theWindow: WindowPtr);
+ // Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
+ // BeginUpdate as described above.
+
+ // PROCEDURE FillOval (r: Rect; pat: Pattern);
+ // FillOval fills an oval just inside the specified rectangle with the given pattern (in patCopy mode).
+ // The grafPort's pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
+
+ // PROCEDURE FillRect (r: Rect; pat: Pattern);
+ // FillRect fills the specified rectangle with the given pattern (in patCopy mode). The grafPort's
+ // pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
+
+ // PROCEDURE FrameArc (r: Rect; startAngle,arcAngle: INTEGER);
+ // FrameArc draws an arc of the oval that fits inside the specified rectangle, using the current
+ // grafPort's pen pattern, mode, and size. StartAngle indicates where the arc begins and is treated
+ // MOD 360. ArcAngle defines the extent of the arc. The angles are given in positive or negative
+ // degrees; a positive angle goes clockwise, while a negative angle goes counterclockwise.
+
+ // PROCEDURE FrameOval (r: Rect);
+ // FrameOval draws an outline just inside the oval that fits inside the specified rectangle, using the
+ // current grafPort's pen pattern, mode, and size. The outline is as wide as the pen width and as tall
+ // as the pen height. It's drawn with the pnPat, according to the pattern transfer mode specified by
+ // pnMode. The pen location is not changed by this procedure.
+
+ // PROCEDURE FrameRect (r: Rect);
+ // FrameRect draws an outline just inside the specified rectangle, using the current grafPort's pen
+ // pattern, mode, and size. The outline is as wide as the pen width and as tall as the pen height. It's
+ // drawn with the pnPat, according to the pattern transfer mode specified by pnMode. The pen
+ // location is not changed by this procedure.
+
+ // PROCEDURE GetCPixel (h,v: INTEGER; VAR cPix: RGBColor);
+ // The GetCPixel function returns the RGB of the pixel at the specified position in the current
+ // port.
+
+ // FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord) : BOOLEAN;
+ // GetNextEvent returns the next available event of a specified type or types and, if the event is in
+ // the event queue, removes it from the queue. The event is returned in the parameter theEvent. The
+ // eventMask parameter specifies which event types are of interest. GetNextEvent returns the next
+ // available event of any type designated by the mask, subject to the priority rules discussed above
+ // under "Priority of Events". If no event of any of the designated types is available, GetNextEvent
+ // returns a null event.
+
+ // FUNCTION GetPicture (picID: INTEGER) : PicHandle;
+ // GetPicture returns a handle to the picture having the given resource ID, reading it from the
+ // resource file if necessary. It calls the Resource Manager function GetResource('PICT',picID). If
+ // the resource can't be read, GetPicture returns NIL. The PicHandle data type is defined in
+ // QuickDraw.
+
+ // PROCEDURE HideCursor;
+ // HideCursor removes the cursor from the screen, restoring the bits under it, and decrements the
+ // cursor level (which InitCursor initialized to 0). Every call to HideCursor should be balanced by a
+ // subsequent call to ShowCursor.
+
+ // PROCEDURE InitCursor;
+ // InitCursor sets the current cursor to the standard arrow and sets the cursor level to 0, making
+ // the cursor visible. The cursor level keeps track of the number of times the cursor has been
+ // hidden to compensate for nested calls to HideCursor and ShowCursor, explained below.
+
+ // PROCEDURE InsetRect (VAR r: Rect; dh,dv: INTEGER);
+ // InsetRect shrinks or expands the given rectangle. The left and right sides are moved in by the
+ // amount specified by dh; the top and bottom are moved toward the center by the amount specified
+ // by dv. If dh or dv is negative, the appropriate pair of sides is moved outward instead of inward.
+ // The effect is to alter the size by 2*dh horizontally and 2*dv vertically, with the rectangle
+ // remaining centered in the same place on the coordinate plane.
+
+ // PROCEDURE InvertOval (r: Rect);
+ // InvertOval inverts the pixels enclosed by an oval just inside the specified rectangle: Every white
+ // pixel becomes black and every black pixel becomes white. The grafPort's pnPat, pnMode, and
+ // bkPat are all ignored; the pen location is not changed.
+
+ // PROCEDURE InvertRect (r: Rect);
+ // InvertRect inverts the pixels enclosed by the specified rectangle: Every white pixel becomes
+ // black and every black pixel becomes white. The grafPort's pnPat, pnMode, and bkPat are all
+ // ignored; the pen location is not changed.
+
+ // PROCEDURE KillPoly (poly: PolyHandle);
+ // KillPoly releases the memory occupied by the given polygon. Use this only when you're completely
+ // through with a polygon.
+
+ // PROCEDURE LineTo (h,v: INTEGER);
+ // LineTo draws a line from the current pen location to the location specified (in local coordinates)
+ // by h and v. The new pen location is (h,v) after the line is drawn.
+
+ // PROCEDURE MovePortTo (leftGlobal,topGlobal: INTEGER);
+ // MovePortTo changes the position of the current grafPort's portRect. This does not affect the
+ // screen; it merely changes the location at which subsequent drawing inside the port will appear.
+
+ // PROCEDURE MoveTo (h,v: INTEGER);
+ // MoveTo moves the pen to location (h,v) in the local coordinates of the current grafPort. No
+ // drawing is performed.
+
+ // FUNCTION OpenPoly : PolyHandle;
+ // OpenPoly returns a handle to a new polygon and tells QuickDraw to start saving the polygon
+ // definition as specified by calls to line-drawing routines. While a polygon is open, all calls to Line
+ // and LineTo affect the outline of the polygon. Only the line endpoints affect the polygon
+ // definition; the pen mode, pattern, and size do not affect it. In fact, OpenPoly calls HidePen, so
+ // no drawing occurs on the screen while the polygon is open (unless you call ShowPen just after
+ // OpenPoly, or you called ShowPen previously without balancing it by a call to HidePen).
+
+ // PROCEDURE OpenPort (port: GrafPtr);
+ // OpenPort allocates space for the given grafPort's visRgn and clipRgn, initializes the fields of the
+ // grafPort as indicated below, and makes the grafPort the current port (by calling SetPort).
+ // OpenPort is called by the Window Manager when you create a window, and you normally won't
+ // call it yourself. If you do call OpenPort, you can create the grafPtr with the Memory Manager
+ // procedure NewPtr or reserve the space on the stack (with a variable of type GrafPort).
+
+ // PROCEDURE PaintOval (r: Rect);
+ // PaintOval paints an oval just inside the specified rectangle with the current grafPort's pen pattern
+ // and mode. The oval is filled with the pnPat, according to the pattern transfer mode specified by
+ // pnMode. The pen location is not changed by this procedure.
+
+ // PROCEDURE PaintPoly (poly: PolyHandle);
+ // PaintPoly paints the specified polygon with the current grafPort's pen pattern and pen mode. The
+ // polygon is filled with the pnPat, according to the pattern transfer mode specified by pnMode.
+ // The pen location is not changed by this procedure.
+
+ // PROCEDURE PaintRect (r: Rect);
+ // PaintRect paints the specified rectangle with the current grafPoit's pen pattern and mode. The
+ // rectangle is filled with the pnPat, according to the pattern transfer mode specified by pnMode.
+ // The pen location is not changed by this procedure.
+
+ // PROCEDURE PenMode (mode: INTEGER);
+ // PenMode sets the transfer mode through which the pen pattern is transferred onto the bit map
+ // when lines or shapes are drawn in the current grafPort.
+
+ // PROCEDURE PenNormal;
+ // PenNormal resets the initial state of the pen in the current grafPort.
+
+ // PROCEDURE PenPat (pat: Pattern);
+ // PenPat sets the pattern that's used by the pen in the current grafPort. The standard patterns
+ // white, black, gray, ltGray, and dkGray are predefined; the initial pen pattern is black. The
+ // current pen pattern can be accessed in the variable thePort .pnPat, and this value can be assigned
+ // to any other variable of type Pattern.
+
+ // PROCEDURE PenSize (width,height: INTEGER);
+ // PenSize sets the dimensions of the graphics pen in the current grafPort. All subsequent calls to
+ // Line, LineTo, and the procedures that draw framed shapes in the current grafPort will use the
+ // new pen dimensions.
+
+ // PROCEDURE PortSize (width,height: INTEGER);
+ // PortSize changes the size of the current grafPort's portRect. This does not affect the screen; it
+ // merely changes the size of the "active area" of the grafPort.
+
+ // PROCEDURE ReleaseResource (theResource: Handle);
+ // Given a handle to a resource, ReleaseResource releases the memory occupied by the resource
+ // data, if any, and replaces the handle to that resource in the resource map with NIL (see Figure 7).
+ // The given handle will no longer be recognized as a handle to a resource; if the Resource Manager
+ // is subsequendy called to get the released resource, a new handle will be allocated. Use this
+ // procedure only after you're completely through with a resource.
+
+ // PROCEDURE SetCPixel (h,v: INTEGER; cPix: RGBColor);
+ // The SetCPixel function sets the pixel at the specified position to the pixel value that most
+ // closely matches the specified RGB.
+
+ // PROCEDURE SetPort (port: GrafPtr);
+ // SetPort makes the specified grafPort the current port.
+
+ // PROCEDURE SetPortBits (bm: BitMap);
+ // SetPortBits sets the portBits field of the current grafPort to any previously defined bit map. This
+ // allows you to perform all normal drawing and calculations on a buffer other than the screenâfor
+ // example, a small off-screen image for later "stamping" onto the screen (with the CopyBits
+ // procedure, described under "Bit Transfer Operations" below).
+
+ // PROCEDURE SetRect (VAR r: Rect; left,top,right,bottom: INTEGER);
+ // SetRect assigns the four boundary coordinates to the given rectangle. The result is a rectangle
+ // with coordinates (left,top) (right,bottom).
+
+ // PROCEDURE StringWidth (s: Str255) : INTEGER;
+ // StringWidth returns the width of the given text string, which it calculates by adding the
+ // CharWidths of all the characters in the string (see above).
+
+ // FUNCTION TickCount : LONGINT;
+ // TickCount returns the current number of ticks (sixtieths of a second) since the system last started
+ // up.
+
+ // PROCEDURE UseResFile (refNum: INTEGER);
+ // Given the reference number of a resource file, UseResFile sets the current resource file to that
+ // file. If there's no resource file open with the given reference number, UseResFile will do nothing
+ // and the ResError function will return the result code resFNotFound. A refNum of 0 represents
+ // the system resource file.
+};
+
+} // namespace Fool
+
+#endif
Commit: fb98a165551ce5505b4187ab4bcade7ff7356d98
https://github.com/scummvm/scummvm/commit/fb98a165551ce5505b4187ab4bcade7ff7356d98
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:44+02:00
Commit Message:
FOOL: More porting
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index cde9f824e07..4b5210f2d4c 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -23,98 +23,26 @@
#include <cstdlib>
#include "fool/fool_prologue.h"
+#include "common/str.h"
namespace Fool {
void FoolPrologue::run() {
-/*
-Found custom CODE block 128
-0x0004: JSR - "ZBASIC_176"
-0x0008: TRAP - _ClearMenuBar
-0x000a: TRAP - _HideCursor
-0x000c: PUSH.W - 0 (unsafe)
-0x000e: TRAP - _CurResFile
-0x0010: POP.W - D0
-0x0012: EXT.L - D0
-0x0014: MOVE.W - D0,VAR(0x0)
-0x0018: PUSH.W - VAR(0x0)
-0x001c: TRAP - _UseResFile
-*/
+ // 128:0004
+ zbasic_176();
g_toolbox->ClearMenuBar();
g_toolbox->HideCursor();
+ g_toolbox->UseResFile(g_toolbox->CurResFile());
-/*
-0x001e: MOVEQ - 0x0,D0
-0x0020: MOVE.W - D0,VAR(0x74)
-
-0x0024: MOVE.W - VAR(0x74),D0
-0x0028: EXT.L - D0
-0x002a: LSL.L - 0x2,D0
-0x002c: ADDI.L - HEAP(0x41296),D0
-0x0036: PUSH.L - D0
-0x0038: MOVE.W - VAR(0x74),D0
-0x003c: EXT.L - D0
-0x003e: MOVE.L - D0,D1
-0x0040: MOVE.L - 0x2ac0,D0
-0x0046: JSR - "MUL_INT"
-0x004a: LSL.L - 0x1,D0
-0x004c: ADDI.L - HEAP(0xb54),D0
-0x0056: POP.L - A0
-0x0058: MOVE.L - D0,(A0)
-0x005a: MOVEQ - 0xb,D0
-0x005c: ADDQ.W - 0x1,VAR(0x74)
-0x0060: CMP.W - VAR(0x74),D0
-0x0064: BGE - [0x0024]
-*/
// 128:001e
// b54 must be the 1-bit screen double buffer?
for (int i = 0; i < 12; i++) {
- this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i]
+ this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
}
-/*
-0x0066: MOVE.L - HEAP(0x412c2),D0
-0x0070: MOVEA.L - D0,A0
-0x0072: MOVE.L - (A0),D0
-0x0074: MOVE.L - D0,VAR(0x4e)
-*/
// 128:0066
this->var_i32_4e = this->arr_i32_412c2[0];
- /*
-0x0078: MOVEQ - 0x0,D0
-0x007a: MOVE.W - D0,VAR(0x74)
-
-0x007e: MOVEQ - 0x0,D0
-0x0080: MOVEA.W - VAR(0x74),A0
-0x0084: ADD.L - A0,D0
-0x0086: LSL.L - 0x1,D0
-0x0088: ADDI.L - HEAP(0x194),D0
-0x0092: MOVEA.L - D0,A0
-0x0094: CLR.W - (A0)
-
-0x0096: MOVEQ - 0x4,D0
-0x0098: MOVEA.W - VAR(0x74),A0
-0x009c: ADD.L - A0,D0
-0x009e: LSL.L - 0x1,D0
-0x00a0: ADDI.L - HEAP(0x194),D0
-0x00aa: MOVEA.L - D0,A0
-0x00ac: MOVE.W - 0xaa55,(A0)
-
-0x00b0: MOVEQ - 0x8,D0
-0x00b2: MOVEA.W - VAR(0x74),A0
-0x00b6: ADD.L - A0,D0
-0x00b8: LSL.L - 0x1,D0
-0x00ba: ADDI.L - HEAP(0x194),D0
-0x00c4: MOVEA.L - D0,A0
-0x00c6: MOVEQ - -0x1,D0
-0x00c8: MOVE.W - D0,(A0)
-
-0x00ca: MOVEQ - 0x3,D0
-0x00cc: ADDQ.W - 0x1,VAR(0x74)
-0x00d0: CMP.W - VAR(0x74),D0
-0x00d4: BGE - [0x007e]
-*/
// 128:0078
// stipple pattern buffer?
for (int i = 0; i < 3; i++) {
@@ -123,58 +51,6 @@ Found custom CODE block 128
this->arr_i16_194[i+8] = 0xffff;
}
- /*
-0x00d6: MOVE.L - HEAP(0x1ac),D0
-0x00e0: MOVEA.L - D0,A0
-0x00e2: MOVE.W - 0x107,(A0)
-
-0x00e6: MOVEQ - 0xc,D0
-0x00e8: ADDQ.L - 0x1,D0
-0x00ea: LSL.L - 0x1,D0
-0x00ec: ADDI.L - HEAP(0x194),D0
-0x00f6: MOVEA.L - D0,A0
-0x00f8: MOVE.W - 0xe0c,(A0)
-
-0x00fc: MOVEQ - 0xc,D0
-0x00fe: ADDQ.L - 0x2,D0
-0x0100: LSL.L - 0x1,D0
-0x0102: ADDI.L - HEAP(0x194),D0
-0x010c: MOVEA.L - D0,A0
-0x010e: MOVE.W - 0x7c70,(A0)
-
-0x0112: MOVEQ - 0xc,D0
-0x0114: ADDQ.L - 0x3,D0
-0x0116: LSL.L - 0x1,D0
-0x0118: ADDI.L - HEAP(0x194),D0
-0x0122: MOVEA.L - D0,A0
-0x0124: MOVE.W - 0xc0c0,(A0)
-
-0x0128: MOVE.L - HEAP(0x1b4),D0
-0x0132: MOVEA.L - D0,A0
-0x0134: MOVE.W - 0x8800,(A0)
-
-0x0138: MOVEQ - 0x10,D0
-0x013a: ADDQ.L - 0x1,D0
-0x013c: LSL.L - 0x1,D0
-0x013e: ADDI.L - HEAP(0x194),D0
-0x0148: MOVEA.L - D0,A0
-0x014a: MOVE.W - 0x2200,(A0)
-
-0x014e: MOVEQ - 0x10,D0
-0x0150: ADDQ.L - 0x2,D0
-0x0152: LSL.L - 0x1,D0
-0x0154: ADDI.L - HEAP(0x194),D0
-0x015e: MOVEA.L - D0,A0
-0x0160: MOVE.W - 0x8800,(A0)
-
-0x0164: MOVEQ - 0x10,D0
-0x0166: ADDQ.L - 0x3,D0
-0x0168: LSL.L - 0x1,D0
-0x016a: ADDI.L - HEAP(0x194),D0
-0x0174: MOVEA.L - D0,A0
-0x0176: MOVE.W - 0x2200,(A0)
-
-*/
// 128:00d6
this->arr_i16_1ac[0] = 0x0107;
this->arr_i16_194[0xd] = 0x0e0c;
@@ -185,287 +61,85 @@ Found custom CODE block 128
this->arr_i16_194[0x12] = 0x8800;
this->arr_i16_194[0x13] = 0x2200;
- /*
-0x017a: MOVEA.L - STR(0x0),A0 # b'\xa9 1987 by Cliff Johnson ALL RIGHTS RESERVED'
-0x0182: JSR - "BUFFER_CONCAT"
-0x0186: LEA - VAR(0x76),A0
-0x018a: JSR - "BUFFER_FLUSH"
-0x018e: MOVEA.L - STR(0x2c),A0 # b'This software was created using the ZBasic\xaa compiler.'
-0x0196: JSR - "BUFFER_CONCAT"
-0x019a: LEA - VAR(0x76),A0
-0x019e: JSR - "BUFFER_FLUSH"
-0x01a2: MOVEA.L - STR(0x62),A0 # b'Portions of this code are \xa9 Copyrighted, 1985 by Zedcor Inc.'
-0x01aa: JSR - "BUFFER_CONCAT"
-0x01ae: LEA - VAR(0x76),A0
-0x01b2: JSR - "BUFFER_FLUSH"
-*/
- //this->var_str_76 = STR(0x0);
- //this->var_str_76 = STR(0x2c);
- //this->var_str_76 = STR(0x62);
+ // 128:017a
+ this->var_str_76 = STR(0x0);
+ this->var_str_76 = STR(0x2c);
+ this->var_str_76 = STR(0x62);
+ // 128:01b6
+ // JMP 0x1f0
+ // JMP 0x21a
+ // JMP 0x246
+ // JMP 0x268
+ // JMP 0x2a2
+ // JMP 0x2ec
+ // JMP 0x350
+ // JMP 0x3ea
+ // JMP 0x506
+ // JMP 0x60c
+ // JMP 0x646
+ // JMP 0x6e0
+ // JMP 0x7fc
+ // JMP 0xa68
+ // JMP 0xa88
+ // JMP 0xc8a
+ // JMP 129:0x4
+ this->sub_129_004();
}
-/*
-0x01b6: JMP - [0x1f0]
---------
-*/
-/*
-0x01ba: MOVE.W - D0,VAR(0x176)
-0x01be: MOVE.W - VAR(0x176),D0
-0x01c2: EXT.L - D0
-0x01c4: LSL.L - 0x2,D0
-0x01c6: ADDI.L - HEAP(0x41296),D0
-0x01d0: MOVEA.L - D0,A0
-0x01d2: MOVE.L - (A0),D0
-0x01d4: MOVE.L - D0,VAR(0x40)
-0x01d8: PEA - VAR(0x32)
-0x01dc: PEA - VAR(0x40)
-0x01e0: PEA - VAR(0x38)
-0x01e4: PEA - VAR(0x38)
-0x01e8: PUSH.W - 0
-0x01ea: PUSH.L - 0
-0x01ec: TRAP - _CopyBits
-0x01ee: RTS
-*/
void FoolPrologue::sub_128_1ba(int16_t screen_page) {
+ // 128:01ba
this->var_40 = &this->arr_i32_41296[screen_page];
g_toolbox->CopyBits(this->var_32, this->var_40, this->var_38, this->var_38, 0, 0);
}
- /*
---------
-0x01f0: JMP - [0x21a]
---------
-0x01f4: MOVE.W - D0,VAR(0x176)
-0x01f8: MOVE.W - VAR(0x176),D0
-0x01fc: EXT.L - D0
-0x01fe: LSL.L - 0x2,D0
-0x0200: ADDI.L - HEAP(0x41296),D0
-0x020a: MOVEA.L - D0,A0
-0x020c: MOVE.L - (A0),D0
-0x020e: MOVE.L - D0,VAR(0x40)
-0x0212: PEA - VAR(0x40)
-0x0216: TRAP - _SetPortBits
-0x0218: RTS
---------
-*/
+
void FoolPrologue::sub_128_1f4(int16_t screen_page) {
+ // 128:01f4
this->var_40 = &this->arr_i32_41296[screen_page];
g_toolbox->SetPortBits(this->var_40);
}
-/*
-0x021a: JMP - [0x246]
---------
-0x021e: MOVE.W - D0,VAR(0x178)
-0x0222: PUSH.L - 0 (unsafe)
-0x0224: TRAP - _TickCount
-0x0226: POP.L - D0
-0x0228: MOVE.L - D0,VAR(0x17a)
-0x022c: PUSH.L - 0 (unsafe)
-0x022e: TRAP - _TickCount
-0x0230: POP.L - D0
-0x0232: PUSH.L - D0
-0x0234: MOVE.L - VAR(0x17a),D0
-0x0238: MOVEA.W - VAR(0x178),A0
-0x023c: ADD.L - A0,D0
-0x023e: POP.L - D1
-0x0240: CMP.L - D0,D1
-0x0242: BLT - [0x022c]
-0x0244: RTS
---------
-*/
void FoolPrologue::sub_128_21e(int16_t numTicks) {
+ // 128:021e
// original code would poll TickCount in a loop,
// effectively the same as Delay
g_toolbox->Delay(numTicks);
}
-/*
-0x0246: JMP - [0x268]
---------
-0x024a: MOVE.W - D0,VAR(0x17e)
-0x024e: PUSH.L - 0 (unsafe)
-0x0250: TRAP - _TickCount
-0x0252: POP.L - D0
-0x0254: PUSH.L - D0
-0x0256: MOVE.L - VAR(0x2),D0
-0x025a: MOVEA.W - VAR(0x17e),A0
-0x025e: ADD.L - A0,D0
-0x0260: POP.L - D1
-0x0262: CMP.L - D0,D1
-0x0264: BLE - [0x024e]
-0x0266: RTS
---------
-*/
void FoolPrologue::sub_128_24a(int16_t numTicks) {
+ // 128:024a
int32_t delay = MAX(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
+ // again, polling TickCount in a loop.
g_toolbox->Delay(delay);
}
-/*
-0x0268: JMP - [0x2a2]
---------
-0x026c: MOVE.W - D0,VAR(0x180)
-0x0270: POP.L - D0
-0x0272: MOVE.W - D0,VAR(0x176)
-0x0276: PUSH.W - 0 (unsafe)
-0x0278: PEA - VAR(0x76)
-0x027c: TRAP - _StringWidth
-0x027e: POP.W - D0
-0x0280: EXT.L - D0
-0x0282: MOVE.W - D0,VAR(0x182)
-0x0286: MOVE.W - VAR(0x176),D0
-0x028a: EXT.L - D0
-0x028c: MOVEA.W - VAR(0x182),A0
-0x0290: SUB.L - A0,D0
-0x0292: PUSH.W - D0
-0x0294: PUSH.W - VAR(0x180)
-0x0298: TRAP - _MoveTo
-0x029a: PEA - VAR(0x76)
-0x029e: TRAP - _DrawString
-0x02a0: RTS
-*/
+
void FoolPrologue::sub_128_26c(int16_t unk1, int16_t unk2) {
+ // 128:026c
this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
g_toolbox->MoveTo(this->var_i32_182 - unk2, unk1);
g_toolbox->DrawString(this->var_str_76);
}
-/*
---------
-0x02a2: JMP - [0x2ec]
---------
-0x02a6: MOVE.W - D0,VAR(0x180)
-0x02aa: POP.L - D0
-0x02ac: MOVE.W - D0,VAR(0x176)
-0x02b0: PUSH.W - 0 (unsafe)
-0x02b2: PEA - VAR(0x76)
-0x02b6: TRAP - _StringWidth
-0x02b8: POP.W - D0
-0x02ba: EXT.L - D0
-0x02bc: MOVE.W - D0,VAR(0x182)
-0x02c0: MOVE.W - VAR(0x176),D0
-0x02c4: EXT.L - D0
-0x02c6: PUSH.L - D0
-0x02c8: MOVE.W - VAR(0x182),D0
-0x02cc: EXT.L - D0
-0x02ce: MOVE.L - D0,D1
-0x02d0: MOVEQ - 0x2,D0
-0x02d2: JSR - "DIV_INT"
-0x02d6: POP.L - D1
-0x02d8: EXG - D0,D1
-0x02da: SUB.L - D1,D0
-0x02dc: PUSH.W - D0
-0x02de: PUSH.W - VAR(0x180)
-0x02e2: TRAP - _MoveTo
-0x02e4: PEA - VAR(0x76)
-0x02e8: TRAP - _DrawString
-0x02ea: RTS
---------
-*/
+
void FoolPrologue::sub_128_2a6(int16_t unk1, int16_t unk2) {
+ // 128:02a6
this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
g_toolbox->MoveTo(unk2 - (this->var_i32_182 / 2), unk1);
g_toolbox->DrawString(this->var_str_76);
}
-/*
-
-0x02ec: JMP - [0x350]
---------
-0x02f0: MOVE.W - D0,VAR(0x186)
-0x02f4: POP.L - D0
-0x02f6: MOVE.W - D0,VAR(0x184)
-0x02fa: POP.L - D0
-0x02fc: MOVE.W - D0,VAR(0x182)
-0x0300: POP.L - D0
-0x0302: MOVE.W - D0,VAR(0x180)
-0x0306: POP.L - D0
-0x0308: MOVE.W - D0,VAR(0x176)
-0x030c: MOVE.L - HEAP(0x41af4),D0
-0x0316: PUSH.L - D0
-0x0318: PUSH.W - VAR(0x180)
-0x031c: PUSH.W - VAR(0x176)
-0x0320: PUSH.W - VAR(0x184)
-0x0324: PUSH.W - VAR(0x182)
-0x0328: TRAP - _SetRect
-0x032a: MOVE.L - HEAP(0x41af4),D0
-0x0334: PUSH.L - D0
-0x0336: MOVE.W - VAR(0x186),D0
-0x033a: EXT.L - D0
-0x033c: LSL.L - 0x2,D0
-0x033e: LSL.L - 0x1,D0
-0x0340: ADDI.L - HEAP(0x194),D0
-0x034a: PUSH.L - D0
-0x034c: TRAP - _FillRect
-0x034e: RTS
---------
-*/
void FoolPrologue::sub_128_2f0(int16_t unk, int16_t right, int16_t bottom, int16_t left, int16_t top) {
+ // 128:02f0
g_toolbox->SetRect(this->rect_41af4, left, top, right, bottom);
g_toolbox->FillRect(this->rect_41af4, &this->arr_i16_194[unk*4])
}
-/*
-0x0350: JMP - [0x3ea]
---------
-0x0354: MOVE.W - D0,VAR(0x18a)
-0x0358: POP.L - D0
-0x035a: MOVE.W - D0,VAR(0x188)
-0x035e: MOVE.L - HEAP(0x1bc),D0
-0x0368: PUSH.L - D0
-0x036a: PUSH.W - 0
-0x036c: PUSH.W - 0
-0x036e: PUSH.W - 0x200
-0x0372: PUSH.W - 0x156
-0x0376: TRAP - _SetRect
-
-0x0378: MOVE.W - VAR(0x188),D0
-0x037c: EXT.L - D0
-0x037e: LSL.L - 0x2,D0
-0x0380: LSL.L - 0x1,D0
-0x0382: ADDI.L - HEAP(0x194),D0
-0x038c: PUSH.L - D0
-0x038e: TRAP - _PenPat
-
-0x0390: PUSH.W - VAR(0x18a)
-0x0394: TRAP - _PenMode
-0x0396: MOVEQ - 0x6,D0
-0x0398: PUSH.W - D0
-0x039a: MOVEQ - 0x4,D0
-0x039c: PUSH.W - D0
-0x039e: TRAP - _PenSize
-
-0x03a0: MOVEQ - 0x0,D0
-0x03a2: MOVE.W - D0,VAR(0x74)
-0x03a6: PUSH.L - 0 (unsafe)
-0x03a8: TRAP - _TickCount
-0x03aa: POP.L - D0
-0x03ac: MOVE.L - D0,VAR(0x2)
-
-0x03b0: MOVE.L - HEAP(0x1bc),D0
-0x03ba: PUSH.L - D0
-0x03bc: TRAP - _FrameRect
-0x03be: MOVE.L - HEAP(0x1bc),D0
-0x03c8: PUSH.L - D0
-0x03ca: MOVEQ - 0x6,D0
-0x03cc: PUSH.W - D0
-0x03ce: MOVEQ - 0x4,D0
-0x03d0: PUSH.W - D0
-0x03d2: TRAP - _InsetRect
-0x03d4: MOVEQ - 0x1,D0
-0x03d6: BSR - [0x024a]
-0x03da: ADDQ.W - 0x3,VAR(0x74)
-0x03de: CMPI.W - 0x82,VAR(0x74)
-0x03e4: BLE - [0x03a6]
-0x03e6: TRAP - _PenNormal
-0x03e8: RTS
---------
-*/
void FoolPrologue::sub_128_354(int16_t unk1, int16_t unk2) {
+ // 128:0354
g_toolbox->SetRect(this->rect_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->PenPat(this->arr_i16_194[unk2*4]);
g_toolbox->PenMode(unk1);
g_toolbox->PenSize(6, 4);
- for (int i = 0; i < 130 i += 3) {
+ for (int i = 0; i <= 130 i += 3) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->FrameRect(this->rect_1bc);
@@ -475,106 +149,8 @@ void FoolPrologue::sub_128_354(int16_t unk1, int16_t unk2) {
g_toolbox->PenNormal();
}
-/*
-
-0x03ea: JMP - [0x506]
---------
-0x03ee: MOVE.W - D0,VAR(0x176)
-0x03f2: MOVEQ - 0x5,D0
-0x03f4: MOVE.W - D0,VAR(0x18c)
-0x03f8: CMPI.W - 0x28,VAR(0x18e)
-0x03fe: BLE - [0x0408]
-
-0x0402: MOVEQ - 0x8,D0
-0x0404: MOVE.W - D0,VAR(0x18c)
-0x0408: CMPI.W - 0x50,VAR(0x18e)
-0x040e: BLE - [0x0418]
-
-0x0412: MOVEQ - 0xb,D0
-0x0414: MOVE.W - D0,VAR(0x18c)
-0x0418: CMPI.W - 0x64,VAR(0x18e)
-0x041e: BLE - [0x0428]
-
-0x0422: MOVEQ - 0xe,D0
-0x0424: MOVE.W - D0,VAR(0x18c)
-
-0x0428: MOVEQ - 0x1,D0
-0x042a: MOVE.W - D0,VAR(0x74)
-0x042e: PUSH.L - 0 (unsafe)
-0x0430: TRAP - _TickCount
-0x0432: POP.L - D0
-0x0434: MOVE.L - D0,VAR(0x2)
-
-0x0438: MOVEQ - 0x0,D0
-0x043a: MOVEA.W - VAR(0x74),A0
-0x043e: ADD.L - A0,D0
-0x0440: LSL.L - 0x1,D0
-0x0442: ADDI.L - HEAP(0x1e8),D0
-0x044c: MOVEA.L - D0,A0
-0x044e: MOVE.W - (A0),D0
-0x0450: EXT.L - D0
-0x0452: MOVEA.W - VAR(0x176),A0
-0x0456: SUB.L - A0,D0
-0x0458: PUSH.W - D0
-
-0x045a: MOVE.L - 0x1f6,D0
-0x0460: MOVEA.W - VAR(0x74),A0
-0x0464: ADD.L - A0,D0
-0x0466: LSL.L - 0x1,D0
-0x0468: ADDI.L - HEAP(0x1e8),D0
-0x0472: MOVEA.L - D0,A0
-0x0474: MOVE.W - (A0),D0
-0x0476: EXT.L - D0
-0x0478: MOVEA.W - VAR(0x176),A0
-0x047c: SUB.L - A0,D0
-0x047e: PUSH.W - D0
-0x0480: TRAP - _MoveTo
-
-0x0482: MOVE.L - 0xfb,D0
-0x0488: MOVEA.W - VAR(0x74),A0
-0x048c: ADD.L - A0,D0
-0x048e: LSL.L - 0x1,D0
-0x0490: ADDI.L - HEAP(0x1e8),D0
-0x049a: MOVEA.L - D0,A0
-0x049c: MOVE.W - (A0),D0
-0x049e: EXT.L - D0
-0x04a0: MOVEA.W - VAR(0x176),A0
-0x04a4: ADD.L - A0,D0
-0x04a6: PUSH.W - D0
-
-0x04a8: MOVE.L - 0x1f6,D0
-0x04ae: MOVEA.W - VAR(0x74),A0
-0x04b2: ADD.L - A0,D0
-0x04b4: LSL.L - 0x1,D0
-0x04b6: ADDI.L - HEAP(0x1e8),D0
-0x04c0: MOVEA.L - D0,A0
-0x04c2: MOVE.W - (A0),D0
-0x04c4: EXT.L - D0
-0x04c6: MOVEA.W - VAR(0x176),A0
-0x04ca: SUB.L - A0,D0
-0x04cc: PUSH.W - D0
-0x04ce: TRAP - _LineTo
-
-0x04d0: MOVE.W - VAR(0x74),D0
-0x04d4: EXT.L - D0
-0x04d6: MOVE.L - D0,D1
-0x04d8: MOVE.W - VAR(0x18c),D0
-0x04dc: EXT.L - D0
-0x04de: JSR - "MOD_INT"
-0x04e2: CMPI.L - 0x0,D0
-0x04e8: BNE - [0x04f2]
-0x04ec: MOVEQ - 0x0,D0
-0x04ee: BSR - [0x024a]
-0x04f2: MOVE.W - VAR(0x18e),D0
-0x04f6: EXT.L - D0
-0x04f8: ADDQ.W - 0x1,VAR(0x74)
-0x04fc: CMP.W - VAR(0x74),D0
-0x0500: BGE - [0x042e]
-
-0x0504: RTS
---------
-*/
void FoolPrologue::sub_128_3ee(int16_t unk1) {
+ // 128:03ee
this->var_18c = 0x5;
if (this->var_i16_18e > 0x28) {
this->var_i16_18c = 0x8;
@@ -585,6 +161,7 @@ void FoolPrologue::sub_128_3ee(int16_t unk1) {
if (this->var_i16_18e > 0x64) {
this->var_i16_18c = 0xe;
}
+ // 128:0428
for (int i = 1; i < this->var_i16_18e + 1; i++) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->MoveTo(
@@ -601,96 +178,9 @@ void FoolPrologue::sub_128_3ee(int16_t unk1) {
}
}
-/*
-0x0506: JMP - [0x60c]
---------
-0x050a: MOVE.W - D0,VAR(0x184)
-0x050e: POP.L - D0
-0x0510: MOVE.W - D0,VAR(0x182)
-0x0514: POP.L - D0
-0x0516: MOVE.W - D0,VAR(0x180)
-0x051a: POP.L - D0
-0x051c: MOVE.W - D0,VAR(0x176)
-0x0520: MOVE.W - VAR(0x176),D0
-0x0524: EXT.L - D0
-0x0526: LSL.L - 0x2,D0
-0x0528: ADDI.L - HEAP(0x41296),D0
-0x0532: MOVEA.L - D0,A0
-0x0534: MOVE.L - (A0),D0
-0x0536: MOVE.L - D0,VAR(0x40)
-
-0x053a: MOVE.W - VAR(0x180),VAR(0x5e)
-0x0540: MOVE.W - VAR(0x182),VAR(0x62)
-0x0546: MOVE.W - VAR(0x184),D0
-0x054a: BNE - [0x0554]
-0x054e: MOVEQ - 0x14,D0
-0x0550: MOVE.W - D0,VAR(0x184)
-
-0x0554: CMPI.W - 0x1,VAR(0x184)
-0x055a: BNE - [0x0564]
-0x055e: MOVEQ - 0x8,D0
-0x0560: MOVE.W - D0,VAR(0x184)
-
-0x0564: CMPI.W - 0x2,VAR(0x184)
-0x056a: BNE - [0x0574]
-0x056e: MOVEQ - 0x6,D0
-0x0570: MOVE.W - D0,VAR(0x184)
-
-0x0574: CMPI.W - 0x3,VAR(0x184)
-0x057a: BNE - [0x0584]
-0x057e: MOVEQ - 0x5,D0
-0x0580: MOVE.W - D0,VAR(0x184)
-
-0x0584: MOVEQ - 0x1,D0
-0x0586: MOVE.W - D0,VAR(0x190)
-0x058a: PUSH.L - 0 (unsafe)
-0x058c: TRAP - _TickCount
-0x058e: POP.L - D0
-0x0590: MOVE.L - D0,VAR(0x2)
-
-0x0594: MOVEA.W - VAR(0x190),A0
-0x0598: ADDA.L - A0,A0
-0x059a: ADDA.L - HEAP(0x412ea),A0
-0x05a4: MOVE.W - (A0),D0
-0x05a6: EXT.L - D0
-0x05a8: SUBQ.L - 0x1,D0
-0x05aa: MOVE.W - D0,VAR(0x5c)
-
-0x05ae: MOVEA.W - VAR(0x190),A0
-0x05b2: ADDA.L - A0,A0
-0x05b4: ADDA.L - HEAP(0x412ea),A0
-0x05be: MOVE.W - (A0),D0
-0x05c0: EXT.L - D0
-0x05c2: MOVE.W - D0,VAR(0x60)
-
-0x05c6: PEA - VAR(0x40)
-0x05ca: PEA - VAR(0x32)
-0x05ce: PEA - VAR(0x5c)
-0x05d2: PEA - VAR(0x5c)
-0x05d6: PUSH.W - 0
-0x05d8: PUSH.L - 0
-0x05da: TRAP - _CopyBits
-
-0x05dc: MOVE.W - VAR(0x190),D0
-0x05e0: EXT.L - D0
-0x05e2: MOVE.L - D0,D1
-0x05e4: MOVE.W - VAR(0x184),D0
-0x05e8: EXT.L - D0
-0x05ea: JSR - "MOD_INT"
-
-0x05ee: CMPI.L - 0x0,D0
-0x05f4: BNE - [0x05fe]
-0x05f8: MOVEQ - 0x0,D0
-0x05fa: BSR - [0x024a]
-0x05fe: ADDQ.W - 0x1,VAR(0x190)
-0x0602: CMPI.W - 0x156,VAR(0x190)
-0x0608: BLE - [0x058a]
-
-0x060a: RTS
---------
-*/
void FoolPrologue::sub_128_50a(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4) {
+ // 128:050a
this->var_i32_40 = this->arr_i32_41296[unk4];
this->var_i16_5e = unk3;
this->var_i16_62 = unk2;
@@ -706,6 +196,7 @@ void FoolPrologue::sub_128_50a(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
if (unk1 == 3) {
unk1 = 0x5;
}
+ // 128:0584
for (int i = 1; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c = this->arr_i16_412ea[i] - 1;
@@ -717,94 +208,17 @@ void FoolPrologue::sub_128_50a(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
}
}
-/*
-
-0x060c: JMP - [0x646]
---------
-0x0610: MOVE.W - D0,VAR(0x176)
-0x0614: MOVE.W - VAR(0x176),D0
-0x0618: EXT.L - D0
-0x061a: LSL.L - 0x2,D0
-0x061c: ADDI.L - HEAP(0x41296),D0
-0x0626: MOVEA.L - D0,A0
-0x0628: MOVE.L - (A0),D0
-0x062a: MOVE.L - D0,VAR(0x40)
-0x062e: PEA - VAR(0x40)
-0x0632: PEA - VAR(0x32)
-0x0636: PEA - VAR(0x38)
-0x063a: PEA - VAR(0x38)
-0x063e: PUSH.W - 0
-0x0640: PUSH.L - 0
-0x0642: TRAP - _CopyBits
-0x0644: RTS
---------
-*/
void FoolPrologue::sub_128_610(int16_t unk) {
+ // 128:0610
this->var_i32_40 = this->arr_i32_41296[unk];
g_toolbox->CopyBits(this->var_i32_40, this->var_32, this->var_38, this->var_38, 0, 0);
}
-/*
-
-0x0646: JMP - [0x6e0]
---------
-0x064a: MOVE.W - D0,VAR(0x176)
-0x064e: TRAP - _PenNormal
-0x0650: MOVE.W - VAR(0x176),D0
-0x0654: EXT.L - D0
-0x0656: LSL.L - 0x2,D0
-0x0658: LSL.L - 0x1,D0
-0x065a: ADDI.L - HEAP(0x194),D0
-0x0664: PUSH.L - D0
-0x0666: TRAP - _PenPat
-
-0x0668: MOVEQ - 0x0,D0
-0x066a: MOVE.W - D0,VAR(0x192)
-
-0x066e: PUSH.L - 0 (unsafe)
-0x0670: TRAP - _TickCount
-0x0672: POP.L - D0
-0x0674: MOVE.L - D0,VAR(0x2)
-
-0x0678: PUSH.W - 0
-0x067a: MOVEA.W - VAR(0x192),A0
-0x067e: ADDA.L - A0,A0
-0x0680: ADDA.L - HEAP(0x412ea),A0
-0x068a: MOVE.W - (A0),D0
-0x068c: EXT.L - D0
-0x068e: SUBQ.L - 0x1,D0
-0x0690: PUSH.W - D0
-0x0692: TRAP - _MoveTo
-
-0x0694: PUSH.W - 0x200
-0x0698: MOVEA.W - VAR(0x192),A0
-0x069c: ADDA.L - A0,A0
-0x069e: ADDA.L - HEAP(0x412ea),A0
-0x06a8: MOVE.W - (A0),D0
-0x06aa: EXT.L - D0
-0x06ac: SUBQ.L - 0x1,D0
-0x06ae: PUSH.W - D0
-0x06b0: TRAP - _LineTo
-
-0x06b2: MOVE.W - VAR(0x192),D0
-0x06b6: EXT.L - D0
-0x06b8: MOVE.L - D0,D1
-0x06ba: MOVEQ - 0x5,D0
-0x06bc: JSR - "MOD_INT"
-0x06c0: CMPI.L - 0x0,D0
-0x06c6: BNE - [0x06d0]
-0x06ca: MOVEQ - 0x0,D0
-0x06cc: BSR - [0x024a]
-0x06d0: ADDQ.W - 0x1,VAR(0x192)
-0x06d4: CMPI.W - 0x156,VAR(0x192)
-0x06da: BLE - [0x066e]
-0x06dc: TRAP - _PenNormal
-0x06de: RTS
---------
-*/
void FoolPrologue::sub_128_64a(int16_t unk1) {
+ // 128:064a
g_toolbox->PenNormal();
g_toolbox->PenPat(&this->arr_i16_194[unk1*4]);
+ // 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->MoveTo(0, this->arr_i16_412ea[i] - 1);
@@ -816,105 +230,8 @@ void FoolPrologue::sub_128_64a(int16_t unk1) {
g_toolbox->PenNormal();
}
-/*
-
-0x06e0: JMP - [0x7fc]
---------
-0x06e4: MOVE.W - D0,VAR(0x176)
-0x06e8: MOVE.W - VAR(0x176),D0
-0x06ec: EXT.L - D0
-0x06ee: LSL.L - 0x2,D0
-0x06f0: ADDI.L - HEAP(0x41296),D0
-0x06fa: MOVEA.L - D0,A0
-0x06fc: MOVE.L - (A0),D0
-0x06fe: MOVE.L - D0,VAR(0x40)
-
-0x0702: MOVEQ - 0x1,D0
-0x0704: MOVE.W - D0,VAR(0x74)
-
-0x0708: PUSH.L - 0 (unsafe)
-0x070a: TRAP - _TickCount
-0x070c: POP.L - D0
-0x070e: MOVE.L - D0,VAR(0x2)
-
-0x0712: MOVE.L - 0xab,D0
-0x0718: PUSH.L - D0
-0x071a: MOVE.W - VAR(0x74),D0
-0x071e: EXT.L - D0
-0x0720: JSR - "BCD_FROM_INT"
-0x0724: JSR - "BCD_PUSH_LHS"
-0x0728: JSR - "BCD_FROM_CONST" 3.33
-0x0732: JSR - "BCD_PUSH_RHS"
-0x0736: JSR - "MUL_BCD"
-0x073a: JSR - "CAST_INT"
-0x073e: POP.L - D1
-0x0740: EXG - D0,D1
-0x0742: SUB.L - D1,D0
-0x0744: MOVE.W - D0,VAR(0x5c)
-
-0x0748: MOVE.L - 0x100,D0
-0x074e: PUSH.L - D0
-0x0750: MOVE.W - VAR(0x74),D0
-0x0754: EXT.L - D0
-0x0756: MOVE.L - D0,D1
-0x0758: MOVEQ - 0x5,D0
-0x075a: JSR - "MUL_INT"
-0x075e: POP.L - D1
-0x0760: EXG - D0,D1
-0x0762: SUB.L - D1,D0
-0x0764: MOVE.W - D0,VAR(0x5e)
-
-0x0768: MOVE.L - 0xab,D0
-0x076e: PUSH.L - D0
-0x0770: MOVE.W - VAR(0x74),D0
-0x0774: EXT.L - D0
-0x0776: JSR - "BCD_FROM_INT"
-0x077a: JSR - "BCD_PUSH_LHS"
-0x077e: JSR - "BCD_FROM_CONST" 3.33
-0x0788: JSR - "BCD_PUSH_RHS"
-0x078c: JSR - "MUL_BCD"
-0x0790: JSR - "CAST_INT"
-0x0794: POP.L - D1
-0x0796: ADD.L - D1,D0
-0x0798: MOVE.W - D0,VAR(0x60)
-
-0x079c: MOVE.L - 0x100,D0
-0x07a2: PUSH.L - D0
-0x07a4: MOVE.W - VAR(0x74),D0
-0x07a8: EXT.L - D0
-0x07aa: MOVE.L - D0,D1
-0x07ac: MOVEQ - 0x5,D0
-0x07ae: JSR - "MUL_INT"
-0x07b2: POP.L - D1
-0x07b4: ADD.L - D1,D0
-0x07b6: MOVE.W - D0,VAR(0x62)
-
-0x07ba: PEA - VAR(0x40)
-0x07be: PEA - VAR(0x32)
-0x07c2: PEA - VAR(0x5c)
-0x07c6: PEA - VAR(0x5c)
-0x07ca: PUSH.W - 0
-0x07cc: PUSH.L - 0
-0x07ce: TRAP - _CopyBits
-
-0x07d0: MOVEQ - 0x1,D0
-0x07d2: BSR - [0x024a]
-0x07d6: MOVEQ - 0x34,D0
-0x07d8: ADDQ.W - 0x1,VAR(0x74)
-0x07dc: CMP.W - VAR(0x74),D0
-0x07e0: BGE - [0x0708]
-
-0x07e4: PEA - VAR(0x40)
-0x07e8: PEA - VAR(0x32)
-0x07ec: PEA - VAR(0x38)
-0x07f0: PEA - VAR(0x38)
-0x07f4: PUSH.W - 0
-0x07f6: PUSH.L - 0
-0x07f8: TRAP - _CopyBits
-0x07fa: RTS
---------
-*/
void FoolPrologue::sub_128_6e4(int16_t unk) {
+ // 128:06e4
this->var_40 = this->arr_i32_41296[unk];
for (int i = 0; i < 0x36; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -927,197 +244,8 @@ void FoolPrologue::sub_128_6e4(int16_t unk) {
g_toolbox->CopyBits(this->var_40, this->var_32, this->var_38, this->var_38, 0, 0);
}
-/*
-
-0x07fc: JMP - [0xa68]
---------
-0x0800: MOVE.W - D0,VAR(0x1a2)
-0x0804: POP.L - D0
-0x0806: MOVE.W - D0,VAR(0x1a0)
-0x080a: POP.L - D0
-0x080c: MOVE.W - D0,VAR(0x19e)
-0x0810: POP.L - D0
-0x0812: MOVE.W - D0,VAR(0x19c)
-0x0816: POP.L - D0
-0x0818: MOVE.W - D0,VAR(0x19a)
-0x081c: POP.L - D0
-0x081e: MOVE.W - D0,VAR(0x198)
-0x0822: POP.L - D0
-0x0824: MOVE.W - D0,VAR(0x196)
-0x0828: POP.L - D0
-0x082a: MOVE.W - D0,VAR(0x194)
-0x082e: POP.L - D0
-0x0830: MOVE.W - D0,VAR(0x178)
-
-0x0834: MOVE.L - HEAP(0x41af4),D0
-0x083e: MOVEA.L - D0,A0
-0x0840: MOVE.W - VAR(0x178),(A0)
-
-0x0844: MOVE.L - HEAP(0x41af6),D0
-0x084e: MOVEA.L - D0,A0
-0x0850: MOVE.W - VAR(0x194),(A0)
-
-0x0854: MOVE.L - HEAP(0x41af8),D0
-0x085e: MOVEA.L - D0,A0
-0x0860: MOVE.W - VAR(0x196),(A0)
-
-0x0864: MOVE.L - HEAP(0x41afa),D0
-0x086e: MOVEA.L - D0,A0
-0x0870: MOVE.W - VAR(0x198),(A0)
-
-0x0874: MOVE.L - HEAP(0x41afc),D0
-0x087e: MOVEA.L - D0,A0
-0x0880: MOVE.W - VAR(0x19a),(A0)
-
-0x0884: MOVE.L - HEAP(0x41afe),D0
-0x088e: MOVEA.L - D0,A0
-0x0890: MOVE.W - VAR(0x19c),(A0)
-
-0x0894: MOVE.L - HEAP(0x41b00),D0
-0x089e: MOVEA.L - D0,A0
-0x08a0: MOVE.W - VAR(0x19e),(A0)
-
-0x08a4: MOVE.L - HEAP(0x41b02),D0
-0x08ae: MOVEA.L - D0,A0
-0x08b0: MOVE.W - VAR(0x1a0),(A0)
-
-0x08b4: TRAP - _PenNormal
-0x08b6: MOVEQ - 0xa,D0
-0x08b8: PUSH.W - D0
-0x08ba: TRAP - _PenMode
-
-0x08bc: MOVEQ - 0x0,D0
-0x08be: MOVE.W - D0,VAR(0x74)
-0x08c2: MOVE.W - VAR(0x74),D0
-0x08c6: EXT.L - D0
-0x08c8: LSL.L - 0x2,D0
-0x08ca: ADDI.L - HEAP(0x41bbe),D0
-0x08d4: PUSH.L - D0
-
-0x08d6: MOVEA.W - VAR(0x74),A0
-0x08da: ADDA.L - A0,A0
-0x08dc: ADDA.L - HEAP(0x41af4),A0
-0x08e6: MOVE.W - (A0),D0
-0x08e8: EXT.L - D0
-0x08ea: JSR - "BCD_FROM_INT"
-0x08ee: POP.L - A0
-0x08f0: JSR - "BCD_TO_VAR"
-
-0x08f4: MOVE.W - VAR(0x74),D0
-0x08f8: EXT.L - D0
-0x08fa: ADDQ.L - 0x4,D0
-0x08fc: LSL.L - 0x2,D0
-0x08fe: ADDI.L - HEAP(0x41bbe),D0
-0x0908: PUSH.L - D0
-
-0x090a: MOVE.W - VAR(0x74),D0
-0x090e: EXT.L - D0
-0x0910: ADDQ.L - 0x4,D0
-0x0912: LSL.L - 0x1,D0
-0x0914: ADDI.L - HEAP(0x41af4),D0
-0x091e: MOVEA.L - D0,A0
-0x0920: MOVE.W - (A0),D0
-0x0922: EXT.L - D0
-0x0924: PUSH.L - D0
-0x0926: MOVEA.W - VAR(0x74),A0
-0x092a: ADDA.L - A0,A0
-0x092c: ADDA.L - HEAP(0x41af4),A0
-0x0936: MOVE.W - (A0),D0
-0x0938: EXT.L - D0
-0x093a: POP.L - D1
-
-0x093c: EXG - D0,D1
-0x093e: SUB.L - D1,D0
-0x0940: JSR - "BCD_FROM_INT"
-0x0944: JSR - "BCD_PUSH_LHS"
-0x0948: MOVE.W - VAR(0x1a2),D0
-0x094c: EXT.L - D0
-0x094e: JSR - "BCD_FROM_INT"
-0x0952: JSR - "BCD_PUSH_RHS"
-0x0956: JSR - "DIV_BCD"
-0x095a: POP.L - A0
-0x095c: JSR - "BCD_TO_VAR"
-0x0960: MOVEQ - 0x3,D0
-0x0962: ADDQ.W - 0x1,VAR(0x74)
-0x0966: CMP.W - VAR(0x74),D0
-0x096a: BGE - [0x08c2]
-
-0x096e: MOVE.L - HEAP(0x41af4),D0
-0x0978: PUSH.L - D0
-0x097a: TRAP - _PaintRect
-
-0x097c: MOVEQ - 0x1,D0
-0x097e: MOVE.W - D0,VAR(0x192)
-0x0982: PUSH.L - 0 (unsafe)
-0x0984: TRAP - _TickCount
-0x0986: POP.L - D0
-0x0988: MOVE.L - D0,VAR(0x2)
-
-0x098c: MOVEQ - 0x0,D0
-0x098e: MOVE.W - D0,VAR(0x74)
-0x0992: MOVE.W - VAR(0x74),D0
-0x0996: EXT.L - D0
-0x0998: LSL.L - 0x2,D0
-0x099a: ADDI.L - HEAP(0x41bbe),D0
-0x09a4: PUSH.L - D0
-0x09a6: MOVE.W - VAR(0x74),D0
-0x09aa: EXT.L - D0
-0x09ac: LSL.L - 0x2,D0
-0x09ae: ADDI.L - HEAP(0x41bbe),D0
-0x09b8: MOVEA.L - D0,A0
-0x09ba: JSR - "BCD_FROM_VAR"
-0x09be: JSR - "BCD_PUSH_LHS"
-0x09c2: MOVE.W - VAR(0x74),D0
-0x09c6: EXT.L - D0
-0x09c8: ADDQ.L - 0x4,D0
-0x09ca: LSL.L - 0x2,D0
-0x09cc: ADDI.L - HEAP(0x41bbe),D0
-0x09d6: MOVEA.L - D0,A0
-0x09d8: JSR - "BCD_FROM_VAR"
-0x09dc: JSR - "ADD_BCD"
-0x09e0: POP.L - A0
-0x09e2: JSR - "BCD_TO_VAR"
-
-0x09e6: MOVE.W - VAR(0x74),D0
-0x09ea: EXT.L - D0
-0x09ec: ADDI.L - 0x0000000b,D0
-0x09f2: LSL.L - 0x1,D0
-0x09f4: ADDI.L - HEAP(0x41af4),D0
-0x09fe: PUSH.L - D0
-0x0a00: MOVE.W - VAR(0x74),D0
-0x0a04: EXT.L - D0
-0x0a06: LSL.L - 0x2,D0
-0x0a08: ADDI.L - HEAP(0x41bbe),D0
-0x0a12: MOVEA.L - D0,A0
-0x0a14: JSR - "BCD_FROM_VAR"
-0x0a18: JSR - "CAST_INT"
-0x0a1c: POP.L - A0
-0x0a1e: MOVE.W - D0,(A0)
-0x0a20: MOVEQ - 0x3,D0
-0x0a22: ADDQ.W - 0x1,VAR(0x74)
-0x0a26: CMP.W - VAR(0x74),D0
-0x0a2a: BGE - [0x0992]
-
-0x0a2e: MOVE.L - HEAP(0x41b0a),D0
-0x0a38: PUSH.L - D0
-0x0a3a: TRAP - _PaintRect
-0x0a3c: MOVEQ - 0x0,D0
-0x0a3e: BSR - [0x024a]
-0x0a42: MOVE.W - VAR(0x1a2),D0
-0x0a46: EXT.L - D0
-0x0a48: SUBQ.L - 0x1,D0
-0x0a4a: ADDQ.W - 0x1,VAR(0x192)
-0x0a4e: CMP.W - VAR(0x192),D0
-0x0a52: BGE - [0x0982]
-
-0x0a56: MOVE.L - HEAP(0x41afc),D0
-0x0a60: PUSH.L - D0
-0x0a62: TRAP - _PaintRect
-0x0a64: TRAP - _PenNormal
-0x0a66: RTS
---------
-*/
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
+ // 128:0800
this->arr_i16_41af4[0] = unk9;
this->arr_i16_41af4[1] = unk8;
this->arr_i16_41af4[2] = unk7;
@@ -1128,10 +256,12 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_i16_41af4[7] = unk2;
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
+ // 128:08bc
for (int i = 0; i < 4; i++) {
this->arr_f64_41bbe[i] = (double)this->arr_i16_41af4[i];
this->arr_f64_41bbe[i+4] = (double)(this->arr_i16_41af4[i] - this->arr_i16_41af4[i+4])/(double)(this->var_i32_182);
}
+ // 128:096e
g_toolbox->PaintRect(&this->arr_i16_41af4);
for (int i = 1; i < unk1 + 1; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -1147,91 +277,14 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
g_toolbox->PenNormal();
}
-/*
-
-0x0a68: JMP - [0xa88]
---------
-0x0a6c: MOVE.W - D0,VAR(0x194)
-0x0a70: POP.L - D0
-0x0a72: MOVE.W - D0,VAR(0x178)
-0x0a76: PUSH.W - VAR(0x178)
-0x0a7a: PUSH.W - VAR(0x194)
-0x0a7e: TRAP - _MoveTo
-0x0a80: PEA - VAR(0x76)
-0x0a84: TRAP - _DrawString
-0x0a86: RTS
---------
-*/
void FoolPrologue::sub_128_a6c(int16_t unk1, int16_t unk2) {
+ // 128:0a6c
g_toolbox->MoveTo(unk2, unk1);
g_toolbox->DrawString(this->var_str_76);
}
-/*
-0x0a88: JMP - [0xc8a]
---------
-0x0a8c: MOVE.W - D0,VAR(0x1a4)
-0x0a90: MOVEQ - 0xa,D0
-0x0a92: PUSH.W - D0
-0x0a94: TRAP - _PenMode
-0x0a96: JSR - 130,0xe82
-0x0a9a: MOVEQ - 0x0,D0
-0x0a9c: MOVEA.W - VAR(0x6),A0
-0x0aa0: ADD.L - A0,D0
-0x0aa2: LSL.L - 0x1,D0
-0x0aa4: ADDI.L - HEAP(0x1e8),D0
-0x0aae: PUSH.L - D0
-0x0ab0: MOVEQ - 0x0,D0
-0x0ab2: MOVEA.W - VAR(0x6),A0
-0x0ab6: ADD.L - A0,D0
-0x0ab8: LSL.L - 0x1,D0
-0x0aba: ADDI.L - HEAP(0x1e8),D0
-0x0ac4: MOVEA.L - D0,A0
-0x0ac6: MOVE.W - (A0),D0
-0x0ac8: EXT.L - D0
-0x0aca: PUSH.L - D0
-0x0acc: MOVE.L - 0x2f1,D0
-0x0ad2: MOVEA.W - VAR(0x6),A0
-0x0ad6: ADD.L - A0,D0
-0x0ad8: LSL.L - 0x1,D0
-0x0ada: ADDI.L - HEAP(0x1e8),D0
-0x0ae4: MOVEA.L - D0,A0
-0x0ae6: MOVE.W - (A0),D0
-0x0ae8: EXT.L - D0
-0x0aea: POP.L - D1
-0x0aec: ADD.L - D1,D0
-0x0aee: POP.L - A0
-0x0af0: MOVE.W - D0,(A0)
-
-0x0af2: MOVE.L - 0xfb,D0
-0x0af8: MOVEA.W - VAR(0x6),A0
-0x0afc: ADD.L - A0,D0
-0x0afe: LSL.L - 0x1,D0
-0x0b00: ADDI.L - HEAP(0x1e8),D0
-0x0b0a: PUSH.L - D0
-0x0b0c: MOVE.L - 0xfb,D0
-0x0b12: MOVEA.W - VAR(0x6),A0
-0x0b16: ADD.L - A0,D0
-0x0b18: LSL.L - 0x1,D0
-0x0b1a: ADDI.L - HEAP(0x1e8),D0
-0x0b24: MOVEA.L - D0,A0
-0x0b26: MOVE.W - (A0),D0
-0x0b28: EXT.L - D0
-0x0b2a: PUSH.L - D0
-0x0b2c: MOVE.L - 0x2f1,D0
-0x0b32: MOVEA.W - VAR(0x6),A0
-0x0b36: ADD.L - A0,D0
-0x0b38: LSL.L - 0x1,D0
-0x0b3a: ADDI.L - HEAP(0x1e8),D0
-0x0b44: MOVEA.L - D0,A0
-0x0b46: MOVE.W - (A0),D0
-0x0b48: EXT.L - D0
-0x0b4a: POP.L - D1
-0x0b4c: ADD.L - D1,D0
-0x0b4e: POP.L - A0
-0x0b50: MOVE.W - D0,(A0)
-
-*/
+
void FoolPrologue::sub_128_a8c(int16_t unk) {
+ // 128:0a8c
this->var_i16_1a4 = unk;
g_toolbox->PenMode(0xa);
do {
@@ -1248,116 +301,11 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
// 128:0b52
if ((this->arr_i16_1e8[this->var_i16_6] < 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] < 0x140)) {
-/*
-0x0b52: MOVEQ - 0x0,D0
-0x0b54: MOVEA.W - VAR(0x6),A0
-0x0b58: ADD.L - A0,D0
-0x0b5a: LSL.L - 0x1,D0
-0x0b5c: ADDI.L - HEAP(0x1e8),D0
-0x0b66: MOVEA.L - D0,A0
-0x0b68: MOVE.W - (A0),D0
-
-0x0b6a: EXT.L - D0
-0x0b6c: CMPI.L - 0x1f4,D0
-0x0b72: SGT - D0
-0x0b74: EXT.W - D0
-0x0b76: EXT.L - D0
-0x0b78: PUSH.L - D0
-
-0x0b7a: MOVE.L - 0xfb,D0
-0x0b80: MOVEA.W - VAR(0x6),A0
-0x0b84: ADD.L - A0,D0
-0x0b86: LSL.L - 0x1,D0
-0x0b88: ADDI.L - HEAP(0x1e8),D0
-0x0b92: MOVEA.L - D0,A0
-0x0b94: MOVE.W - (A0),D0
-0x0b96: EXT.L - D0
-0x0b98: CMPI.L - 0x140,D0
-0x0b9e: SGT - D0
-
-0x0ba0: EXT.W - D0
-0x0ba2: EXT.L - D0
-0x0ba4: POPOR.L - D0
-0x0ba6: TST.L - D0
-0x0ba8: BNE - [0x0bae]
-0x0baa: JMP - [0xc56]
---------
-
-
-0x0bae: MOVEQ - 0x0,D0
-0x0bb0: MOVEA.W - VAR(0x6),A0
-0x0bb4: ADD.L - A0,D0
-0x0bb6: LSL.L - 0x1,D0
-0x0bb8: ADDI.L - HEAP(0x1e8),D0
-0x0bc2: PUSH.L - D0
-0x0bc4: MOVE.L - 0x264,D0
-0x0bca: JSR - "RND_INT"
-0x0bce: SUBI.L - 0xc8,D0
-0x0bd4: POP.L - A0
-0x0bd6: MOVE.W - D0,(A0)
-
-0x0bd8: MOVE.L - 0xfb,D0
-0x0bde: MOVEA.W - VAR(0x6),A0
-0x0be2: ADD.L - A0,D0
-0x0be4: LSL.L - 0x1,D0
-0x0be6: ADDI.L - HEAP(0x1e8),D0
-0x0bf0: PUSH.L - D0
-0x0bf2: MOVE.L - 0x1ba,D0
-0x0bf8: JSR - "RND_INT"
-0x0bfc: SUBI.L - 0xc8,D0
-0x0c02: POP.L - A0
-0x0c04: MOVE.W - D0,(A0)
-
-0x0c06: MOVE.L - 0x1f6,D0
-0x0c0c: MOVEA.W - VAR(0x6),A0
-0x0c10: ADD.L - A0,D0
-0x0c12: LSL.L - 0x1,D0
-0x0c14: ADDI.L - HEAP(0x1e8),D0
-0x0c1e: PUSH.L - D0
-0x0c20: MOVEQ - 0x5,D0
-0x0c22: JSR - "RND_INT"
-0x0c26: ADDQ.L - 0x1,D0
-0x0c28: POP.L - A0
-0x0c2a: MOVE.W - D0,(A0)
-
-0x0c2c: MOVE.L - 0x2f1,D0
-0x0c32: MOVEA.W - VAR(0x6),A0
-0x0c36: ADD.L - A0,D0
-0x0c38: LSL.L - 0x1,D0
-0x0c3a: ADDI.L - HEAP(0x1e8),D0
-0x0c44: PUSH.L - D0
-0x0c46: MOVEQ - 0xa,D0
-0x0c48: JSR - "RND_INT"
-0x0c4c: ADDI.L - 0x00000019,D0
-0x0c52: POP.L - A0
-0x0c54: MOVE.W - D0,(A0)
-
-0x0c56: JSR - 130,0xe82
-
-0x0c5a: ADDQ.W - 0x1,VAR(0x6)
-0x0c5e: CMPI.W - 0xb5,VAR(0x6)
-0x0c64: BLE - [0x0c6e]
-0x0c68: MOVEQ - 0x1,D0
-0x0c6a: MOVE.W - D0,VAR(0x6)
-
-0x0c6e: PUSH.L - 0 (unsafe)
-0x0c70: TRAP - _TickCount
-0x0c72: POP.L - D0
-0x0c74: PUSH.L - D0
-0x0c76: MOVE.L - VAR(0x2),D0
-0x0c7a: MOVEA.W - VAR(0x1a4),A0
-0x0c7e: ADD.L - A0,D0
-0x0c80: POP.L - D1
-0x0c82: CMP.L - D0,D1
-0x0c84: BLE - [0x0a96]
-0x0c88: RTS
---------
-*/
// 128:0bae
this->arr_i16_1e8[this->var_i16_6] = _vm->_rnd->getRandomNumber(0x264) - 0xc8;
- this->arr_i16_1e8[0xfb + this->var_i16_6] = (std::rand() % 0x1ba) - 0xc8;
- this->arr_i16_1e8[0x1f6 + this->var_i16_6] = (std::rand() % 0x5) + 0x1;
- this->arr_i16_1e8[0x2f1 + this->var_i16_6] = (std::rand() % 0xa) + 0x19;
+ this->arr_i16_1e8[0xfb + this->var_i16_6] = _vm->_rnd->getRandomNumber(0x1ba) - 0xc8;
+ this->arr_i16_1e8[0x1f6 + this->var_i16_6] = _vm->_rnd->getRandomNumber(0x5) + 0x1;
+ this->arr_i16_1e8[0x2f1 + this->var_i16_6] = _vm->_rnd->getRandomNumber(0xa) + 0x19;
}
// 128:0c56
this->sub_130_e82();
@@ -1368,115 +316,8 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
} while (this->var_i32_2 + this->var_i16_1a4 <= g_toolbox->TickCount())
}
-/*
-
-0x0c8a: JSR - 129,0x4
-0x0c8e: MOVEQ - -0x1,D0
-0x0c90: JSR - "MEM"
-0x0c94: MOVE.L - D0,VAR(0x1a6)
-0x0c98: CMPI.W - 0x1,VAR(0x1aa)
-0x0c9e: BNE - [0x0cb0]
-0x0ca2: JSR - 130,0x4
-0x0ca6: MOVEQ - -0x1,D0
-0x0ca8: JSR - "MEM"
-0x0cac: MOVE.L - D0,VAR(0x1a6)
-0x0cb0: CMPI.W - 0x2,VAR(0x1aa)
-0x0cb6: BNE - [0x0cc8]
-0x0cba: JSR - 131,0x4
-0x0cbe: MOVEQ - -0x1,D0
-0x0cc0: JSR - "MEM"
-0x0cc4: MOVE.L - D0,VAR(0x1a6)
-0x0cc8: JMP - "ZBASIC_UNK4"
-0x0ccc: JSR - "ZBASIC_20"
-0x0cd0: MOVE.L - HEAP(0x41598),D0
-0x0cda: MOVE.L - D0,VAR(0x1ac)
-0x0cde: MOVE.L - HEAP(0x41846),D0
-0x0ce8: MOVE.L - D0,VAR(0x1b0)
-0x0cec: MOVE.W - VAR(0x18e),D0
-0x0cf0: EXT.L - D0
-0x0cf2: MOVE.L - D0,D1
-0x0cf4: MOVEQ - 0x2,D0
-0x0cf6: JSR - "MUL_INT"
-0x0cfa: ADDQ.L - 0x2,D0
-0x0cfc: MOVE.W - D0,VAR(0x1b4)
-
-0x0d00: MOVEQ - 0x1,D0
-0x0d02: MOVE.W - D0,VAR(0x74)
-0x0d06: MOVEA.W - VAR(0x74),A0
-0x0d0a: ADDA.L - A0,A0
-0x0d0c: ADDA.L - HEAP(0x41598),A0
-0x0d16: MOVE.W - VAR(0x74),(A0)
-0x0d1a: MOVE.W - VAR(0x18e),D0
-0x0d1e: EXT.L - D0
-0x0d20: ADDQ.W - 0x1,VAR(0x74)
-0x0d24: CMP.W - VAR(0x74),D0
-0x0d28: BGE - [0x0d06]
-
-0x0d2a: MOVE.W - VAR(0x18e),VAR(0x74)
-0x0d30: MOVE.W - VAR(0x74),D0
-0x0d34: EXT.L - D0
-0x0d36: JSR - "RND_INT"
-0x0d3a: MOVE.W - D0,VAR(0x1b6)
-
-0x0d3e: MOVE.W - VAR(0x74),D0
-0x0d42: EXT.L - D0
-0x0d44: LSL.L - 0x1,D0
-0x0d46: ADDI.L - HEAP(0x412ea),D0
-0x0d50: PUSH.L - D0
-0x0d52: MOVEA.W - VAR(0x1b6),A0
-0x0d56: ADDA.L - A0,A0
-0x0d58: ADDA.L - HEAP(0x41598),A0
-0x0d62: MOVE.W - (A0),D0
-0x0d64: EXT.L - D0
-0x0d66: POP.L - A0
-0x0d68: MOVE.W - D0,(A0)
-
-0x0d6a: MOVE.W - VAR(0x1b6),D0
-0x0d6e: EXT.L - D0
-0x0d70: MOVE.L - D0,D1
-0x0d72: MOVEQ - 0x2,D0
-0x0d74: JSR - "MUL_INT"
-0x0d78: ADDQ.L - 0x2,D0
-0x0d7a: MOVE.W - D0,VAR(0x1b8)
-
-0x0d7e: MOVE.L - VAR(0x1ac),D0
-0x0d82: MOVEA.W - VAR(0x1b8),A0
-0x0d86: ADD.L - A0,D0
-0x0d88: PUSH.L - D0
-0x0d8a: MOVE.L - VAR(0x1b0),D0
-0x0d8e: MOVEA.W - VAR(0x1b8),A0
-0x0d92: ADD.L - A0,D0
-0x0d94: PUSH.L - D0
-0x0d96: MOVE.W - VAR(0x1b4),D0
-0x0d9a: EXT.L - D0
-0x0d9c: MOVEA.W - VAR(0x1b8),A0
-0x0da0: SUB.L - A0,D0
-0x0da2: JSR - "BLOCKMOVE"
-
-0x0da6: MOVE.L - VAR(0x1b0),D0
-0x0daa: MOVEA.W - VAR(0x1b8),A0
-0x0dae: ADD.L - A0,D0
-0x0db0: PUSH.L - D0
-0x0db2: MOVE.L - VAR(0x1ac),D0
-0x0db6: MOVEA.W - VAR(0x1b8),A0
-0x0dba: ADD.L - A0,D0
-0x0dbc: SUBQ.L - 0x2,D0
-0x0dbe: PUSH.L - D0
-0x0dc0: MOVE.W - VAR(0x1b4),D0
-0x0dc4: EXT.L - D0
-0x0dc6: MOVEA.W - VAR(0x1b8),A0
-0x0dca: SUB.L - A0,D0
-0x0dcc: JSR - "BLOCKMOVE"
-
-0x0dd0: MOVEQ - 0x1,D0
-0x0dd2: ADDI.W - 0xffff,VAR(0x74)
-0x0dd8: CMP.W - VAR(0x74),D0
-0x0ddc: BLE - [0x0d30]
-0x0de0: RTS
---------
-*/
-
void FoolPrologue::sub_128_c8a() {
+ // 128:0c8a
this->sub_129_004();
this->var_i32_1a6 = zbasic_mem(-1);
if (this->var_i16_1aa == 1) {
@@ -1509,119 +350,33 @@ void FoolPrologue::sub_128_c8a() {
}
}
-/*
-
-0x0de2: PUSH.W - 0xfb
-0x0de6: MOVEQ - 0x9,D0
-0x0de8: PUSH.W - D0
-0x0dea: PUSH.W - 0
-0x0dec: MOVEQ - 0x2,D0
-0x0dee: PUSH.W - D0
-0x0df0: JSR - "TEXT"
-0x0df4: MOVEA.L - STR(0xa0),A0 # b'Click Mouse to Continue'
-0x0dfc: JSR - "BUFFER_CONCAT"
-0x0e00: LEA - VAR(0x76),A0
-0x0e04: JSR - "BUFFER_FLUSH"
-0x0e08: PEA - [0x0e1a]
-0x0e0c: MOVEQ - 0x5,D0
-0x0e0e: PUSH.L - D0
-0x0e10: MOVE.L - 0x151,D0
-0x0e16: BRA - [0x0a6c]
-0x0e1a: RTS
---------
-*/
void FoolPrologue::sub_128_de2() {
+ // 128:0de2
zbasic_text(0xfb, 0x9, 0x0, 0x2);
this->var_str_76 = STR(0xa0); // "Click Mouse to Continue"
this->sub_128_a6c(0x151, 0x5);
}
-/*
-
-0x0e1c: PUSH.W - 0xfb
-0x0e20: MOVEQ - 0x9,D0
-0x0e22: PUSH.W - D0
-0x0e24: PUSH.W - 0
-0x0e26: MOVEQ - 0x2,D0
-0x0e28: PUSH.W - D0
-0x0e2a: JSR - "TEXT"
-0x0e2e: MOVEA.L - STR(0xb8),A0 # b'Click Mouse to Continue'
-0x0e36: JSR - "BUFFER_CONCAT"
-0x0e3a: LEA - VAR(0x76),A0
-0x0e3e: JSR - "BUFFER_FLUSH"
-0x0e42: PEA - [0x0e56]
-0x0e46: PUSH.L - 0x000001f7
-0x0e4c: MOVE.L - 0x154,D0
-0x0e52: BRA - [0x026c]
-0x0e56: RTS
---------
-*/
void FoolPrologue::sub_128_e1c() {
+ // 128:0e1c
zbasic_text(0xfb, 0x9, 0x0, 0x2);
this->var_str_76 = "Click Mouse to Continue"; // STR(0xb8)
this->sub_128_26c(0x154, 0x1f7);
}
-/*
-0x0e58: JSR - [0xe80]
-0x0e5c: PUSH.W - 0 (unsafe)
-0x0e5e: MOVEQ - 0x2,D0
-0x0e60: PUSH.W - D0
-0x0e62: PEA - VAR(0x22)
-0x0e66: TRAP - _GetNextEvent
-0x0e68: POP.B - D0
-0x0e6a: EXT.W - D0
-0x0e6c: EXT.L - D0
-0x0e6e: MOVE.W - D0,VAR(0x1ba)
-0x0e72: CMPI.W - 0x1,VAR(0x22)
-0x0e78: BNE - [0x0e5c]
-0x0e7a: JSR - [0xe80]
-0x0e7e: RTS
---------
-*/
-
void FoolPrologue::sub_128_e58() {
+ // 128:0e58
this->sub_128_e80();
while (true) {
- this->var_i16_1ba = g_toolbox->GetNextEvent(0, 0x2, &this->var_22);
+ this->var_i16_1ba = g_toolbox->GetNextEvent(0x2, &this->var_22);
if (this->var_22 == 1)
break;
}
this->sub_128_e80();
}
-/*
-
-0x0e80: PUSH.W - 0 (unsafe)
-0x0e82: MOVEQ - -0x1,D0
-0x0e84: PUSH.W - D0
-0x0e86: PEA - VAR(0x22)
-0x0e8a: TRAP - _GetNextEvent
-0x0e8c: POP.B - D0
-0x0e8e: EXT.W - D0
-0x0e90: EXT.L - D0
-0x0e92: MOVE.W - D0,VAR(0x1ba)
-0x0e96: CMPI.W - 0x6,VAR(0x22)
-0x0e9c: BNE - [0x0ea4]
-0x0ea0: JSR - [0xed2]
-0x0ea4: CMPI.W - 0x7,VAR(0x22)
-0x0eaa: BNE - [0x0eb2]
-0x0eae: JSR - [0xee0]
-0x0eb2: MOVE.W - VAR(0x22),D0
-0x0eb6: SEQ - D0
-0x0eb8: EXT.W - D0
-0x0eba: EXT.L - D0
-0x0ebc: PUSH.L - D0
-0x0ebe: MOVE.W - VAR(0x30),D0
-0x0ec2: EXT.L - D0
-0x0ec4: ANDI.L - 0x80,D0
-0x0eca: POPAND.L - D0
-0x0ecc: TST.L - D0
-0x0ece: BEQ - [0x0e80]
-0x0ed0: RTS
---------
-*/
void FoolPrologue::sub_128_e80() {
+ // 128:0e80
while (true) {
this->var_i16_1ba = (int)g_toolbox->GetNextEvent(-1, &this->var_22);
if (this->var_22 == 6) {
@@ -1634,49 +389,26 @@ void FoolPrologue::sub_128_e80() {
break;
}
}
-
}
-/*
-0x0ed2: PUSH.L - VAR(0x24)
-0x0ed6: TRAP - _BeginUpdate
-0x0ed8: PUSH.L - VAR(0x24)
-0x0edc: TRAP - _EndUpdate
-0x0ede: RTS
---------
-*/
void FoolPrologue::sub_128_ed2() {
+ // 128:0ed2
g_toolbox->BeginUpdate(this->var_window_24);
g_toolbox->EndUpdate(this->var_window_24);
}
-/*
-0x0ee0: LEA - VAR(0x24),A0
-0x0ee4: EXG - D0,A0
-0x0ee6: JSR - "PEEKWORD"
-0x0eea: MOVE.W - D0,VAR(0x1bc)
-0x0eee: LEA - VAR(0x24),A0
-0x0ef2: EXG - D0,A0
-0x0ef4: ADDQ.L - 0x2,D0
-0x0ef6: JSR - "PEEKWORD"
-0x0efa: MOVE.W - D0,VAR(0x1be)
-0x0efe: MOVE.W - VAR(0x1be),D0
-0x0f02: EXT.L - D0
-0x0f04: JSR - "ZBASIC_UNK11"
-0x0f08: RTS
---------
-*/
void FoolPrologue::sub_128_ee0() {
- this->var_i16_1bc = this->var_window_24.port;
- this->var_i16_1be = this->var_window_24.windowKind;
+ // 128:0ee0
+ // done by using PEEKWORD into fixed offsets of the window pointer
+ this->var_i16_1bc = this->var_window_24.port; // +0
+ this->var_i16_1be = this->var_window_24.windowKind; // +2
zbasic_unk11(this->var_i16_1be);
}
-/*
-0x0f0a: MOVE.W - 0x80,D1
-0x0f0e: JMP - "ZBASIC_199"
-0x0f12: JMP - 129,0x4
-*/
+void FoolPrologue::sub_128_f0a() {
+ zbasic_199(0x80); // switch CODE resource?
+ this->sub_129_004();
+}
// Sources:
// QuickDraw types, Inside Macintosh I-201
@@ -1698,71 +430,21 @@ void FoolPrologue::sub_128_ee0() {
// - INTEGER screenBits.rowBytes = 0x74
// - Rect screenBits.bounds = 0x76
// LONGINT randSeed = 0x7e
-/*
-Found custom CODE block 129
-0x0004: MOVE.L - 0x904,D0
-0x000a: JSR - "PEEKLONG" # current A5
-0x000e: SUBI.L - 0x72,D0
-0x0014: JSR - "PEEKWORD" # quickdraw globals,
-0x0018: MOVE.W - D0,VAR(0x10)
-
-0x001c: MOVE.L - 0x904,D0
-0x0022: JSR - "PEEKLONG" # current A5
-0x0026: SUBI.L - 0x74,D0
-0x002c: JSR - "PEEKWORD"
-0x0030: MOVE.W - D0,VAR(0x12)
-*/
void FoolPrologue::sub_129_004() {
// get the screen width and height from QuickDraw
- this->var_i16_10 = SCREEN_WIDTH; // window width?
- this->var_i16_12 = SCREEN_HEIGHT; // window height?
+ // 0x0004: MOVE.L - 0x904,D0
+ // 0x000a: JSR - "PEEKLONG" # current A5
+ // 0x000e: SUBI.L - 0x72,D0
+ // 0x0014: JSR - "PEEKWORD" # quickdraw globals,
+ this->var_i16_10 = _vm->_wm->_screenDims.width(); // window width?
+ this->var_i16_12 = _vm->_wm->_screenDims.height(); // window height?
-/*
-0x0034: MOVE.W - VAR(0x10),D0
-0x0038: EXT.L - D0
-0x003a: SUBI.L - 0x200,D0
-0x0040: MOVE.L - D0,D1
-0x0042: MOVEQ - 0x2,D0
-0x0044: JSR - "DIV_INT"
-0x0048: MOVE.W - D0,VAR(0x14)
-
-0x004c: MOVE.W - VAR(0x12),D0
-0x0050: EXT.L - D0
-0x0052: SUBI.L - 0x156,D0
-0x0058: MOVE.L - D0,D1
-0x005a: MOVEQ - 0x2,D0
-0x005c: JSR - "DIV_INT"
-0x0060: MOVE.W - D0,VAR(0x16)
-*/
// 129:0034
// set left and top offsets based on a drawable area of 512x342
- this->var_i16_14 = (this->var_i16_10 - 0x200)/2;
- this->var_i16_16 = (this->var_i16_12 - 0x156)/2;
-
- /*
-0x0064: MOVEQ - 0x1,D0
-0x0066: PUSH.W - D0
-0x0068: PEA - STR(0xd0) # b''
-0x0070: PUSH.W - 0
-0x0072: PUSH.W - 0
-0x0074: MOVEQ - -0x1,D0
-0x0076: PUSH.W - D0
-0x0078: PUSH.W - VAR(0x10)
-0x007c: PUSH.W - VAR(0x12)
-0x0080: MOVEQ - -0x1,D0
-0x0082: PUSH.W - D0
-0x0084: MOVEQ - 0x3,D0
-0x0086: PUSH.W - D0
-0x0088: JSR - "WINDOW"
-0x008c: JSR - "COORDINATE_WINDOW"
-0x0090: MOVEQ - 0x0,D0
-0x0092: MOVE.W - D0,VAR(0x1c)
-0x0096: MOVEQ - 0x0,D0
-0x0098: MOVE.W - D0,VAR(0x1e)
-0x009c: MOVEQ - 0x0,D0
-0x009e: MOVE.W - D0,VAR(0x20)
-*/
+ this->var_i16_14 = (this->var_i16_10 - SCREEN_WIDTH)/2;
+ this->var_i16_16 = (this->var_i16_12 - SCREEN_HEIGHT)/2;
+
// 129:0064
zbasic_window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, 3);
zbasic_coordinate_window();
@@ -1770,32 +452,7 @@ void FoolPrologue::sub_129_004() {
this->var_i16_1c = 0;
this->var_i16_1e = 0;
this->var_i16_20 = 0;
-/*
-0x00a2: MOVE.L - 0x28e,D0 # ROM85
-0x00a8: JSR - "BCD_FROM_INT"
-0x00ac: JSR - "CAST_INT"
-0x00b0: JSR - "PEEKWORD"
-0x00b4: CMPI.L - 0x3fff,D0
-0x00ba: BEQ - [0x00c0]
-0x00bc: JMP - [0xee]
---------
-0x00c0: MOVE.W - 0x4e20,VAR(0x1c)
-0x00c6: MOVE.W - 0x4e20,VAR(0x1e)
-0x00cc: MOVE.W - 0x4e20,VAR(0x20)
-0x00d2: MOVEQ - 0x64,D0
-0x00d4: PUSH.W - D0
-0x00d6: MOVEQ - 0x64,D0
-0x00d8: PUSH.W - D0
-0x00da: PEA - VAR(0x1c)
-0x00de: TRAP - _SetCPixel
-0x00e0: MOVEQ - 0x64,D0
-0x00e2: PUSH.W - D0
-0x00e4: MOVEQ - 0x64,D0
-0x00e6: PUSH.W - D0
-0x00e8: PEA - VAR(0x1c)
-0x00ec: TRAP - _GetCPixel
-
- */
+
// code checks Rom85 for presence of 128K ROM before doing next bit
// 129:00a2
if (true) {
@@ -1806,31 +463,6 @@ void FoolPrologue::sub_129_004() {
g_toolbox->GetCPixel(0x64, 0x64, &this->var_i16_1c);
}
-/*
-0x00ee: MOVE.L - HEAP(0xa8a),D0
-0x00f8: MOVE.L - D0,VAR(0xc)
-0x00fc: PUSH.L - VAR(0xc)
-0x0100: TRAP - _OpenPort
-0x0102: MOVE.L - HEAP(0x9c0),D0
-0x010c: MOVE.L - D0,VAR(0x8)
-0x0110: PUSH.L - VAR(0x8)
-0x0114: TRAP - _OpenPort
-0x0116: CMPI.W - 0x200,VAR(0x10)
-0x011c: SNE - D0
-0x011e: EXT.W - D0
-0x0120: EXT.L - D0
-0x0122: PUSH.L - D0
-0x0124: CMPI.W - 0x156,VAR(0x12)
-0x012a: SNE - D0
-0x012c: EXT.W - D0
-0x012e: EXT.L - D0
-0x0130: POPOR.L - D0
-0x0132: TST.L - D0
-0x0134: BNE - [0x013a]
-0x0136: JMP - [0x1b0]
---------
- */
-
// 129:00ee
this->var_i32_c = this->arr_i21_a8a[0];
g_toolbox->OpenPort(this->var_i32_c);
@@ -1838,186 +470,29 @@ void FoolPrologue::sub_129_004() {
g_toolbox->OpenPort(this->var_i32_8);
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
-
-/*
-
-0x013a: PEA - [0x0156]
-0x013e: MOVEQ - 0x14,D0
-0x0140: PUSH.L - D0
-0x0142: PUSH.L - 0
-0x0144: MOVEA.W - VAR(0x12),A0
-0x0148: PUSH.L - A0
-0x014a: MOVEA.W - VAR(0x10),A0
-0x014e: PUSH.L - A0
-0x0150: MOVEQ - 0x2,D0
-0x0152: JMP - 128,0x2f0
-
-0x0156: MOVE.L - HEAP(0x1bc),D0
-0x0160: PUSH.L - D0
-0x0162: MOVE.W - VAR(0x14),D0
-0x0166: EXT.L - D0
-0x0168: SUBQ.L - 0x2,D0
-0x016a: PUSH.W - D0
-0x016c: MOVE.W - VAR(0x16),D0
-0x0170: EXT.L - D0
-0x0172: SUBQ.L - 0x2,D0
-0x0174: PUSH.W - D0
-0x0176: MOVE.W - VAR(0x14),D0
-0x017a: EXT.L - D0
-0x017c: ADDI.L - 0x00000202,D0
-0x0182: PUSH.W - D0
-0x0184: MOVE.W - VAR(0x16),D0
-0x0188: EXT.L - D0
-0x018a: ADDI.L - 0x00000158,D0
-0x0190: PUSH.W - D0
-0x0192: TRAP - _SetRect
-
-0x0194: MOVE.L - HEAP(0x19c),D0
-0x019e: PUSH.L - D0
-0x01a0: TRAP - _PenPat
-0x01a2: MOVE.L - HEAP(0x1bc),D0
-0x01ac: PUSH.L - D0
-0x01ae: TRAP - _FrameRect
- * */
// 129:013a
this->sub_128_2f0(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
- g_toolbox->SetRect(this->arr_i32_1bc[0], this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
+ g_toolbox->SetRect(&this->arr_i32_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
g_toolbox->PenPat(this->arr_i32_19c[0]);
- g_toolbox->FrameRect(this->arr_i32_1bc[0]);
+ g_toolbox->FrameRect(&this->arr_i32_1bc);
}
-/*
-0x01b0: PUSH.L - VAR(0x8)
-0x01b4: TRAP - _SetPort
-
-0x01b6: PUSH.W - 0x200
-0x01ba: PUSH.W - 0x156
-0x01be: TRAP - _PortSize
-
-0x01c0: PUSH.W - VAR(0x14)
-0x01c4: PUSH.W - VAR(0x16)
-0x01c8: TRAP - _MovePortTo
-
-0x01ca: MOVE.L - HEAP(0x1bc),D0
-0x01d4: PUSH.L - D0
-0x01d6: PUSH.W - 0
-0x01d8: PUSH.W - 0
-0x01da: PUSH.W - 0x200
-0x01de: PUSH.W - 0x156
-0x01e2: TRAP - _SetRect
-
-0x01e4: MOVE.L - HEAP(0x1bc),D0
-0x01ee: PUSH.L - D0
-0x01f0: TRAP - _ClipRect
- */
-
// 129:01b0
g_toolbox->SetPort(this->var_i32_8);
g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->MovePortTo(this->var_i16_14, this->var_i16_16);
- g_toolbox->SetRect(this->arr_i32_1bc[0], 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->ClipRect(this->arr_i32_1bc[0]);
-/*
-0x01f2: CMPI.W - 0x156,VAR(0x12)
-0x01f8: BEQ - [0x01fe]
-0x01fa: JMP - [0x238]
---------
-0x01fe: MOVE.L - HEAP(0x1bc),D0
-0x0208: PUSH.L - D0
-0x020a: PUSH.W - 0
-0x020c: MOVEQ - 0x14,D0
-0x020e: PUSH.W - D0
-0x0210: PUSH.W - 0x200
-0x0214: PUSH.W - 0x156
-0x0218: TRAP - _SetRect
-0x021a: MOVE.L - HEAP(0x1bc),D0
-0x0224: PUSH.L - D0
-0x0226: MOVE.L - HEAP(0x19c),D0
-0x0230: PUSH.L - D0
-0x0232: TRAP - _FillRect
-0x0234: JMP - [0x26c]
---------
-0x0238: MOVE.L - HEAP(0x1bc),D0
-0x0242: PUSH.L - D0
-0x0244: PUSH.W - 0
-0x0246: PUSH.W - 0
-0x0248: PUSH.W - 0x200
-0x024c: PUSH.W - 0x156
-0x0250: TRAP - _SetRect
-0x0252: MOVE.L - HEAP(0x1bc),D0
-0x025c: PUSH.L - D0
-0x025e: MOVE.L - HEAP(0x19c),D0
-0x0268: PUSH.L - D0
-0x026a: TRAP - _FillRect
- * */
+ g_toolbox->SetRect(&this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->ClipRect(&this->arr_i32_1bc);
+
// 129:01f2
if (this->var_i16_12 == SCREEN_HEIGHT) {
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(this->arr_i32_1bc, this->arr_i32_19c);
+ g_toolbox->SetRect(&this->arr_i32_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(&this->arr_i32_1bc, this->arr_i32_19c);
} else {
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(this->arr_i32_1bc, this->arr_i32_19c);
+ g_toolbox->SetRect(&this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(&this->arr_i32_1bc, this->arr_i32_19c);
}
- /*
-0x026c: MOVE.L - VAR(0x8),D0
-0x0270: ADDQ.L - 0x2,D0
-0x0272: JSR - "PEEKLONG"
-0x0276: MOVE.L - D0,VAR(0x32)
-
-0x027a: MOVEQ - 0x40,D0
-0x027c: MOVE.W - D0,VAR(0x36)
-
-0x0280: MOVE.W - VAR(0x16),D0
-0x0284: EXT.L - D0
-0x0286: NEG.L - D0
-0x0288: MOVE.W - D0,VAR(0x38)
-
-0x028c: MOVE.W - VAR(0x14),D0
-0x0290: EXT.L - D0
-0x0292: NEG.L - D0
-0x0294: MOVE.W - D0,VAR(0x3a)
-
-0x0298: MOVE.W - VAR(0x16),D0
-0x029c: EXT.L - D0
-0x029e: ADDI.L - 0x00000156,D0
-0x02a4: MOVE.W - D0,VAR(0x3c)
-
-0x02a8: MOVE.W - VAR(0x14),D0
-0x02ac: EXT.L - D0
-0x02ae: ADDI.L - 0x00000200,D0
-0x02b4: MOVE.W - D0,VAR(0x3e)
-
-0x02b8: MOVEQ - 0x40,D0
-0x02ba: MOVE.W - D0,VAR(0x44)
-
-0x02be: MOVEQ - 0x0,D0
-0x02c0: MOVE.W - D0,VAR(0x46)
-
-0x02c4: MOVEQ - 0x0,D0
-0x02c6: MOVE.W - D0,VAR(0x48)
-
-0x02ca: MOVE.W - 0x156,VAR(0x4a)
-
-0x02d0: MOVE.W - 0x200,VAR(0x4c)
-
-0x02d6: MOVEQ - 0x40,D0
-0x02d8: MOVE.W - D0,VAR(0x52)
-
-0x02dc: MOVEQ - 0x0,D0
-0x02de: MOVE.W - D0,VAR(0x54)
-
-0x02e2: MOVEQ - 0x0,D0
-0x02e4: MOVE.W - D0,VAR(0x56)
-
-0x02e8: MOVE.W - 0x156,VAR(0x58)
-
-0x02ee: MOVE.W - 0x200,VAR(0x5a)
-
-0x02f4: MOVEQ - -0x1,D0
-0x02f6: JSR - "MEM"
-0x02fa: MOVE.L - D0,VAR(0x1c0)
-*/
// 129:026c
this->var_i32_32 = this->var_i32_8.portBits;
this->var_i16_36 = 0x40;
@@ -2037,55 +512,7 @@ void FoolPrologue::sub_129_004() {
this->var_i16_5a = SCREEN_WIDTH;
this->var_i32_1c0 = zbasic_mem(-1);
- /*
-0x02fe: CMPI.L - 0xd6d8,VAR(0x1c0)
-0x0306: BLT - [0x030c]
-0x0308: JMP - [0x4a0]
---------
-0x030c: TRAP - _InitCursor
-0x030e: MOVEQ - 0x0,D0
-0x0310: MOVE.L - D0,D1
-0x0312: MOVEQ - 0x14,D0
-0x0314: JSR - "GET_FROM"
-
-0x0318: PUSH.L - 0x000001fc
-0x031e: PUSH.L - 0x00000152
-0x0324: MOVE.L - HEAP(0xb54),D0
-0x032e: MOVEA.L - D0,A0
-0x0330: POP.L - D0
-0x0332: POP.L - D1
-0x0334: JSR - "GET_TO"
-
-0x0338: MOVEQ - 0x19,D0
-0x033a: PUSH.W - D0
-0x033c: MOVEQ - 0x64,D0
-0x033e: PUSH.L - D0
-0x0340: PUSH.W - 0xff
-0x0344: PUSH.W - 0
-0x0346: JSR - "ZBASIC_UNK6"
-
-0x034a: PEA - [0x0368]
-0x034e: MOVEQ - 0x46,D0
-0x0350: PUSH.L - D0
-0x0352: MOVEQ - 0x64,D0
-0x0354: PUSH.L - D0
-0x0356: PUSH.L - 0x000000d8
-0x035c: PUSH.L - 0x00000198
-0x0362: MOVEQ - 0x2,D0
-0x0364: JMP - 128,0x2f0
-
-0x0368: PEA - [0x0386]
-0x036c: MOVEQ - 0x4b,D0
-0x036e: PUSH.L - D0
-0x0370: MOVEQ - 0x69,D0
-0x0372: PUSH.L - D0
-0x0374: PUSH.L - 0x000000d3
-0x037a: PUSH.L - 0x00000193
-0x0380: MOVEQ - 0x1,D0
-0x0382: JMP - 128,0x2f0
-
-*/
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
@@ -2094,102 +521,19 @@ void FoolPrologue::sub_129_004() {
zbasic_unk6(0x19, 0x64, 0xff, 0x0);
this->sub_128_2f0(2, 0x46, 0x64, 0xd8, 0x198);
this->sub_128_2f0(1, 0x4b, 0x69, 0xd3, 0x193);
- /*
-
-
-0x0386: PEA - [0x03a4]
-0x038a: MOVEQ - 0x50,D0
-0x038c: PUSH.L - D0
-0x038e: MOVEQ - 0x6e,D0
-0x0390: PUSH.L - D0
-0x0392: PUSH.L - 0x000000ce
-0x0398: PUSH.L - 0x0000018e
-0x039e: MOVEQ - 0x2,D0
-0x03a0: JMP - 128,0x2f0
-
-0x03a4: PUSH.W - 0
-0x03a6: MOVEQ - 0xc,D0
-0x03a8: PUSH.W - D0
-0x03aa: PUSH.W - 0
-0x03ac: MOVEQ - 0x3,D0
-0x03ae: PUSH.W - D0
-0x03b0: JSR - "TEXT"
-
-0x03b4: MOVEA.L - STR(0xd2),A0 # b'There is not enough available memory'
-0x03bc: JSR - "BUFFER_CONCAT"
-0x03c0: LEA - VAR(0x76),A0
-0x03c4: JSR - "BUFFER_FLUSH"
-0x03c8: PEA - [0x03d8]
-0x03cc: PUSH.L - 0x000000fc
-0x03d2: MOVEQ - 0x64,D0
-0x03d4: JMP - 128,0x2a6
-
-0x03d8: MOVEA.L - STR(0xf8),A0 # b'to run the program at this time.'
-0x03e0: JSR - "BUFFER_CONCAT"
-0x03e4: LEA - VAR(0x76),A0
-0x03e8: JSR - "BUFFER_FLUSH"
-0x03ec: PEA - [0x03fc]
-0x03f0: PUSH.L - 0x000000fc
-0x03f6: MOVEQ - 0x78,D0
-0x03f8: JMP - 128,0x2a6
-
-0x03fc: MOVEA.L - STR(0x11a),A0 # b'Check your instruction manual for '
-0x0404: JSR - "BUFFER_CONCAT"
-0x0408: LEA - VAR(0x76),A0
-0x040c: JSR - "BUFFER_FLUSH"
-0x0410: PEA - [0x0424]
-0x0414: PUSH.L - 0x000000fc
-0x041a: MOVE.L - 0x96,D0
-0x0420: JMP - 128,0x2a6
-
-0x0424: MOVEA.L - STR(0x13e),A0 # b'for possible solutions.'
-0x042c: JSR - "BUFFER_CONCAT"
-0x0430: LEA - VAR(0x76),A0
-0x0434: JSR - "BUFFER_FLUSH"
-0x0438: PEA - [0x044c]
-0x043c: PUSH.L - 0x000000fc
-0x0442: MOVE.L - 0xaa,D0
-0x0448: JMP - 128,0x2a6
-
-0x044c: MOVEA.L - STR(0x156),A0 # b'(click mouse to quit)'
-0x0454: JSR - "BUFFER_CONCAT"
-0x0458: LEA - VAR(0x76),A0
-0x045c: JSR - "BUFFER_FLUSH"
-0x0460: PEA - [0x0474]
-0x0464: PUSH.L - 0x000000fc
-0x046a: MOVE.L - 0xcb,D0
-0x0470: JMP - 128,0x2a6
-
-0x0474: JSR - 128,0xe58
-
-0x0478: MOVEQ - 0x0,D0
-0x047a: MOVE.L - D0,D1
-0x047c: MOVEQ - 0x14,D0
-0x047e: JSR - "GET_FROM"
-
-0x0482: PUSH.W - 0
-0x0484: MOVE.L - HEAP(0xb54),D0
-0x048e: PUSH.L - D0
-0x0490: MOVEQ - 0x0,D0
-0x0492: JSR - "ZBASIC_194"
-
-0x0496: MOVEQ - 0x0,D0
-0x0498: MOVE.W - D0,VAR(0x1aa)
-0x049c: JMP - [0x772]
---------
-*/
+
// 129:0386
this->sub_128_2f0(2, 0x50, 0x6e, 0xc3, 0x18e);
zbasic_text(0, 0xc, 0, 3);
- this->var_str_76 = STR(0xd2);
+ this->var_str_76 = STR(0xd2); // 'There is not enough available memory'
this->sub_128_2a6(0x64, 0xfc);
- this->var_str_76 = STR(0xf8);
+ this->var_str_76 = STR(0xf8); // 'to run the program at this time.'
this->sub_128_2a6(0x78, 0xfc);
- this->var_str_76 = STR(0x11a);
+ this->var_str_76 = STR(0x11a); // 'Check your instruction manual for '
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = STR(0x13e);
+ this->var_str_76 = STR(0x13e); // 'for possible solutions.'
this->sub_128_2a6(0xaa, 0xfc);
- this->var_str_76 = STR(0x156);
+ this->var_str_76 = STR(0x156); // '(click mouse to quit)'
this->sub_128_2a6(0xcb, 0xfc);
this->sub_128_e58();
zbasic_get_from(0x0, 0x14);
@@ -2204,7 +548,7 @@ void FoolPrologue::sub_129_004() {
this->var_i16_176 = zbasic_249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
if (zbasic_106(STR(0x16c), &this->var_i16_1c4)) {
// 129:04de
- this->var_str_76 = STR(0x16e);
+ this->var_str_76 = STR(0x16e); // "And now it is time to show the Finale for the Fool's Errand."
for (int i = 1; i < 0xa; i++) {
this->var_str_76 += zbasic_chr(this->var_i16_74);
}
@@ -2213,49 +557,24 @@ void FoolPrologue::sub_129_004() {
this->var_i16_2ca = this->var_str_76.size();
this->var_i16_2cc = 0;
// 129:0534
- // ??????
-/*
-0x0534: LEA - [0x0764],A0
-0x0538: MOVE.L - A0,-0x8ee(A5)
-0x053c: SF - 0x8,D0
-0x053e: MOVEQ - 0x1,D0
-0x0540: PUSH.W - D0
-0x0542: PEA - VAR(0x1c4)
-0x0546: PUSH.L - 0x000003fc
-0x054c: PUSH.W - VAR(0x2c8)
-0x0550: JSR - "ZBASIC_135"
-
-0x0554: MOVEQ - 0x1,D0
-0x0556: MOVE.W - D0,-0x914(A5)
-0x055a: PEA - VAR(0x2ce)
-0x055e: MOVE.W - VAR(0x2ca),D0
-0x0562: EXT.L - D0
-0x0564: POP.L - A0
-0x0566: JSR - "ZBASIC_163"
-
-0x056a: MOVEQ - 0x1,D0
-0x056c: JSR - "CLOSE"
-
-0x0570: CLR.L - -0x8ee(A5)
-0x0574: PEA - VAR(0x76)
-0x0578: LEA - VAR(0x2ce),A0
-0x057c: POP.L - A1
-0x057e: JSR - "ZBASIC_103"
-
-0x0582: PUSH.L - D0
-0x0584: MOVE.W - VAR(0x2cc),D0
-0x0588: SEQ - D0
-0x058a: EXT.W - D0
-0x058c: EXT.L - D0
-0x058e: POPAND.L - D0
-0x0590: TST.L - D0
-0x0592: BEQ - [0x05a0]
-0x0596: MOVEQ - 0x2,D0
-0x0598: MOVE.W - D0,VAR(0x1aa)
-0x059c: BRA - [0x05a6]
-0x05a0: MOVEQ - 0x0,D0
-0x05a2: MOVE.W - D0,VAR(0x1aa)
- */
+ // what is this???
+ // 0x0534: LEA - [0x0764],A0
+ // 0x0538: MOVE.L - A0,-0x8ee(A5)
+ // 0x053c: SF - 0x8,D0
+ zbasic_135(1, &this->var_i16_1c4, 0x3fc, this->var_i16_2c8);
+
+ // 0x0554: MOVEQ - 0x1,D0
+ // 0x0556: MOVE.W - D0,-0x914(A5)
+ zbasic_163(&this->var_i16_2ce, this->var_i16_2ca);
+ zbasic_close(1);
+ // 0x0570: CLR.L - -0x8ee(A5)
+ // 128:0582
+ if (zbasic_103(&this->var_i16_2ce, &this->var_str_76) &&
+ this->var_i16_2cc == 0) {
+ this->var_i16_1aa = 2;
+ } else {
+ this->var_i16_1aa = 0;
+ }
}
// 129:05a6
@@ -2269,18 +588,18 @@ void FoolPrologue::sub_129_004() {
this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
// 129:0662
zbasic_text(0, 0xc, 0, 0x3);
- this->var_str_76 = STR(0x1ac);
+ this->var_str_76 = STR(0x1ac); // 'Set your monitor to'
this->sub_128_2a6(0x82, 0xfc);
- this->var_str_76 = STR(0x1c0);
+ this->var_str_76 = STR(0x1c0); // '2 color black and white'
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = STR(0x1d8); // start the prologue again
+ this->var_str_76 = STR(0x1d8); // 'and start the Prologue again.'
if (this->var_i16_1aa == 2) {
- this->var_str_76 = STR(0x1f6); // start the finale again
+ this->var_str_76 = STR(0x1f6); // 'and start the Finale again.'
}
this->sub_128_2a6(0xaa, 0xfc);
- this->var_str_76 = STR(0x212);
+ this->var_str_76 = STR(0x212); // '(click mouse to quit)'
this->sub_128_2a6(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
@@ -2295,205 +614,23 @@ void FoolPrologue::sub_129_004() {
zbasic_199(0x81);
this->sub_130_004();
-/*
-0x04a0: MOVEQ - 0x1,D0
-0x04a2: MOVE.W - D0,VAR(0x180)
-0x04a6: MOVEQ - 0x1,D0
-0x04a8: MOVE.W - D0,VAR(0x1aa)
-0x04ac: PEA - VAR(0x180)
-0x04b0: PEA - VAR(0x1c4)
-0x04b4: PEA - VAR(0x2c4)
-0x04b8: PEA - VAR(0x2c8)
-0x04bc: JSR - "ZBASIC_249"
-0x04c0: MOVE.W - D0,VAR(0x176)
-
-0x04c4: PEA - VAR(0x1c4)
-0x04c8: MOVEA.L - STR(0x16c),A0 # b''
-0x04d0: POP.L - A1
-0x04d2: JSR - "ZBASIC_106"
-0x04d6: TST.L - D0
-0x04d8: BNE - [0x04de]
-0x04da: JMP - [0x5a6]
---------
-
-0x04de: MOVEA.L - STR(0x16e),A0 # b"And now it is time to show the Finale for the Fool's Errand."
-0x04e6: JSR - "BUFFER_CONCAT"
-0x04ea: LEA - VAR(0x76),A0
-0x04ee: JSR - "BUFFER_FLUSH"
-0x04f2: MOVEQ - 0x1,D0
-0x04f4: MOVE.W - D0,VAR(0x74)
-
-0x04f8: LEA - VAR(0x76),A0
-0x04fc: JSR - "BUFFER_CONCAT"
-
-0x0500: MOVE.W - VAR(0x74),D0
-0x0504: EXT.L - D0
-0x0506: JSR - "CHR$"
-0x050a: JSR - "BUFFER_CONCAT"
-0x050e: LEA - VAR(0x76),A0
-0x0512: JSR - "BUFFER_FLUSH"
-
-0x0516: MOVEQ - 0xa,D0
-0x0518: ADDQ.W - 0x1,VAR(0x74)
-0x051c: CMP.W - VAR(0x74),D0
-0x0520: BGE - [0x04f8]
-
-0x0522: LEA - VAR(0x76),A0
-0x0526: JSR - "LEN"
-0x052a: MOVE.W - D0,VAR(0x2ca)
-
-0x052e: MOVEQ - 0x0,D0
-0x0530: MOVE.W - D0,VAR(0x2cc)
-
-
-0x05a6: MOVE.W - VAR(0x1c),D0
-0x05aa: EXT.L - D0
-0x05ac: MOVEA.W - VAR(0x20),A0
-0x05b0: ADD.L - A0,D0
-0x05b2: MOVEA.W - VAR(0x1e),A0
-0x05b6: ADD.L - A0,D0
-0x05b8: CMPI.L - 0x0,D0
-0x05be: BNE - [0x05c4]
-0x05c0: JMP - [0x75c]
---------
-0x05c4: TRAP - _InitCursor
-0x05c6: MOVEQ - 0x0,D0
-0x05c8: MOVE.L - D0,D1
-0x05ca: MOVEQ - 0x14,D0
-0x05cc: JSR - "GET_FROM"
-0x05d0: PUSH.L - 0x000001fc
-0x05d6: PUSH.L - 0x00000152
-0x05dc: MOVE.L - HEAP(0xb54),D0
-0x05e6: MOVEA.L - D0,A0
-0x05e8: POP.L - D0
-0x05ea: POP.L - D1
-0x05ec: JSR - "GET_TO"
-
-0x05f0: MOVEQ - 0x19,D0
-0x05f2: PUSH.W - D0
-0x05f4: MOVEQ - 0x64,D0
-0x05f6: PUSH.L - D0
-0x05f8: PUSH.W - 0xff
-0x05fc: PUSH.W - 0
-0x05fe: JSR - "ZBASIC_UNK6"
-
-0x0602: PEA - [0x0622]
-0x0606: MOVEQ - 0x64,D0
-0x0608: PUSH.L - D0
-0x060a: PUSH.L - 0x0000007e
-0x0610: PUSH.L - 0x000000d8
-0x0616: PUSH.L - 0x0000017a
-0x061c: MOVEQ - 0x2,D0
-0x061e: JMP - 128,0x2f0
-
-0x0622: PEA - [0x0642]
-0x0626: MOVEQ - 0x69,D0
-0x0628: PUSH.L - D0
-0x062a: PUSH.L - 0x00000083
-0x0630: PUSH.L - 0x000000d3
-0x0636: PUSH.L - 0x00000175
-0x063c: MOVEQ - 0x1,D0
-0x063e: JMP - 128,0x2f0
-
-0x0642: PEA - [0x0662]
-0x0646: MOVEQ - 0x6e,D0
-0x0648: PUSH.L - D0
-0x064a: PUSH.L - 0x00000088
-0x0650: PUSH.L - 0x000000ce
-0x0656: PUSH.L - 0x00000170
-0x065c: MOVEQ - 0x2,D0
-0x065e: JMP - 128,0x2f0
-
-0x0662: PUSH.W - 0
-0x0664: MOVEQ - 0xc,D0
-0x0666: PUSH.W - D0
-0x0668: PUSH.W - 0
-0x066a: MOVEQ - 0x3,D0
-0x066c: PUSH.W - D0
-0x066e: JSR - "TEXT"
-
-0x0672: MOVEA.L - STR(0x1ac),A0 # b'Set your monitor to'
-0x067a: JSR - "BUFFER_CONCAT"
-0x067e: LEA - VAR(0x76),A0
-0x0682: JSR - "BUFFER_FLUSH"
-0x0686: PEA - [0x069a]
-0x068a: PUSH.L - 0x000000fc
-0x0690: MOVE.L - 0x82,D0
-0x0696: JMP - 128,0x2a6
-
-0x069a: MOVEA.L - STR(0x1c0),A0 # b'2 color black and white'
-0x06a2: JSR - "BUFFER_CONCAT"
-0x06a6: LEA - VAR(0x76),A0
-0x06aa: JSR - "BUFFER_FLUSH"
-0x06ae: PEA - [0x06c2]
-0x06b2: PUSH.L - 0x000000fc
-0x06b8: MOVE.L - 0x96,D0
-0x06be: JMP - 128,0x2a6
-
-0x06c2: MOVEA.L - STR(0x1d8),A0 # b'and start the Prologue again.'
-0x06ca: JSR - "BUFFER_CONCAT"
-0x06ce: LEA - VAR(0x76),A0
-0x06d2: JSR - "BUFFER_FLUSH"
-0x06d6: CMPI.W - 0x2,VAR(0x1aa)
-0x06dc: BNE - [0x06f4]
-0x06e0: MOVEA.L - STR(0x1f6),A0 # b'and start the Finale again.'
-0x06e8: JSR - "BUFFER_CONCAT"
-0x06ec: LEA - VAR(0x76),A0
-0x06f0: JSR - "BUFFER_FLUSH"
-0x06f4: PEA - [0x0708]
-0x06f8: PUSH.L - 0x000000fc
-0x06fe: MOVE.L - 0xaa,D0
-0x0704: JMP - 128,0x2a6
-
-0x0708: MOVEA.L - STR(0x212),A0 # b'(click mouse to quit)'
-0x0710: JSR - "BUFFER_CONCAT"
-0x0714: LEA - VAR(0x76),A0
-0x0718: JSR - "BUFFER_FLUSH"
-0x071c: PEA - [0x0730]
-0x0720: PUSH.L - 0x000000fc
-0x0726: MOVE.L - 0xcb,D0
-0x072c: JMP - 128,0x2a6
-
-0x0730: JSR - 128,0xe58
-0x0734: MOVEQ - 0x0,D0
-0x0736: MOVE.L - D0,D1
-0x0738: MOVEQ - 0x14,D0
-0x073a: JSR - "GET_FROM"
-
-0x073e: PUSH.W - 0
-0x0740: MOVE.L - HEAP(0xb54),D0
-0x074a: PUSH.L - D0
-0x074c: MOVEQ - 0x0,D0
-0x074e: JSR - "ZBASIC_194"
-0x0752: MOVEQ - 0x0,D0
-0x0754: MOVE.W - D0,VAR(0x1aa)
-0x0758: JMP - [0x772]
---------
-
-
-0x075c: JSR - 128,0xe80
-0x0760: JMP - [0x772]
---------
-0x0764: MOVEQ - 0x1,D0
-0x0766: MOVE.W - D0,VAR(0x2cc)
-0x076a: MOVEQ - 0x0,D0
-0x076c: JSR - "ZBASIC_130"
-0x0770: RTS
---------
-0x0772: MOVE.W - 0x81,D1
-0x0776: JMP - "ZBASIC_199"
-0x077a: JMP - 130,0x4
- */
}
}
void FoolPrologue::sub_129_764() {
+ // 129:0764
this->var_i16_2cc = 1;
zbasic_130(0);
}
+void FoolPrologue::sub_129_772() {
+ zbasic_199(0x81);
+ this->sub_130_004();
+}
+
void FoolPrologue::sub_130_004() {
+ // 130:0004
this->var_i16_3ce = 5;
this->sub_130_d28();
this->var_i16_18e = 0x156;
@@ -2766,7 +903,3002 @@ void FoolPrologue::sub_130_004() {
this->sub_128_6e4(0);
this->sub_128_e58();
// 130:0b98
+ this->var_i16_74 = 0;
+ this->var_i16_192 = 1;
+ while (this->var_i16_22 != 1) {
+ // 130:0ba4
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i16_74 += this->var_i16_192;
+ // 130:0bbe
+ if (this->var_i16_74 == 0x5) {
+ this->var_i16_192 = -1;
+ }
+ if (this->var_i16_74 == 1) {
+ this->var_i16_192 = 1;
+ }
+ this->sub_128_610(this->var_i16_74);
+ this->sub_128_24a(0xa);
+ // 130:0bee
+ this->var_i16_1ba = g_toolbox->GetNextEvent(2, &this->var_i16_22);
+ }
+ while (!((this->var_i16_22 == 0) && (this->var_i16_30 & 0x80))) {
+ // 130:0c0c
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i16_74 += this->var_i16_192;
+ // 130:0c26
+ if (this->var_i16_74 == 0x5) {
+ this->var_i16_192 = -1;
+ }
+ if (this->var_i16_74 == 1) {
+ this->var_i16_192 = 1;
+ }
+ this->sub_128_610(this->var_i16_74);
+ this->sub_128_24a(0xa);
+ // 130:0c56
+ this->var_i16_1ba = g_toolbox->GetNextEvent(-1, &this->var_i16_22);
+ if (this->var_i16_22 == 6) {
+ this->sub_128_ed2();
+ }
+ if (this->var_i16_22 == 7) {
+ this->sub_128_ee0();
+ }
+ }
+ // 130:0ca8
+ this->sub_128_610(0x6);
+ this->sub_128_e58();
+ this->sub_128_50a(0, 0x7, 0, 0x1fc);
+ this->sub_128_21e(0xa);
+ this->sub_128_610(0x8);
+ this->sub_128_e58();
+ this->sub_128_354(8, 1);
+ // 130:0ce6
+ // JMP 1002
+ zbasic_199(0x82);
+ this->sub_131_004();
+}
+
+void FoolPrologue::sub_130_cea() {
+ // 130:0cea
+ this->var_i16_3d4 += 1;
+ this->arr_i32_0[this->var_i16_3d4] = g_toolbox->GetPicture(this->var_i16_3d4);
+ // 130:0d0a
+ this->var_i16_3ce = this->var_i16_3d4 * 5 + 0xa;
+ this->sub_130_d28();
+}
+
+void FoolPrologue::sub_130_d28() {
+ // 130:0d28
+ g_toolbox->SetPort(this->var_i32_c);
+ zbasic_text(0, 0xc, 0, 0x1);
+ this->var_str_76 = STR(0x256); // 'Loading Prologue -'
+ this->var_str_76 += Common::String::format("%d", this->var_i16_3ce);
+ this->var_str_76 += STR(0x26a); // '%'
+ // 130:0d70
+ this->sub_128_2f0(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
+ this->sub_128_2a6(0xe, this->var_i16_10/2);
+ g_toolbox->SetPort(this->var_i32_8);
+}
+
+void FoolPrologue::sub_130_db0() {
+ // 130:0db0
+ zbasic_20();
+ g_toolbox->PenMode(0xa);
+ this->var_i16_6 = 0x1;
+ while (this->var_i16_6 <= 0xb5) {
+ // 130:0dc0
+ this->arr_i16_1e8[this->var_i16_6] = _vm->_rnd->getRandomNumber(0x264) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0xfb] = _vm->_rnd->getRandomNumber(0x1ba) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = _vm->_rnd->getRandomNumber(0x5) + 1;
+ this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = _vm->_rnd->getRandomNumber(0xa) + 0x19;
+ // 130:0e68
+ this->sub_130_e82();
+ this->var_i16_6 += 1;
+ }
+ this->var_i16_6 = 1;
+}
+
+void FoolPrologue::sub_130_e82() {
+ // 130:0e82
+ g_toolbox->MoveTo(this->arr_i16_1e8[this->var_i16_6], this->arr_i16_1e8[this->var_i16_6 + 0xfb]);
+ // 130:0ec0
+ g_toolbox->LineTo(
+ this->arr_i16_1e8[this->var_i16_6] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
+ this->arr_i16_1e8[this->var_i16_6 + 0xfb] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
+ );
+}
+
+void FoolPrologue::sub_130_f48() {
+ // 130:0f48
+ this->var_i16_3d2 = zbasic_read_as_int();
+ this->var_i16_74 = 1;
+ while (this->var_i16_74 <= this->var_i16_3d2) {
+ // 130:0f56
+ this->var_i16_176 = zbasic_read_as_int();
+ this->var_i16_180 = zbasic_read_as_int();
+ this->var_str_76 = zbasic_read_as_str();
+ this->var_i16_1ba = 1;
+ // JMP 0xfc2
+
+ while (this->var_i16_1ba > 0) {
+ // 130:0f78
+ this->var_i16_1ba = this->var_str_76.find(STR(0x26c), this->var_i16_1ba);
+ if (this->var_i16_1ba >= 0) {
+ this->var_str_76.replace(this->var_i16_1ba, 1, "\"");
+ }
+ }
+ // 130:0fc8
+ zbasic_text(0xfa, 0xc, 0, 0x1);
+ this->sub_128_a6c(this->var_i16_180, this->var_i16_176);
+ this->var_i16_74 += 1;
+ }
+}
+void FoolPrologue::sub_130_1002() {
+ // 130:1002
+ zbasic_199(0x82);
+ this->sub_131_004();
}
+void FoolPrologue:::sub_131_004() {
+ // 131:0004
+ this->var_i16_3ce = 0x2d;
+ this->sub_131_4dc0();
+ this->var_i32_3d6 = g_toolbox->OpenPoly();
+ g_toolbox->MoveTo(0xc8, 0x8d);
+ g_toolbox->LineTo(0x1df, 0xc8);
+ g_toolbox->LineTo(0x1d2, 0x11b);
+ g_toolbox->LineTo(0xcd, 0x93);
+ g_toolbox->LineTo(0xc8, 0x8d);
+ g_toolbox->ClosePoly();
+ // 131:004c
+ this->arr_i32_7c = g_toolbox->GetPicture(0x1f);
+ this->sub_128_1f4(0x4);
+ zbasic_picture(0x0, 0x0, -1, 0x0, this->arr_i32_7c);
+ g_toolbox->ReleaseResource(*this->arr_i32_7c);
+ this->sub_131_4dc0();
+ for (int i = 0x14; i < 0x1e; i++) {
+ // 131:009c
+ this->arr_i32_0[i] = g_toolbox->GetPicture(this->var_i16_74);
+ if ((i % 3) == 0) {
+ this->var_i16_3ce += 5;
+ this->sub_131_4dc0();
+ }
+ }
+ // 131:00e6
+ for (int i = 6; i <= 9; i++) {
+ this->sub_128_1f4(i);
+ this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ // 131:0110
+ if (i < 8) {
+ zbasic_picture(0, 0x3, -1, 0, this->arr_i32_64);
+ }
+ if (i == 8) {
+ zbasic_picture(0, 0, -1, 0, this->arr_i32_68);
+ }
+ if (i == 9) {
+ zbasic_picture(0x60, 0x4c, -1, 0, this->arr_i32_6c);
+ }
+ }
+ // 131:0184
+ for (int i = 0x19; i <= 0x1b; i++) {
+ g_toolbox->ReleaseResource(*this->arr_i32_0[i]);
+ }
+ // 131:01aa
+ this->arr_i32_4c = g_toolbox->GetPicture(0x13);
+ this->sub_128_1f4(0x5);
+ zbasic_picture(0, 0xb4, -1, 0, this->arr_i32_4c);
+ zbasic_picture(0, 0, -1, 0, this->arr_i32_60);
+ g_toolbox->ReleaseResource(*this->arr_i32_4c);
+ g_toolbox->ReleaseResource(*this->arr_i32_60);
+ this->sub_131_4e98();
+ this->var_i16_3ce = 0x4b;
+ this->sub_131_4dc0();
+ // 131:021e
+ for (int i = 0x20; i <= 0x2f; i++) {
+ this->arr_i32_0[i] = g_toolbox->GetPicture(i);
+ if (i % 3) {
+ this->var_i16_3ce += 5;
+ this->sub_131_4dc0();
+ }
+ }
+ // 131:026e
+ this->var_i16_18e = 0x156;
+ this->sub_128_ccc();
+ this->var_i32_1a6 = zbasic_mem(-1);
+ g_toolbox->SetPortBits(&this->var_i32_32);
+ if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var-i16_12 == SCREEN_HEIGHT))) {
+ // 131:02ac
+ this->sub_128_2f0(0x1, 0, 0, 0x14, 0x1fc);
+ } else {
+ g_toolbox->SetPort(&this->var_i32_c);
+ this->sub_128_2f0(0x2, 0, 0, 0x14, this->var_i16_10);
+ g_toolbox->SetPort(&this->var_i32_8);
+ }
+ // 131:02ec
+ this->sub_128_21e(0x3c);
+ this->sub_128_6e4(0x5);
+ this->sub_128_e58();
+ this->sub_131_4e98();
+ zbasic_52(0x4c);
+ for (int j = 1; j < 0xe; j++) {
+ this->var_i16_3da = 1;
+
+ // 131:030c
+ this->var_i16_18e = zbasic_read_as_int();
+ for (int i = 1; i < this->var_i16_18e; i++) {
+ // 131:031a
+ this->arr_i16_1e8[i] = zbasic_read_as_int();
+ this->arr_i16_1e8[i + 0xfb] = zbasic_read_as_int();
+ this->arr_i16_1e8[i + 0x1f6] = zbasic_read_int();
+ }
+
+ // 131:0380
+ g_toolbox->PenMode(0xa);
+ this->sub_128_3ee(0x14);
+ this->sub_128_3ee(0xa);
+ this->sub_128_3ee(0x14);
+ this->sub_128_3ee(0x5);
+ this->sub_128_3ee(0xa);
+ this->sub_128_3ee(0x5);
+ g_toolbox->PenNormal();
+ this->sub_128_3ee(0x0);
+ }
+
+ // 131:03c0
+ this->sub_128_21e(0x1e);
+ zbasic_text(0xfa, 0xc, 0, 1);
+ this->var_str_76 = Common::String::format("\"%s\"", _("Well. . . that's that!"));
+
+ // 131:0400
+ this->sub_128_a6c(0x178, 0xb4);
+ this->sub_128_21e(0x1e);
+
+ // 131:041a
+ zbasic_picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
+ this->sub_128_21e(0x2);
+ zbasic_picture(0x1cd, 0xbf, -1, 0, this->arr_u8_54);
+ this->sub_128_21e(0x3c);
+ zbasic_picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
+ this->sub_128_21e(0x6);
+ zbasic_picture(0x1a6, 0xbf, -1, 0, this->arr_u8_58);
+ this->sub_128_21e(0x6);
+ zbasic_picture(0x1b3, 0xc5, -1, 0, this->arr_u8_5c);
+
+ // 131:04b4
+ for (int i = 0x14; i < 0x17; i++) {
+ g_toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+
+ // 131:04da
+ this->var_i32_2 = g_toolbox->TickCount();
+
+ this->var_i32_40 = *this->arr_i32_412aa;
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i32_38, this->var_i32_38, 0, 0);
+ this->sub_128_2f0(0);
+ this->sub_131_4e48();
+
+ // 131:0538
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i32_38, this->var_i32_38, 0, 0);
+ g_toolbox->SetPortBits(this->var_i32_4e);
+
+ // 131:0554
+ this->sub_128_2f0(0, 0, 0x9c, 0x15a, 0);
+ this->sub_128_2f0(0x9c, 0x5a, 0xce, 0xa6, 0);
+ this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+
+ // 131:05b0
+ this->sub_128_1f4(6);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ this->sub_128_1f4(7);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ this->sub_128_1f4(8);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ this->sub_128_1f4(9);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+
+ // 131:0630
+ g_toolbox->SetPortBits(this->var_i32_32);
+ zbasic_get_from(0x1bc, 0xc1);
+ zbasic_get_to(0x1ee, 0x117, this->arr_i32_3bca4);
+ this->sub_128_24a(0x3c);
+ this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->sub_128_50a(0x6, 0, 0x1fc, 0x3);
+ this->sub_131_4e48();
+
+ // 131:06aa
+ this->sub_128_50a(5, 0, 0x1fc, 2);
+ this->sub_128_50a(7, 0, 0x1fc, 2);
+ this->sub_128_50a(8, 0, 0x1fc, 1);
+ this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->sub_128_50a(0x9, 0, 0x1fc, 1);
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(0xa);
+ zbasic_20();
+
+ // 131:0730
+ this->var_i16_3dc = 0;
+ this->var_i16_18e = 0;
+ for (int j = 1; j < 0x63; j++) {
+ if (this->var_i16_3dc > 0x156) {
+ // 131:074e
+ this->var_i16_3dc += zbasic_maybe() ? 0x4 : 0x5;
+ }
+ if (this->var_i16_18e > 0x41) {
+ // 131:0770
+ this->var_i16_18e += 1;
+ this->arr_i16_1e8[this->var_i16_18e] = zbasic_rnd_int(32);
+ this->arr_i16_1e8[this->var_i16_18e+0xfb] = zbasic_rnd_int(this->var_i16_3dc);
+ this->arr_i16_1e8[this->var_i16_18e+0x1f6] = zbasic_rnd_int(0xa) + 0xa;
+ this->sub_131_4f96();
+ }
+ // 131:07ea
+ for (int i = 1; i < this->var_i16_18e; i++) {
+ this->sub_131_4f96();
+ this->arr_i16_1e8[i] = ((this->arr_i16_1e8[i] + this->arr_i16_1e8[0x1f6+i]) + this->arr_i16_1e8[0x1f6+i]);
+
+ // 131:0870
+ if (this->arr_i16_1e8[i] < 0x200) {
+ this->arr_i16_1e8[i] = 1;
+ this->arr_i16_1e8[0xfb+i] = zbasic_rnd_int(this->var_i16_3dc);
+ this->arr_i16_1e8[0x1f6+i] = zbasic_rnd_int(0xa) + 0xa;
+
+ }
+
+ // 131:0902
+ this->sub_131_4f96();
+ }
+ }
+
+
+ // 131:0926
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->PenPat(this->arr_i32_1ac);
+ zbasic_picture(0x6d, 0x49, -1, 0, this->arr_i32_70);
+ zbasic_picture(0x65, 0x48, -1, 0, this->arr_i32_74);
+ zbasic_picture(0x64, 0x54, -1, 0, this->arr_i32_78);
+ // 131:099c
+/*
+
+
+
+
+0x0282: PEA - VAR(0x32)
+0x0286: TRAP - _SetPortBits
+0x0288: CMPI.W - 0x200,var_i16_10
+0x028e: SEQ - D0
+0x0290: EXT.W - D0
+0x0292: EXT.L - D0
+0x0294: PUSH.L - D0
+0x0296: CMPI.W - 0x156,var_i16_12
+0x029c: SEQ - D0
+0x029e: EXT.W - D0
+0x02a0: EXT.L - D0
+0x02a2: POPAND.L - D0
+0x02a4: TST.L - D0
+0x02a6: BNE - [0x02ac]
+
+0x02a8: JMP - [0x2c8]
+--------
+0x02ac: PEA - [0x02c4]
+0x02b0: PUSH.L - 0
+0x02b2: PUSH.L - 0
+0x02b4: MOVEQ - 0x14,D0
+0x02b6: PUSH.L - D0
+0x02b8: PUSH.L - 0x000001fc
+0x02be: MOVEQ - 0x1,D0
+0x02c0: JMP - 128,0x2f0
+
+0x02c4: JMP - [0x2ec]
+--------
+
+
+0x02c8: PUSH.L - var_i32_c
+0x02cc: TRAP - _SetPort
+0x02ce: PEA - [0x02e6]
+0x02d2: PUSH.L - 0
+0x02d4: PUSH.L - 0
+0x02d6: MOVEQ - 0x14,D0
+0x02d8: PUSH.L - D0
+0x02da: MOVEA.W - var_i16_10,A0
+0x02de: PUSH.L - A0
+0x02e0: MOVEQ - 0x2,D0
+0x02e2: JMP - 128,0x2f0
+
+0x02e6: PUSH.L - var_i32_8
+0x02ea: TRAP - _SetPort
+
+
+0x02ec: MOVEQ - 0x3c,D0
+0x02ee: JSR - 128,0x21e
+
+0x02f2: MOVEQ - 0x5,D0
+0x02f4: JSR - 128,0x6e4
+
+0x02f8: JSR - 128,0xe58
+
+0x02fc: JSR - [0x4e98]
+
+0x0300: MOVEQ - 0x4c,D0
+0x0302: JSR - "ZBASIC_52"
+
+0x0306: MOVEQ - 0x1,D0
+0x0308: MOVE.W - D0,var_i16_3da
+
+0x030c: LEA - VAR(0x18e),A0
+0x0310: JSR - "READ_AS_INT"
+
+0x0314: MOVEQ - 0x1,D0
+0x0316: MOVE.W - D0,var_i16_74
+
+0x031a: MOVEQ - 0x0,D0
+0x031c: MOVEA.W - var_i16_74,A0
+0x0320: ADD.L - A0,D0
+0x0322: LSL.L - 0x1,D0
+0x0324: ADDI.L - HEAP(0x1e8),D0
+0x032e: MOVEA.L - D0,A0
+0x0330: JSR - "READ_AS_INT"
+
+0x0334: MOVE.L - 0xfb,D0
+0x033a: MOVEA.W - var_i16_74,A0
+0x033e: ADD.L - A0,D0
+0x0340: LSL.L - 0x1,D0
+0x0342: ADDI.L - HEAP(0x1e8),D0
+0x034c: MOVEA.L - D0,A0
+0x034e: JSR - "READ_AS_INT"
+
+0x0352: MOVE.L - 0x1f6,D0
+0x0358: MOVEA.W - var_i16_74,A0
+0x035c: ADD.L - A0,D0
+0x035e: LSL.L - 0x1,D0
+0x0360: ADDI.L - HEAP(0x1e8),D0
+0x036a: MOVEA.L - D0,A0
+0x036c: JSR - "READ_AS_INT"
+
+0x0370: MOVE.W - var_i16_18e,D0
+0x0374: EXT.L - D0
+0x0376: ADDQ.W - 0x1,var_i16_74
+0x037a: CMP.W - var_i16_74,D0
+0x037e: BGE - [0x031a]
+
+0x0380: MOVEQ - 0xa,D0
+0x0382: PUSH.W - D0
+0x0384: TRAP - _PenMode
+0x0386: MOVEQ - 0x14,D0
+0x0388: JSR - 128,0x3ee
+
+0x038c: MOVEQ - 0xa,D0
+0x038e: JSR - 128,0x3ee
+
+0x0392: MOVEQ - 0x14,D0
+0x0394: JSR - 128,0x3ee
+
+0x0398: MOVEQ - 0x5,D0
+0x039a: JSR - 128,0x3ee
+
+0x039e: MOVEQ - 0xa,D0
+0x03a0: JSR - 128,0x3ee
+
+0x03a4: MOVEQ - 0x5,D0
+0x03a6: JSR - 128,0x3ee
+
+0x03aa: TRAP - _PenNormal
+0x03ac: MOVEQ - 0x0,D0
+0x03ae: JSR - 128,0x3ee
+
+0x03b2: MOVEQ - 0xe,D0
+0x03b4: ADDQ.W - 0x1,var_i16_3da
+0x03b8: CMP.W - var_i16_3da,D0
+0x03bc: BGE - [0x030c]
+
+0x03c0: MOVEQ - 0x1e,D0
+0x03c2: JSR - 128,0x21e
+
+0x03c6: PUSH.W - 0xfa
+0x03ca: MOVEQ - 0xc,D0
+0x03cc: PUSH.W - D0
+0x03ce: PUSH.W - 0
+0x03d0: MOVEQ - 0x1,D0
+0x03d2: PUSH.W - D0
+0x03d4: JSR - "TEXT"
+
+0x03d8: MOVEQ - 0x22,D0
+0x03da: JSR - "CHR$"
+
+0x03de: JSR - "BUFFER_CONCAT"
+
+0x03e2: MOVEA.L - STR(0x26e),A0 # b"Well. . . that's that!"
+0x03ea: JSR - "BUFFER_CONCAT"
+
+0x03ee: MOVEQ - 0x22,D0
+0x03f0: JSR - "CHR$"
+
+0x03f4: JSR - "BUFFER_CONCAT"
+
+0x03f8: LEA - VAR(0x76),A0
+0x03fc: JSR - "BUFFER_FLUSH"
+
+0x0400: PEA - [0x0414]
+0x0404: PUSH.L - 0x00000178
+0x040a: MOVE.L - 0xb4,D0
+0x0410: JMP - 128,0xa6c
+
+0x0414: MOVEQ - 0x1e,D0
+0x0416: JSR - 128,0x21e
+
+0x041a: PUSH.W - 0x1cd
+0x041e: PUSH.W - 0xbd
+0x0422: MOVEQ - -0x1,D0
+0x0424: PUSH.W - D0
+0x0426: PUSH.W - 0
+0x0428: MOVEQ - 0x50,D0
+0x042a: ADD.L - HEAP,D0
+0x042e: MOVEA.L - D0,A0
+0x0430: JSR - "PICTURE"
+
+0x0434: MOVEQ - 0x2,D0
+0x0436: JSR - 128,0x21e
+
+0x043a: PUSH.W - 0x1cd
+0x043e: PUSH.W - 0xbf
+0x0442: MOVEQ - -0x1,D0
+0x0444: PUSH.W - D0
+0x0446: PUSH.W - 0
+0x0448: MOVEQ - 0x54,D0
+0x044a: ADD.L - HEAP,D0
+0x044e: MOVEA.L - D0,A0
+0x0450: JSR - "PICTURE"
+
+0x0454: MOVEQ - 0x3c,D0
+0x0456: JSR - 128,0x21e
+
+0x045a: PUSH.W - 0x1cd
+0x045e: PUSH.W - 0xbd
+0x0462: MOVEQ - -0x1,D0
+0x0464: PUSH.W - D0
+0x0466: PUSH.W - 0
+0x0468: MOVEQ - 0x50,D0
+0x046a: ADD.L - HEAP,D0
+0x046e: MOVEA.L - D0,A0
+0x0470: JSR - "PICTURE"
+
+0x0474: MOVEQ - 0x6,D0
+0x0476: JSR - 128,0x21e
+
+0x047a: PUSH.W - 0x1a6
+0x047e: PUSH.W - 0xbf
+0x0482: MOVEQ - -0x1,D0
+0x0484: PUSH.W - D0
+0x0486: PUSH.W - 0
+0x0488: MOVEQ - 0x58,D0
+0x048a: ADD.L - HEAP,D0
+0x048e: MOVEA.L - D0,A0
+0x0490: JSR - "PICTURE"
+
+0x0494: MOVEQ - 0x6,D0
+0x0496: JSR - 128,0x21e
+
+0x049a: PUSH.W - 0x1b3
+0x049e: PUSH.W - 0xc5
+0x04a2: MOVEQ - -0x1,D0
+0x04a4: PUSH.W - D0
+0x04a6: PUSH.W - 0
+0x04a8: MOVEQ - 0x5c,D0
+0x04aa: ADD.L - HEAP,D0
+0x04ae: MOVEA.L - D0,A0
+0x04b0: JSR - "PICTURE"
+
+0x04b4: MOVEQ - 0x14,D0
+0x04b6: MOVE.W - D0,var_i16_74
+
+0x04ba: MOVE.W - var_i16_74,D0
+0x04be: EXT.L - D0
+0x04c0: LSL.L - 0x2,D0
+0x04c2: ADD.L - HEAP,D0
+0x04c6: MOVEA.L - D0,A0
+0x04c8: MOVE.L - (A0),D0
+0x04ca: PUSH.L - D0
+0x04cc: TRAP - _ReleaseResource
+0x04ce: MOVEQ - 0x17,D0
+0x04d0: ADDQ.W - 0x1,var_i16_74
+0x04d4: CMP.W - var_i16_74,D0
+0x04d8: BGE - [0x04ba]
+
+0x04da: PUSH.L - 0 (unsafe)
+0x04dc: TRAP - _TickCount
+0x04de: POP.L - D0
+0x04e0: MOVE.L - D0,var_i32_2
+
+0x04e4: MOVE.L - HEAP(0x412aa),D0
+0x04ee: MOVEA.L - D0,A0
+0x04f0: MOVE.L - (A0),D0
+0x04f2: MOVE.L - D0,var_i32_40
+
+0x04f6: PEA - VAR(0x32)
+0x04fa: PEA - VAR(0x40)
+0x04fe: PEA - VAR(0x38)
+0x0502: PEA - VAR(0x38)
+0x0506: PUSH.W - 0
+0x0508: PUSH.L - 0
+0x050a: TRAP - _CopyBits
+0x050c: MOVEQ - 0x5,D0
+0x050e: JSR - 128,0x1f4
+
+0x0512: PEA - [0x0534]
+0x0516: PUSH.L - 0x000000a6
+0x051c: PUSH.L - 0x00000173
+0x0522: PUSH.L - 0x000000b5
+0x0528: PUSH.L - 0x000001fc
+0x052e: MOVEQ - 0x0,D0
+0x0530: JMP - 128,0x2f0
+
+0x0534: JSR - [0x4e48]
+
+0x0538: PEA - VAR(0x32)
+0x053c: PEA - VAR(0x4e)
+0x0540: PEA - VAR(0x38)
+0x0544: PEA - VAR(0x38)
+0x0548: PUSH.W - 0
+0x054a: PUSH.L - 0
+0x054c: TRAP - _CopyBits
+0x054e: PEA - VAR(0x4e)
+0x0552: TRAP - _SetPortBits
+0x0554: PEA - [0x056e]
+0x0558: PUSH.L - 0
+0x055a: PUSH.L - 0
+0x055c: PUSH.L - 0x0000009c
+0x0562: PUSH.L - 0x0000015a
+0x0568: MOVEQ - 0x0,D0
+0x056a: JMP - 128,0x2f0
+
+0x056e: PEA - [0x058e]
+0x0572: PUSH.L - 0x0000009c
+0x0578: MOVEQ - 0x5a,D0
+0x057a: PUSH.L - D0
+0x057c: PUSH.L - 0x000000ce
+0x0582: PUSH.L - 0x000000a6
+0x0588: MOVEQ - 0x0,D0
+0x058a: JMP - 128,0x2f0
+
+0x058e: PEA - [0x05b0]
+0x0592: PUSH.L - 0x000000a6
+0x0598: PUSH.L - 0x00000173
+0x059e: PUSH.L - 0x000000b5
+0x05a4: PUSH.L - 0x000001fc
+0x05aa: MOVEQ - 0x0,D0
+0x05ac: JMP - 128,0x2f0
+
+0x05b0: MOVEQ - 0x6,D0
+0x05b2: JSR - 128,0x1f4
+
+0x05b6: PEA - VAR(0x4e)
+0x05ba: PEA - VAR(0x40)
+0x05be: PEA - VAR(0x38)
+0x05c2: PEA - VAR(0x38)
+0x05c6: MOVEQ - 0x1,D0
+0x05c8: PUSH.W - D0
+0x05ca: PUSH.L - 0
+0x05cc: TRAP - _CopyBits
+0x05ce: MOVEQ - 0x7,D0
+0x05d0: JSR - 128,0x1f4
+
+0x05d4: PEA - VAR(0x4e)
+0x05d8: PEA - VAR(0x40)
+0x05dc: PEA - VAR(0x38)
+0x05e0: PEA - VAR(0x38)
+0x05e4: MOVEQ - 0x1,D0
+0x05e6: PUSH.W - D0
+0x05e8: PUSH.L - 0
+0x05ea: TRAP - _CopyBits
+0x05ec: JSR - [0x4e48]
+
+0x05f0: MOVEQ - 0x8,D0
+0x05f2: JSR - 128,0x1f4
+
+0x05f6: PEA - VAR(0x4e)
+0x05fa: PEA - VAR(0x40)
+0x05fe: PEA - VAR(0x38)
+0x0602: PEA - VAR(0x38)
+0x0606: MOVEQ - 0x1,D0
+0x0608: PUSH.W - D0
+0x060a: PUSH.L - 0
+0x060c: TRAP - _CopyBits
+0x060e: JSR - [0x4e48]
+
+0x0612: MOVEQ - 0x9,D0
+0x0614: JSR - 128,0x1f4
+
+0x0618: PEA - VAR(0x4e)
+0x061c: PEA - VAR(0x40)
+0x0620: PEA - VAR(0x38)
+0x0624: PEA - VAR(0x38)
+0x0628: MOVEQ - 0x1,D0
+0x062a: PUSH.W - D0
+0x062c: PUSH.L - 0
+0x062e: TRAP - _CopyBits
+0x0630: PEA - VAR(0x32)
+0x0634: TRAP - _SetPortBits
+0x0636: MOVE.L - 0x1bc,D0
+0x063c: MOVE.L - D0,D1
+0x063e: MOVE.L - 0xc1,D0
+0x0644: JSR - "GET_FROM"
+
+0x0648: PUSH.L - 0x000001ee
+0x064e: PUSH.L - 0x00000117
+0x0654: MOVE.L - HEAP(0x3bca4),D0
+0x065e: MOVEA.L - D0,A0
+0x0660: POP.L - D0
+0x0662: POP.L - D1
+0x0664: JSR - "GET_TO"
+
+0x0668: MOVEQ - 0x3c,D0
+0x066a: JSR - 128,0x24a
+
+0x066e: PEA - [0x0690]
+0x0672: PUSH.L - 0x000000a6
+0x0678: PUSH.L - 0x00000173
+0x067e: PUSH.L - 0x000000b5
+0x0684: PUSH.L - 0x000001fc
+0x068a: MOVEQ - 0x0,D0
+0x068c: JMP - 128,0x2f0
+
+0x0690: PEA - [0x06a6]
+0x0694: MOVEQ - 0x6,D0
+0x0696: PUSH.L - D0
+0x0698: PUSH.L - 0
+0x069a: PUSH.L - 0x000001fc
+0x06a0: MOVEQ - 0x3,D0
+0x06a2: JMP - 128,0x50a
+
+0x06a6: JSR - [0x4e48]
+
+0x06aa: PEA - [0x06c0]
+0x06ae: MOVEQ - 0x5,D0
+0x06b0: PUSH.L - D0
+0x06b2: PUSH.L - 0
+0x06b4: PUSH.L - 0x000001fc
+0x06ba: MOVEQ - 0x2,D0
+0x06bc: JMP - 128,0x50a
+
+0x06c0: PEA - [0x06d6]
+0x06c4: MOVEQ - 0x7,D0
+0x06c6: PUSH.L - D0
+0x06c8: PUSH.L - 0
+0x06ca: PUSH.L - 0x000001fc
+0x06d0: MOVEQ - 0x2,D0
+0x06d2: JMP - 128,0x50a
+
+0x06d6: PEA - [0x06ec]
+0x06da: MOVEQ - 0x8,D0
+0x06dc: PUSH.L - D0
+0x06de: PUSH.L - 0
+0x06e0: PUSH.L - 0x000001fc
+0x06e6: MOVEQ - 0x1,D0
+0x06e8: JMP - 128,0x50a
+
+0x06ec: PEA - [0x070e]
+0x06f0: PUSH.L - 0x000000a6
+0x06f6: PUSH.L - 0x00000173
+0x06fc: PUSH.L - 0x000000b5
+0x0702: PUSH.L - 0x000001fc
+0x0708: MOVEQ - 0x0,D0
+0x070a: JMP - 128,0x2f0
+
+0x070e: PEA - [0x0724]
+0x0712: MOVEQ - 0x9,D0
+0x0714: PUSH.L - D0
+0x0716: PUSH.L - 0
+0x0718: PUSH.L - 0x000001fc
+0x071e: MOVEQ - 0x1,D0
+0x0720: JMP - 128,0x50a
+
+0x0724: TRAP - _PenNormal
+0x0726: MOVEQ - 0xa,D0
+0x0728: PUSH.W - D0
+0x072a: TRAP - _PenMode
+0x072c: JSR - "ZBASIC_20"
+
+0x0730: MOVEQ - 0x0,D0
+0x0732: MOVE.W - D0,var_i16_3dc
+
+0x0736: MOVEQ - 0x0,D0
+0x0738: MOVE.W - D0,var_i16_18e
+
+0x073c: MOVEQ - 0x1,D0
+0x073e: MOVE.W - D0,var_i16_3de
+
+0x0742: CMPI.W - 0x156,var_i16_3dc
+0x0748: BLT - [0x074e]
+
+0x074a: JMP - [0x764]
+--------
+0x074e: JSR - "MAYBE"
+
+0x0752: TST.L - D0
+0x0754: BEQ - [0x0760]
+
+0x0758: ADDQ.W - 0x4,var_i16_3dc
+0x075c: BRA - [0x0764]
+
+0x0760: ADDQ.W - 0x5,var_i16_3dc
+0x0764: CMPI.W - 0x41,var_i16_18e
+0x076a: BLT - [0x0770]
+
+0x076c: JMP - [0x7ea]
+--------
+0x0770: ADDQ.W - 0x1,var_i16_18e
+0x0774: MOVEQ - 0x0,D0
+0x0776: MOVEA.W - var_i16_18e,A0
+0x077a: ADD.L - A0,D0
+0x077c: LSL.L - 0x1,D0
+0x077e: ADDI.L - HEAP(0x1e8),D0
+0x0788: PUSH.L - D0
+0x078a: MOVEQ - 0x32,D0
+0x078c: JSR - "RND_INT"
+
+0x0790: POP.L - A0
+0x0792: MOVE.W - D0,(A0)
+
+0x0794: MOVE.L - 0xfb,D0
+0x079a: MOVEA.W - var_i16_18e,A0
+0x079e: ADD.L - A0,D0
+0x07a0: LSL.L - 0x1,D0
+0x07a2: ADDI.L - HEAP(0x1e8),D0
+0x07ac: PUSH.L - D0
+0x07ae: MOVE.W - var_i16_3dc,D0
+0x07b2: EXT.L - D0
+0x07b4: JSR - "RND_INT"
+
+0x07b8: POP.L - A0
+0x07ba: MOVE.W - D0,(A0)
+
+0x07bc: MOVE.L - 0x1f6,D0
+0x07c2: MOVEA.W - var_i16_18e,A0
+0x07c6: ADD.L - A0,D0
+0x07c8: LSL.L - 0x1,D0
+0x07ca: ADDI.L - HEAP(0x1e8),D0
+0x07d4: PUSH.L - D0
+0x07d6: MOVEQ - 0xa,D0
+0x07d8: JSR - "RND_INT"
+
+0x07dc: ADDI.L - 0x0000000a,D0
+0x07e2: POP.L - A0
+0x07e4: MOVE.W - D0,(A0)
+
+0x07e6: JSR - [0x4f96]
+
+0x07ea: MOVEQ - 0x1,D0
+0x07ec: MOVE.W - D0,var_i16_74
+
+0x07f0: JSR - [0x4f96]
+
+0x07f4: MOVEQ - 0x0,D0
+0x07f6: MOVEA.W - var_i16_74,A0
+0x07fa: ADD.L - A0,D0
+0x07fc: LSL.L - 0x1,D0
+0x07fe: ADDI.L - HEAP(0x1e8),D0
+0x0808: PUSH.L - D0
+
+0x080a: MOVEQ - 0x0,D0
+0x080c: MOVEA.W - var_i16_74,A0
+0x0810: ADD.L - A0,D0
+0x0812: LSL.L - 0x1,D0
+0x0814: ADDI.L - HEAP(0x1e8),D0
+0x081e: MOVEA.L - D0,A0
+0x0820: MOVE.W - (A0),D0
+0x0822: EXT.L - D0
+0x0824: PUSH.L - D0
+
+0x0826: MOVE.L - 0x1f6,D0
+0x082c: MOVEA.W - var_i16_74,A0
+0x0830: ADD.L - A0,D0
+0x0832: LSL.L - 0x1,D0
+0x0834: ADDI.L - HEAP(0x1e8),D0
+0x083e: MOVEA.L - D0,A0
+0x0840: MOVE.W - (A0),D0
+0x0842: EXT.L - D0
+0x0844: POP.L - D1
+0x0846: ADD.L - D1,D0
+0x0848: PUSH.L - D0
+
+0x084a: MOVE.L - 0x1f6,D0
+0x0850: MOVEA.W - var_i16_74,A0
+0x0854: ADD.L - A0,D0
+0x0856: LSL.L - 0x1,D0
+0x0858: ADDI.L - HEAP(0x1e8),D0
+0x0862: MOVEA.L - D0,A0
+0x0864: MOVE.W - (A0),D0
+0x0866: EXT.L - D0
+0x0868: POP.L - D1
+0x086a: ADD.L - D1,D0
+0x086c: POP.L - A0
+0x086e: MOVE.W - D0,(A0)
+
+0x0870: MOVEQ - 0x0,D0
+0x0872: MOVEA.W - var_i16_74,A0
+0x0876: ADD.L - A0,D0
+0x0878: LSL.L - 0x1,D0
+0x087a: ADDI.L - HEAP(0x1e8),D0
+0x0884: MOVEA.L - D0,A0
+0x0886: MOVE.W - (A0),D0
+0x0888: EXT.L - D0
+0x088a: CMPI.L - 0x200,D0
+0x0890: BGT - [0x0896]
+
+0x0892: JMP - [0x902]
+--------
+0x0896: MOVEQ - 0x0,D0
+0x0898: MOVEA.W - var_i16_74,A0
+0x089c: ADD.L - A0,D0
+0x089e: LSL.L - 0x1,D0
+0x08a0: ADDI.L - HEAP(0x1e8),D0
+0x08aa: MOVEA.L - D0,A0
+0x08ac: MOVEQ - 0x1,D0
+0x08ae: MOVE.W - D0,(A0)
+
+0x08b0: MOVE.L - 0xfb,D0
+0x08b6: MOVEA.W - var_i16_74,A0
+0x08ba: ADD.L - A0,D0
+0x08bc: LSL.L - 0x1,D0
+0x08be: ADDI.L - HEAP(0x1e8),D0
+0x08c8: PUSH.L - D0
+0x08ca: MOVE.W - var_i16_3dc,D0
+0x08ce: EXT.L - D0
+0x08d0: JSR - "RND_INT"
+
+0x08d4: POP.L - A0
+0x08d6: MOVE.W - D0,(A0)
+
+0x08d8: MOVE.L - 0x1f6,D0
+0x08de: MOVEA.W - var_i16_74,A0
+0x08e2: ADD.L - A0,D0
+0x08e4: LSL.L - 0x1,D0
+0x08e6: ADDI.L - HEAP(0x1e8),D0
+0x08f0: PUSH.L - D0
+0x08f2: MOVEQ - 0xa,D0
+0x08f4: JSR - "RND_INT"
+
+0x08f8: ADDI.L - 0x0000000a,D0
+0x08fe: POP.L - A0
+0x0900: MOVE.W - D0,(A0)
+
+0x0902: JSR - [0x4f96]
+
+0x0906: MOVE.W - var_i16_18e,D0
+0x090a: EXT.L - D0
+0x090c: ADDQ.W - 0x1,var_i16_74
+0x0910: CMP.W - var_i16_74,D0
+0x0914: BGE - [0x07f0]
+
+0x0918: MOVEQ - 0x63,D0
+0x091a: ADDQ.W - 0x1,var_i16_3de
+0x091e: CMP.W - var_i16_3de,D0
+0x0922: BGE - [0x0742]
+
+0x0926: MOVE.L - HEAP(0x1bc),D0
+0x0930: PUSH.L - D0
+0x0932: PUSH.W - 0
+0x0934: PUSH.W - 0
+0x0936: PUSH.W - 0x200
+0x093a: PUSH.W - 0x156
+0x093e: TRAP - _SetRect
+0x0940: MOVE.L - HEAP(0x1ac),D0
+0x094a: PUSH.L - D0
+0x094c: TRAP - _PenPat
+0x094e: MOVEQ - 0x6d,D0
+0x0950: PUSH.W - D0
+0x0952: MOVEQ - 0x49,D0
+0x0954: PUSH.W - D0
+0x0956: MOVEQ - -0x1,D0
+0x0958: PUSH.W - D0
+0x095a: PUSH.W - 0
+0x095c: MOVEQ - 0x70,D0
+0x095e: ADD.L - HEAP,D0
+0x0962: MOVEA.L - D0,A0
+0x0964: JSR - "PICTURE"
+
+0x0968: MOVEQ - 0x65,D0
+0x096a: PUSH.W - D0
+0x096c: MOVEQ - 0x48,D0
+0x096e: PUSH.W - D0
+0x0970: MOVEQ - -0x1,D0
+0x0972: PUSH.W - D0
+0x0974: PUSH.W - 0
+0x0976: MOVEQ - 0x74,D0
+0x0978: ADD.L - HEAP,D0
+0x097c: MOVEA.L - D0,A0
+0x097e: JSR - "PICTURE"
+
+0x0982: MOVEQ - 0x64,D0
+0x0984: PUSH.W - D0
+0x0986: MOVEQ - 0x54,D0
+0x0988: PUSH.W - D0
+0x098a: MOVEQ - -0x1,D0
+0x098c: PUSH.W - D0
+0x098e: PUSH.W - 0
+0x0990: MOVEQ - 0x78,D0
+0x0992: ADD.L - HEAP,D0
+0x0996: MOVEA.L - D0,A0
+0x0998: JSR - "PICTURE"
+
+0x099c: PUSH.L - var_i32_3d6
+0x09a0: TRAP - _PaintPoly
+0x09a2: MOVEQ - 0x0,D0
+0x09a4: MOVE.W - D0,var_i16_74
+
+0x09a8: PUSH.L - 0 (unsafe)
+0x09aa: TRAP - _TickCount
+0x09ac: POP.L - D0
+0x09ae: MOVE.L - D0,var_i32_2
+
+0x09b2: MOVE.L - HEAP(0x1bc),D0
+0x09bc: PUSH.L - D0
+0x09be: TRAP - _InverRect
+0x09c0: MOVEQ - 0x1,D0
+0x09c2: JSR - 128,0x24a
+
+0x09c6: MOVEQ - 0x21,D0
+0x09c8: ADDQ.W - 0x1,var_i16_74
+0x09cc: CMP.W - var_i16_74,D0
+0x09d0: BGE - [0x09a8]
+
+0x09d2: PEA - [0x0a04]
+0x09d6: PUSH.L - 0x000000bd
+0x09dc: PUSH.L - 0x000001b8
+0x09e2: PUSH.L - 0x00000117
+0x09e8: PUSH.L - 0x000001ee
+0x09ee: PUSH.L - 0
+0x09f0: PUSH.L - 0
+0x09f2: PUSH.L - 0x00000152
+0x09f8: PUSH.L - 0x000001fc
+0x09fe: MOVEQ - 0x21,D0
+0x0a00: JMP - 128,0x800
+
+0x0a04: PEA - [0x0a2e]
+0x0a08: PUSH.L - 0x00000152
+0x0a0e: PUSH.L - 0
+0x0a10: PUSH.L - 0x00000152
+0x0a16: PUSH.L - 0
+0x0a18: PUSH.L - 0
+0x0a1a: PUSH.L - 0
+0x0a1c: PUSH.L - 0x00000152
+0x0a22: PUSH.L - 0x000001fc
+0x0a28: MOVEQ - 0x21,D0
+0x0a2a: JMP - 128,0x800
+
+0x0a2e: PEA - [0x0a50]
+0x0a32: PUSH.L - 0
+0x0a34: PUSH.L - 0
+0x0a36: PUSH.L - 0
+0x0a38: PUSH.L - 0
+0x0a3a: PUSH.L - 0
+0x0a3c: PUSH.L - 0
+0x0a3e: PUSH.L - 0x00000152
+0x0a44: PUSH.L - 0x000001fc
+0x0a4a: MOVEQ - 0x21,D0
+0x0a4c: JMP - 128,0x800
+
+0x0a50: PEA - [0x0a7a]
+0x0a54: PUSH.L - 0
+0x0a56: PUSH.L - 0x000001fc
+0x0a5c: PUSH.L - 0
+0x0a5e: PUSH.L - 0x000001fc
+0x0a64: PUSH.L - 0
+0x0a66: PUSH.L - 0
+0x0a68: PUSH.L - 0x00000152
+0x0a6e: PUSH.L - 0x000001fc
+0x0a74: MOVEQ - 0x21,D0
+0x0a76: JMP - 128,0x800
+
+0x0a7a: MOVEQ - 0x1,D0
+0x0a7c: MOVE.W - D0,var_i16_1ba
+
+0x0a80: PUSH.L - 0 (unsafe)
+0x0a82: TRAP - _TickCount
+0x0a84: POP.L - D0
+0x0a86: MOVE.L - D0,var_i32_2
+
+0x0a8a: MOVE.L - 0x1ca,D0
+0x0a90: JSR - "RND_INT"
+
+0x0a94: MOVE.W - D0,var_i16_74
+
+0x0a98: MOVE.L - 0xfc,D0
+0x0a9e: JSR - "RND_INT"
+
+0x0aa2: MOVE.W - D0,var_i16_192
+
+0x0aa6: MOVE.W - var_i16_74,D0
+0x0aaa: EXT.L - D0
+0x0aac: MOVE.L - D0,D1
+0x0aae: MOVE.W - var_i16_192,D0
+0x0ab2: EXT.L - D0
+0x0ab4: JSR - "GET_FROM"
+
+0x0ab8: PUSH.W - 0
+0x0aba: MOVE.L - HEAP(0x3bca4),D0
+0x0ac4: PUSH.L - D0
+0x0ac6: MOVEQ - 0x0,D0
+0x0ac8: JSR - "ZBASIC_194"
+
+0x0acc: MOVE.L - HEAP(0x1bc),D0
+0x0ad6: PUSH.L - D0
+0x0ad8: TRAP - _InverRect
+0x0ada: MOVEQ - 0x1,D0
+0x0adc: JSR - 128,0x24a
+
+0x0ae0: MOVEQ - 0x63,D0
+0x0ae2: ADDQ.W - 0x1,var_i16_1ba
+0x0ae6: CMP.W - var_i16_1ba,D0
+0x0aea: BGE - [0x0a80]
+
+0x0aec: PUSH.L - 0 (unsafe)
+0x0aee: TRAP - _TickCount
+0x0af0: POP.L - D0
+0x0af2: MOVE.L - D0,var_i32_2
+
+0x0af6: MOVE.L - 0x1ca,D0
+0x0afc: JSR - "RND_INT"
+
+0x0b00: MOVE.W - D0,var_i16_74
+
+0x0b04: MOVE.L - 0xfc,D0
+0x0b0a: JSR - "RND_INT"
+
+0x0b0e: MOVE.W - D0,var_i16_192
+
+0x0b12: MOVE.W - var_i16_74,D0
+0x0b16: EXT.L - D0
+0x0b18: MOVE.L - D0,D1
+0x0b1a: MOVE.W - var_i16_192,D0
+0x0b1e: EXT.L - D0
+0x0b20: JSR - "GET_FROM"
+
+0x0b24: MOVE.W - var_i16_74,D0
+0x0b28: EXT.L - D0
+0x0b2a: ADDI.L - 0x00000036,D0
+0x0b30: PUSH.L - D0
+0x0b32: MOVE.W - var_i16_192,D0
+0x0b36: EXT.L - D0
+0x0b38: ADDI.L - 0x0000005a,D0
+0x0b3e: PUSH.L - D0
+0x0b40: MOVE.L - HEAP(0x3bca4),D0
+0x0b4a: MOVEA.L - D0,A0
+0x0b4c: POP.L - D0
+0x0b4e: POP.L - D1
+0x0b50: JSR - "GET_TO"
+
+0x0b54: MOVE.L - 0x1ca,D0
+0x0b5a: JSR - "RND_INT"
+
+0x0b5e: MOVE.W - D0,var_i16_74
+
+0x0b62: MOVE.L - 0xfc,D0
+0x0b68: JSR - "RND_INT"
+
+0x0b6c: MOVE.W - D0,var_i16_192
+
+0x0b70: MOVE.W - var_i16_74,D0
+0x0b74: EXT.L - D0
+0x0b76: MOVE.L - D0,D1
+0x0b78: MOVE.W - var_i16_192,D0
+0x0b7c: EXT.L - D0
+0x0b7e: JSR - "GET_FROM"
+
+0x0b82: PUSH.W - 0
+0x0b84: MOVE.L - HEAP(0x3bca4),D0
+0x0b8e: PUSH.L - D0
+0x0b90: MOVEQ - 0x0,D0
+0x0b92: JSR - "ZBASIC_194"
+
+0x0b96: PUSH.L - 0 (unsafe)
+0x0b98: TRAP - _TickCount
+0x0b9a: POP.L - D0
+0x0b9c: PUSH.L - D0
+0x0b9e: MOVE.L - var_i32_2,D0
+0x0ba2: ADDI.L - 0x00000078,D0
+0x0ba8: POP.L - D1
+0x0baa: CMP.L - D0,D1
+0x0bac: BLE - [0x0af6]
+
+0x0bb0: PEA - [0x0bc6]
+0x0bb4: MOVEQ - 0x4,D0
+0x0bb6: PUSH.L - D0
+0x0bb8: PUSH.L - 0
+0x0bba: PUSH.L - 0x000001fc
+0x0bc0: MOVEQ - 0x3,D0
+0x0bc2: JMP - 128,0x50a
+
+0x0bc6: MOVEQ - 0x5,D0
+0x0bc8: JSR - 128,0x1f4
+
+0x0bcc: MOVEQ - 0x5,D0
+0x0bce: JSR - 128,0x1ba
+
+0x0bd2: PUSH.W - 0x198
+0x0bd6: PUSH.W - 0x102
+0x0bda: MOVEQ - -0x1,D0
+0x0bdc: PUSH.W - D0
+0x0bde: PUSH.W - 0
+0x0be0: MOVE.L - HEAP(0x94),D0
+0x0bea: MOVEA.L - D0,A0
+0x0bec: JSR - "PICTURE"
+
+0x0bf0: PEA - VAR(0x32)
+0x0bf4: TRAP - _SetPortBits
+0x0bf6: MOVEQ - 0x3c,D0
+0x0bf8: JSR - 128,0x21e
+
+0x0bfc: PEA - [0x0c12]
+0x0c00: MOVEQ - 0x5,D0
+0x0c02: PUSH.L - D0
+0x0c04: PUSH.L - 0
+0x0c06: PUSH.L - 0x000001fc
+0x0c0c: MOVEQ - 0x0,D0
+0x0c0e: JMP - 128,0x50a
+
+0x0c12: MOVEQ - 0x3c,D0
+0x0c14: JSR - 128,0x21e
+
+0x0c18: PUSH.W - 0x197
+0x0c1c: PUSH.W - 0x101
+0x0c20: MOVEQ - -0x1,D0
+0x0c22: PUSH.W - D0
+0x0c24: PUSH.W - 0
+0x0c26: MOVE.L - HEAP(0x98),D0
+0x0c30: MOVEA.L - D0,A0
+0x0c32: JSR - "PICTURE"
+
+0x0c36: PUSH.L - 0 (unsafe)
+0x0c38: TRAP - _TickCount
+0x0c3a: POP.L - D0
+0x0c3c: MOVE.L - D0,var_i32_2
+
+0x0c40: PUSH.L - var_i32_3d6
+0x0c44: TRAP - _KillPoly
+0x0c46: MOVEQ - 0x1c,D0
+0x0c48: MOVE.W - D0,var_i16_74
+
+0x0c4c: MOVE.W - var_i16_74,D0
+0x0c50: EXT.L - D0
+0x0c52: LSL.L - 0x2,D0
+0x0c54: ADD.L - HEAP,D0
+0x0c58: MOVEA.L - D0,A0
+0x0c5a: MOVE.L - (A0),D0
+0x0c5c: PUSH.L - D0
+0x0c5e: TRAP - _ReleaseResource
+0x0c60: MOVEQ - 0x1e,D0
+0x0c62: ADDQ.W - 0x1,var_i16_74
+0x0c66: CMP.W - var_i16_74,D0
+0x0c6a: BGE - [0x0c4c]
+
+0x0c6c: MOVEQ - 0x6,D0
+0x0c6e: MOVE.W - D0,var_i16_74
+
+0x0c72: MOVE.L - HEAP(0x412aa),D0
+0x0c7c: MOVEA.L - D0,A0
+0x0c7e: MOVE.L - (A0),D0
+0x0c80: PUSH.L - D0
+0x0c82: MOVE.W - var_i16_74,D0
+0x0c86: EXT.L - D0
+0x0c88: LSL.L - 0x2,D0
+0x0c8a: ADDI.L - HEAP(0x41296),D0
+0x0c94: MOVEA.L - D0,A0
+0x0c96: MOVE.L - (A0),D0
+0x0c98: PUSH.L - D0
+0x0c9a: MOVE.L - 0x5580,D0
+0x0ca0: JSR - "BLOCKMOVE"
+
+0x0ca4: MOVEQ - 0xa,D0
+0x0ca6: ADDQ.W - 0x1,var_i16_74
+0x0caa: CMP.W - var_i16_74,D0
+0x0cae: BGE - [0x0c72]
+
+0x0cb0: MOVEQ - 0x6,D0
+0x0cb2: JSR - 128,0x1f4
+
+0x0cb6: MOVEQ - 0x6,D0
+0x0cb8: PUSH.W - D0
+0x0cba: PUSH.W - 0x8f
+0x0cbe: MOVEQ - -0x1,D0
+0x0cc0: PUSH.W - D0
+0x0cc2: PUSH.W - 0
+0x0cc4: MOVE.L - HEAP(0x80),D0
+0x0cce: MOVEA.L - D0,A0
+0x0cd0: JSR - "PICTURE"
+
+0x0cd4: MOVEQ - 0x7,D0
+0x0cd6: JSR - 128,0x1f4
+
+0x0cda: MOVEQ - 0x1a,D0
+0x0cdc: PUSH.W - D0
+0x0cde: MOVEQ - 0x7e,D0
+0x0ce0: PUSH.W - D0
+0x0ce2: MOVEQ - -0x1,D0
+0x0ce4: PUSH.W - D0
+0x0ce6: PUSH.W - 0
+0x0ce8: MOVE.L - HEAP(0x84),D0
+0x0cf2: MOVEA.L - D0,A0
+0x0cf4: JSR - "PICTURE"
+
+0x0cf8: MOVEQ - 0x8,D0
+0x0cfa: JSR - 128,0x1f4
+
+0x0cfe: MOVEQ - 0x2e,D0
+0x0d00: PUSH.W - D0
+0x0d02: MOVEQ - 0x6a,D0
+0x0d04: PUSH.W - D0
+0x0d06: MOVEQ - -0x1,D0
+0x0d08: PUSH.W - D0
+0x0d0a: PUSH.W - 0
+0x0d0c: MOVE.L - HEAP(0x88),D0
+0x0d16: MOVEA.L - D0,A0
+0x0d18: JSR - "PICTURE"
+
+0x0d1c: MOVEQ - 0x9,D0
+0x0d1e: JSR - 128,0x1f4
+
+0x0d22: MOVEQ - 0x45,D0
+0x0d24: PUSH.W - D0
+0x0d26: MOVEQ - 0x4e,D0
+0x0d28: PUSH.W - D0
+0x0d2a: MOVEQ - -0x1,D0
+0x0d2c: PUSH.W - D0
+0x0d2e: PUSH.W - 0
+0x0d30: MOVE.L - HEAP(0x8c),D0
+0x0d3a: MOVEA.L - D0,A0
+0x0d3c: JSR - "PICTURE"
+
+0x0d40: MOVEQ - 0xa,D0
+0x0d42: JSR - 128,0x1f4
+
+0x0d46: MOVEQ - 0x73,D0
+0x0d48: PUSH.W - D0
+0x0d4a: MOVEQ - 0x28,D0
+0x0d4c: PUSH.W - D0
+0x0d4e: MOVEQ - -0x1,D0
+0x0d50: PUSH.W - D0
+0x0d52: PUSH.W - 0
+0x0d54: MOVE.L - HEAP(0x90),D0
+0x0d5e: MOVEA.L - D0,A0
+0x0d60: JSR - "PICTURE"
+
+0x0d64: MOVEQ - 0x20,D0
+0x0d66: MOVE.W - D0,var_i16_74
+
+0x0d6a: MOVE.W - var_i16_74,D0
+0x0d6e: EXT.L - D0
+0x0d70: LSL.L - 0x2,D0
+0x0d72: ADD.L - HEAP,D0
+0x0d76: MOVEA.L - D0,A0
+0x0d78: MOVE.L - (A0),D0
+0x0d7a: PUSH.L - D0
+0x0d7c: TRAP - _ReleaseResource
+0x0d7e: MOVEQ - 0x23,D0
+0x0d80: ADDQ.W - 0x1,var_i16_74
+0x0d84: CMP.W - var_i16_74,D0
+0x0d88: BGE - [0x0d6a]
+
+0x0d8a: PEA - VAR(0x32)
+0x0d8e: TRAP - _SetPortBits
+0x0d90: MOVEQ - 0x64,D0
+0x0d92: JSR - 128,0x24a
+
+0x0d96: PUSH.W - 0x198
+0x0d9a: PUSH.W - 0x102
+0x0d9e: MOVEQ - -0x1,D0
+0x0da0: PUSH.W - D0
+0x0da2: PUSH.W - 0
+0x0da4: MOVE.L - HEAP(0x94),D0
+0x0dae: MOVEA.L - D0,A0
+0x0db0: JSR - "PICTURE"
+
+0x0db4: MOVEQ - 0x6,D0
+0x0db6: MOVE.W - D0,var_i16_74
+
+0x0dba: MOVEQ - 0xf,D0
+0x0dbc: JSR - 128,0x21e
+
+0x0dc0: PEA - [0x0dd8]
+0x0dc4: MOVEA.W - var_i16_74,A0
+0x0dc8: PUSH.L - A0
+0x0dca: PUSH.L - 0
+0x0dcc: PUSH.L - 0x000001fc
+0x0dd2: MOVEQ - 0x1,D0
+0x0dd4: JMP - 128,0x50a
+
+0x0dd8: MOVEQ - 0xa,D0
+0x0dda: ADDQ.W - 0x1,var_i16_74
+0x0dde: CMP.W - var_i16_74,D0
+0x0de2: BGE - [0x0dba]
+
+0x0de4: PUSH.W - 0x191
+0x0de8: PUSH.W - 0x102
+0x0dec: MOVEQ - -0x1,D0
+0x0dee: PUSH.W - D0
+0x0df0: PUSH.W - 0
+0x0df2: MOVE.L - HEAP(0x9c),D0
+0x0dfc: MOVEA.L - D0,A0
+0x0dfe: JSR - "PICTURE"
+
+0x0e02: MOVEQ - 0x3c,D0
+0x0e04: JSR - 128,0x21e
+
+0x0e08: PUSH.W - 0xfa
+0x0e0c: MOVEQ - 0xc,D0
+0x0e0e: PUSH.W - D0
+0x0e10: PUSH.W - 0
+0x0e12: MOVEQ - 0x3,D0
+0x0e14: PUSH.W - D0
+0x0e16: JSR - "TEXT"
+
+0x0e1a: MOVEQ - 0x22,D0
+0x0e1c: JSR - "CHR$"
+
+0x0e20: JSR - "BUFFER_CONCAT"
+
+0x0e24: MOVEA.L - STR(0x286),A0 # b'Are you still angry with me?'
+0x0e2c: JSR - "BUFFER_CONCAT"
+
+0x0e30: MOVEQ - 0x22,D0
+0x0e32: JSR - "CHR$"
+
+0x0e36: JSR - "BUFFER_CONCAT"
+
+0x0e3a: LEA - VAR(0x76),A0
+0x0e3e: JSR - "BUFFER_FLUSH"
+
+0x0e42: PEA - [0x0e6c]
+0x0e46: MOVE.L - 0x1f4,D0
+0x0e4c: PUSH.L - D0
+0x0e4e: PUSH.W - 0 (unsafe)
+0x0e50: PEA - VAR(0x76)
+0x0e54: TRAP - _StringWidth
+0x0e56: POP.W - D0
+0x0e58: EXT.L - D0
+0x0e5a: POP.L - D1
+0x0e5c: EXG - D0,D1
+0x0e5e: SUB.L - D1,D0
+0x0e60: PUSH.L - D0
+0x0e62: MOVE.L - 0xd2,D0
+0x0e68: JMP - 128,0xa6c
+
+0x0e6c: PUSH.L - 0 (unsafe)
+0x0e6e: TRAP - _TickCount
+0x0e70: POP.L - D0
+0x0e72: MOVE.L - D0,var_i32_2
+
+0x0e76: MOVE.L - HEAP(0x412a6),D0
+0x0e80: MOVEA.L - D0,A0
+0x0e82: MOVE.L - (A0),D0
+0x0e84: PUSH.L - D0
+0x0e86: MOVE.L - HEAP(0x412aa),D0
+0x0e90: MOVEA.L - D0,A0
+0x0e92: MOVE.L - (A0),D0
+0x0e94: PUSH.L - D0
+0x0e96: MOVE.L - 0x5580,D0
+0x0e9c: JSR - "BLOCKMOVE"
+
+0x0ea0: MOVEQ - 0x5,D0
+0x0ea2: JSR - 128,0x1f4
+
+0x0ea6: MOVEQ - 0x73,D0
+0x0ea8: PUSH.W - D0
+0x0eaa: MOVEQ - 0x28,D0
+0x0eac: PUSH.W - D0
+0x0eae: MOVEQ - -0x1,D0
+0x0eb0: PUSH.W - D0
+0x0eb2: PUSH.W - 0
+0x0eb4: MOVE.L - HEAP(0x90),D0
+0x0ebe: MOVEA.L - D0,A0
+0x0ec0: JSR - "PICTURE"
+
+0x0ec4: PUSH.W - 0x191
+0x0ec8: PUSH.W - 0x102
+0x0ecc: MOVEQ - -0x1,D0
+0x0ece: PUSH.W - D0
+0x0ed0: PUSH.W - 0
+0x0ed2: MOVE.L - HEAP(0x9c),D0
+0x0edc: MOVEA.L - D0,A0
+0x0ede: JSR - "PICTURE"
+
+0x0ee2: PUSH.W - 0x8a
+0x0ee6: MOVEQ - 0x24,D0
+0x0ee8: PUSH.W - D0
+0x0eea: MOVEQ - -0x1,D0
+0x0eec: PUSH.W - D0
+0x0eee: PUSH.W - 0
+0x0ef0: MOVE.L - HEAP(0xa0),D0
+0x0efa: MOVEA.L - D0,A0
+0x0efc: JSR - "PICTURE"
+
+0x0f00: MOVEQ - 0x6,D0
+0x0f02: JSR - 128,0x1f4
+
+0x0f06: PEA - [0x0f20]
+0x0f0a: PUSH.L - 0
+0x0f0c: PUSH.L - 0
+0x0f0e: PUSH.L - 0x00000152
+0x0f14: PUSH.L - 0x000001fc
+0x0f1a: MOVEQ - 0x0,D0
+0x0f1c: JMP - 128,0x2f0
+
+0x0f20: PUSH.W - 0x118
+0x0f24: MOVEQ - 0x19,D0
+0x0f26: PUSH.W - D0
+0x0f28: MOVEQ - -0x1,D0
+0x0f2a: PUSH.W - D0
+0x0f2c: PUSH.W - 0
+0x0f2e: MOVE.L - HEAP(0xa4),D0
+0x0f38: MOVEA.L - D0,A0
+0x0f3a: JSR - "PICTURE"
+
+0x0f3e: MOVEQ - 0x7,D0
+0x0f40: JSR - 128,0x1f4
+
+0x0f44: PEA - [0x0f5e]
+0x0f48: PUSH.L - 0
+0x0f4a: PUSH.L - 0
+0x0f4c: PUSH.L - 0x00000152
+0x0f52: PUSH.L - 0x000001fc
+0x0f58: MOVEQ - 0x0,D0
+0x0f5a: JMP - 128,0x2f0
+
+0x0f5e: PUSH.W - 0x118
+0x0f62: MOVEQ - 0x19,D0
+0x0f64: PUSH.W - D0
+0x0f66: MOVEQ - -0x1,D0
+0x0f68: PUSH.W - D0
+0x0f6a: PUSH.W - 0
+0x0f6c: MOVE.L - HEAP(0xa8),D0
+0x0f76: MOVEA.L - D0,A0
+0x0f78: JSR - "PICTURE"
+
+0x0f7c: MOVE.L - HEAP(0x412aa),D0
+0x0f86: MOVEA.L - D0,A0
+0x0f88: MOVE.L - (A0),D0
+0x0f8a: PUSH.L - D0
+0x0f8c: MOVE.L - HEAP(0x412b6),D0
+0x0f96: MOVEA.L - D0,A0
+0x0f98: MOVE.L - (A0),D0
+0x0f9a: PUSH.L - D0
+0x0f9c: MOVE.L - 0x5580,D0
+0x0fa2: JSR - "BLOCKMOVE"
+
+0x0fa6: MOVEQ - 0x8,D0
+0x0fa8: JSR - 128,0x1f4
+
+0x0fac: PUSH.W - 0x18f
+0x0fb0: PUSH.W - 0xc0
+0x0fb4: MOVEQ - -0x1,D0
+0x0fb6: PUSH.W - D0
+0x0fb8: PUSH.W - 0
+0x0fba: MOVE.L - HEAP(0xac),D0
+0x0fc4: MOVEA.L - D0,A0
+0x0fc6: JSR - "PICTURE"
+
+0x0fca: MOVE.L - HEAP(0x412a6),D0
+0x0fd4: MOVEA.L - D0,A0
+0x0fd6: MOVE.L - (A0),D0
+0x0fd8: PUSH.L - D0
+0x0fda: MOVE.L - HEAP(0x412ba),D0
+0x0fe4: MOVEA.L - D0,A0
+0x0fe6: MOVE.L - (A0),D0
+0x0fe8: PUSH.L - D0
+0x0fea: MOVE.L - 0x5580,D0
+0x0ff0: JSR - "BLOCKMOVE"
+
+0x0ff4: MOVEQ - 0x9,D0
+0x0ff6: JSR - 128,0x1f4
+
+0x0ffa: PUSH.W - 0x18f
+0x0ffe: PUSH.W - 0xc0
+0x1002: MOVEQ - -0x1,D0
+0x1004: PUSH.W - D0
+0x1006: PUSH.W - 0
+0x1008: MOVE.L - HEAP(0xac),D0
+0x1012: MOVEA.L - D0,A0
+0x1014: JSR - "PICTURE"
+
+0x1018: MOVEQ - 0xa,D0
+0x101a: JSR - 128,0x1f4
+
+0x101e: PEA - [0x1038]
+0x1022: PUSH.L - 0
+0x1024: PUSH.L - 0
+0x1026: PUSH.L - 0x00000152
+0x102c: PUSH.L - 0x000001fc
+0x1032: MOVEQ - 0x2,D0
+0x1034: JMP - 128,0x2f0
+
+0x1038: PUSH.W - 0x18f
+0x103c: PUSH.W - 0xc0
+0x1040: MOVEQ - -0x1,D0
+0x1042: PUSH.W - D0
+0x1044: PUSH.W - 0
+0x1046: MOVE.L - HEAP(0xac),D0
+0x1050: MOVEA.L - D0,A0
+0x1052: JSR - "PICTURE"
+
+0x1056: MOVE.L - HEAP(0x90),D0
+0x1060: MOVEA.L - D0,A0
+0x1062: MOVE.L - (A0),D0
+0x1064: PUSH.L - D0
+0x1066: TRAP - _ReleaseResource
+0x1068: PEA - VAR(0x32)
+0x106c: TRAP - _SetPortBits
+0x106e: MOVEQ - 0x78,D0
+0x1070: JSR - 128,0x24a
+
+0x1074: PEA - [0x1096]
+0x1078: PUSH.L - 0x000000c4
+0x107e: PUSH.L - 0x00000141
+0x1084: PUSH.L - 0x000000d3
+0x108a: PUSH.L - 0x000001fc
+0x1090: MOVEQ - 0x2,D0
+0x1092: JMP - 128,0x2f0
+
+0x1096: PEA - [0x10ae]
+0x109a: MOVEQ - 0x5,D0
+0x109c: PUSH.L - D0
+0x109e: MOVEQ - 0x64,D0
+0x10a0: PUSH.L - D0
+0x10a2: PUSH.L - 0x00000198
+0x10a8: MOVEQ - 0x0,D0
+0x10aa: JMP - 128,0x50a
+
+0x10ae: MOVEQ - 0x28,D0
+0x10b0: JSR - 128,0x21e
+
+0x10b4: MOVE.W - 0x118,var_i16_5e
+
+0x10ba: MOVE.W - 0x1d1,var_i16_62
+
+0x10c0: MOVEQ - 0x19,D0
+0x10c2: MOVE.W - D0,var_i16_5c
+
+0x10c6: MOVE.W - 0x118,var_i16_66
+
+0x10cc: MOVE.W - 0x1d1,var_i16_6a
+
+0x10d2: MOVE.W - 0xdf,var_i16_68
+
+0x10d8: MOVE.W - 0xdc,var_i16_74
+
+0x10de: PUSH.L - 0 (unsafe)
+0x10e0: TRAP - _TickCount
+0x10e2: POP.L - D0
+0x10e4: MOVE.L - D0,var_i32_2
+
+0x10e8: MOVE.L - HEAP(0x412aa),D0
+0x10f2: MOVEA.L - D0,A0
+0x10f4: MOVE.L - (A0),D0
+0x10f6: PUSH.L - D0
+0x10f8: PUSH.L - var_i32_4e
+0x10fc: MOVE.L - 0x5580,D0
+0x1102: JSR - "BLOCKMOVE"
+
+0x1106: MOVE.W - var_i16_74,var_i16_64
+
+0x110c: MOVEQ - 0x19,D0
+0x110e: PUSH.L - D0
+0x1110: MOVE.L - 0xdf,D0
+0x1116: MOVEA.W - var_i16_74,A0
+0x111a: SUB.L - A0,D0
+0x111c: POP.L - D1
+0x111e: ADD.L - D1,D0
+0x1120: MOVE.W - D0,var_i16_60
+
+0x1124: MOVE.L - HEAP(0x412ae),D0
+0x112e: MOVEA.L - D0,A0
+0x1130: MOVE.L - (A0),D0
+0x1132: MOVE.L - D0,var_i32_40
+
+0x1136: PEA - VAR(0x40)
+0x113a: PEA - VAR(0x4e)
+0x113e: PEA - VAR(0x5c)
+0x1142: PEA - VAR(0x64)
+0x1146: MOVEQ - 0x3,D0
+0x1148: PUSH.W - D0
+0x114a: PUSH.L - 0
+0x114c: TRAP - _CopyBits
+0x114e: MOVE.L - HEAP(0x412b2),D0
+0x1158: MOVEA.L - D0,A0
+0x115a: MOVE.L - (A0),D0
+0x115c: MOVE.L - D0,var_i32_40
+
+0x1160: PEA - VAR(0x40)
+0x1164: PEA - VAR(0x4e)
+0x1168: PEA - VAR(0x5c)
+0x116c: PEA - VAR(0x64)
+0x1170: MOVEQ - 0x1,D0
+0x1172: PUSH.W - D0
+0x1174: PUSH.L - 0
+0x1176: TRAP - _CopyBits
+0x1178: MOVEQ - 0x2,D0
+0x117a: JSR - 128,0x24a
+
+0x117e: PEA - VAR(0x4e)
+0x1182: PEA - VAR(0x32)
+0x1186: PEA - VAR(0x64)
+0x118a: PEA - VAR(0x64)
+0x118e: PUSH.W - 0
+0x1190: PUSH.L - 0
+0x1192: TRAP - _CopyBits
+0x1194: MOVEQ - 0x19,D0
+0x1196: ADDI.W - 0xfffb,var_i16_74
+0x119c: CMP.W - var_i16_74,D0
+0x11a0: BLE - [0x10de]
+
+0x11a4: MOVEQ - 0x5,D0
+0x11a6: JSR - 128,0x1ba
+
+0x11aa: MOVEQ - 0x5,D0
+0x11ac: JSR - 128,0x1f4
+
+0x11b0: PEA - [0x11d2]
+0x11b4: PUSH.L - 0x000000c4
+0x11ba: PUSH.L - 0x00000141
+0x11c0: PUSH.L - 0x000000d3
+0x11c6: PUSH.L - 0x000001fc
+0x11cc: MOVEQ - 0x2,D0
+0x11ce: JMP - 128,0x2f0
+
+0x11d2: PUSH.W - 0x18f
+0x11d6: PUSH.W - 0xc0
+0x11da: MOVEQ - -0x1,D0
+0x11dc: PUSH.W - D0
+0x11de: PUSH.W - 0
+0x11e0: MOVE.L - HEAP(0xac),D0
+0x11ea: MOVEA.L - D0,A0
+0x11ec: JSR - "PICTURE"
+
+0x11f0: PEA - VAR(0x32)
+0x11f4: TRAP - _SetPortBits
+0x11f6: TRAP - _PenNormal
+0x11f8: MOVEQ - 0xa,D0
+0x11fa: PUSH.W - D0
+0x11fc: TRAP - _PenMode
+0x11fe: MOVEQ - 0x5,D0
+0x1200: PUSH.W - D0
+0x1202: MOVEQ - 0x5,D0
+0x1204: PUSH.W - D0
+0x1206: TRAP - _PenSize
+0x1208: MOVEQ - 0x0,D0
+0x120a: MOVE.W - D0,var_i16_74
+
+0x120e: PUSH.L - 0 (unsafe)
+0x1210: TRAP - _TickCount
+0x1212: POP.L - D0
+0x1214: MOVE.L - D0,var_i32_2
+
+0x1218: PUSH.W - 0x172
+0x121c: MOVEQ - 0x33,D0
+0x121e: PUSH.W - D0
+0x1220: TRAP - _MoveTo
+0x1222: PUSH.W - var_i16_74
+0x1226: PUSH.W - 0x14a
+0x122a: TRAP - _LineTo
+0x122c: CMPI.W - 0x4e,var_i16_74
+0x1232: BEQ - [0x1238]
+
+0x1234: JMP - [0x12a4]
+--------
+0x1238: PUSH.W - 0xfa
+0x123c: MOVEQ - 0xc,D0
+0x123e: PUSH.W - D0
+0x1240: PUSH.W - 0
+0x1242: MOVEQ - 0x3,D0
+0x1244: PUSH.W - D0
+0x1246: JSR - "TEXT"
+
+0x124a: MOVEQ - 0x22,D0
+0x124c: JSR - "CHR$"
+
+0x1250: JSR - "BUFFER_CONCAT"
+
+0x1254: MOVEA.L - STR(0x2a4),A0 # b'Yes, apparently so. . .'
+0x125c: JSR - "BUFFER_CONCAT"
+
+0x1260: MOVEQ - 0x22,D0
+0x1262: JSR - "CHR$"
+
+0x1266: JSR - "BUFFER_CONCAT"
+
+0x126a: LEA - VAR(0x76),A0
+0x126e: JSR - "BUFFER_FLUSH"
+
+0x1272: PEA - [0x1286]
+0x1276: PUSH.L - 0x000001f0
+0x127c: MOVE.L - 0xd2,D0
+0x1282: JMP - 128,0x26c
+
+0x1286: PUSH.W - 0x198
+0x128a: PUSH.W - 0x102
+0x128e: MOVEQ - -0x1,D0
+0x1290: PUSH.W - D0
+0x1292: PUSH.W - 0
+0x1294: MOVE.L - HEAP(0x94),D0
+0x129e: MOVEA.L - D0,A0
+0x12a0: JSR - "PICTURE"
+
+0x12a4: MOVEQ - 0x2,D0
+0x12a6: JSR - 128,0x24a
+
+0x12aa: PUSH.W - 0x172
+0x12ae: MOVEQ - 0x33,D0
+0x12b0: PUSH.W - D0
+0x12b2: TRAP - _MoveTo
+0x12b4: PUSH.W - var_i16_74
+0x12b8: PUSH.W - 0x14a
+0x12bc: TRAP - _LineTo
+0x12be: ADDQ.W - 0x6,var_i16_74
+0x12c2: CMPI.W - 0x1b8,var_i16_74
+0x12c8: BLE - [0x120e]
+
+0x12cc: PEA - [0x1306]
+0x12d0: PUSH.L - 0x00000146
+0x12d6: PUSH.L - 0x000001b4
+0x12dc: PUSH.L - 0x00000146
+0x12e2: PUSH.L - 0x000001b4
+0x12e8: PUSH.L - 0x000000bc
+0x12ee: PUSH.L - 0x0000018b
+0x12f4: PUSH.L - 0x00000152
+0x12fa: PUSH.L - 0x000001e2
+0x1300: MOVEQ - 0x10,D0
+0x1302: JMP - 128,0x800
+
+0x1306: PEA - [0x1320]
+0x130a: MOVEQ - 0x5,D0
+0x130c: PUSH.L - D0
+0x130e: PUSH.L - 0x00000128
+0x1314: PUSH.L - 0x000001fc
+0x131a: MOVEQ - 0x1,D0
+0x131c: JMP - 128,0x50a
+
+0x1320: MOVEQ - 0x3c,D0
+0x1322: JSR - 128,0x21e
+
+0x1326: MOVEQ - 0x8,D0
+0x1328: MOVE.W - D0,var_i16_74
+
+0x132c: PEA - [0x1344]
+0x1330: MOVEA.W - var_i16_74,A0
+0x1334: PUSH.L - A0
+0x1336: PUSH.L - 0
+0x1338: PUSH.L - 0x000001fc
+0x133e: MOVEQ - 0x1,D0
+0x1340: JMP - 128,0x50a
+
+0x1344: MOVEQ - 0xa,D0
+0x1346: ADDQ.W - 0x1,var_i16_74
+0x134a: CMP.W - var_i16_74,D0
+0x134e: BGE - [0x132c]
+
+0x1350: PUSH.L - 0 (unsafe)
+0x1352: TRAP - _TickCount
+0x1354: POP.L - D0
+0x1356: MOVE.L - D0,var_i32_2
+
+0x135a: MOVEQ - 0x5,D0
+0x135c: JSR - 128,0x1f4
+
+0x1360: PEA - [0x137a]
+0x1364: PUSH.L - 0
+0x1366: PUSH.L - 0
+0x1368: PUSH.L - 0x00000152
+0x136e: PUSH.L - 0x000001fc
+0x1374: MOVEQ - 0x0,D0
+0x1376: JMP - 128,0x2f0
+
+0x137a: PUSH.W - 0
+0x137c: PUSH.W - 0
+0x137e: MOVEQ - -0x1,D0
+0x1380: PUSH.W - D0
+0x1382: PUSH.W - 0
+0x1384: MOVE.L - HEAP(0xbc),D0
+0x138e: MOVEA.L - D0,A0
+0x1390: JSR - "PICTURE"
+
+0x1394: PEA - VAR(0x32)
+0x1398: TRAP - _SetPortBits
+0x139a: MOVEQ - 0xa,D0
+0x139c: JSR - 128,0x24a
+
+0x13a0: MOVE.W - 0x18b,var_i16_5e
+
+0x13a6: MOVE.W - 0x1ef,var_i16_62
+
+0x13ac: MOVE.W - 0x18b,var_i16_66
+
+0x13b2: MOVE.W - 0x1ef,var_i16_6a
+
+0x13b8: MOVE.W - 0xc0,var_i16_74
+
+0x13be: PUSH.L - 0 (unsafe)
+0x13c0: TRAP - _TickCount
+0x13c2: POP.L - D0
+0x13c4: MOVE.L - D0,var_i32_2
+
+0x13c8: MOVE.W - var_i16_74,var_i16_5c
+
+0x13ce: MOVE.W - var_i16_5c,D0
+0x13d2: EXT.L - D0
+0x13d4: ADDI.L - 0x00000096,D0
+0x13da: MOVE.W - D0,var_i16_60
+
+0x13de: MOVE.W - var_i16_74,D0
+0x13e2: EXT.L - D0
+0x13e4: SUBQ.L - 0x1,D0
+0x13e6: MOVE.W - D0,var_i16_64
+
+0x13ea: MOVE.W - var_i16_64,D0
+0x13ee: EXT.L - D0
+0x13f0: ADDI.L - 0x00000096,D0
+0x13f6: MOVE.W - D0,var_i16_68
+
+0x13fa: PEA - VAR(0x32)
+0x13fe: PEA - VAR(0x32)
+0x1402: PEA - VAR(0x5c)
+0x1406: PEA - VAR(0x64)
+0x140a: PUSH.W - 0
+0x140c: PUSH.L - 0
+0x140e: TRAP - _CopyBits
+0x1410: MOVEQ - 0x1,D0
+0x1412: JSR - 128,0x24a
+
+0x1416: MOVEQ - 0x15,D0
+0x1418: ADDI.W - 0xffff,var_i16_74
+0x141e: CMP.W - var_i16_74,D0
+0x1422: BLE - [0x13be]
+
+0x1424: PUSH.W - 0x193
+0x1428: MOVEQ - 0x2d,D0
+0x142a: PUSH.W - D0
+0x142c: MOVEQ - -0x1,D0
+0x142e: PUSH.W - D0
+0x1430: PUSH.W - 0
+0x1432: MOVE.L - HEAP(0xb0),D0
+0x143c: MOVEA.L - D0,A0
+0x143e: JSR - "PICTURE"
+
+0x1442: MOVEQ - 0x1,D0
+0x1444: JSR - 128,0x21e
+
+0x1448: PUSH.W - 0x193
+0x144c: MOVEQ - 0x2d,D0
+0x144e: PUSH.W - D0
+0x1450: MOVEQ - -0x1,D0
+0x1452: PUSH.W - D0
+0x1454: PUSH.W - 0
+0x1456: MOVE.L - HEAP(0xb4),D0
+0x1460: MOVEA.L - D0,A0
+0x1462: JSR - "PICTURE"
+
+0x1466: MOVEQ - 0x1,D0
+0x1468: JSR - 128,0x21e
+
+0x146c: PUSH.W - 0x193
+0x1470: MOVEQ - 0x2d,D0
+0x1472: PUSH.W - D0
+0x1474: MOVEQ - -0x1,D0
+0x1476: PUSH.W - D0
+0x1478: PUSH.W - 0
+0x147a: MOVE.L - HEAP(0xb8),D0
+0x1484: MOVEA.L - D0,A0
+0x1486: JSR - "PICTURE"
+
+0x148a: MOVEQ - 0x6,D0
+0x148c: JSR - 128,0x1ba
+
+0x1490: TRAP - _PenNormal
+0x1492: MOVEQ - 0xa,D0
+0x1494: PUSH.W - D0
+0x1496: TRAP - _PenMode
+0x1498: MOVEQ - 0x3,D0
+0x149a: PUSH.W - D0
+0x149c: MOVEQ - 0x3,D0
+0x149e: PUSH.W - D0
+0x14a0: TRAP - _PenSize
+0x14a2: MOVE.W - 0x190,var_i16_6e
+
+0x14a8: MOVE.W - 0x200,var_i16_72
+
+0x14ae: MOVEQ - 0x50,D0
+0x14b0: MOVE.W - D0,var_i16_6c
+
+0x14b4: MOVE.W - 0x156,var_i16_70
+
+0x14ba: MOVEQ - 0x0,D0
+0x14bc: MOVE.W - D0,var_i16_5e
+
+0x14c0: MOVEQ - 0x32,D0
+0x14c2: MOVE.W - D0,var_i16_62
+
+0x14c6: MOVEQ - 0x0,D0
+0x14c8: MOVE.W - D0,var_i16_5c
+
+0x14cc: MOVEQ - 0x32,D0
+0x14ce: MOVE.W - D0,var_i16_60
+
+0x14d2: MOVEQ - 0x64,D0
+0x14d4: MOVE.W - D0,var_i16_3e0
+
+0x14d8: MOVE.L - HEAP(0x412aa),D0
+0x14e2: MOVEA.L - D0,A0
+0x14e4: MOVE.L - (A0),D0
+0x14e6: MOVE.L - D0,var_i32_40
+
+0x14ea: PEA - VAR(0x4e)
+0x14ee: TRAP - _SetPortBits
+0x14f0: MOVEQ - 0x1,D0
+0x14f2: MOVE.W - D0,var_i16_74
+
+0x14f6: PUSH.L - 0 (unsafe)
+0x14f8: TRAP - _TickCount
+0x14fa: POP.L - D0
+0x14fc: MOVE.L - D0,var_i32_2
+
+0x1500: MOVE.L - HEAP(0x412ae),D0
+0x150a: MOVEA.L - D0,A0
+0x150c: MOVE.L - (A0),D0
+0x150e: PUSH.L - D0
+0x1510: PUSH.L - var_i32_4e
+0x1514: MOVE.L - 0x5580,D0
+0x151a: JSR - "BLOCKMOVE"
+
+0x151e: MOVE.W - var_i16_3e0,D0
+0x1522: EXT.L - D0
+0x1524: ADDQ.L - 0x5,D0
+0x1526: PUSH.L - D0
+0x1528: MOVE.W - var_i16_74,D0
+0x152c: EXT.L - D0
+0x152e: MOVE.L - D0,D1
+0x1530: MOVEQ - 0x2,D0
+0x1532: JSR - "MUL_INT"
+
+0x1536: POP.L - D1
+0x1538: ADD.L - D1,D0
+0x153a: MOVE.W - D0,var_i16_3e0
+
+0x153e: MOVE.W - 0x1e0,var_i16_66
+
+0x1544: MOVE.W - var_i16_66,D0
+0x1548: EXT.L - D0
+0x154a: ADDI.L - 0x00000032,D0
+0x1550: MOVE.W - D0,var_i16_6a
+
+0x1554: MOVE.W - var_i16_3e0,var_i16_64
+
+0x155a: MOVE.W - var_i16_64,D0
+0x155e: EXT.L - D0
+0x1560: ADDI.L - 0x00000032,D0
+0x1566: MOVE.W - D0,var_i16_68
+
+0x156a: PEA - VAR(0x40)
+0x156e: PEA - VAR(0x4e)
+0x1572: PEA - VAR(0x5c)
+0x1576: PEA - VAR(0x64)
+0x157a: MOVEQ - 0x2,D0
+0x157c: PUSH.W - D0
+0x157e: PUSH.L - 0
+0x1580: TRAP - _CopyBits
+0x1582: MOVE.L - 0x190,D0
+0x1588: MOVEA.W - var_i16_74,A0
+0x158c: SUB.L - A0,D0
+0x158e: PUSH.W - D0
+0x1590: MOVE.W - var_i16_3e0,D0
+0x1594: EXT.L - D0
+0x1596: SUBI.L - 0x1e,D0
+0x159c: PUSH.L - D0
+0x159e: MOVE.W - var_i16_74,D0
+0x15a2: EXT.L - D0
+0x15a4: MOVE.L - D0,D1
+0x15a6: MOVEQ - 0x3,D0
+0x15a8: JSR - "MUL_INT"
+
+0x15ac: POP.L - D1
+0x15ae: ADD.L - D1,D0
+0x15b0: PUSH.W - D0
+0x15b2: TRAP - _MoveTo
+0x15b4: PUSH.W - 0x1f4
+0x15b8: MOVE.W - var_i16_3e0,D0
+0x15bc: EXT.L - D0
+0x15be: ADDI.L - 0x0000000a,D0
+0x15c4: MOVEA.W - var_i16_74,A0
+0x15c8: SUB.L - A0,D0
+0x15ca: PUSH.W - D0
+0x15cc: TRAP - _LineTo
+0x15ce: MOVEQ - 0x1,D0
+0x15d0: JSR - 128,0x24a
+
+0x15d4: PEA - VAR(0x4e)
+0x15d8: PEA - VAR(0x32)
+0x15dc: PEA - VAR(0x6c)
+0x15e0: PEA - VAR(0x6c)
+0x15e4: PUSH.W - 0
+0x15e6: PUSH.L - 0
+0x15e8: TRAP - _CopyBits
+0x15ea: MOVEQ - 0xf,D0
+0x15ec: ADDQ.W - 0x1,var_i16_74
+0x15f0: CMP.W - var_i16_74,D0
+0x15f4: BGE - [0x14f6]
+
+0x15f8: PEA - VAR(0x32)
+0x15fc: TRAP - _SetPortBits
+0x15fe: TRAP - _PenNormal
+0x1600: MOVEQ - 0xa,D0
+0x1602: PUSH.W - D0
+0x1604: TRAP - _PenMode
+0x1606: MOVEQ - 0x0,D0
+0x1608: MOVE.W - D0,var_i16_192
+
+0x160c: MOVEQ - 0x1,D0
+0x160e: MOVE.W - D0,var_i16_74
+
+0x1612: PUSH.L - 0 (unsafe)
+0x1614: TRAP - _TickCount
+0x1616: POP.L - D0
+0x1618: MOVE.L - D0,var_i32_2
+
+0x161c: MOVE.W - var_i16_192,D0
+0x1620: BEQ - [0x1626]
+
+0x1622: JMP - [0x1692]
+--------
+0x1626: MOVEQ - 0x0,D0
+0x1628: MOVEA.W - var_i16_74,A0
+0x162c: ADD.L - A0,D0
+0x162e: LSL.L - 0x1,D0
+0x1630: ADDI.L - HEAP(0x1e8),D0
+0x163a: PUSH.L - D0
+0x163c: MOVE.L - 0x1f4,D0
+0x1642: MOVEA.W - var_i16_74,A0
+0x1646: SUB.L - A0,D0
+0x1648: PUSH.L - D0
+0x164a: MOVE.W - var_i16_74,D0
+0x164e: EXT.L - D0
+0x1650: JSR - "RND_INT"
+
+0x1654: POP.L - D1
+0x1656: ADD.L - D1,D0
+0x1658: POP.L - A0
+0x165a: MOVE.W - D0,(A0)
+
+0x165c: MOVE.L - 0xfb,D0
+0x1662: MOVEA.W - var_i16_74,A0
+0x1666: ADD.L - A0,D0
+0x1668: LSL.L - 0x1,D0
+0x166a: ADDI.L - HEAP(0x1e8),D0
+0x1674: PUSH.L - D0
+0x1676: MOVE.L - 0x156,D0
+0x167c: PUSH.L - D0
+0x167e: MOVE.W - var_i16_74,D0
+0x1682: EXT.L - D0
+0x1684: JSR - "RND_INT"
+
+0x1688: POP.L - D1
+0x168a: EXG - D0,D1
+0x168c: SUB.L - D1,D0
+0x168e: POP.L - A0
+0x1690: MOVE.W - D0,(A0)
+
+0x1692: MOVEQ - 0x0,D0
+0x1694: MOVEA.W - var_i16_74,A0
+0x1698: ADD.L - A0,D0
+0x169a: LSL.L - 0x1,D0
+0x169c: ADDI.L - HEAP(0x1e8),D0
+0x16a6: MOVEA.L - D0,A0
+0x16a8: MOVE.W - (A0),D0
+0x16aa: EXT.L - D0
+0x16ac: PUSH.W - D0
+0x16ae: MOVE.L - 0xfb,D0
+0x16b4: MOVEA.W - var_i16_74,A0
+0x16b8: ADD.L - A0,D0
+0x16ba: LSL.L - 0x1,D0
+0x16bc: ADDI.L - HEAP(0x1e8),D0
+0x16c6: MOVEA.L - D0,A0
+0x16c8: MOVE.W - (A0),D0
+0x16ca: EXT.L - D0
+0x16cc: PUSH.W - D0
+0x16ce: TRAP - _MoveTo
+0x16d0: MOVEQ - 0x0,D0
+0x16d2: MOVEA.W - var_i16_74,A0
+0x16d6: ADD.L - A0,D0
+0x16d8: LSL.L - 0x1,D0
+0x16da: ADDI.L - HEAP(0x1e8),D0
+0x16e4: MOVEA.L - D0,A0
+0x16e6: MOVE.W - (A0),D0
+0x16e8: EXT.L - D0
+0x16ea: PUSH.W - D0
+0x16ec: MOVE.L - 0xfb,D0
+0x16f2: MOVEA.W - var_i16_74,A0
+0x16f6: ADD.L - A0,D0
+0x16f8: LSL.L - 0x1,D0
+0x16fa: ADDI.L - HEAP(0x1e8),D0
+0x1704: MOVEA.L - D0,A0
+0x1706: MOVE.W - (A0),D0
+0x1708: EXT.L - D0
+0x170a: PUSH.W - D0
+0x170c: TRAP - _LineTo
+0x170e: MOVE.W - var_i16_74,D0
+0x1712: EXT.L - D0
+0x1714: MOVE.L - D0,D1
+0x1716: MOVEQ - 0x19,D0
+0x1718: JSR - "MOD_INT"
+
+0x171c: CMPI.L - 0x0,D0
+0x1722: BNE - [0x172c]
+
+0x1726: MOVEQ - 0x1,D0
+0x1728: JSR - 128,0x24a
+
+0x172c: ADDQ.W - 0x1,var_i16_74
+0x1730: CMPI.W - 0xfa,var_i16_74
+0x1736: BLE - [0x1612]
+
+0x173a: MOVEQ - 0x1,D0
+0x173c: ADDQ.W - 0x1,var_i16_192
+0x1740: CMP.W - var_i16_192,D0
+0x1744: BGE - [0x160c]
+
+0x1748: PUSH.L - 0 (unsafe)
+0x174a: TRAP - _TickCount
+0x174c: POP.L - D0
+0x174e: MOVE.L - D0,var_i32_2
+
+0x1752: MOVEQ - 0x25,D0
+0x1754: MOVE.W - D0,var_i16_74
+
+0x1758: MOVE.W - var_i16_74,D0
+0x175c: EXT.L - D0
+0x175e: LSL.L - 0x2,D0
+0x1760: ADD.L - HEAP,D0
+0x1764: MOVEA.L - D0,A0
+0x1766: MOVE.L - (A0),D0
+0x1768: PUSH.L - D0
+0x176a: TRAP - _ReleaseResource
+0x176c: MOVEQ - 0x2f,D0
+0x176e: ADDQ.W - 0x1,var_i16_74
+0x1772: CMP.W - var_i16_74,D0
+0x1776: BGE - [0x1758]
+
+0x1778: MOVEQ - 0x3c,D0
+0x177a: JSR - 128,0x24a
+
+0x177e: PUSH.W - 0xfa
+0x1782: MOVEQ - 0xc,D0
+0x1784: PUSH.W - D0
+0x1786: PUSH.W - 0
+0x1788: MOVEQ - 0x3,D0
+0x178a: PUSH.W - D0
+0x178c: JSR - "TEXT"
+
+0x1790: MOVEQ - 0x22,D0
+0x1792: JSR - "CHR$"
+
+0x1796: JSR - "BUFFER_CONCAT"
+
+0x179a: MOVEA.L - STR(0x2bc),A0 # b"Well, this won't do. . ."
+0x17a2: JSR - "BUFFER_CONCAT"
+
+0x17a6: MOVEQ - 0x22,D0
+0x17a8: JSR - "CHR$"
+
+0x17ac: JSR - "BUFFER_CONCAT"
+
+0x17b0: LEA - VAR(0x76),A0
+0x17b4: JSR - "BUFFER_FLUSH"
+
+0x17b8: PEA - [0x17c8]
+0x17bc: PUSH.L - 0x0000017d
+0x17c2: MOVEQ - 0x3c,D0
+0x17c4: JMP - 128,0x26c
+
+0x17c8: PUSH.L - 0 (unsafe)
+0x17ca: TRAP - _TickCount
+0x17cc: POP.L - D0
+0x17ce: MOVE.L - D0,var_i32_2
+
+0x17d2: MOVEQ - 0x30,D0
+0x17d4: MOVE.W - D0,var_i16_74
+
+0x17d8: MOVE.W - var_i16_74,D0
+0x17dc: EXT.L - D0
+0x17de: LSL.L - 0x2,D0
+0x17e0: ADD.L - HEAP,D0
+0x17e4: PUSH.L - D0
+0x17e6: PUSH.L - 0 (unsafe)
+0x17e8: PUSH.W - var_i16_74
+0x17ec: TRAP - _GetPicture
+0x17ee: POP.L - D0
+0x17f0: POP.L - A0
+0x17f2: MOVE.L - D0,(A0)
+
+0x17f4: MOVEQ - 0x31,D0
+0x17f6: ADDQ.W - 0x1,var_i16_74
+0x17fa: CMP.W - var_i16_74,D0
+0x17fe: BGE - [0x17d8]
+
+0x1800: MOVEQ - 0x4b,D0
+0x1802: MOVE.W - D0,var_i16_74
+
+0x1806: MOVE.W - var_i16_74,D0
+0x180a: EXT.L - D0
+0x180c: LSL.L - 0x2,D0
+0x180e: ADD.L - HEAP,D0
+0x1812: PUSH.L - D0
+0x1814: PUSH.L - 0 (unsafe)
+0x1816: PUSH.W - var_i16_74
+0x181a: TRAP - _GetPicture
+0x181c: POP.L - D0
+0x181e: POP.L - A0
+0x1820: MOVE.L - D0,(A0)
+
+0x1822: MOVEQ - 0x52,D0
+0x1824: ADDQ.W - 0x1,var_i16_74
+0x1828: CMP.W - var_i16_74,D0
+0x182c: BGE - [0x1806]
+
+0x182e: MOVE.L - 0xd2,D0
+0x1834: JSR - 128,0x24a
+
+0x1838: PEA - [0x1852]
+0x183c: PUSH.L - 0
+0x183e: PUSH.L - 0
+0x1840: PUSH.L - 0x00000092
+0x1846: PUSH.L - 0x00000187
+0x184c: MOVEQ - 0x2,D0
+0x184e: JMP - 128,0x2f0
+
+0x1852: PUSH.W - 0x193
+0x1856: MOVEQ - 0x2d,D0
+0x1858: PUSH.W - D0
+0x185a: MOVEQ - -0x1,D0
+0x185c: PUSH.W - D0
+0x185e: PUSH.W - 0
+0x1860: MOVE.L - HEAP(0xc0),D0
+0x186a: MOVEA.L - D0,A0
+0x186c: JSR - "PICTURE"
+
+0x1870: MOVEQ - 0x1,D0
+0x1872: JSR - 128,0x21e
+
+0x1876: PUSH.W - 0x193
+0x187a: MOVEQ - 0x2d,D0
+0x187c: PUSH.W - D0
+0x187e: MOVEQ - -0x1,D0
+0x1880: PUSH.W - D0
+0x1882: PUSH.W - 0
+0x1884: MOVE.L - HEAP(0xc4),D0
+0x188e: MOVEA.L - D0,A0
+0x1890: JSR - "PICTURE"
+
+0x1894: PUSH.W - 0xfa
+0x1898: MOVEQ - 0xc,D0
+0x189a: PUSH.W - D0
+0x189c: PUSH.W - 0
+0x189e: MOVEQ - 0x3,D0
+0x18a0: PUSH.W - D0
+0x18a2: JSR - "TEXT"
+
+0x18a6: MOVEQ - 0x22,D0
+0x18a8: JSR - "CHR$"
+
+0x18ac: JSR - "BUFFER_CONCAT"
+
+0x18b0: MOVEA.L - STR(0x2d6),A0 # b'High Priestess!'
+0x18b8: JSR - "BUFFER_CONCAT"
+
+0x18bc: LEA - VAR(0x76),A0
+0x18c0: JSR - "BUFFER_FLUSH"
+
+0x18c4: PEA - [0x18d4]
+0x18c8: PUSH.L - 0x0000017d
+0x18ce: MOVEQ - 0x3c,D0
+0x18d0: JMP - 128,0x26c
+
+0x18d4: MOVEA.L - STR(0x2e6),A0 # b' Am I to suffer this fate merely for uncovering'
+0x18dc: JSR - "BUFFER_CONCAT"
+
+0x18e0: LEA - VAR(0x76),A0
+0x18e4: JSR - "BUFFER_FLUSH"
+
+0x18e8: PEA - [0x18f8]
+0x18ec: PUSH.L - 0x0000017d
+0x18f2: MOVEQ - 0x4d,D0
+0x18f4: JMP - 128,0x26c
+
+0x18f8: MOVEA.L - STR(0x318),A0 # b' the fourteen lost treasures of the land?'
+0x1900: JSR - "BUFFER_CONCAT"
+
+0x1904: MOVEQ - 0x22,D0
+0x1906: JSR - "CHR$"
+
+0x190a: JSR - "BUFFER_CONCAT"
+
+0x190e: LEA - VAR(0x76),A0
+0x1912: JSR - "BUFFER_FLUSH"
+
+0x1916: PEA - [0x1926]
+0x191a: PUSH.L - 0x0000017d
+0x1920: MOVEQ - 0x5e,D0
+0x1922: JMP - 128,0x26c
+
+0x1926: MOVEQ - 0x30,D0
+0x1928: MOVE.W - D0,var_i16_74
+
+0x192c: MOVE.W - var_i16_74,D0
+0x1930: EXT.L - D0
+0x1932: LSL.L - 0x2,D0
+0x1934: ADD.L - HEAP,D0
+0x1938: MOVEA.L - D0,A0
+0x193a: MOVE.L - (A0),D0
+0x193c: PUSH.L - D0
+0x193e: TRAP - _ReleaseResource
+0x1940: MOVEQ - 0x31,D0
+0x1942: ADDQ.W - 0x1,var_i16_74
+0x1946: CMP.W - var_i16_74,D0
+0x194a: BGE - [0x192c]
+
+0x194c: MOVEQ - 0x32,D0
+0x194e: MOVE.W - D0,var_i16_74
+
+0x1952: MOVE.W - var_i16_74,D0
+0x1956: EXT.L - D0
+0x1958: LSL.L - 0x2,D0
+0x195a: ADD.L - HEAP,D0
+0x195e: PUSH.L - D0
+0x1960: PUSH.L - 0 (unsafe)
+0x1962: PUSH.W - var_i16_74
+0x1966: TRAP - _GetPicture
+0x1968: POP.L - D0
+0x196a: POP.L - A0
+0x196c: MOVE.L - D0,(A0)
+
+0x196e: CMPI.W - 0x37,var_i16_74
+0x1974: BEQ - [0x197a]
+
+0x1976: JMP - [0x19b2]
+--------
+0x197a: MOVEQ - 0x5,D0
+0x197c: JSR - 128,0x1f4
+
+0x1980: PUSH.W - 0
+0x1982: PUSH.W - 0
+0x1984: MOVEQ - -0x1,D0
+0x1986: PUSH.W - D0
+0x1988: PUSH.W - 0
+0x198a: MOVE.L - HEAP(0xdc),D0
+0x1994: MOVEA.L - D0,A0
+0x1996: JSR - "PICTURE"
+
+0x199a: MOVE.L - HEAP(0xdc),D0
+0x19a4: MOVEA.L - D0,A0
+0x19a6: MOVE.L - (A0),D0
+0x19a8: PUSH.L - D0
+0x19aa: TRAP - _ReleaseResource
+0x19ac: PEA - VAR(0x32)
+0x19b0: TRAP - _SetPortBits
+0x19b2: MOVEQ - 0x38,D0
+0x19b4: ADDQ.W - 0x1,var_i16_74
+0x19b8: CMP.W - var_i16_74,D0
+0x19bc: BGE - [0x1952]
+
+0x19be: JSR - 128,0xe1c
+
+0x19c2: JSR - 128,0xe58
+
+0x19c6: JSR - 128,0xe1c
+
+0x19ca: PEA - [0x19e4]
+0x19ce: PUSH.L - 0
+0x19d0: PUSH.L - 0
+0x19d2: PUSH.L - 0x00000092
+0x19d8: PUSH.L - 0x00000187
+0x19de: MOVEQ - 0x2,D0
+0x19e0: JMP - 128,0x2f0
+
+0x19e4: PUSH.W - 0x193
+0x19e8: MOVEQ - 0x2d,D0
+0x19ea: PUSH.W - D0
+0x19ec: MOVEQ - -0x1,D0
+0x19ee: PUSH.W - D0
+0x19f0: PUSH.W - 0
+0x19f2: MOVE.L - HEAP(0xc8),D0
+0x19fc: MOVEA.L - D0,A0
+0x19fe: JSR - "PICTURE"
+
+0x1a02: PUSH.W - 0xfa
+0x1a06: MOVEQ - 0xc,D0
+0x1a08: PUSH.W - D0
+0x1a0a: PUSH.W - 0
+0x1a0c: MOVEQ - 0x3,D0
+0x1a0e: PUSH.W - D0
+0x1a10: JSR - "TEXT"
+
+0x1a14: MOVEQ - 0x22,D0
+0x1a16: JSR - "CHR$"
+
+0x1a1a: JSR - "BUFFER_CONCAT"
+
+0x1a1e: MOVEA.L - STR(0x342),A0 # b'. . . for if that be true,'
+0x1a26: JSR - "BUFFER_CONCAT"
+
+0x1a2a: LEA - VAR(0x76),A0
+0x1a2e: JSR - "BUFFER_FLUSH"
+
+0x1a32: PEA - [0x1a42]
+0x1a36: PUSH.L - 0x0000017d
+0x1a3c: MOVEQ - 0x3c,D0
+0x1a3e: JMP - 128,0x26c
+
+0x1a42: MOVEA.L - STR(0x35e),A0 # b' I wish you had made the challenge more difficult!'
+0x1a4a: JSR - "BUFFER_CONCAT"
+
+0x1a4e: LEA - VAR(0x76),A0
+0x1a52: JSR - "BUFFER_FLUSH"
+
+0x1a56: PEA - [0x1a66]
+0x1a5a: PUSH.L - 0x0000017d
+0x1a60: MOVEQ - 0x4d,D0
+0x1a62: JMP - 128,0x26c
+
+0x1a66: MOVEA.L - STR(0x392),A0 # b' After all, I am just a fool and I should not'
+0x1a6e: JSR - "BUFFER_CONCAT"
+
+0x1a72: LEA - VAR(0x76),A0
+0x1a76: JSR - "BUFFER_FLUSH"
+
+0x1a7a: PEA - [0x1a8a]
+0x1a7e: PUSH.L - 0x0000017d
+0x1a84: MOVEQ - 0x5e,D0
+0x1a86: JMP - 128,0x26c
+
+0x1a8a: MOVEA.L - STR(0x3c0),A0 # b' have been able to find them so easily.'
+0x1a92: JSR - "BUFFER_CONCAT"
+
+0x1a96: MOVEQ - 0x22,D0
+0x1a98: JSR - "CHR$"
+
+0x1a9c: JSR - "BUFFER_CONCAT"
+
+0x1aa0: LEA - VAR(0x76),A0
+0x1aa4: JSR - "BUFFER_FLUSH"
+
+0x1aa8: PEA - [0x1ab8]
+0x1aac: PUSH.L - 0x0000017d
+0x1ab2: MOVEQ - 0x6f,D0
+0x1ab4: JMP - 128,0x26c
+
+0x1ab8: MOVE.L - HEAP(0x41af4),D0
+0x1ac2: MOVEA.L - D0,A0
+0x1ac4: MOVEQ - 0x6,D0
+0x1ac6: MOVE.W - D0,(A0)
+
+0x1ac8: MOVE.L - HEAP(0x41af6),D0
+0x1ad2: MOVEA.L - D0,A0
+0x1ad4: MOVE.W - 0xd0,(A0)
+
+0x1ad8: MOVE.L - HEAP(0x41af8),D0
+0x1ae2: MOVEA.L - D0,A0
+0x1ae4: MOVEQ - 0x6c,D0
+0x1ae6: MOVE.W - D0,(A0)
+
+0x1ae8: MOVE.L - HEAP(0x41afa),D0
+0x1af2: MOVEA.L - D0,A0
+0x1af4: MOVE.W - 0x133,(A0)
+
+0x1af8: MOVE.L - HEAP(0x41afc),D0
+0x1b02: MOVEA.L - D0,A0
+0x1b04: MOVEQ - 0xa,D0
+0x1b06: MOVE.W - D0,(A0)
+
+0x1b08: MOVE.L - HEAP(0x41afe),D0
+0x1b12: MOVEA.L - D0,A0
+0x1b14: MOVE.W - 0xb4,(A0)
+
+0x1b18: MOVE.L - HEAP(0x41b00),D0
+0x1b22: MOVEA.L - D0,A0
+0x1b24: MOVE.W - 0x14c,(A0)
+
+0x1b28: MOVE.L - HEAP(0x41b02),D0
+0x1b32: MOVEA.L - D0,A0
+0x1b34: MOVE.W - 0x1f6,(A0)
+
+0x1b38: MOVE.L - HEAP(0x41b04),D0
+0x1b42: MOVEA.L - D0,A0
+0x1b44: MOVEQ - 0x2,D0
+0x1b46: MOVE.W - D0,(A0)
+
+0x1b48: MOVE.L - HEAP(0x41b06),D0
+0x1b52: MOVEA.L - D0,A0
+0x1b54: MOVEQ - 0xa,D0
+0x1b56: MOVE.W - D0,(A0)
+
+0x1b58: MOVE.L - HEAP(0x41b08),D0
+0x1b62: MOVEA.L - D0,A0
+0x1b64: MOVEQ - 0xd,D0
+0x1b66: MOVE.W - D0,(A0)
+
+0x1b68: MOVEQ - 0x0,D0
+0x1b6a: MOVE.W - D0,var_i16_74
+
+0x1b6e: MOVE.W - var_i16_74,D0
+0x1b72: EXT.L - D0
+0x1b74: LSL.L - 0x2,D0
+0x1b76: ADDI.L - HEAP(0x41bbe),D0
+0x1b80: PUSH.L - D0
+0x1b82: MOVEA.W - var_i16_74,A0
+0x1b86: ADDA.L - A0,A0
+0x1b88: ADDA.L - HEAP(0x41af4),A0
+0x1b92: MOVE.W - (A0),D0
+0x1b94: EXT.L - D0
+0x1b96: JSR - "BCD_FROM_INT"
+
+0x1b9a: POP.L - A0
+0x1b9c: JSR - "BCD_TO_VAR"
+
+0x1ba0: MOVE.W - var_i16_74,D0
+0x1ba4: EXT.L - D0
+0x1ba6: ADDQ.L - 0x4,D0
+0x1ba8: LSL.L - 0x2,D0
+0x1baa: ADDI.L - HEAP(0x41bbe),D0
+0x1bb4: PUSH.L - D0
+0x1bb6: MOVE.W - var_i16_74,D0
+0x1bba: EXT.L - D0
+0x1bbc: ADDQ.L - 0x4,D0
+0x1bbe: LSL.L - 0x1,D0
+0x1bc0: ADDI.L - HEAP(0x41af4),D0
+0x1bca: MOVEA.L - D0,A0
+0x1bcc: MOVE.W - (A0),D0
+0x1bce: EXT.L - D0
+0x1bd0: PUSH.L - D0
+0x1bd2: MOVEA.W - var_i16_74,A0
+0x1bd6: ADDA.L - A0,A0
+0x1bd8: ADDA.L - HEAP(0x41af4),A0
+0x1be2: MOVE.W - (A0),D0
+0x1be4: EXT.L - D0
+0x1be6: POP.L - D1
+0x1be8: EXG - D0,D1
+0x1bea: SUB.L - D1,D0
+0x1bec: JSR - "BCD_FROM_INT"
+
+0x1bf0: JSR - "BCD_PUSH_LHS"
+
+0x1bf4: MOVE.L - HEAP(0x41b08),D0
+0x1bfe: MOVEA.L - D0,A0
+0x1c00: MOVE.W - (A0),D0
+0x1c02: EXT.L - D0
+0x1c04: JSR - "BCD_FROM_INT"
+
+0x1c08: JSR - "BCD_PUSH_RHS"
+
+0x1c0c: JSR - "DIV_BCD"
+
+0x1c10: POP.L - A0
+0x1c12: JSR - "BCD_TO_VAR"
+
+0x1c16: MOVEQ - 0x3,D0
+0x1c18: ADDQ.W - 0x1,var_i16_74
+0x1c1c: CMP.W - var_i16_74,D0
+0x1c20: BGE - [0x1b6e]
+
+0x1c24: MOVE.L - HEAP(0x19c),D0
+0x1c2e: PUSH.L - D0
+0x1c30: TRAP - _PenPat
+0x1c32: MOVEQ - 0xa,D0
+0x1c34: PUSH.W - D0
+0x1c36: TRAP - _PenMode
+0x1c38: MOVEQ - 0x6,D0
+0x1c3a: MOVE.W - D0,var_i16_192
+
+0x1c3e: MOVE.W - var_i16_192,D0
+0x1c42: EXT.L - D0
+0x1c44: SUBQ.L - 0x1,D0
+0x1c46: LSL.L - 0x2,D0
+0x1c48: ADDI.L - HEAP(0x41296),D0
+0x1c52: MOVEA.L - D0,A0
+0x1c54: MOVE.L - (A0),D0
+0x1c56: PUSH.L - D0
+0x1c58: MOVE.W - var_i16_192,D0
+0x1c5c: EXT.L - D0
+0x1c5e: LSL.L - 0x2,D0
+0x1c60: ADDI.L - HEAP(0x41296),D0
+0x1c6a: MOVEA.L - D0,A0
+0x1c6c: MOVE.L - (A0),D0
+0x1c6e: PUSH.L - D0
+0x1c70: MOVE.L - 0x5580,D0
+0x1c76: JSR - "BLOCKMOVE"
+
+0x1c7a: MOVE.W - var_i16_192,D0
+0x1c7e: EXT.L - D0
+0x1c80: JSR - 128,0x1f4
+
+0x1c84: CMPI.W - 0x6,var_i16_192
+0x1c8a: BNE - [0x1c9c]
+
+0x1c8e: MOVE.L - HEAP(0x41af4),D0
+0x1c98: PUSH.L - D0
+0x1c9a: TRAP - _PaintOval
+0x1c9c: MOVEQ - 0x0,D0
+0x1c9e: MOVE.W - D0,var_i16_3e2
+
+0x1ca2: MOVEQ - 0x0,D0
+0x1ca4: MOVE.W - D0,var_i16_74
+
+0x1ca8: MOVE.W - var_i16_74,D0
+0x1cac: EXT.L - D0
+0x1cae: LSL.L - 0x2,D0
+0x1cb0: ADDI.L - HEAP(0x41bbe),D0
+0x1cba: PUSH.L - D0
+0x1cbc: MOVE.W - var_i16_74,D0
+0x1cc0: EXT.L - D0
+0x1cc2: LSL.L - 0x2,D0
+0x1cc4: ADDI.L - HEAP(0x41bbe),D0
+0x1cce: MOVEA.L - D0,A0
+0x1cd0: JSR - "BCD_FROM_VAR"
+
+0x1cd4: JSR - "BCD_PUSH_LHS"
+
+0x1cd8: MOVE.W - var_i16_74,D0
+0x1cdc: EXT.L - D0
+0x1cde: ADDQ.L - 0x4,D0
+0x1ce0: LSL.L - 0x2,D0
+0x1ce2: ADDI.L - HEAP(0x41bbe),D0
+0x1cec: MOVEA.L - D0,A0
+0x1cee: JSR - "BCD_FROM_VAR"
+
+0x1cf2: JSR - "ADD_BCD"
+
+0x1cf6: POP.L - A0
+0x1cf8: JSR - "BCD_TO_VAR"
+
+0x1cfc: MOVE.W - var_i16_74,D0
+0x1d00: EXT.L - D0
+0x1d02: ADDI.L - 0x0000000b,D0
+0x1d08: LSL.L - 0x1,D0
+0x1d0a: ADDI.L - HEAP(0x41af4),D0
+0x1d14: PUSH.L - D0
+0x1d16: MOVE.W - var_i16_74,D0
+0x1d1a: EXT.L - D0
+0x1d1c: LSL.L - 0x2,D0
+0x1d1e: ADDI.L - HEAP(0x41bbe),D0
+0x1d28: MOVEA.L - D0,A0
+0x1d2a: JSR - "BCD_FROM_VAR"
+
+0x1d2e: JSR - "CAST_INT"
+
+0x1d32: POP.L - A0
+0x1d34: MOVE.W - D0,(A0)
+
+0x1d36: MOVEQ - 0x3,D0
+0x1d38: ADDQ.W - 0x1,var_i16_74
+0x1d3c: CMP.W - var_i16_74,D0
+0x1d40: BGE - [0x1ca8]
+
+0x1d44: MOVE.L - HEAP(0x41b0a),D0
+0x1d4e: PUSH.L - D0
+0x1d50: TRAP - _PaintOval
+0x1d52: MOVEQ - 0x2,D0
+0x1d54: ADDQ.W - 0x1,var_i16_3e2
+0x1d58: CMP.W - var_i16_3e2,D0
+0x1d5c: BGE - [0x1ca2]
+
+0x1d60: MOVEQ - 0x9,D0
+0x1d62: ADDQ.W - 0x1,var_i16_192
+0x1d66: CMP.W - var_i16_192,D0
+0x1d6a: BGE - [0x1c3e]
+
+0x1d6e: MOVE.L - HEAP(0x412ba),D0
+0x1d78: MOVEA.L - D0,A0
+0x1d7a: MOVE.L - (A0),D0
+0x1d7c: PUSH.L - D0
+0x1d7e: MOVE.L - HEAP(0x412be),D0
+0x1d88: MOVEA.L - D0,A0
+0x1d8a: MOVE.L - (A0),D0
+0x1d8c: PUSH.L - D0
+0x1d8e: MOVE.L - 0x5580,D0
+0x1d94: JSR - "BLOCKMOVE"
+
+0x1d98: MOVEQ - 0xa,D0
+0x1d9a: JSR - 128,0x1f4
+
+0x1d9e: MOVE.L - HEAP(0x41afc),D0
+0x1da8: PUSH.L - D0
+0x1daa: TRAP - _PaintOval
+0x1dac: MOVEQ - 0x5,D0
+0x1dae: JSR - 128,0x1f4
+
+0x1db2: MOVE.L - HEAP(0x1bc),D0
+0x1dbc: PUSH.L - D0
+0x1dbe: PUSH.W - 0xae
+0x1dc2: PUSH.W - 0x8c
+0x1dc6: PUSH.W - 0xb6
+0x1dca: PUSH.W - 0x94
+0x1dce: TRAP - _SetRect
+0x1dd0: MOVE.L - HEAP(0x1bc),D0
+0x1dda: PUSH.L - D0
+0x1ddc: TRAP - _InvertOval
+0x1dde: MOVE.L - HEAP(0x1bc),D0
+0x1de8: PUSH.L - D0
+0x1dea: PUSH.W - 0x151
+0x1dee: PUSH.W - 0x86
+0x1df2: PUSH.W - 0x159
+0x1df6: PUSH.W - 0x8e
+0x1dfa: TRAP - _SetRect
+0x1dfc: MOVE.L - HEAP(0x1bc),D0
+0x1e06: PUSH.L - D0
+0x1e08: TRAP - _InvertOval
+0x1e0a: PEA - VAR(0x32)
+0x1e0e: TRAP - _SetPortBits
+0x1e10: JSR - 128,0xe1c
+
+0x1e14: JSR - 128,0xe58
+
+0x1e18: PEA - [0x1e32]
+0x1e1c: PUSH.L - 0
+0x1e1e: PUSH.L - 0
+0x1e20: PUSH.L - 0x00000092
+0x1e26: PUSH.L - 0x00000187
+0x1e2c: MOVEQ - 0x2,D0
+0x1e2e: JMP - 128,0x2f0
+
+0x1e32: PEA - [0x1e54]
+0x1e36: PUSH.L - 0x00000128
+0x1e3c: PUSH.L - 0x0000015a
+0x1e42: PUSH.L - 0x00000152
+0x1e48: PUSH.L - 0x000001fc
+0x1e4e: MOVEQ - 0x2,D0
+0x1e50: JMP - 128,0x2f0
+
+0x1e54: MOVEQ - 0x0,D0
+0x1e56: MOVE.W - D0,var_i16_18e
+
+0x1e5a: MOVEQ - 0xa,D0
+0x1e5c: MOVE.W - D0,var_i16_74
+
+0x1e60: MOVE.L - 0x190,D0
+0x1e66: PUSH.L - D0
+0x1e68: MOVE.W - var_i16_74,D0
+0x1e6c: EXT.L - D0
+0x1e6e: ADDI.L - 0x0000000a,D0
+0x1e74: POP.L - D1
+0x1e76: JSR - "GET_FROM"
+
+0x1e7a: PUSH.L - 0x000001e6
+0x1e80: MOVE.W - var_i16_74,D0
+0x1e84: EXT.L - D0
+0x1e86: ADDI.L - 0x00000014,D0
+0x1e8c: PUSH.L - D0
+0x1e8e: MOVE.L - 0x1d8a8,D0
+0x1e94: PUSH.L - D0
+0x1e96: MOVE.W - var_i16_74,D0
+0x1e9a: EXT.L - D0
+0x1e9c: MOVE.L - D0,D1
+0x1e9e: MOVEQ - 0x32,D0
+0x1ea0: JSR - "MUL_INT"
+
+0x1ea4: POP.L - D1
+0x1ea6: ADD.L - D1,D0
+0x1ea8: LSL.L - 0x1,D0
+0x1eaa: ADDI.L - HEAP(0xb54),D0
+0x1eb4: MOVEA.L - D0,A0
+0x1eb6: POP.L - D0
+0x1eb8: POP.L - D1
+0x1eba: JSR - "GET_TO"
+
+0x1ebe: MOVEQ - 0x0,D0
+0x1ec0: MOVEA.W - var_i16_74,A0
+0x1ec4: ADD.L - A0,D0
+0x1ec6: LSL.L - 0x1,D0
+0x1ec8: ADDI.L - HEAP(0x1e8),D0
+0x1ed2: MOVEA.L - D0,A0
+0x1ed4: MOVE.W - 0x190,(A0)
+
+0x1ed8: ADDQ.W - 0x1,var_i16_18e
+0x1edc: CMPI.W - 0x4,var_i16_18e
+0x1ee2: BLE - [0x1eec]
+
+0x1ee6: MOVEQ - 0x1,D0
+0x1ee8: MOVE.W - D0,var_i16_18e
+
+0x1eec: MOVE.L - 0xfb,D0
+0x1ef2: MOVEA.W - var_i16_74,A0
+0x1ef6: ADD.L - A0,D0
+0x1ef8: LSL.L - 0x1,D0
+0x1efa: ADDI.L - HEAP(0x1e8),D0
+0x1f04: MOVEA.L - D0,A0
+0x1f06: MOVE.W - var_i16_18e,(A0)
+
+0x1f0a: ADDI.W - 0x000a,var_i16_74
+0x1f10: CMPI.W - 0x96,var_i16_74
+0x1f16: BLE - [0x1e60]
+
+0x1f1a: MOVEQ - 0x1,D0
+0x1f1c: MOVE.W - D0,var_i16_192
+
+0x1f20: CMPI.W - 0x9,var_i16_192
+0x1f26: BGE - [0x1f30]
+
+0x1f2a: PEA - VAR(0x38)
+0x1f2e: TRAP - _InverRect
+0x1f30: PUSH.L - 0 (unsafe)
+0x1f32: TRAP - _TickCount
+0x1f34: POP.L - D0
+0x1f36: MOVE.L - D0,var_i32_2
+
+0x1f3a: MOVEQ - 0xa,D0
+0x1f3c: MOVE.W - D0,var_i16_74
+
+0x1f40: MOVEQ - 0x0,D0
+0x1f42: MOVEA.W - var_i16_74,A0
+0x1f46: ADD.L - A0,D0
+0x1f48: LSL.L - 0x1,D0
+0x1f4a: ADDI.L - HEAP(0x1e8),D0
+0x1f54: MOVEA.L - D0,A0
+0x1f56: MOVE.W - (A0),D0
+0x1f58: EXT.L - D0
+0x1f5a: PUSH.L - D0
+0x1f5c: MOVE.W - var_i16_74,D0
+0x1f60: EXT.L - D0
+0x1f62: ADDI.L - 0x0000000a,D0
+0x1f68: POP.L - D1
+0x1f6a: JSR - "GET_FROM"
+
+0x1f6e: PUSH.W - 0
+0x1f70: MOVE.L - 0x1d8a8,D0
+0x1f76: PUSH.L - D0
+0x1f78: MOVE.W - var_i16_74,D0
+0x1f7c: EXT.L - D0
+0x1f7e: MOVE.L - D0,D1
+0x1f80: MOVEQ - 0x32,D0
+0x1f82: JSR - "MUL_INT"
+
+0x1f86: POP.L - D1
+0x1f88: ADD.L - D1,D0
+0x1f8a: LSL.L - 0x1,D0
+0x1f8c: ADDI.L - HEAP(0xb54),D0
+0x1f96: PUSH.L - D0
+0x1f98: MOVEQ - 0x6,D0
+0x1f9a: JSR - "ZBASIC_194"
+
+0x1f9e: MOVEQ - 0x0,D0
+0x1fa0: MOVEA.W - var_i16_74,A0
+0x1fa4: ADD.L - A0,D0
+0x1fa6: LSL.L - 0x1,D0
+0x1fa8: ADDI.L - HEAP(0x1e8),D0
+0x1fb2: PUSH.L - D0
+0x1fb4: MOVEQ - 0x0,D0
+0x1fb6: MOVEA.W - var_i16_74,A0
+0x1fba: ADD.L - A0,D0
+0x1fbc: LSL.L - 0x1,D0
+0x1fbe: ADDI.L - HEAP(0x1e8),D0
+0x1fc8: MOVEA.L - D0,A0
+0x1fca: MOVE.W - (A0),D0
+0x1fcc: EXT.L - D0
+0x1fce: PUSH.L - D0
+0x1fd0: MOVE.L - 0xfb,D0
+0x1fd6: MOVEA.W - var_i16_74,A0
+0x1fda: ADD.L - A0,D0
+0x1fdc: LSL.L - 0x1,D0
+0x1fde: ADDI.L - HEAP(0x1e8),D0
+0x1fe8: MOVEA.L - D0,A0
+0x1fea: MOVE.W - (A0),D0
+0x1fec: EXT.L - D0
+0x1fee: MOVE.L - D0,D1
+0x1ff0: MOVE.W - var_i16_192,D0
+0x1ff4: EXT.L - D0
+0x1ff6: JSR - "MUL_INT"
+
+0x1ffa: POP.L - D1
+0x1ffc: EXG - D0,D1
+0x1ffe: SUB.L - D1,D0
+0x2000: POP.L - A0
+0x2002: MOVE.W - D0,(A0)
+
+0x2004: MOVEQ - 0x0,D0
+
+ */
+
+
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index a9969414a2d..3766ca5d558 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -33,6 +33,11 @@ public:
FoolPrologue();
~FoolPrologue();
+ int32 var_i32_32; // pointer to bitmap
+ int32 var_i32_38; // pointer to rect
+ int32 var_i32_40; // pointer to bitmap
+ int32 var_i32_4e; // pointer to bitmap
+
void run();
};
Commit: 23fbab5097ebd5739ef314b808fe5d613a72a958
https://github.com/scummvm/scummvm/commit/23fbab5097ebd5739ef314b808fe5d613a72a958
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:44+02:00
Commit Message:
FOOL: Even more porting
Changed paths:
A engines/fool/zbasic.cpp
A engines/fool/zbasic.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/module.mk
engines/fool/toolbox.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 4b5210f2d4c..b6af19b551a 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -19,18 +19,21 @@
*
*/
-#include <cstdint>
-#include <cstdlib>
#include "fool/fool_prologue.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
#include "common/str.h"
namespace Fool {
+ZBasic *g_zbasic;
+Toolbox *g_toolbox;
+
void FoolPrologue::run() {
// 128:0004
- zbasic_176();
+ g_zbasic->unk_176();
g_toolbox->ClearMenuBar();
g_toolbox->HideCursor();
g_toolbox->UseResFile(g_toolbox->CurResFile());
@@ -62,9 +65,13 @@ void FoolPrologue::run() {
this->arr_i16_194[0x13] = 0x2200;
// 128:017a
- this->var_str_76 = STR(0x0);
- this->var_str_76 = STR(0x2c);
- this->var_str_76 = STR(0x62);
+ this->var_str_76 = Common::String(_("© 1987 by Cliff Johnson ALL RIGHTS RESERVED"));
+ g_zbasic->buffer_flush(this->var_str_76);
+ this->var_str_76 = Common::String(_("This software was created using the ZBasic⢠compiler."));
+ g_zbasic->buffer_flush(this->var_str_76);
+ this->var_str_76 = Common::String(_("Portions of this code are © Copyrighted, 1985 by Zedcor Inc."));
+ g_zbasic->buffer_flush(this->var_str_76);
+
// 128:01b6
// JMP 0x1f0
// JMP 0x21a
@@ -319,19 +326,19 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
void FoolPrologue::sub_128_c8a() {
// 128:0c8a
this->sub_129_004();
- this->var_i32_1a6 = zbasic_mem(-1);
+ this->var_i32_1a6 = g_zbasic->mem(-1);
if (this->var_i16_1aa == 1) {
this->sub_130_004();
- this->var_i32_1a6 = zbasic_mem(-1);
+ this->var_i32_1a6 = g_zbasic->mem(-1);
}
// 128:0cb0
if (this->var_i16_1aa == 2) {
this->sub_131_004();
- this->var_i32_1a6 = zbasic_mem(-1);
+ this->var_i32_1a6 = g_zbasic->mem(-1);
}
// 128:0cc8
- zbasic_unk4();
- zbasic_20();
+ g_zbasic->unk4();
+ g_zbasic->20();
this->arr_i32_1ac = this->arr_i32_41598;
this->arr_i32_1b0 = this->arr_i32_41846;
this->var_i16_1b4 = this->var_i16_18e * 2 + 2;
@@ -344,22 +351,22 @@ void FoolPrologue::sub_128_c8a() {
this->var_i16_1b6 = _vm->_rnd->getRandomNumber(i);
this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
- zbasic_blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8);
- zbasic_blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8);
+ g_zbasic->blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8);
+ g_zbasic->blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8);
}
}
void FoolPrologue::sub_128_de2() {
// 128:0de2
- zbasic_text(0xfb, 0x9, 0x0, 0x2);
+ g_zbasic->text(0xfb, 0x9, 0x0, 0x2);
this->var_str_76 = STR(0xa0); // "Click Mouse to Continue"
this->sub_128_a6c(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
- zbasic_text(0xfb, 0x9, 0x0, 0x2);
+ g_zbasic->text(0xfb, 0x9, 0x0, 0x2);
this->var_str_76 = "Click Mouse to Continue"; // STR(0xb8)
this->sub_128_26c(0x154, 0x1f7);
}
@@ -402,11 +409,11 @@ void FoolPrologue::sub_128_ee0() {
// done by using PEEKWORD into fixed offsets of the window pointer
this->var_i16_1bc = this->var_window_24.port; // +0
this->var_i16_1be = this->var_window_24.windowKind; // +2
- zbasic_unk11(this->var_i16_1be);
+ g_zbasic->unk11(this->var_i16_1be);
}
void FoolPrologue::sub_128_f0a() {
- zbasic_199(0x80); // switch CODE resource?
+ g_zbasic->199(0x80); // switch CODE resource?
this->sub_129_004();
}
@@ -446,8 +453,8 @@ void FoolPrologue::sub_129_004() {
this->var_i16_16 = (this->var_i16_12 - SCREEN_HEIGHT)/2;
// 129:0064
- zbasic_window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, 3);
- zbasic_coordinate_window();
+ g_zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, 3);
+ g_zbasic->coordinate_window();
this->var_i16_1c = 0;
this->var_i16_1e = 0;
@@ -511,20 +518,20 @@ void FoolPrologue::sub_129_004() {
this->var_i16_58 = SCREEN_HEIGHT;
this->var_i16_5a = SCREEN_WIDTH;
- this->var_i32_1c0 = zbasic_mem(-1);
+ this->var_i32_1c0 = g_zbasic->mem(-1);
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
- zbasic_get_from(0x0, 0x14);
- zbasic_get_to(0x1fc, 0x152, this->arr_i32_b54);
- zbasic_unk6(0x19, 0x64, 0xff, 0x0);
+ g_zbasic->get_from(0x0, 0x14);
+ g_zbasic->get_to(0x1fc, 0x152, this->arr_i32_b54);
+ g_zbasic->unk6(0x19, 0x64, 0xff, 0x0);
this->sub_128_2f0(2, 0x46, 0x64, 0xd8, 0x198);
this->sub_128_2f0(1, 0x4b, 0x69, 0xd3, 0x193);
// 129:0386
this->sub_128_2f0(2, 0x50, 0x6e, 0xc3, 0x18e);
- zbasic_text(0, 0xc, 0, 3);
+ g_zbasic->text(0, 0xc, 0, 3);
this->var_str_76 = STR(0xd2); // 'There is not enough available memory'
this->sub_128_2a6(0x64, 0xfc);
this->var_str_76 = STR(0xf8); // 'to run the program at this time.'
@@ -536,21 +543,21 @@ void FoolPrologue::sub_129_004() {
this->var_str_76 = STR(0x156); // '(click mouse to quit)'
this->sub_128_2a6(0xcb, 0xfc);
this->sub_128_e58();
- zbasic_get_from(0x0, 0x14);
+ g_zbasic->get_from(0x0, 0x14);
- zbasic_194(0, 0, this->arr_i32_b54);
+ g_zbasic->194(0, 0, this->arr_i32_b54);
this->var_i16_1aa = 0;
} else {
// 129:04a0
this->var_i16_180 = 1;
this->var_i16_1aa = 1;
- this->var_i16_176 = zbasic_249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
- if (zbasic_106(STR(0x16c), &this->var_i16_1c4)) {
+ this->var_i16_176 = g_zbasic->249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
+ if (g_zbasic->106(STR(0x16c), &this->var_i16_1c4)) {
// 129:04de
this->var_str_76 = STR(0x16e); // "And now it is time to show the Finale for the Fool's Errand."
for (int i = 1; i < 0xa; i++) {
- this->var_str_76 += zbasic_chr(this->var_i16_74);
+ this->var_str_76 += g_zbasic->chr(this->var_i16_74);
}
// 129:0522
@@ -561,15 +568,15 @@ void FoolPrologue::sub_129_004() {
// 0x0534: LEA - [0x0764],A0
// 0x0538: MOVE.L - A0,-0x8ee(A5)
// 0x053c: SF - 0x8,D0
- zbasic_135(1, &this->var_i16_1c4, 0x3fc, this->var_i16_2c8);
+ g_zbasic->135(1, &this->var_i16_1c4, 0x3fc, this->var_i16_2c8);
// 0x0554: MOVEQ - 0x1,D0
// 0x0556: MOVE.W - D0,-0x914(A5)
- zbasic_163(&this->var_i16_2ce, this->var_i16_2ca);
- zbasic_close(1);
+ g_zbasic->163(&this->var_i16_2ce, this->var_i16_2ca);
+ g_zbasic->close(1);
// 0x0570: CLR.L - -0x8ee(A5)
// 128:0582
- if (zbasic_103(&this->var_i16_2ce, &this->var_str_76) &&
+ if (g_zbasic->103(&this->var_i16_2ce, &this->var_str_76) &&
this->var_i16_2cc == 0) {
this->var_i16_1aa = 2;
} else {
@@ -580,14 +587,14 @@ void FoolPrologue::sub_129_004() {
// 129:05a6
if (this->var_i16_1c + this->var_i16_20 + this->var_i16_1e != 0) {
g_toolbox->InitCursor();
- zbasic_get_from(0x0, 0x14);
- zbasic_get_to(0x1fc, 0x152, this->arr_i32_b54);
- zbasic_unk6(0x19, 0x64, 0xff, 0x00);
+ g_zbasic->get_from(0x0, 0x14);
+ g_zbasic->get_to(0x1fc, 0x152, this->arr_i32_b54);
+ g_zbasic->unk6(0x19, 0x64, 0xff, 0x00);
this->sub_128_2f0(2, 0x64, 0x7e, 0xd8, 0x17a);
this->sub_128_2f0(1, 0x69, 0x83, 0xd3, 0x175);
this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
// 129:0662
- zbasic_text(0, 0xc, 0, 0x3);
+ g_zbasic->text(0, 0xc, 0, 0x3);
this->var_str_76 = STR(0x1ac); // 'Set your monitor to'
this->sub_128_2a6(0x82, 0xfc);
this->var_str_76 = STR(0x1c0); // '2 color black and white'
@@ -603,15 +610,15 @@ void FoolPrologue::sub_129_004() {
this->sub_128_2a6(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
- zbasic_get_from(0x0, 0x14);
- zbasic_194(0x0, 0x0, this->arr_i32_b54);
+ g_zbasic->get_from(0x0, 0x14);
+ g_zbasic->194(0x0, 0x0, this->arr_i32_b54);
this->var_i16_1aa = 0;
} else {
// 129:075c
this->sub_128_e80();
}
// 129:0772
- zbasic_199(0x81);
+ g_zbasic->199(0x81);
this->sub_130_004();
}
@@ -620,11 +627,11 @@ void FoolPrologue::sub_129_004() {
void FoolPrologue::sub_129_764() {
// 129:0764
this->var_i16_2cc = 1;
- zbasic_130(0);
+ g_zbasic->unk_130(0);
}
void FoolPrologue::sub_129_772() {
- zbasic_199(0x81);
+ g_zbasic->unk_199(0x81);
this->sub_130_004();
}
@@ -641,11 +648,11 @@ void FoolPrologue::sub_130_004() {
this->sub_130_d28();
this->sub_128_1f4(0xb);
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0x74, 0xaa, 0x00, 0x00, this->glob_i32_2ce);
+ g_zbasic->picture(0x74, 0xaa, 0x00, 0x00, this->glob_i32_2ce);
g_toolbox->ReleaseResource(*this->glob_i32_2ce);
// 130:007a
- zbasic_text(0xfb, 0x9, 0x0, 0x3);
+ g_zbasic->text(0xfb, 0x9, 0x0, 0x3);
this->var_str_76 = STR(0x228);
this->sub_128_2a6(0x10d, 0xdd);
g_toolbox->SetPortBits(&this->var_i32_32);
@@ -656,39 +663,39 @@ void FoolPrologue::sub_130_004() {
// 130:00d6
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0, 0x96, 0, this->arr_u8_4);
+ g_zbasic->picture(0, 0x96, 0, this->arr_u8_4);
g_toolbox->ReleaseResource(*this->arr_u8_4);
this->sub_128_1f4(8);
// 130:011c
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0, 0x96, 0, this->arr_u8_8);
+ g_zbasic->picture(0, 0x96, 0, this->arr_u8_8);
g_toolbox->ReleaseResource(*this->arr_u8_8);
// 130:015c
for (int i = 3; i < 5; i++) {
- zbasic_blockmove(this->arr_i32_412b2[0], this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockmove(this->arr_i32_412b2[0], this->arr_i32_41296[i], 0x5580);
}
this->sub_130_cea();
this->sub_128_1f4(0);
// 130:01aa
- zbasic_picture(0, 0, 0, this->arr_u8_18);
+ g_zbasic->picture(0, 0, 0, this->arr_u8_18);
g_toolbox->ReleaseResource(*this->arr_u8_18);
this->sub_130_cea();
- zbasic_blockmove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
+ g_zbasic->blockmove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
this->sub_128_1f4(1);
// 130:0202
- zbasic_picture(0xa2, 0x3c, 0, this->arr_u8_1c);
+ g_zbasic->picture(0xa2, 0x3c, 0, this->arr_u8_1c);
g_toolbox->ReleaseResource(*this->arr_u8_1c);
this->sub_130_cea();
this->sub_128_1f4(2);
// 130:0234
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0x5a, 0x2e, 0, this->arr_u8_20);
+ g_zbasic->picture(0x5a, 0x2e, 0, this->arr_u8_20);
g_toolbox->ReleaseResource(*this->arr_u8_20);
// 130:0276
@@ -703,8 +710,8 @@ void FoolPrologue::sub_130_004() {
// 130:029a
this->sub_128_1f4(j - 6);
- zbasic_picture(0, 0, 0, this->arr_i32_0[j]);
- zbasic_picture(this->var_i16_74, 0x96, 0, this->arr_i32_0[j - 6]);
+ g_zbasic->picture(0, 0, 0, this->arr_i32_0[j]);
+ g_zbasic->picture(this->var_i16_74, 0x96, 0, this->arr_i32_0[j - 6]);
g_toolbox->ReleaseResource(*this->arr_i32_0[j]);
g_toolbox->ReleaseResource(*this->arr_i32_0[j - 6]);
}
@@ -712,7 +719,7 @@ void FoolPrologue::sub_130_004() {
// 130:0320
this->sub_128_1f4(6);
- zbasic_picture(0, 0, 0, this->arr_i32_0[0xc]);
+ g_zbasic->picture(0, 0, 0, this->arr_i32_0[0xc]);
g_toolbox->ReleaseResource(*this->arr_i32_0[0xc]);
// 130:034a
@@ -724,7 +731,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->SetPortBits(&this->var_i32_32);
// 130:0380
- if ((this->var_i16_10 == 0x200) && (this->var_i16_12 == 0x156)) {
+ if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == 0x156)) {
this->sub_128_2f0(1, 0, 0, 0x14, 0x1fc);
} else {
g_toolbox->SetPort(this->var_i32_c);
@@ -738,7 +745,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_610(0xb);
this->sub_128_21e(0x5a);
this->sub_130_db0();
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, 0x200, 0x156);
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, 0x200, 0x118);
// 130:043c
@@ -787,7 +794,7 @@ void FoolPrologue::sub_130_004() {
// 130:062c
this->var_i16_74 = 0;
while (this->var_i16_74 != 0x156) {
- this->var_i16_62 = 0x200;
+ this->var_i16_62 = SCREEN_WIDTH;
this->var_i32_2 = g_toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
this->var_i16_192 = 1;
@@ -834,35 +841,35 @@ void FoolPrologue::sub_130_004() {
}
// 130:07ec
this->sub_128_610(6);
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, 0x200, 0x156);
+ g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i < 0x2d; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_24a(1);
}
// 130:083c
- zbasic_picture(0, 0, 0, this->arr_i32_34);
- zbasic_picture(5, 0, 0, this->arr_i32_38);
+ g_zbasic->picture(0, 0, 0, this->arr_i32_34);
+ g_zbasic->picture(5, 0, 0, this->arr_i32_38);
g_toolbox->ReleaseResource(*this->arr_i32_34);
g_toolbox->ReleaseResource(*this->arr_i32_38);
this->var_i32_2 = g_toolbox->TickCount();
// 130:0890
- zbasic_52(0);
+ g_zbasic->52(0);
this->sub_128_1f4(0);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0, 0x17, 0, this->arr_i32_3c);
+ g_zbasic->picture(0, 0x17, 0, this->arr_i32_3c);
g_toolbox->ReleaseResource(*this->arr_i32_3c);
// 130:08dc
this->sub_130_f48();
this->sub_128_de2();
this->sub_128_1f4(1);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0xf0, 0xba, 0, this->arr_i32_40);
+ g_zbasic->picture(0xf0, 0xba, 0, this->arr_i32_40);
g_toolbox->ReleaseResource(*this->arr_i32_40);
this->sub_130_f48();
this->sub_128_de2();
// 130:0934
for (int i = 2; i < 5; i++) {
- zbasic_blockmove(*this->arr_i32_4129a, this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockmove(*this->arr_i32_4129a, this->arr_i32_41296[i], 0x5580);
}
// 130:0978
for (int i = 1; i < 5; i++) {
@@ -881,18 +888,18 @@ void FoolPrologue::sub_130_004() {
// 130:0a42
this->sub_128_1f4(6);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- zbasic_picture(0x166, 0x77, 0, this->arr_i32_44);
+ g_zbasic->picture(0x166, 0x77, 0, this->arr_i32_44);
this->sub_128_de2();
- zbasic_blockmove(*this->arr_i32_412ae, *this->arr_i32_412b2, 0x5580);
+ g_zbasic->blockmove(*this->arr_i32_412ae, *this->arr_i32_412b2, 0x5580);
this->sub_130_f48();
g_toolbox->ReleaseResource(*this->arr_i32_44);
this->sub_128_1f4(7);
// 130:0ac2
- zbasic_picture(-0x14, -0x1e, 0, this->arr_i32_48);
+ g_zbasic->picture(-0x14, -0x1e, 0, this->arr_i32_48);
this->sub_128_1f4(8);
- zbasic_blockmove(*this->arr_i32_412b2, *this->arr_i32_412b6, 0x5580);
+ g_zbasic->blockmove(*this->arr_i32_412b2, *this->arr_i32_412b6, 0x5580);
this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
- zbasic_picture(0x16d, 0x80, 0, this->arr_i32_120);
+ g_zbasic->picture(0x16d, 0x80, 0, this->arr_i32_120);
g_toolbox->ReleaseResource(*this->arr_i32_120);
g_toolbox->SetPortBits(&this->var_i32_32);
// 130:0b74
@@ -953,7 +960,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_354(8, 1);
// 130:0ce6
// JMP 1002
- zbasic_199(0x82);
+ g_zbasic->199(0x82);
this->sub_131_004();
}
@@ -969,7 +976,7 @@ void FoolPrologue::sub_130_cea() {
void FoolPrologue::sub_130_d28() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
- zbasic_text(0, 0xc, 0, 0x1);
+ g_zbasic->text(0, 0xc, 0, 0x1);
this->var_str_76 = STR(0x256); // 'Loading Prologue -'
this->var_str_76 += Common::String::format("%d", this->var_i16_3ce);
this->var_str_76 += STR(0x26a); // '%'
@@ -981,7 +988,7 @@ void FoolPrologue::sub_130_d28() {
void FoolPrologue::sub_130_db0() {
// 130:0db0
- zbasic_20();
+ g_zbasic->20();
g_toolbox->PenMode(0xa);
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
@@ -1009,13 +1016,13 @@ void FoolPrologue::sub_130_e82() {
void FoolPrologue::sub_130_f48() {
// 130:0f48
- this->var_i16_3d2 = zbasic_read_as_int();
+ this->var_i16_3d2 = g_zbasic->read_as_int();
this->var_i16_74 = 1;
while (this->var_i16_74 <= this->var_i16_3d2) {
// 130:0f56
- this->var_i16_176 = zbasic_read_as_int();
- this->var_i16_180 = zbasic_read_as_int();
- this->var_str_76 = zbasic_read_as_str();
+ this->var_i16_176 = g_zbasic->read_as_int();
+ this->var_i16_180 = g_zbasic->read_as_int();
+ this->var_str_76 = g_zbasic->read_as_str();
this->var_i16_1ba = 1;
// JMP 0xfc2
@@ -1027,7 +1034,7 @@ void FoolPrologue::sub_130_f48() {
}
}
// 130:0fc8
- zbasic_text(0xfa, 0xc, 0, 0x1);
+ g_zbasic->text(0xfa, 0xc, 0, 0x1);
this->sub_128_a6c(this->var_i16_180, this->var_i16_176);
this->var_i16_74 += 1;
}
@@ -1035,7 +1042,7 @@ void FoolPrologue::sub_130_f48() {
void FoolPrologue::sub_130_1002() {
// 130:1002
- zbasic_199(0x82);
+ g_zbasic->199(0x82);
this->sub_131_004();
}
@@ -1053,7 +1060,7 @@ void FoolPrologue:::sub_131_004() {
// 131:004c
this->arr_i32_7c = g_toolbox->GetPicture(0x1f);
this->sub_128_1f4(0x4);
- zbasic_picture(0x0, 0x0, -1, 0x0, this->arr_i32_7c);
+ g_zbasic->picture(0x0, 0x0, -1, 0x0, this->arr_i32_7c);
g_toolbox->ReleaseResource(*this->arr_i32_7c);
this->sub_131_4dc0();
for (int i = 0x14; i < 0x1e; i++) {
@@ -1070,13 +1077,13 @@ void FoolPrologue:::sub_131_004() {
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
// 131:0110
if (i < 8) {
- zbasic_picture(0, 0x3, -1, 0, this->arr_i32_64);
+ g_zbasic->picture(0, 0x3, -1, 0, this->arr_i32_64);
}
if (i == 8) {
- zbasic_picture(0, 0, -1, 0, this->arr_i32_68);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_68);
}
if (i == 9) {
- zbasic_picture(0x60, 0x4c, -1, 0, this->arr_i32_6c);
+ g_zbasic->picture(0x60, 0x4c, -1, 0, this->arr_i32_6c);
}
}
// 131:0184
@@ -1086,8 +1093,8 @@ void FoolPrologue:::sub_131_004() {
// 131:01aa
this->arr_i32_4c = g_toolbox->GetPicture(0x13);
this->sub_128_1f4(0x5);
- zbasic_picture(0, 0xb4, -1, 0, this->arr_i32_4c);
- zbasic_picture(0, 0, -1, 0, this->arr_i32_60);
+ g_zbasic->picture(0, 0xb4, -1, 0, this->arr_i32_4c);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_60);
g_toolbox->ReleaseResource(*this->arr_i32_4c);
g_toolbox->ReleaseResource(*this->arr_i32_60);
this->sub_131_4e98();
@@ -1104,7 +1111,7 @@ void FoolPrologue:::sub_131_004() {
// 131:026e
this->var_i16_18e = 0x156;
this->sub_128_ccc();
- this->var_i32_1a6 = zbasic_mem(-1);
+ this->var_i32_1a6 = g_zbasic->mem(-1);
g_toolbox->SetPortBits(&this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var-i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
@@ -1119,17 +1126,17 @@ void FoolPrologue:::sub_131_004() {
this->sub_128_6e4(0x5);
this->sub_128_e58();
this->sub_131_4e98();
- zbasic_52(0x4c);
+ g_zbasic->52(0x4c);
for (int j = 1; j < 0xe; j++) {
this->var_i16_3da = 1;
// 131:030c
- this->var_i16_18e = zbasic_read_as_int();
+ this->var_i16_18e = g_zbasic->read_as_int();
for (int i = 1; i < this->var_i16_18e; i++) {
// 131:031a
- this->arr_i16_1e8[i] = zbasic_read_as_int();
- this->arr_i16_1e8[i + 0xfb] = zbasic_read_as_int();
- this->arr_i16_1e8[i + 0x1f6] = zbasic_read_int();
+ this->arr_i16_1e8[i] = g_zbasic->read_as_int();
+ this->arr_i16_1e8[i + 0xfb] = g_zbasic->read_as_int();
+ this->arr_i16_1e8[i + 0x1f6] = g_zbasic->read_int();
}
// 131:0380
@@ -1146,23 +1153,24 @@ void FoolPrologue:::sub_131_004() {
// 131:03c0
this->sub_128_21e(0x1e);
- zbasic_text(0xfa, 0xc, 0, 1);
+ g_zbasic->text(0xfa, 0xc, 0, 1);
this->var_str_76 = Common::String::format("\"%s\"", _("Well. . . that's that!"));
+ g_zbasic->buffer_flush(this->var_str_76);
// 131:0400
this->sub_128_a6c(0x178, 0xb4);
this->sub_128_21e(0x1e);
// 131:041a
- zbasic_picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
+ g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
this->sub_128_21e(0x2);
- zbasic_picture(0x1cd, 0xbf, -1, 0, this->arr_u8_54);
+ g_zbasic->picture(0x1cd, 0xbf, -1, 0, this->arr_u8_54);
this->sub_128_21e(0x3c);
- zbasic_picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
+ g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
this->sub_128_21e(0x6);
- zbasic_picture(0x1a6, 0xbf, -1, 0, this->arr_u8_58);
+ g_zbasic->picture(0x1a6, 0xbf, -1, 0, this->arr_u8_58);
this->sub_128_21e(0x6);
- zbasic_picture(0x1b3, 0xc5, -1, 0, this->arr_u8_5c);
+ g_zbasic->picture(0x1b3, 0xc5, -1, 0, this->arr_u8_5c);
// 131:04b4
for (int i = 0x14; i < 0x17; i++) {
@@ -1198,8 +1206,8 @@ void FoolPrologue:::sub_131_004() {
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
- zbasic_get_from(0x1bc, 0xc1);
- zbasic_get_to(0x1ee, 0x117, this->arr_i32_3bca4);
+ g_zbasic->get_from(0x1bc, 0xc1);
+ g_zbasic->get_to(0x1ee, 0x117, this->arr_i32_3bca4);
this->sub_128_24a(0x3c);
this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_128_50a(0x6, 0, 0x1fc, 0x3);
@@ -1213,7 +1221,7 @@ void FoolPrologue:::sub_131_004() {
this->sub_128_50a(0x9, 0, 0x1fc, 1);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
- zbasic_20();
+ g_zbasic->20();
// 131:0730
this->var_i16_3dc = 0;
@@ -1221,14 +1229,14 @@ void FoolPrologue:::sub_131_004() {
for (int j = 1; j < 0x63; j++) {
if (this->var_i16_3dc > 0x156) {
// 131:074e
- this->var_i16_3dc += zbasic_maybe() ? 0x4 : 0x5;
+ this->var_i16_3dc += g_zbasic->maybe() ? 0x4 : 0x5;
}
if (this->var_i16_18e > 0x41) {
// 131:0770
this->var_i16_18e += 1;
- this->arr_i16_1e8[this->var_i16_18e] = zbasic_rnd_int(32);
- this->arr_i16_1e8[this->var_i16_18e+0xfb] = zbasic_rnd_int(this->var_i16_3dc);
- this->arr_i16_1e8[this->var_i16_18e+0x1f6] = zbasic_rnd_int(0xa) + 0xa;
+ this->arr_i16_1e8[this->var_i16_18e] = g_zbasic->rnd_int(32);
+ this->arr_i16_1e8[this->var_i16_18e+0xfb] = g_zbasic->rnd_int(this->var_i16_3dc);
+ this->arr_i16_1e8[this->var_i16_18e+0x1f6] = g_zbasic->rnd_int(0xa) + 0xa;
this->sub_131_4f96();
}
// 131:07ea
@@ -1237,10 +1245,10 @@ void FoolPrologue:::sub_131_004() {
this->arr_i16_1e8[i] = ((this->arr_i16_1e8[i] + this->arr_i16_1e8[0x1f6+i]) + this->arr_i16_1e8[0x1f6+i]);
// 131:0870
- if (this->arr_i16_1e8[i] < 0x200) {
+ if (this->arr_i16_1e8[i] < SCREEN_WIDTH) {
this->arr_i16_1e8[i] = 1;
- this->arr_i16_1e8[0xfb+i] = zbasic_rnd_int(this->var_i16_3dc);
- this->arr_i16_1e8[0x1f6+i] = zbasic_rnd_int(0xa) + 0xa;
+ this->arr_i16_1e8[0xfb+i] = g_zbasic->rnd_int(this->var_i16_3dc);
+ this->arr_i16_1e8[0x1f6+i] = g_zbasic->rnd_int(0xa) + 0xa;
}
@@ -1253,10 +1261,282 @@ void FoolPrologue:::sub_131_004() {
// 131:0926
g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->PenPat(this->arr_i32_1ac);
- zbasic_picture(0x6d, 0x49, -1, 0, this->arr_i32_70);
- zbasic_picture(0x65, 0x48, -1, 0, this->arr_i32_74);
- zbasic_picture(0x64, 0x54, -1, 0, this->arr_i32_78);
+ g_zbasic->picture(0x6d, 0x49, -1, 0, this->arr_i32_70);
+ g_zbasic->picture(0x65, 0x48, -1, 0, this->arr_i32_74);
+ g_zbasic->picture(0x64, 0x54, -1, 0, this->arr_i32_78);
// 131:099c
+
+ g_toolbox->PaintPoly(this->var_i32_3d6);
+ for (int i = 0; i < 0x21; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->InverRect(this->arr_i32_1bc);
+ this->sub_128_24a(1);
+ }
+
+ // 131:09d2
+ this->sub_128_800(0xbd, 0x1b8, 0x117, 0x1ee, 0, 0, 0x152, 0x1fc, 0x21);
+ this->sub_128_800(0x152, 0, 0x152, 0, 0, 0, 0x152, 0x1fc, 0x21);
+ this->sub_128_800(0, 0, 0, 0, 0, 0, 0x152, 0x1fc, 0x21);
+ this->sub_128_800(0, 0x1fc, 0, 0x1fc, 0, 0, 0x152, 0x1fc, 0x21);
+
+ // 131:0a7a
+ for (int i = 1; i < 0x63; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i16_74 = g_zbasic->rnd_int(0x1ca);
+ this->var_i16_192 = g_zbasic->rnd_int(0xfc);
+ g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
+ g_zbasic->194(0, this->arr_i32_3bca4, 0);
+ g_toolbox->InverRect(this->arr_i32_1bc);
+ this->sub_128_24a(1);
+ }
+
+ // 131:0aec
+ this->var_i32_2 = g_toolbox->TickCount();
+
+ // 131:0af6
+ while (g_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
+ this->var_i16_74 = g_zbasic->rnd_int(0x1ca);
+ this->var_i16_192 = g_zbasic->rnd_int(0xfc);
+ g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
+ g_zbasic->get_to(this->var_i16_74 + 0x36, this->var_16192 + 0x5a, this->arr_i32_3bca4);
+
+ // 131:0b54
+ this->var_i16_74 = g_zbasic->rnd_int(0x1ca);
+ this->var_i16_192 = g_zbasic->rnd_int(0xfc);
+ g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
+ g_zbasic->194(0, this->arr_i32_3bca4, 0);
+ }
+
+ // 131:0bb0
+ this->sub_128_50a(4, 0, 0x1fc, 3);
+ this->sub_128_1ba(5);
+ g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_94);
+ g_toolbox->SetPortBits(this->var_i32_32);
+ this->sub_128_21e(0x3c);
+ g_zbasic->picture(0x197, 0x101, -1, 0, this->arr_i32_98);
+
+ // 131:0c36
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->KillPoly(this->var_i32_3d6);
+ for (int i = 0x1c; i < 0x1e; i++) {
+ g_toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+
+ // 131:0c6c
+ for (int i = 0x6; i < 0xa; i++) {
+ g_zbasic->blockmove(*this->arr_i32_412aa, this->arr_i32_41296[i], 0x5580);
+ }
+ this->sub_128_1f4(0x6);
+ g_zbasic->picture(0x6, 0x8f, -1, 0, this->arr_i32_80);
+ this->sub_128_1f4(0x7);
+ g_zbasic->picture(0x1a, 0x7e, -1, 0, this->arr_i32_84);
+ this->sub_128_1f4(0x8);
+ g_zbasic->picture(0x2e, 0x6a, -1, 0, this->arr_i32_88);
+ this->sub_128_1f4(0x9);
+ g_zbasic->picture(0x45, 0x4e, -1, 0, this->arr_i32_8c);
+ this->sub_128_1f4(0xa);
+ g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_90);
+
+ // 131:0d64
+ for (int i = 0x20; i < 0x23; i++) {
+ g_toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+ g_toolbox->SetPortBits(this->var_i32_32);
+ this->sub_128_24a(0x64);
+ g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_94);
+ for (int i = 0x6; i < 0xa; i++) {
+ this->sub_128_21e(0xf);
+ this->sub_128_50a(i, 0, 0x1fc, 1);
+ }
+ g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_9c);
+ this->sub_128_21e(0x3c);
+
+ // 131:0e08
+ g_zbasic->text(0xfa, 0xc, 0, 0x3);
+ this->var_str_76 = Common::String::format("\"%s\"", _("Are you still angry with me?"));
+ g_zbasic->buffer_flush(this->var_str_76);
+ this->sub_128_a6c(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
+ this->var_i32_2 = g_toolbox->TickCount();
+
+ // 131:0e76
+ g_zbasic->blockmove(this->arr_i32_412a6, this->arr_i32_412aa, 0x5580);
+ this->sub_128_1f4(0x5);
+ g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_90);
+ g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_9c);
+ g_zbasic->picture(0x8a, 0x24, -1, 0, this->arr_i32_a0);
+ this->sub_128_1f4(0x6);
+ this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
+ g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_a4);
+ this->sub_128_1f4(0x7);
+ this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
+ g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_a8);
+ g_zbasic->blockmove(this->arr_i32_412aa, this->arr_i32_412b6, 0x5580);
+ this->sub_128_1f4(0x8);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+ g_zbasic->blockmove(this->arr_i32_412a6, this->arr_i32_412ba, 0x5580);
+ this->sub_128_1f4(0x9);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+ this->sub_128_1f4(0xa);
+ this->sub_128_2f0(0, 0, 0x152, 0x1fc, 2);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+
+ // 131:1056
+ g_toolbox->ReleaseResource(this->arr_i32_90);
+ g_toolbox->SetPortBits(this->var_i32_32);
+ this->sub_128_24a(0x78);
+ this->sub_128_2f0(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
+ this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
+ this->sub_128_21e(0x28);
+
+ this->var_i16_5e = 0x118;
+ this->var_i16_62 = 0x1d1;
+ this->var_i16_5c = 0x19;
+ this->var_i16_66 = 0x118;
+ this->var_i16_6a = 0x1d1;
+ this->var_i16_68 = 0xdf;
+
+ for (int i = 0xdc; i > 0x19; i -= 5) {
+ // 131:10de
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_zbasic->blockmove(this->arr_i32_412aa, this->var_i32_4e, 0x5580);
+ this->var_i16_64 = i;
+ this->var_i16_60 = 0x19 + (i - 0xdf);
+ this->var_i32_40 = *this->arr_i32_412ae;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i32_5c, this->var_i32_64, 3, 0);
+ this->var_i32_40 = *this->arr_i32_412b2;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i32_5c, this->var_i32_64, 1, 0);
+ this->sub_128_24a(0x2);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i32_64, this->var_i32_64, 0, 0);
+ }
+
+ // 131:11a4
+ this->sub_128_1ba(0x5);
+ this->sub_128_1f4(0x5);
+ this->sub_128_2f0(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+ g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(0xa);
+ g_toolbox->PenSize(0x5, 0x5);
+
+ // 131:1208
+ for (int i = 0; i < 0x1b8; i += 6) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_toolbox->MoveTo(0x172, 0x33);
+ g_toolbox->LineTo(i, 0x14a);
+ if (i == 0x43) {
+ g_zbasic->text(0xfa, 0xc, 0, 0x3);
+ this->var_str_76 = Common::String::format("\"%s\"", _("Yes, apparently so. . ."));
+ g_zbasic->buffer_flush(this->var_str_76);
+ this->sub_127_26c(0x1f0, 0xd2);
+ g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_94);
+ }
+ this->sub_127_24a(0x2);
+ g_toolbox->MoveTo(0x172, 0x33);
+ g_toolbox->LineTo(i, 0x14a);
+ }
+
+ // 131:12cc
+ this->sub_128_800(0x146, 0x1b4, 0x146, 0x1b4, 0xbc, 0x18b, 0x152, 0x1e2, 0x10);
+ this->sub_128_50a(0x5, 0x128, 0x1fc, 0x1);
+ this->sub_128_21e(0xec);
+ for (int i = 8; i < 0xa; i++) {
+ this->sub_128_50a(i, 0, 0x1fc, 1);
+ }
+
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->sub_128_1f4(0x5);
+
+ this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_bc);
+ g_toolbox->SetPortBits(this->var_i32_32);
+ this->sub_128_24a(0xa);
+ this->var_i16_5e = 0x18b;
+ this->var_i16_62 = 0x1ef;
+ this->var_i16_66 = 0x18b;
+ this->var_i16_6a = 0x1ef;
+
+ // 131:13b8
+ for (int i = 0xc0; i > 0x15; i--) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i16_5c = i;
+ this->var_i16_60 = this->var_i16_5c + 0x96;
+ this->var_i16_64 = i - 1;
+ this->var_i16_68 = this->var_i16_64 + 0x96;
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
+ this->sub_128_24a(0x1);
+ }
+
+ // 131:1424
+ g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_b0);
+ this->sub_128_21e(0x1);
+ g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_b4);
+ this->sub_128_21e(0x1);
+ g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_b8);
+ this->sub_128_1ba(0x6);
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(0xa);
+ g_toolbox->PenSize(0x3, 0x3);
+ this->var_i16_6e = 0x190;
+ this->var_i16_72 = SCREEN_WIDTH;
+ this->var_i16_6c = 0x50;
+ this->var_i16_70 = SCREEN_HEIGHT;
+ this->var_i16_5e = 0;
+ this->var_i16_62 = 0x32;
+ this->var_i16_5c = 0;
+ this->var_i16_60 = 0x32;
+ this->var_i16_3e0 = 0x64;
+
+ // 131:14d8
+ this->var_i32_40 = this->arr_i32_412aa;
+ g_toolbox->SetPortBits(this->var_i32_4e);
+ for (int i = 1; i < 0xf; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+ g_zbasic->blockmove(this->arr_i32_412ae, this->var_i32_4e, 0x5580);
+ this->var_i16_3e0 += 5 + i*2;
+ this->var_i16_66 = 0x1e0;
+ this->var_i16_6a = this->var_i16_66 + 0x32;
+ this->var_i16_64 = this->var_i16_3e0;
+ this->var_i16_68 = this->var_i16_64 + 0x32;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i32_5c, this->var_i32_64, 2, 0);
+ // 131:1582
+ g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e, i*3 + 3);
+ g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
+ this->sub_128_24a(0x1);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i32_6c, this->var_i32_6c, 0, 0);
+ }
+
+ g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(0xa);
+ for (int j = 0; j < 1; j++) {
+
+ for (int i = 1; i < 0xfa; i++) {
+ this->var_i32_2 = g_toolbox->TickCount();
+
+ if (j == 0) {
+ this->arr_i16_1e8[i] = 0x1f4 - i + g_zbasic->rnd_int(i);
+ this->arr_i16_1e8[i+0xfb] = g_zbasic->rnd_int(i)- 0x156;
+ }
+ // 131:1692
+ g_toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
+ g_toolbox->LineTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
+ if (i % 0x19 == 0) {
+ this->sub_128_24a(0x1);
+ }
+ }
+ }
+ // 131:1748
+ this->var_i32_2 = g_toolbox->TickCount();
+ for (int i = 0x25; i < 0x2f; i++) {
+ g_toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+
+ this->sub_128_24a(0x3c);
+ g_zbasic->text(0xfa, 0xc, 0, 0x3);
+ this->var_str_76 = Common::String::format("\"%s\"", _("Well, this won't do. . ."));
+ g_zbasic->buffer_flush(this->var_str_76);
+ this->sub_128_026c(0x17d, 0x3c);
/*
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 3766ca5d558..d5df5b3a215 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -22,8 +22,13 @@
#ifndef FOOL_PROLOGUE_H
#define FOOL_PROLOGUE_H
-#define SCREEN_WIDTH 512
-#define SCREEN_HEIGHT 342
+#include "common/array.h"
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "graphics/surface.h"
+
+#define SCREEN_WIDTH 0x200
+#define SCREEN_HEIGHT 0x156
#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8/2)
namespace Fool {
@@ -33,10 +38,16 @@ public:
FoolPrologue();
~FoolPrologue();
- int32 var_i32_32; // pointer to bitmap
- int32 var_i32_38; // pointer to rect
- int32 var_i32_40; // pointer to bitmap
- int32 var_i32_4e; // pointer to bitmap
+
+
+ Graphics::Surface var_i32_32; // pointer to bitmap
+ Common::Rect var_i32_38; // pointer to rect
+ Graphics::Surface var_i32_40; // pointer to bitmap
+ Graphics::Surface var_i32_4e; // pointer to bitmap
+
+ Common::Rect arr_i32_1c4;
+
+ Common::String var_str_76;
void run();
};
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index c1d4d898025..7d7dd20f791 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -2,6 +2,9 @@ MODULE := engines/fool
MODULE_OBJS = \
fool.o \
+ fool_prologue.o \
+ toolbox.o \
+ zbasic.o \
console.o \
events.o \
messages.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 9c1c91424e4..0f649d5dbf0 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -22,36 +22,58 @@
#ifndef FOOL_TOOLBOX_H
#define FOOL_TOOLBOX_H
-#include "common/array.h"
-#include "common/events.h"
+#include "common/scummsys.h"
#include "common/str.h"
+#include "common/ustr.h"
+#include "graphics/macgui/macwindow.h"
namespace Fool {
+typedef uint32 RgnHandle;
+typedef uint32 PicHandle;
+
+struct Pattern {
+ uint8 data[8];
+};
+
+struct RGBColor {
+ uint16 red;
+ uint16 green;
+ uint16 blue;
+};
+
+
class Toolbox {
public:
+ // Compatibility shim for the Macintosh Toolbox/QuickDraw API.
+
+
// PROCEDURE BeginUpdate (theWindow: WindowPtr);
// Call BeginUpdate when an update event occurs for theWindow. BeginUpdate replaces the
// visRgn of the window's grafPort with the intersection of the visRgn and the update region and
// then sets the window's update region to an empty region. You would then usually draw the
// entire content region, though it suffices to draw only the visRgn; in either case, only the parts of
// the window that require updating will actually be drawn on the screen. Every call to
- // BeginUpdate must be balanced by a call to EndUpdate. (See "How a Window is Drawn".)
+ // BeginUpdate must be balanced by a call to EndUpdate.
+ void BeginUpdate(Graphics::MacWindow &theWindow);
// PROCEDURE ClearMenuBar;
// Call ClearMenuBar to remove all menus from the menu list when you want to start afresh with all
// new menus. Be sure to call DrawMenuBar to update the menu bar.
+ void ClearMenuBar();
// PROCEDURE ClipRect (r: Rect);
// ClipRect changes the clipping region of the current grafPort to a rectangle that's equivalent to the
// given rectangle. Note that this doesn't change the region handle, but affects the clipping region
// itself.
+ void ClipRect(Common::Rect &r);
// PROCEDURE ClosePoly;
// ClosePoly tells QuickDraw to stop saving the definition of the currently open polygon and computes
// the polyBBox rectangle. You should perform one and only one ClosePoly for every OpenPoly.
// ClosePoly calls ShowPen, balancing the HidePen call made by OpenPoly.
+ void ClosePoly();
// PROCEDURE CopyBits (srcBits,dstBits: BitMap; srcRect,dstRect: Rect; mode: INTEGER; maskRgn: RgnHandle);
// CopyBits transfers a bit image between any two bit maps and clips the result to the area specified
@@ -62,55 +84,66 @@ public:
// just pass NIL for the maskRgn parameter. The dstRect and maskRgn coordinates are in terms of
// the dstBits.bounds coordinate system, and the srcRect coordinates are in terms of the
// srcBits.bounds coordinates.
+ void CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn);
// FUNCTION CurResFile: INTEGER;
// CurResFile returns the reference number of the current resource file. You can call it when the
// application starts up to get the reference number of its resource file.
+ uint16 CurResFile();
// PROCEDURE DrawChar (ch: CHAR);
// DrawChar places the given character to the right of the pen location, with the left end of its base
// line at the pen's location, and advances the pen accordingly. If the character isn't in the font, the
// font's missing symbol is drawn.
+ void DrawChar(Common::u32char_type_t ch);
// PROCEDURE DrawString (s: Str255);
// DrawString calls DrawChar for each character in the given string. The string is placed beginning
// at the current pen location and extending right. No formatting (such as carriage returns and line
// feeds) is performed by QuickDraw. The pen location ends up to the right of the last character in
// the string.
+ void DrawString(const Common::String &s);
// PROCEDURE EndUpdate (theWindow: WindowPtr);
// Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
// BeginUpdate as described above.
+ void EndUpdate(Graphics::MacWindow &theWindow);
// PROCEDURE FillOval (r: Rect; pat: Pattern);
// FillOval fills an oval just inside the specified rectangle with the given pattern (in patCopy mode).
// The grafPort's pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
+ void FillOval(const Common::Rect &r, const Pattern &pat);
// PROCEDURE FillRect (r: Rect; pat: Pattern);
// FillRect fills the specified rectangle with the given pattern (in patCopy mode). The grafPort's
// pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
+ void FillRect(const Common::Rect &r, const Pattern &pat);
// PROCEDURE FrameArc (r: Rect; startAngle,arcAngle: INTEGER);
// FrameArc draws an arc of the oval that fits inside the specified rectangle, using the current
// grafPort's pen pattern, mode, and size. StartAngle indicates where the arc begins and is treated
// MOD 360. ArcAngle defines the extent of the arc. The angles are given in positive or negative
// degrees; a positive angle goes clockwise, while a negative angle goes counterclockwise.
+ void FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle);
// PROCEDURE FrameOval (r: Rect);
// FrameOval draws an outline just inside the oval that fits inside the specified rectangle, using the
// current grafPort's pen pattern, mode, and size. The outline is as wide as the pen width and as tall
// as the pen height. It's drawn with the pnPat, according to the pattern transfer mode specified by
// pnMode. The pen location is not changed by this procedure.
+ void FrameOval(const Common::Rect &r);
// PROCEDURE FrameRect (r: Rect);
// FrameRect draws an outline just inside the specified rectangle, using the current grafPort's pen
// pattern, mode, and size. The outline is as wide as the pen width and as tall as the pen height. It's
// drawn with the pnPat, according to the pattern transfer mode specified by pnMode. The pen
// location is not changed by this procedure.
+ void FrameRect(const Common::Rect &r);
// PROCEDURE GetCPixel (h,v: INTEGER; VAR cPix: RGBColor);
// The GetCPixel function returns the RGB of the pixel at the specified position in the current
// port.
+ void GetCPixel(int16 h, int16 v, RGBColor &cPix);
// FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord) : BOOLEAN;
// GetNextEvent returns the next available event of a specified type or types and, if the event is in
@@ -125,16 +158,19 @@ public:
// resource file if necessary. It calls the Resource Manager function GetResource('PICT',picID). If
// the resource can't be read, GetPicture returns NIL. The PicHandle data type is defined in
// QuickDraw.
+ PicHandle GetPicture(uint16 picID);
// PROCEDURE HideCursor;
// HideCursor removes the cursor from the screen, restoring the bits under it, and decrements the
// cursor level (which InitCursor initialized to 0). Every call to HideCursor should be balanced by a
// subsequent call to ShowCursor.
+ void HideCursor();
// PROCEDURE InitCursor;
// InitCursor sets the current cursor to the standard arrow and sets the cursor level to 0, making
// the cursor visible. The cursor level keeps track of the number of times the cursor has been
// hidden to compensate for nested calls to HideCursor and ShowCursor, explained below.
+ void InitCursor();
// PROCEDURE InsetRect (VAR r: Rect; dh,dv: INTEGER);
// InsetRect shrinks or expands the given rectangle. The left and right sides are moved in by the
@@ -147,11 +183,13 @@ public:
// InvertOval inverts the pixels enclosed by an oval just inside the specified rectangle: Every white
// pixel becomes black and every black pixel becomes white. The grafPort's pnPat, pnMode, and
// bkPat are all ignored; the pen location is not changed.
+ void InvertOval(const Common::Rect &r);
// PROCEDURE InvertRect (r: Rect);
// InvertRect inverts the pixels enclosed by the specified rectangle: Every white pixel becomes
// black and every black pixel becomes white. The grafPort's pnPat, pnMode, and bkPat are all
// ignored; the pen location is not changed.
+ void InvertRect(const Common::Rect &r);
// PROCEDURE KillPoly (poly: PolyHandle);
// KillPoly releases the memory occupied by the given polygon. Use this only when you're completely
@@ -160,14 +198,17 @@ public:
// PROCEDURE LineTo (h,v: INTEGER);
// LineTo draws a line from the current pen location to the location specified (in local coordinates)
// by h and v. The new pen location is (h,v) after the line is drawn.
+ void LineTo(int16 h, int16 v);
// PROCEDURE MovePortTo (leftGlobal,topGlobal: INTEGER);
// MovePortTo changes the position of the current grafPort's portRect. This does not affect the
// screen; it merely changes the location at which subsequent drawing inside the port will appear.
+ void MovePortTo(int16 leftGlobal, int16 topGlobal);
// PROCEDURE MoveTo (h,v: INTEGER);
// MoveTo moves the pen to location (h,v) in the local coordinates of the current grafPort. No
// drawing is performed.
+ void MoveTo(int16 h, int16 v);
// FUNCTION OpenPoly : PolyHandle;
// OpenPoly returns a handle to a new polygon and tells QuickDraw to start saving the polygon
@@ -188,6 +229,7 @@ public:
// PaintOval paints an oval just inside the specified rectangle with the current grafPort's pen pattern
// and mode. The oval is filled with the pnPat, according to the pattern transfer mode specified by
// pnMode. The pen location is not changed by this procedure.
+ void PaintOval(const Common::Rect &r);
// PROCEDURE PaintPoly (poly: PolyHandle);
// PaintPoly paints the specified polygon with the current grafPort's pen pattern and pen mode. The
@@ -198,28 +240,34 @@ public:
// PaintRect paints the specified rectangle with the current grafPoit's pen pattern and mode. The
// rectangle is filled with the pnPat, according to the pattern transfer mode specified by pnMode.
// The pen location is not changed by this procedure.
+ void PaintRect(const Common::Rect &r);
// PROCEDURE PenMode (mode: INTEGER);
// PenMode sets the transfer mode through which the pen pattern is transferred onto the bit map
// when lines or shapes are drawn in the current grafPort.
+ void PenMode(uint16 mode);
// PROCEDURE PenNormal;
// PenNormal resets the initial state of the pen in the current grafPort.
+ void PenNormal();
// PROCEDURE PenPat (pat: Pattern);
// PenPat sets the pattern that's used by the pen in the current grafPort. The standard patterns
// white, black, gray, ltGray, and dkGray are predefined; the initial pen pattern is black. The
// current pen pattern can be accessed in the variable thePort .pnPat, and this value can be assigned
// to any other variable of type Pattern.
+ void PenPat(const Pattern &pat);
// PROCEDURE PenSize (width,height: INTEGER);
// PenSize sets the dimensions of the graphics pen in the current grafPort. All subsequent calls to
// Line, LineTo, and the procedures that draw framed shapes in the current grafPort will use the
// new pen dimensions.
+ void PenSize(uint16 width, uint16 height);
// PROCEDURE PortSize (width,height: INTEGER);
// PortSize changes the size of the current grafPort's portRect. This does not affect the screen; it
// merely changes the size of the "active area" of the grafPort.
+ void PortSize(uint16 width, uint16 height);
// PROCEDURE ReleaseResource (theResource: Handle);
// Given a handle to a resource, ReleaseResource releases the memory occupied by the resource
@@ -227,10 +275,12 @@ public:
// The given handle will no longer be recognized as a handle to a resource; if the Resource Manager
// is subsequendy called to get the released resource, a new handle will be allocated. Use this
// procedure only after you're completely through with a resource.
+ void ReleaseResource(uint32 handle);
// PROCEDURE SetCPixel (h,v: INTEGER; cPix: RGBColor);
// The SetCPixel function sets the pixel at the specified position to the pixel value that most
// closely matches the specified RGB.
+ void SetCPixel(int16 h, int16 v, const RGBColor &cPix);
// PROCEDURE SetPort (port: GrafPtr);
// SetPort makes the specified grafPort the current port.
@@ -240,24 +290,29 @@ public:
// allows you to perform all normal drawing and calculations on a buffer other than the screenâfor
// example, a small off-screen image for later "stamping" onto the screen (with the CopyBits
// procedure, described under "Bit Transfer Operations" below).
+ void SetPortBits(const Graphics::Surface &bm);
// PROCEDURE SetRect (VAR r: Rect; left,top,right,bottom: INTEGER);
// SetRect assigns the four boundary coordinates to the given rectangle. The result is a rectangle
// with coordinates (left,top) (right,bottom).
+ void SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom);
// PROCEDURE StringWidth (s: Str255) : INTEGER;
// StringWidth returns the width of the given text string, which it calculates by adding the
// CharWidths of all the characters in the string (see above).
+ uint16 StringWidth(const Common::String &s);
// FUNCTION TickCount : LONGINT;
// TickCount returns the current number of ticks (sixtieths of a second) since the system last started
// up.
+ uint32 TickCount();
// PROCEDURE UseResFile (refNum: INTEGER);
// Given the reference number of a resource file, UseResFile sets the current resource file to that
// file. If there's no resource file open with the given reference number, UseResFile will do nothing
// and the ResError function will return the result code resFNotFound. A refNum of 0 represents
// the system resource file.
+ void UseResFile(uint16 refNum);
};
} // namespace Fool
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
new file mode 100644
index 00000000000..7bf740473f1
--- /dev/null
+++ b/engines/fool/zbasic.cpp
@@ -0,0 +1,28 @@
+/* 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 "fool/toolbox.h"
+
+namespace Fool {
+
+
+
+} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
new file mode 100644
index 00000000000..7a7a84b713f
--- /dev/null
+++ b/engines/fool/zbasic.h
@@ -0,0 +1,35 @@
+/* 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 FOOL_ZBASIC_H
+#define FOOL_ZBASIC_H
+
+namespace Fool {
+
+class ZBasic {
+
+public:
+
+};
+
+} // namespace Fool
+
+#endif
Commit: 7a5c35935583faf4ac084833370d4ed84e228133
https://github.com/scummvm/scummvm/commit/7a5c35935583faf4ac084833370d4ed84e228133
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:45+02:00
Commit Message:
FOOL: Yet more porting
Changed paths:
engines/fool/detection.cpp
engines/fool/detection.h
engines/fool/detection_tables.h
engines/fool/fool.cpp
engines/fool/fool.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/detection.cpp b/engines/fool/detection.cpp
index b285bc1df27..6ba2543f2e3 100644
--- a/engines/fool/detection.cpp
+++ b/engines/fool/detection.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "advancedDetector.h"
#include "base/plugins.h"
#include "common/config-manager.h"
#include "common/file.h"
@@ -38,8 +39,7 @@ const DebugChannelDef FoolMetaEngineDetection::debugFlagList[] = {
DEBUG_CHANNEL_END
};
-FoolMetaEngineDetection::FoolMetaEngineDetection() : AdvancedMetaEngineDetection(Fool::gameDescriptions,
- sizeof(ADGameDescription), Fool::foolGames) {
+FoolMetaEngineDetection::FoolMetaEngineDetection() : AdvancedMetaEngineDetection(Fool::gameDescriptions, Fool::foolGames) {
}
REGISTER_PLUGIN_STATIC(FOOL_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, FoolMetaEngineDetection);
diff --git a/engines/fool/detection.h b/engines/fool/detection.h
index 99238eedea1..9ff81e8aa4f 100644
--- a/engines/fool/detection.h
+++ b/engines/fool/detection.h
@@ -42,7 +42,7 @@ extern const ADGameDescription gameDescriptions[];
} // End of namespace Fool
-class FoolMetaEngineDetection : public AdvancedMetaEngineDetection {
+class FoolMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
static const DebugChannelDef debugFlagList[];
public:
@@ -58,7 +58,7 @@ public:
}
const char *getOriginalCopyright() const override {
- return "Fool (C)";
+ return "(C) Cliff Johnson";
}
const DebugChannelDef *getDebugChannels() const override {
diff --git a/engines/fool/detection_tables.h b/engines/fool/detection_tables.h
index 1b46b651a32..4d2c70a11d9 100644
--- a/engines/fool/detection_tables.h
+++ b/engines/fool/detection_tables.h
@@ -20,6 +20,7 @@
*/
#include "common/platform.h"
+
namespace Fool {
const PlainGameDescriptor foolGames[] = {
@@ -30,17 +31,40 @@ const PlainGameDescriptor foolGames[] = {
};
const ADGameDescription gameDescriptions[] = {
- // The Fool's Errand - Version 2.0 July 25, 1988
+ // The Fool's Errand - Version 1.1 (1987-07-30)
+ {
+ "fool",
+ "v1.1",
+ AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ // The Fool's Errand - Version 2.0 (1988-07-25)
{
"fool",
- nullptr,
- AD_ENTRY1s("file1.bin", "00000000000000000000000000000000", 11111),
+ "v2.0",
+ AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
+ // The Fool's Errand - Version 3.0 (1998-04-01)
+ {
+ "fool",
+ "v3.0",
+ AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+
AD_TABLE_END_MARKER
};
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index 6ec04fb7fc5..9d662563e02 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -57,7 +57,6 @@ Common::Error FoolEngine::run() {
// Set the engine's debugger console
setDebugger(new Console());
- runGame();
return Common::kNoError;
}
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
index 8de978fd4ba..90d64fa815b 100644
--- a/engines/fool/fool.h
+++ b/engines/fool/fool.h
@@ -41,7 +41,7 @@ namespace Fool {
struct FoolGameDescription;
-class FoolEngine : public Engine, public Events {
+class FoolEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
@@ -49,13 +49,6 @@ protected:
// Engine APIs
Common::Error run() override;
- /**
- * Returns true if the game should quit
- */
- bool shouldQuit() const override {
- return Engine::shouldQuit();
- }
-
public:
FoolEngine(OSystem *syst, const ADGameDescription *gameDesc);
~FoolEngine() override;
@@ -81,10 +74,10 @@ public:
(f == kSupportsReturnToLauncher);
};
- bool canLoadGameStateCurrently() override {
+ bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
return true;
}
- bool canSaveGameStateCurrently() override {
+ bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
return true;
}
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index b6af19b551a..c97ba24700f 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -21,6 +21,7 @@
#include "fool/fool_prologue.h"
+#include "common/translation.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
#include "common/str.h"
@@ -30,6 +31,9 @@ namespace Fool {
ZBasic *g_zbasic;
Toolbox *g_toolbox;
+// Based on disassembly of Fool's Errand v2.0.
+// v3.0 had several features removed to improve compatibility with later versions of Mac OS.
+
void FoolPrologue::run() {
// 128:0004
@@ -48,29 +52,22 @@ void FoolPrologue::run() {
this->var_i32_4e = this->arr_i32_412c2[0];
// 128:0078
// stipple pattern buffer?
- for (int i = 0; i < 3; i++) {
- this->arr_i16_194[i] = 0;
- this->arr_i16_194[i+4] = 0xaa55;
- this->arr_i16_194[i+8] = 0xffff;
- }
+ this->arr_i16_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ this->arr_i16_194[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } };
+ this->arr_i16_194[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+
// 128:00d6
- this->arr_i16_1ac[0] = 0x0107;
- this->arr_i16_194[0xd] = 0x0e0c;
- this->arr_i16_194[0xe] = 0x7c70;
- this->arr_i16_194[0xf] = 0xc0c0;
- this->arr_i16_1b4[0] = 0x8800;
- this->arr_i16_194[0x11] = 0x2200;
- this->arr_i16_194[0x12] = 0x8800;
- this->arr_i16_194[0x13] = 0x2200;
+ this->arr_i16_194[3] = { { 0x01, 0x07, 0x0e, 0x0c, 0x7c, 0x70, 0xc0, 0xc0 } };
+ this->arr_i16_194[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
// 128:017a
- this->var_str_76 = Common::String(_("© 1987 by Cliff Johnson ALL RIGHTS RESERVED"));
- g_zbasic->buffer_flush(this->var_str_76);
- this->var_str_76 = Common::String(_("This software was created using the ZBasic⢠compiler."));
- g_zbasic->buffer_flush(this->var_str_76);
- this->var_str_76 = Common::String(_("Portions of this code are © Copyrighted, 1985 by Zedcor Inc."));
- g_zbasic->buffer_flush(this->var_str_76);
+ this->var_str_76 = _("© 1987 by Cliff Johnson ALL RIGHTS RESERVED");
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 = _("This software was created using the ZBasic⢠compiler.");
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 = _("Portions of this code are © Copyrighted, 1985 by Zedcor Inc.");
+ g_zbasic->bufferFlush(this->var_str_76);
// 128:01b6
// JMP 0x1f0
@@ -93,72 +90,72 @@ void FoolPrologue::run() {
this->sub_129_004();
}
-void FoolPrologue::sub_128_1ba(int16_t screen_page) {
+void FoolPrologue::sub_128_1ba(int16 screen_page) {
// 128:01ba
- this->var_40 = &this->arr_i32_41296[screen_page];
- g_toolbox->CopyBits(this->var_32, this->var_40, this->var_38, this->var_38, 0, 0);
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
}
-void FoolPrologue::sub_128_1f4(int16_t screen_page) {
+void FoolPrologue::sub_128_1f4(int16 screen_page) {
// 128:01f4
- this->var_40 = &this->arr_i32_41296[screen_page];
- g_toolbox->SetPortBits(this->var_40);
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ g_toolbox->SetPortBits(this->var_i32_40);
}
-void FoolPrologue::sub_128_21e(int16_t numTicks) {
+void FoolPrologue::sub_128_21e(int16 numTicks) {
// 128:021e
// original code would poll TickCount in a loop,
// effectively the same as Delay
g_toolbox->Delay(numTicks);
}
-void FoolPrologue::sub_128_24a(int16_t numTicks) {
+void FoolPrologue::sub_128_24a(int16 numTicks) {
// 128:024a
- int32_t delay = MAX(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
+ int32_t delay = MAX<uint32>(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
// again, polling TickCount in a loop.
g_toolbox->Delay(delay);
}
-void FoolPrologue::sub_128_26c(int16_t unk1, int16_t unk2) {
+void FoolPrologue::sub_128_26c(int16 unk1, int16 unk2) {
// 128:026c
this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
g_toolbox->MoveTo(this->var_i32_182 - unk2, unk1);
g_toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::sub_128_2a6(int16_t unk1, int16_t unk2) {
+void FoolPrologue::sub_128_2a6(int16 unk1, int16 unk2) {
// 128:02a6
this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
g_toolbox->MoveTo(unk2 - (this->var_i32_182 / 2), unk1);
g_toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::sub_128_2f0(int16_t unk, int16_t right, int16_t bottom, int16_t left, int16_t top) {
+void FoolPrologue::sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right) {
// 128:02f0
- g_toolbox->SetRect(this->rect_41af4, left, top, right, bottom);
- g_toolbox->FillRect(this->rect_41af4, &this->arr_i16_194[unk*4])
+ g_toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
+ g_toolbox->FillRect(this->arr_i16_41af4, this->arr_i16_194[unk]);
}
-void FoolPrologue::sub_128_354(int16_t unk1, int16_t unk2) {
+void FoolPrologue::sub_128_354(uint16 unk1, uint16 unk2) {
// 128:0354
- g_toolbox->SetRect(this->rect_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenPat(this->arr_i16_194[unk2*4]);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->PenPat(this->arr_i16_194[unk2]);
g_toolbox->PenMode(unk1);
g_toolbox->PenSize(6, 4);
- for (int i = 0; i <= 130 i += 3) {
+ for (int i = 0; i <= 130; i += 3) {
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->FrameRect(this->rect_1bc);
- g_toolbox->InsetRect(this->rect_1bc, 6, 4);
+ g_toolbox->FrameRect(this->arr_i16_1bc);
+ g_toolbox->InsetRect(this->arr_i16_1bc, 6, 4);
this->sub_128_24a(1);
}
g_toolbox->PenNormal();
}
-void FoolPrologue::sub_128_3ee(int16_t unk1) {
+void FoolPrologue::sub_128_3ee(int16 unk1) {
// 128:03ee
- this->var_18c = 0x5;
+ this->var_i16_18c = 0x5;
if (this->var_i16_18e > 0x28) {
this->var_i16_18c = 0x8;
}
@@ -173,11 +170,11 @@ void FoolPrologue::sub_128_3ee(int16_t unk1) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->MoveTo(
unk1 - this->arr_i16_1e8[i],
- unk1 - this->arr_i16_1e8[i + 0x1f6],
+ unk1 - this->arr_i16_1e8[i + 0x1f6]
);
g_toolbox->LineTo(
unk1 + this->arr_i16_1e8[i + 0xfb],
- unk1 - this->arr_i16_1e8[i + 0x1f6],
+ unk1 - this->arr_i16_1e8[i + 0x1f6]
);
if (i % this->var_i16_18c == 0) {
this->sub_128_24a(0);
@@ -186,11 +183,11 @@ void FoolPrologue::sub_128_3ee(int16_t unk1) {
}
-void FoolPrologue::sub_128_50a(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4) {
+void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_page) {
// 128:050a
- this->var_i32_40 = this->arr_i32_41296[unk4];
- this->var_i16_5e = unk3;
- this->var_i16_62 = unk2;
+ this->var_i32_40 = this->arr_i32_41296[screen_page];
+ this->var_i16_5c.left = unk3;
+ this->var_i16_5c.right = unk2;
if (unk1 == 0) {
unk1 = 0x14;
}
@@ -206,25 +203,25 @@ void FoolPrologue::sub_128_50a(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
// 128:0584
for (int i = 1; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_5c = this->arr_i16_412ea[i] - 1;
- this->var_i16_60 = this->arr_i16_412ea[i];
- g_toolbox->CopyBits(this->var_i32_40, this->var_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ this->var_i16_5c.top = this->arr_i16_412ea[i] - 1;
+ this->var_i16_5c.bottom = this->arr_i16_412ea[i];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
if (i % unk1 == 0) {
this->sub_128_24a(0);
}
}
}
-void FoolPrologue::sub_128_610(int16_t unk) {
+void FoolPrologue::sub_128_610(int16 screen_page) {
// 128:0610
- this->var_i32_40 = this->arr_i32_41296[unk];
- g_toolbox->CopyBits(this->var_i32_40, this->var_32, this->var_38, this->var_38, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[screen_page];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
-void FoolPrologue::sub_128_64a(int16_t unk1) {
+void FoolPrologue::sub_128_64a(int16 unk1) {
// 128:064a
g_toolbox->PenNormal();
- g_toolbox->PenPat(&this->arr_i16_194[unk1*4]);
+ g_toolbox->PenPat(this->arr_i16_194[unk1]);
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -237,39 +234,45 @@ void FoolPrologue::sub_128_64a(int16_t unk1) {
g_toolbox->PenNormal();
}
-void FoolPrologue::sub_128_6e4(int16_t unk) {
+void FoolPrologue::sub_128_6e4(int16 screen_page) {
// 128:06e4
- this->var_40 = this->arr_i32_41296[unk];
+ this->var_i32_40 = this->arr_i32_41296[screen_page];
for (int i = 0; i < 0x36; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_5c = (SCREEN_HEIGHT/2) - (int)(i*3.33);
- this->var_i16_5e = (SCREEN_WIDTH/2) - i*5;
- this->var_i16_60 = (SCREEN_HEIGHT/2) + (int)(i*3.33);
- this->var_i16_62 = (SCREEN_WIDTH/2) + i*5;
- g_toolbox->CopyBits(this->var_40, this->var_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
+ this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
+ this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
+ this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
}
- g_toolbox->CopyBits(this->var_40, this->var_32, this->var_38, this->var_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
// 128:0800
- this->arr_i16_41af4[0] = unk9;
- this->arr_i16_41af4[1] = unk8;
- this->arr_i16_41af4[2] = unk7;
- this->arr_i16_41af4[3] = unk6;
- this->arr_i16_41af4[4] = unk5;
- this->arr_i16_41af4[5] = unk4;
- this->arr_i16_41af4[6] = unk3;
- this->arr_i16_41af4[7] = unk2;
+ this->arr_i16_41af4.top = unk9;
+ this->arr_i16_41af4.left = unk8;
+ this->arr_i16_41af4.bottom = unk7;
+ this->arr_i16_41af4.right = unk6;
+ this->arr_i16_41afc.top = unk5;
+ this->arr_i16_41afc.left = unk4;
+ this->arr_i16_41afc.bottom = unk3;
+ this->arr_i16_41afc.right = unk2;
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
+
// 128:08bc
- for (int i = 0; i < 4; i++) {
- this->arr_f64_41bbe[i] = (double)this->arr_i16_41af4[i];
- this->arr_f64_41bbe[i+4] = (double)(this->arr_i16_41af4[i] - this->arr_i16_41af4[i+4])/(double)(this->var_i32_182);
- }
+ this->arr_f64_41bbe[0] = (double)this->arr_i16_41af4.top;
+ this->arr_f64_41bbe[1] = (double)this->arr_i16_41af4.left;
+ this->arr_f64_41bbe[2] = (double)this->arr_i16_41af4.bottom;
+ this->arr_f64_41bbe[3] = (double)this->arr_i16_41af4.right;
+ this->arr_f64_41bbe[4] = (double)(this->arr_i16_41af4.top - this->arr_i16_41afc.top)/(double)(this->var_i32_182);
+ this->arr_f64_41bbe[5] = (double)(this->arr_i16_41af4.left - this->arr_i16_41afc.left)/(double)(this->var_i32_182);
+ this->arr_f64_41bbe[6] = (double)(this->arr_i16_41af4.bottom - this->arr_i16_41afc.bottom)/(double)(this->var_i32_182);
+ this->arr_f64_41bbe[7] = (double)(this->arr_i16_41af4.right - this->arr_i16_41afc.right)/(double)(this->var_i32_182);
+
// 128:096e
- g_toolbox->PaintRect(&this->arr_i16_41af4);
+ g_toolbox->PaintRect(this->arr_i16_41af4);
for (int i = 1; i < unk1 + 1; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -277,10 +280,10 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_f64_41bbe[j] = this->arr_f64_41bbe[j] + this->arr_f64_41bbe[j+4];
this->arr_i16_41af4[j+11] = (int16_t)this->arr_f64_41bbe[j];
}
- g_toolbox->PaintRect(&this->arr_i16_41b0a);
+ g_toolbox->PaintRect(this->arr_i16_41b0a);
this->sub_128_24a(0);
}
- g_toolbox->PaintRect(&this->arr_i16_41afc);
+ g_toolbox->PaintRect(this->arr_i16_41afc);
g_toolbox->PenNormal();
}
@@ -309,10 +312,10 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
if ((this->arr_i16_1e8[this->var_i16_6] < 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] < 0x140)) {
// 128:0bae
- this->arr_i16_1e8[this->var_i16_6] = _vm->_rnd->getRandomNumber(0x264) - 0xc8;
- this->arr_i16_1e8[0xfb + this->var_i16_6] = _vm->_rnd->getRandomNumber(0x1ba) - 0xc8;
- this->arr_i16_1e8[0x1f6 + this->var_i16_6] = _vm->_rnd->getRandomNumber(0x5) + 0x1;
- this->arr_i16_1e8[0x2f1 + this->var_i16_6] = _vm->_rnd->getRandomNumber(0xa) + 0x19;
+ this->arr_i16_1e8[this->var_i16_6] = g_zbasic->rndInt(0x264) - 0xc8;
+ this->arr_i16_1e8[0xfb + this->var_i16_6] = g_zbasic->rndInt(0x1ba) - 0xc8;
+ this->arr_i16_1e8[0x1f6 + this->var_i16_6] = g_zbasic->rndInt(0x5) + 0x1;
+ this->arr_i16_1e8[0x2f1 + this->var_i16_6] = g_zbasic->rndInt(0xa) + 0x19;
}
// 128:0c56
this->sub_130_e82();
@@ -348,26 +351,26 @@ void FoolPrologue::sub_128_c8a() {
}
// 128:0d2a
for (int i=this->var_i16_18e; i<=1; i--) {
- this->var_i16_1b6 = _vm->_rnd->getRandomNumber(i);
+ this->var_i16_1b6 = g_engine->getRandomNumber(i);
this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
- g_zbasic->blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8);
- g_zbasic->blockmove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8);
+ g_zbasic->blockMove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8);
+ g_zbasic->blockMove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8);
}
}
void FoolPrologue::sub_128_de2() {
// 128:0de2
- g_zbasic->text(0xfb, 0x9, 0x0, 0x2);
- this->var_str_76 = STR(0xa0); // "Click Mouse to Continue"
+ g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceXOR);
+ this->var_str_76 = _("Click Mouse to Continue");
this->sub_128_a6c(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
- g_zbasic->text(0xfb, 0x9, 0x0, 0x2);
- this->var_str_76 = "Click Mouse to Continue"; // STR(0xb8)
+ g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceXOR);
+ this->var_str_76 = _("Click Mouse to Continue");
this->sub_128_26c(0x154, 0x1f7);
}
@@ -444,8 +447,8 @@ void FoolPrologue::sub_129_004() {
// 0x000a: JSR - "PEEKLONG" # current A5
// 0x000e: SUBI.L - 0x72,D0
// 0x0014: JSR - "PEEKWORD" # quickdraw globals,
- this->var_i16_10 = _vm->_wm->_screenDims.width(); // window width?
- this->var_i16_12 = _vm->_wm->_screenDims.height(); // window height?
+ this->var_i16_10 = g_engine->_wm->_screenDims.width(); // window width?
+ this->var_i16_12 = g_engine->_wm->_screenDims.height(); // window height?
// 129:0034
// set left and top offsets based on a drawable area of 512x342
@@ -479,25 +482,25 @@ void FoolPrologue::sub_129_004() {
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
// 129:013a
this->sub_128_2f0(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
- g_toolbox->SetRect(&this->arr_i32_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
+ g_toolbox->SetRect(&this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
g_toolbox->PenPat(this->arr_i32_19c[0]);
- g_toolbox->FrameRect(&this->arr_i32_1bc);
+ g_toolbox->FrameRect(this->arr_i16_1bc);
}
// 129:01b0
g_toolbox->SetPort(this->var_i32_8);
g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->MovePortTo(this->var_i16_14, this->var_i16_16);
- g_toolbox->SetRect(&this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->ClipRect(&this->arr_i32_1bc);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->ClipRect(this->arr_i16_1bc);
// 129:01f2
if (this->var_i16_12 == SCREEN_HEIGHT) {
- g_toolbox->SetRect(&this->arr_i32_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(&this->arr_i32_1bc, this->arr_i32_19c);
+ g_toolbox->SetRect(&this->arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(this->arr_i16_1bc, this->arr_i32_19c);
} else {
- g_toolbox->SetRect(&this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(&this->arr_i32_1bc, this->arr_i32_19c);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(this->arr_i16_1bc, this->arr_i32_19c);
}
// 129:026c
@@ -523,24 +526,23 @@ void FoolPrologue::sub_129_004() {
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
- g_zbasic->get_from(0x0, 0x14);
- g_zbasic->get_to(0x1fc, 0x152, this->arr_i32_b54);
+ g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_b54);
g_zbasic->unk6(0x19, 0x64, 0xff, 0x0);
this->sub_128_2f0(2, 0x46, 0x64, 0xd8, 0x198);
this->sub_128_2f0(1, 0x4b, 0x69, 0xd3, 0x193);
// 129:0386
this->sub_128_2f0(2, 0x50, 0x6e, 0xc3, 0x18e);
- g_zbasic->text(0, 0xc, 0, 3);
- this->var_str_76 = STR(0xd2); // 'There is not enough available memory'
+ g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
+ this->var_str_76 = _("There is not enough available memory");
this->sub_128_2a6(0x64, 0xfc);
- this->var_str_76 = STR(0xf8); // 'to run the program at this time.'
+ this->var_str_76 = _("to run the program at this time.");
this->sub_128_2a6(0x78, 0xfc);
- this->var_str_76 = STR(0x11a); // 'Check your instruction manual for '
+ this->var_str_76 = _("Check your instruction manual for ");
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = STR(0x13e); // 'for possible solutions.'
+ this->var_str_76 = _("for possible solutions.");
this->sub_128_2a6(0xaa, 0xfc);
- this->var_str_76 = STR(0x156); // '(click mouse to quit)'
+ this->var_str_76 = _("(click mouse to quit)");
this->sub_128_2a6(0xcb, 0xfc);
this->sub_128_e58();
g_zbasic->get_from(0x0, 0x14);
@@ -553,11 +555,11 @@ void FoolPrologue::sub_129_004() {
this->var_i16_180 = 1;
this->var_i16_1aa = 1;
this->var_i16_176 = g_zbasic->249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
- if (g_zbasic->106(STR(0x16c), &this->var_i16_1c4)) {
+ if (g_zbasic->106(Common::U32String(""), &this->var_i16_1c4)) {
// 129:04de
- this->var_str_76 = STR(0x16e); // "And now it is time to show the Finale for the Fool's Errand."
+ this->var_str_76 = _("And now it is time to show the Finale for the Fool's Errand.");
for (int i = 1; i < 0xa; i++) {
- this->var_str_76 += g_zbasic->chr(this->var_i16_74);
+ this->var_str_76 += g_zbasic->chr(i);
}
// 129:0522
@@ -587,26 +589,25 @@ void FoolPrologue::sub_129_004() {
// 129:05a6
if (this->var_i16_1c + this->var_i16_20 + this->var_i16_1e != 0) {
g_toolbox->InitCursor();
- g_zbasic->get_from(0x0, 0x14);
- g_zbasic->get_to(0x1fc, 0x152, this->arr_i32_b54);
+ g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_b54);
g_zbasic->unk6(0x19, 0x64, 0xff, 0x00);
this->sub_128_2f0(2, 0x64, 0x7e, 0xd8, 0x17a);
this->sub_128_2f0(1, 0x69, 0x83, 0xd3, 0x175);
this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
// 129:0662
- g_zbasic->text(0, 0xc, 0, 0x3);
- this->var_str_76 = STR(0x1ac); // 'Set your monitor to'
+ g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
+ this->var_str_76 = _("Set your monitor to");
this->sub_128_2a6(0x82, 0xfc);
- this->var_str_76 = STR(0x1c0); // '2 color black and white'
+ this->var_str_76 = _("2 color black and white");
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = STR(0x1d8); // 'and start the Prologue again.'
+ this->var_str_76 = _("and start the Prologue again.");
if (this->var_i16_1aa == 2) {
- this->var_str_76 = STR(0x1f6); // 'and start the Finale again.'
+ this->var_str_76 = _("and start the Finale again.");
}
this->sub_128_2a6(0xaa, 0xfc);
- this->var_str_76 = STR(0x212); // '(click mouse to quit)'
+ this->var_str_76 = _("(click mouse to quit)");
this->sub_128_2a6(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
@@ -635,27 +636,27 @@ void FoolPrologue::sub_129_772() {
this->sub_130_004();
}
-
+// run prologue
void FoolPrologue::sub_130_004() {
// 130:0004
this->var_i16_3ce = 5;
this->sub_130_d28();
- this->var_i16_18e = 0x156;
+ this->var_i16_18e = SCREEN_HEIGHT;
this->sub_128_ccc();
this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
this->var_i16_3ce = 0xa;
this->sub_130_d28();
this->sub_128_1f4(0xb);
- this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
g_zbasic->picture(0x74, 0xaa, 0x00, 0x00, this->glob_i32_2ce);
g_toolbox->ReleaseResource(*this->glob_i32_2ce);
// 130:007a
- g_zbasic->text(0xfb, 0x9, 0x0, 0x3);
- this->var_str_76 = STR(0x228);
+ g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceBIC);
+ this->var_str_76 = Common::String(_("©1987 by Cliff Johnson. All Rights Reserved."));
this->sub_128_2a6(0x10d, 0xdd);
- g_toolbox->SetPortBits(&this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
for (int i = 1; i < 5; i++) {
this->sub_130_cea();
}
@@ -663,40 +664,40 @@ void FoolPrologue::sub_130_004() {
// 130:00d6
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x96, 0, this->arr_u8_4);
- g_toolbox->ReleaseResource(*this->arr_u8_4);
+ g_zbasic->picture(0, 0x96, 0, this->arr_i32_0[1]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->sub_128_1f4(8);
// 130:011c
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x96, 0, this->arr_u8_8);
- g_toolbox->ReleaseResource(*this->arr_u8_8);
+ g_zbasic->picture(0, 0x96, 0, this->arr_i32_0[2]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
for (int i = 3; i < 5; i++) {
- g_zbasic->blockmove(this->arr_i32_412b2[0], this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockMove(this->arr_i32_412b2[0], this->arr_i32_41296[i], 0x5580);
}
this->sub_130_cea();
this->sub_128_1f4(0);
// 130:01aa
- g_zbasic->picture(0, 0, 0, this->arr_u8_18);
- g_toolbox->ReleaseResource(*this->arr_u8_18);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[6]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[6]);
this->sub_130_cea();
- g_zbasic->blockmove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
this->sub_128_1f4(1);
// 130:0202
- g_zbasic->picture(0xa2, 0x3c, 0, this->arr_u8_1c);
- g_toolbox->ReleaseResource(*this->arr_u8_1c);
+ g_zbasic->picture(0xa2, 0x3c, -1, 0, this->arr_i32_0[7]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[7]);
this->sub_130_cea();
this->sub_128_1f4(2);
// 130:0234
- this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0x5a, 0x2e, 0, this->arr_u8_20);
- g_toolbox->ReleaseResource(*this->arr_u8_20);
+ this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
+ g_zbasic->picture(0x5a, 0x2e, -1, 0, this->arr_i32_0[8]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[8]);
// 130:0276
for (int j = 9; j < 0xb; j++) {
@@ -712,15 +713,15 @@ void FoolPrologue::sub_130_004() {
this->sub_128_1f4(j - 6);
g_zbasic->picture(0, 0, 0, this->arr_i32_0[j]);
g_zbasic->picture(this->var_i16_74, 0x96, 0, this->arr_i32_0[j - 6]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[j]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[j - 6]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[j]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
this->sub_130_cea();
// 130:0320
this->sub_128_1f4(6);
g_zbasic->picture(0, 0, 0, this->arr_i32_0[0xc]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[0xc]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
// 130:034a
for (int i = 0xd; i < 0x12; i++) {
@@ -731,7 +732,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->SetPortBits(&this->var_i32_32);
// 130:0380
- if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == 0x156)) {
+ if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
this->sub_128_2f0(1, 0, 0, 0x14, 0x1fc);
} else {
g_toolbox->SetPort(this->var_i32_c);
@@ -745,17 +746,17 @@ void FoolPrologue::sub_130_004() {
this->sub_128_610(0xb);
this->sub_128_21e(0x5a);
this->sub_130_db0();
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, 0x200, 0x118);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
// 130:043c
for (int i = 1; i < 2; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_a8c(0xb4);
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i32_1bc);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_24a(1);
- g_toolbox->InvertRect(this->arr_i32_1bc);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
// 130:04ca
for (int j = 0; j < 3; j++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -793,16 +794,16 @@ void FoolPrologue::sub_130_004() {
// 130:062c
this->var_i16_74 = 0;
- while (this->var_i16_74 != 0x156) {
- this->var_i16_62 = SCREEN_WIDTH;
+ while (this->var_i16_74 != SCREEN_HEIGHT) {
+ this->var_i16_5c.right = SCREEN_WIDTH;
this->var_i32_2 = g_toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
this->var_i16_192 = 1;
- if (this->var_i16_74 < 0x156) {
+ if (this->var_i16_74 < SCREEN_HEIGHT) {
this->var_i16_74 += 1;
}
- this->var_i16_5c = this->arr_i16_412ea[this->var_i16_74] - 1;
- this->var_i16_60 = this->arr_i16_412ea[this->var_i16_74];
+ this->var_i16_5c.top = this->arr_i16_412ea[this->var_i16_74] - 1;
+ this->var_i16_5c.bottom = this->arr_i16_412ea[this->var_i16_74];
// 130:068e
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_5c, this->arr_i32_5c, 0, 0);
}
@@ -815,15 +816,15 @@ void FoolPrologue::sub_130_004() {
// 130:06d4
for (int i = 1; i < 4; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i32_1bc);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_a8c(0x2);
}
// 130:0704
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i32_1bc);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_a8c(0xf);
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i32_1bc);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_a8c(0x78);
this->sub_128_610(2);
this->sub_130_db0();
@@ -841,7 +842,7 @@ void FoolPrologue::sub_130_004() {
}
// 130:07ec
this->sub_128_610(6);
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i < 0x2d; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_24a(1);
@@ -869,20 +870,20 @@ void FoolPrologue::sub_130_004() {
this->sub_128_de2();
// 130:0934
for (int i = 2; i < 5; i++) {
- g_zbasic->blockmove(*this->arr_i32_4129a, this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockMove(*this->arr_i32_4129a, this->arr_i32_41296[i], 0x5580);
}
// 130:0978
for (int i = 1; i < 5; i++) {
this->sub_128_1f4(i);
g_toolbox->PenPat(this->arr_i32_19c);
- g_toolbox->SetRect(this->arr_i32_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
- g_toolbox->FrameOval(this->arr_i32_1bc);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
+ g_toolbox->FrameOval(this->arr_i16_1bc);
g_toolbox->PenPat(this->arr_i16_1b4);
// 130:09d0
- g_toolbox->InsetRect(this->arr_i32_1bc, -i, -i);
+ g_toolbox->InsetRect(this->arr_i16_1bc, -i, -i);
for (int j = 2; j < 0xd; j++) {
- g_toolbox->InsetRect(this->arr_i32_1bc, -j, -j);
- g_toolbox->FrameOval(this->arr_i32_1bc);
+ g_toolbox->InsetRect(this->arr_i16_1bc, -j, -j);
+ g_toolbox->FrameOval(this->arr_i16_1bc);
}
}
// 130:0a42
@@ -890,14 +891,14 @@ void FoolPrologue::sub_130_004() {
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0x166, 0x77, 0, this->arr_i32_44);
this->sub_128_de2();
- g_zbasic->blockmove(*this->arr_i32_412ae, *this->arr_i32_412b2, 0x5580);
+ g_zbasic->blockMove(*this->arr_i32_412ae, *this->arr_i32_412b2, 0x5580);
this->sub_130_f48();
g_toolbox->ReleaseResource(*this->arr_i32_44);
this->sub_128_1f4(7);
// 130:0ac2
g_zbasic->picture(-0x14, -0x1e, 0, this->arr_i32_48);
this->sub_128_1f4(8);
- g_zbasic->blockmove(*this->arr_i32_412b2, *this->arr_i32_412b6, 0x5580);
+ g_zbasic->blockMove(*this->arr_i32_412b2, *this->arr_i32_412b6, 0x5580);
this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
g_zbasic->picture(0x16d, 0x80, 0, this->arr_i32_120);
g_toolbox->ReleaseResource(*this->arr_i32_120);
@@ -976,10 +977,10 @@ void FoolPrologue::sub_130_cea() {
void FoolPrologue::sub_130_d28() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, 0, 0x1);
- this->var_str_76 = STR(0x256); // 'Loading Prologue -'
- this->var_str_76 += Common::String::format("%d", this->var_i16_3ce);
- this->var_str_76 += STR(0x26a); // '%'
+ g_zbasic->text(0, 0xc, kFacePlain, kModeSourceOR);
+ this->var_str_76 = _("Loading Prologue -");
+ this->var_str_76 += Common::U32String::format("%d", this->var_i16_3ce);
+ this->var_str_76 += _("%");
// 130:0d70
this->sub_128_2f0(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
this->sub_128_2a6(0xe, this->var_i16_10/2);
@@ -993,10 +994,10 @@ void FoolPrologue::sub_130_db0() {
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
// 130:0dc0
- this->arr_i16_1e8[this->var_i16_6] = _vm->_rnd->getRandomNumber(0x264) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0xfb] = _vm->_rnd->getRandomNumber(0x1ba) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = _vm->_rnd->getRandomNumber(0x5) + 1;
- this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = _vm->_rnd->getRandomNumber(0xa) + 0x19;
+ this->arr_i16_1e8[this->var_i16_6] = g_engine->getRandomNumber(0x264) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0xfb] = g_engine->getRandomNumber(0x1ba) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = g_engine->getRandomNumber(0x5) + 1;
+ this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = g_engine->getRandomNumber(0xa) + 0x19;
// 130:0e68
this->sub_130_e82();
this->var_i16_6 += 1;
@@ -1028,13 +1029,13 @@ void FoolPrologue::sub_130_f48() {
while (this->var_i16_1ba > 0) {
// 130:0f78
- this->var_i16_1ba = this->var_str_76.find(STR(0x26c), this->var_i16_1ba);
- if (this->var_i16_1ba >= 0) {
- this->var_str_76.replace(this->var_i16_1ba, 1, "\"");
+ this->var_i16_1ba = g_zbasic->instr(this->var_i16_1ba, this->var_str_76, _("^"));
+ if (this->var_i16_1ba > 0) {
+ this->var_str_76.replace(this->var_i16_1ba, 1, Common::U32String("\""));
}
}
// 130:0fc8
- g_zbasic->text(0xfa, 0xc, 0, 0x1);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
this->sub_128_a6c(this->var_i16_180, this->var_i16_176);
this->var_i16_74 += 1;
}
@@ -1046,7 +1047,8 @@ void FoolPrologue::sub_130_1002() {
this->sub_131_004();
}
-void FoolPrologue:::sub_131_004() {
+// run finale
+void FoolPrologue::sub_131_004() {
// 131:0004
this->var_i16_3ce = 0x2d;
this->sub_131_4dc0();
@@ -1058,10 +1060,10 @@ void FoolPrologue:::sub_131_004() {
g_toolbox->LineTo(0xc8, 0x8d);
g_toolbox->ClosePoly();
// 131:004c
- this->arr_i32_7c = g_toolbox->GetPicture(0x1f);
+ this->arr_i32_0[0x1f] = g_toolbox->GetPicture(0x1f);
this->sub_128_1f4(0x4);
- g_zbasic->picture(0x0, 0x0, -1, 0x0, this->arr_i32_7c);
- g_toolbox->ReleaseResource(*this->arr_i32_7c);
+ g_zbasic->picture(0x0, 0x0, -1, 0x0, this->arr_i32_0[0x1f]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
this->sub_131_4dc0();
for (int i = 0x14; i < 0x1e; i++) {
// 131:009c
@@ -1088,15 +1090,15 @@ void FoolPrologue:::sub_131_004() {
}
// 131:0184
for (int i = 0x19; i <= 0x1b; i++) {
- g_toolbox->ReleaseResource(*this->arr_i32_0[i]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[i]);
}
// 131:01aa
this->arr_i32_4c = g_toolbox->GetPicture(0x13);
this->sub_128_1f4(0x5);
g_zbasic->picture(0, 0xb4, -1, 0, this->arr_i32_4c);
g_zbasic->picture(0, 0, -1, 0, this->arr_i32_60);
- g_toolbox->ReleaseResource(*this->arr_i32_4c);
- g_toolbox->ReleaseResource(*this->arr_i32_60);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x13]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x18]);
this->sub_131_4e98();
this->var_i16_3ce = 0x4b;
this->sub_131_4dc0();
@@ -1109,17 +1111,17 @@ void FoolPrologue:::sub_131_004() {
}
}
// 131:026e
- this->var_i16_18e = 0x156;
+ this->var_i16_18e = SCREEN_HEIGHT;
this->sub_128_ccc();
this->var_i32_1a6 = g_zbasic->mem(-1);
- g_toolbox->SetPortBits(&this->var_i32_32);
- if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var-i16_12 == SCREEN_HEIGHT))) {
+ g_toolbox->SetPortBits(this->var_i32_32);
+ if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
this->sub_128_2f0(0x1, 0, 0, 0x14, 0x1fc);
} else {
- g_toolbox->SetPort(&this->var_i32_c);
+ g_toolbox->SetPort(this->var_i32_c);
this->sub_128_2f0(0x2, 0, 0, 0x14, this->var_i16_10);
- g_toolbox->SetPort(&this->var_i32_8);
+ g_toolbox->SetPort(this->var_i32_8);
}
// 131:02ec
this->sub_128_21e(0x3c);
@@ -1153,24 +1155,24 @@ void FoolPrologue:::sub_131_004() {
// 131:03c0
this->sub_128_21e(0x1e);
- g_zbasic->text(0xfa, 0xc, 0, 1);
- this->var_str_76 = Common::String::format("\"%s\"", _("Well. . . that's that!"));
- g_zbasic->buffer_flush(this->var_str_76);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _("Well. . . that's that!"));
+ g_zbasic->bufferFlush(this->var_str_76);
// 131:0400
this->sub_128_a6c(0x178, 0xb4);
this->sub_128_21e(0x1e);
// 131:041a
- g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
+ g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_i32_0[0x14]);
this->sub_128_21e(0x2);
- g_zbasic->picture(0x1cd, 0xbf, -1, 0, this->arr_u8_54);
+ g_zbasic->picture(0x1cd, 0xbf, -1, 0, this->arr_i32_0[0x15]);
this->sub_128_21e(0x3c);
- g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_u8_50);
+ g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_i32_0[0x14]);
this->sub_128_21e(0x6);
- g_zbasic->picture(0x1a6, 0xbf, -1, 0, this->arr_u8_58);
+ g_zbasic->picture(0x1a6, 0xbf, -1, 0, this->arr_i32_0[0x16]);
this->sub_128_21e(0x6);
- g_zbasic->picture(0x1b3, 0xc5, -1, 0, this->arr_u8_5c);
+ g_zbasic->picture(0x1b3, 0xc5, -1, 0, this->arr_i32_0[0x17]);
// 131:04b4
for (int i = 0x14; i < 0x17; i++) {
@@ -1181,12 +1183,12 @@ void FoolPrologue:::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = *this->arr_i32_412aa;
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i32_38, this->var_i32_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
this->sub_128_2f0(0);
this->sub_131_4e48();
// 131:0538
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i32_38, this->var_i32_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
g_toolbox->SetPortBits(this->var_i32_4e);
// 131:0554
@@ -1196,18 +1198,17 @@ void FoolPrologue:::sub_131_004() {
// 131:05b0
this->sub_128_1f4(6);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(7);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(8);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(9);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i32_38, this->var_i32_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
- g_zbasic->get_from(0x1bc, 0xc1);
- g_zbasic->get_to(0x1ee, 0x117, this->arr_i32_3bca4);
+ g_zbasic->get(0x1bc, 0xc1, 0x1ee, 0x117, this->arr_i32_3bca4);
this->sub_128_24a(0x3c);
this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_128_50a(0x6, 0, 0x1fc, 0x3);
@@ -1227,16 +1228,16 @@ void FoolPrologue:::sub_131_004() {
this->var_i16_3dc = 0;
this->var_i16_18e = 0;
for (int j = 1; j < 0x63; j++) {
- if (this->var_i16_3dc > 0x156) {
+ if (this->var_i16_3dc > SCREEN_HEIGHT) {
// 131:074e
this->var_i16_3dc += g_zbasic->maybe() ? 0x4 : 0x5;
}
if (this->var_i16_18e > 0x41) {
// 131:0770
this->var_i16_18e += 1;
- this->arr_i16_1e8[this->var_i16_18e] = g_zbasic->rnd_int(32);
- this->arr_i16_1e8[this->var_i16_18e+0xfb] = g_zbasic->rnd_int(this->var_i16_3dc);
- this->arr_i16_1e8[this->var_i16_18e+0x1f6] = g_zbasic->rnd_int(0xa) + 0xa;
+ this->arr_i16_1e8[this->var_i16_18e] = g_zbasic->rndInt(32);
+ this->arr_i16_1e8[this->var_i16_18e+0xfb] = g_zbasic->rndInt(this->var_i16_3dc);
+ this->arr_i16_1e8[this->var_i16_18e+0x1f6] = g_zbasic->rndInt(0xa) + 0xa;
this->sub_131_4f96();
}
// 131:07ea
@@ -1247,9 +1248,8 @@ void FoolPrologue:::sub_131_004() {
// 131:0870
if (this->arr_i16_1e8[i] < SCREEN_WIDTH) {
this->arr_i16_1e8[i] = 1;
- this->arr_i16_1e8[0xfb+i] = g_zbasic->rnd_int(this->var_i16_3dc);
- this->arr_i16_1e8[0x1f6+i] = g_zbasic->rnd_int(0xa) + 0xa;
-
+ this->arr_i16_1e8[0xfb+i] = g_zbasic->rndInt(this->var_i16_3dc);
+ this->arr_i16_1e8[0x1f6+i] = g_zbasic->rndInt(0xa) + 0xa;
}
// 131:0902
@@ -1259,17 +1259,17 @@ void FoolPrologue:::sub_131_004() {
// 131:0926
- g_toolbox->SetRect(this->arr_i32_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->PenPat(this->arr_i32_1ac);
- g_zbasic->picture(0x6d, 0x49, -1, 0, this->arr_i32_70);
- g_zbasic->picture(0x65, 0x48, -1, 0, this->arr_i32_74);
- g_zbasic->picture(0x64, 0x54, -1, 0, this->arr_i32_78);
+ g_zbasic->picture(0x6d, 0x49, -1, 0, this->arr_i32_0[0x1c]);
+ g_zbasic->picture(0x65, 0x48, -1, 0, this->arr_i32_0[0x1d]);
+ g_zbasic->picture(0x64, 0x54, -1, 0, this->arr_i32_0[0x1e]);
// 131:099c
g_toolbox->PaintPoly(this->var_i32_3d6);
for (int i = 0; i < 0x21; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InverRect(this->arr_i32_1bc);
+ g_toolbox->InverRect(this->arr_i16_1bc);
this->sub_128_24a(1);
}
@@ -1282,11 +1282,11 @@ void FoolPrologue:::sub_131_004() {
// 131:0a7a
for (int i = 1; i < 0x63; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_74 = g_zbasic->rnd_int(0x1ca);
- this->var_i16_192 = g_zbasic->rnd_int(0xfc);
+ this->var_i16_74 = g_zbasic->rndInt(0x1ca);
+ this->var_i16_192 = g_zbasic->rndInt(0xfc);
g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
g_zbasic->194(0, this->arr_i32_3bca4, 0);
- g_toolbox->InverRect(this->arr_i32_1bc);
+ g_toolbox->InverRect(this->arr_i16_1bc);
this->sub_128_24a(1);
}
@@ -1295,14 +1295,13 @@ void FoolPrologue:::sub_131_004() {
// 131:0af6
while (g_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
- this->var_i16_74 = g_zbasic->rnd_int(0x1ca);
- this->var_i16_192 = g_zbasic->rnd_int(0xfc);
- g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
- g_zbasic->get_to(this->var_i16_74 + 0x36, this->var_16192 + 0x5a, this->arr_i32_3bca4);
+ this->var_i16_74 = g_zbasic->rndInt(0x1ca);
+ this->var_i16_192 = g_zbasic->rndInt(0xfc);
+ g_zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_16192 + 0x5a, this->arr_i32_3bca4);
// 131:0b54
- this->var_i16_74 = g_zbasic->rnd_int(0x1ca);
- this->var_i16_192 = g_zbasic->rnd_int(0xfc);
+ this->var_i16_74 = g_zbasic->rndInt(0x1ca);
+ this->var_i16_192 = g_zbasic->rndInt(0xfc);
g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
g_zbasic->194(0, this->arr_i32_3bca4, 0);
}
@@ -1310,10 +1309,10 @@ void FoolPrologue:::sub_131_004() {
// 131:0bb0
this->sub_128_50a(4, 0, 0x1fc, 3);
this->sub_128_1ba(5);
- g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_94);
+ g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_21e(0x3c);
- g_zbasic->picture(0x197, 0x101, -1, 0, this->arr_i32_98);
+ g_zbasic->picture(0x197, 0x101, -1, 0, this->arr_i32_0[0x26]);
// 131:0c36
this->var_i32_2 = g_toolbox->TickCount();
@@ -1324,18 +1323,18 @@ void FoolPrologue:::sub_131_004() {
// 131:0c6c
for (int i = 0x6; i < 0xa; i++) {
- g_zbasic->blockmove(*this->arr_i32_412aa, this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockMove(*this->arr_i32_412aa, this->arr_i32_41296[i], 0x5580);
}
this->sub_128_1f4(0x6);
- g_zbasic->picture(0x6, 0x8f, -1, 0, this->arr_i32_80);
+ g_zbasic->picture(0x6, 0x8f, -1, 0, this->arr_i32_0[0x20]);
this->sub_128_1f4(0x7);
- g_zbasic->picture(0x1a, 0x7e, -1, 0, this->arr_i32_84);
+ g_zbasic->picture(0x1a, 0x7e, -1, 0, this->arr_i32_0[0x21]);
this->sub_128_1f4(0x8);
- g_zbasic->picture(0x2e, 0x6a, -1, 0, this->arr_i32_88);
+ g_zbasic->picture(0x2e, 0x6a, -1, 0, this->arr_i32_0[0x22]);
this->sub_128_1f4(0x9);
- g_zbasic->picture(0x45, 0x4e, -1, 0, this->arr_i32_8c);
+ g_zbasic->picture(0x45, 0x4e, -1, 0, this->arr_i32_0[0x23]);
this->sub_128_1f4(0xa);
- g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_90);
+ g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_0[0x24]);
// 131:0d64
for (int i = 0x20; i < 0x23; i++) {
@@ -1343,77 +1342,77 @@ void FoolPrologue:::sub_131_004() {
}
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0x64);
- g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_94);
+ g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
this->sub_128_21e(0xf);
this->sub_128_50a(i, 0, 0x1fc, 1);
}
- g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_9c);
+ g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_0[0x27]);
this->sub_128_21e(0x3c);
// 131:0e08
- g_zbasic->text(0xfa, 0xc, 0, 0x3);
- this->var_str_76 = Common::String::format("\"%s\"", _("Are you still angry with me?"));
- g_zbasic->buffer_flush(this->var_str_76);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _("Are you still angry with me?"));
+ g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_a6c(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
this->var_i32_2 = g_toolbox->TickCount();
// 131:0e76
- g_zbasic->blockmove(this->arr_i32_412a6, this->arr_i32_412aa, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_412a6, this->arr_i32_412aa, 0x5580);
this->sub_128_1f4(0x5);
- g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_90);
- g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_9c);
- g_zbasic->picture(0x8a, 0x24, -1, 0, this->arr_i32_a0);
+ g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_0[0x24]);
+ g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_0[0x27]);
+ g_zbasic->picture(0x8a, 0x24, -1, 0, this->arr_i32_0[0x28]);
this->sub_128_1f4(0x6);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
- g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_a4);
+ g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_0[0x29]);
this->sub_128_1f4(0x7);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
- g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_a8);
- g_zbasic->blockmove(this->arr_i32_412aa, this->arr_i32_412b6, 0x5580);
+ g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_0[0x2a]);
+ g_zbasic->blockMove(this->arr_i32_412aa, this->arr_i32_412b6, 0x5580);
this->sub_128_1f4(0x8);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
- g_zbasic->blockmove(this->arr_i32_412a6, this->arr_i32_412ba, 0x5580);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
+ g_zbasic->blockMove(this->arr_i32_412a6, this->arr_i32_412ba, 0x5580);
this->sub_128_1f4(0x9);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
this->sub_128_1f4(0xa);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 2);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
// 131:1056
- g_toolbox->ReleaseResource(this->arr_i32_90);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0x78);
this->sub_128_2f0(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
this->sub_128_21e(0x28);
- this->var_i16_5e = 0x118;
- this->var_i16_62 = 0x1d1;
- this->var_i16_5c = 0x19;
- this->var_i16_66 = 0x118;
- this->var_i16_6a = 0x1d1;
- this->var_i16_68 = 0xdf;
+ this->var_i16_5c.left = 0x118;
+ this->var_i16_5c.right = 0x1d1;
+ this->var_i16_5c.top = 0x19;
+ this->var_i16_64.left = 0x118;
+ this->var_i16_64.right = 0x1d1;
+ this->var_i16_64.bottom = 0xdf;
for (int i = 0xdc; i > 0x19; i -= 5) {
// 131:10de
this->var_i32_2 = g_toolbox->TickCount();
- g_zbasic->blockmove(this->arr_i32_412aa, this->var_i32_4e, 0x5580);
- this->var_i16_64 = i;
- this->var_i16_60 = 0x19 + (i - 0xdf);
+ g_zbasic->blockMove(this->arr_i32_412aa, this->var_i32_4e, 0x5580);
+ this->var_i16_64.top = i;
+ this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
this->var_i32_40 = *this->arr_i32_412ae;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i32_5c, this->var_i32_64, 3, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
this->var_i32_40 = *this->arr_i32_412b2;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i32_5c, this->var_i32_64, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
this->sub_128_24a(0x2);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i32_64, this->var_i32_64, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
}
// 131:11a4
this->sub_128_1ba(0x5);
this->sub_128_1f4(0x5);
this->sub_128_2f0(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_ac);
+ g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
@@ -1425,13 +1424,13 @@ void FoolPrologue:::sub_131_004() {
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
- g_zbasic->text(0xfa, 0xc, 0, 0x3);
- this->var_str_76 = Common::String::format("\"%s\"", _("Yes, apparently so. . ."));
- g_zbasic->buffer_flush(this->var_str_76);
- this->sub_127_26c(0x1f0, 0xd2);
- g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_94);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _("Yes, apparently so. . ."));
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_26c(0x1f0, 0xd2);
+ g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
}
- this->sub_127_24a(0x2);
+ this->sub_128_24a(0x2);
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
}
@@ -1448,43 +1447,43 @@ void FoolPrologue:::sub_131_004() {
this->sub_128_1f4(0x5);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_bc);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0xa);
- this->var_i16_5e = 0x18b;
- this->var_i16_62 = 0x1ef;
- this->var_i16_66 = 0x18b;
- this->var_i16_6a = 0x1ef;
+ this->var_i16_5c.left = 0x18b;
+ this->var_i16_5c.right = 0x1ef;
+ this->var_i16_64.left = 0x18b;
+ this->var_i16_64.right = 0x1ef;
// 131:13b8
for (int i = 0xc0; i > 0x15; i--) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_5c = i;
- this->var_i16_60 = this->var_i16_5c + 0x96;
- this->var_i16_64 = i - 1;
- this->var_i16_68 = this->var_i16_64 + 0x96;
+ this->var_i16_5c.top = i;
+ this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
+ this->var_i16_64.top = i - 1;
+ this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
this->sub_128_24a(0x1);
}
// 131:1424
- g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_b0);
+ g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_0[0x2c]);
this->sub_128_21e(0x1);
- g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_b4);
+ g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_0[0x2d]);
this->sub_128_21e(0x1);
- g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_b8);
+ g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_0[0x2e]);
this->sub_128_1ba(0x6);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
g_toolbox->PenSize(0x3, 0x3);
- this->var_i16_6e = 0x190;
- this->var_i16_72 = SCREEN_WIDTH;
- this->var_i16_6c = 0x50;
- this->var_i16_70 = SCREEN_HEIGHT;
- this->var_i16_5e = 0;
- this->var_i16_62 = 0x32;
- this->var_i16_5c = 0;
- this->var_i16_60 = 0x32;
+ this->var_i16_6c.left = 0x190;
+ this->var_i16_6c.right = SCREEN_WIDTH;
+ this->var_i16_6c.top = 0x50;
+ this->var_i16_6c.bottom = SCREEN_HEIGHT;
+ this->var_i16_5c.left = 0;
+ this->var_i16_5c.right = 0x32;
+ this->var_i16_5c.top = 0;
+ this->var_i16_5c.bottom = 0x32;
this->var_i16_3e0 = 0x64;
// 131:14d8
@@ -1492,18 +1491,18 @@ void FoolPrologue:::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_4e);
for (int i = 1; i < 0xf; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_zbasic->blockmove(this->arr_i32_412ae, this->var_i32_4e, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_412ae, this->var_i32_4e, 0x5580);
this->var_i16_3e0 += 5 + i*2;
- this->var_i16_66 = 0x1e0;
- this->var_i16_6a = this->var_i16_66 + 0x32;
- this->var_i16_64 = this->var_i16_3e0;
- this->var_i16_68 = this->var_i16_64 + 0x32;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i32_5c, this->var_i32_64, 2, 0);
+ this->var_i16_64.left = 0x1e0;
+ this->var_i16_64.right = this->var_i16_64.left + 0x32;
+ this->var_i16_64.top = this->var_i16_3e0;
+ this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 2, 0);
// 131:1582
- g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e, i*3 + 3);
+ g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
this->sub_128_24a(0x1);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i32_6c, this->var_i32_6c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
}
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1515,8 +1514,8 @@ void FoolPrologue:::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
if (j == 0) {
- this->arr_i16_1e8[i] = 0x1f4 - i + g_zbasic->rnd_int(i);
- this->arr_i16_1e8[i+0xfb] = g_zbasic->rnd_int(i)- 0x156;
+ this->arr_i16_1e8[i] = 0x1f4 - i + g_zbasic->rndInt(i);
+ this->arr_i16_1e8[i+0xfb] = g_zbasic->rndInt(i)- SCREEN_HEIGHT;
}
// 131:1692
g_toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
@@ -1533,2652 +1532,13 @@ void FoolPrologue:::sub_131_004() {
}
this->sub_128_24a(0x3c);
- g_zbasic->text(0xfa, 0xc, 0, 0x3);
- this->var_str_76 = Common::String::format("\"%s\"", _("Well, this won't do. . ."));
- g_zbasic->buffer_flush(this->var_str_76);
- this->sub_128_026c(0x17d, 0x3c);
-/*
-
-
-
-
-0x0282: PEA - VAR(0x32)
-0x0286: TRAP - _SetPortBits
-0x0288: CMPI.W - 0x200,var_i16_10
-0x028e: SEQ - D0
-0x0290: EXT.W - D0
-0x0292: EXT.L - D0
-0x0294: PUSH.L - D0
-0x0296: CMPI.W - 0x156,var_i16_12
-0x029c: SEQ - D0
-0x029e: EXT.W - D0
-0x02a0: EXT.L - D0
-0x02a2: POPAND.L - D0
-0x02a4: TST.L - D0
-0x02a6: BNE - [0x02ac]
-
-0x02a8: JMP - [0x2c8]
---------
-0x02ac: PEA - [0x02c4]
-0x02b0: PUSH.L - 0
-0x02b2: PUSH.L - 0
-0x02b4: MOVEQ - 0x14,D0
-0x02b6: PUSH.L - D0
-0x02b8: PUSH.L - 0x000001fc
-0x02be: MOVEQ - 0x1,D0
-0x02c0: JMP - 128,0x2f0
-
-0x02c4: JMP - [0x2ec]
---------
-
-
-0x02c8: PUSH.L - var_i32_c
-0x02cc: TRAP - _SetPort
-0x02ce: PEA - [0x02e6]
-0x02d2: PUSH.L - 0
-0x02d4: PUSH.L - 0
-0x02d6: MOVEQ - 0x14,D0
-0x02d8: PUSH.L - D0
-0x02da: MOVEA.W - var_i16_10,A0
-0x02de: PUSH.L - A0
-0x02e0: MOVEQ - 0x2,D0
-0x02e2: JMP - 128,0x2f0
-
-0x02e6: PUSH.L - var_i32_8
-0x02ea: TRAP - _SetPort
-
-
-0x02ec: MOVEQ - 0x3c,D0
-0x02ee: JSR - 128,0x21e
-
-0x02f2: MOVEQ - 0x5,D0
-0x02f4: JSR - 128,0x6e4
-
-0x02f8: JSR - 128,0xe58
-
-0x02fc: JSR - [0x4e98]
-
-0x0300: MOVEQ - 0x4c,D0
-0x0302: JSR - "ZBASIC_52"
-
-0x0306: MOVEQ - 0x1,D0
-0x0308: MOVE.W - D0,var_i16_3da
-
-0x030c: LEA - VAR(0x18e),A0
-0x0310: JSR - "READ_AS_INT"
-
-0x0314: MOVEQ - 0x1,D0
-0x0316: MOVE.W - D0,var_i16_74
-
-0x031a: MOVEQ - 0x0,D0
-0x031c: MOVEA.W - var_i16_74,A0
-0x0320: ADD.L - A0,D0
-0x0322: LSL.L - 0x1,D0
-0x0324: ADDI.L - HEAP(0x1e8),D0
-0x032e: MOVEA.L - D0,A0
-0x0330: JSR - "READ_AS_INT"
-
-0x0334: MOVE.L - 0xfb,D0
-0x033a: MOVEA.W - var_i16_74,A0
-0x033e: ADD.L - A0,D0
-0x0340: LSL.L - 0x1,D0
-0x0342: ADDI.L - HEAP(0x1e8),D0
-0x034c: MOVEA.L - D0,A0
-0x034e: JSR - "READ_AS_INT"
-
-0x0352: MOVE.L - 0x1f6,D0
-0x0358: MOVEA.W - var_i16_74,A0
-0x035c: ADD.L - A0,D0
-0x035e: LSL.L - 0x1,D0
-0x0360: ADDI.L - HEAP(0x1e8),D0
-0x036a: MOVEA.L - D0,A0
-0x036c: JSR - "READ_AS_INT"
-
-0x0370: MOVE.W - var_i16_18e,D0
-0x0374: EXT.L - D0
-0x0376: ADDQ.W - 0x1,var_i16_74
-0x037a: CMP.W - var_i16_74,D0
-0x037e: BGE - [0x031a]
-
-0x0380: MOVEQ - 0xa,D0
-0x0382: PUSH.W - D0
-0x0384: TRAP - _PenMode
-0x0386: MOVEQ - 0x14,D0
-0x0388: JSR - 128,0x3ee
-
-0x038c: MOVEQ - 0xa,D0
-0x038e: JSR - 128,0x3ee
-
-0x0392: MOVEQ - 0x14,D0
-0x0394: JSR - 128,0x3ee
-
-0x0398: MOVEQ - 0x5,D0
-0x039a: JSR - 128,0x3ee
-
-0x039e: MOVEQ - 0xa,D0
-0x03a0: JSR - 128,0x3ee
-
-0x03a4: MOVEQ - 0x5,D0
-0x03a6: JSR - 128,0x3ee
-
-0x03aa: TRAP - _PenNormal
-0x03ac: MOVEQ - 0x0,D0
-0x03ae: JSR - 128,0x3ee
-
-0x03b2: MOVEQ - 0xe,D0
-0x03b4: ADDQ.W - 0x1,var_i16_3da
-0x03b8: CMP.W - var_i16_3da,D0
-0x03bc: BGE - [0x030c]
-
-0x03c0: MOVEQ - 0x1e,D0
-0x03c2: JSR - 128,0x21e
-
-0x03c6: PUSH.W - 0xfa
-0x03ca: MOVEQ - 0xc,D0
-0x03cc: PUSH.W - D0
-0x03ce: PUSH.W - 0
-0x03d0: MOVEQ - 0x1,D0
-0x03d2: PUSH.W - D0
-0x03d4: JSR - "TEXT"
-
-0x03d8: MOVEQ - 0x22,D0
-0x03da: JSR - "CHR$"
-
-0x03de: JSR - "BUFFER_CONCAT"
-
-0x03e2: MOVEA.L - STR(0x26e),A0 # b"Well. . . that's that!"
-0x03ea: JSR - "BUFFER_CONCAT"
-
-0x03ee: MOVEQ - 0x22,D0
-0x03f0: JSR - "CHR$"
-
-0x03f4: JSR - "BUFFER_CONCAT"
-
-0x03f8: LEA - VAR(0x76),A0
-0x03fc: JSR - "BUFFER_FLUSH"
-
-0x0400: PEA - [0x0414]
-0x0404: PUSH.L - 0x00000178
-0x040a: MOVE.L - 0xb4,D0
-0x0410: JMP - 128,0xa6c
-
-0x0414: MOVEQ - 0x1e,D0
-0x0416: JSR - 128,0x21e
-
-0x041a: PUSH.W - 0x1cd
-0x041e: PUSH.W - 0xbd
-0x0422: MOVEQ - -0x1,D0
-0x0424: PUSH.W - D0
-0x0426: PUSH.W - 0
-0x0428: MOVEQ - 0x50,D0
-0x042a: ADD.L - HEAP,D0
-0x042e: MOVEA.L - D0,A0
-0x0430: JSR - "PICTURE"
-
-0x0434: MOVEQ - 0x2,D0
-0x0436: JSR - 128,0x21e
-
-0x043a: PUSH.W - 0x1cd
-0x043e: PUSH.W - 0xbf
-0x0442: MOVEQ - -0x1,D0
-0x0444: PUSH.W - D0
-0x0446: PUSH.W - 0
-0x0448: MOVEQ - 0x54,D0
-0x044a: ADD.L - HEAP,D0
-0x044e: MOVEA.L - D0,A0
-0x0450: JSR - "PICTURE"
-
-0x0454: MOVEQ - 0x3c,D0
-0x0456: JSR - 128,0x21e
-
-0x045a: PUSH.W - 0x1cd
-0x045e: PUSH.W - 0xbd
-0x0462: MOVEQ - -0x1,D0
-0x0464: PUSH.W - D0
-0x0466: PUSH.W - 0
-0x0468: MOVEQ - 0x50,D0
-0x046a: ADD.L - HEAP,D0
-0x046e: MOVEA.L - D0,A0
-0x0470: JSR - "PICTURE"
-
-0x0474: MOVEQ - 0x6,D0
-0x0476: JSR - 128,0x21e
-
-0x047a: PUSH.W - 0x1a6
-0x047e: PUSH.W - 0xbf
-0x0482: MOVEQ - -0x1,D0
-0x0484: PUSH.W - D0
-0x0486: PUSH.W - 0
-0x0488: MOVEQ - 0x58,D0
-0x048a: ADD.L - HEAP,D0
-0x048e: MOVEA.L - D0,A0
-0x0490: JSR - "PICTURE"
-
-0x0494: MOVEQ - 0x6,D0
-0x0496: JSR - 128,0x21e
-
-0x049a: PUSH.W - 0x1b3
-0x049e: PUSH.W - 0xc5
-0x04a2: MOVEQ - -0x1,D0
-0x04a4: PUSH.W - D0
-0x04a6: PUSH.W - 0
-0x04a8: MOVEQ - 0x5c,D0
-0x04aa: ADD.L - HEAP,D0
-0x04ae: MOVEA.L - D0,A0
-0x04b0: JSR - "PICTURE"
-
-0x04b4: MOVEQ - 0x14,D0
-0x04b6: MOVE.W - D0,var_i16_74
-
-0x04ba: MOVE.W - var_i16_74,D0
-0x04be: EXT.L - D0
-0x04c0: LSL.L - 0x2,D0
-0x04c2: ADD.L - HEAP,D0
-0x04c6: MOVEA.L - D0,A0
-0x04c8: MOVE.L - (A0),D0
-0x04ca: PUSH.L - D0
-0x04cc: TRAP - _ReleaseResource
-0x04ce: MOVEQ - 0x17,D0
-0x04d0: ADDQ.W - 0x1,var_i16_74
-0x04d4: CMP.W - var_i16_74,D0
-0x04d8: BGE - [0x04ba]
-
-0x04da: PUSH.L - 0 (unsafe)
-0x04dc: TRAP - _TickCount
-0x04de: POP.L - D0
-0x04e0: MOVE.L - D0,var_i32_2
-
-0x04e4: MOVE.L - HEAP(0x412aa),D0
-0x04ee: MOVEA.L - D0,A0
-0x04f0: MOVE.L - (A0),D0
-0x04f2: MOVE.L - D0,var_i32_40
-
-0x04f6: PEA - VAR(0x32)
-0x04fa: PEA - VAR(0x40)
-0x04fe: PEA - VAR(0x38)
-0x0502: PEA - VAR(0x38)
-0x0506: PUSH.W - 0
-0x0508: PUSH.L - 0
-0x050a: TRAP - _CopyBits
-0x050c: MOVEQ - 0x5,D0
-0x050e: JSR - 128,0x1f4
-
-0x0512: PEA - [0x0534]
-0x0516: PUSH.L - 0x000000a6
-0x051c: PUSH.L - 0x00000173
-0x0522: PUSH.L - 0x000000b5
-0x0528: PUSH.L - 0x000001fc
-0x052e: MOVEQ - 0x0,D0
-0x0530: JMP - 128,0x2f0
-
-0x0534: JSR - [0x4e48]
-
-0x0538: PEA - VAR(0x32)
-0x053c: PEA - VAR(0x4e)
-0x0540: PEA - VAR(0x38)
-0x0544: PEA - VAR(0x38)
-0x0548: PUSH.W - 0
-0x054a: PUSH.L - 0
-0x054c: TRAP - _CopyBits
-0x054e: PEA - VAR(0x4e)
-0x0552: TRAP - _SetPortBits
-0x0554: PEA - [0x056e]
-0x0558: PUSH.L - 0
-0x055a: PUSH.L - 0
-0x055c: PUSH.L - 0x0000009c
-0x0562: PUSH.L - 0x0000015a
-0x0568: MOVEQ - 0x0,D0
-0x056a: JMP - 128,0x2f0
-
-0x056e: PEA - [0x058e]
-0x0572: PUSH.L - 0x0000009c
-0x0578: MOVEQ - 0x5a,D0
-0x057a: PUSH.L - D0
-0x057c: PUSH.L - 0x000000ce
-0x0582: PUSH.L - 0x000000a6
-0x0588: MOVEQ - 0x0,D0
-0x058a: JMP - 128,0x2f0
-
-0x058e: PEA - [0x05b0]
-0x0592: PUSH.L - 0x000000a6
-0x0598: PUSH.L - 0x00000173
-0x059e: PUSH.L - 0x000000b5
-0x05a4: PUSH.L - 0x000001fc
-0x05aa: MOVEQ - 0x0,D0
-0x05ac: JMP - 128,0x2f0
-
-0x05b0: MOVEQ - 0x6,D0
-0x05b2: JSR - 128,0x1f4
-
-0x05b6: PEA - VAR(0x4e)
-0x05ba: PEA - VAR(0x40)
-0x05be: PEA - VAR(0x38)
-0x05c2: PEA - VAR(0x38)
-0x05c6: MOVEQ - 0x1,D0
-0x05c8: PUSH.W - D0
-0x05ca: PUSH.L - 0
-0x05cc: TRAP - _CopyBits
-0x05ce: MOVEQ - 0x7,D0
-0x05d0: JSR - 128,0x1f4
-
-0x05d4: PEA - VAR(0x4e)
-0x05d8: PEA - VAR(0x40)
-0x05dc: PEA - VAR(0x38)
-0x05e0: PEA - VAR(0x38)
-0x05e4: MOVEQ - 0x1,D0
-0x05e6: PUSH.W - D0
-0x05e8: PUSH.L - 0
-0x05ea: TRAP - _CopyBits
-0x05ec: JSR - [0x4e48]
-
-0x05f0: MOVEQ - 0x8,D0
-0x05f2: JSR - 128,0x1f4
-
-0x05f6: PEA - VAR(0x4e)
-0x05fa: PEA - VAR(0x40)
-0x05fe: PEA - VAR(0x38)
-0x0602: PEA - VAR(0x38)
-0x0606: MOVEQ - 0x1,D0
-0x0608: PUSH.W - D0
-0x060a: PUSH.L - 0
-0x060c: TRAP - _CopyBits
-0x060e: JSR - [0x4e48]
-
-0x0612: MOVEQ - 0x9,D0
-0x0614: JSR - 128,0x1f4
-
-0x0618: PEA - VAR(0x4e)
-0x061c: PEA - VAR(0x40)
-0x0620: PEA - VAR(0x38)
-0x0624: PEA - VAR(0x38)
-0x0628: MOVEQ - 0x1,D0
-0x062a: PUSH.W - D0
-0x062c: PUSH.L - 0
-0x062e: TRAP - _CopyBits
-0x0630: PEA - VAR(0x32)
-0x0634: TRAP - _SetPortBits
-0x0636: MOVE.L - 0x1bc,D0
-0x063c: MOVE.L - D0,D1
-0x063e: MOVE.L - 0xc1,D0
-0x0644: JSR - "GET_FROM"
-
-0x0648: PUSH.L - 0x000001ee
-0x064e: PUSH.L - 0x00000117
-0x0654: MOVE.L - HEAP(0x3bca4),D0
-0x065e: MOVEA.L - D0,A0
-0x0660: POP.L - D0
-0x0662: POP.L - D1
-0x0664: JSR - "GET_TO"
-
-0x0668: MOVEQ - 0x3c,D0
-0x066a: JSR - 128,0x24a
-
-0x066e: PEA - [0x0690]
-0x0672: PUSH.L - 0x000000a6
-0x0678: PUSH.L - 0x00000173
-0x067e: PUSH.L - 0x000000b5
-0x0684: PUSH.L - 0x000001fc
-0x068a: MOVEQ - 0x0,D0
-0x068c: JMP - 128,0x2f0
-
-0x0690: PEA - [0x06a6]
-0x0694: MOVEQ - 0x6,D0
-0x0696: PUSH.L - D0
-0x0698: PUSH.L - 0
-0x069a: PUSH.L - 0x000001fc
-0x06a0: MOVEQ - 0x3,D0
-0x06a2: JMP - 128,0x50a
-
-0x06a6: JSR - [0x4e48]
-
-0x06aa: PEA - [0x06c0]
-0x06ae: MOVEQ - 0x5,D0
-0x06b0: PUSH.L - D0
-0x06b2: PUSH.L - 0
-0x06b4: PUSH.L - 0x000001fc
-0x06ba: MOVEQ - 0x2,D0
-0x06bc: JMP - 128,0x50a
-
-0x06c0: PEA - [0x06d6]
-0x06c4: MOVEQ - 0x7,D0
-0x06c6: PUSH.L - D0
-0x06c8: PUSH.L - 0
-0x06ca: PUSH.L - 0x000001fc
-0x06d0: MOVEQ - 0x2,D0
-0x06d2: JMP - 128,0x50a
-
-0x06d6: PEA - [0x06ec]
-0x06da: MOVEQ - 0x8,D0
-0x06dc: PUSH.L - D0
-0x06de: PUSH.L - 0
-0x06e0: PUSH.L - 0x000001fc
-0x06e6: MOVEQ - 0x1,D0
-0x06e8: JMP - 128,0x50a
-
-0x06ec: PEA - [0x070e]
-0x06f0: PUSH.L - 0x000000a6
-0x06f6: PUSH.L - 0x00000173
-0x06fc: PUSH.L - 0x000000b5
-0x0702: PUSH.L - 0x000001fc
-0x0708: MOVEQ - 0x0,D0
-0x070a: JMP - 128,0x2f0
-
-0x070e: PEA - [0x0724]
-0x0712: MOVEQ - 0x9,D0
-0x0714: PUSH.L - D0
-0x0716: PUSH.L - 0
-0x0718: PUSH.L - 0x000001fc
-0x071e: MOVEQ - 0x1,D0
-0x0720: JMP - 128,0x50a
-
-0x0724: TRAP - _PenNormal
-0x0726: MOVEQ - 0xa,D0
-0x0728: PUSH.W - D0
-0x072a: TRAP - _PenMode
-0x072c: JSR - "ZBASIC_20"
-
-0x0730: MOVEQ - 0x0,D0
-0x0732: MOVE.W - D0,var_i16_3dc
-
-0x0736: MOVEQ - 0x0,D0
-0x0738: MOVE.W - D0,var_i16_18e
-
-0x073c: MOVEQ - 0x1,D0
-0x073e: MOVE.W - D0,var_i16_3de
-
-0x0742: CMPI.W - 0x156,var_i16_3dc
-0x0748: BLT - [0x074e]
-
-0x074a: JMP - [0x764]
---------
-0x074e: JSR - "MAYBE"
-
-0x0752: TST.L - D0
-0x0754: BEQ - [0x0760]
-
-0x0758: ADDQ.W - 0x4,var_i16_3dc
-0x075c: BRA - [0x0764]
-
-0x0760: ADDQ.W - 0x5,var_i16_3dc
-0x0764: CMPI.W - 0x41,var_i16_18e
-0x076a: BLT - [0x0770]
-
-0x076c: JMP - [0x7ea]
---------
-0x0770: ADDQ.W - 0x1,var_i16_18e
-0x0774: MOVEQ - 0x0,D0
-0x0776: MOVEA.W - var_i16_18e,A0
-0x077a: ADD.L - A0,D0
-0x077c: LSL.L - 0x1,D0
-0x077e: ADDI.L - HEAP(0x1e8),D0
-0x0788: PUSH.L - D0
-0x078a: MOVEQ - 0x32,D0
-0x078c: JSR - "RND_INT"
-
-0x0790: POP.L - A0
-0x0792: MOVE.W - D0,(A0)
-
-0x0794: MOVE.L - 0xfb,D0
-0x079a: MOVEA.W - var_i16_18e,A0
-0x079e: ADD.L - A0,D0
-0x07a0: LSL.L - 0x1,D0
-0x07a2: ADDI.L - HEAP(0x1e8),D0
-0x07ac: PUSH.L - D0
-0x07ae: MOVE.W - var_i16_3dc,D0
-0x07b2: EXT.L - D0
-0x07b4: JSR - "RND_INT"
-
-0x07b8: POP.L - A0
-0x07ba: MOVE.W - D0,(A0)
-
-0x07bc: MOVE.L - 0x1f6,D0
-0x07c2: MOVEA.W - var_i16_18e,A0
-0x07c6: ADD.L - A0,D0
-0x07c8: LSL.L - 0x1,D0
-0x07ca: ADDI.L - HEAP(0x1e8),D0
-0x07d4: PUSH.L - D0
-0x07d6: MOVEQ - 0xa,D0
-0x07d8: JSR - "RND_INT"
-
-0x07dc: ADDI.L - 0x0000000a,D0
-0x07e2: POP.L - A0
-0x07e4: MOVE.W - D0,(A0)
-
-0x07e6: JSR - [0x4f96]
-
-0x07ea: MOVEQ - 0x1,D0
-0x07ec: MOVE.W - D0,var_i16_74
-
-0x07f0: JSR - [0x4f96]
-
-0x07f4: MOVEQ - 0x0,D0
-0x07f6: MOVEA.W - var_i16_74,A0
-0x07fa: ADD.L - A0,D0
-0x07fc: LSL.L - 0x1,D0
-0x07fe: ADDI.L - HEAP(0x1e8),D0
-0x0808: PUSH.L - D0
-
-0x080a: MOVEQ - 0x0,D0
-0x080c: MOVEA.W - var_i16_74,A0
-0x0810: ADD.L - A0,D0
-0x0812: LSL.L - 0x1,D0
-0x0814: ADDI.L - HEAP(0x1e8),D0
-0x081e: MOVEA.L - D0,A0
-0x0820: MOVE.W - (A0),D0
-0x0822: EXT.L - D0
-0x0824: PUSH.L - D0
-
-0x0826: MOVE.L - 0x1f6,D0
-0x082c: MOVEA.W - var_i16_74,A0
-0x0830: ADD.L - A0,D0
-0x0832: LSL.L - 0x1,D0
-0x0834: ADDI.L - HEAP(0x1e8),D0
-0x083e: MOVEA.L - D0,A0
-0x0840: MOVE.W - (A0),D0
-0x0842: EXT.L - D0
-0x0844: POP.L - D1
-0x0846: ADD.L - D1,D0
-0x0848: PUSH.L - D0
-
-0x084a: MOVE.L - 0x1f6,D0
-0x0850: MOVEA.W - var_i16_74,A0
-0x0854: ADD.L - A0,D0
-0x0856: LSL.L - 0x1,D0
-0x0858: ADDI.L - HEAP(0x1e8),D0
-0x0862: MOVEA.L - D0,A0
-0x0864: MOVE.W - (A0),D0
-0x0866: EXT.L - D0
-0x0868: POP.L - D1
-0x086a: ADD.L - D1,D0
-0x086c: POP.L - A0
-0x086e: MOVE.W - D0,(A0)
-
-0x0870: MOVEQ - 0x0,D0
-0x0872: MOVEA.W - var_i16_74,A0
-0x0876: ADD.L - A0,D0
-0x0878: LSL.L - 0x1,D0
-0x087a: ADDI.L - HEAP(0x1e8),D0
-0x0884: MOVEA.L - D0,A0
-0x0886: MOVE.W - (A0),D0
-0x0888: EXT.L - D0
-0x088a: CMPI.L - 0x200,D0
-0x0890: BGT - [0x0896]
-
-0x0892: JMP - [0x902]
---------
-0x0896: MOVEQ - 0x0,D0
-0x0898: MOVEA.W - var_i16_74,A0
-0x089c: ADD.L - A0,D0
-0x089e: LSL.L - 0x1,D0
-0x08a0: ADDI.L - HEAP(0x1e8),D0
-0x08aa: MOVEA.L - D0,A0
-0x08ac: MOVEQ - 0x1,D0
-0x08ae: MOVE.W - D0,(A0)
-
-0x08b0: MOVE.L - 0xfb,D0
-0x08b6: MOVEA.W - var_i16_74,A0
-0x08ba: ADD.L - A0,D0
-0x08bc: LSL.L - 0x1,D0
-0x08be: ADDI.L - HEAP(0x1e8),D0
-0x08c8: PUSH.L - D0
-0x08ca: MOVE.W - var_i16_3dc,D0
-0x08ce: EXT.L - D0
-0x08d0: JSR - "RND_INT"
-
-0x08d4: POP.L - A0
-0x08d6: MOVE.W - D0,(A0)
-
-0x08d8: MOVE.L - 0x1f6,D0
-0x08de: MOVEA.W - var_i16_74,A0
-0x08e2: ADD.L - A0,D0
-0x08e4: LSL.L - 0x1,D0
-0x08e6: ADDI.L - HEAP(0x1e8),D0
-0x08f0: PUSH.L - D0
-0x08f2: MOVEQ - 0xa,D0
-0x08f4: JSR - "RND_INT"
-
-0x08f8: ADDI.L - 0x0000000a,D0
-0x08fe: POP.L - A0
-0x0900: MOVE.W - D0,(A0)
-
-0x0902: JSR - [0x4f96]
-
-0x0906: MOVE.W - var_i16_18e,D0
-0x090a: EXT.L - D0
-0x090c: ADDQ.W - 0x1,var_i16_74
-0x0910: CMP.W - var_i16_74,D0
-0x0914: BGE - [0x07f0]
-
-0x0918: MOVEQ - 0x63,D0
-0x091a: ADDQ.W - 0x1,var_i16_3de
-0x091e: CMP.W - var_i16_3de,D0
-0x0922: BGE - [0x0742]
-
-0x0926: MOVE.L - HEAP(0x1bc),D0
-0x0930: PUSH.L - D0
-0x0932: PUSH.W - 0
-0x0934: PUSH.W - 0
-0x0936: PUSH.W - 0x200
-0x093a: PUSH.W - 0x156
-0x093e: TRAP - _SetRect
-0x0940: MOVE.L - HEAP(0x1ac),D0
-0x094a: PUSH.L - D0
-0x094c: TRAP - _PenPat
-0x094e: MOVEQ - 0x6d,D0
-0x0950: PUSH.W - D0
-0x0952: MOVEQ - 0x49,D0
-0x0954: PUSH.W - D0
-0x0956: MOVEQ - -0x1,D0
-0x0958: PUSH.W - D0
-0x095a: PUSH.W - 0
-0x095c: MOVEQ - 0x70,D0
-0x095e: ADD.L - HEAP,D0
-0x0962: MOVEA.L - D0,A0
-0x0964: JSR - "PICTURE"
-
-0x0968: MOVEQ - 0x65,D0
-0x096a: PUSH.W - D0
-0x096c: MOVEQ - 0x48,D0
-0x096e: PUSH.W - D0
-0x0970: MOVEQ - -0x1,D0
-0x0972: PUSH.W - D0
-0x0974: PUSH.W - 0
-0x0976: MOVEQ - 0x74,D0
-0x0978: ADD.L - HEAP,D0
-0x097c: MOVEA.L - D0,A0
-0x097e: JSR - "PICTURE"
-
-0x0982: MOVEQ - 0x64,D0
-0x0984: PUSH.W - D0
-0x0986: MOVEQ - 0x54,D0
-0x0988: PUSH.W - D0
-0x098a: MOVEQ - -0x1,D0
-0x098c: PUSH.W - D0
-0x098e: PUSH.W - 0
-0x0990: MOVEQ - 0x78,D0
-0x0992: ADD.L - HEAP,D0
-0x0996: MOVEA.L - D0,A0
-0x0998: JSR - "PICTURE"
-
-0x099c: PUSH.L - var_i32_3d6
-0x09a0: TRAP - _PaintPoly
-0x09a2: MOVEQ - 0x0,D0
-0x09a4: MOVE.W - D0,var_i16_74
-
-0x09a8: PUSH.L - 0 (unsafe)
-0x09aa: TRAP - _TickCount
-0x09ac: POP.L - D0
-0x09ae: MOVE.L - D0,var_i32_2
-
-0x09b2: MOVE.L - HEAP(0x1bc),D0
-0x09bc: PUSH.L - D0
-0x09be: TRAP - _InverRect
-0x09c0: MOVEQ - 0x1,D0
-0x09c2: JSR - 128,0x24a
-
-0x09c6: MOVEQ - 0x21,D0
-0x09c8: ADDQ.W - 0x1,var_i16_74
-0x09cc: CMP.W - var_i16_74,D0
-0x09d0: BGE - [0x09a8]
-
-0x09d2: PEA - [0x0a04]
-0x09d6: PUSH.L - 0x000000bd
-0x09dc: PUSH.L - 0x000001b8
-0x09e2: PUSH.L - 0x00000117
-0x09e8: PUSH.L - 0x000001ee
-0x09ee: PUSH.L - 0
-0x09f0: PUSH.L - 0
-0x09f2: PUSH.L - 0x00000152
-0x09f8: PUSH.L - 0x000001fc
-0x09fe: MOVEQ - 0x21,D0
-0x0a00: JMP - 128,0x800
-
-0x0a04: PEA - [0x0a2e]
-0x0a08: PUSH.L - 0x00000152
-0x0a0e: PUSH.L - 0
-0x0a10: PUSH.L - 0x00000152
-0x0a16: PUSH.L - 0
-0x0a18: PUSH.L - 0
-0x0a1a: PUSH.L - 0
-0x0a1c: PUSH.L - 0x00000152
-0x0a22: PUSH.L - 0x000001fc
-0x0a28: MOVEQ - 0x21,D0
-0x0a2a: JMP - 128,0x800
-
-0x0a2e: PEA - [0x0a50]
-0x0a32: PUSH.L - 0
-0x0a34: PUSH.L - 0
-0x0a36: PUSH.L - 0
-0x0a38: PUSH.L - 0
-0x0a3a: PUSH.L - 0
-0x0a3c: PUSH.L - 0
-0x0a3e: PUSH.L - 0x00000152
-0x0a44: PUSH.L - 0x000001fc
-0x0a4a: MOVEQ - 0x21,D0
-0x0a4c: JMP - 128,0x800
-
-0x0a50: PEA - [0x0a7a]
-0x0a54: PUSH.L - 0
-0x0a56: PUSH.L - 0x000001fc
-0x0a5c: PUSH.L - 0
-0x0a5e: PUSH.L - 0x000001fc
-0x0a64: PUSH.L - 0
-0x0a66: PUSH.L - 0
-0x0a68: PUSH.L - 0x00000152
-0x0a6e: PUSH.L - 0x000001fc
-0x0a74: MOVEQ - 0x21,D0
-0x0a76: JMP - 128,0x800
-
-0x0a7a: MOVEQ - 0x1,D0
-0x0a7c: MOVE.W - D0,var_i16_1ba
-
-0x0a80: PUSH.L - 0 (unsafe)
-0x0a82: TRAP - _TickCount
-0x0a84: POP.L - D0
-0x0a86: MOVE.L - D0,var_i32_2
-
-0x0a8a: MOVE.L - 0x1ca,D0
-0x0a90: JSR - "RND_INT"
-
-0x0a94: MOVE.W - D0,var_i16_74
-
-0x0a98: MOVE.L - 0xfc,D0
-0x0a9e: JSR - "RND_INT"
-
-0x0aa2: MOVE.W - D0,var_i16_192
-
-0x0aa6: MOVE.W - var_i16_74,D0
-0x0aaa: EXT.L - D0
-0x0aac: MOVE.L - D0,D1
-0x0aae: MOVE.W - var_i16_192,D0
-0x0ab2: EXT.L - D0
-0x0ab4: JSR - "GET_FROM"
-
-0x0ab8: PUSH.W - 0
-0x0aba: MOVE.L - HEAP(0x3bca4),D0
-0x0ac4: PUSH.L - D0
-0x0ac6: MOVEQ - 0x0,D0
-0x0ac8: JSR - "ZBASIC_194"
-
-0x0acc: MOVE.L - HEAP(0x1bc),D0
-0x0ad6: PUSH.L - D0
-0x0ad8: TRAP - _InverRect
-0x0ada: MOVEQ - 0x1,D0
-0x0adc: JSR - 128,0x24a
-
-0x0ae0: MOVEQ - 0x63,D0
-0x0ae2: ADDQ.W - 0x1,var_i16_1ba
-0x0ae6: CMP.W - var_i16_1ba,D0
-0x0aea: BGE - [0x0a80]
-
-0x0aec: PUSH.L - 0 (unsafe)
-0x0aee: TRAP - _TickCount
-0x0af0: POP.L - D0
-0x0af2: MOVE.L - D0,var_i32_2
-
-0x0af6: MOVE.L - 0x1ca,D0
-0x0afc: JSR - "RND_INT"
-
-0x0b00: MOVE.W - D0,var_i16_74
-
-0x0b04: MOVE.L - 0xfc,D0
-0x0b0a: JSR - "RND_INT"
-
-0x0b0e: MOVE.W - D0,var_i16_192
-
-0x0b12: MOVE.W - var_i16_74,D0
-0x0b16: EXT.L - D0
-0x0b18: MOVE.L - D0,D1
-0x0b1a: MOVE.W - var_i16_192,D0
-0x0b1e: EXT.L - D0
-0x0b20: JSR - "GET_FROM"
-
-0x0b24: MOVE.W - var_i16_74,D0
-0x0b28: EXT.L - D0
-0x0b2a: ADDI.L - 0x00000036,D0
-0x0b30: PUSH.L - D0
-0x0b32: MOVE.W - var_i16_192,D0
-0x0b36: EXT.L - D0
-0x0b38: ADDI.L - 0x0000005a,D0
-0x0b3e: PUSH.L - D0
-0x0b40: MOVE.L - HEAP(0x3bca4),D0
-0x0b4a: MOVEA.L - D0,A0
-0x0b4c: POP.L - D0
-0x0b4e: POP.L - D1
-0x0b50: JSR - "GET_TO"
-
-0x0b54: MOVE.L - 0x1ca,D0
-0x0b5a: JSR - "RND_INT"
-
-0x0b5e: MOVE.W - D0,var_i16_74
-
-0x0b62: MOVE.L - 0xfc,D0
-0x0b68: JSR - "RND_INT"
-
-0x0b6c: MOVE.W - D0,var_i16_192
-
-0x0b70: MOVE.W - var_i16_74,D0
-0x0b74: EXT.L - D0
-0x0b76: MOVE.L - D0,D1
-0x0b78: MOVE.W - var_i16_192,D0
-0x0b7c: EXT.L - D0
-0x0b7e: JSR - "GET_FROM"
-
-0x0b82: PUSH.W - 0
-0x0b84: MOVE.L - HEAP(0x3bca4),D0
-0x0b8e: PUSH.L - D0
-0x0b90: MOVEQ - 0x0,D0
-0x0b92: JSR - "ZBASIC_194"
-
-0x0b96: PUSH.L - 0 (unsafe)
-0x0b98: TRAP - _TickCount
-0x0b9a: POP.L - D0
-0x0b9c: PUSH.L - D0
-0x0b9e: MOVE.L - var_i32_2,D0
-0x0ba2: ADDI.L - 0x00000078,D0
-0x0ba8: POP.L - D1
-0x0baa: CMP.L - D0,D1
-0x0bac: BLE - [0x0af6]
-
-0x0bb0: PEA - [0x0bc6]
-0x0bb4: MOVEQ - 0x4,D0
-0x0bb6: PUSH.L - D0
-0x0bb8: PUSH.L - 0
-0x0bba: PUSH.L - 0x000001fc
-0x0bc0: MOVEQ - 0x3,D0
-0x0bc2: JMP - 128,0x50a
-
-0x0bc6: MOVEQ - 0x5,D0
-0x0bc8: JSR - 128,0x1f4
-
-0x0bcc: MOVEQ - 0x5,D0
-0x0bce: JSR - 128,0x1ba
-
-0x0bd2: PUSH.W - 0x198
-0x0bd6: PUSH.W - 0x102
-0x0bda: MOVEQ - -0x1,D0
-0x0bdc: PUSH.W - D0
-0x0bde: PUSH.W - 0
-0x0be0: MOVE.L - HEAP(0x94),D0
-0x0bea: MOVEA.L - D0,A0
-0x0bec: JSR - "PICTURE"
-
-0x0bf0: PEA - VAR(0x32)
-0x0bf4: TRAP - _SetPortBits
-0x0bf6: MOVEQ - 0x3c,D0
-0x0bf8: JSR - 128,0x21e
-
-0x0bfc: PEA - [0x0c12]
-0x0c00: MOVEQ - 0x5,D0
-0x0c02: PUSH.L - D0
-0x0c04: PUSH.L - 0
-0x0c06: PUSH.L - 0x000001fc
-0x0c0c: MOVEQ - 0x0,D0
-0x0c0e: JMP - 128,0x50a
-
-0x0c12: MOVEQ - 0x3c,D0
-0x0c14: JSR - 128,0x21e
-
-0x0c18: PUSH.W - 0x197
-0x0c1c: PUSH.W - 0x101
-0x0c20: MOVEQ - -0x1,D0
-0x0c22: PUSH.W - D0
-0x0c24: PUSH.W - 0
-0x0c26: MOVE.L - HEAP(0x98),D0
-0x0c30: MOVEA.L - D0,A0
-0x0c32: JSR - "PICTURE"
-
-0x0c36: PUSH.L - 0 (unsafe)
-0x0c38: TRAP - _TickCount
-0x0c3a: POP.L - D0
-0x0c3c: MOVE.L - D0,var_i32_2
-
-0x0c40: PUSH.L - var_i32_3d6
-0x0c44: TRAP - _KillPoly
-0x0c46: MOVEQ - 0x1c,D0
-0x0c48: MOVE.W - D0,var_i16_74
-
-0x0c4c: MOVE.W - var_i16_74,D0
-0x0c50: EXT.L - D0
-0x0c52: LSL.L - 0x2,D0
-0x0c54: ADD.L - HEAP,D0
-0x0c58: MOVEA.L - D0,A0
-0x0c5a: MOVE.L - (A0),D0
-0x0c5c: PUSH.L - D0
-0x0c5e: TRAP - _ReleaseResource
-0x0c60: MOVEQ - 0x1e,D0
-0x0c62: ADDQ.W - 0x1,var_i16_74
-0x0c66: CMP.W - var_i16_74,D0
-0x0c6a: BGE - [0x0c4c]
-
-0x0c6c: MOVEQ - 0x6,D0
-0x0c6e: MOVE.W - D0,var_i16_74
-
-0x0c72: MOVE.L - HEAP(0x412aa),D0
-0x0c7c: MOVEA.L - D0,A0
-0x0c7e: MOVE.L - (A0),D0
-0x0c80: PUSH.L - D0
-0x0c82: MOVE.W - var_i16_74,D0
-0x0c86: EXT.L - D0
-0x0c88: LSL.L - 0x2,D0
-0x0c8a: ADDI.L - HEAP(0x41296),D0
-0x0c94: MOVEA.L - D0,A0
-0x0c96: MOVE.L - (A0),D0
-0x0c98: PUSH.L - D0
-0x0c9a: MOVE.L - 0x5580,D0
-0x0ca0: JSR - "BLOCKMOVE"
-
-0x0ca4: MOVEQ - 0xa,D0
-0x0ca6: ADDQ.W - 0x1,var_i16_74
-0x0caa: CMP.W - var_i16_74,D0
-0x0cae: BGE - [0x0c72]
-
-0x0cb0: MOVEQ - 0x6,D0
-0x0cb2: JSR - 128,0x1f4
-
-0x0cb6: MOVEQ - 0x6,D0
-0x0cb8: PUSH.W - D0
-0x0cba: PUSH.W - 0x8f
-0x0cbe: MOVEQ - -0x1,D0
-0x0cc0: PUSH.W - D0
-0x0cc2: PUSH.W - 0
-0x0cc4: MOVE.L - HEAP(0x80),D0
-0x0cce: MOVEA.L - D0,A0
-0x0cd0: JSR - "PICTURE"
-
-0x0cd4: MOVEQ - 0x7,D0
-0x0cd6: JSR - 128,0x1f4
-
-0x0cda: MOVEQ - 0x1a,D0
-0x0cdc: PUSH.W - D0
-0x0cde: MOVEQ - 0x7e,D0
-0x0ce0: PUSH.W - D0
-0x0ce2: MOVEQ - -0x1,D0
-0x0ce4: PUSH.W - D0
-0x0ce6: PUSH.W - 0
-0x0ce8: MOVE.L - HEAP(0x84),D0
-0x0cf2: MOVEA.L - D0,A0
-0x0cf4: JSR - "PICTURE"
-
-0x0cf8: MOVEQ - 0x8,D0
-0x0cfa: JSR - 128,0x1f4
-
-0x0cfe: MOVEQ - 0x2e,D0
-0x0d00: PUSH.W - D0
-0x0d02: MOVEQ - 0x6a,D0
-0x0d04: PUSH.W - D0
-0x0d06: MOVEQ - -0x1,D0
-0x0d08: PUSH.W - D0
-0x0d0a: PUSH.W - 0
-0x0d0c: MOVE.L - HEAP(0x88),D0
-0x0d16: MOVEA.L - D0,A0
-0x0d18: JSR - "PICTURE"
-
-0x0d1c: MOVEQ - 0x9,D0
-0x0d1e: JSR - 128,0x1f4
-
-0x0d22: MOVEQ - 0x45,D0
-0x0d24: PUSH.W - D0
-0x0d26: MOVEQ - 0x4e,D0
-0x0d28: PUSH.W - D0
-0x0d2a: MOVEQ - -0x1,D0
-0x0d2c: PUSH.W - D0
-0x0d2e: PUSH.W - 0
-0x0d30: MOVE.L - HEAP(0x8c),D0
-0x0d3a: MOVEA.L - D0,A0
-0x0d3c: JSR - "PICTURE"
-
-0x0d40: MOVEQ - 0xa,D0
-0x0d42: JSR - 128,0x1f4
-
-0x0d46: MOVEQ - 0x73,D0
-0x0d48: PUSH.W - D0
-0x0d4a: MOVEQ - 0x28,D0
-0x0d4c: PUSH.W - D0
-0x0d4e: MOVEQ - -0x1,D0
-0x0d50: PUSH.W - D0
-0x0d52: PUSH.W - 0
-0x0d54: MOVE.L - HEAP(0x90),D0
-0x0d5e: MOVEA.L - D0,A0
-0x0d60: JSR - "PICTURE"
-
-0x0d64: MOVEQ - 0x20,D0
-0x0d66: MOVE.W - D0,var_i16_74
-
-0x0d6a: MOVE.W - var_i16_74,D0
-0x0d6e: EXT.L - D0
-0x0d70: LSL.L - 0x2,D0
-0x0d72: ADD.L - HEAP,D0
-0x0d76: MOVEA.L - D0,A0
-0x0d78: MOVE.L - (A0),D0
-0x0d7a: PUSH.L - D0
-0x0d7c: TRAP - _ReleaseResource
-0x0d7e: MOVEQ - 0x23,D0
-0x0d80: ADDQ.W - 0x1,var_i16_74
-0x0d84: CMP.W - var_i16_74,D0
-0x0d88: BGE - [0x0d6a]
-
-0x0d8a: PEA - VAR(0x32)
-0x0d8e: TRAP - _SetPortBits
-0x0d90: MOVEQ - 0x64,D0
-0x0d92: JSR - 128,0x24a
-
-0x0d96: PUSH.W - 0x198
-0x0d9a: PUSH.W - 0x102
-0x0d9e: MOVEQ - -0x1,D0
-0x0da0: PUSH.W - D0
-0x0da2: PUSH.W - 0
-0x0da4: MOVE.L - HEAP(0x94),D0
-0x0dae: MOVEA.L - D0,A0
-0x0db0: JSR - "PICTURE"
-
-0x0db4: MOVEQ - 0x6,D0
-0x0db6: MOVE.W - D0,var_i16_74
-
-0x0dba: MOVEQ - 0xf,D0
-0x0dbc: JSR - 128,0x21e
-
-0x0dc0: PEA - [0x0dd8]
-0x0dc4: MOVEA.W - var_i16_74,A0
-0x0dc8: PUSH.L - A0
-0x0dca: PUSH.L - 0
-0x0dcc: PUSH.L - 0x000001fc
-0x0dd2: MOVEQ - 0x1,D0
-0x0dd4: JMP - 128,0x50a
-
-0x0dd8: MOVEQ - 0xa,D0
-0x0dda: ADDQ.W - 0x1,var_i16_74
-0x0dde: CMP.W - var_i16_74,D0
-0x0de2: BGE - [0x0dba]
-
-0x0de4: PUSH.W - 0x191
-0x0de8: PUSH.W - 0x102
-0x0dec: MOVEQ - -0x1,D0
-0x0dee: PUSH.W - D0
-0x0df0: PUSH.W - 0
-0x0df2: MOVE.L - HEAP(0x9c),D0
-0x0dfc: MOVEA.L - D0,A0
-0x0dfe: JSR - "PICTURE"
-
-0x0e02: MOVEQ - 0x3c,D0
-0x0e04: JSR - 128,0x21e
-
-0x0e08: PUSH.W - 0xfa
-0x0e0c: MOVEQ - 0xc,D0
-0x0e0e: PUSH.W - D0
-0x0e10: PUSH.W - 0
-0x0e12: MOVEQ - 0x3,D0
-0x0e14: PUSH.W - D0
-0x0e16: JSR - "TEXT"
-
-0x0e1a: MOVEQ - 0x22,D0
-0x0e1c: JSR - "CHR$"
-
-0x0e20: JSR - "BUFFER_CONCAT"
-
-0x0e24: MOVEA.L - STR(0x286),A0 # b'Are you still angry with me?'
-0x0e2c: JSR - "BUFFER_CONCAT"
-
-0x0e30: MOVEQ - 0x22,D0
-0x0e32: JSR - "CHR$"
-
-0x0e36: JSR - "BUFFER_CONCAT"
-
-0x0e3a: LEA - VAR(0x76),A0
-0x0e3e: JSR - "BUFFER_FLUSH"
-
-0x0e42: PEA - [0x0e6c]
-0x0e46: MOVE.L - 0x1f4,D0
-0x0e4c: PUSH.L - D0
-0x0e4e: PUSH.W - 0 (unsafe)
-0x0e50: PEA - VAR(0x76)
-0x0e54: TRAP - _StringWidth
-0x0e56: POP.W - D0
-0x0e58: EXT.L - D0
-0x0e5a: POP.L - D1
-0x0e5c: EXG - D0,D1
-0x0e5e: SUB.L - D1,D0
-0x0e60: PUSH.L - D0
-0x0e62: MOVE.L - 0xd2,D0
-0x0e68: JMP - 128,0xa6c
-
-0x0e6c: PUSH.L - 0 (unsafe)
-0x0e6e: TRAP - _TickCount
-0x0e70: POP.L - D0
-0x0e72: MOVE.L - D0,var_i32_2
-
-0x0e76: MOVE.L - HEAP(0x412a6),D0
-0x0e80: MOVEA.L - D0,A0
-0x0e82: MOVE.L - (A0),D0
-0x0e84: PUSH.L - D0
-0x0e86: MOVE.L - HEAP(0x412aa),D0
-0x0e90: MOVEA.L - D0,A0
-0x0e92: MOVE.L - (A0),D0
-0x0e94: PUSH.L - D0
-0x0e96: MOVE.L - 0x5580,D0
-0x0e9c: JSR - "BLOCKMOVE"
-
-0x0ea0: MOVEQ - 0x5,D0
-0x0ea2: JSR - 128,0x1f4
-
-0x0ea6: MOVEQ - 0x73,D0
-0x0ea8: PUSH.W - D0
-0x0eaa: MOVEQ - 0x28,D0
-0x0eac: PUSH.W - D0
-0x0eae: MOVEQ - -0x1,D0
-0x0eb0: PUSH.W - D0
-0x0eb2: PUSH.W - 0
-0x0eb4: MOVE.L - HEAP(0x90),D0
-0x0ebe: MOVEA.L - D0,A0
-0x0ec0: JSR - "PICTURE"
-
-0x0ec4: PUSH.W - 0x191
-0x0ec8: PUSH.W - 0x102
-0x0ecc: MOVEQ - -0x1,D0
-0x0ece: PUSH.W - D0
-0x0ed0: PUSH.W - 0
-0x0ed2: MOVE.L - HEAP(0x9c),D0
-0x0edc: MOVEA.L - D0,A0
-0x0ede: JSR - "PICTURE"
-
-0x0ee2: PUSH.W - 0x8a
-0x0ee6: MOVEQ - 0x24,D0
-0x0ee8: PUSH.W - D0
-0x0eea: MOVEQ - -0x1,D0
-0x0eec: PUSH.W - D0
-0x0eee: PUSH.W - 0
-0x0ef0: MOVE.L - HEAP(0xa0),D0
-0x0efa: MOVEA.L - D0,A0
-0x0efc: JSR - "PICTURE"
-
-0x0f00: MOVEQ - 0x6,D0
-0x0f02: JSR - 128,0x1f4
-
-0x0f06: PEA - [0x0f20]
-0x0f0a: PUSH.L - 0
-0x0f0c: PUSH.L - 0
-0x0f0e: PUSH.L - 0x00000152
-0x0f14: PUSH.L - 0x000001fc
-0x0f1a: MOVEQ - 0x0,D0
-0x0f1c: JMP - 128,0x2f0
-
-0x0f20: PUSH.W - 0x118
-0x0f24: MOVEQ - 0x19,D0
-0x0f26: PUSH.W - D0
-0x0f28: MOVEQ - -0x1,D0
-0x0f2a: PUSH.W - D0
-0x0f2c: PUSH.W - 0
-0x0f2e: MOVE.L - HEAP(0xa4),D0
-0x0f38: MOVEA.L - D0,A0
-0x0f3a: JSR - "PICTURE"
-
-0x0f3e: MOVEQ - 0x7,D0
-0x0f40: JSR - 128,0x1f4
-
-0x0f44: PEA - [0x0f5e]
-0x0f48: PUSH.L - 0
-0x0f4a: PUSH.L - 0
-0x0f4c: PUSH.L - 0x00000152
-0x0f52: PUSH.L - 0x000001fc
-0x0f58: MOVEQ - 0x0,D0
-0x0f5a: JMP - 128,0x2f0
-
-0x0f5e: PUSH.W - 0x118
-0x0f62: MOVEQ - 0x19,D0
-0x0f64: PUSH.W - D0
-0x0f66: MOVEQ - -0x1,D0
-0x0f68: PUSH.W - D0
-0x0f6a: PUSH.W - 0
-0x0f6c: MOVE.L - HEAP(0xa8),D0
-0x0f76: MOVEA.L - D0,A0
-0x0f78: JSR - "PICTURE"
-
-0x0f7c: MOVE.L - HEAP(0x412aa),D0
-0x0f86: MOVEA.L - D0,A0
-0x0f88: MOVE.L - (A0),D0
-0x0f8a: PUSH.L - D0
-0x0f8c: MOVE.L - HEAP(0x412b6),D0
-0x0f96: MOVEA.L - D0,A0
-0x0f98: MOVE.L - (A0),D0
-0x0f9a: PUSH.L - D0
-0x0f9c: MOVE.L - 0x5580,D0
-0x0fa2: JSR - "BLOCKMOVE"
-
-0x0fa6: MOVEQ - 0x8,D0
-0x0fa8: JSR - 128,0x1f4
-
-0x0fac: PUSH.W - 0x18f
-0x0fb0: PUSH.W - 0xc0
-0x0fb4: MOVEQ - -0x1,D0
-0x0fb6: PUSH.W - D0
-0x0fb8: PUSH.W - 0
-0x0fba: MOVE.L - HEAP(0xac),D0
-0x0fc4: MOVEA.L - D0,A0
-0x0fc6: JSR - "PICTURE"
-
-0x0fca: MOVE.L - HEAP(0x412a6),D0
-0x0fd4: MOVEA.L - D0,A0
-0x0fd6: MOVE.L - (A0),D0
-0x0fd8: PUSH.L - D0
-0x0fda: MOVE.L - HEAP(0x412ba),D0
-0x0fe4: MOVEA.L - D0,A0
-0x0fe6: MOVE.L - (A0),D0
-0x0fe8: PUSH.L - D0
-0x0fea: MOVE.L - 0x5580,D0
-0x0ff0: JSR - "BLOCKMOVE"
-
-0x0ff4: MOVEQ - 0x9,D0
-0x0ff6: JSR - 128,0x1f4
-
-0x0ffa: PUSH.W - 0x18f
-0x0ffe: PUSH.W - 0xc0
-0x1002: MOVEQ - -0x1,D0
-0x1004: PUSH.W - D0
-0x1006: PUSH.W - 0
-0x1008: MOVE.L - HEAP(0xac),D0
-0x1012: MOVEA.L - D0,A0
-0x1014: JSR - "PICTURE"
-
-0x1018: MOVEQ - 0xa,D0
-0x101a: JSR - 128,0x1f4
-
-0x101e: PEA - [0x1038]
-0x1022: PUSH.L - 0
-0x1024: PUSH.L - 0
-0x1026: PUSH.L - 0x00000152
-0x102c: PUSH.L - 0x000001fc
-0x1032: MOVEQ - 0x2,D0
-0x1034: JMP - 128,0x2f0
-
-0x1038: PUSH.W - 0x18f
-0x103c: PUSH.W - 0xc0
-0x1040: MOVEQ - -0x1,D0
-0x1042: PUSH.W - D0
-0x1044: PUSH.W - 0
-0x1046: MOVE.L - HEAP(0xac),D0
-0x1050: MOVEA.L - D0,A0
-0x1052: JSR - "PICTURE"
-
-0x1056: MOVE.L - HEAP(0x90),D0
-0x1060: MOVEA.L - D0,A0
-0x1062: MOVE.L - (A0),D0
-0x1064: PUSH.L - D0
-0x1066: TRAP - _ReleaseResource
-0x1068: PEA - VAR(0x32)
-0x106c: TRAP - _SetPortBits
-0x106e: MOVEQ - 0x78,D0
-0x1070: JSR - 128,0x24a
-
-0x1074: PEA - [0x1096]
-0x1078: PUSH.L - 0x000000c4
-0x107e: PUSH.L - 0x00000141
-0x1084: PUSH.L - 0x000000d3
-0x108a: PUSH.L - 0x000001fc
-0x1090: MOVEQ - 0x2,D0
-0x1092: JMP - 128,0x2f0
-
-0x1096: PEA - [0x10ae]
-0x109a: MOVEQ - 0x5,D0
-0x109c: PUSH.L - D0
-0x109e: MOVEQ - 0x64,D0
-0x10a0: PUSH.L - D0
-0x10a2: PUSH.L - 0x00000198
-0x10a8: MOVEQ - 0x0,D0
-0x10aa: JMP - 128,0x50a
-
-0x10ae: MOVEQ - 0x28,D0
-0x10b0: JSR - 128,0x21e
-
-0x10b4: MOVE.W - 0x118,var_i16_5e
-
-0x10ba: MOVE.W - 0x1d1,var_i16_62
-
-0x10c0: MOVEQ - 0x19,D0
-0x10c2: MOVE.W - D0,var_i16_5c
-
-0x10c6: MOVE.W - 0x118,var_i16_66
-
-0x10cc: MOVE.W - 0x1d1,var_i16_6a
-
-0x10d2: MOVE.W - 0xdf,var_i16_68
-
-0x10d8: MOVE.W - 0xdc,var_i16_74
-
-0x10de: PUSH.L - 0 (unsafe)
-0x10e0: TRAP - _TickCount
-0x10e2: POP.L - D0
-0x10e4: MOVE.L - D0,var_i32_2
-
-0x10e8: MOVE.L - HEAP(0x412aa),D0
-0x10f2: MOVEA.L - D0,A0
-0x10f4: MOVE.L - (A0),D0
-0x10f6: PUSH.L - D0
-0x10f8: PUSH.L - var_i32_4e
-0x10fc: MOVE.L - 0x5580,D0
-0x1102: JSR - "BLOCKMOVE"
-
-0x1106: MOVE.W - var_i16_74,var_i16_64
-
-0x110c: MOVEQ - 0x19,D0
-0x110e: PUSH.L - D0
-0x1110: MOVE.L - 0xdf,D0
-0x1116: MOVEA.W - var_i16_74,A0
-0x111a: SUB.L - A0,D0
-0x111c: POP.L - D1
-0x111e: ADD.L - D1,D0
-0x1120: MOVE.W - D0,var_i16_60
-
-0x1124: MOVE.L - HEAP(0x412ae),D0
-0x112e: MOVEA.L - D0,A0
-0x1130: MOVE.L - (A0),D0
-0x1132: MOVE.L - D0,var_i32_40
-
-0x1136: PEA - VAR(0x40)
-0x113a: PEA - VAR(0x4e)
-0x113e: PEA - VAR(0x5c)
-0x1142: PEA - VAR(0x64)
-0x1146: MOVEQ - 0x3,D0
-0x1148: PUSH.W - D0
-0x114a: PUSH.L - 0
-0x114c: TRAP - _CopyBits
-0x114e: MOVE.L - HEAP(0x412b2),D0
-0x1158: MOVEA.L - D0,A0
-0x115a: MOVE.L - (A0),D0
-0x115c: MOVE.L - D0,var_i32_40
-
-0x1160: PEA - VAR(0x40)
-0x1164: PEA - VAR(0x4e)
-0x1168: PEA - VAR(0x5c)
-0x116c: PEA - VAR(0x64)
-0x1170: MOVEQ - 0x1,D0
-0x1172: PUSH.W - D0
-0x1174: PUSH.L - 0
-0x1176: TRAP - _CopyBits
-0x1178: MOVEQ - 0x2,D0
-0x117a: JSR - 128,0x24a
-
-0x117e: PEA - VAR(0x4e)
-0x1182: PEA - VAR(0x32)
-0x1186: PEA - VAR(0x64)
-0x118a: PEA - VAR(0x64)
-0x118e: PUSH.W - 0
-0x1190: PUSH.L - 0
-0x1192: TRAP - _CopyBits
-0x1194: MOVEQ - 0x19,D0
-0x1196: ADDI.W - 0xfffb,var_i16_74
-0x119c: CMP.W - var_i16_74,D0
-0x11a0: BLE - [0x10de]
-
-0x11a4: MOVEQ - 0x5,D0
-0x11a6: JSR - 128,0x1ba
-
-0x11aa: MOVEQ - 0x5,D0
-0x11ac: JSR - 128,0x1f4
-
-0x11b0: PEA - [0x11d2]
-0x11b4: PUSH.L - 0x000000c4
-0x11ba: PUSH.L - 0x00000141
-0x11c0: PUSH.L - 0x000000d3
-0x11c6: PUSH.L - 0x000001fc
-0x11cc: MOVEQ - 0x2,D0
-0x11ce: JMP - 128,0x2f0
-
-0x11d2: PUSH.W - 0x18f
-0x11d6: PUSH.W - 0xc0
-0x11da: MOVEQ - -0x1,D0
-0x11dc: PUSH.W - D0
-0x11de: PUSH.W - 0
-0x11e0: MOVE.L - HEAP(0xac),D0
-0x11ea: MOVEA.L - D0,A0
-0x11ec: JSR - "PICTURE"
-
-0x11f0: PEA - VAR(0x32)
-0x11f4: TRAP - _SetPortBits
-0x11f6: TRAP - _PenNormal
-0x11f8: MOVEQ - 0xa,D0
-0x11fa: PUSH.W - D0
-0x11fc: TRAP - _PenMode
-0x11fe: MOVEQ - 0x5,D0
-0x1200: PUSH.W - D0
-0x1202: MOVEQ - 0x5,D0
-0x1204: PUSH.W - D0
-0x1206: TRAP - _PenSize
-0x1208: MOVEQ - 0x0,D0
-0x120a: MOVE.W - D0,var_i16_74
-
-0x120e: PUSH.L - 0 (unsafe)
-0x1210: TRAP - _TickCount
-0x1212: POP.L - D0
-0x1214: MOVE.L - D0,var_i32_2
-
-0x1218: PUSH.W - 0x172
-0x121c: MOVEQ - 0x33,D0
-0x121e: PUSH.W - D0
-0x1220: TRAP - _MoveTo
-0x1222: PUSH.W - var_i16_74
-0x1226: PUSH.W - 0x14a
-0x122a: TRAP - _LineTo
-0x122c: CMPI.W - 0x4e,var_i16_74
-0x1232: BEQ - [0x1238]
-
-0x1234: JMP - [0x12a4]
---------
-0x1238: PUSH.W - 0xfa
-0x123c: MOVEQ - 0xc,D0
-0x123e: PUSH.W - D0
-0x1240: PUSH.W - 0
-0x1242: MOVEQ - 0x3,D0
-0x1244: PUSH.W - D0
-0x1246: JSR - "TEXT"
-
-0x124a: MOVEQ - 0x22,D0
-0x124c: JSR - "CHR$"
-
-0x1250: JSR - "BUFFER_CONCAT"
-
-0x1254: MOVEA.L - STR(0x2a4),A0 # b'Yes, apparently so. . .'
-0x125c: JSR - "BUFFER_CONCAT"
-
-0x1260: MOVEQ - 0x22,D0
-0x1262: JSR - "CHR$"
-
-0x1266: JSR - "BUFFER_CONCAT"
-
-0x126a: LEA - VAR(0x76),A0
-0x126e: JSR - "BUFFER_FLUSH"
-
-0x1272: PEA - [0x1286]
-0x1276: PUSH.L - 0x000001f0
-0x127c: MOVE.L - 0xd2,D0
-0x1282: JMP - 128,0x26c
-
-0x1286: PUSH.W - 0x198
-0x128a: PUSH.W - 0x102
-0x128e: MOVEQ - -0x1,D0
-0x1290: PUSH.W - D0
-0x1292: PUSH.W - 0
-0x1294: MOVE.L - HEAP(0x94),D0
-0x129e: MOVEA.L - D0,A0
-0x12a0: JSR - "PICTURE"
-
-0x12a4: MOVEQ - 0x2,D0
-0x12a6: JSR - 128,0x24a
-
-0x12aa: PUSH.W - 0x172
-0x12ae: MOVEQ - 0x33,D0
-0x12b0: PUSH.W - D0
-0x12b2: TRAP - _MoveTo
-0x12b4: PUSH.W - var_i16_74
-0x12b8: PUSH.W - 0x14a
-0x12bc: TRAP - _LineTo
-0x12be: ADDQ.W - 0x6,var_i16_74
-0x12c2: CMPI.W - 0x1b8,var_i16_74
-0x12c8: BLE - [0x120e]
-
-0x12cc: PEA - [0x1306]
-0x12d0: PUSH.L - 0x00000146
-0x12d6: PUSH.L - 0x000001b4
-0x12dc: PUSH.L - 0x00000146
-0x12e2: PUSH.L - 0x000001b4
-0x12e8: PUSH.L - 0x000000bc
-0x12ee: PUSH.L - 0x0000018b
-0x12f4: PUSH.L - 0x00000152
-0x12fa: PUSH.L - 0x000001e2
-0x1300: MOVEQ - 0x10,D0
-0x1302: JMP - 128,0x800
-
-0x1306: PEA - [0x1320]
-0x130a: MOVEQ - 0x5,D0
-0x130c: PUSH.L - D0
-0x130e: PUSH.L - 0x00000128
-0x1314: PUSH.L - 0x000001fc
-0x131a: MOVEQ - 0x1,D0
-0x131c: JMP - 128,0x50a
-
-0x1320: MOVEQ - 0x3c,D0
-0x1322: JSR - 128,0x21e
-
-0x1326: MOVEQ - 0x8,D0
-0x1328: MOVE.W - D0,var_i16_74
-
-0x132c: PEA - [0x1344]
-0x1330: MOVEA.W - var_i16_74,A0
-0x1334: PUSH.L - A0
-0x1336: PUSH.L - 0
-0x1338: PUSH.L - 0x000001fc
-0x133e: MOVEQ - 0x1,D0
-0x1340: JMP - 128,0x50a
-
-0x1344: MOVEQ - 0xa,D0
-0x1346: ADDQ.W - 0x1,var_i16_74
-0x134a: CMP.W - var_i16_74,D0
-0x134e: BGE - [0x132c]
-
-0x1350: PUSH.L - 0 (unsafe)
-0x1352: TRAP - _TickCount
-0x1354: POP.L - D0
-0x1356: MOVE.L - D0,var_i32_2
-
-0x135a: MOVEQ - 0x5,D0
-0x135c: JSR - 128,0x1f4
-
-0x1360: PEA - [0x137a]
-0x1364: PUSH.L - 0
-0x1366: PUSH.L - 0
-0x1368: PUSH.L - 0x00000152
-0x136e: PUSH.L - 0x000001fc
-0x1374: MOVEQ - 0x0,D0
-0x1376: JMP - 128,0x2f0
-
-0x137a: PUSH.W - 0
-0x137c: PUSH.W - 0
-0x137e: MOVEQ - -0x1,D0
-0x1380: PUSH.W - D0
-0x1382: PUSH.W - 0
-0x1384: MOVE.L - HEAP(0xbc),D0
-0x138e: MOVEA.L - D0,A0
-0x1390: JSR - "PICTURE"
-
-0x1394: PEA - VAR(0x32)
-0x1398: TRAP - _SetPortBits
-0x139a: MOVEQ - 0xa,D0
-0x139c: JSR - 128,0x24a
-
-0x13a0: MOVE.W - 0x18b,var_i16_5e
-
-0x13a6: MOVE.W - 0x1ef,var_i16_62
-
-0x13ac: MOVE.W - 0x18b,var_i16_66
-
-0x13b2: MOVE.W - 0x1ef,var_i16_6a
-
-0x13b8: MOVE.W - 0xc0,var_i16_74
-
-0x13be: PUSH.L - 0 (unsafe)
-0x13c0: TRAP - _TickCount
-0x13c2: POP.L - D0
-0x13c4: MOVE.L - D0,var_i32_2
-
-0x13c8: MOVE.W - var_i16_74,var_i16_5c
-
-0x13ce: MOVE.W - var_i16_5c,D0
-0x13d2: EXT.L - D0
-0x13d4: ADDI.L - 0x00000096,D0
-0x13da: MOVE.W - D0,var_i16_60
-
-0x13de: MOVE.W - var_i16_74,D0
-0x13e2: EXT.L - D0
-0x13e4: SUBQ.L - 0x1,D0
-0x13e6: MOVE.W - D0,var_i16_64
-
-0x13ea: MOVE.W - var_i16_64,D0
-0x13ee: EXT.L - D0
-0x13f0: ADDI.L - 0x00000096,D0
-0x13f6: MOVE.W - D0,var_i16_68
-
-0x13fa: PEA - VAR(0x32)
-0x13fe: PEA - VAR(0x32)
-0x1402: PEA - VAR(0x5c)
-0x1406: PEA - VAR(0x64)
-0x140a: PUSH.W - 0
-0x140c: PUSH.L - 0
-0x140e: TRAP - _CopyBits
-0x1410: MOVEQ - 0x1,D0
-0x1412: JSR - 128,0x24a
-
-0x1416: MOVEQ - 0x15,D0
-0x1418: ADDI.W - 0xffff,var_i16_74
-0x141e: CMP.W - var_i16_74,D0
-0x1422: BLE - [0x13be]
-
-0x1424: PUSH.W - 0x193
-0x1428: MOVEQ - 0x2d,D0
-0x142a: PUSH.W - D0
-0x142c: MOVEQ - -0x1,D0
-0x142e: PUSH.W - D0
-0x1430: PUSH.W - 0
-0x1432: MOVE.L - HEAP(0xb0),D0
-0x143c: MOVEA.L - D0,A0
-0x143e: JSR - "PICTURE"
-
-0x1442: MOVEQ - 0x1,D0
-0x1444: JSR - 128,0x21e
-
-0x1448: PUSH.W - 0x193
-0x144c: MOVEQ - 0x2d,D0
-0x144e: PUSH.W - D0
-0x1450: MOVEQ - -0x1,D0
-0x1452: PUSH.W - D0
-0x1454: PUSH.W - 0
-0x1456: MOVE.L - HEAP(0xb4),D0
-0x1460: MOVEA.L - D0,A0
-0x1462: JSR - "PICTURE"
-
-0x1466: MOVEQ - 0x1,D0
-0x1468: JSR - 128,0x21e
-
-0x146c: PUSH.W - 0x193
-0x1470: MOVEQ - 0x2d,D0
-0x1472: PUSH.W - D0
-0x1474: MOVEQ - -0x1,D0
-0x1476: PUSH.W - D0
-0x1478: PUSH.W - 0
-0x147a: MOVE.L - HEAP(0xb8),D0
-0x1484: MOVEA.L - D0,A0
-0x1486: JSR - "PICTURE"
-
-0x148a: MOVEQ - 0x6,D0
-0x148c: JSR - 128,0x1ba
-
-0x1490: TRAP - _PenNormal
-0x1492: MOVEQ - 0xa,D0
-0x1494: PUSH.W - D0
-0x1496: TRAP - _PenMode
-0x1498: MOVEQ - 0x3,D0
-0x149a: PUSH.W - D0
-0x149c: MOVEQ - 0x3,D0
-0x149e: PUSH.W - D0
-0x14a0: TRAP - _PenSize
-0x14a2: MOVE.W - 0x190,var_i16_6e
-
-0x14a8: MOVE.W - 0x200,var_i16_72
-
-0x14ae: MOVEQ - 0x50,D0
-0x14b0: MOVE.W - D0,var_i16_6c
-
-0x14b4: MOVE.W - 0x156,var_i16_70
-
-0x14ba: MOVEQ - 0x0,D0
-0x14bc: MOVE.W - D0,var_i16_5e
-
-0x14c0: MOVEQ - 0x32,D0
-0x14c2: MOVE.W - D0,var_i16_62
-
-0x14c6: MOVEQ - 0x0,D0
-0x14c8: MOVE.W - D0,var_i16_5c
-
-0x14cc: MOVEQ - 0x32,D0
-0x14ce: MOVE.W - D0,var_i16_60
-
-0x14d2: MOVEQ - 0x64,D0
-0x14d4: MOVE.W - D0,var_i16_3e0
-
-0x14d8: MOVE.L - HEAP(0x412aa),D0
-0x14e2: MOVEA.L - D0,A0
-0x14e4: MOVE.L - (A0),D0
-0x14e6: MOVE.L - D0,var_i32_40
-
-0x14ea: PEA - VAR(0x4e)
-0x14ee: TRAP - _SetPortBits
-0x14f0: MOVEQ - 0x1,D0
-0x14f2: MOVE.W - D0,var_i16_74
-
-0x14f6: PUSH.L - 0 (unsafe)
-0x14f8: TRAP - _TickCount
-0x14fa: POP.L - D0
-0x14fc: MOVE.L - D0,var_i32_2
-
-0x1500: MOVE.L - HEAP(0x412ae),D0
-0x150a: MOVEA.L - D0,A0
-0x150c: MOVE.L - (A0),D0
-0x150e: PUSH.L - D0
-0x1510: PUSH.L - var_i32_4e
-0x1514: MOVE.L - 0x5580,D0
-0x151a: JSR - "BLOCKMOVE"
-
-0x151e: MOVE.W - var_i16_3e0,D0
-0x1522: EXT.L - D0
-0x1524: ADDQ.L - 0x5,D0
-0x1526: PUSH.L - D0
-0x1528: MOVE.W - var_i16_74,D0
-0x152c: EXT.L - D0
-0x152e: MOVE.L - D0,D1
-0x1530: MOVEQ - 0x2,D0
-0x1532: JSR - "MUL_INT"
-
-0x1536: POP.L - D1
-0x1538: ADD.L - D1,D0
-0x153a: MOVE.W - D0,var_i16_3e0
-
-0x153e: MOVE.W - 0x1e0,var_i16_66
-
-0x1544: MOVE.W - var_i16_66,D0
-0x1548: EXT.L - D0
-0x154a: ADDI.L - 0x00000032,D0
-0x1550: MOVE.W - D0,var_i16_6a
-
-0x1554: MOVE.W - var_i16_3e0,var_i16_64
-
-0x155a: MOVE.W - var_i16_64,D0
-0x155e: EXT.L - D0
-0x1560: ADDI.L - 0x00000032,D0
-0x1566: MOVE.W - D0,var_i16_68
-
-0x156a: PEA - VAR(0x40)
-0x156e: PEA - VAR(0x4e)
-0x1572: PEA - VAR(0x5c)
-0x1576: PEA - VAR(0x64)
-0x157a: MOVEQ - 0x2,D0
-0x157c: PUSH.W - D0
-0x157e: PUSH.L - 0
-0x1580: TRAP - _CopyBits
-0x1582: MOVE.L - 0x190,D0
-0x1588: MOVEA.W - var_i16_74,A0
-0x158c: SUB.L - A0,D0
-0x158e: PUSH.W - D0
-0x1590: MOVE.W - var_i16_3e0,D0
-0x1594: EXT.L - D0
-0x1596: SUBI.L - 0x1e,D0
-0x159c: PUSH.L - D0
-0x159e: MOVE.W - var_i16_74,D0
-0x15a2: EXT.L - D0
-0x15a4: MOVE.L - D0,D1
-0x15a6: MOVEQ - 0x3,D0
-0x15a8: JSR - "MUL_INT"
-
-0x15ac: POP.L - D1
-0x15ae: ADD.L - D1,D0
-0x15b0: PUSH.W - D0
-0x15b2: TRAP - _MoveTo
-0x15b4: PUSH.W - 0x1f4
-0x15b8: MOVE.W - var_i16_3e0,D0
-0x15bc: EXT.L - D0
-0x15be: ADDI.L - 0x0000000a,D0
-0x15c4: MOVEA.W - var_i16_74,A0
-0x15c8: SUB.L - A0,D0
-0x15ca: PUSH.W - D0
-0x15cc: TRAP - _LineTo
-0x15ce: MOVEQ - 0x1,D0
-0x15d0: JSR - 128,0x24a
-
-0x15d4: PEA - VAR(0x4e)
-0x15d8: PEA - VAR(0x32)
-0x15dc: PEA - VAR(0x6c)
-0x15e0: PEA - VAR(0x6c)
-0x15e4: PUSH.W - 0
-0x15e6: PUSH.L - 0
-0x15e8: TRAP - _CopyBits
-0x15ea: MOVEQ - 0xf,D0
-0x15ec: ADDQ.W - 0x1,var_i16_74
-0x15f0: CMP.W - var_i16_74,D0
-0x15f4: BGE - [0x14f6]
-
-0x15f8: PEA - VAR(0x32)
-0x15fc: TRAP - _SetPortBits
-0x15fe: TRAP - _PenNormal
-0x1600: MOVEQ - 0xa,D0
-0x1602: PUSH.W - D0
-0x1604: TRAP - _PenMode
-0x1606: MOVEQ - 0x0,D0
-0x1608: MOVE.W - D0,var_i16_192
-
-0x160c: MOVEQ - 0x1,D0
-0x160e: MOVE.W - D0,var_i16_74
-
-0x1612: PUSH.L - 0 (unsafe)
-0x1614: TRAP - _TickCount
-0x1616: POP.L - D0
-0x1618: MOVE.L - D0,var_i32_2
-
-0x161c: MOVE.W - var_i16_192,D0
-0x1620: BEQ - [0x1626]
-
-0x1622: JMP - [0x1692]
---------
-0x1626: MOVEQ - 0x0,D0
-0x1628: MOVEA.W - var_i16_74,A0
-0x162c: ADD.L - A0,D0
-0x162e: LSL.L - 0x1,D0
-0x1630: ADDI.L - HEAP(0x1e8),D0
-0x163a: PUSH.L - D0
-0x163c: MOVE.L - 0x1f4,D0
-0x1642: MOVEA.W - var_i16_74,A0
-0x1646: SUB.L - A0,D0
-0x1648: PUSH.L - D0
-0x164a: MOVE.W - var_i16_74,D0
-0x164e: EXT.L - D0
-0x1650: JSR - "RND_INT"
-
-0x1654: POP.L - D1
-0x1656: ADD.L - D1,D0
-0x1658: POP.L - A0
-0x165a: MOVE.W - D0,(A0)
-
-0x165c: MOVE.L - 0xfb,D0
-0x1662: MOVEA.W - var_i16_74,A0
-0x1666: ADD.L - A0,D0
-0x1668: LSL.L - 0x1,D0
-0x166a: ADDI.L - HEAP(0x1e8),D0
-0x1674: PUSH.L - D0
-0x1676: MOVE.L - 0x156,D0
-0x167c: PUSH.L - D0
-0x167e: MOVE.W - var_i16_74,D0
-0x1682: EXT.L - D0
-0x1684: JSR - "RND_INT"
-
-0x1688: POP.L - D1
-0x168a: EXG - D0,D1
-0x168c: SUB.L - D1,D0
-0x168e: POP.L - A0
-0x1690: MOVE.W - D0,(A0)
-
-0x1692: MOVEQ - 0x0,D0
-0x1694: MOVEA.W - var_i16_74,A0
-0x1698: ADD.L - A0,D0
-0x169a: LSL.L - 0x1,D0
-0x169c: ADDI.L - HEAP(0x1e8),D0
-0x16a6: MOVEA.L - D0,A0
-0x16a8: MOVE.W - (A0),D0
-0x16aa: EXT.L - D0
-0x16ac: PUSH.W - D0
-0x16ae: MOVE.L - 0xfb,D0
-0x16b4: MOVEA.W - var_i16_74,A0
-0x16b8: ADD.L - A0,D0
-0x16ba: LSL.L - 0x1,D0
-0x16bc: ADDI.L - HEAP(0x1e8),D0
-0x16c6: MOVEA.L - D0,A0
-0x16c8: MOVE.W - (A0),D0
-0x16ca: EXT.L - D0
-0x16cc: PUSH.W - D0
-0x16ce: TRAP - _MoveTo
-0x16d0: MOVEQ - 0x0,D0
-0x16d2: MOVEA.W - var_i16_74,A0
-0x16d6: ADD.L - A0,D0
-0x16d8: LSL.L - 0x1,D0
-0x16da: ADDI.L - HEAP(0x1e8),D0
-0x16e4: MOVEA.L - D0,A0
-0x16e6: MOVE.W - (A0),D0
-0x16e8: EXT.L - D0
-0x16ea: PUSH.W - D0
-0x16ec: MOVE.L - 0xfb,D0
-0x16f2: MOVEA.W - var_i16_74,A0
-0x16f6: ADD.L - A0,D0
-0x16f8: LSL.L - 0x1,D0
-0x16fa: ADDI.L - HEAP(0x1e8),D0
-0x1704: MOVEA.L - D0,A0
-0x1706: MOVE.W - (A0),D0
-0x1708: EXT.L - D0
-0x170a: PUSH.W - D0
-0x170c: TRAP - _LineTo
-0x170e: MOVE.W - var_i16_74,D0
-0x1712: EXT.L - D0
-0x1714: MOVE.L - D0,D1
-0x1716: MOVEQ - 0x19,D0
-0x1718: JSR - "MOD_INT"
-
-0x171c: CMPI.L - 0x0,D0
-0x1722: BNE - [0x172c]
-
-0x1726: MOVEQ - 0x1,D0
-0x1728: JSR - 128,0x24a
-
-0x172c: ADDQ.W - 0x1,var_i16_74
-0x1730: CMPI.W - 0xfa,var_i16_74
-0x1736: BLE - [0x1612]
-
-0x173a: MOVEQ - 0x1,D0
-0x173c: ADDQ.W - 0x1,var_i16_192
-0x1740: CMP.W - var_i16_192,D0
-0x1744: BGE - [0x160c]
-
-0x1748: PUSH.L - 0 (unsafe)
-0x174a: TRAP - _TickCount
-0x174c: POP.L - D0
-0x174e: MOVE.L - D0,var_i32_2
-
-0x1752: MOVEQ - 0x25,D0
-0x1754: MOVE.W - D0,var_i16_74
-
-0x1758: MOVE.W - var_i16_74,D0
-0x175c: EXT.L - D0
-0x175e: LSL.L - 0x2,D0
-0x1760: ADD.L - HEAP,D0
-0x1764: MOVEA.L - D0,A0
-0x1766: MOVE.L - (A0),D0
-0x1768: PUSH.L - D0
-0x176a: TRAP - _ReleaseResource
-0x176c: MOVEQ - 0x2f,D0
-0x176e: ADDQ.W - 0x1,var_i16_74
-0x1772: CMP.W - var_i16_74,D0
-0x1776: BGE - [0x1758]
-
-0x1778: MOVEQ - 0x3c,D0
-0x177a: JSR - 128,0x24a
-
-0x177e: PUSH.W - 0xfa
-0x1782: MOVEQ - 0xc,D0
-0x1784: PUSH.W - D0
-0x1786: PUSH.W - 0
-0x1788: MOVEQ - 0x3,D0
-0x178a: PUSH.W - D0
-0x178c: JSR - "TEXT"
-
-0x1790: MOVEQ - 0x22,D0
-0x1792: JSR - "CHR$"
-
-0x1796: JSR - "BUFFER_CONCAT"
-
-0x179a: MOVEA.L - STR(0x2bc),A0 # b"Well, this won't do. . ."
-0x17a2: JSR - "BUFFER_CONCAT"
-
-0x17a6: MOVEQ - 0x22,D0
-0x17a8: JSR - "CHR$"
-
-0x17ac: JSR - "BUFFER_CONCAT"
-
-0x17b0: LEA - VAR(0x76),A0
-0x17b4: JSR - "BUFFER_FLUSH"
-
-0x17b8: PEA - [0x17c8]
-0x17bc: PUSH.L - 0x0000017d
-0x17c2: MOVEQ - 0x3c,D0
-0x17c4: JMP - 128,0x26c
-
-0x17c8: PUSH.L - 0 (unsafe)
-0x17ca: TRAP - _TickCount
-0x17cc: POP.L - D0
-0x17ce: MOVE.L - D0,var_i32_2
-
-0x17d2: MOVEQ - 0x30,D0
-0x17d4: MOVE.W - D0,var_i16_74
-
-0x17d8: MOVE.W - var_i16_74,D0
-0x17dc: EXT.L - D0
-0x17de: LSL.L - 0x2,D0
-0x17e0: ADD.L - HEAP,D0
-0x17e4: PUSH.L - D0
-0x17e6: PUSH.L - 0 (unsafe)
-0x17e8: PUSH.W - var_i16_74
-0x17ec: TRAP - _GetPicture
-0x17ee: POP.L - D0
-0x17f0: POP.L - A0
-0x17f2: MOVE.L - D0,(A0)
-
-0x17f4: MOVEQ - 0x31,D0
-0x17f6: ADDQ.W - 0x1,var_i16_74
-0x17fa: CMP.W - var_i16_74,D0
-0x17fe: BGE - [0x17d8]
-
-0x1800: MOVEQ - 0x4b,D0
-0x1802: MOVE.W - D0,var_i16_74
-
-0x1806: MOVE.W - var_i16_74,D0
-0x180a: EXT.L - D0
-0x180c: LSL.L - 0x2,D0
-0x180e: ADD.L - HEAP,D0
-0x1812: PUSH.L - D0
-0x1814: PUSH.L - 0 (unsafe)
-0x1816: PUSH.W - var_i16_74
-0x181a: TRAP - _GetPicture
-0x181c: POP.L - D0
-0x181e: POP.L - A0
-0x1820: MOVE.L - D0,(A0)
-
-0x1822: MOVEQ - 0x52,D0
-0x1824: ADDQ.W - 0x1,var_i16_74
-0x1828: CMP.W - var_i16_74,D0
-0x182c: BGE - [0x1806]
-
-0x182e: MOVE.L - 0xd2,D0
-0x1834: JSR - 128,0x24a
-
-0x1838: PEA - [0x1852]
-0x183c: PUSH.L - 0
-0x183e: PUSH.L - 0
-0x1840: PUSH.L - 0x00000092
-0x1846: PUSH.L - 0x00000187
-0x184c: MOVEQ - 0x2,D0
-0x184e: JMP - 128,0x2f0
-
-0x1852: PUSH.W - 0x193
-0x1856: MOVEQ - 0x2d,D0
-0x1858: PUSH.W - D0
-0x185a: MOVEQ - -0x1,D0
-0x185c: PUSH.W - D0
-0x185e: PUSH.W - 0
-0x1860: MOVE.L - HEAP(0xc0),D0
-0x186a: MOVEA.L - D0,A0
-0x186c: JSR - "PICTURE"
-
-0x1870: MOVEQ - 0x1,D0
-0x1872: JSR - 128,0x21e
-
-0x1876: PUSH.W - 0x193
-0x187a: MOVEQ - 0x2d,D0
-0x187c: PUSH.W - D0
-0x187e: MOVEQ - -0x1,D0
-0x1880: PUSH.W - D0
-0x1882: PUSH.W - 0
-0x1884: MOVE.L - HEAP(0xc4),D0
-0x188e: MOVEA.L - D0,A0
-0x1890: JSR - "PICTURE"
-
-0x1894: PUSH.W - 0xfa
-0x1898: MOVEQ - 0xc,D0
-0x189a: PUSH.W - D0
-0x189c: PUSH.W - 0
-0x189e: MOVEQ - 0x3,D0
-0x18a0: PUSH.W - D0
-0x18a2: JSR - "TEXT"
-
-0x18a6: MOVEQ - 0x22,D0
-0x18a8: JSR - "CHR$"
-
-0x18ac: JSR - "BUFFER_CONCAT"
-
-0x18b0: MOVEA.L - STR(0x2d6),A0 # b'High Priestess!'
-0x18b8: JSR - "BUFFER_CONCAT"
-
-0x18bc: LEA - VAR(0x76),A0
-0x18c0: JSR - "BUFFER_FLUSH"
-
-0x18c4: PEA - [0x18d4]
-0x18c8: PUSH.L - 0x0000017d
-0x18ce: MOVEQ - 0x3c,D0
-0x18d0: JMP - 128,0x26c
-
-0x18d4: MOVEA.L - STR(0x2e6),A0 # b' Am I to suffer this fate merely for uncovering'
-0x18dc: JSR - "BUFFER_CONCAT"
-
-0x18e0: LEA - VAR(0x76),A0
-0x18e4: JSR - "BUFFER_FLUSH"
-
-0x18e8: PEA - [0x18f8]
-0x18ec: PUSH.L - 0x0000017d
-0x18f2: MOVEQ - 0x4d,D0
-0x18f4: JMP - 128,0x26c
-
-0x18f8: MOVEA.L - STR(0x318),A0 # b' the fourteen lost treasures of the land?'
-0x1900: JSR - "BUFFER_CONCAT"
-
-0x1904: MOVEQ - 0x22,D0
-0x1906: JSR - "CHR$"
-
-0x190a: JSR - "BUFFER_CONCAT"
-
-0x190e: LEA - VAR(0x76),A0
-0x1912: JSR - "BUFFER_FLUSH"
-
-0x1916: PEA - [0x1926]
-0x191a: PUSH.L - 0x0000017d
-0x1920: MOVEQ - 0x5e,D0
-0x1922: JMP - 128,0x26c
-
-0x1926: MOVEQ - 0x30,D0
-0x1928: MOVE.W - D0,var_i16_74
-
-0x192c: MOVE.W - var_i16_74,D0
-0x1930: EXT.L - D0
-0x1932: LSL.L - 0x2,D0
-0x1934: ADD.L - HEAP,D0
-0x1938: MOVEA.L - D0,A0
-0x193a: MOVE.L - (A0),D0
-0x193c: PUSH.L - D0
-0x193e: TRAP - _ReleaseResource
-0x1940: MOVEQ - 0x31,D0
-0x1942: ADDQ.W - 0x1,var_i16_74
-0x1946: CMP.W - var_i16_74,D0
-0x194a: BGE - [0x192c]
-
-0x194c: MOVEQ - 0x32,D0
-0x194e: MOVE.W - D0,var_i16_74
-
-0x1952: MOVE.W - var_i16_74,D0
-0x1956: EXT.L - D0
-0x1958: LSL.L - 0x2,D0
-0x195a: ADD.L - HEAP,D0
-0x195e: PUSH.L - D0
-0x1960: PUSH.L - 0 (unsafe)
-0x1962: PUSH.W - var_i16_74
-0x1966: TRAP - _GetPicture
-0x1968: POP.L - D0
-0x196a: POP.L - A0
-0x196c: MOVE.L - D0,(A0)
-
-0x196e: CMPI.W - 0x37,var_i16_74
-0x1974: BEQ - [0x197a]
-
-0x1976: JMP - [0x19b2]
---------
-0x197a: MOVEQ - 0x5,D0
-0x197c: JSR - 128,0x1f4
-
-0x1980: PUSH.W - 0
-0x1982: PUSH.W - 0
-0x1984: MOVEQ - -0x1,D0
-0x1986: PUSH.W - D0
-0x1988: PUSH.W - 0
-0x198a: MOVE.L - HEAP(0xdc),D0
-0x1994: MOVEA.L - D0,A0
-0x1996: JSR - "PICTURE"
-
-0x199a: MOVE.L - HEAP(0xdc),D0
-0x19a4: MOVEA.L - D0,A0
-0x19a6: MOVE.L - (A0),D0
-0x19a8: PUSH.L - D0
-0x19aa: TRAP - _ReleaseResource
-0x19ac: PEA - VAR(0x32)
-0x19b0: TRAP - _SetPortBits
-0x19b2: MOVEQ - 0x38,D0
-0x19b4: ADDQ.W - 0x1,var_i16_74
-0x19b8: CMP.W - var_i16_74,D0
-0x19bc: BGE - [0x1952]
-
-0x19be: JSR - 128,0xe1c
-
-0x19c2: JSR - 128,0xe58
-
-0x19c6: JSR - 128,0xe1c
-
-0x19ca: PEA - [0x19e4]
-0x19ce: PUSH.L - 0
-0x19d0: PUSH.L - 0
-0x19d2: PUSH.L - 0x00000092
-0x19d8: PUSH.L - 0x00000187
-0x19de: MOVEQ - 0x2,D0
-0x19e0: JMP - 128,0x2f0
-
-0x19e4: PUSH.W - 0x193
-0x19e8: MOVEQ - 0x2d,D0
-0x19ea: PUSH.W - D0
-0x19ec: MOVEQ - -0x1,D0
-0x19ee: PUSH.W - D0
-0x19f0: PUSH.W - 0
-0x19f2: MOVE.L - HEAP(0xc8),D0
-0x19fc: MOVEA.L - D0,A0
-0x19fe: JSR - "PICTURE"
-
-0x1a02: PUSH.W - 0xfa
-0x1a06: MOVEQ - 0xc,D0
-0x1a08: PUSH.W - D0
-0x1a0a: PUSH.W - 0
-0x1a0c: MOVEQ - 0x3,D0
-0x1a0e: PUSH.W - D0
-0x1a10: JSR - "TEXT"
-
-0x1a14: MOVEQ - 0x22,D0
-0x1a16: JSR - "CHR$"
-
-0x1a1a: JSR - "BUFFER_CONCAT"
-
-0x1a1e: MOVEA.L - STR(0x342),A0 # b'. . . for if that be true,'
-0x1a26: JSR - "BUFFER_CONCAT"
-
-0x1a2a: LEA - VAR(0x76),A0
-0x1a2e: JSR - "BUFFER_FLUSH"
-
-0x1a32: PEA - [0x1a42]
-0x1a36: PUSH.L - 0x0000017d
-0x1a3c: MOVEQ - 0x3c,D0
-0x1a3e: JMP - 128,0x26c
-
-0x1a42: MOVEA.L - STR(0x35e),A0 # b' I wish you had made the challenge more difficult!'
-0x1a4a: JSR - "BUFFER_CONCAT"
-
-0x1a4e: LEA - VAR(0x76),A0
-0x1a52: JSR - "BUFFER_FLUSH"
-
-0x1a56: PEA - [0x1a66]
-0x1a5a: PUSH.L - 0x0000017d
-0x1a60: MOVEQ - 0x4d,D0
-0x1a62: JMP - 128,0x26c
-
-0x1a66: MOVEA.L - STR(0x392),A0 # b' After all, I am just a fool and I should not'
-0x1a6e: JSR - "BUFFER_CONCAT"
-
-0x1a72: LEA - VAR(0x76),A0
-0x1a76: JSR - "BUFFER_FLUSH"
-
-0x1a7a: PEA - [0x1a8a]
-0x1a7e: PUSH.L - 0x0000017d
-0x1a84: MOVEQ - 0x5e,D0
-0x1a86: JMP - 128,0x26c
-
-0x1a8a: MOVEA.L - STR(0x3c0),A0 # b' have been able to find them so easily.'
-0x1a92: JSR - "BUFFER_CONCAT"
-
-0x1a96: MOVEQ - 0x22,D0
-0x1a98: JSR - "CHR$"
-
-0x1a9c: JSR - "BUFFER_CONCAT"
-
-0x1aa0: LEA - VAR(0x76),A0
-0x1aa4: JSR - "BUFFER_FLUSH"
-
-0x1aa8: PEA - [0x1ab8]
-0x1aac: PUSH.L - 0x0000017d
-0x1ab2: MOVEQ - 0x6f,D0
-0x1ab4: JMP - 128,0x26c
-
-0x1ab8: MOVE.L - HEAP(0x41af4),D0
-0x1ac2: MOVEA.L - D0,A0
-0x1ac4: MOVEQ - 0x6,D0
-0x1ac6: MOVE.W - D0,(A0)
-
-0x1ac8: MOVE.L - HEAP(0x41af6),D0
-0x1ad2: MOVEA.L - D0,A0
-0x1ad4: MOVE.W - 0xd0,(A0)
-
-0x1ad8: MOVE.L - HEAP(0x41af8),D0
-0x1ae2: MOVEA.L - D0,A0
-0x1ae4: MOVEQ - 0x6c,D0
-0x1ae6: MOVE.W - D0,(A0)
-
-0x1ae8: MOVE.L - HEAP(0x41afa),D0
-0x1af2: MOVEA.L - D0,A0
-0x1af4: MOVE.W - 0x133,(A0)
-
-0x1af8: MOVE.L - HEAP(0x41afc),D0
-0x1b02: MOVEA.L - D0,A0
-0x1b04: MOVEQ - 0xa,D0
-0x1b06: MOVE.W - D0,(A0)
-
-0x1b08: MOVE.L - HEAP(0x41afe),D0
-0x1b12: MOVEA.L - D0,A0
-0x1b14: MOVE.W - 0xb4,(A0)
-
-0x1b18: MOVE.L - HEAP(0x41b00),D0
-0x1b22: MOVEA.L - D0,A0
-0x1b24: MOVE.W - 0x14c,(A0)
-
-0x1b28: MOVE.L - HEAP(0x41b02),D0
-0x1b32: MOVEA.L - D0,A0
-0x1b34: MOVE.W - 0x1f6,(A0)
-
-0x1b38: MOVE.L - HEAP(0x41b04),D0
-0x1b42: MOVEA.L - D0,A0
-0x1b44: MOVEQ - 0x2,D0
-0x1b46: MOVE.W - D0,(A0)
-
-0x1b48: MOVE.L - HEAP(0x41b06),D0
-0x1b52: MOVEA.L - D0,A0
-0x1b54: MOVEQ - 0xa,D0
-0x1b56: MOVE.W - D0,(A0)
-
-0x1b58: MOVE.L - HEAP(0x41b08),D0
-0x1b62: MOVEA.L - D0,A0
-0x1b64: MOVEQ - 0xd,D0
-0x1b66: MOVE.W - D0,(A0)
-
-0x1b68: MOVEQ - 0x0,D0
-0x1b6a: MOVE.W - D0,var_i16_74
-
-0x1b6e: MOVE.W - var_i16_74,D0
-0x1b72: EXT.L - D0
-0x1b74: LSL.L - 0x2,D0
-0x1b76: ADDI.L - HEAP(0x41bbe),D0
-0x1b80: PUSH.L - D0
-0x1b82: MOVEA.W - var_i16_74,A0
-0x1b86: ADDA.L - A0,A0
-0x1b88: ADDA.L - HEAP(0x41af4),A0
-0x1b92: MOVE.W - (A0),D0
-0x1b94: EXT.L - D0
-0x1b96: JSR - "BCD_FROM_INT"
-
-0x1b9a: POP.L - A0
-0x1b9c: JSR - "BCD_TO_VAR"
-
-0x1ba0: MOVE.W - var_i16_74,D0
-0x1ba4: EXT.L - D0
-0x1ba6: ADDQ.L - 0x4,D0
-0x1ba8: LSL.L - 0x2,D0
-0x1baa: ADDI.L - HEAP(0x41bbe),D0
-0x1bb4: PUSH.L - D0
-0x1bb6: MOVE.W - var_i16_74,D0
-0x1bba: EXT.L - D0
-0x1bbc: ADDQ.L - 0x4,D0
-0x1bbe: LSL.L - 0x1,D0
-0x1bc0: ADDI.L - HEAP(0x41af4),D0
-0x1bca: MOVEA.L - D0,A0
-0x1bcc: MOVE.W - (A0),D0
-0x1bce: EXT.L - D0
-0x1bd0: PUSH.L - D0
-0x1bd2: MOVEA.W - var_i16_74,A0
-0x1bd6: ADDA.L - A0,A0
-0x1bd8: ADDA.L - HEAP(0x41af4),A0
-0x1be2: MOVE.W - (A0),D0
-0x1be4: EXT.L - D0
-0x1be6: POP.L - D1
-0x1be8: EXG - D0,D1
-0x1bea: SUB.L - D1,D0
-0x1bec: JSR - "BCD_FROM_INT"
-
-0x1bf0: JSR - "BCD_PUSH_LHS"
-
-0x1bf4: MOVE.L - HEAP(0x41b08),D0
-0x1bfe: MOVEA.L - D0,A0
-0x1c00: MOVE.W - (A0),D0
-0x1c02: EXT.L - D0
-0x1c04: JSR - "BCD_FROM_INT"
-
-0x1c08: JSR - "BCD_PUSH_RHS"
-
-0x1c0c: JSR - "DIV_BCD"
-
-0x1c10: POP.L - A0
-0x1c12: JSR - "BCD_TO_VAR"
-
-0x1c16: MOVEQ - 0x3,D0
-0x1c18: ADDQ.W - 0x1,var_i16_74
-0x1c1c: CMP.W - var_i16_74,D0
-0x1c20: BGE - [0x1b6e]
-
-0x1c24: MOVE.L - HEAP(0x19c),D0
-0x1c2e: PUSH.L - D0
-0x1c30: TRAP - _PenPat
-0x1c32: MOVEQ - 0xa,D0
-0x1c34: PUSH.W - D0
-0x1c36: TRAP - _PenMode
-0x1c38: MOVEQ - 0x6,D0
-0x1c3a: MOVE.W - D0,var_i16_192
-
-0x1c3e: MOVE.W - var_i16_192,D0
-0x1c42: EXT.L - D0
-0x1c44: SUBQ.L - 0x1,D0
-0x1c46: LSL.L - 0x2,D0
-0x1c48: ADDI.L - HEAP(0x41296),D0
-0x1c52: MOVEA.L - D0,A0
-0x1c54: MOVE.L - (A0),D0
-0x1c56: PUSH.L - D0
-0x1c58: MOVE.W - var_i16_192,D0
-0x1c5c: EXT.L - D0
-0x1c5e: LSL.L - 0x2,D0
-0x1c60: ADDI.L - HEAP(0x41296),D0
-0x1c6a: MOVEA.L - D0,A0
-0x1c6c: MOVE.L - (A0),D0
-0x1c6e: PUSH.L - D0
-0x1c70: MOVE.L - 0x5580,D0
-0x1c76: JSR - "BLOCKMOVE"
-
-0x1c7a: MOVE.W - var_i16_192,D0
-0x1c7e: EXT.L - D0
-0x1c80: JSR - 128,0x1f4
-
-0x1c84: CMPI.W - 0x6,var_i16_192
-0x1c8a: BNE - [0x1c9c]
-
-0x1c8e: MOVE.L - HEAP(0x41af4),D0
-0x1c98: PUSH.L - D0
-0x1c9a: TRAP - _PaintOval
-0x1c9c: MOVEQ - 0x0,D0
-0x1c9e: MOVE.W - D0,var_i16_3e2
-
-0x1ca2: MOVEQ - 0x0,D0
-0x1ca4: MOVE.W - D0,var_i16_74
-
-0x1ca8: MOVE.W - var_i16_74,D0
-0x1cac: EXT.L - D0
-0x1cae: LSL.L - 0x2,D0
-0x1cb0: ADDI.L - HEAP(0x41bbe),D0
-0x1cba: PUSH.L - D0
-0x1cbc: MOVE.W - var_i16_74,D0
-0x1cc0: EXT.L - D0
-0x1cc2: LSL.L - 0x2,D0
-0x1cc4: ADDI.L - HEAP(0x41bbe),D0
-0x1cce: MOVEA.L - D0,A0
-0x1cd0: JSR - "BCD_FROM_VAR"
-
-0x1cd4: JSR - "BCD_PUSH_LHS"
-
-0x1cd8: MOVE.W - var_i16_74,D0
-0x1cdc: EXT.L - D0
-0x1cde: ADDQ.L - 0x4,D0
-0x1ce0: LSL.L - 0x2,D0
-0x1ce2: ADDI.L - HEAP(0x41bbe),D0
-0x1cec: MOVEA.L - D0,A0
-0x1cee: JSR - "BCD_FROM_VAR"
-
-0x1cf2: JSR - "ADD_BCD"
-
-0x1cf6: POP.L - A0
-0x1cf8: JSR - "BCD_TO_VAR"
-
-0x1cfc: MOVE.W - var_i16_74,D0
-0x1d00: EXT.L - D0
-0x1d02: ADDI.L - 0x0000000b,D0
-0x1d08: LSL.L - 0x1,D0
-0x1d0a: ADDI.L - HEAP(0x41af4),D0
-0x1d14: PUSH.L - D0
-0x1d16: MOVE.W - var_i16_74,D0
-0x1d1a: EXT.L - D0
-0x1d1c: LSL.L - 0x2,D0
-0x1d1e: ADDI.L - HEAP(0x41bbe),D0
-0x1d28: MOVEA.L - D0,A0
-0x1d2a: JSR - "BCD_FROM_VAR"
-
-0x1d2e: JSR - "CAST_INT"
-
-0x1d32: POP.L - A0
-0x1d34: MOVE.W - D0,(A0)
-
-0x1d36: MOVEQ - 0x3,D0
-0x1d38: ADDQ.W - 0x1,var_i16_74
-0x1d3c: CMP.W - var_i16_74,D0
-0x1d40: BGE - [0x1ca8]
-
-0x1d44: MOVE.L - HEAP(0x41b0a),D0
-0x1d4e: PUSH.L - D0
-0x1d50: TRAP - _PaintOval
-0x1d52: MOVEQ - 0x2,D0
-0x1d54: ADDQ.W - 0x1,var_i16_3e2
-0x1d58: CMP.W - var_i16_3e2,D0
-0x1d5c: BGE - [0x1ca2]
-
-0x1d60: MOVEQ - 0x9,D0
-0x1d62: ADDQ.W - 0x1,var_i16_192
-0x1d66: CMP.W - var_i16_192,D0
-0x1d6a: BGE - [0x1c3e]
-
-0x1d6e: MOVE.L - HEAP(0x412ba),D0
-0x1d78: MOVEA.L - D0,A0
-0x1d7a: MOVE.L - (A0),D0
-0x1d7c: PUSH.L - D0
-0x1d7e: MOVE.L - HEAP(0x412be),D0
-0x1d88: MOVEA.L - D0,A0
-0x1d8a: MOVE.L - (A0),D0
-0x1d8c: PUSH.L - D0
-0x1d8e: MOVE.L - 0x5580,D0
-0x1d94: JSR - "BLOCKMOVE"
-
-0x1d98: MOVEQ - 0xa,D0
-0x1d9a: JSR - 128,0x1f4
-
-0x1d9e: MOVE.L - HEAP(0x41afc),D0
-0x1da8: PUSH.L - D0
-0x1daa: TRAP - _PaintOval
-0x1dac: MOVEQ - 0x5,D0
-0x1dae: JSR - 128,0x1f4
-
-0x1db2: MOVE.L - HEAP(0x1bc),D0
-0x1dbc: PUSH.L - D0
-0x1dbe: PUSH.W - 0xae
-0x1dc2: PUSH.W - 0x8c
-0x1dc6: PUSH.W - 0xb6
-0x1dca: PUSH.W - 0x94
-0x1dce: TRAP - _SetRect
-0x1dd0: MOVE.L - HEAP(0x1bc),D0
-0x1dda: PUSH.L - D0
-0x1ddc: TRAP - _InvertOval
-0x1dde: MOVE.L - HEAP(0x1bc),D0
-0x1de8: PUSH.L - D0
-0x1dea: PUSH.W - 0x151
-0x1dee: PUSH.W - 0x86
-0x1df2: PUSH.W - 0x159
-0x1df6: PUSH.W - 0x8e
-0x1dfa: TRAP - _SetRect
-0x1dfc: MOVE.L - HEAP(0x1bc),D0
-0x1e06: PUSH.L - D0
-0x1e08: TRAP - _InvertOval
-0x1e0a: PEA - VAR(0x32)
-0x1e0e: TRAP - _SetPortBits
-0x1e10: JSR - 128,0xe1c
-
-0x1e14: JSR - 128,0xe58
-
-0x1e18: PEA - [0x1e32]
-0x1e1c: PUSH.L - 0
-0x1e1e: PUSH.L - 0
-0x1e20: PUSH.L - 0x00000092
-0x1e26: PUSH.L - 0x00000187
-0x1e2c: MOVEQ - 0x2,D0
-0x1e2e: JMP - 128,0x2f0
-
-0x1e32: PEA - [0x1e54]
-0x1e36: PUSH.L - 0x00000128
-0x1e3c: PUSH.L - 0x0000015a
-0x1e42: PUSH.L - 0x00000152
-0x1e48: PUSH.L - 0x000001fc
-0x1e4e: MOVEQ - 0x2,D0
-0x1e50: JMP - 128,0x2f0
-
-0x1e54: MOVEQ - 0x0,D0
-0x1e56: MOVE.W - D0,var_i16_18e
-
-0x1e5a: MOVEQ - 0xa,D0
-0x1e5c: MOVE.W - D0,var_i16_74
-
-0x1e60: MOVE.L - 0x190,D0
-0x1e66: PUSH.L - D0
-0x1e68: MOVE.W - var_i16_74,D0
-0x1e6c: EXT.L - D0
-0x1e6e: ADDI.L - 0x0000000a,D0
-0x1e74: POP.L - D1
-0x1e76: JSR - "GET_FROM"
-
-0x1e7a: PUSH.L - 0x000001e6
-0x1e80: MOVE.W - var_i16_74,D0
-0x1e84: EXT.L - D0
-0x1e86: ADDI.L - 0x00000014,D0
-0x1e8c: PUSH.L - D0
-0x1e8e: MOVE.L - 0x1d8a8,D0
-0x1e94: PUSH.L - D0
-0x1e96: MOVE.W - var_i16_74,D0
-0x1e9a: EXT.L - D0
-0x1e9c: MOVE.L - D0,D1
-0x1e9e: MOVEQ - 0x32,D0
-0x1ea0: JSR - "MUL_INT"
-
-0x1ea4: POP.L - D1
-0x1ea6: ADD.L - D1,D0
-0x1ea8: LSL.L - 0x1,D0
-0x1eaa: ADDI.L - HEAP(0xb54),D0
-0x1eb4: MOVEA.L - D0,A0
-0x1eb6: POP.L - D0
-0x1eb8: POP.L - D1
-0x1eba: JSR - "GET_TO"
-
-0x1ebe: MOVEQ - 0x0,D0
-0x1ec0: MOVEA.W - var_i16_74,A0
-0x1ec4: ADD.L - A0,D0
-0x1ec6: LSL.L - 0x1,D0
-0x1ec8: ADDI.L - HEAP(0x1e8),D0
-0x1ed2: MOVEA.L - D0,A0
-0x1ed4: MOVE.W - 0x190,(A0)
-
-0x1ed8: ADDQ.W - 0x1,var_i16_18e
-0x1edc: CMPI.W - 0x4,var_i16_18e
-0x1ee2: BLE - [0x1eec]
-
-0x1ee6: MOVEQ - 0x1,D0
-0x1ee8: MOVE.W - D0,var_i16_18e
-
-0x1eec: MOVE.L - 0xfb,D0
-0x1ef2: MOVEA.W - var_i16_74,A0
-0x1ef6: ADD.L - A0,D0
-0x1ef8: LSL.L - 0x1,D0
-0x1efa: ADDI.L - HEAP(0x1e8),D0
-0x1f04: MOVEA.L - D0,A0
-0x1f06: MOVE.W - var_i16_18e,(A0)
-
-0x1f0a: ADDI.W - 0x000a,var_i16_74
-0x1f10: CMPI.W - 0x96,var_i16_74
-0x1f16: BLE - [0x1e60]
-
-0x1f1a: MOVEQ - 0x1,D0
-0x1f1c: MOVE.W - D0,var_i16_192
-
-0x1f20: CMPI.W - 0x9,var_i16_192
-0x1f26: BGE - [0x1f30]
-
-0x1f2a: PEA - VAR(0x38)
-0x1f2e: TRAP - _InverRect
-0x1f30: PUSH.L - 0 (unsafe)
-0x1f32: TRAP - _TickCount
-0x1f34: POP.L - D0
-0x1f36: MOVE.L - D0,var_i32_2
-
-0x1f3a: MOVEQ - 0xa,D0
-0x1f3c: MOVE.W - D0,var_i16_74
-
-0x1f40: MOVEQ - 0x0,D0
-0x1f42: MOVEA.W - var_i16_74,A0
-0x1f46: ADD.L - A0,D0
-0x1f48: LSL.L - 0x1,D0
-0x1f4a: ADDI.L - HEAP(0x1e8),D0
-0x1f54: MOVEA.L - D0,A0
-0x1f56: MOVE.W - (A0),D0
-0x1f58: EXT.L - D0
-0x1f5a: PUSH.L - D0
-0x1f5c: MOVE.W - var_i16_74,D0
-0x1f60: EXT.L - D0
-0x1f62: ADDI.L - 0x0000000a,D0
-0x1f68: POP.L - D1
-0x1f6a: JSR - "GET_FROM"
-
-0x1f6e: PUSH.W - 0
-0x1f70: MOVE.L - 0x1d8a8,D0
-0x1f76: PUSH.L - D0
-0x1f78: MOVE.W - var_i16_74,D0
-0x1f7c: EXT.L - D0
-0x1f7e: MOVE.L - D0,D1
-0x1f80: MOVEQ - 0x32,D0
-0x1f82: JSR - "MUL_INT"
-
-0x1f86: POP.L - D1
-0x1f88: ADD.L - D1,D0
-0x1f8a: LSL.L - 0x1,D0
-0x1f8c: ADDI.L - HEAP(0xb54),D0
-0x1f96: PUSH.L - D0
-0x1f98: MOVEQ - 0x6,D0
-0x1f9a: JSR - "ZBASIC_194"
-
-0x1f9e: MOVEQ - 0x0,D0
-0x1fa0: MOVEA.W - var_i16_74,A0
-0x1fa4: ADD.L - A0,D0
-0x1fa6: LSL.L - 0x1,D0
-0x1fa8: ADDI.L - HEAP(0x1e8),D0
-0x1fb2: PUSH.L - D0
-0x1fb4: MOVEQ - 0x0,D0
-0x1fb6: MOVEA.W - var_i16_74,A0
-0x1fba: ADD.L - A0,D0
-0x1fbc: LSL.L - 0x1,D0
-0x1fbe: ADDI.L - HEAP(0x1e8),D0
-0x1fc8: MOVEA.L - D0,A0
-0x1fca: MOVE.W - (A0),D0
-0x1fcc: EXT.L - D0
-0x1fce: PUSH.L - D0
-0x1fd0: MOVE.L - 0xfb,D0
-0x1fd6: MOVEA.W - var_i16_74,A0
-0x1fda: ADD.L - A0,D0
-0x1fdc: LSL.L - 0x1,D0
-0x1fde: ADDI.L - HEAP(0x1e8),D0
-0x1fe8: MOVEA.L - D0,A0
-0x1fea: MOVE.W - (A0),D0
-0x1fec: EXT.L - D0
-0x1fee: MOVE.L - D0,D1
-0x1ff0: MOVE.W - var_i16_192,D0
-0x1ff4: EXT.L - D0
-0x1ff6: JSR - "MUL_INT"
-
-0x1ffa: POP.L - D1
-0x1ffc: EXG - D0,D1
-0x1ffe: SUB.L - D1,D0
-0x2000: POP.L - A0
-0x2002: MOVE.W - D0,(A0)
-
-0x2004: MOVEQ - 0x0,D0
-
- */
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _("Well, this won't do. . ."));
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_26c(0x17d, 0x3c);
+ // 131:17c8
+ // ...
+}
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index d5df5b3a215..f59e3345762 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -25,11 +25,12 @@
#include "common/array.h"
#include "common/scummsys.h"
#include "common/str.h"
+#include "fool/toolbox.h"
#include "graphics/surface.h"
#define SCREEN_WIDTH 0x200
#define SCREEN_HEIGHT 0x156
-#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8/2)
+#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8/2) // 0x2ac0
namespace Fool {
@@ -38,16 +39,100 @@ public:
FoolPrologue();
~FoolPrologue();
+ void sub_128_1ba(int16 screen_page);
+ void sub_128_1f4(int16 screen_page);
+ void sub_128_21e(int16 numTicks);
+ void sub_128_24a(int16 numTicks);
+ void sub_128_26c(int16 unk1, int16 unk2);
+ void sub_128_2a6(int16 unk1, int16 unk2);
+ void sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right);
+ void sub_128_354(uint16 unk1, uint16 unk2);
+ void sub_128_3ee(int16 unk1);
+ void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_page);
+ void sub_128_610(int16 screen_page);
+ void sub_128_64a(int16 unk1);
+ void sub_128_6e4(int16 screen_page);
+ void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
+ void sub_128_a6c(int16_t unk1, int16_t unk2);
+ void sub_128_a8c(int16_t unk);
+ void sub_128_c8a();
+ void sub_128_de2();
+ void sub_128_e1c();
+ void sub_128_e58();
+ void sub_128_e80();
+ void sub_128_ed2();
+ void sub_128_ee0();
+ void sub_128_f0a();
+ void sub_129_004();
+ void sub_129_764();
+ void sub_129_772();
- Graphics::Surface var_i32_32; // pointer to bitmap
- Common::Rect var_i32_38; // pointer to rect
- Graphics::Surface var_i32_40; // pointer to bitmap
- Graphics::Surface var_i32_4e; // pointer to bitmap
+ void sub_130_004();
+ void sub_130_cea();
+ void sub_130_db0();
+ void sub_130_e82();
+ void sub_130_f48();
+ void sub_130_1002();
+ void sub_131_004();
+
+private:
+ // last tick count
+ uint32 var_i32_2;
+ int16 var_i16_6;
+ GrafPtr var_i32_8;
+ GrafPtr var_i32_c;
+
+ int16 var_i16_10;
+ int16 var_i16_12;
+ int16 var_i16_14;
+ int16 var_i16_16;
+
+ Graphics::Surface var_i32_32;
+ Common::Rect var_i16_38;
+
+ Graphics::Surface var_i32_40;
+
+ Graphics::Surface var_i32_4e;
+
+ Common::Rect var_i16_5c;
+ Common::Rect var_i16_64;
+ Common::Rect var_i16_6c;
+
+ // 1 for prologue, 2 for finale
+ int16 var_i16_1aa;
+
+ int32 var_i32_182;
+ int16 var_i16_18c;
+ int16 var_i16_18e;
+
+ int16 var_i16_1a4;
+
+ int16 var_i16_3e0;
+
+ // picture resource handles
+ Handle arr_i32_0[0x30] = { 0 };
+
+ Pattern arr_i16_194[5];
+
+
+ Common::Rect arr_i16_1bc;
Common::Rect arr_i32_1c4;
- Common::String var_str_76;
+ int16 arr_i16_1e8[1206] = { 0 };
+
+ uint32 arr_i32_41296[12] = { 0 };
+
+ int16 arr_i16_412ea[SCREEN_HEIGHT];
+
+ Common::Rect arr_i16_41af4;
+ Common::Rect arr_i16_41afc;
+ Common::Rect arr_i16_41b0a;
+
+ double arr_f64_41bbe[8] = { 0 };
+
+ Common::U32String var_str_76;
void run();
};
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 0f649d5dbf0..51b0fc7016b 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -29,8 +29,11 @@
namespace Fool {
+typedef uint32 GrafPtr;
+typedef uint32 Handle;
typedef uint32 RgnHandle;
typedef uint32 PicHandle;
+typedef uint32 PolyHandle;
struct Pattern {
uint8 data[8];
@@ -91,6 +94,10 @@ public:
// application starts up to get the reference number of its resource file.
uint16 CurResFile();
+ // PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
+ // Delay causes the system to wait for the number of ticks (sixtieths of a second) specified by numTicks, and returns in finalTicks the total number of ticks from system startup to the end of the delay.
+ uint32 Delay(uint32 numTicks);
+
// PROCEDURE DrawChar (ch: CHAR);
// DrawChar places the given character to the right of the pen location, with the left end of its base
// line at the pen's location, and advances the pen accordingly. If the character isn't in the font, the
@@ -178,6 +185,7 @@ public:
// by dv. If dh or dv is negative, the appropriate pair of sides is moved outward instead of inward.
// The effect is to alter the size by 2*dh horizontally and 2*dv vertically, with the rectangle
// remaining centered in the same place on the coordinate plane.
+ void InsetRect(Common::Rect &r, int16 dh, int16 dv);
// PROCEDURE InvertOval (r: Rect);
// InvertOval inverts the pixels enclosed by an oval just inside the specified rectangle: Every white
@@ -194,6 +202,7 @@ public:
// PROCEDURE KillPoly (poly: PolyHandle);
// KillPoly releases the memory occupied by the given polygon. Use this only when you're completely
// through with a polygon.
+ void KillPoly(PolyHandle poly);
// PROCEDURE LineTo (h,v: INTEGER);
// LineTo draws a line from the current pen location to the location specified (in local coordinates)
@@ -224,6 +233,7 @@ public:
// OpenPort is called by the Window Manager when you create a window, and you normally won't
// call it yourself. If you do call OpenPort, you can create the grafPtr with the Memory Manager
// procedure NewPtr or reserve the space on the stack (with a variable of type GrafPort).
+ void OpenPort(GrafPtr port);
// PROCEDURE PaintOval (r: Rect);
// PaintOval paints an oval just inside the specified rectangle with the current grafPort's pen pattern
@@ -275,7 +285,7 @@ public:
// The given handle will no longer be recognized as a handle to a resource; if the Resource Manager
// is subsequendy called to get the released resource, a new handle will be allocated. Use this
// procedure only after you're completely through with a resource.
- void ReleaseResource(uint32 handle);
+ void ReleaseResource(Handle &handle);
// PROCEDURE SetCPixel (h,v: INTEGER; cPix: RGBColor);
// The SetCPixel function sets the pixel at the specified position to the pixel value that most
@@ -284,6 +294,7 @@ public:
// PROCEDURE SetPort (port: GrafPtr);
// SetPort makes the specified grafPort the current port.
+ void SetPort(GrafPtr port);
// PROCEDURE SetPortBits (bm: BitMap);
// SetPortBits sets the portBits field of the current grafPort to any previously defined bit map. This
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 7bf740473f1..f6604daf343 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -19,10 +19,115 @@
*
*/
+#include "common/macresman.h"
+
+#include "common/str-enc.h"
+#include "common/stream.h"
+#include "fool/fool.h"
#include "fool/toolbox.h"
+#include "fool/zbasic.h"
namespace Fool {
+void ZBasic::loadProgram(const Common::Path &path) {
+ Common::MacResManager resman;
+ if (!resman.open(path)) {
+ warning("ZBasic::loadProgram: unable to open %s", path.toString(':').c_str());
+ return;
+ }
+ Common::SeekableReadStream *scot = resman.getResource(MKTAG('S', 'C', 'O', 'T'), 1);
+ if (!scot) {
+ warning("ZBasic::loadProgram: could not find SCOT chunk");
+ return;
+ }
+
+ Common::Array<ZBasicDatum> dataTable;
+ Common::Array<ZBasicDatum> stringTable;
+ bool hasStringTable = false;
+ while (scot->pos() < scot->size()) {
+ uint32 offset = scot->pos();
+ uint8 opcode = scot->readByte();
+ if (opcode == 0x80) {
+ hasStringTable = true;
+ break;
+ }
+ switch (opcode) {
+ case kDatumNULL:
+ dataTable.push_back(ZBasicDatum::newNull(offset));
+ break;
+ case kDatumINT:
+ {
+ uint8 size = scot->readByte();
+ if (size == 0) {
+ dataTable.push_back(ZBasicDatum::newInt(offset, 0));
+ } else if (size == 2) {
+ dataTable.push_back(ZBasicDatum::newInt(offset, scot->readSint16BE()));
+ } else {
+ warning("ZBasic::loadProgram: unexpected size for int %d", size);
+ scot->skip(size);
+ }
+ }
+ break;
+ case kDatumDBLINT:
+ {
+ uint8 size = scot->readByte();
+ if (size == 0) {
+ dataTable.push_back(ZBasicDatum::newDblInt(offset, 0));
+ } else if (size == 2) {
+ dataTable.push_back(ZBasicDatum::newDblInt(offset, scot->readSint32BE()));
+ } else {
+ warning("ZBasic::loadProgram: unexpected size for dblint %d", size);
+ scot->skip(size);
+ }
+ }
+ break;
+ case kDatumSTR:
+ {
+ uint8 size = scot->readByte();
+ char *buf = new char[size];
+ scot->read(buf, size);
+ dataTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
+ delete[] buf;
+ }
+ break;
+ case kDatumBCD:
+ {
+ scot->seek(-1);
+ dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ delete scot;
+
+}
+
+int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2) {
+ uint32 result = string1.find(string2, (uint32)MAX<int16>(expression - 1, 1));
+ if (result == Common::U32String::npos)
+ return 0;
+ return (int16)(result + 1);
+}
+
+bool ZBasic::maybe() {
+ return g_engine->getRandomNumber(1) == 1;
+}
+
+uint32 ZBasic::mem(int16 index) {
+ if (index == -1)
+ return 32*1024*1024;
+ return 0;
+}
+
+int16 ZBasic::rndInt(int16 max) {
+ if (max == 0)
+ return 0;
+ max = (int16)abs(MAX<int16>(max, -32767));
+ return (int16)(g_engine->getRandomNumber(max - 1) + 1);
+}
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 7a7a84b713f..74bb4b56717 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -22,12 +22,213 @@
#ifndef FOOL_ZBASIC_H
#define FOOL_ZBASIC_H
+#include "common/str.h"
+#include "common/ustr.h"
+#include "graphics/surface.h"
+
+#include "fool/toolbox.h"
+
namespace Fool {
+union DoubleBits {
+ uint64 i;
+ double d;
+};
+
+struct ZBasicBCD {
+ uint16 exponent = 0;
+ uint64 mantissaBits = 0;
+ uint8 mantissaSize = 0;
+
+ ZBasicBCD() {}
+
+ ZBasicBCD(uint16 e, uint64 mb, uint8 ms) {
+ this->exponent = e;
+ this->mantissaBits = mb;
+ this->mantissaSize = ms;
+ }
+
+ ZBasicBCD(const ZBasicBCD &obj) {
+ this->exponent = obj.exponent;
+ this->mantissaBits = obj.mantissaBits;
+ this->mantissaSize = obj.mantissaSize;
+ }
+
+ static ZBasicBCD read(Common::SeekableReadStream *stream) {
+ ZBasicBCD bcd = { 0, 0, 0 };
+ uint8 size = stream->readByte();
+ if (size == 0) {
+ // pass
+ } else if (size == 4) {
+ bcd.exponent = stream->readUint16BE();
+ bcd.mantissaBits = stream->readUint16BE();
+ bcd.mantissaSize = 16;
+ } else if (size == 6) {
+ bcd.exponent = stream->readUint16BE();
+ bcd.mantissaBits = stream->readUint32BE();
+ bcd.mantissaSize = 32;
+ } else if (size == 8) {
+ bcd.exponent = stream->readUint16BE();
+ bcd.mantissaBits = stream->readUint32BE() << 16;
+ bcd.mantissaBits += stream->readUint16BE();
+ bcd.mantissaSize = 48;
+ } else {
+ warning("ZBasicBCD::read: unexpected size for bcd %d", size);
+ stream->skip(size);
+ }
+ return bcd;
+ }
+
+ double toDouble() {
+ DoubleBits result = { 0 };
+ int64 expSigned = this->exponent <= 0x3fff ? (int64)this->exponent : ((int64)this->exponent - 0x8000);
+ if (expSigned > 0x7ff) {
+ result.i = 0x7ff0000000000000; // +inf
+ } else if (expSigned < -0x800) {
+ result.i = 0xfff0000000000000; // -inf
+ } else {
+ int sign = expSigned < 0 ? -1 : 1;
+ uint64 mantissaRaw = this->mantissaBits;
+ for (int i = 0; i < this->mantissaSize; i += 4) {
+ if (i != 0) {
+ result.d /= 10;
+ }
+ result.d += (double)(mantissaRaw & 0xf);
+ mantissaRaw >>= 4;
+ }
+ result.d *= sign * pow((double)10, (double)expSigned);
+ }
+ return result.d;
+ }
+};
+
+enum ZBasicTextFont {
+ kFontSystem = 0,
+ kFontApplication = 1,
+ kFontNewYork = 2,
+ kFontGeneva = 3,
+ kFontMonaco = 4,
+ kFontVenice = 5,
+ kFontLondon = 6,
+ kFontAthens = 7,
+ kFontSanFrancisco = 8,
+ kFontToronto = 9,
+ kFontSeattle = 10,
+ kFontCairo = 11,
+ kFontLosAngeles = 12
+};
+
+enum ZBasicTextFace {
+ kFacePlain = 0,
+ kFaceBold = 1,
+ kFaceItalic = 2,
+ kFaceUnderlined = 4,
+ kFaceOutlined = 8,
+ kFaceShadow = 16,
+ kFaceCondensed = 32,
+ kFaceExtended = 64
+};
+
+enum ZBasicTextMode {
+ kModeSourceCOPY = 0,
+ kModeSourceOR = 1,
+ kModeSourceXOR = 2,
+ kModeSourceBIC = 3,
+ kModeNOTSourceCOPY = 4,
+ kModeNOTSourceOR = 5,
+ kModeNOTSourceXOR = 6,
+ kModeNOTSourceBIC = 7
+};
+
+enum ZBasicDatumType {
+ kDatumNULL = 0,
+ kDatumINT = 1,
+ kDatumDBLINT = 2,
+ kDatumBCD = 4,
+ kDatumSTR = 8,
+};
+
+struct ZBasicDatum {
+ ZBasicDatumType type = kDatumNULL;
+ uint32 offset = 0;
+ union {
+ ZBasicBCD *bcd = 0;
+ int16 i16;
+ int32 i32;
+ Common::U32String *str;
+ } data;
+
+ ~ZBasicDatum() {
+ if (this->type == kDatumBCD) {
+ delete this->data.bcd;
+ this->data.bcd = 0;
+ } else if (this->type == kDatumSTR) {
+ delete this->data.str;
+ this->data.str = 0;
+ }
+ }
+
+ static ZBasicDatum newNull(uint32 offset) {
+ ZBasicDatum result;
+ result.type = kDatumNULL;
+ result.offset = offset;
+ result.data.bcd = 0;
+ return result;
+ }
+
+ static ZBasicDatum newInt(uint32 offset, int16 value) {
+ ZBasicDatum result;
+ result.type = kDatumINT;
+ result.offset = offset;
+ result.data.i16 = value;
+ return result;
+ }
+
+ static ZBasicDatum newDblInt(uint32 offset, int32 value) {
+ ZBasicDatum result;
+ result.type = kDatumDBLINT;
+ result.offset = offset;
+ result.data.i32 = value;
+ return result;
+ }
+
+ static ZBasicDatum newBcd(uint32 offset, const ZBasicBCD &value) {
+ ZBasicDatum result;
+ result.type = kDatumBCD;
+ result.offset = offset;
+ result.data.bcd = new ZBasicBCD(value);
+ return result;
+ }
+
+ static ZBasicDatum newStr(uint32 offset, const Common::U32String &value) {
+ ZBasicDatum result;
+ result.type = kDatumSTR;
+ result.offset = offset;
+ result.data.str = new Common::U32String(value);
+ return result;
+ }
+};
+
class ZBasic {
public:
+ void loadProgram(const Common::Path &path);
+ void loadSCOT();
+
+ void bufferFlush(const Common::U32String &str);
+ void blockMove(int16 srcptr, int16 destptr, uint16 size);
+ void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest);
+ int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
+ bool maybe();
+ uint32 mem(int16 index);
+ void put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src);
+ void text(int16 font, int16 size, int16 face, ZBasicTextMode mode);
+ void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
+ int16 rndInt(int16 max);
+
+
+
};
} // namespace Fool
Commit: 4f5739bcfbd56b72072a29032f26ac51030797d6
https://github.com/scummvm/scummvm/commit/4f5739bcfbd56b72072a29032f26ac51030797d6
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:45+02:00
Commit Message:
FOOL: It continues
Changed paths:
engines/fool/fool.cpp
engines/fool/fool.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index 9d662563e02..848cabcbda3 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -19,9 +19,6 @@
*
*/
-#include "fool/fool.h"
-#include "fool/detection.h"
-#include "fool/console.h"
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
@@ -30,6 +27,10 @@
#include "engines/util.h"
#include "graphics/palette.h"
+#include "fool/fool.h"
+#include "fool/detection.h"
+#include "fool/console.h"
+
namespace Fool {
FoolEngine *g_engine;
@@ -37,6 +38,7 @@ FoolEngine *g_engine;
FoolEngine::FoolEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Fool") {
g_engine = this;
+
}
FoolEngine::~FoolEngine() {
@@ -51,12 +53,17 @@ Common::String FoolEngine::getGameId() const {
}
Common::Error FoolEngine::run() {
- // Initialize 320x200 paletted graphics mode
- initGraphics(320, 200);
+ initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
// Set the engine's debugger console
setDebugger(new Console());
+ _screen.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ _wm.setScreen(&_screen);
+
+ // Menu
+ _menu = _wm.addMenu();
+
return Common::kNoError;
}
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
index 90d64fa815b..c0faf95975c 100644
--- a/engines/fool/fool.h
+++ b/engines/fool/fool.h
@@ -32,11 +32,16 @@
#include "common/util.h"
#include "engines/engine.h"
#include "engines/savestate.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "graphics/screen.h"
#include "fool/detection.h"
#include "fool/events.h"
+#define SCREEN_WIDTH 0x200
+#define SCREEN_HEIGHT 0x156
+#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8) // 0x5580
+
namespace Fool {
struct FoolGameDescription;
@@ -50,6 +55,10 @@ protected:
Common::Error run() override;
public:
+ Graphics::ManagedSurface _screen;
+ Graphics::MacWindowManager _wm;
+ Graphics::MacMenu *_menu;
+
FoolEngine(OSystem *syst, const ADGameDescription *gameDesc);
~FoolEngine() override;
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index c97ba24700f..c5fc8a1f81a 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -20,6 +20,7 @@
*/
+#include "fool/fool.h"
#include "fool/fool_prologue.h"
#include "common/translation.h"
#include "fool/toolbox.h"
@@ -43,13 +44,12 @@ void FoolPrologue::run() {
g_toolbox->UseResFile(g_toolbox->CurResFile());
// 128:001e
- // b54 must be the 1-bit screen double buffer?
+ // b54 must be the 1-bit screen buffer
for (int i = 0; i < 12; i++) {
this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
-
}
// 128:0066
- this->var_i32_4e = this->arr_i32_412c2[0];
+ this->var_i32_4e = this->arr_i32_41296[11];
// 128:0078
// stipple pattern buffer?
this->arr_i16_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
@@ -62,11 +62,12 @@ void FoolPrologue::run() {
this->arr_i16_194[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
// 128:017a
- this->var_str_76 = _("© 1987 by Cliff Johnson ALL RIGHTS RESERVED");
+ // about message
+ this->var_str_76 = g_zbasic->str(0);
g_zbasic->bufferFlush(this->var_str_76);
- this->var_str_76 = _("This software was created using the ZBasic⢠compiler.");
+ this->var_str_76 = g_zbasic->str(1);
g_zbasic->bufferFlush(this->var_str_76);
- this->var_str_76 = _("Portions of this code are © Copyrighted, 1985 by Zedcor Inc.");
+ this->var_str_76 = g_zbasic->str(2);
g_zbasic->bufferFlush(this->var_str_76);
// 128:01b6
@@ -92,14 +93,14 @@ void FoolPrologue::run() {
void FoolPrologue::sub_128_1ba(int16 screen_page) {
// 128:01ba
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[screen_page];
+ g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_1f4(int16 screen_page) {
// 128:01f4
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
- g_toolbox->SetPortBits(this->var_i32_40);
+ this->var_i32_40 = this->arr_i32_41296[screen_page];
+ g_toolbox->SetPortBits(*this->var_i32_40);
}
void FoolPrologue::sub_128_21e(int16 numTicks) {
@@ -133,7 +134,7 @@ void FoolPrologue::sub_128_2a6(int16 unk1, int16 unk2) {
void FoolPrologue::sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right) {
// 128:02f0
g_toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
- g_toolbox->FillRect(this->arr_i16_41af4, this->arr_i16_194[unk]);
+ g_toolbox->FillRect(this->arr_i16_41af4, this->arr_i16_194[pattern_id]);
}
void FoolPrologue::sub_128_354(uint16 unk1, uint16 unk2) {
@@ -205,7 +206,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = this->arr_i16_412ea[i] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[i];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
if (i % unk1 == 0) {
this->sub_128_24a(0);
}
@@ -215,7 +216,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_
void FoolPrologue::sub_128_610(int16 screen_page) {
// 128:0610
this->var_i32_40 = this->arr_i32_41296[screen_page];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_64a(int16 unk1) {
@@ -243,9 +244,9 @@ void FoolPrologue::sub_128_6e4(int16 screen_page) {
this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
}
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
@@ -278,8 +279,11 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
for (int j = 0; j < 4; j++) {
this->arr_f64_41bbe[j] = this->arr_f64_41bbe[j] + this->arr_f64_41bbe[j+4];
- this->arr_i16_41af4[j+11] = (int16_t)this->arr_f64_41bbe[j];
}
+ this->arr_i16_41b0a.top = (int16_t)this->arr_f64_41bbe[0];
+ this->arr_i16_41b0a.left = (int16_t)this->arr_f64_41bbe[1];
+ this->arr_i16_41b0a.bottom = (int16_t)this->arr_f64_41bbe[2];
+ this->arr_i16_41b0a.right = (int16_t)this->arr_f64_41bbe[3];
g_toolbox->PaintRect(this->arr_i16_41b0a);
this->sub_128_24a(0);
}
@@ -323,7 +327,7 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
if (this->var_i16_6 > 0xb5) {
this->var_i16_6 = 0;
}
- } while (this->var_i32_2 + this->var_i16_1a4 <= g_toolbox->TickCount())
+ } while (this->var_i32_2 + this->var_i16_1a4 <= g_toolbox->TickCount());
}
void FoolPrologue::sub_128_c8a() {
@@ -342,7 +346,7 @@ void FoolPrologue::sub_128_c8a() {
// 128:0cc8
g_zbasic->unk4();
g_zbasic->20();
- this->arr_i32_1ac = this->arr_i32_41598;
+ this->arr_i32_194[3] = this->arr_i32_41598;
this->arr_i32_1b0 = this->arr_i32_41846;
this->var_i16_1b4 = this->var_i16_18e * 2 + 2;
// 128:0d00
@@ -354,8 +358,8 @@ void FoolPrologue::sub_128_c8a() {
this->var_i16_1b6 = g_engine->getRandomNumber(i);
this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
- g_zbasic->blockMove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8);
- g_zbasic->blockMove(this->var_i16_1b4 - this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8);
+ g_zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
+ g_zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
}
}
@@ -363,14 +367,14 @@ void FoolPrologue::sub_128_c8a() {
void FoolPrologue::sub_128_de2() {
// 128:0de2
g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceXOR);
- this->var_str_76 = _("Click Mouse to Continue");
+ this->var_str_76 = g_zbasic->str(3);
this->sub_128_a6c(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceXOR);
- this->var_str_76 = _("Click Mouse to Continue");
+ this->var_str_76 = g_zbasic->str(4);
this->sub_128_26c(0x154, 0x1f7);
}
@@ -378,8 +382,8 @@ void FoolPrologue::sub_128_e58() {
// 128:0e58
this->sub_128_e80();
while (true) {
- this->var_i16_1ba = g_toolbox->GetNextEvent(0x2, &this->var_22);
- if (this->var_22 == 1)
+ this->var_i16_1ba = g_toolbox->GetNextEvent(0x2, this->var_ev_22);
+ if (this->var_ev_22.what == kMouseDown)
break;
}
this->sub_128_e80();
@@ -388,14 +392,14 @@ void FoolPrologue::sub_128_e58() {
void FoolPrologue::sub_128_e80() {
// 128:0e80
while (true) {
- this->var_i16_1ba = (int)g_toolbox->GetNextEvent(-1, &this->var_22);
- if (this->var_22 == 6) {
+ this->var_i16_1ba = (int)g_toolbox->GetNextEvent(-1, this->var_ev_22);
+ if (this->var_ev_22.what == kUpdateEvt) {
this->sub_128_ed2();
}
- if (this->var_22 == 7) {
+ if (this->var_ev_22.what == kDiskEvt) {
this->sub_128_ee0();
}
- if ((this->var_i16_30 & 0x80) && (this->var_22 == 0)) {
+ if ((this->var_i16_30 & 0x80) && (this->var_ev_22.what == kNullEvent)) {
break;
}
}
@@ -456,8 +460,8 @@ void FoolPrologue::sub_129_004() {
this->var_i16_16 = (this->var_i16_12 - SCREEN_HEIGHT)/2;
// 129:0064
- g_zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, 3);
- g_zbasic->coordinate_window();
+ g_zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, kWindowDialogOneLine);
+ //g_zbasic->coordinate_window();
this->var_i16_1c = 0;
this->var_i16_1e = 0;
@@ -474,9 +478,9 @@ void FoolPrologue::sub_129_004() {
}
// 129:00ee
- this->var_i32_c = this->arr_i21_a8a[0];
+ this->var_i32_c = &this->arr_grafport_a8a;
g_toolbox->OpenPort(this->var_i32_c);
- this->var_i32_8 = this->arr_i21_9c0[0];
+ this->var_i32_8 = &this->arr_grafport_9c0;
g_toolbox->OpenPort(this->var_i32_8);
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
@@ -506,10 +510,10 @@ void FoolPrologue::sub_129_004() {
// 129:026c
this->var_i32_32 = this->var_i32_8.portBits;
this->var_i16_36 = 0x40;
- this->var_i16_38 = -this->var_i16_16;
- this->var_i16_3a = -this->var_i16_14;
- this->var_i16_3c = this->var_i16_16 + SCREEN_HEIGHT;
- this->var_i16_3e = this->var_i16_14 + SCREEN_WIDTH;
+ this->var_i16_38.top = -this->var_i16_16;
+ this->var_i16_38.left = -this->var_i16_14;
+ this->var_i16_38.bottom = this->var_i16_16 + SCREEN_HEIGHT;
+ this->var_i16_38.right = this->var_i16_14 + SCREEN_WIDTH;
this->var_i16_44 = 0x40;
this->var_i16_46 = 0x0;
this->var_i16_48 = 0x0;
@@ -534,15 +538,16 @@ void FoolPrologue::sub_129_004() {
// 129:0386
this->sub_128_2f0(2, 0x50, 0x6e, 0xc3, 0x18e);
g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
- this->var_str_76 = _("There is not enough available memory");
+ // "not enough memory" message
+ this->var_str_76 = g_zbasic->str(6);
this->sub_128_2a6(0x64, 0xfc);
- this->var_str_76 = _("to run the program at this time.");
+ this->var_str_76 = g_zbasic->str(7);
this->sub_128_2a6(0x78, 0xfc);
- this->var_str_76 = _("Check your instruction manual for ");
+ this->var_str_76 = g_zbasic->str(8);
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = _("for possible solutions.");
+ this->var_str_76 = g_zbasic->str(9);
this->sub_128_2a6(0xaa, 0xfc);
- this->var_str_76 = _("(click mouse to quit)");
+ this->var_str_76 = g_zbasic->str(10);
this->sub_128_2a6(0xcb, 0xfc);
this->sub_128_e58();
g_zbasic->get_from(0x0, 0x14);
@@ -557,7 +562,8 @@ void FoolPrologue::sub_129_004() {
this->var_i16_176 = g_zbasic->249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
if (g_zbasic->106(Common::U32String(""), &this->var_i16_1c4)) {
// 129:04de
- this->var_str_76 = _("And now it is time to show the Finale for the Fool's Errand.");
+ // "and now it is time to show the finale" message
+ this->var_str_76 = g_zbasic->str(12);
for (int i = 1; i < 0xa; i++) {
this->var_str_76 += g_zbasic->chr(i);
}
@@ -596,18 +602,20 @@ void FoolPrologue::sub_129_004() {
this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
// 129:0662
g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
- this->var_str_76 = _("Set your monitor to");
+ // "set your monitor to black and white" message"
+ this->var_str_76 = g_zbasic->str(13);
this->sub_128_2a6(0x82, 0xfc);
- this->var_str_76 = _("2 color black and white");
+ this->var_str_76 = g_zbasic->str(14);
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = _("and start the Prologue again.");
+ this->var_str_76 = g_zbasic->(15);
+ // if this is the finale
if (this->var_i16_1aa == 2) {
- this->var_str_76 = _("and start the Finale again.");
+ this->var_str_76 = g_zbasic->(16);
}
this->sub_128_2a6(0xaa, 0xfc);
- this->var_str_76 = _("(click mouse to quit)");
+ this->var_str_76 = g_zbasic->str(17);
this->sub_128_2a6(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
@@ -654,9 +662,9 @@ void FoolPrologue::sub_130_004() {
// 130:007a
g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceBIC);
- this->var_str_76 = Common::String(_("©1987 by Cliff Johnson. All Rights Reserved."));
+ this->var_str_76 = g_zbasic->str(18);
this->sub_128_2a6(0x10d, 0xdd);
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
for (int i = 1; i < 5; i++) {
this->sub_130_cea();
}
@@ -675,7 +683,7 @@ void FoolPrologue::sub_130_004() {
// 130:015c
for (int i = 3; i < 5; i++) {
- g_zbasic->blockMove(this->arr_i32_412b2[0], this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
}
this->sub_130_cea();
this->sub_128_1f4(0);
@@ -729,7 +737,7 @@ void FoolPrologue::sub_130_004() {
}
this->arr_i32_120[0] = g_toolbox->GetPicture(0x48);
- g_toolbox->SetPortBits(&this->var_i32_32);
+ g_toolbox->SetPortBits(&*this->var_i32_32);
// 130:0380
if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
@@ -762,26 +770,26 @@ void FoolPrologue::sub_130_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_412b2[1];
// 130:049e
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(4);
this->var_i16_192 = 0;
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = *this->arr_i32_412a2;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[3];
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
// 130:0518
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = *this->arr_i32_412a6;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[4];
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = *this->arr_i32_412aa;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[5];
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
}
// 130:05b6
- this->var_i32_40 = *this->arr_i32_412b2;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[7];
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
}
@@ -790,22 +798,22 @@ void FoolPrologue::sub_130_004() {
this->sub_130_db0();
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_a8c(0xb4);
- this->var_i32_40 = *this->arr_i32_4129a;
+ this->var_i32_40 = this->arr_i32_41296[1];
// 130:062c
- this->var_i16_74 = 0;
- while (this->var_i16_74 != SCREEN_HEIGHT) {
+ int y = 0;
+ while (y != SCREEN_HEIGHT) {
this->var_i16_5c.right = SCREEN_WIDTH;
this->var_i32_2 = g_toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
this->var_i16_192 = 1;
- if (this->var_i16_74 < SCREEN_HEIGHT) {
- this->var_i16_74 += 1;
+ if (y < SCREEN_HEIGHT) {
+ y += 1;
}
- this->var_i16_5c.top = this->arr_i16_412ea[this->var_i16_74] - 1;
- this->var_i16_5c.bottom = this->arr_i16_412ea[this->var_i16_74];
+ this->var_i16_5c.top = this->arr_i16_412ea[y] - 1;
+ this->var_i16_5c.bottom = this->arr_i16_412ea[y];
// 130:068e
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_5c, this->arr_i32_5c, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_5c, this->arr_i32_5c, 0, 0);
}
// 130:06b0
this->sub_128_a8c(1);
@@ -836,7 +844,7 @@ void FoolPrologue::sub_130_004() {
for (int i = 3; i < 5; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[i];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(3);
}
}
@@ -848,29 +856,29 @@ void FoolPrologue::sub_130_004() {
this->sub_128_24a(1);
}
// 130:083c
- g_zbasic->picture(0, 0, 0, this->arr_i32_34);
- g_zbasic->picture(5, 0, 0, this->arr_i32_38);
- g_toolbox->ReleaseResource(*this->arr_i32_34);
- g_toolbox->ReleaseResource(*this->arr_i32_38);
+ g_zbasic->picture(0, 0, 0, this->arr_i32_0[0xd]);
+ g_zbasic->picture(5, 0, 0, this->arr_i32_0[0xe]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[0xd]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[0xe]);
this->var_i32_2 = g_toolbox->TickCount();
// 130:0890
g_zbasic->52(0);
this->sub_128_1f4(0);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x17, 0, this->arr_i32_3c);
- g_toolbox->ReleaseResource(*this->arr_i32_3c);
+ g_zbasic->picture(0, 0x17, 0, this->arr_i32_0[0xf]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[0xf]);
// 130:08dc
this->sub_130_f48();
this->sub_128_de2();
this->sub_128_1f4(1);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0xf0, 0xba, 0, this->arr_i32_40);
- g_toolbox->ReleaseResource(*this->arr_i32_40);
+ g_zbasic->picture(0xf0, 0xba, 0, this->arr_i32_0[0x10]);
+ g_toolbox->ReleaseResource(*this->arr_i32_0[0x10]);
this->sub_130_f48();
this->sub_128_de2();
// 130:0934
for (int i = 2; i < 5; i++) {
- g_zbasic->blockMove(*this->arr_i32_4129a, this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
}
// 130:0978
for (int i = 1; i < 5; i++) {
@@ -889,20 +897,20 @@ void FoolPrologue::sub_130_004() {
// 130:0a42
this->sub_128_1f4(6);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0x166, 0x77, 0, this->arr_i32_44);
+ g_zbasic->picture(0x166, 0x77, 0, this->arr_i32_0[0x11]);
this->sub_128_de2();
- g_zbasic->blockMove(*this->arr_i32_412ae, *this->arr_i32_412b2, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
this->sub_130_f48();
- g_toolbox->ReleaseResource(*this->arr_i32_44);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->sub_128_1f4(7);
// 130:0ac2
- g_zbasic->picture(-0x14, -0x1e, 0, this->arr_i32_48);
+ g_zbasic->picture(-0x14, -0x1e, 0, this->arr_i32_0[0x12]);
this->sub_128_1f4(8);
- g_zbasic->blockMove(*this->arr_i32_412b2, *this->arr_i32_412b6, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[7], *this->arr_i32_41296[8], 0x5580);
this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
g_zbasic->picture(0x16d, 0x80, 0, this->arr_i32_120);
g_toolbox->ReleaseResource(*this->arr_i32_120);
- g_toolbox->SetPortBits(&this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
// 130:0b74
this->sub_128_24a(0xd2);
this->sub_128_e80();
@@ -913,7 +921,7 @@ void FoolPrologue::sub_130_004() {
// 130:0b98
this->var_i16_74 = 0;
this->var_i16_192 = 1;
- while (this->var_i16_22 != 1) {
+ while (this->var_ev_22.what != kMouseDown) {
// 130:0ba4
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_74 += this->var_i16_192;
@@ -927,9 +935,9 @@ void FoolPrologue::sub_130_004() {
this->sub_128_610(this->var_i16_74);
this->sub_128_24a(0xa);
// 130:0bee
- this->var_i16_1ba = g_toolbox->GetNextEvent(2, &this->var_i16_22);
+ this->var_i16_1ba = g_toolbox->GetNextEvent(2, this->var_ev_22);
}
- while (!((this->var_i16_22 == 0) && (this->var_i16_30 & 0x80))) {
+ while (!((this->var_ev_22.what == kNullEvent) && (this->var_ev_22.modifiers & 0x80))) {
// 130:0c0c
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_74 += this->var_i16_192;
@@ -943,11 +951,11 @@ void FoolPrologue::sub_130_004() {
this->sub_128_610(this->var_i16_74);
this->sub_128_24a(0xa);
// 130:0c56
- this->var_i16_1ba = g_toolbox->GetNextEvent(-1, &this->var_i16_22);
- if (this->var_i16_22 == 6) {
+ this->var_i16_1ba = g_toolbox->GetNextEvent(-1, this->var_ev_22);
+ if (this->var_ev_22.what == kUpdateEvt) {
this->sub_128_ed2();
}
- if (this->var_i16_22 == 7) {
+ if (this->var_ev_22.what == kDiskEvt) {
this->sub_128_ee0();
}
}
@@ -978,9 +986,10 @@ void FoolPrologue::sub_130_d28() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
g_zbasic->text(0, 0xc, kFacePlain, kModeSourceOR);
- this->var_str_76 = _("Loading Prologue -");
+ // "loading prologue" message
+ this->var_str_76 = g_zbasic->str(19);
this->var_str_76 += Common::U32String::format("%d", this->var_i16_3ce);
- this->var_str_76 += _("%");
+ this->var_str_76 += g_zbasic->str(20);
// 130:0d70
this->sub_128_2f0(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
this->sub_128_2a6(0xe, this->var_i16_10/2);
@@ -1017,19 +1026,18 @@ void FoolPrologue::sub_130_e82() {
void FoolPrologue::sub_130_f48() {
// 130:0f48
- this->var_i16_3d2 = g_zbasic->read_as_int();
- this->var_i16_74 = 1;
- while (this->var_i16_74 <= this->var_i16_3d2) {
+ this->var_i16_3d2 = g_zbasic->readInt();
+ for (int i = 1; i <= this->var_i16_3d2; i++) {
// 130:0f56
- this->var_i16_176 = g_zbasic->read_as_int();
- this->var_i16_180 = g_zbasic->read_as_int();
- this->var_str_76 = g_zbasic->read_as_str();
+ this->var_i16_176 = g_zbasic->readInt();
+ this->var_i16_180 = g_zbasic->readInt();
+ this->var_str_76 = g_zbasic->readStr();
this->var_i16_1ba = 1;
// JMP 0xfc2
while (this->var_i16_1ba > 0) {
// 130:0f78
- this->var_i16_1ba = g_zbasic->instr(this->var_i16_1ba, this->var_str_76, _("^"));
+ this->var_i16_1ba = g_zbasic->instr(this->var_i16_1ba, this->var_str_76, g_zbasic->str(21));
if (this->var_i16_1ba > 0) {
this->var_str_76.replace(this->var_i16_1ba, 1, Common::U32String("\""));
}
@@ -1037,7 +1045,6 @@ void FoolPrologue::sub_130_f48() {
// 130:0fc8
g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
this->sub_128_a6c(this->var_i16_180, this->var_i16_176);
- this->var_i16_74 += 1;
}
}
@@ -1046,7 +1053,7 @@ void FoolPrologue::sub_130_1002() {
g_zbasic->199(0x82);
this->sub_131_004();
}
-
+/*
// run finale
void FoolPrologue::sub_131_004() {
// 131:0004
@@ -1114,7 +1121,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_18e = SCREEN_HEIGHT;
this->sub_128_ccc();
this->var_i32_1a6 = g_zbasic->mem(-1);
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
this->sub_128_2f0(0x1, 0, 0, 0x14, 0x1fc);
@@ -1133,11 +1140,11 @@ void FoolPrologue::sub_131_004() {
this->var_i16_3da = 1;
// 131:030c
- this->var_i16_18e = g_zbasic->read_as_int();
+ this->var_i16_18e = g_zbasic->readInt();
for (int i = 1; i < this->var_i16_18e; i++) {
// 131:031a
- this->arr_i16_1e8[i] = g_zbasic->read_as_int();
- this->arr_i16_1e8[i + 0xfb] = g_zbasic->read_as_int();
+ this->arr_i16_1e8[i] = g_zbasic->readInt();
+ this->arr_i16_1e8[i + 0xfb] = g_zbasic->readInt();
this->arr_i16_1e8[i + 0x1f6] = g_zbasic->read_int();
}
@@ -1156,7 +1163,7 @@ void FoolPrologue::sub_131_004() {
// 131:03c0
this->sub_128_21e(0x1e);
g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
- this->var_str_76 = Common::U32String::format("\"%s\"", _("Well. . . that's that!"));
+ this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(22));
g_zbasic->bufferFlush(this->var_str_76);
// 131:0400
@@ -1182,14 +1189,14 @@ void FoolPrologue::sub_131_004() {
// 131:04da
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = *this->arr_i32_412aa;
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[5];
+ g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
this->sub_128_2f0(0);
this->sub_131_4e48();
// 131:0538
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
- g_toolbox->SetPortBits(this->var_i32_4e);
+ g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->SetPortBits(*this->var_i32_4e);
// 131:0554
this->sub_128_2f0(0, 0, 0x9c, 0x15a, 0);
@@ -1198,16 +1205,16 @@ void FoolPrologue::sub_131_004() {
// 131:05b0
this->sub_128_1f4(6);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(7);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(8);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(9);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
// 131:0630
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
g_zbasic->get(0x1bc, 0xc1, 0x1ee, 0x117, this->arr_i32_3bca4);
this->sub_128_24a(0x3c);
this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
@@ -1260,7 +1267,7 @@ void FoolPrologue::sub_131_004() {
// 131:0926
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenPat(this->arr_i32_1ac);
+ g_toolbox->PenPat(this->arr_i32_194[3]);
g_zbasic->picture(0x6d, 0x49, -1, 0, this->arr_i32_0[0x1c]);
g_zbasic->picture(0x65, 0x48, -1, 0, this->arr_i32_0[0x1d]);
g_zbasic->picture(0x64, 0x54, -1, 0, this->arr_i32_0[0x1e]);
@@ -1310,7 +1317,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_50a(4, 0, 0x1fc, 3);
this->sub_128_1ba(5);
g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
this->sub_128_21e(0x3c);
g_zbasic->picture(0x197, 0x101, -1, 0, this->arr_i32_0[0x26]);
@@ -1323,7 +1330,7 @@ void FoolPrologue::sub_131_004() {
// 131:0c6c
for (int i = 0x6; i < 0xa; i++) {
- g_zbasic->blockMove(*this->arr_i32_412aa, this->arr_i32_41296[i], 0x5580);
+ g_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
}
this->sub_128_1f4(0x6);
g_zbasic->picture(0x6, 0x8f, -1, 0, this->arr_i32_0[0x20]);
@@ -1340,7 +1347,7 @@ void FoolPrologue::sub_131_004() {
for (int i = 0x20; i < 0x23; i++) {
g_toolbox->ReleaseResource(this->arr_i32_0[i]);
}
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
this->sub_128_24a(0x64);
g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
@@ -1352,13 +1359,13 @@ void FoolPrologue::sub_131_004() {
// 131:0e08
g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
- this->var_str_76 = Common::U32String::format("\"%s\"", _("Are you still angry with me?"));
+ this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(23));
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_a6c(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
this->var_i32_2 = g_toolbox->TickCount();
// 131:0e76
- g_zbasic->blockMove(this->arr_i32_412a6, this->arr_i32_412aa, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
this->sub_128_1f4(0x5);
g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_0[0x24]);
g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_0[0x27]);
@@ -1369,10 +1376,10 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1f4(0x7);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_0[0x2a]);
- g_zbasic->blockMove(this->arr_i32_412aa, this->arr_i32_412b6, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->sub_128_1f4(0x8);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
- g_zbasic->blockMove(this->arr_i32_412a6, this->arr_i32_412ba, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
this->sub_128_1f4(0x9);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
this->sub_128_1f4(0xa);
@@ -1381,7 +1388,7 @@ void FoolPrologue::sub_131_004() {
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
this->sub_128_24a(0x78);
this->sub_128_2f0(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
@@ -1397,15 +1404,15 @@ void FoolPrologue::sub_131_004() {
for (int i = 0xdc; i > 0x19; i -= 5) {
// 131:10de
this->var_i32_2 = g_toolbox->TickCount();
- g_zbasic->blockMove(this->arr_i32_412aa, this->var_i32_4e, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
this->var_i16_64.top = i;
this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
- this->var_i32_40 = *this->arr_i32_412ae;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
- this->var_i32_40 = *this->arr_i32_412b2;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
+ this->var_i32_40 = this->arr_i32_41296[6];
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
+ this->var_i32_40 = this->arr_i32_41296[7];
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
this->sub_128_24a(0x2);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
}
// 131:11a4
@@ -1413,7 +1420,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1f4(0x5);
this->sub_128_2f0(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
g_toolbox->PenSize(0x5, 0x5);
@@ -1425,7 +1432,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
- this->var_str_76 = Common::U32String::format("\"%s\"", _("Yes, apparently so. . ."));
+ this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24));
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_26c(0x1f0, 0xd2);
g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
@@ -1448,7 +1455,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x2f]);
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
this->sub_128_24a(0xa);
this->var_i16_5c.left = 0x18b;
this->var_i16_5c.right = 0x1ef;
@@ -1462,7 +1469,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
this->var_i16_64.top = i - 1;
this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
this->sub_128_24a(0x1);
}
@@ -1487,25 +1494,25 @@ void FoolPrologue::sub_131_004() {
this->var_i16_3e0 = 0x64;
// 131:14d8
- this->var_i32_40 = this->arr_i32_412aa;
- g_toolbox->SetPortBits(this->var_i32_4e);
+ this->var_i32_40 = this->arr_i32_41296[5];
+ g_toolbox->SetPortBits(*this->var_i32_4e);
for (int i = 1; i < 0xf; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_zbasic->blockMove(this->arr_i32_412ae, this->var_i32_4e, 0x5580);
+ g_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
this->var_i16_3e0 += 5 + i*2;
this->var_i16_64.left = 0x1e0;
this->var_i16_64.right = this->var_i16_64.left + 0x32;
this->var_i16_64.top = this->var_i16_3e0;
this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 2, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 2, 0);
// 131:1582
g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
this->sub_128_24a(0x1);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
}
- g_toolbox->SetPortBits(this->var_i32_32);
+ g_toolbox->SetPortBits(*this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
for (int j = 0; j < 1; j++) {
@@ -1533,12 +1540,12 @@ void FoolPrologue::sub_131_004() {
this->sub_128_24a(0x3c);
g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
- this->var_str_76 = Common::U32String::format("\"%s\"", _("Well, this won't do. . ."));
+ this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_26c(0x17d, 0x3c);
// 131:17c8
// ...
}
-
+*/
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index f59e3345762..46f7b3e8d7a 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -28,9 +28,6 @@
#include "fool/toolbox.h"
#include "graphics/surface.h"
-#define SCREEN_WIDTH 0x200
-#define SCREEN_HEIGHT 0x156
-#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8/2) // 0x2ac0
namespace Fool {
@@ -88,13 +85,18 @@ private:
int16 var_i16_12;
int16 var_i16_14;
int16 var_i16_16;
+ int16 var_i16_1c;
+ int16 var_i16_1e;
+ int16 var_i16_20;
- Graphics::Surface var_i32_32;
+ EventRecord var_ev_22;
+
+ Graphics::Surface *var_i32_32;
Common::Rect var_i16_38;
- Graphics::Surface var_i32_40;
+ Graphics::Surface *var_i32_40;
- Graphics::Surface var_i32_4e;
+ byte *var_i32_4e;
Common::Rect var_i16_5c;
Common::Rect var_i16_64;
@@ -108,7 +110,10 @@ private:
int16 var_i16_18e;
int16 var_i16_1a4;
+ uint32 var_i32_1a6;
+ int16 var_i16_1b8;
+ int16 var_i16_1ba;
int16 var_i16_3e0;
// picture resource handles
@@ -122,7 +127,12 @@ private:
int16 arr_i16_1e8[1206] = { 0 };
- uint32 arr_i32_41296[12] = { 0 };
+ GrafPort arr_grafport_9c0;
+ GrafPort arr_grafport_a8a;
+
+ byte arr_i32_b54[SCREEN_PAGE_SIZE*12];
+
+ byte *arr_i32_41296[12];
int16 arr_i16_412ea[SCREEN_HEIGHT];
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 7bf740473f1..d91614ba771 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -23,6 +23,15 @@
namespace Fool {
+void Toolbox::OpenPort(GrafPtr port) {
+ // source: QuickDraw Routines I-163
+ port->device = 0;
+ //port->portBits = screenBits;
+ //port->portRect = screenBits.bounds;
+ //port->visRgn
+ //port->clipRgn
+ //port->bkPat = white
+}
} // namespace Fool
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 51b0fc7016b..73c356f4c72 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -29,7 +29,6 @@
namespace Fool {
-typedef uint32 GrafPtr;
typedef uint32 Handle;
typedef uint32 RgnHandle;
typedef uint32 PicHandle;
@@ -45,6 +44,76 @@ struct RGBColor {
uint16 blue;
};
+enum EventCode {
+ kNullEvent = 0,
+ kMouseDown = 1,
+ kMouseUp = 2,
+ kKeyDown = 3,
+ kKeyUp = 4,
+ kAutoKey = 5,
+ kUpdateEvt = 6,
+ kDiskEvt = 7,
+ kActivateEvt = 8,
+ kNetworkEvt = 10,
+ kDriverEvt = 11,
+ kApp1Evt = 12,
+ kApp2Evt = 13,
+ kApp3Evt = 14,
+ kApp4Evt = 15
+};
+
+struct EventRecord {
+ EventCode what;
+ uint32 message;
+ uint32 when;
+ Common::Point where;
+ uint16 modifiers;
+};
+
+enum WindowDefinition {
+ kDocumentProc = 0,
+ kDBoxProc = 1,
+ kPlainDBox = 2,
+ kAltDBoxProc = 3,
+ kNoGrowDocProc = 4,
+ kRDocProc = 16,
+};
+
+struct GrafPort {
+ uint16 device;
+ Graphics::Surface *portBits;
+ Common::Rect portRect;
+ RgnHandle visRgn;
+ RgnHandle clipRgn;
+ Pattern bkPat;
+ Pattern fillPat;
+ Common::Point pnLoc;
+ Common::Point pnSize;
+ uint16 pnMode;
+ Pattern pnPat;
+ uint16 pnVis;
+ uint16 txFont;
+ uint16 txFace;
+ uint16 txMode;
+ uint16 txSize;
+ uint32 spExtra;
+ uint32 fgColor;
+ uint32 bkColor;
+ uint16 colrBit;
+ uint16 patStretch;
+ Handle picSave;
+ Handle rgnSave;
+ Handle polySave;
+
+};
+typedef GrafPort * GrafPtr;
+
+struct WindowRecord {
+ GrafPort port;
+ uint16 windowKind;
+};
+
+// TYPE Rect: top: INTEGER; left: INTEGER; bottom: INTEGER; right: INTEGER;
class Toolbox {
@@ -159,6 +228,7 @@ public:
// available event of any type designated by the mask, subject to the priority rules discussed above
// under "Priority of Events". If no event of any of the designated types is available, GetNextEvent
// returns a null event.
+ bool GetNextEvent(uint16 eventMask, EventRecord &theEvent);
// FUNCTION GetPicture (picID: INTEGER) : PicHandle;
// GetPicture returns a handle to the picture having the given resource ID, reading it from the
@@ -301,12 +371,17 @@ public:
// allows you to perform all normal drawing and calculations on a buffer other than the screenâfor
// example, a small off-screen image for later "stamping" onto the screen (with the CopyBits
// procedure, described under "Bit Transfer Operations" below).
- void SetPortBits(const Graphics::Surface &bm);
+ void SetPortBits(const Graphics::Surface *bm);
// PROCEDURE SetRect (VAR r: Rect; left,top,right,bottom: INTEGER);
// SetRect assigns the four boundary coordinates to the given rectangle. The result is a rectangle
// with coordinates (left,top) (right,bottom).
- void SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom);
+ void SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
+ r.left = left;
+ r.top = top;
+ r.right = right;
+ r.bottom = bottom;
+ }
// PROCEDURE StringWidth (s: Str255) : INTEGER;
// StringWidth returns the width of the given text string, which it calculates by adding the
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index f6604daf343..de24017c49b 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -41,8 +41,9 @@ void ZBasic::loadProgram(const Common::Path &path) {
return;
}
- Common::Array<ZBasicDatum> dataTable;
- Common::Array<ZBasicDatum> stringTable;
+ this->_dataTable.clear();
+ this->_dataPtr = 0;
+ this->_stringTable.clear();
bool hasStringTable = false;
while (scot->pos() < scot->size()) {
uint32 offset = scot->pos();
@@ -53,15 +54,15 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
switch (opcode) {
case kDatumNULL:
- dataTable.push_back(ZBasicDatum::newNull(offset));
+ this->_dataTable.push_back(ZBasicDatum::newNull(offset));
break;
case kDatumINT:
{
uint8 size = scot->readByte();
if (size == 0) {
- dataTable.push_back(ZBasicDatum::newInt(offset, 0));
+ this->_dataTable.push_back(ZBasicDatum::newInt(offset, 0));
} else if (size == 2) {
- dataTable.push_back(ZBasicDatum::newInt(offset, scot->readSint16BE()));
+ this->_dataTable.push_back(ZBasicDatum::newInt(offset, scot->readSint16BE()));
} else {
warning("ZBasic::loadProgram: unexpected size for int %d", size);
scot->skip(size);
@@ -72,9 +73,9 @@ void ZBasic::loadProgram(const Common::Path &path) {
{
uint8 size = scot->readByte();
if (size == 0) {
- dataTable.push_back(ZBasicDatum::newDblInt(offset, 0));
+ this->_dataTable.push_back(ZBasicDatum::newDblInt(offset, 0));
} else if (size == 2) {
- dataTable.push_back(ZBasicDatum::newDblInt(offset, scot->readSint32BE()));
+ this->_dataTable.push_back(ZBasicDatum::newDblInt(offset, scot->readSint32BE()));
} else {
warning("ZBasic::loadProgram: unexpected size for dblint %d", size);
scot->skip(size);
@@ -86,20 +87,30 @@ void ZBasic::loadProgram(const Common::Path &path) {
uint8 size = scot->readByte();
char *buf = new char[size];
scot->read(buf, size);
- dataTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
+ this->_dataTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
delete[] buf;
}
break;
case kDatumBCD:
{
scot->seek(-1);
- dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
+ this->_dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
}
break;
default:
break;
}
}
+ if (hasStringTable) {
+ uint32 offset = 0;
+ while (scot->pos() < scot->size()) {
+ uint8 size = scot->readByte();
+ char *buf = new char[size];
+ scot->read(buf, size);
+ this->_stringTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
+ offset += size + 1;
+ }
+ }
delete scot;
@@ -129,5 +140,34 @@ int16 ZBasic::rndInt(int16 max) {
return (int16)(g_engine->getRandomNumber(max - 1) + 1);
}
+int16 ZBasic::readInt() {
+ if (_dataPtr >= _dataTable.size()) {
+ warning("ZBasic::readInt: no more data left");
+ return 0;
+ }
+ ZBasicDatum &el = _dataTable[_dataPtr];
+ _dataPtr++;
+ if (el.type != kDatumINT) {
+ warning("ZBasic::readInt: entry %d was unexpected type %d", el.type);
+ return 0;
+ }
+ return el.data.i16;
+}
+
+Common::U32String ZBasic::readStr() {
+ Common::U32String result;
+ if (_dataPtr >= _dataTable.size()) {
+ warning("ZBasic::readStr: no more data left");
+ return result;
+ }
+ ZBasicDatum &el = _dataTable[_dataPtr];
+ _dataPtr++;
+ if (el.type != kDatumSTR) {
+ warning("ZBasic::readStr: entry %d was unexpected type %d", el.type);
+ return result;
+ }
+ result = *el.data.str;
+ return result;
+}
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 74bb4b56717..9f446e91b37 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -148,6 +148,14 @@ enum ZBasicDatumType {
kDatumSTR = 8,
};
+enum ZBasicWindowType {
+ kWindowDocument = 1,
+ kWindowDialogTwoLine = 2,
+ kWindowDialogOneLine = 3,
+ kWindowShadow = 4,
+ kWindowDocumentFixed = 5,
+};
+
struct ZBasicDatum {
ZBasicDatumType type = kDatumNULL;
uint32 offset = 0;
@@ -211,13 +219,20 @@ struct ZBasicDatum {
class ZBasic {
+private:
+ Common::Array<ZBasicDatum> _dataTable;
+ uint32 _dataPtr;
+ Common::Array<ZBasicDatum> _stringTable;
+
public:
void loadProgram(const Common::Path &path);
void loadSCOT();
void bufferFlush(const Common::U32String &str);
- void blockMove(int16 srcptr, int16 destptr, uint16 size);
+ void blockMove(void *srcptr, void *destptr, uint16 size) {
+ memmove(destptr, srcptr, size);
+ }
void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
bool maybe();
@@ -226,8 +241,14 @@ public:
void text(int16 font, int16 size, int16 face, ZBasicTextMode mode);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
int16 rndInt(int16 max);
+ void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
+ const Common::U32String &str(size_t index) {
+ return *_stringTable[index].data.str;
+ }
+ int16 readInt();
+ Common::U32String readStr();
};
Commit: d7a1d78c5f990bea41b5aadd4169d36020a93257
https://github.com/scummvm/scummvm/commit/d7a1d78c5f990bea41b5aadd4169d36020a93257
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:45+02:00
Commit Message:
FOOL: Fix first lot of compile errors
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index c5fc8a1f81a..f60408acd62 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -20,12 +20,13 @@
*/
+#include "common/str.h"
+#include "common/str-enc.h"
+
#include "fool/fool.h"
#include "fool/fool_prologue.h"
-#include "common/translation.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
-#include "common/str.h"
namespace Fool {
@@ -38,7 +39,7 @@ Toolbox *g_toolbox;
void FoolPrologue::run() {
// 128:0004
- g_zbasic->unk_176();
+ g_zbasic->coordinateWindow();
g_toolbox->ClearMenuBar();
g_toolbox->HideCursor();
g_toolbox->UseResFile(g_toolbox->CurResFile());
@@ -46,20 +47,21 @@ void FoolPrologue::run() {
// 128:001e
// b54 must be the 1-bit screen buffer
for (int i = 0; i < 12; i++) {
- this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
+ //this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
+ this->arr_i32_41296[i].create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
// 128:0066
- this->var_i32_4e = this->arr_i32_41296[11];
+ this->var_i32_4e = &this->arr_i32_41296[11];
// 128:0078
// stipple pattern buffer?
- this->arr_i16_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
- this->arr_i16_194[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } };
- this->arr_i16_194[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+ this->arr_pat_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ this->arr_pat_194[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } };
+ this->arr_pat_194[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
// 128:00d6
- this->arr_i16_194[3] = { { 0x01, 0x07, 0x0e, 0x0c, 0x7c, 0x70, 0xc0, 0xc0 } };
- this->arr_i16_194[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
+ this->arr_pat_194[3] = { { 0x01, 0x07, 0x0e, 0x0c, 0x7c, 0x70, 0xc0, 0xc0 } };
+ this->arr_pat_194[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
// 128:017a
// about message
@@ -87,20 +89,32 @@ void FoolPrologue::run() {
// JMP 0xa68
// JMP 0xa88
// JMP 0xc8a
- // JMP 129:0x4
+ // 128:0c8a
this->sub_129_004();
+ this->var_i32_1a6 = g_zbasic->mem(-1);
+ if (this->var_i16_1aa == 1) {
+ this->sub_130_004();
+ this->var_i32_1a6 = g_zbasic->mem(-1);
+ }
+ // 128:0cb0
+ if (this->var_i16_1aa == 2) {
+ this->sub_131_004();
+ this->var_i32_1a6 = g_zbasic->mem(-1);
+ }
+ // 128:0cc8
+ //g_zbasic->unk4(); // exit command?
}
void FoolPrologue::sub_128_1ba(int16 screen_page) {
// 128:01ba
- this->var_i32_40 = this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_1f4(int16 screen_page) {
// 128:01f4
- this->var_i32_40 = this->arr_i32_41296[screen_page];
- g_toolbox->SetPortBits(*this->var_i32_40);
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ g_toolbox->SetPortBits(this->var_i32_40);
}
void FoolPrologue::sub_128_21e(int16 numTicks) {
@@ -134,13 +148,13 @@ void FoolPrologue::sub_128_2a6(int16 unk1, int16 unk2) {
void FoolPrologue::sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right) {
// 128:02f0
g_toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
- g_toolbox->FillRect(this->arr_i16_41af4, this->arr_i16_194[pattern_id]);
+ g_toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[pattern_id]);
}
void FoolPrologue::sub_128_354(uint16 unk1, uint16 unk2) {
// 128:0354
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenPat(this->arr_i16_194[unk2]);
+ g_toolbox->PenPat(this->arr_pat_194[unk2]);
g_toolbox->PenMode(unk1);
g_toolbox->PenSize(6, 4);
@@ -186,7 +200,7 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_page) {
// 128:050a
- this->var_i32_40 = this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
this->var_i16_5c.left = unk3;
this->var_i16_5c.right = unk2;
if (unk1 == 0) {
@@ -215,14 +229,14 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_
void FoolPrologue::sub_128_610(int16 screen_page) {
// 128:0610
- this->var_i32_40 = this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_64a(int16 unk1) {
// 128:064a
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_i16_194[unk1]);
+ g_toolbox->PenPat(this->arr_pat_194[unk1]);
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -237,7 +251,7 @@ void FoolPrologue::sub_128_64a(int16 unk1) {
void FoolPrologue::sub_128_6e4(int16 screen_page) {
// 128:06e4
- this->var_i32_40 = this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screen_page];
for (int i = 0; i < 0x36; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
@@ -331,23 +345,13 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
}
void FoolPrologue::sub_128_c8a() {
- // 128:0c8a
- this->sub_129_004();
- this->var_i32_1a6 = g_zbasic->mem(-1);
- if (this->var_i16_1aa == 1) {
- this->sub_130_004();
- this->var_i32_1a6 = g_zbasic->mem(-1);
- }
- // 128:0cb0
- if (this->var_i16_1aa == 2) {
- this->sub_131_004();
- this->var_i32_1a6 = g_zbasic->mem(-1);
- }
- // 128:0cc8
- g_zbasic->unk4();
- g_zbasic->20();
- this->arr_i32_194[3] = this->arr_i32_41598;
- this->arr_i32_1b0 = this->arr_i32_41846;
+
+}
+
+void FoolPrologue::sub_128_ccc() {
+ g_zbasic->unk_20();
+ this->var_i32_1ac = &this->arr_i16_41598[0];
+ this->var_i32_1b0 = &this->arr_i16_41846[0];
this->var_i16_1b4 = this->var_i16_18e * 2 + 2;
// 128:0d00
for (int i=1; i < this->var_i16_18e; i++) {
@@ -399,7 +403,7 @@ void FoolPrologue::sub_128_e80() {
if (this->var_ev_22.what == kDiskEvt) {
this->sub_128_ee0();
}
- if ((this->var_i16_30 & 0x80) && (this->var_ev_22.what == kNullEvent)) {
+ if ((this->var_ev_22.modifiers & 0x80) && (this->var_ev_22.what == kNullEvent)) {
break;
}
}
@@ -414,19 +418,20 @@ void FoolPrologue::sub_128_ed2() {
void FoolPrologue::sub_128_ee0() {
// 128:0ee0
// done by using PEEKWORD into fixed offsets of the window pointer
- this->var_i16_1bc = this->var_window_24.port; // +0
- this->var_i16_1be = this->var_window_24.windowKind; // +2
- g_zbasic->unk11(this->var_i16_1be);
+ //this->var_i16_1bc = &this->var_window_24; // +0
+ //this->var_i16_1be = &this->var_window_24; // +2
+ //g_zbasic->unk11(this->var_i16_1be);
}
void FoolPrologue::sub_128_f0a() {
- g_zbasic->199(0x80); // switch CODE resource?
+ // g_zbasic->pushOldCodeResource(0x80); // switch CODE resource?
this->sub_129_004();
}
// Sources:
// QuickDraw types, Inside Macintosh I-201
// QuickDraw global list, Inside Macintosh I-162
+// Memory organization: Inside Macintosh II-19
// QuickDraw globals; offset below the A5 address.
// GrafPtr thePort = 0x00
@@ -451,8 +456,8 @@ void FoolPrologue::sub_129_004() {
// 0x000a: JSR - "PEEKLONG" # current A5
// 0x000e: SUBI.L - 0x72,D0
// 0x0014: JSR - "PEEKWORD" # quickdraw globals,
- this->var_i16_10 = g_engine->_wm->_screenDims.width(); // window width?
- this->var_i16_12 = g_engine->_wm->_screenDims.height(); // window height?
+ this->var_i16_10 = g_engine->_wm._screenDims.width(); // window width?
+ this->var_i16_12 = g_engine->_wm._screenDims.height(); // window height?
// 129:0034
// set left and top offsets based on a drawable area of 512x342
@@ -461,20 +466,16 @@ void FoolPrologue::sub_129_004() {
// 129:0064
g_zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, kWindowDialogOneLine);
- //g_zbasic->coordinate_window();
+ g_zbasic->coordinateWindow();
- this->var_i16_1c = 0;
- this->var_i16_1e = 0;
- this->var_i16_20 = 0;
+ this->var_i16_1c = { 0, 0, 0 };
// code checks Rom85 for presence of 128K ROM before doing next bit
// 129:00a2
if (true) {
- this->var_i16_1c = 0x4e20;
- this->var_i16_1e = 0x4e20;
- this->var_i16_20 = 0x4e20;
- g_toolbox->SetCPixel(0x64, 0x64, &this->var_i16_1c);
- g_toolbox->GetCPixel(0x64, 0x64, &this->var_i16_1c);
+ this->var_i16_1c = { 0x4e20, 0x4e20, 0x4e20 };
+ g_toolbox->SetCPixel(0x64, 0x64, this->var_i16_1c);
+ g_toolbox->GetCPixel(0x64, 0x64, this->var_i16_1c);
}
// 129:00ee
@@ -486,8 +487,8 @@ void FoolPrologue::sub_129_004() {
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
// 129:013a
this->sub_128_2f0(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
- g_toolbox->SetRect(&this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
- g_toolbox->PenPat(this->arr_i32_19c[0]);
+ g_toolbox->SetRect(this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
+ g_toolbox->PenPat(this->arr_pat_194[1]);
g_toolbox->FrameRect(this->arr_i16_1bc);
}
@@ -500,38 +501,38 @@ void FoolPrologue::sub_129_004() {
// 129:01f2
if (this->var_i16_12 == SCREEN_HEIGHT) {
- g_toolbox->SetRect(&this->arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(this->arr_i16_1bc, this->arr_i32_19c);
+ g_toolbox->SetRect(this->arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
} else {
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(this->arr_i16_1bc, this->arr_i32_19c);
+ g_toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
}
// 129:026c
- this->var_i32_32 = this->var_i32_8.portBits;
+ this->var_i32_32 = this->var_i32_8->portBits;
this->var_i16_36 = 0x40;
this->var_i16_38.top = -this->var_i16_16;
this->var_i16_38.left = -this->var_i16_14;
this->var_i16_38.bottom = this->var_i16_16 + SCREEN_HEIGHT;
this->var_i16_38.right = this->var_i16_14 + SCREEN_WIDTH;
this->var_i16_44 = 0x40;
- this->var_i16_46 = 0x0;
- this->var_i16_48 = 0x0;
- this->var_i16_4a = SCREEN_HEIGHT;
- this->var_i16_4c = SCREEN_WIDTH;
+ this->var_i16_46.top = 0x0;
+ this->var_i16_46.left = 0x0;
+ this->var_i16_46.bottom = SCREEN_HEIGHT;
+ this->var_i16_46.right = SCREEN_WIDTH;
this->var_i16_52 = 0x40;
- this->var_i16_54 = 0x0;
- this->var_i16_56 = 0x0;
- this->var_i16_58 = SCREEN_HEIGHT;
- this->var_i16_5a = SCREEN_WIDTH;
+ this->var_i16_54.top = 0x0;
+ this->var_i16_54.left = 0x0;
+ this->var_i16_54.bottom = SCREEN_HEIGHT;
+ this->var_i16_54.right = SCREEN_WIDTH;
this->var_i32_1c0 = g_zbasic->mem(-1);
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_b54);
- g_zbasic->unk6(0x19, 0x64, 0xff, 0x0);
+ g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_41296[0]);
+ g_zbasic->unk_6(0x19, 0x64, 0xff, 0x0);
this->sub_128_2f0(2, 0x46, 0x64, 0xd8, 0x198);
this->sub_128_2f0(1, 0x4b, 0x69, 0xd3, 0x193);
@@ -550,22 +551,28 @@ void FoolPrologue::sub_129_004() {
this->var_str_76 = g_zbasic->str(10);
this->sub_128_2a6(0xcb, 0xfc);
this->sub_128_e58();
- g_zbasic->get_from(0x0, 0x14);
- g_zbasic->194(0, 0, this->arr_i32_b54);
+ g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
this->var_i16_1aa = 0;
} else {
// 129:04a0
this->var_i16_180 = 1;
this->var_i16_1aa = 1;
- this->var_i16_176 = g_zbasic->249(&this->var_i16_180, &this->var_i16_1c4, &this->var_i16_2c4, &this->var_i16_2c8);
- if (g_zbasic->106(Common::U32String(""), &this->var_i16_1c4)) {
+ // 180 == number, possibly file number
+ // 1c4 == string
+ // 2c4 == unused
+ // 2c8 == volume number?
+ this->var_i16_176 = g_zbasic->finderInfo(this->var_i16_180, this->var_i16_1c4, this->var_i32_2c4, this->var_i16_2c8);
+ if (Common::U32String("") != this->var_i16_1c4) {
// 129:04de
// "and now it is time to show the finale" message
this->var_str_76 = g_zbasic->str(12);
- for (int i = 1; i < 0xa; i++) {
+ g_zbasic->bufferFlush(this->var_str_76);
+
+ for (int i = 1; i <= 0xa; i++) {
this->var_str_76 += g_zbasic->chr(i);
+ g_zbasic->bufferFlush(this->var_str_76);
}
// 129:0522
@@ -576,15 +583,14 @@ void FoolPrologue::sub_129_004() {
// 0x0534: LEA - [0x0764],A0
// 0x0538: MOVE.L - A0,-0x8ee(A5)
// 0x053c: SF - 0x8,D0
- g_zbasic->135(1, &this->var_i16_1c4, 0x3fc, this->var_i16_2c8);
+ g_zbasic->openR(1, this->var_i16_1c4, 0x3fc, this->var_i16_2c8);
- // 0x0554: MOVEQ - 0x1,D0
- // 0x0556: MOVE.W - D0,-0x914(A5)
- g_zbasic->163(&this->var_i16_2ce, this->var_i16_2ca);
+ Common::Array<byte> payload = g_zbasic->read(1, this->var_i16_2ca);
+ this->var_i16_2ce = Common::U32String((char *)&payload[0], this->var_i16_2ca, Common::kMacRoman);
g_zbasic->close(1);
// 0x0570: CLR.L - -0x8ee(A5)
- // 128:0582
- if (g_zbasic->103(&this->var_i16_2ce, &this->var_str_76) &&
+ // 129:0582
+ if ((this->var_i16_2ce == this->var_str_76) &&
this->var_i16_2cc == 0) {
this->var_i16_1aa = 2;
} else {
@@ -593,10 +599,10 @@ void FoolPrologue::sub_129_004() {
}
// 129:05a6
- if (this->var_i16_1c + this->var_i16_20 + this->var_i16_1e != 0) {
+ if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_b54);
- g_zbasic->unk6(0x19, 0x64, 0xff, 0x00);
+ g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_41296[0]);
+ g_zbasic->unk_6(0x19, 0x64, 0xff, 0x00);
this->sub_128_2f0(2, 0x64, 0x7e, 0xd8, 0x17a);
this->sub_128_2f0(1, 0x69, 0x83, 0xd3, 0x175);
this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
@@ -608,10 +614,10 @@ void FoolPrologue::sub_129_004() {
this->var_str_76 = g_zbasic->str(14);
this->sub_128_2a6(0x96, 0xfc);
- this->var_str_76 = g_zbasic->(15);
+ this->var_str_76 = g_zbasic->str(15);
// if this is the finale
if (this->var_i16_1aa == 2) {
- this->var_str_76 = g_zbasic->(16);
+ this->var_str_76 = g_zbasic->str(16);
}
this->sub_128_2a6(0xaa, 0xfc);
@@ -619,15 +625,14 @@ void FoolPrologue::sub_129_004() {
this->sub_128_2a6(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
- g_zbasic->get_from(0x0, 0x14);
- g_zbasic->194(0x0, 0x0, this->arr_i32_b54);
+ g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
this->var_i16_1aa = 0;
} else {
// 129:075c
this->sub_128_e80();
}
// 129:0772
- g_zbasic->199(0x81);
+ // g_zbasic->pushOldCodeResource(0x81);
this->sub_130_004();
}
@@ -640,7 +645,7 @@ void FoolPrologue::sub_129_764() {
}
void FoolPrologue::sub_129_772() {
- g_zbasic->unk_199(0x81);
+ // g_zbasic->pushOldCodeResource(0x81);
this->sub_130_004();
}
@@ -657,14 +662,14 @@ void FoolPrologue::sub_130_004() {
this->sub_130_d28();
this->sub_128_1f4(0xb);
this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
- g_zbasic->picture(0x74, 0xaa, 0x00, 0x00, this->glob_i32_2ce);
- g_toolbox->ReleaseResource(*this->glob_i32_2ce);
+ g_zbasic->picture(0x74, 0xaa, -1, 0x00, this->glob_i32_2ce);
+ g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceBIC);
this->var_str_76 = g_zbasic->str(18);
this->sub_128_2a6(0x10d, 0xdd);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
for (int i = 1; i < 5; i++) {
this->sub_130_cea();
}
@@ -672,18 +677,19 @@ void FoolPrologue::sub_130_004() {
// 130:00d6
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x96, 0, this->arr_i32_0[1]);
+ g_zbasic->picture(0, 0x96, -1, 0, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->sub_128_1f4(8);
// 130:011c
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x96, 0, this->arr_i32_0[2]);
+ g_zbasic->picture(0, 0x96, -1, 0, this->arr_i32_0[2]);
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
for (int i = 3; i < 5; i++) {
- g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
+ this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[7]);
}
this->sub_130_cea();
this->sub_128_1f4(0);
@@ -693,7 +699,8 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[6]);
this->sub_130_cea();
- g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
+ this->arr_i32_41296[1].copyFrom(this->arr_i32_41296[0]);
this->sub_128_1f4(1);
// 130:0202
@@ -705,7 +712,7 @@ void FoolPrologue::sub_130_004() {
// 130:0234
this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
g_zbasic->picture(0x5a, 0x2e, -1, 0, this->arr_i32_0[8]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[8]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[8]);
// 130:0276
for (int j = 9; j < 0xb; j++) {
@@ -719,8 +726,8 @@ void FoolPrologue::sub_130_004() {
// 130:029a
this->sub_128_1f4(j - 6);
- g_zbasic->picture(0, 0, 0, this->arr_i32_0[j]);
- g_zbasic->picture(this->var_i16_74, 0x96, 0, this->arr_i32_0[j - 6]);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[j]);
+ g_zbasic->picture(this->var_i16_74, 0x96, -1, 0, this->arr_i32_0[j - 6]);
g_toolbox->ReleaseResource(this->arr_i32_0[j]);
g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
@@ -728,7 +735,7 @@ void FoolPrologue::sub_130_004() {
// 130:0320
this->sub_128_1f4(6);
- g_zbasic->picture(0, 0, 0, this->arr_i32_0[0xc]);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0xc]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
// 130:034a
@@ -736,8 +743,8 @@ void FoolPrologue::sub_130_004() {
this->sub_130_cea();
}
- this->arr_i32_120[0] = g_toolbox->GetPicture(0x48);
- g_toolbox->SetPortBits(&*this->var_i32_32);
+ this->arr_i32_0[0x48] = g_toolbox->GetPicture(0x48);
+ g_toolbox->SetPortBits(this->var_i32_32);
// 130:0380
if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
@@ -768,27 +775,27 @@ void FoolPrologue::sub_130_004() {
// 130:04ca
for (int j = 0; j < 3; j++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_412b2[1];
+ this->var_i32_40 = &this->arr_i32_41296[8];
// 130:049e
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(4);
this->var_i16_192 = 0;
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[3];
+ this->var_i32_40 = &this->arr_i32_41296[3];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
// 130:0518
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[4];
+ this->var_i32_40 = &this->arr_i32_41296[4];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[5];
+ this->var_i32_40 = &this->arr_i32_41296[5];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
}
// 130:05b6
- this->var_i32_40 = this->arr_i32_41296[7];
+ this->var_i32_40 = &this->arr_i32_41296[7];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
}
@@ -798,7 +805,7 @@ void FoolPrologue::sub_130_004() {
this->sub_130_db0();
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_a8c(0xb4);
- this->var_i32_40 = this->arr_i32_41296[1];
+ this->var_i32_40 = &this->arr_i32_41296[1];
// 130:062c
int y = 0;
@@ -813,7 +820,7 @@ void FoolPrologue::sub_130_004() {
this->var_i16_5c.top = this->arr_i16_412ea[y] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[y];
// 130:068e
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_5c, this->arr_i32_5c, 0, 0);
+ g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
}
// 130:06b0
this->sub_128_a8c(1);
@@ -843,7 +850,7 @@ void FoolPrologue::sub_130_004() {
for (int j = 0; j < 8; j++) {
for (int i = 3; i < 5; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[i];
+ this->var_i32_40 = &this->arr_i32_41296[i];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(3);
}
@@ -856,37 +863,38 @@ void FoolPrologue::sub_130_004() {
this->sub_128_24a(1);
}
// 130:083c
- g_zbasic->picture(0, 0, 0, this->arr_i32_0[0xd]);
- g_zbasic->picture(5, 0, 0, this->arr_i32_0[0xe]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[0xd]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[0xe]);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0xd]);
+ g_zbasic->picture(5, 0, -1, 0, this->arr_i32_0[0xe]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0xd]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0xe]);
this->var_i32_2 = g_toolbox->TickCount();
// 130:0890
- g_zbasic->52(0);
+ // g_zbasic->52(0);
this->sub_128_1f4(0);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x17, 0, this->arr_i32_0[0xf]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[0xf]);
+ g_zbasic->picture(0, 0x17, -1, 0, this->arr_i32_0[0xf]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->sub_130_f48();
this->sub_128_de2();
this->sub_128_1f4(1);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0xf0, 0xba, 0, this->arr_i32_0[0x10]);
- g_toolbox->ReleaseResource(*this->arr_i32_0[0x10]);
+ g_zbasic->picture(0xf0, 0xba, -1, 0, this->arr_i32_0[0x10]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->sub_130_f48();
this->sub_128_de2();
// 130:0934
for (int i = 2; i < 5; i++) {
- g_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
+ this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[1]);
}
// 130:0978
for (int i = 1; i < 5; i++) {
this->sub_128_1f4(i);
- g_toolbox->PenPat(this->arr_i32_19c);
+ g_toolbox->PenPat(this->arr_pat_194[1]);
g_toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
g_toolbox->FrameOval(this->arr_i16_1bc);
- g_toolbox->PenPat(this->arr_i16_1b4);
+ g_toolbox->PenPat(this->arr_pat_194[4]);
// 130:09d0
g_toolbox->InsetRect(this->arr_i16_1bc, -i, -i);
for (int j = 2; j < 0xd; j++) {
@@ -897,20 +905,22 @@ void FoolPrologue::sub_130_004() {
// 130:0a42
this->sub_128_1f4(6);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0x166, 0x77, 0, this->arr_i32_0[0x11]);
+ g_zbasic->picture(0x166, 0x77, -1, 0, this->arr_i32_0[0x11]);
this->sub_128_de2();
- g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
+ this->arr_i32_41296[7].copyFrom(this->arr_i32_41296[6]);
this->sub_130_f48();
g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->sub_128_1f4(7);
// 130:0ac2
- g_zbasic->picture(-0x14, -0x1e, 0, this->arr_i32_0[0x12]);
+ g_zbasic->picture(-0x14, -0x1e, -1, 0, this->arr_i32_0[0x12]);
this->sub_128_1f4(8);
- g_zbasic->blockMove(this->arr_i32_41296[7], *this->arr_i32_41296[8], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
+ this->arr_i32_41296[8].copyFrom(this->arr_i32_41296[7]);
this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
- g_zbasic->picture(0x16d, 0x80, 0, this->arr_i32_120);
- g_toolbox->ReleaseResource(*this->arr_i32_120);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_zbasic->picture(0x16d, 0x80, -1, 0, this->arr_i32_0[0x48]);
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
+ g_toolbox->SetPortBits(this->var_i32_32);
// 130:0b74
this->sub_128_24a(0xd2);
this->sub_128_e80();
@@ -969,7 +979,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_354(8, 1);
// 130:0ce6
// JMP 1002
- g_zbasic->199(0x82);
+ // g_zbasic->pushOldCodeResource(0x82);
this->sub_131_004();
}
@@ -998,7 +1008,7 @@ void FoolPrologue::sub_130_d28() {
void FoolPrologue::sub_130_db0() {
// 130:0db0
- g_zbasic->20();
+ g_zbasic->unk_20();
g_toolbox->PenMode(0xa);
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
@@ -1020,7 +1030,7 @@ void FoolPrologue::sub_130_e82() {
// 130:0ec0
g_toolbox->LineTo(
this->arr_i16_1e8[this->var_i16_6] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
- this->arr_i16_1e8[this->var_i16_6 + 0xfb] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
+ this->arr_i16_1e8[this->var_i16_6 + 0xfb] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6]
);
}
@@ -1050,10 +1060,10 @@ void FoolPrologue::sub_130_f48() {
void FoolPrologue::sub_130_1002() {
// 130:1002
- g_zbasic->199(0x82);
+ // g_zbasic->pushOldCodeResource(0x82);
this->sub_131_004();
}
-/*
+
// run finale
void FoolPrologue::sub_131_004() {
// 131:0004
@@ -1086,13 +1096,13 @@ void FoolPrologue::sub_131_004() {
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
// 131:0110
if (i < 8) {
- g_zbasic->picture(0, 0x3, -1, 0, this->arr_i32_64);
+ g_zbasic->picture(0, 0x3, -1, 0, this->arr_i32_0[0x19]);
}
if (i == 8) {
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_68);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x1a]);
}
if (i == 9) {
- g_zbasic->picture(0x60, 0x4c, -1, 0, this->arr_i32_6c);
+ g_zbasic->picture(0x60, 0x4c, -1, 0, this->arr_i32_0[0x1b]);
}
}
// 131:0184
@@ -1100,10 +1110,10 @@ void FoolPrologue::sub_131_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[i]);
}
// 131:01aa
- this->arr_i32_4c = g_toolbox->GetPicture(0x13);
+ this->arr_i32_0[0x13] = g_toolbox->GetPicture(0x13);
this->sub_128_1f4(0x5);
- g_zbasic->picture(0, 0xb4, -1, 0, this->arr_i32_4c);
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_60);
+ g_zbasic->picture(0, 0xb4, -1, 0, this->arr_i32_0[0x13]);
+ g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x18]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x13]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x18]);
this->sub_131_4e98();
@@ -1121,7 +1131,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_18e = SCREEN_HEIGHT;
this->sub_128_ccc();
this->var_i32_1a6 = g_zbasic->mem(-1);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
this->sub_128_2f0(0x1, 0, 0, 0x14, 0x1fc);
@@ -1135,7 +1145,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_6e4(0x5);
this->sub_128_e58();
this->sub_131_4e98();
- g_zbasic->52(0x4c);
+ // g_zbasic->52(0x4c);
for (int j = 1; j < 0xe; j++) {
this->var_i16_3da = 1;
@@ -1145,7 +1155,7 @@ void FoolPrologue::sub_131_004() {
// 131:031a
this->arr_i16_1e8[i] = g_zbasic->readInt();
this->arr_i16_1e8[i + 0xfb] = g_zbasic->readInt();
- this->arr_i16_1e8[i + 0x1f6] = g_zbasic->read_int();
+ this->arr_i16_1e8[i + 0x1f6] = g_zbasic->readInt();
}
// 131:0380
@@ -1189,14 +1199,14 @@ void FoolPrologue::sub_131_004() {
// 131:04da
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[5];
+ this->var_i32_40 = &this->arr_i32_41296[5];
g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
- this->sub_128_2f0(0);
+ this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_131_4e48();
// 131:0538
g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
- g_toolbox->SetPortBits(*this->var_i32_4e);
+ g_toolbox->SetPortBits(this->var_i32_4e);
// 131:0554
this->sub_128_2f0(0, 0, 0x9c, 0x15a, 0);
@@ -1214,7 +1224,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
// 131:0630
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
g_zbasic->get(0x1bc, 0xc1, 0x1ee, 0x117, this->arr_i32_3bca4);
this->sub_128_24a(0x3c);
this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
@@ -1229,7 +1239,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_50a(0x9, 0, 0x1fc, 1);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
- g_zbasic->20();
+ g_zbasic->unk_20();
// 131:0730
this->var_i16_3dc = 0;
@@ -1267,7 +1277,7 @@ void FoolPrologue::sub_131_004() {
// 131:0926
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenPat(this->arr_i32_194[3]);
+ g_toolbox->PenPat(this->arr_pat_194[3]);
g_zbasic->picture(0x6d, 0x49, -1, 0, this->arr_i32_0[0x1c]);
g_zbasic->picture(0x65, 0x48, -1, 0, this->arr_i32_0[0x1d]);
g_zbasic->picture(0x64, 0x54, -1, 0, this->arr_i32_0[0x1e]);
@@ -1276,7 +1286,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->PaintPoly(this->var_i32_3d6);
for (int i = 0; i < 0x21; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InverRect(this->arr_i16_1bc);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_24a(1);
}
@@ -1291,9 +1301,8 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
- g_zbasic->194(0, this->arr_i32_3bca4, 0);
- g_toolbox->InverRect(this->arr_i16_1bc);
+ g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4);
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_24a(1);
}
@@ -1304,20 +1313,19 @@ void FoolPrologue::sub_131_004() {
while (g_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_16192 + 0x5a, this->arr_i32_3bca4);
+ g_zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_i16_192 + 0x5a, this->arr_i32_3bca4);
// 131:0b54
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->get_from(this->var_i16_74, this->var_i16_192);
- g_zbasic->194(0, this->arr_i32_3bca4, 0);
+ g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4);
}
// 131:0bb0
this->sub_128_50a(4, 0, 0x1fc, 3);
this->sub_128_1ba(5);
g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_21e(0x3c);
g_zbasic->picture(0x197, 0x101, -1, 0, this->arr_i32_0[0x26]);
@@ -1330,7 +1338,8 @@ void FoolPrologue::sub_131_004() {
// 131:0c6c
for (int i = 0x6; i < 0xa; i++) {
- g_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
+ //g_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
+ this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[5]);
}
this->sub_128_1f4(0x6);
g_zbasic->picture(0x6, 0x8f, -1, 0, this->arr_i32_0[0x20]);
@@ -1347,7 +1356,7 @@ void FoolPrologue::sub_131_004() {
for (int i = 0x20; i < 0x23; i++) {
g_toolbox->ReleaseResource(this->arr_i32_0[i]);
}
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0x64);
g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
@@ -1365,7 +1374,8 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
// 131:0e76
- g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
+ this->arr_i32_41296[5].copyFrom(this->arr_i32_41296[4]);
this->sub_128_1f4(0x5);
g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_0[0x24]);
g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_0[0x27]);
@@ -1376,10 +1386,12 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1f4(0x7);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_0[0x2a]);
- g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
+ this->arr_i32_41296[8].copyFrom(this->arr_i32_41296[5]);
this->sub_128_1f4(0x8);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
- g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
+ this->arr_i32_41296[9].copyFrom(this->arr_i32_41296[4]);
this->sub_128_1f4(0x9);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
this->sub_128_1f4(0xa);
@@ -1388,7 +1400,7 @@ void FoolPrologue::sub_131_004() {
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0x78);
this->sub_128_2f0(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
@@ -1404,12 +1416,13 @@ void FoolPrologue::sub_131_004() {
for (int i = 0xdc; i > 0x19; i -= 5) {
// 131:10de
this->var_i32_2 = g_toolbox->TickCount();
- g_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
+ this->var_i32_4e->copyFrom(this->arr_i32_41296[5]);
this->var_i16_64.top = i;
this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
- this->var_i32_40 = this->arr_i32_41296[6];
+ this->var_i32_40 = &this->arr_i32_41296[6];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
- this->var_i32_40 = this->arr_i32_41296[7];
+ this->var_i32_40 = &this->arr_i32_41296[7];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
this->sub_128_24a(0x2);
g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
@@ -1420,7 +1433,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1f4(0x5);
this->sub_128_2f0(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
g_toolbox->PenSize(0x5, 0x5);
@@ -1455,7 +1468,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x2f]);
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0xa);
this->var_i16_5c.left = 0x18b;
this->var_i16_5c.right = 0x1ef;
@@ -1494,11 +1507,12 @@ void FoolPrologue::sub_131_004() {
this->var_i16_3e0 = 0x64;
// 131:14d8
- this->var_i32_40 = this->arr_i32_41296[5];
- g_toolbox->SetPortBits(*this->var_i32_4e);
+ this->var_i32_40 = &this->arr_i32_41296[5];
+ g_toolbox->SetPortBits(this->var_i32_4e);
for (int i = 1; i < 0xf; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
+ //g_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
+ this->var_i32_4e->copyFrom(this->arr_i32_41296[6]);
this->var_i16_3e0 += 5 + i*2;
this->var_i16_64.left = 0x1e0;
this->var_i16_64.right = this->var_i16_64.left + 0x32;
@@ -1512,7 +1526,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
}
- g_toolbox->SetPortBits(*this->var_i32_32);
+ g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
for (int j = 0; j < 1; j++) {
@@ -1547,5 +1561,73 @@ void FoolPrologue::sub_131_004() {
// 131:17c8
// ...
}
-*/
+
+void FoolPrologue::sub_131_4dc0() {
+ // 131:4dc0
+ g_toolbox->SetPort(this->var_i32_c);
+ g_zbasic->text(0, 0xc, kFacePlain, kModeSourceOR);
+ // Loading Finale
+ this->var_str_76 += g_zbasic->str(78);
+ this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
+ g_zbasic->bufferFlush(this->var_str_76);
+ // 131:4e08
+ this->sub_128_2f0(0, 7, 0x13, this->var_i16_10 - 7, 0);
+
+ this->sub_128_2a6(this->var_i16_10 / 2, 0xe);
+ g_toolbox->SetPort(this->var_i32_8);
+}
+
+void FoolPrologue::sub_131_4e48() {
+ // 131:4e48
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
+
+ // Uh oh . . .
+ this->var_str_76 += Common::U32String::format("\"%s\"", g_zbasic->str(80).c_str());
+ g_zbasic->bufferFlush(this->var_str_76);
+
+ this->sub_128_a6c(0x1aa, 0xb4);
+}
+
+void FoolPrologue::sub_131_4e98() {
+ // 131:4e98
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceXOR);
+ this->var_i16_3fc = 0xa0;
+ // "And so the fool heeded the advice of the magician..."
+ this->var_str_76 += g_zbasic->str(81);
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_a6c(0x92, this->var_i16_3fc);
+
+ this->var_str_76 += g_zbasic->str(82);
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_a6c(0x9c, this->var_i16_3fc + 0xf);
+
+ this->var_str_76 += g_zbasic->str(83);
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_a6c(0xa6, this->var_i16_3fc + 0x1e);
+
+ this->var_str_76 += g_zbasic->str(84);
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_a6c(0xc4, this->var_i16_3fc + 0x2d);
+
+ this->var_str_76 += g_zbasic->str(85);
+ g_zbasic->bufferFlush(this->var_str_76);
+ this->sub_128_a6c(0xe2, this->var_i16_3fc + 0x3c);
+
+ this->sub_128_de2();
+}
+
+void FoolPrologue::sub_131_4f96() {
+ // 131:4f96
+ g_toolbox->MoveTo(
+ this->arr_i16_1e8[this->var_i16_74],
+ this->arr_i16_1e8[this->var_i16_74+0xfb]
+ );
+
+ // 131:4fd4
+ g_toolbox->LineTo(
+ this->arr_i16_1e8[this->var_i16_74] + this->arr_i16_1e8[this->var_i16_74+0x1f6],
+ this->arr_i16_1e8[this->var_i16_74+0xfb]
+ );
+}
+
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 46f7b3e8d7a..00add8b7341 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -53,6 +53,7 @@ public:
void sub_128_a6c(int16_t unk1, int16_t unk2);
void sub_128_a8c(int16_t unk);
void sub_128_c8a();
+ void sub_128_ccc();
void sub_128_de2();
void sub_128_e1c();
void sub_128_e58();
@@ -67,6 +68,7 @@ public:
void sub_130_004();
void sub_130_cea();
+ void sub_130_d28();
void sub_130_db0();
void sub_130_e82();
void sub_130_f48();
@@ -74,6 +76,11 @@ public:
void sub_131_004();
+ void sub_131_4dc0();
+ void sub_131_4e48();
+ void sub_131_4e98();
+ void sub_131_4f96();
+
private:
// last tick count
uint32 var_i32_2;
@@ -85,41 +92,77 @@ private:
int16 var_i16_12;
int16 var_i16_14;
int16 var_i16_16;
- int16 var_i16_1c;
- int16 var_i16_1e;
- int16 var_i16_20;
+ RGBColor var_i16_1c;
EventRecord var_ev_22;
+ WindowRecord var_window_24;
+
Graphics::Surface *var_i32_32;
- Common::Rect var_i16_38;
+ int16 var_i16_36;
+ Common::Rect var_i16_38;
Graphics::Surface *var_i32_40;
+ int16 var_i16_44;
+ Common::Rect var_i16_46;
+ Graphics::Surface *var_i32_4e;
- byte *var_i32_4e;
+ int16 var_i16_52;
+ Common::Rect var_i16_54;
Common::Rect var_i16_5c;
Common::Rect var_i16_64;
Common::Rect var_i16_6c;
- // 1 for prologue, 2 for finale
- int16 var_i16_1aa;
+ int16 var_i16_74;
+
+ Common::U32String var_str_76;
+ int16 var_i16_176;
+ int16 var_i16_180;
int32 var_i32_182;
int16 var_i16_18c;
int16 var_i16_18e;
+ int16 var_i16_192;
+
int16 var_i16_1a4;
uint32 var_i32_1a6;
+ // 1 for prologue, 2 for finale
+ int16 var_i16_1aa;
+ int16 *var_i32_1ac;
+ int16 *var_i32_1b0;
+
+ int16 var_i16_1b4;
+ int16 var_i16_1b6;
int16 var_i16_1b8;
int16 var_i16_1ba;
+
+ uint32 var_i32_1c0;
+
+ Common::U32String var_i16_1c4;
+
+ uint32 var_i32_2c4;
+ int16 var_i16_2c8;
+ int16 var_i16_2ca;
+ int16 var_i16_2cc;
+ Common::U32String var_i16_2ce;
+
+ int16 var_i16_3ce;
+ int16 var_i16_3d2;
+ int16 var_i16_3d4;
+ PolyHandle var_i32_3d6;
+ int16 var_i16_3da;
+ int16 var_i16_3dc;
int16 var_i16_3e0;
+ int16 var_i16_3fc;
+
// picture resource handles
- Handle arr_i32_0[0x30] = { 0 };
+ Handle arr_i32_0[92] = { 0 };
- Pattern arr_i16_194[5];
+ Pattern arr_pat_194[5];
Common::Rect arr_i16_1bc;
@@ -132,9 +175,13 @@ private:
byte arr_i32_b54[SCREEN_PAGE_SIZE*12];
- byte *arr_i32_41296[12];
+ Graphics::Surface arr_i32_3bca4;
+
+ Graphics::Surface arr_i32_41296[12];
int16 arr_i16_412ea[SCREEN_HEIGHT];
+ int16 arr_i16_41598[SCREEN_HEIGHT];
+ int16 arr_i16_41846[SCREEN_HEIGHT];
Common::Rect arr_i16_41af4;
Common::Rect arr_i16_41afc;
@@ -142,7 +189,7 @@ private:
double arr_f64_41bbe[8] = { 0 };
- Common::U32String var_str_76;
+ PicHandle glob_i32_2ce;
void run();
};
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 73c356f4c72..27cedd517e5 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -128,7 +128,7 @@ public:
// entire content region, though it suffices to draw only the visRgn; in either case, only the parts of
// the window that require updating will actually be drawn on the screen. Every call to
// BeginUpdate must be balanced by a call to EndUpdate.
- void BeginUpdate(Graphics::MacWindow &theWindow);
+ void BeginUpdate(WindowRecord &theWindow);
// PROCEDURE ClearMenuBar;
// Call ClearMenuBar to remove all menus from the menu list when you want to start afresh with all
@@ -183,7 +183,7 @@ public:
// PROCEDURE EndUpdate (theWindow: WindowPtr);
// Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
// BeginUpdate as described above.
- void EndUpdate(Graphics::MacWindow &theWindow);
+ void EndUpdate(WindowRecord &theWindow);
// PROCEDURE FillOval (r: Rect; pat: Pattern);
// FillOval fills an oval just inside the specified rectangle with the given pattern (in patCopy mode).
@@ -296,6 +296,7 @@ public:
// definition; the pen mode, pattern, and size do not affect it. In fact, OpenPoly calls HidePen, so
// no drawing occurs on the screen while the polygon is open (unless you call ShowPen just after
// OpenPoly, or you called ShowPen previously without balancing it by a call to HidePen).
+ PolyHandle OpenPoly();
// PROCEDURE OpenPort (port: GrafPtr);
// OpenPort allocates space for the given grafPort's visRgn and clipRgn, initializes the fields of the
@@ -315,6 +316,7 @@ public:
// PaintPoly paints the specified polygon with the current grafPort's pen pattern and pen mode. The
// polygon is filled with the pnPat, according to the pattern transfer mode specified by pnMode.
// The pen location is not changed by this procedure.
+ void PaintPoly(PolyHandle poly);
// PROCEDURE PaintRect (r: Rect);
// PaintRect paints the specified rectangle with the current grafPoit's pen pattern and mode. The
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index de24017c49b..a9e0ac77e53 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -20,9 +20,9 @@
*/
#include "common/macresman.h"
-
#include "common/str-enc.h"
#include "common/stream.h"
+
#include "fool/fool.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
@@ -148,7 +148,7 @@ int16 ZBasic::readInt() {
ZBasicDatum &el = _dataTable[_dataPtr];
_dataPtr++;
if (el.type != kDatumINT) {
- warning("ZBasic::readInt: entry %d was unexpected type %d", el.type);
+ warning("ZBasic::readInt: entry %d was unexpected type %d", _dataPtr-1, el.type);
return 0;
}
return el.data.i16;
@@ -163,7 +163,7 @@ Common::U32String ZBasic::readStr() {
ZBasicDatum &el = _dataTable[_dataPtr];
_dataPtr++;
if (el.type != kDatumSTR) {
- warning("ZBasic::readStr: entry %d was unexpected type %d", el.type);
+ warning("ZBasic::readStr: entry %d was unexpected type %d", _dataPtr-1, el.type);
return result;
}
result = *el.data.str;
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 9f446e91b37..634bedb3609 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -233,11 +233,20 @@ public:
void blockMove(void *srcptr, void *destptr, uint16 size) {
memmove(destptr, srcptr, size);
}
+ Common::U32String chr(uint16 code) {
+ return Common::U32String(code, Common::kMacRoman);
+ }
+ void close(int16 fileNo);
+ void coordinateWindow();
void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
+ int finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume);
bool maybe();
uint32 mem(int16 index);
+ void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
+ void put(int16 x, int16 y, Graphics::Surface &src);
void put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src);
+ Common::Array<byte> read(int16 fileNo, uint32 length);
void text(int16 font, int16 size, int16 face, ZBasicTextMode mode);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
int16 rndInt(int16 max);
@@ -250,6 +259,10 @@ public:
int16 readInt();
Common::U32String readStr();
+ void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
+ void unk_20();
+ void unk_130(int16 unk1);
+
};
} // namespace Fool
Commit: 6bf2e3f7ef421b0d1bcf487ea44cb31579ad612d
https://github.com/scummvm/scummvm/commit/6bf2e3f7ef421b0d1bcf487ea44cb31579ad612d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:46+02:00
Commit Message:
FOOL: Stub out everything
Changed paths:
R engines/fool/events.cpp
R engines/fool/events.h
R engines/fool/metaengine.h
R engines/fool/view1.cpp
R engines/fool/view1.h
R engines/fool/views.h
engines/fool/detection.h
engines/fool/detection_tables.h
engines/fool/fool.cpp
engines/fool/fool.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/metaengine.cpp
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/detection.h b/engines/fool/detection.h
index 9ff81e8aa4f..89959fb45c2 100644
--- a/engines/fool/detection.h
+++ b/engines/fool/detection.h
@@ -26,6 +26,12 @@
namespace Fool {
+struct FOOLGameDescription {
+ AD_GAME_DESCRIPTION_HELPERS(desc);
+
+ ADGameDescription desc;
+};
+
enum FoolDebugChannels {
kDebugGraphics = 1 << 0,
kDebugPath = 1 << 1,
diff --git a/engines/fool/detection_tables.h b/engines/fool/detection_tables.h
index 4d2c70a11d9..b91be070857 100644
--- a/engines/fool/detection_tables.h
+++ b/engines/fool/detection_tables.h
@@ -46,7 +46,7 @@ const ADGameDescription gameDescriptions[] = {
{
"fool",
"v2.0",
- AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
+ AD_ENTRY1s("The Fool's Errand", "rt:7319cc059fde4535a196a744761b293f", 178663),
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
diff --git a/engines/fool/events.cpp b/engines/fool/events.cpp
deleted file mode 100644
index 62eae35d908..00000000000
--- a/engines/fool/events.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/* 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/config-manager.h"
-#include "graphics/screen.h"
-#include "fool/events.h"
-#include "fool/fool.h"
-#include "fool/views.h"
-
-namespace Fool {
-
-Events *g_events;
-
-Events::Events() : UIElement("Root", nullptr) {
- g_events = this;
-}
-
-Events::~Events() {
- g_events = nullptr;
-}
-
-void Events::runGame() {
- uint currTime, nextFrameTime = 0;
- _screen = new Graphics::Screen();
- Views views; // Loads all views in the structure
-
- // Run the game
- int saveSlot = ConfMan.getInt("save_slot");
- if (saveSlot != -1)
- g_engine->loadGameState(saveSlot);
-
- addView("View1");
-
- Common::Event e;
- while (!_views.empty() && !shouldQuit()) {
- while (g_system->getEventManager()->pollEvent(e)) {
- if (e.type == Common::EVENT_QUIT ||
- e.type == Common::EVENT_RETURN_TO_LAUNCHER) {
- _views.clear();
- break;
- } else {
- processEvent(e);
- }
- }
-
- if (_views.empty())
- break;
-
- g_system->delayMillis(10);
- if ((currTime = g_system->getMillis()) >= nextFrameTime) {
- nextFrameTime = currTime + FRAME_DELAY;
- tick();
- drawElements();
- _screen->update();
- }
- }
-
- delete _screen;
-}
-
-void Events::processEvent(Common::Event &ev) {
- switch (ev.type) {
- case Common::EVENT_KEYDOWN:
- if (ev.kbd.keycode < Common::KEYCODE_NUMLOCK)
- msgKeypress(KeypressMessage(ev.kbd));
- break;
- case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
- msgAction(ActionMessage(ev.customType));
- break;
- case Common::EVENT_LBUTTONDOWN:
- case Common::EVENT_RBUTTONDOWN:
- //case Common::EVENT_MBUTTONDOWN:
- msgMouseDown(MouseDownMessage(ev.type, ev.mouse));
- break;
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONUP:
- //case Common::EVENT_MBUTTONUP:
- msgMouseUp(MouseUpMessage(ev.type, ev.mouse));
- break;
- default:
- break;
- }
-}
-
-void Events::replaceView(UIElement *ui, bool replaceAllViews) {
- assert(ui);
- UIElement *priorView = focusedView();
-
- if (replaceAllViews) {
- clearViews();
-
- } else if (!_views.empty()) {
- priorView->msgUnfocus(UnfocusMessage());
- _views.pop();
- }
-
- _views.push(ui);
- ui->redraw();
- ui->msgFocus(FocusMessage(priorView));
-}
-
-void Events::replaceView(const Common::String &name, bool replaceAllViews) {
- replaceView(findView(name));
-}
-
-void Events::addView(UIElement *ui) {
- assert(ui);
- UIElement *priorView = focusedView();
-
- if (!_views.empty())
- priorView->msgUnfocus(UnfocusMessage());
-
- _views.push(ui);
- ui->redraw();
- ui->msgFocus(FocusMessage(priorView));
-}
-
-void Events::addView(const Common::String &name) {
- addView(findView(name));
-}
-
-void Events::popView() {
- UIElement *priorView = focusedView();
- priorView->msgUnfocus(UnfocusMessage());
- _views.pop();
-
- for (int i = 0; i < (int)_views.size() - 1; ++i) {
- _views[i]->redraw();
- _views[i]->draw();
- }
-
- if (!_views.empty()) {
- UIElement *view = focusedView();
- view->msgFocus(FocusMessage(priorView));
- view->redraw();
- view->draw();
- }
-}
-
-void Events::redrawViews() {
- for (uint i = 0; i < _views.size(); ++i) {
- _views[i]->redraw();
- _views[i]->draw();
- }
-}
-
-bool Events::isPresent(const Common::String &name) const {
- for (uint i = 0; i < _views.size(); ++i) {
- if (_views[i]->_name == name)
- return true;
- }
-
- return false;
-}
-
-void Events::clearViews() {
- if (!_views.empty())
- focusedView()->msgUnfocus(UnfocusMessage());
-
- _views.clear();
-}
-
-void Events::addKeypress(const Common::KeyCode kc) {
- Common::KeyState ks;
- ks.keycode = kc;
- if (kc >= Common::KEYCODE_SPACE && kc <= Common::KEYCODE_TILDE)
- ks.ascii = kc;
-
- focusedView()->msgKeypress(KeypressMessage(ks));
-}
-
-/*------------------------------------------------------------------------*/
-
-Bounds::Bounds(Common::Rect &innerBounds) :
- _bounds(0, 0, 320, 200),
- _innerBounds(innerBounds),
- left(_bounds.left), top(_bounds.top),
- right(_bounds.right), bottom(_bounds.bottom) {
-}
-
-Bounds &Bounds::operator=(const Common::Rect &r) {
- _bounds = r;
- _innerBounds = r;
- _innerBounds.grow(-_borderSize);
- return *this;
-}
-
-void Bounds::setBorderSize(size_t borderSize) {
- _borderSize = borderSize;
- _innerBounds = *this;
- _innerBounds.grow(-_borderSize);
-}
-
-/*------------------------------------------------------------------------*/
-
-UIElement::UIElement(const Common::String &name) :
- _name(name), _parent(g_engine), _bounds(_innerBounds) {
- g_engine->_children.push_back(this);
-}
-
-UIElement::UIElement(const Common::String &name, UIElement *uiParent) :
- _name(name), _parent(uiParent),
- _bounds(_innerBounds) {
- if (_parent)
- _parent->_children.push_back(this);
-}
-
-void UIElement::redraw() {
- _needsRedraw = true;
-
- for (size_t i = 0; i < _children.size(); ++i)
- _children[i]->redraw();
-}
-
-void UIElement::drawElements() {
- if (_needsRedraw) {
- draw();
- _needsRedraw = false;
- }
-
- for (size_t i = 0; i < _children.size(); ++i)
- _children[i]->drawElements();
-}
-
-UIElement *UIElement::findViewGlobally(const Common::String &name) {
- return g_events->findView(name);
-}
-
-void UIElement::focus() {
- g_events->replaceView(this);
-}
-
-void UIElement::close() {
- assert(g_events->focusedView() == this);
- g_events->popView();
-}
-
-bool UIElement::isFocused() const {
- return g_events->focusedView() == this;
-}
-
-void UIElement::clearSurface() {
- Graphics::ManagedSurface s = getSurface();
- s.fillRect(Common::Rect(s.w, s.h), 0);
-}
-
-void UIElement::draw() {
- for (size_t i = 0; i < _children.size(); ++i) {
- _children[i]->draw();
- }
-}
-
-bool UIElement::tick() {
- if (_timeoutCtr && --_timeoutCtr == 0) {
- timeout();
- }
-
- for (size_t i = 0; i < _children.size(); ++i) {
- if (_children[i]->tick())
- return true;
- }
-
- return false;
-}
-
-UIElement *UIElement::findView(const Common::String &name) {
- if (_name.equalsIgnoreCase(name))
- return this;
-
- UIElement *result;
- for (size_t i = 0; i < _children.size(); ++i) {
- if ((result = _children[i]->findView(name)) != nullptr)
- return result;
- }
-
- return nullptr;
-}
-
-void UIElement::replaceView(UIElement *ui, bool replaceAllViews) {
- g_events->replaceView(ui, replaceAllViews);
-}
-
-void UIElement::replaceView(const Common::String &name, bool replaceAllViews) {
- g_events->replaceView(name, replaceAllViews);
-}
-
-void UIElement::addView(UIElement *ui) {
- g_events->addView(ui);
-}
-
-void UIElement::addView(const Common::String &name) {
- g_events->addView(name);
-}
-
-void UIElement::addView() {
- g_events->addView(this);
-}
-
-Graphics::ManagedSurface UIElement::getSurface() const {
- return Graphics::ManagedSurface(*g_events->getScreen(), _bounds);
-}
-
-int UIElement::getRandomNumber(int minNumber, int maxNumber) {
- return g_engine->getRandomNumber(maxNumber - minNumber + 1) + minNumber;
-}
-
-int UIElement::getRandomNumber(int maxNumber) {
- return g_engine->getRandomNumber(maxNumber);
-}
-
-void UIElement::delaySeconds(uint seconds) {
- _timeoutCtr = seconds * FRAME_RATE;
-}
-
-void UIElement::delayFrames(uint frames) {
- _timeoutCtr = frames;
-}
-
-void UIElement::timeout() {
- redraw();
-}
-
-} // namespace Fool
diff --git a/engines/fool/events.h b/engines/fool/events.h
deleted file mode 100644
index 65e6176eef3..00000000000
--- a/engines/fool/events.h
+++ /dev/null
@@ -1,386 +0,0 @@
-/* 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 FOOL_EVENTS_H
-#define FOOL_EVENTS_H
-
-#include "common/array.h"
-#include "common/stack.h"
-#include "graphics/screen.h"
-#include "fool/messages.h"
-
-namespace Fool {
-
-#define FRAME_RATE 20
-#define FRAME_DELAY (1000 / FRAME_RATE)
-
-class Events;
-
-/**
- * Implements a thunk layer around an element's bounds,
- * allowing access to it as if it were a simple Common::Rect,
- * but any changes to it will also be applied to a linked inner bounds
- */
-struct Bounds {
-private:
- Common::Rect _bounds;
- Common::Rect &_innerBounds;
- int _borderSize = 0;
-public:
- const int16 &left;
- const int16 ⊤
- const int16 &right;
- const int16 ⊥
-public:
- Bounds(Common::Rect &innerBounds);
- operator const Common::Rect &() const { return _bounds; }
- Bounds &operator=(const Common::Rect &r);
- void setBorderSize(size_t borderSize);
- size_t borderSize() const { return _borderSize; }
- int16 width() const { return _bounds.width(); }
- int16 height() const { return _bounds.height(); }
-};
-
-/**
- * User interface element
- */
-class UIElement {
- friend class Events;
-private:
- int _timeoutCtr = 0;
-protected:
- UIElement *_parent;
- Common::Array<UIElement *> _children;
- Common::Rect _innerBounds;
- Bounds _bounds;
- bool _needsRedraw = true;
- Common::String _name;
-protected:
- /**
- * Set a delay countdown in seconds, after which timeout() is called
- */
- void delaySeconds(uint seconds);
-
- /**
- * Set a delay countdown in frames, after which timeout() is called
- */
- void delayFrames(uint frames);
-
- /**
- * Returns true if a delay is active
- */
- bool isDelayActive() const {
- return _timeoutCtr != 0;
- }
-
- /**
- * Cancels any active delay
- */
- void cancelDelay() {
- _timeoutCtr = 0;
- }
-
- /**
- * Called when an active timeout countdown expired
- */
- virtual void timeout();
-
-private:
- /**
- * Outer method for doing drawing
- *
- */
- void drawElements();
-
- /**
- * Finds a view globally
- */
- static UIElement *findViewGlobally(const Common::String &name);
-public:
- UIElement(const Common::String &name, UIElement *uiParent);
- UIElement(const Common::String &name);
- virtual ~UIElement() {}
-
- /**
- * Returns true if the elements needs to be redrawn
- */
- bool needsRedraw() const { return _needsRedraw; }
-
- /**
- * Sets that the element needs to be redrawn
- */
- void redraw();
-
- /**
- * Focuses the element as the current view
- */
- void focus();
-
- /**
- * Closes the current view. The view must have been added
- * via addView, so there's a remaining view afterwards
- */
- virtual void close();
-
- /*
- * Returns true if the view is focused
- */
- bool isFocused() const;
-
- /**
- * Sets the focus to a new view
- */
- void replaceView(UIElement *ui, bool replaceAllViews = false);
- void replaceView(const Common::String &name, bool replaceAllViews = false);
-
- /**
- * Adds a focused view to the view stack without replacing current one
- */
- void addView(UIElement *ui);
- void addView(const Common::String &name);
- void addView();
- void open() { addView(); }
-
- /**
- * Returns a random number
- */
- int getRandomNumber(int minNumber, int maxNumber);
- int getRandomNumber(int maxNumber);
-
- /**
- * Sets the element's bounds
- */
- virtual void setBounds(const Common::Rect &r) {
- _bounds = r;
- }
-
- /**
- * Gets the element's bounds
- */
- Common::Rect getBounds() const {
- return _bounds;
- }
-
- /**
- * Returns a surface for drawing the element
- */
- Graphics::ManagedSurface getSurface() const;
-
- /**
- * Clear the surface
- */
- virtual void clearSurface();
-
- /**
- * Draws the element
- */
- virtual void draw();
-
- /**
- * Called for game frame ticks
- */
- virtual bool tick();
-
- /**
- * Find a view by name
- */
- virtual UIElement *findView(const Common::String &name);
-
- /**
- * Handles events
- */
- #define MESSAGE(NAME) \
- protected: \
- virtual bool msg##NAME(const NAME##Message &e) { \
- for (Common::Array<UIElement *>::iterator it = _children.begin(); \
- it != _children.end(); ++it) { \
- if ((*it)->msg##NAME(e)) return true; \
- } \
- return false; \
- } \
- public: \
- bool send(const Common::String &viewName, const NAME##Message &msg) { \
- UIElement *view = UIElement::findViewGlobally(viewName); \
- assert(view); \
- return view->msg##NAME(msg); \
- } \
- bool send(const NAME##Message &msg) { \
- return send("Root", msg); \
- } \
-
- MESSAGE(Focus);
- MESSAGE(Unfocus);
- MESSAGE(Keypress);
- MESSAGE(MouseDown);
- MESSAGE(MouseUp);
- MESSAGE(Action);
- MESSAGE(Game);
- MESSAGE(Value);
- #undef MESSAGE
-};
-
-/**
- * Main events and view manager. This is kept separate from the engine
- * class because the engine may add a lot of globals and bring in other
- * classes. So to save on compilation time, classes that only need to
- * access basic view management methods like addView or replaceView
- * only need to include events.h rather than the whole engine.
- */
-class Events : public UIElement {
-private:
- Graphics::Screen *_screen = nullptr;
- Common::Stack<UIElement *> _views;
-protected:
- /**
- * Process an event
- */
- void processEvent(Common::Event &ev);
-
- /**
- * Returns true if the game should quit
- */
- virtual bool shouldQuit() const = 0;
-
- /**
- * Overrides events we want to only go to the focused view
- */
- #define MESSAGE(NAME) \
- bool msg##NAME(const NAME##Message &e) override { \
- return !_views.empty() ? focusedView()->msg##NAME(e) : false; \
- }
- MESSAGE(Action);
- MESSAGE(Focus);
- MESSAGE(Unfocus);
- MESSAGE(Keypress);
- MESSAGE(MouseDown);
- MESSAGE(MouseUp);
- #undef MESSAGE
-public:
- Events();
- virtual ~Events();
-
- /**
- * Main game loop
- */
- void runGame();
-
- /**
- * Sets the focus to a new view
- */
- void replaceView(UIElement *ui, bool replaceAllViews = false);
- void replaceView(const Common::String &name, bool replaceAllViews = false);
-
- /**
- * Adds a focused view to the view stack without replacing current one
- */
- void addView(UIElement *ui);
- void addView(const Common::String &name);
-
- /**
- * Clears the view list
- */
- void clearViews();
-
- /**
- * Pops a view from the view stack
- */
- void popView();
-
- /**
- * Redraws the views in order. This is used in rare cases
- * where a view draws outside it's defined area, and needs
- * to restore whether the background was before
- */
- void redrawViews();
-
- /**
- * Returns the currently focused view, if any
- */
- UIElement *focusedView() const {
- return _views.empty() ? nullptr : _views.top();
- }
-
- /**
- * Returns the view prior to the current view, if any
- */
- UIElement *priorView() const {
- return _views.size() < 2 ? nullptr :
- _views[_views.size() - 2];
- }
-
- /**
- * Returns true if a view of a given name is present
- * at all in the visible view stack
- */
- bool isPresent(const Common::String &name) const;
-
- /**
- * Returns true if combat is active
- */
- bool isInCombat() const {
- return isPresent("Combat");
- }
-
- /**
- * Returns the underlying screen
- */
- Graphics::Screen *getScreen() const {
- return _screen;
- }
-
- /**
- * Draws the focused view
- */
- void drawElements() {
- if (!_views.empty())
- focusedView()->drawElements();
- }
-
- /**
- * Add a keypress to the event queue
- */
- void addKeypress(const Common::KeyCode kc);
-
- /**
- * Events manager doesn't have any intrinsic drawing
- */
- void draw() override {}
-
- /**
- * Called once every game frame
- */
- bool tick() override {
- return !_views.empty() ? focusedView()->tick() : false;
- }
-
- /**
- * Calling the close method for g_events closes the active view
- */
- void close() override {
- focusedView()->close();
- }
-};
-
-extern Events *g_events;
-
-} // namespace Fool
-
-#endif
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index 848cabcbda3..d891545e70e 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -28,6 +28,7 @@
#include "graphics/palette.h"
#include "fool/fool.h"
+#include "fool/fool_prologue.h"
#include "fool/detection.h"
#include "fool/console.h"
@@ -35,7 +36,7 @@ namespace Fool {
FoolEngine *g_engine;
-FoolEngine::FoolEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
+FoolEngine::FoolEngine(OSystem *syst, const FOOLGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Fool") {
g_engine = this;
@@ -45,11 +46,11 @@ FoolEngine::~FoolEngine() {
}
uint32 FoolEngine::getFeatures() const {
- return _gameDescription->flags;
+ return _gameDescription->desc.flags;
}
Common::String FoolEngine::getGameId() const {
- return _gameDescription->gameId;
+ return _gameDescription->desc.gameId;
}
Common::Error FoolEngine::run() {
@@ -64,6 +65,9 @@ Common::Error FoolEngine::run() {
// Menu
_menu = _wm.addMenu();
+ FoolPrologue fp;
+ fp.run();
+
return Common::kNoError;
}
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
index c0faf95975c..37b372253e5 100644
--- a/engines/fool/fool.h
+++ b/engines/fool/fool.h
@@ -36,7 +36,6 @@
#include "graphics/screen.h"
#include "fool/detection.h"
-#include "fool/events.h"
#define SCREEN_WIDTH 0x200
#define SCREEN_HEIGHT 0x156
@@ -48,7 +47,7 @@ struct FoolGameDescription;
class FoolEngine : public Engine {
private:
- const ADGameDescription *_gameDescription;
+ const FOOLGameDescription *_gameDescription;
Common::RandomSource _randomSource;
protected:
// Engine APIs
@@ -59,7 +58,7 @@ public:
Graphics::MacWindowManager _wm;
Graphics::MacMenu *_menu;
- FoolEngine(OSystem *syst, const ADGameDescription *gameDesc);
+ FoolEngine(OSystem *syst, const FOOLGameDescription *gameDesc);
~FoolEngine() override;
uint32 getFeatures() const;
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index f60408acd62..5ea92e18cc0 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -34,9 +34,20 @@ ZBasic *g_zbasic;
Toolbox *g_toolbox;
// Based on disassembly of Fool's Errand v2.0.
-// v3.0 had several features removed to improve compatibility with later versions of Mac OS.
+// v3.0 had several features removed to improve compatibility with later versions of Mac OS,
+// and was built with a different ZBASIC compiler.
void FoolPrologue::run() {
+ g_toolbox = new Toolbox();
+ g_zbasic = new ZBasic(g_toolbox);
+ g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
+
+ this->sub_128_004();
+ delete g_zbasic;
+ delete g_toolbox;
+}
+
+void FoolPrologue::sub_128_004() {
// 128:0004
g_zbasic->coordinateWindow();
@@ -46,6 +57,7 @@ void FoolPrologue::run() {
// 128:001e
// b54 must be the 1-bit screen buffer
+ // 41296 is an array of pointers to screen pages within the buffer
for (int i = 0; i < 12; i++) {
//this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
this->arr_i32_41296[i].create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 00add8b7341..f66bf292a03 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -33,9 +33,12 @@ namespace Fool {
class FoolPrologue {
public:
- FoolPrologue();
- ~FoolPrologue();
+ FoolPrologue() {}
+ ~FoolPrologue() {}
+ void run();
+
+ void sub_128_004();
void sub_128_1ba(int16 screen_page);
void sub_128_1f4(int16 screen_page);
void sub_128_21e(int16 numTicks);
@@ -191,7 +194,6 @@ private:
PicHandle glob_i32_2ce;
- void run();
};
} // End of namespace Fool
diff --git a/engines/fool/metaengine.cpp b/engines/fool/metaengine.cpp
index 15127cf711b..4b4d75f8116 100644
--- a/engines/fool/metaengine.cpp
+++ b/engines/fool/metaengine.cpp
@@ -21,7 +21,6 @@
#include "common/translation.h"
-#include "fool/metaengine.h"
#include "fool/detection.h"
#include "fool/fool.h"
@@ -44,6 +43,22 @@ static const ADExtraGuiOptionsMap optionsList[] = {
} // End of namespace Fool
+class FoolMetaEngine : public AdvancedMetaEngine<Fool::FOOLGameDescription> {
+public:
+ const char *getName() const override;
+
+ Common::Error createInstance(OSystem *syst, Engine **engine, const Fool::FOOLGameDescription *desc) const override;
+
+ /**
+ * Determine whether the engine supports the specified MetaEngine feature.
+ *
+ * Used by e.g. the launcher to determine whether to enable the Load button.
+ */
+ bool hasFeature(MetaEngineFeature f) const override;
+
+ const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+};
+
const char *FoolMetaEngine::getName() const {
return "fool";
}
@@ -52,7 +67,7 @@ const ADExtraGuiOptionsMap *FoolMetaEngine::getAdvancedExtraGuiOptions() const {
return Fool::optionsList;
}
-Common::Error FoolMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+Common::Error FoolMetaEngine::createInstance(OSystem *syst, Engine **engine, const Fool::FOOLGameDescription *desc) const {
*engine = new Fool::FoolEngine(syst, desc);
return Common::kNoError;
}
diff --git a/engines/fool/metaengine.h b/engines/fool/metaengine.h
deleted file mode 100644
index 10b87326aab..00000000000
--- a/engines/fool/metaengine.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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 FOOL_METAENGINE_H
-#define FOOL_METAENGINE_H
-
-#include "engines/advancedDetector.h"
-
-class FoolMetaEngine : public AdvancedMetaEngine {
-public:
- const char *getName() const override;
-
- Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
-
- /**
- * Determine whether the engine supports the specified MetaEngine feature.
- *
- * Used by e.g. the launcher to determine whether to enable the Load button.
- */
- bool hasFeature(MetaEngineFeature f) const override;
-
- const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
-};
-
-#endif // FOOL_METAENGINE_H
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 7d7dd20f791..db79e34ffa0 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -6,10 +6,8 @@ MODULE_OBJS = \
toolbox.o \
zbasic.o \
console.o \
- events.o \
messages.o \
- metaengine.o \
- view1.o
+ metaengine.o
# This module can be built as a plugin
ifeq ($(ENABLE_FOOL), DYNAMIC_PLUGIN)
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index d91614ba771..b6a0bb282c6 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -23,7 +23,121 @@
namespace Fool {
+void Toolbox::BeginUpdate(WindowRecord &theWindow) {
+ warning("STUB: Toolbox::BeginUpdate");
+}
+
+void Toolbox::ClearMenuBar() {
+ warning("STUB: Toolbox::ClearMenuBar");
+}
+
+void Toolbox::ClosePoly() {
+ warning("STUB: Toolbox::ClosePoly");
+}
+
+void Toolbox::ClipRect(Common::Rect &r) {
+ warning("STUB: Toolbox::ClipRect");
+}
+
+void Toolbox::CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn) {
+ warning("STUB: Toolbox::CopyBits");
+}
+
+uint16 Toolbox::CurResFile() {
+ warning("STUB: Toolbox::CurResFile");
+ return 0;
+}
+
+uint32 Toolbox::Delay(uint32 numTicks) {
+ warning("STUB: Toolbox::Delay");
+ return 0;
+}
+
+void Toolbox::DrawString(const Common::String &s) {
+ warning("STUB: Toolbox::DrawString");
+}
+
+void Toolbox::EndUpdate(WindowRecord &theWindow) {
+ warning("STUB: Toolbox::EndUpdate");
+}
+
+void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
+ warning("STUB: Toolbox::FillOval");
+}
+
+void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
+ warning("STUB: Toolbox::FillRect");
+}
+
+void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle) {
+ warning("STUB: Toolbox::FrameArc");
+}
+
+void Toolbox::FrameOval(const Common::Rect &r) {
+ warning("STUB: Toolbox::FrameOval");
+}
+
+void Toolbox::FrameRect(const Common::Rect &r) {
+ warning("STUB: Toolbox::FrameRect");
+}
+
+void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
+ warning("STUB: Toolbox::GetCPixel");
+}
+
+bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
+ warning("STUB: Toolbox::GetNextEvent");
+ return false;
+}
+
+PicHandle Toolbox::GetPicture(uint16 picID) {
+ warning("STUB: Toolbox::GetPicture");
+ return 0;
+}
+
+void Toolbox::HideCursor() {
+ warning("STUB: Toolbox::HideCursor");
+}
+
+void Toolbox::InitCursor() {
+ warning("STUB: Toolbox::InitCursor");
+}
+
+void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
+ warning("STUB: Toolbox::InsetRect");
+}
+
+void Toolbox::InvertOval(const Common::Rect &r) {
+ warning("STUB: Toolbox::InvertOval");
+}
+
+void Toolbox::InvertRect(const Common::Rect &r) {
+ warning("STUB: Toolbox::InvertRect");
+}
+
+void Toolbox::KillPoly(PolyHandle poly) {
+ warning("STUB: Toolbox::KillPoly");
+}
+
+void Toolbox::LineTo(int16 h, int16 v) {
+ warning("STUB: Toolbox::LineTo");
+}
+
+void Toolbox::MovePortTo(int16 leftGlobal, int16 topGlobal) {
+ warning("STUB: Toolbox::MovePortTo");
+}
+
+void Toolbox::MoveTo(int16 h, int16 v) {
+ warning("STUB: Toolbox::MoveTo");
+}
+
+PolyHandle Toolbox::OpenPoly() {
+ warning("STUB: Toolbox::OpenPoly");
+ return 0;
+}
+
void Toolbox::OpenPort(GrafPtr port) {
+ warning("STUB: Toolbox::OpenPort");
// source: QuickDraw Routines I-163
port->device = 0;
//port->portBits = screenBits;
@@ -33,5 +147,82 @@ void Toolbox::OpenPort(GrafPtr port) {
//port->bkPat = white
}
+void Toolbox::PaintOval(const Common::Rect &r) {
+ warning("STUB: Toolbox::PaintOval");
+}
+
+void Toolbox::PaintPoly(PolyHandle poly) {
+ warning("STUB: Toolbox::PaintPoly");
+}
+
+void Toolbox::PaintRect(const Common::Rect &r) {
+ warning("STUB: Toolbox::PaintRect");
+}
+
+void Toolbox::PenMode(uint16 mode) {
+ warning("STUB: Toolbox::PenMode");
+}
+
+void Toolbox::PenNormal() {
+ warning("STUB: Toolbox::PenNormal");
+}
+
+void Toolbox::PenPat(const Pattern &pat) {
+ warning("STUB: Toolbox::PenPat");
+
+}
+
+void Toolbox::PenSize(uint16 width, uint16 height) {
+ warning("STUB: Toolbox::PenSize");
+
+}
+
+void Toolbox::PortSize(uint16 width, uint16 height) {
+ warning("STUB: Toolbox::PortSize");
+
+}
+
+void Toolbox::ReleaseResource(Handle &handle) {
+ warning("STUB: Toolbox::ReleaseResource");
+
+}
+
+void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
+ warning("STUB: Toolbox::SetCPixel");
+
+}
+
+void Toolbox::SetPort(GrafPtr port) {
+ warning("STUB: Toolbox::SetPort");
+
+}
+
+void Toolbox::SetPortBits(const Graphics::Surface *bm) {
+ warning("STUB: Toolbox::SetPortBits");
+
+}
+
+void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
+ r.left = left;
+ r.top = top;
+ r.right = right;
+ r.bottom = bottom;
+ }
+
+uint16 Toolbox::StringWidth(const Common::String &s) {
+ warning("STUB: Toolbox::StringWidth");
+ return 0;
+}
+
+uint32 Toolbox::TickCount() {
+ warning("STUB: Toolbox::TickCount");
+ return 0;
+}
+
+void Toolbox::UseResFile(uint16 refNum) {
+ warning("STUB: Toolbox::UseResFile");
+
+}
+
} // namespace Fool
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 27cedd517e5..dd2e8d3ad87 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -378,12 +378,7 @@ public:
// PROCEDURE SetRect (VAR r: Rect; left,top,right,bottom: INTEGER);
// SetRect assigns the four boundary coordinates to the given rectangle. The result is a rectangle
// with coordinates (left,top) (right,bottom).
- void SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
- r.left = left;
- r.top = top;
- r.right = right;
- r.bottom = bottom;
- }
+ void SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom);
// PROCEDURE StringWidth (s: Str255) : INTEGER;
// StringWidth returns the width of the given text string, which it calculates by adding the
diff --git a/engines/fool/view1.cpp b/engines/fool/view1.cpp
deleted file mode 100644
index d6707f4859e..00000000000
--- a/engines/fool/view1.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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/system.h"
-#include "graphics/palette.h"
-#include "fool/view1.h"
-
-namespace Fool {
-
-bool View1::msgFocus(const FocusMessage &msg) {
- Common::fill(&_pal[0], &_pal[256 * 3], 0);
- _offset = 128;
- return true;
-}
-
-bool View1::msgKeypress(const KeypressMessage &msg) {
- // Any keypress to close the view
- close();
- return true;
-}
-
-void View1::draw() {
- // Draw a bunch of squares on screen
- Graphics::ManagedSurface s = getSurface();
-
- for (int i = 0; i < 100; ++i)
- s.frameRect(Common::Rect(i, i, 320 - i, 200 - i), i);
-}
-
-bool View1::tick() {
- // Cycle the palette
- ++_offset;
- for (int i = 0; i < 256; ++i)
- _pal[i * 3 + 1] = (i + _offset) % 256;
- g_system->getPaletteManager()->setPalette(_pal, 0, 256);
-
- // Below is redundant since we're only cycling the palette, but it demonstrates
- // how to trigger the view to do further draws after the first time, since views
- // don't automatically keep redrawing unless you tell it to
- if ((_offset % 256) == 0)
- redraw();
-
- return true;
-}
-
-} // namespace Fool
diff --git a/engines/fool/view1.h b/engines/fool/view1.h
deleted file mode 100644
index 67dd33fc603..00000000000
--- a/engines/fool/view1.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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 FOOL_VIEW1_H
-#define FOOL_VIEW1_H
-
-#include "fool/events.h"
-
-namespace Fool {
-
-class View1 : public UIElement {
-private:
- byte _pal[256 * 3] = { 0 };
- int _offset = 0;
-
-public:
- View1() : UIElement("View1") {}
- virtual ~View1() {}
-
- bool msgFocus(const FocusMessage &msg) override;
- bool msgKeypress(const KeypressMessage &msg) override;
- void draw() override;
- bool tick() override;
-};
-
-} // namespace Fool
-
-#endif
diff --git a/engines/fool/views.h b/engines/fool/views.h
deleted file mode 100644
index 2745813eef2..00000000000
--- a/engines/fool/views.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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 FOOL_VIEWS_H
-#define FOOL_VIEWS_H
-
-#include "fool/view1.h"
-
-namespace Fool {
-
-struct Views {
- View1 _view1;
-};
-
-} // namespace Fool
-
-#endif
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index a9e0ac77e53..f200cdeccda 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -20,6 +20,7 @@
*/
#include "common/macresman.h"
+#include "common/memorypool.h"
#include "common/str-enc.h"
#include "common/stream.h"
@@ -85,16 +86,16 @@ void ZBasic::loadProgram(const Common::Path &path) {
case kDatumSTR:
{
uint8 size = scot->readByte();
- char *buf = new char[size];
+ char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
- this->_dataTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
- delete[] buf;
+ this->_dataTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
+ free(buf);
}
break;
case kDatumBCD:
{
scot->seek(-1);
- this->_dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
+ this->_dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
}
break;
default:
@@ -105,10 +106,11 @@ void ZBasic::loadProgram(const Common::Path &path) {
uint32 offset = 0;
while (scot->pos() < scot->size()) {
uint8 size = scot->readByte();
- char *buf = new char[size];
+ char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
this->_stringTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
offset += size + 1;
+ free(buf);
}
}
@@ -116,6 +118,30 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
+void ZBasic::blockMove(void *srcptr, void *destptr, uint16 size) {
+ memmove(destptr, srcptr, size);
+}
+
+Common::U32String ZBasic::chr(uint16 code) {
+ return Common::U32String(code, Common::kMacRoman);
+}
+
+void ZBasic::bufferFlush(const Common::U32String &str) {
+ warning("STUB: ZBasic::bufferFlush");
+}
+
+void ZBasic::close(int16 fileNo) {
+ warning("STUB: ZBasic::close");
+}
+
+void ZBasic::coordinateWindow() {
+ warning("STUB: ZBasic::coordinateWindow");
+}
+
+void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest) {
+ warning("STUB: ZBasic::get");
+}
+
int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2) {
uint32 result = string1.find(string2, (uint32)MAX<int16>(expression - 1, 1));
if (result == Common::U32String::npos)
@@ -123,6 +149,11 @@ int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Co
return (int16)(result + 1);
}
+int ZBasic::finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume) {
+ warning("STUB: ZBasic::finderInfo");
+ return 0;
+}
+
bool ZBasic::maybe() {
return g_engine->getRandomNumber(1) == 1;
}
@@ -133,11 +164,25 @@ uint32 ZBasic::mem(int16 index) {
return 0;
}
-int16 ZBasic::rndInt(int16 max) {
- if (max == 0)
- return 0;
- max = (int16)abs(MAX<int16>(max, -32767));
- return (int16)(g_engine->getRandomNumber(max - 1) + 1);
+void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
+ warning("STUB: ZBasic::openR");
+}
+
+void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
+ warning("STUB: ZBasic::picture");
+}
+
+void ZBasic::put(int16 x, int16 y, Graphics::Surface &src) {
+ this->put(x, y, x+src.w, y+src.h, src);
+}
+
+void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src) {
+ warning("STUB: ZBasic::put");
+}
+
+Common::Array<byte> ZBasic::read(int16 fileNo, uint32 length) {
+ warning("STUB: ZBasic::read");
+ return Common::Array<byte>();
}
int16 ZBasic::readInt() {
@@ -145,13 +190,13 @@ int16 ZBasic::readInt() {
warning("ZBasic::readInt: no more data left");
return 0;
}
- ZBasicDatum &el = _dataTable[_dataPtr];
+ Common::SharedPtr<ZBasicDatum> &el = _dataTable[_dataPtr];
_dataPtr++;
- if (el.type != kDatumINT) {
- warning("ZBasic::readInt: entry %d was unexpected type %d", _dataPtr-1, el.type);
+ if (el->type != kDatumINT) {
+ warning("ZBasic::readInt: entry %d was unexpected type %d", _dataPtr-1, el->type);
return 0;
}
- return el.data.i16;
+ return el->data.i16;
}
Common::U32String ZBasic::readStr() {
@@ -160,14 +205,47 @@ Common::U32String ZBasic::readStr() {
warning("ZBasic::readStr: no more data left");
return result;
}
- ZBasicDatum &el = _dataTable[_dataPtr];
+ Common::SharedPtr<ZBasicDatum> &el = _dataTable[_dataPtr];
_dataPtr++;
- if (el.type != kDatumSTR) {
- warning("ZBasic::readStr: entry %d was unexpected type %d", _dataPtr-1, el.type);
+ if (el->type != kDatumSTR) {
+ warning("ZBasic::readStr: entry %d was unexpected type %d", _dataPtr-1, el->type);
return result;
}
- result = *el.data.str;
+ result = *el->data.str;
return result;
}
+int16 ZBasic::rndInt(int16 max) {
+ if (max == 0)
+ return 0;
+ max = (int16)abs(MAX<int16>(max, -32767));
+ return (int16)(g_engine->getRandomNumber(max - 1) + 1);
+}
+
+
+const Common::U32String &ZBasic::str(size_t index) {
+ return *_stringTable[index]->data.str;
+}
+
+void ZBasic::text(int16 font, int16 size, int16 face, ZBasicTextMode mode) {
+ warning("STUB: ZBasic::text");
+}
+
+void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type) {
+ warning("STUB:: ZBasic::window");
+}
+
+void ZBasic::unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4) {
+ warning("STUB:: ZBasic::unk_6");
+}
+
+void ZBasic::unk_20() {
+ warning("STUB: ZBasic::unk_20");
+}
+
+void ZBasic::unk_130(int16 unk1) {
+ warning("STUB: ZBasic::unk_130");
+}
+
+
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 634bedb3609..0ffcb17a04f 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -22,6 +22,8 @@
#ifndef FOOL_ZBASIC_H
#define FOOL_ZBASIC_H
+#include "common/memorypool.h"
+#include "common/ptr.h"
#include "common/str.h"
#include "common/ustr.h"
#include "graphics/surface.h"
@@ -166,6 +168,8 @@ struct ZBasicDatum {
Common::U32String *str;
} data;
+ ZBasicDatum() {}
+
~ZBasicDatum() {
if (this->type == kDatumBCD) {
delete this->data.bcd;
@@ -176,66 +180,72 @@ struct ZBasicDatum {
}
}
- static ZBasicDatum newNull(uint32 offset) {
- ZBasicDatum result;
- result.type = kDatumNULL;
- result.offset = offset;
- result.data.bcd = 0;
- return result;
+ static Common::SharedPtr<ZBasicDatum> newNull(int32 offset) {
+ ZBasicDatum *result = new ZBasicDatum();
+ result->type = kDatumNULL;
+ result->offset = offset;
+ result->data.bcd = 0;
+ return Common::SharedPtr<ZBasicDatum>(result);
}
- static ZBasicDatum newInt(uint32 offset, int16 value) {
- ZBasicDatum result;
- result.type = kDatumINT;
- result.offset = offset;
- result.data.i16 = value;
- return result;
+ static Common::SharedPtr<ZBasicDatum> newInt(uint32 offset, int16 value) {
+ ZBasicDatum *result = new ZBasicDatum();
+ result->type = kDatumINT;
+ result->offset = offset;
+ result->data.i16 = value;
+ return Common::SharedPtr<ZBasicDatum>(result);
}
- static ZBasicDatum newDblInt(uint32 offset, int32 value) {
- ZBasicDatum result;
- result.type = kDatumDBLINT;
- result.offset = offset;
- result.data.i32 = value;
- return result;
+ static Common::SharedPtr<ZBasicDatum> newDblInt(uint32 offset, int32 value) {
+ ZBasicDatum *result = new ZBasicDatum();
+ result->type = kDatumDBLINT;
+ result->offset = offset;
+ result->data.i32 = value;
+ return Common::SharedPtr<ZBasicDatum>(result);
}
- static ZBasicDatum newBcd(uint32 offset, const ZBasicBCD &value) {
- ZBasicDatum result;
- result.type = kDatumBCD;
- result.offset = offset;
- result.data.bcd = new ZBasicBCD(value);
- return result;
+ static Common::SharedPtr<ZBasicDatum> newBcd(uint32 offset, const ZBasicBCD &value) {
+ ZBasicDatum *result = new ZBasicDatum();
+ result->type = kDatumBCD;
+ result->offset = offset;
+ result->data.bcd = new ZBasicBCD(value);
+ return Common::SharedPtr<ZBasicDatum>(result);
}
- static ZBasicDatum newStr(uint32 offset, const Common::U32String &value) {
- ZBasicDatum result;
- result.type = kDatumSTR;
- result.offset = offset;
- result.data.str = new Common::U32String(value);
- return result;
+ static Common::SharedPtr<ZBasicDatum> newStr(uint32 offset, const Common::U32String &value) {
+ ZBasicDatum *result = new ZBasicDatum();
+ result->type = kDatumSTR;
+ result->offset = offset;
+ result->data.str = new Common::U32String(value);
+ return Common::SharedPtr<ZBasicDatum>(result);
}
};
class ZBasic {
private:
- Common::Array<ZBasicDatum> _dataTable;
+ Common::Array<Common::SharedPtr<ZBasicDatum>> _dataTable;
uint32 _dataPtr;
- Common::Array<ZBasicDatum> _stringTable;
+ Common::Array<Common::SharedPtr<ZBasicDatum>> _stringTable;
+ Toolbox *_toolbox;
+ Common::MemoryPool *_memPool;
public:
+ ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
+ _memPool = new Common::MemoryPool(sizeof(int));
+ }
+ ~ZBasic() {
+ delete _memPool;
+ _memPool = nullptr;
+ }
+
void loadProgram(const Common::Path &path);
void loadSCOT();
void bufferFlush(const Common::U32String &str);
- void blockMove(void *srcptr, void *destptr, uint16 size) {
- memmove(destptr, srcptr, size);
- }
- Common::U32String chr(uint16 code) {
- return Common::U32String(code, Common::kMacRoman);
- }
+ void blockMove(void *srcptr, void *destptr, uint16 size);
+ Common::U32String chr(uint16 code);
void close(int16 fileNo);
void coordinateWindow();
void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest);
@@ -244,20 +254,18 @@ public:
bool maybe();
uint32 mem(int16 index);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
+ void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
void put(int16 x, int16 y, Graphics::Surface &src);
void put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src);
Common::Array<byte> read(int16 fileNo, uint32 length);
- void text(int16 font, int16 size, int16 face, ZBasicTextMode mode);
- void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
+ int16 readInt();
+ Common::U32String readStr();
int16 rndInt(int16 max);
+ void text(int16 font, int16 size, int16 face, ZBasicTextMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
- const Common::U32String &str(size_t index) {
- return *_stringTable[index].data.str;
- }
+ const Common::U32String &str(size_t index);
- int16 readInt();
- Common::U32String readStr();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
void unk_20();
Commit: 8d3003200fac94d1a711776f513c0ff82f7b0f36
https://github.com/scummvm/scummvm/commit/8d3003200fac94d1a711776f513c0ff82f7b0f36
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:46+02:00
Commit Message:
FOOL: Almost working
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 5ea92e18cc0..66581800fdb 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -22,6 +22,7 @@
#include "common/str.h"
#include "common/str-enc.h"
+#include "graphics/macgui/macwindow.h"
#include "fool/fool.h"
#include "fool/fool_prologue.h"
@@ -38,6 +39,9 @@ Toolbox *g_toolbox;
// and was built with a different ZBASIC compiler.
void FoolPrologue::run() {
+ this->_window = new Graphics::MacWindow(g_engine->_wm.getNextId(), false, false, false, &g_engine->_wm);
+ g_engine->_wm.setBackgroundWindow(this->_window);
+
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
@@ -117,15 +121,15 @@ void FoolPrologue::sub_128_004() {
//g_zbasic->unk4(); // exit command?
}
-void FoolPrologue::sub_128_1ba(int16 screen_page) {
+void FoolPrologue::sub_128_1ba(int16 screenPage) {
// 128:01ba
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screenPage];
g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
}
-void FoolPrologue::sub_128_1f4(int16 screen_page) {
+void FoolPrologue::sub_128_1f4(int16 screenPage) {
// 128:01f4
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screenPage];
g_toolbox->SetPortBits(this->var_i32_40);
}
@@ -138,7 +142,7 @@ void FoolPrologue::sub_128_21e(int16 numTicks) {
void FoolPrologue::sub_128_24a(int16 numTicks) {
// 128:024a
- int32_t delay = MAX<uint32>(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
+ uint32 delay = (uint32)MAX<int>(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
// again, polling TickCount in a loop.
g_toolbox->Delay(delay);
}
@@ -210,9 +214,9 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
}
-void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_page) {
+void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage) {
// 128:050a
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screenPage];
this->var_i16_5c.left = unk3;
this->var_i16_5c.right = unk2;
if (unk1 == 0) {
@@ -239,9 +243,9 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_
}
}
-void FoolPrologue::sub_128_610(int16 screen_page) {
+void FoolPrologue::sub_128_610(int16 screenPage) {
// 128:0610
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screenPage];
g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
@@ -261,9 +265,9 @@ void FoolPrologue::sub_128_64a(int16 unk1) {
g_toolbox->PenNormal();
}
-void FoolPrologue::sub_128_6e4(int16 screen_page) {
+void FoolPrologue::sub_128_6e4(int16 screenPage) {
// 128:06e4
- this->var_i32_40 = &this->arr_i32_41296[screen_page];
+ this->var_i32_40 = &this->arr_i32_41296[screenPage];
for (int i = 0; i < 0x36; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
@@ -353,7 +357,7 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
if (this->var_i16_6 > 0xb5) {
this->var_i16_6 = 0;
}
- } while (this->var_i32_2 + this->var_i16_1a4 <= g_toolbox->TickCount());
+ } while (this->var_i32_2 + this->var_i16_1a4 > g_toolbox->TickCount());
}
void FoolPrologue::sub_128_c8a() {
@@ -371,7 +375,7 @@ void FoolPrologue::sub_128_ccc() {
}
// 128:0d2a
for (int i=this->var_i16_18e; i<=1; i--) {
- this->var_i16_1b6 = g_engine->getRandomNumber(i);
+ this->var_i16_1b6 = g_zbasic->rndInt(i);
this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
g_zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
@@ -401,6 +405,8 @@ void FoolPrologue::sub_128_e58() {
this->var_i16_1ba = g_toolbox->GetNextEvent(0x2, this->var_ev_22);
if (this->var_ev_22.what == kMouseDown)
break;
+ // wait until next redraw
+ g_toolbox->Delay(1);
}
this->sub_128_e80();
}
@@ -415,9 +421,13 @@ void FoolPrologue::sub_128_e80() {
if (this->var_ev_22.what == kDiskEvt) {
this->sub_128_ee0();
}
+ // keep looping until mouse is seen as up??
+ // see I-252
if ((this->var_ev_22.modifiers & 0x80) && (this->var_ev_22.what == kNullEvent)) {
break;
}
+ // wait until next redraw
+ g_toolbox->Delay(1);
}
}
@@ -992,7 +1002,7 @@ void FoolPrologue::sub_130_004() {
// 130:0ce6
// JMP 1002
// g_zbasic->pushOldCodeResource(0x82);
- this->sub_131_004();
+ //this->sub_131_004();
}
void FoolPrologue::sub_130_cea() {
@@ -1025,10 +1035,10 @@ void FoolPrologue::sub_130_db0() {
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
// 130:0dc0
- this->arr_i16_1e8[this->var_i16_6] = g_engine->getRandomNumber(0x264) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0xfb] = g_engine->getRandomNumber(0x1ba) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = g_engine->getRandomNumber(0x5) + 1;
- this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = g_engine->getRandomNumber(0xa) + 0x19;
+ this->arr_i16_1e8[this->var_i16_6] = g_zbasic->rndInt(0x264) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0xfb] = g_zbasic->rndInt(0x1ba) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = g_zbasic->rndInt(0x5) + 1;
+ this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = g_zbasic->rndInt(0xa) + 0x19;
// 130:0e68
this->sub_130_e82();
this->var_i16_6 += 1;
@@ -1061,7 +1071,7 @@ void FoolPrologue::sub_130_f48() {
// 130:0f78
this->var_i16_1ba = g_zbasic->instr(this->var_i16_1ba, this->var_str_76, g_zbasic->str(21));
if (this->var_i16_1ba > 0) {
- this->var_str_76.replace(this->var_i16_1ba, 1, Common::U32String("\""));
+ this->var_str_76.replace(this->var_i16_1ba-1, 1, Common::U32String("\""));
}
}
// 130:0fc8
@@ -1073,7 +1083,7 @@ void FoolPrologue::sub_130_f48() {
void FoolPrologue::sub_130_1002() {
// 130:1002
// g_zbasic->pushOldCodeResource(0x82);
- this->sub_131_004();
+ //this->sub_131_004();
}
// run finale
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index f66bf292a03..50978b438da 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -39,8 +39,8 @@ public:
void run();
void sub_128_004();
- void sub_128_1ba(int16 screen_page);
- void sub_128_1f4(int16 screen_page);
+ void sub_128_1ba(int16 screenPage);
+ void sub_128_1f4(int16 screenPage);
void sub_128_21e(int16 numTicks);
void sub_128_24a(int16 numTicks);
void sub_128_26c(int16 unk1, int16 unk2);
@@ -48,10 +48,10 @@ public:
void sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right);
void sub_128_354(uint16 unk1, uint16 unk2);
void sub_128_3ee(int16 unk1);
- void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screen_page);
- void sub_128_610(int16 screen_page);
+ void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
+ void sub_128_610(int16 screenPage);
void sub_128_64a(int16 unk1);
- void sub_128_6e4(int16 screen_page);
+ void sub_128_6e4(int16 screenPage);
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
void sub_128_a6c(int16_t unk1, int16_t unk2);
void sub_128_a8c(int16_t unk);
@@ -194,6 +194,8 @@ private:
PicHandle glob_i32_2ce;
+ Graphics::MacWindow *_window;
+
};
} // End of namespace Fool
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index db79e34ffa0..236120d291f 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
fool.o \
fool_prologue.o \
toolbox.o \
+ toolbox_resman.o \
zbasic.o \
console.o \
messages.o \
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index b6a0bb282c6..5857b3a7925 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -19,10 +19,52 @@
*
*/
+#include "common/system.h"
+
+#include "fool/fool.h"
#include "fool/toolbox.h"
namespace Fool {
+Toolbox::Toolbox() {
+ this->_frameLimiter = new Graphics::FrameLimiter(g_system, 60);
+}
+
+Toolbox::~Toolbox() {
+ delete this->_frameLimiter;
+}
+
+void Toolbox::_pumpEvents() {
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event)) {
+ EventRecord newRecord;
+ newRecord.when = this->TickCount();
+ switch (event.type) {
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
+ newRecord.what = kMouseDown;
+ newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
+ this->_events.push(newRecord);
+ break;
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
+ newRecord.what = kMouseUp;
+ newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
+ this->_events.push(newRecord);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void Toolbox::_updateScreen() {
+ g_engine->_wm.draw();
+ this->_frameLimiter->delayBeforeSwap();
+ g_system->updateScreen();
+ this->_frameLimiter->startFrame();
+}
+
void Toolbox::BeginUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::BeginUpdate");
}
@@ -43,14 +85,13 @@ void Toolbox::CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstB
warning("STUB: Toolbox::CopyBits");
}
-uint16 Toolbox::CurResFile() {
- warning("STUB: Toolbox::CurResFile");
- return 0;
-}
-
uint32 Toolbox::Delay(uint32 numTicks) {
- warning("STUB: Toolbox::Delay");
- return 0;
+ uint32 target = g_system->getMillis() + (numTicks * 1000 / 60);
+ while (g_system->getMillis() < target) {
+ this->_pumpEvents();
+ this->_updateScreen();
+ }
+ return (uint32)(g_system->getMillis() * 60 / 1000);
}
void Toolbox::DrawString(const Common::String &s) {
@@ -87,7 +128,15 @@ void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
warning("STUB: Toolbox::GetNextEvent");
- return false;
+ this->_pumpEvents();
+ if (!this->_events.empty()) {
+ theEvent = this->_events.pop();
+ } else {
+ theEvent.what = kNullEvent;
+ // pretend mouse button is up
+ theEvent.modifiers = 0x80;
+ }
+ return true;
}
PicHandle Toolbox::GetPicture(uint16 picID) {
@@ -174,17 +223,10 @@ void Toolbox::PenPat(const Pattern &pat) {
void Toolbox::PenSize(uint16 width, uint16 height) {
warning("STUB: Toolbox::PenSize");
-
}
void Toolbox::PortSize(uint16 width, uint16 height) {
warning("STUB: Toolbox::PortSize");
-
-}
-
-void Toolbox::ReleaseResource(Handle &handle) {
- warning("STUB: Toolbox::ReleaseResource");
-
}
void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
@@ -215,13 +257,7 @@ uint16 Toolbox::StringWidth(const Common::String &s) {
}
uint32 Toolbox::TickCount() {
- warning("STUB: Toolbox::TickCount");
- return 0;
-}
-
-void Toolbox::UseResFile(uint16 refNum) {
- warning("STUB: Toolbox::UseResFile");
-
+ return (uint32)(g_system->getMillis() * 60 / 1000);
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index dd2e8d3ad87..5d1046e38ea 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -22,9 +22,12 @@
#ifndef FOOL_TOOLBOX_H
#define FOOL_TOOLBOX_H
-#include "common/scummsys.h"
+#include "common/hashmap.h"
+#include "common/system.h"
+#include "common/macresman.h"
#include "common/str.h"
#include "common/ustr.h"
+#include "graphics/framelimiter.h"
#include "graphics/macgui/macwindow.h"
namespace Fool {
@@ -33,6 +36,7 @@ typedef uint32 Handle;
typedef uint32 RgnHandle;
typedef uint32 PicHandle;
typedef uint32 PolyHandle;
+typedef uint32 ResType;
struct Pattern {
uint8 data[8];
@@ -119,6 +123,52 @@ class Toolbox {
public:
// Compatibility shim for the Macintosh Toolbox/QuickDraw API.
+ Toolbox();
+ ~Toolbox();
+
+ // toolbox_resman.cpp
+
+ // FUNCTION CurResFile: INTEGER;
+ // CurResFile returns the reference number of the current resource file. You can call it when the
+ // application starts up to get the reference number of its resource file.
+ uint16 CurResFile();
+
+ // FUNCTION GetNamedResource (theType: ResType; name: Str255) : Handle;
+ // GetNamedResource is the same as GetResource (above) except that you pass a resource name
+ // instead of an ID number.
+
+ // FUNCTION GetResource (theType: ResType; theID: INTEGER) : Handle;
+ // GetResource returns a handle to the resource having the given type and ID number, reading
+ // the resource data into memory if it's not already in memory and if you haven't called
+ // SetResLoad(FALSE) (see the warning above for GetIndResource). If the resource data is already
+ // in memory, GetResource just returns the handle to the resource.
+ Handle GetResource(ResType theType, int16 theID);
+
+ // FUNCTION OpenResFile (fileName: Str255): INTEGER;
+ // OpenResFile opens the resource file having the given name and makes it the current resource file.
+ // It reads the resource map from the file into memory and returns a reference number for the file. It
+ // also reads in every resource whose resPreload attribute is set. If the resource file is already open,
+ // it doesn't make it the current resource file; it simply returns the reference number.
+ // If the file can't be opened, OpenResFile will return -1 and the ResError function will return an
+ // appropriate Operating System result code. For example, an error occurs if there's no resource file
+ // with the given name.
+ int16 OpenResFile(Common::Path &filename);
+
+ // PROCEDURE ReleaseResource (theResource: Handle);
+ // Given a handle to a resource, ReleaseResource releases the memory occupied by the resource
+ // data, if any, and replaces the handle to that resource in the resource map with NIL (see Figure 7).
+ // The given handle will no longer be recognized as a handle to a resource; if the Resource Manager
+ // is subsequendy called to get the released resource, a new handle will be allocated. Use this
+ // procedure only after you're completely through with a resource.
+ void ReleaseResource(Handle &handle);
+
+ // PROCEDURE UseResFile (refNum: INTEGER);
+ // Given the reference number of a resource file, UseResFile sets the current resource file to that
+ // file. If there's no resource file open with the given reference number, UseResFile will do nothing
+ // and the ResError function will return the result code resFNotFound. A refNum of 0 represents
+ // the system resource file.
+ void UseResFile(uint16 refNum);
+
// PROCEDURE BeginUpdate (theWindow: WindowPtr);
@@ -158,11 +208,6 @@ public:
// srcBits.bounds coordinates.
void CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn);
- // FUNCTION CurResFile: INTEGER;
- // CurResFile returns the reference number of the current resource file. You can call it when the
- // application starts up to get the reference number of its resource file.
- uint16 CurResFile();
-
// PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
// Delay causes the system to wait for the number of ticks (sixtieths of a second) specified by numTicks, and returns in finalTicks the total number of ticks from system startup to the end of the delay.
uint32 Delay(uint32 numTicks);
@@ -351,14 +396,6 @@ public:
// merely changes the size of the "active area" of the grafPort.
void PortSize(uint16 width, uint16 height);
- // PROCEDURE ReleaseResource (theResource: Handle);
- // Given a handle to a resource, ReleaseResource releases the memory occupied by the resource
- // data, if any, and replaces the handle to that resource in the resource map with NIL (see Figure 7).
- // The given handle will no longer be recognized as a handle to a resource; if the Resource Manager
- // is subsequendy called to get the released resource, a new handle will be allocated. Use this
- // procedure only after you're completely through with a resource.
- void ReleaseResource(Handle &handle);
-
// PROCEDURE SetCPixel (h,v: INTEGER; cPix: RGBColor);
// The SetCPixel function sets the pixel at the specified position to the pixel value that most
// closely matches the specified RGB.
@@ -390,12 +427,15 @@ public:
// up.
uint32 TickCount();
- // PROCEDURE UseResFile (refNum: INTEGER);
- // Given the reference number of a resource file, UseResFile sets the current resource file to that
- // file. If there's no resource file open with the given reference number, UseResFile will do nothing
- // and the ResError function will return the result code resFNotFound. A refNum of 0 represents
- // the system resource file.
- void UseResFile(uint16 refNum);
+private:
+ Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
+ int16 _nextResId = 0;
+ Graphics::FrameLimiter *_frameLimiter = nullptr;
+
+ Common::Queue<EventRecord> _events;
+
+ void _pumpEvents();
+ void _updateScreen();
};
} // namespace Fool
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index f200cdeccda..53f912803ab 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -55,15 +55,21 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
switch (opcode) {
case kDatumNULL:
- this->_dataTable.push_back(ZBasicDatum::newNull(offset));
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, NULL\n", this->_dataTable.size(), offset);
+ this->_dataTable.push_back(ZBasicDatum::newNull(offset));
break;
case kDatumINT:
{
uint8 size = scot->readByte();
+ Common::SharedPtr<ZBasicDatum> result;
if (size == 0) {
- this->_dataTable.push_back(ZBasicDatum::newInt(offset, 0));
+ result = ZBasicDatum::newInt(offset, 0);
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
+ this->_dataTable.push_back(result);
} else if (size == 2) {
- this->_dataTable.push_back(ZBasicDatum::newInt(offset, scot->readSint16BE()));
+ result = ZBasicDatum::newInt(offset, scot->readSint16BE());
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
+ this->_dataTable.push_back(result);
} else {
warning("ZBasic::loadProgram: unexpected size for int %d", size);
scot->skip(size);
@@ -73,10 +79,15 @@ void ZBasic::loadProgram(const Common::Path &path) {
case kDatumDBLINT:
{
uint8 size = scot->readByte();
+ Common::SharedPtr<ZBasicDatum> result;
if (size == 0) {
- this->_dataTable.push_back(ZBasicDatum::newDblInt(offset, 0));
- } else if (size == 2) {
- this->_dataTable.push_back(ZBasicDatum::newDblInt(offset, scot->readSint32BE()));
+ result = ZBasicDatum::newDblInt(offset, 0);
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
+ this->_dataTable.push_back(result);
+ } else if (size == 4) {
+ result = ZBasicDatum::newDblInt(offset, scot->readSint32BE());
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
+ this->_dataTable.push_back(result);
} else {
warning("ZBasic::loadProgram: unexpected size for dblint %d", size);
scot->skip(size);
@@ -88,29 +99,37 @@ void ZBasic::loadProgram(const Common::Path &path) {
uint8 size = scot->readByte();
char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
- this->_dataTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
+ Common::SharedPtr<ZBasicDatum> result = ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman));
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, \"%s\"\n", this->_dataTable.size(), offset, result->data.str->encode().c_str());
+ this->_dataTable.push_back(result);
free(buf);
}
break;
case kDatumBCD:
{
scot->seek(-1);
+ debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, BCD\n", this->_dataTable.size(), offset);
this->_dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
}
break;
default:
break;
}
+ scot->skip(scot->pos() % 2);
}
if (hasStringTable) {
uint32 offset = 0;
+ scot->skip(1);
while (scot->pos() < scot->size()) {
uint8 size = scot->readByte();
char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
- this->_stringTable.push_back(ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman)));
+ Common::SharedPtr<ZBasicDatum> result = ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman));
+ debugN(5, "ZBasic::loadProgram: _stringTable[%d]: offset %d, \"%s\"\n", this->_stringTable.size(), offset, result->data.str->encode().c_str());
+ this->_stringTable.push_back(result);
offset += size + 1;
free(buf);
+ scot->skip(scot->pos() % 2);
}
}
@@ -143,7 +162,7 @@ void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest
}
int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2) {
- uint32 result = string1.find(string2, (uint32)MAX<int16>(expression - 1, 1));
+ uint32 result = string1.find(string2, (uint32)MAX<int16>(expression - 1, 0));
if (result == Common::U32String::npos)
return 0;
return (int16)(result + 1);
Commit: 38142cd973445296fe1c66ca7e0be7de6dc88133
https://github.com/scummvm/scummvm/commit/38142cd973445296fe1c66ca7e0be7de6dc88133
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:46+02:00
Commit Message:
COMMON: Add MacResMan::getResID()
Changed paths:
common/macresman.cpp
common/macresman.h
diff --git a/common/macresman.cpp b/common/macresman.cpp
index fc11e3fd143..5b89ba7649f 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -1013,6 +1013,21 @@ uint32 MacResManager::getResLength(uint32 typeID, uint16 resID) {
return len;
}
+uint16 MacResManager::getResID(uint32 typeID, const Common::String &fileName) {
+ for (uint32 i = 0; i < _resMap.numTypes; i++) {
+ if (_resTypes[i].id != typeID)
+ continue;
+
+ for (uint32 j = 0; j < _resTypes[i].items; j++) {
+ if (_resLists[i][j].nameOffset != -1 && fileName.equalsIgnoreCase(_resLists[i][j].name)) {
+ return _resLists[i][j].id;
+ }
+ }
+ }
+
+ return 0;
+}
+
void MacResManager::readMap() {
_stream->seek(_mapOffset + 22);
diff --git a/common/macresman.h b/common/macresman.h
index 8fa7b9d25b2..8df2ded4f9e 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -263,6 +263,14 @@ public:
*/
uint32 getResLength(uint32 typeID, uint16 resID);
+ /**
+ * Get the resource ID from a MacBinary file
+ * @param typeID FourCC of the type
+ * @param filename file name of the resource
+ * @return The resource ID for a matching resource
+ */
+ uint16 getResID(uint32 typeID, const Common::String &filename);
+
/**
* Get the size of the data portion of the resource fork
* @return The size of the data portion of the resource fork
Commit: cda196c3225308dd5623ce11d84cdcaa056edb13
https://github.com/scummvm/scummvm/commit/cda196c3225308dd5623ce11d84cdcaa056edb13
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:47+02:00
Commit Message:
FOOL: Implement more of ResMan API
Changed paths:
A engines/fool/siphash/LICENSE_CC0
A engines/fool/siphash/halfsip.cpp
A engines/fool/siphash/halfsip.h
A engines/fool/toolbox_resman.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 66581800fdb..df959238a8c 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -684,7 +684,7 @@ void FoolPrologue::sub_130_004() {
this->sub_130_d28();
this->sub_128_1f4(0xb);
this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
- g_zbasic->picture(0x74, 0xaa, -1, 0x00, this->glob_i32_2ce);
+ g_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
@@ -699,13 +699,13 @@ void FoolPrologue::sub_130_004() {
// 130:00d6
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x96, -1, 0, this->arr_i32_0[1]);
+ g_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->sub_128_1f4(8);
// 130:011c
this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x96, -1, 0, this->arr_i32_0[2]);
+ g_zbasic->picture(0, 0x96, this->arr_i32_0[2]);
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
@@ -717,7 +717,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_1f4(0);
// 130:01aa
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[6]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[6]);
g_toolbox->ReleaseResource(this->arr_i32_0[6]);
this->sub_130_cea();
@@ -726,14 +726,14 @@ void FoolPrologue::sub_130_004() {
this->sub_128_1f4(1);
// 130:0202
- g_zbasic->picture(0xa2, 0x3c, -1, 0, this->arr_i32_0[7]);
+ g_zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
g_toolbox->ReleaseResource(this->arr_i32_0[7]);
this->sub_130_cea();
this->sub_128_1f4(2);
// 130:0234
this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
- g_zbasic->picture(0x5a, 0x2e, -1, 0, this->arr_i32_0[8]);
+ g_zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
g_toolbox->ReleaseResource(this->arr_i32_0[8]);
// 130:0276
@@ -748,8 +748,8 @@ void FoolPrologue::sub_130_004() {
// 130:029a
this->sub_128_1f4(j - 6);
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[j]);
- g_zbasic->picture(this->var_i16_74, 0x96, -1, 0, this->arr_i32_0[j - 6]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[j]);
+ g_zbasic->picture(this->var_i16_74, 0x96, this->arr_i32_0[j - 6]);
g_toolbox->ReleaseResource(this->arr_i32_0[j]);
g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
@@ -757,7 +757,7 @@ void FoolPrologue::sub_130_004() {
// 130:0320
this->sub_128_1f4(6);
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0xc]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[0xc]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
// 130:034a
@@ -885,8 +885,8 @@ void FoolPrologue::sub_130_004() {
this->sub_128_24a(1);
}
// 130:083c
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0xd]);
- g_zbasic->picture(5, 0, -1, 0, this->arr_i32_0[0xe]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[0xd]);
+ g_zbasic->picture(5, 0, this->arr_i32_0[0xe]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xd]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xe]);
this->var_i32_2 = g_toolbox->TickCount();
@@ -894,14 +894,14 @@ void FoolPrologue::sub_130_004() {
// g_zbasic->52(0);
this->sub_128_1f4(0);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0, 0x17, -1, 0, this->arr_i32_0[0xf]);
+ g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->sub_130_f48();
this->sub_128_de2();
this->sub_128_1f4(1);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0xf0, 0xba, -1, 0, this->arr_i32_0[0x10]);
+ g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->sub_130_f48();
this->sub_128_de2();
@@ -927,7 +927,7 @@ void FoolPrologue::sub_130_004() {
// 130:0a42
this->sub_128_1f4(6);
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
- g_zbasic->picture(0x166, 0x77, -1, 0, this->arr_i32_0[0x11]);
+ g_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
this->sub_128_de2();
//g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
this->arr_i32_41296[7].copyFrom(this->arr_i32_41296[6]);
@@ -935,12 +935,12 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->sub_128_1f4(7);
// 130:0ac2
- g_zbasic->picture(-0x14, -0x1e, -1, 0, this->arr_i32_0[0x12]);
+ g_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
this->sub_128_1f4(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8].copyFrom(this->arr_i32_41296[7]);
this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
- g_zbasic->picture(0x16d, 0x80, -1, 0, this->arr_i32_0[0x48]);
+ g_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
// 130:0b74
@@ -1101,12 +1101,12 @@ void FoolPrologue::sub_131_004() {
// 131:004c
this->arr_i32_0[0x1f] = g_toolbox->GetPicture(0x1f);
this->sub_128_1f4(0x4);
- g_zbasic->picture(0x0, 0x0, -1, 0x0, this->arr_i32_0[0x1f]);
+ g_zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
this->sub_131_4dc0();
for (int i = 0x14; i < 0x1e; i++) {
// 131:009c
- this->arr_i32_0[i] = g_toolbox->GetPicture(this->var_i16_74);
+ this->arr_i32_0[i] = g_toolbox->GetPicture(i);
if ((i % 3) == 0) {
this->var_i16_3ce += 5;
this->sub_131_4dc0();
@@ -1118,13 +1118,13 @@ void FoolPrologue::sub_131_004() {
this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
// 131:0110
if (i < 8) {
- g_zbasic->picture(0, 0x3, -1, 0, this->arr_i32_0[0x19]);
+ g_zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
}
if (i == 8) {
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x1a]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[0x1a]);
}
if (i == 9) {
- g_zbasic->picture(0x60, 0x4c, -1, 0, this->arr_i32_0[0x1b]);
+ g_zbasic->picture(0x60, 0x4c, this->arr_i32_0[0x1b]);
}
}
// 131:0184
@@ -1134,8 +1134,8 @@ void FoolPrologue::sub_131_004() {
// 131:01aa
this->arr_i32_0[0x13] = g_toolbox->GetPicture(0x13);
this->sub_128_1f4(0x5);
- g_zbasic->picture(0, 0xb4, -1, 0, this->arr_i32_0[0x13]);
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x18]);
+ g_zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[0x18]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x13]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x18]);
this->sub_131_4e98();
@@ -1203,15 +1203,15 @@ void FoolPrologue::sub_131_004() {
this->sub_128_21e(0x1e);
// 131:041a
- g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_i32_0[0x14]);
+ g_zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
this->sub_128_21e(0x2);
- g_zbasic->picture(0x1cd, 0xbf, -1, 0, this->arr_i32_0[0x15]);
+ g_zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
this->sub_128_21e(0x3c);
- g_zbasic->picture(0x1cd, 0xbd, -1, 0, this->arr_i32_0[0x14]);
+ g_zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
this->sub_128_21e(0x6);
- g_zbasic->picture(0x1a6, 0xbf, -1, 0, this->arr_i32_0[0x16]);
+ g_zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
this->sub_128_21e(0x6);
- g_zbasic->picture(0x1b3, 0xc5, -1, 0, this->arr_i32_0[0x17]);
+ g_zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
// 131:04b4
for (int i = 0x14; i < 0x17; i++) {
@@ -1300,9 +1300,9 @@ void FoolPrologue::sub_131_004() {
// 131:0926
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->PenPat(this->arr_pat_194[3]);
- g_zbasic->picture(0x6d, 0x49, -1, 0, this->arr_i32_0[0x1c]);
- g_zbasic->picture(0x65, 0x48, -1, 0, this->arr_i32_0[0x1d]);
- g_zbasic->picture(0x64, 0x54, -1, 0, this->arr_i32_0[0x1e]);
+ g_zbasic->picture(0x6d, 0x49, this->arr_i32_0[0x1c]);
+ g_zbasic->picture(0x65, 0x48, this->arr_i32_0[0x1d]);
+ g_zbasic->picture(0x64, 0x54, this->arr_i32_0[0x1e]);
// 131:099c
g_toolbox->PaintPoly(this->var_i32_3d6);
@@ -1346,10 +1346,10 @@ void FoolPrologue::sub_131_004() {
// 131:0bb0
this->sub_128_50a(4, 0, 0x1fc, 3);
this->sub_128_1ba(5);
- g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
+ g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_21e(0x3c);
- g_zbasic->picture(0x197, 0x101, -1, 0, this->arr_i32_0[0x26]);
+ g_zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
// 131:0c36
this->var_i32_2 = g_toolbox->TickCount();
@@ -1364,15 +1364,15 @@ void FoolPrologue::sub_131_004() {
this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[5]);
}
this->sub_128_1f4(0x6);
- g_zbasic->picture(0x6, 0x8f, -1, 0, this->arr_i32_0[0x20]);
+ g_zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
this->sub_128_1f4(0x7);
- g_zbasic->picture(0x1a, 0x7e, -1, 0, this->arr_i32_0[0x21]);
+ g_zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
this->sub_128_1f4(0x8);
- g_zbasic->picture(0x2e, 0x6a, -1, 0, this->arr_i32_0[0x22]);
+ g_zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
this->sub_128_1f4(0x9);
- g_zbasic->picture(0x45, 0x4e, -1, 0, this->arr_i32_0[0x23]);
+ g_zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
this->sub_128_1f4(0xa);
- g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_0[0x24]);
+ g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
// 131:0d64
for (int i = 0x20; i < 0x23; i++) {
@@ -1380,12 +1380,12 @@ void FoolPrologue::sub_131_004() {
}
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0x64);
- g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
+ g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
this->sub_128_21e(0xf);
this->sub_128_50a(i, 0, 0x1fc, 1);
}
- g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_0[0x27]);
+ g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
this->sub_128_21e(0x3c);
// 131:0e08
@@ -1399,15 +1399,15 @@ void FoolPrologue::sub_131_004() {
//g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
this->arr_i32_41296[5].copyFrom(this->arr_i32_41296[4]);
this->sub_128_1f4(0x5);
- g_zbasic->picture(0x73, 0x28, -1, 0, this->arr_i32_0[0x24]);
- g_zbasic->picture(0x191, 0x102, -1, 0, this->arr_i32_0[0x27]);
- g_zbasic->picture(0x8a, 0x24, -1, 0, this->arr_i32_0[0x28]);
+ g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
+ g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
+ g_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
this->sub_128_1f4(0x6);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
- g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_0[0x29]);
+ g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
this->sub_128_1f4(0x7);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
- g_zbasic->picture(0x118, 0x19, -1, 0, this->arr_i32_0[0x2a]);
+ g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
//g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8].copyFrom(this->arr_i32_41296[5]);
this->sub_128_1f4(0x8);
@@ -1415,10 +1415,10 @@ void FoolPrologue::sub_131_004() {
//g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
this->arr_i32_41296[9].copyFrom(this->arr_i32_41296[4]);
this->sub_128_1f4(0x9);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
+ g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
this->sub_128_1f4(0xa);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 2);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
+ g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
@@ -1454,7 +1454,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1ba(0x5);
this->sub_128_1f4(0x5);
this->sub_128_2f0(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
+ g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
@@ -1467,10 +1467,10 @@ void FoolPrologue::sub_131_004() {
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
- this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24));
+ this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24).encode().c_str());
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_26c(0x1f0, 0xd2);
- g_zbasic->picture(0x198, 0x102, -1, 0, this->arr_i32_0[0x25]);
+ g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
}
this->sub_128_24a(0x2);
g_toolbox->MoveTo(0x172, 0x33);
@@ -1489,7 +1489,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1f4(0x5);
this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
- g_zbasic->picture(0, 0, -1, 0, this->arr_i32_0[0x2f]);
+ g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0xa);
this->var_i16_5c.left = 0x18b;
@@ -1509,11 +1509,11 @@ void FoolPrologue::sub_131_004() {
}
// 131:1424
- g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_0[0x2c]);
+ g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
this->sub_128_21e(0x1);
- g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_0[0x2d]);
+ g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
this->sub_128_21e(0x1);
- g_zbasic->picture(0x193, 0x2d, -1, 0, this->arr_i32_0[0x2e]);
+ g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
this->sub_128_1ba(0x6);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 50978b438da..e04ad369eaa 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -163,7 +163,7 @@ private:
int16 var_i16_3fc;
// picture resource handles
- Handle arr_i32_0[92] = { 0 };
+ PicHandle arr_i32_0[92] = { nullptr };
Pattern arr_pat_194[5];
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 236120d291f..358da4fff47 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/fool
MODULE_OBJS = \
+ siphash/halfsip.o \
fool.o \
fool_prologue.o \
toolbox.o \
diff --git a/engines/fool/siphash/LICENSE_CC0 b/engines/fool/siphash/LICENSE_CC0
new file mode 100644
index 00000000000..3bbbc1ee925
--- /dev/null
+++ b/engines/fool/siphash/LICENSE_CC0
@@ -0,0 +1,116 @@
+CC0 1.0 Universal
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator and
+subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the
+purpose of contributing to a commons of creative, cultural and scientific
+works ("Commons") that the public can reliably and without fear of later
+claims of infringement build upon, modify, incorporate in other works, reuse
+and redistribute as freely as possible in any form whatsoever and for any
+purposes, including without limitation commercial purposes. These owners may
+contribute to the Commons to promote the ideal of a free culture and the
+further production of creative, cultural and scientific works, or to gain
+reputation or greater distribution for their Work in part through the use and
+efforts of others.
+
+For these and/or other purposes and motivations, and without any expectation
+of additional consideration or compensation, the person associating CC0 with a
+Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
+and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
+and publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal
+effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not limited
+to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+
+ ii. moral rights retained by the original author(s) and/or performer(s);
+
+ iii. publicity and privacy rights pertaining to a person's image or likeness
+ depicted in a Work;
+
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+
+ v. rights protecting the extraction, dissemination, use and reuse of data in
+ a Work;
+
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation thereof,
+ including any amended or successor version of such directive); and
+
+ vii. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of,
+applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
+and Related Rights and associated claims and causes of action, whether now
+known or unknown (including existing as well as future claims and causes of
+action), in the Work (i) in all territories worldwide, (ii) for the maximum
+duration provided by applicable law or treaty (including future time
+extensions), (iii) in any current or future medium and for any number of
+copies, and (iv) for any purpose whatsoever, including without limitation
+commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
+the Waiver for the benefit of each member of the public at large and to the
+detriment of Affirmer's heirs and successors, fully intending that such Waiver
+shall not be subject to revocation, rescission, cancellation, termination, or
+any other legal or equitable action to disrupt the quiet enjoyment of the Work
+by the public as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be
+judged legally invalid or ineffective under applicable law, then the Waiver
+shall be preserved to the maximum extent permitted taking into account
+Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
+is so judged Affirmer hereby grants to each affected person a royalty-free,
+non transferable, non sublicensable, non exclusive, irrevocable and
+unconditional license to exercise Affirmer's Copyright and Related Rights in
+the Work (i) in all territories worldwide, (ii) for the maximum duration
+provided by applicable law or treaty (including future time extensions), (iii)
+in any current or future medium and for any number of copies, and (iv) for any
+purpose whatsoever, including without limitation commercial, advertising or
+promotional purposes (the "License"). The License shall be deemed effective as
+of the date CC0 was applied by Affirmer to the Work. Should any part of the
+License for any reason be judged legally invalid or ineffective under
+applicable law, such partial invalidity or ineffectiveness shall not
+invalidate the remainder of the License, and in such case Affirmer hereby
+affirms that he or she will not (i) exercise any of his or her remaining
+Copyright and Related Rights in the Work or (ii) assert any associated claims
+and causes of action with respect to the Work, in either case contrary to
+Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+
+ b. Affirmer offers the Work as-is and makes no representations or warranties
+ of any kind concerning the Work, express, implied, statutory or otherwise,
+ including without limitation warranties of title, merchantability, fitness
+ for a particular purpose, non infringement, or the absence of latent or
+ other defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without limitation
+ any person's Copyright and Related Rights in the Work. Further, Affirmer
+ disclaims responsibility for obtaining any necessary consents, permissions
+ or other rights required for any use of the Work.
+
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to this
+ CC0 or use of the Work.
+
+For more information, please see
+<http://creativecommons.org/publicdomain/zero/1.0/>
\ No newline at end of file
diff --git a/engines/fool/siphash/halfsip.cpp b/engines/fool/siphash/halfsip.cpp
new file mode 100644
index 00000000000..50e75fd15a9
--- /dev/null
+++ b/engines/fool/siphash/halfsip.cpp
@@ -0,0 +1,170 @@
+
+/*
+ SipHash reference C implementation
+
+ Copyright (c) 2016 Jean-Philippe Aumasson <jeanphilippe.aumasson at gmail.com>
+
+ To the extent possible under law, the author(s) have dedicated all copyright
+ and related and neighboring rights to this software to the public domain
+ worldwide. This software is distributed without any warranty.
+
+ You should have received a copy of the CC0 Public Domain Dedication along
+ with
+ this software. If not, see
+ <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+#include "fool/siphash/halfsip.h"
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* default: SipHash-2-4 */
+#ifndef cROUNDS
+#define cROUNDS 2
+#endif
+#ifndef dROUNDS
+#define dROUNDS 4
+#endif
+
+#define ROTL(x, b) (uint32_t)(((x) << (b)) | ((x) >> (32 - (b))))
+
+#define U32TO8_LE(p, v) \
+ (p)[0] = (uint8_t)((v)); \
+ (p)[1] = (uint8_t)((v) >> 8); \
+ (p)[2] = (uint8_t)((v) >> 16); \
+ (p)[3] = (uint8_t)((v) >> 24);
+
+#define U8TO32_LE(p) \
+ (((uint32_t)((p)[0])) | ((uint32_t)((p)[1]) << 8) | \
+ ((uint32_t)((p)[2]) << 16) | ((uint32_t)((p)[3]) << 24))
+
+#define SIPROUND \
+ do { \
+ v0 += v1; \
+ v1 = ROTL(v1, 5); \
+ v1 ^= v0; \
+ v0 = ROTL(v0, 16); \
+ v2 += v3; \
+ v3 = ROTL(v3, 8); \
+ v3 ^= v2; \
+ v0 += v3; \
+ v3 = ROTL(v3, 7); \
+ v3 ^= v0; \
+ v2 += v1; \
+ v1 = ROTL(v1, 13); \
+ v1 ^= v2; \
+ v2 = ROTL(v2, 16); \
+ } while (0)
+
+
+#ifdef DEBUG_SIPHASH
+#include <stdio.h>
+
+#define TRACE \
+ do { \
+ printf("(%3zu) v0 %08" PRIx32 "\n", inlen, v0); \
+ printf("(%3zu) v1 %08" PRIx32 "\n", inlen, v1); \
+ printf("(%3zu) v2 %08" PRIx32 "\n", inlen, v2); \
+ printf("(%3zu) v3 %08" PRIx32 "\n", inlen, v3); \
+ } while (0)
+#else
+#define TRACE
+#endif
+
+namespace Fool {
+
+/*
+ Computes a SipHash value
+ *in: pointer to input data (read-only)
+ inlen: input data length in bytes (any size_t value)
+ *k: pointer to the key data (read-only), must be 8 bytes
+ *out: pointer to output data (write-only), outlen bytes must be allocated
+ outlen: length of the output in bytes, must be 4 or 8
+*/
+int halfsiphash(const void *in, const size_t inlen, const void *k, uint8_t *out,
+ const size_t outlen) {
+
+ const unsigned char *ni = (const unsigned char *)in;
+ const unsigned char *kk = (const unsigned char *)k;
+
+ assert((outlen == 4) || (outlen == 8));
+ uint32_t v0 = 0;
+ uint32_t v1 = 0;
+ uint32_t v2 = UINT32_C(0x6c796765);
+ uint32_t v3 = UINT32_C(0x74656462);
+ uint32_t k0 = U8TO32_LE(kk);
+ uint32_t k1 = U8TO32_LE(kk + 4);
+ uint32_t m;
+ int i;
+ const unsigned char *end = ni + inlen - (inlen % sizeof(uint32_t));
+ const int left = inlen & 3;
+ uint32_t b = ((uint32_t)inlen) << 24;
+ v3 ^= k1;
+ v2 ^= k0;
+ v1 ^= k1;
+ v0 ^= k0;
+
+ if (outlen == 8)
+ v1 ^= 0xee;
+
+ for (; ni != end; ni += 4) {
+ m = U8TO32_LE(ni);
+ v3 ^= m;
+
+ TRACE;
+ for (i = 0; i < cROUNDS; ++i)
+ SIPROUND;
+
+ v0 ^= m;
+ }
+
+ switch (left) {
+ case 3:
+ b |= ((uint32_t)ni[2]) << 16;
+ /* FALLTHRU */
+ case 2:
+ b |= ((uint32_t)ni[1]) << 8;
+ /* FALLTHRU */
+ case 1:
+ b |= ((uint32_t)ni[0]);
+ break;
+ case 0:
+ break;
+ }
+
+ v3 ^= b;
+
+ TRACE;
+ for (i = 0; i < cROUNDS; ++i)
+ SIPROUND;
+
+ v0 ^= b;
+
+ if (outlen == 8)
+ v2 ^= 0xee;
+ else
+ v2 ^= 0xff;
+
+ TRACE;
+ for (i = 0; i < dROUNDS; ++i)
+ SIPROUND;
+
+ b = v1 ^ v3;
+ U32TO8_LE(out, b);
+
+ if (outlen == 4)
+ return 0;
+
+ v1 ^= 0xdd;
+
+ TRACE;
+ for (i = 0; i < dROUNDS; ++i)
+ SIPROUND;
+
+ b = v1 ^ v3;
+ U32TO8_LE(out + 4, b);
+
+ return 0;
+}
+
+} // namespace Fool
diff --git a/engines/fool/siphash/halfsip.h b/engines/fool/siphash/halfsip.h
new file mode 100644
index 00000000000..023dd4d7874
--- /dev/null
+++ b/engines/fool/siphash/halfsip.h
@@ -0,0 +1,30 @@
+/*
+ SipHash reference C implementation
+
+ Copyright (c) 2012-2021 Jean-Philippe Aumasson
+ <jeanphilippe.aumasson at gmail.com>
+ Copyright (c) 2012-2014 Daniel J. Bernstein <djb at cr.yp.to>
+
+ To the extent possible under law, the author(s) have dedicated all copyright
+ and related and neighboring rights to this software to the public domain
+ worldwide. This software is distributed without any warranty.
+
+ You should have received a copy of the CC0 Public Domain Dedication along
+ with
+ this software. If not, see
+ <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#ifndef FOOL_SIPHASH_HALFSIP_H
+#define FOOL_SIPHASH_HALFSIP_H
+
+namespace Fool {
+
+#include <inttypes.h>
+#include <string.h>
+
+int halfsiphash(const void* in, const size_t inlen, const void* k, uint8_t* out, const size_t outlen);
+
+};
+
+#endif // FOOL_SIPHASH_HALFSIP_H
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 5857b3a7925..569c7575ad4 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -19,8 +19,12 @@
*
*/
+#include "common/memstream.h"
#include "common/system.h"
+#include "graphics/macgui/macwindowmanager.h"
+#include "image/pict.h"
+
#include "fool/fool.h"
#include "fool/toolbox.h"
@@ -140,16 +144,29 @@ bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
}
PicHandle Toolbox::GetPicture(uint16 picID) {
- warning("STUB: Toolbox::GetPicture");
- return 0;
+ Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
+ if (handle) {
+ Common::MemoryReadStream stream(handle->data(), handle->size());
+ Image::PICTDecoder decoder;
+ if (decoder.loadStream(stream)) {
+ PicHandle result(new Graphics::ManagedSurface());
+ result->copyFrom(*decoder.getSurface());
+ this->_resPicts[result] = handle;
+ return result;
+ }
+ }
+
+ return nullptr;
}
void Toolbox::HideCursor() {
- warning("STUB: Toolbox::HideCursor");
+ this->_cursorLevel--;
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
}
void Toolbox::InitCursor() {
- warning("STUB: Toolbox::InitCursor");
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ this->_cursorLevel = 0;
}
void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
@@ -218,7 +235,6 @@ void Toolbox::PenNormal() {
void Toolbox::PenPat(const Pattern &pat) {
warning("STUB: Toolbox::PenPat");
-
}
void Toolbox::PenSize(uint16 width, uint16 height) {
@@ -231,25 +247,30 @@ void Toolbox::PortSize(uint16 width, uint16 height) {
void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
warning("STUB: Toolbox::SetCPixel");
-
}
void Toolbox::SetPort(GrafPtr port) {
warning("STUB: Toolbox::SetPort");
-
}
void Toolbox::SetPortBits(const Graphics::Surface *bm) {
warning("STUB: Toolbox::SetPortBits");
-
}
void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
- r.left = left;
- r.top = top;
- r.right = right;
- r.bottom = bottom;
- }
+ r.left = left;
+ r.top = top;
+ r.right = right;
+ r.bottom = bottom;
+}
+
+void Toolbox::ShowCursor() {
+ if (this->_cursorLevel < 0)
+ this->_cursorLevel++;
+ if (this->_cursorLevel == 0)
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+}
+
uint16 Toolbox::StringWidth(const Common::String &s) {
warning("STUB: Toolbox::StringWidth");
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 5d1046e38ea..861bcb5ecb3 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -27,16 +27,44 @@
#include "common/macresman.h"
#include "common/str.h"
#include "common/ustr.h"
+
#include "graphics/framelimiter.h"
#include "graphics/macgui/macwindow.h"
+#include "fool/siphash/halfsip.h"
+
namespace Fool {
-typedef uint32 Handle;
-typedef uint32 RgnHandle;
-typedef uint32 PicHandle;
-typedef uint32 PolyHandle;
+typedef Common::SharedPtr<Common::Array<byte>> Handle;
+typedef Handle RgnHandle;
+typedef Common::SharedPtr<Graphics::ManagedSurface> PicHandle;
+typedef Handle PolyHandle;
typedef uint32 ResType;
+typedef size_t Size;
+
+};
+
+template<>
+struct Common::Hash<Fool::Handle> {
+ uint operator()(const Fool::Handle& h) const {
+ void *target = h.get();
+ uint result;
+ Fool::halfsiphash((const void *)&target, sizeof(intptr_t), "TBHANDLE", (byte *)&result, sizeof(uint));
+ return result;
+ }
+};
+
+template<>
+struct Common::Hash<Fool::PicHandle> {
+ uint operator()(const Fool::PicHandle& h) const {
+ void *target = h.get();
+ uint result;
+ Fool::halfsiphash((const void *)&target, sizeof(intptr_t), "TBHANDLE", (byte *)&result, sizeof(uint));
+ return result;
+ }
+};
+
+namespace Fool {
struct Pattern {
uint8 data[8];
@@ -119,6 +147,14 @@ struct WindowRecord {
// TYPE Rect: top: INTEGER; left: INTEGER; bottom: INTEGER; right: INTEGER;
+struct ToolboxResInfo {
+ int16 fileID;
+ ResType type;
+ uint16 resID;
+ Handle handle;
+ Common::String name;
+};
+
class Toolbox {
public:
@@ -131,18 +167,54 @@ public:
// FUNCTION CurResFile: INTEGER;
// CurResFile returns the reference number of the current resource file. You can call it when the
// application starts up to get the reference number of its resource file.
- uint16 CurResFile();
+ int16 CurResFile();
+
+ // PROCEDURE DetachResource (theResource: Handle);
+ // Given a handle to a resource, DetachResource replaces the handle to that resource in the resource
+ // map with NIL (see Figure 7 above). The given handle will no longer be recognized as a handle to
+ // a resource; if the Resource Manager is subsequendy called to get the detached resource, a new
+ // handle will be allocated.
+ void DetachResource(Handle &h);
+
+ // PROCEDURE DisposHandle (h: Handle);
+ // DisposHandle releases the memory occupied by the relocatable block whose handle is h.
+ void DisposHandle(Handle &h);
+
+ // FUNCTION GetHandleSize (h: Handle) : Size;
+ // GetHandleSize returns the logical size, in bytes, of the relocatable block whose handle is h. In
+ // case of an error, GetHandleSize returns 0.
+ Size GetHandleSize(Handle &h);
// FUNCTION GetNamedResource (theType: ResType; name: Str255) : Handle;
// GetNamedResource is the same as GetResource (above) except that you pass a resource name
// instead of an ID number.
+ Handle GetNamedResource(ResType theType, const Common::String &name);
+
+ // PROCEDURE GetResInfo (theResource: Handle; VAR theID: INTEGER;
+ // VAR theType: ResType; VAR name: Str255);
+ // Given a handle to a resource, GetResInfo returns the ID number, type, and name of the resource.
+ // If the given handle isn't a handle to a resource, GetResInfo will do nothing and the ResError
+ // function will return the result code resNotFound.
+ void GetResInfo(Handle &theResource, int16 &theID, ResType &theType, Common::String &name);
// FUNCTION GetResource (theType: ResType; theID: INTEGER) : Handle;
// GetResource returns a handle to the resource having the given type and ID number, reading
// the resource data into memory if it's not already in memory and if you haven't called
// SetResLoad(FALSE) (see the warning above for GetIndResource). If the resource data is already
// in memory, GetResource just returns the handle to the resource.
- Handle GetResource(ResType theType, int16 theID);
+ Handle GetResource(ResType theType, uint16 theID);
+
+ // FUNCTION HomeResFile (theResource: Handle) : INTEGER;
+ // Given a handle to a resource, HomeResFile returns the reference number of the resource file
+ // containing that resource. If the given handle isn't a handle to a resource, HomeResFile will
+ // return -1 and the ResError function will return the result code resNotFound.
+ int32 HomeResFile(Handle &theResource);
+
+ // FUNCTION NewHandle (logicalSize: Size) : Handle;
+ // NewHandle attempts to allocate a new relocatable block of logicalSize bytes from the current heap
+ // zone and then return a handle to it. The new block will be unlocked and unpurgeable. If
+ // logicalSize bytes can't be allocated, NewHandle returns NIL.
+ Handle NewHandle(Size logicalSize);
// FUNCTION OpenResFile (fileName: Str255): INTEGER;
// OpenResFile opens the resource file having the given name and makes it the current resource file.
@@ -152,7 +224,7 @@ public:
// If the file can't be opened, OpenResFile will return -1 and the ResError function will return an
// appropriate Operating System result code. For example, an error occurs if there's no resource file
// with the given name.
- int16 OpenResFile(Common::Path &filename);
+ int16 OpenResFile(const Common::Path &filename);
// PROCEDURE ReleaseResource (theResource: Handle);
// Given a handle to a resource, ReleaseResource releases the memory occupied by the resource
@@ -161,13 +233,21 @@ public:
// is subsequendy called to get the released resource, a new handle will be allocated. Use this
// procedure only after you're completely through with a resource.
void ReleaseResource(Handle &handle);
+ void ReleaseResource(PicHandle &handle);
+
+ // FUNCTION SizeResource(theResource: Handle) : LONGINT;
+ // Given a handle to a resource, SizeResource returns the size in bytes of the resource in the
+ // resource file. If the given handle isn't a handle to a resource, SizeResource will return - 1 and the
+ // ResError function will return the result code resNotFound. It's a good idea to call SizeResource
+ // and ensure that sufficient space is available before reading a resource into memory.
+ int32 SizeResource(Handle &theResource);
// PROCEDURE UseResFile (refNum: INTEGER);
// Given the reference number of a resource file, UseResFile sets the current resource file to that
// file. If there's no resource file open with the given reference number, UseResFile will do nothing
// and the ResError function will return the result code resFNotFound. A refNum of 0 represents
// the system resource file.
- void UseResFile(uint16 refNum);
+ void UseResFile(int16 refNum);
@@ -417,6 +497,13 @@ public:
// with coordinates (left,top) (right,bottom).
void SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom);
+ // PROCEDURE ShowCursor;
+ // ShowCursor increments the cursor level, which may have been decremented by HideCursor, and
+ // displays the cursor on the screen if the level becomes 0. A call to ShowCursor should balance
+ // each previous call to HideCursor. The level isn't incremented beyond 0, so extra calls to
+ // ShowCursor have no effect.
+ void ShowCursor();
+
// PROCEDURE StringWidth (s: Str255) : INTEGER;
// StringWidth returns the width of the given text string, which it calculates by adding the
// CharWidths of all the characters in the string (see above).
@@ -429,8 +516,13 @@ public:
private:
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
- int16 _nextResId = 0;
+ Common::Array<int16> _resOrder;
+ int16 _nextResId = 1;
+ size_t _resIndexStart = 0;
+ Common::HashMap<Handle, ToolboxResInfo> _resInfo;
+ Common::HashMap<PicHandle, Handle> _resPicts;
Graphics::FrameLimiter *_frameLimiter = nullptr;
+ int _cursorLevel = 0;
Common::Queue<EventRecord> _events;
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
new file mode 100644
index 00000000000..d7243854360
--- /dev/null
+++ b/engines/fool/toolbox_resman.cpp
@@ -0,0 +1,170 @@
+/* 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/system.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+
+namespace Fool {
+
+int16 Toolbox::CurResFile() {
+ // Return whatever the first resource file is
+ if (_resOrder.empty())
+ return 0;
+ return _resOrder.back();
+}
+
+void Toolbox::DetachResource(Handle &handle) {
+ if (this->_resInfo.contains(handle)) {
+ this->_resInfo.erase(handle);
+ }
+}
+
+void Toolbox::DisposHandle(Handle &h) {
+ // Our Handles are reference counted, do nothing.
+};
+
+void Toolbox::GetResInfo(Handle &theResource, int16 &theID, ResType &theType, Common::String &name) {
+ if (this->_resInfo.contains(theResource)) {
+ ToolboxResInfo &info = this->_resInfo[theResource];
+ theID = info.resID;
+ theType = info.type;
+ name = info.name;
+ }
+}
+
+Handle Toolbox::GetResource(ResType theType, uint16 theID) {
+ for (auto &it : this->_resInfo) {
+ if (it._value.type == theType && it._value.resID == theID) {
+ return it._value.handle;
+ }
+ }
+
+ for (size_t i = _resIndexStart; i < this->_resOrder.size(); i++) {
+ int16 fileID = this->_resOrder[i];
+ Common::SeekableReadStream *stream = this->_resMap[fileID]->getResource(theType, theID);
+ if (stream) {
+ Handle result = this->NewHandle(stream->size());
+ stream->read(result->data(), stream->size());
+ delete stream;
+ this->_resInfo[result] = { fileID, theType, theID, result, this->_resMap[fileID]->getResName(theType, theID) };
+ return result;
+ }
+ }
+ return nullptr;
+}
+
+Size Toolbox::GetHandleSize(Handle &h) {
+ if (h == nullptr) {
+ return 0;
+ }
+ return h->size();
+}
+
+Handle Toolbox::GetNamedResource(ResType theType, const Common::String &name) {
+ for (auto &it : this->_resInfo) {
+ if (it._value.type == theType && it._value.name == name) {
+ return it._value.handle;
+ }
+ }
+
+ for (size_t i = _resIndexStart; i < this->_resOrder.size(); i++) {
+ int16 fileID = this->_resOrder[i];
+ uint16 resID = this->_resMap[fileID]->getResID(theType, name);
+ if (resID) {
+ Common::SeekableReadStream *stream = this->_resMap[fileID]->getResource(theType, resID);
+ if (stream) {
+ Handle result = this->NewHandle(stream->size());
+ stream->read(result->data(), stream->size());
+ delete stream;
+ this->_resInfo[result] = { fileID, theType, resID, result, this->_resMap[fileID]->getResName(theType, resID) };
+ return result;
+ }
+ }
+ }
+ return nullptr;
+}
+
+int32 Toolbox::HomeResFile(Handle &theResource) {
+ if (_resInfo.contains(theResource)) {
+ return _resInfo[theResource].fileID;
+ }
+ return -1;
+}
+
+Handle Toolbox::NewHandle(Size logicalSize) {
+ Handle result(new Common::Array<byte>());
+ result->resize(logicalSize);
+ return result;
+}
+
+int16 Toolbox::OpenResFile(const Common::Path &fileName) {
+ Common::SharedPtr<Common::MacResManager> res(new Common::MacResManager());
+ if (!res->open(fileName)) {
+ return -1;
+ }
+ int16 result = _nextResId;
+ this->_resMap[result] = res;
+ this->_resOrder.insert_at(0, result);
+ this->_nextResId++;
+ this->_resIndexStart = 0;
+ return result;
+}
+
+void Toolbox::ReleaseResource(Handle &handle) {
+ if (this->_resInfo.contains(handle)) {
+ this->_resInfo.erase(handle);
+ }
+}
+
+void Toolbox::ReleaseResource(PicHandle &handle) {
+ // Pictures generated by GetPicture are apparently freed with ReleaseResource.
+ if (this->_resPicts.contains(handle)) {
+ Handle target = this->_resPicts[handle];
+ this->_resPicts.erase(handle);
+ this->ReleaseResource(target);
+ }
+}
+
+int32 Toolbox::SizeResource(Handle &theResource) {
+ if (this->_resInfo.contains(theResource)) {
+ ToolboxResInfo &info = this->_resInfo[theResource];
+ return (int32)this->_resMap[info.fileID]->getResLength(info.type, info.resID);
+ }
+ return -1;
+}
+
+void Toolbox::UseResFile(int16 refNum) {
+ if (refNum == 0) {
+ this->_resIndexStart = this->_resOrder.size();
+ return;
+ }
+ for (size_t i = 0; i < this->_resOrder.size(); i++) {
+ if (this->_resOrder[i] == refNum) {
+ this->_resIndexStart = i;
+ return;
+ }
+ }
+}
+
+
+} // namespace Fool
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 53f912803ab..8e5db43af6d 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -21,6 +21,7 @@
#include "common/macresman.h"
#include "common/memorypool.h"
+#include "common/memstream.h"
#include "common/str-enc.h"
#include "common/stream.h"
@@ -31,16 +32,17 @@
namespace Fool {
void ZBasic::loadProgram(const Common::Path &path) {
- Common::MacResManager resman;
- if (!resman.open(path)) {
+ _fileId = this->_toolbox->OpenResFile(path);
+ if (_fileId == -1) {
warning("ZBasic::loadProgram: unable to open %s", path.toString(':').c_str());
return;
}
- Common::SeekableReadStream *scot = resman.getResource(MKTAG('S', 'C', 'O', 'T'), 1);
- if (!scot) {
+ Handle scotRes = this->_toolbox->GetResource(MKTAG('S', 'C', 'O', 'T'), 1);
+ if (!scotRes) {
warning("ZBasic::loadProgram: could not find SCOT chunk");
return;
}
+ Common::MemoryReadStream *scot = new Common::MemoryReadStream(scotRes->data(), scotRes->size());
this->_dataTable.clear();
this->_dataPtr = 0;
@@ -187,6 +189,14 @@ void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineS
warning("STUB: ZBasic::openR");
}
+void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
+ if (!src) {
+ warning("ZBasic::picture: Empty handle");
+ return;
+ }
+ g_engine->_screen.blitFrom(*src, Common::Point(x, y));
+}
+
void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
warning("STUB: ZBasic::picture");
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 0ffcb17a04f..9b3ae818182 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -230,6 +230,7 @@ private:
Toolbox *_toolbox;
Common::MemoryPool *_memPool;
+ int16 _fileId = -1;
public:
ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
@@ -254,6 +255,7 @@ public:
bool maybe();
uint32 mem(int16 index);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
+ void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
void put(int16 x, int16 y, Graphics::Surface &src);
void put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src);
Commit: beb94c42f13e87d078e1c3c44efaf504cf437d2a
https://github.com/scummvm/scummvm/commit/beb94c42f13e87d078e1c3c44efaf504cf437d2a
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:47+02:00
Commit Message:
FOOL: First graphics displaying
Changed paths:
A engines/fool/utils.cpp
A engines/fool/utils.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
graphics/macgui/macwindow.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index df959238a8c..a0b0c2d455a 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -39,9 +39,6 @@ Toolbox *g_toolbox;
// and was built with a different ZBASIC compiler.
void FoolPrologue::run() {
- this->_window = new Graphics::MacWindow(g_engine->_wm.getNextId(), false, false, false, &g_engine->_wm);
- g_engine->_wm.setBackgroundWindow(this->_window);
-
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index e04ad369eaa..ff172d37466 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -194,7 +194,6 @@ private:
PicHandle glob_i32_2ce;
- Graphics::MacWindow *_window;
};
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 358da4fff47..88b4cad48ab 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -9,7 +9,8 @@ MODULE_OBJS = \
zbasic.o \
console.o \
messages.o \
- metaengine.o
+ metaengine.o \
+ utils.o
# This module can be built as a plugin
ifeq ($(ENABLE_FOOL), DYNAMIC_PLUGIN)
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 569c7575ad4..a9a6dfa6f80 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -27,15 +27,16 @@
#include "fool/fool.h"
#include "fool/toolbox.h"
+#include "fool/utils.h"
namespace Fool {
Toolbox::Toolbox() {
- this->_frameLimiter = new Graphics::FrameLimiter(g_system, 60);
+ _frameLimiter = new Graphics::FrameLimiter(g_system, 60);
}
Toolbox::~Toolbox() {
- delete this->_frameLimiter;
+ delete _frameLimiter;
}
void Toolbox::_pumpEvents() {
@@ -48,13 +49,13 @@ void Toolbox::_pumpEvents() {
case Common::EVENT_RBUTTONDOWN:
newRecord.what = kMouseDown;
newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
- this->_events.push(newRecord);
+ _events.push(newRecord);
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
newRecord.what = kMouseUp;
newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
- this->_events.push(newRecord);
+ _events.push(newRecord);
break;
default:
break;
@@ -64,9 +65,9 @@ void Toolbox::_pumpEvents() {
void Toolbox::_updateScreen() {
g_engine->_wm.draw();
- this->_frameLimiter->delayBeforeSwap();
+ _frameLimiter->delayBeforeSwap();
g_system->updateScreen();
- this->_frameLimiter->startFrame();
+ _frameLimiter->startFrame();
}
void Toolbox::BeginUpdate(WindowRecord &theWindow) {
@@ -92,8 +93,8 @@ void Toolbox::CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstB
uint32 Toolbox::Delay(uint32 numTicks) {
uint32 target = g_system->getMillis() + (numTicks * 1000 / 60);
while (g_system->getMillis() < target) {
- this->_pumpEvents();
- this->_updateScreen();
+ _pumpEvents();
+ _updateScreen();
}
return (uint32)(g_system->getMillis() * 60 / 1000);
}
@@ -132,9 +133,9 @@ void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
warning("STUB: Toolbox::GetNextEvent");
- this->_pumpEvents();
- if (!this->_events.empty()) {
- theEvent = this->_events.pop();
+ _pumpEvents();
+ if (!_events.empty()) {
+ theEvent = _events.pop();
} else {
theEvent.what = kNullEvent;
// pretend mouse button is up
@@ -149,9 +150,10 @@ PicHandle Toolbox::GetPicture(uint16 picID) {
Common::MemoryReadStream stream(handle->data(), handle->size());
Image::PICTDecoder decoder;
if (decoder.loadStream(stream)) {
- PicHandle result(new Graphics::ManagedSurface());
- result->copyFrom(*decoder.getSurface());
- this->_resPicts[result] = handle;
+ const Graphics::Surface *surface = decoder.getSurface();
+ const Graphics::Palette &palette = decoder.getPalette();
+ PicHandle result(createRemappedSurface(surface, palette.data(), palette.size()));
+ _resPicts[result] = handle;
return result;
}
}
@@ -160,13 +162,13 @@ PicHandle Toolbox::GetPicture(uint16 picID) {
}
void Toolbox::HideCursor() {
- this->_cursorLevel--;
+ _cursorLevel--;
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
}
void Toolbox::InitCursor() {
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
- this->_cursorLevel = 0;
+ _cursorLevel = 0;
}
void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
@@ -265,9 +267,9 @@ void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16
}
void Toolbox::ShowCursor() {
- if (this->_cursorLevel < 0)
- this->_cursorLevel++;
- if (this->_cursorLevel == 0)
+ if (_cursorLevel < 0)
+ _cursorLevel++;
+ if (_cursorLevel == 0)
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
}
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index d7243854360..d0f9e48426a 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -34,8 +34,8 @@ int16 Toolbox::CurResFile() {
}
void Toolbox::DetachResource(Handle &handle) {
- if (this->_resInfo.contains(handle)) {
- this->_resInfo.erase(handle);
+ if (_resInfo.contains(handle)) {
+ _resInfo.erase(handle);
}
}
@@ -44,8 +44,8 @@ void Toolbox::DisposHandle(Handle &h) {
};
void Toolbox::GetResInfo(Handle &theResource, int16 &theID, ResType &theType, Common::String &name) {
- if (this->_resInfo.contains(theResource)) {
- ToolboxResInfo &info = this->_resInfo[theResource];
+ if (_resInfo.contains(theResource)) {
+ ToolboxResInfo &info = _resInfo[theResource];
theID = info.resID;
theType = info.type;
name = info.name;
@@ -53,20 +53,20 @@ void Toolbox::GetResInfo(Handle &theResource, int16 &theID, ResType &theType, Co
}
Handle Toolbox::GetResource(ResType theType, uint16 theID) {
- for (auto &it : this->_resInfo) {
+ for (auto &it : _resInfo) {
if (it._value.type == theType && it._value.resID == theID) {
return it._value.handle;
}
}
- for (size_t i = _resIndexStart; i < this->_resOrder.size(); i++) {
- int16 fileID = this->_resOrder[i];
- Common::SeekableReadStream *stream = this->_resMap[fileID]->getResource(theType, theID);
+ for (size_t i = _resIndexStart; i < _resOrder.size(); i++) {
+ int16 fileID = _resOrder[i];
+ Common::SeekableReadStream *stream = _resMap[fileID]->getResource(theType, theID);
if (stream) {
Handle result = this->NewHandle(stream->size());
stream->read(result->data(), stream->size());
delete stream;
- this->_resInfo[result] = { fileID, theType, theID, result, this->_resMap[fileID]->getResName(theType, theID) };
+ _resInfo[result] = { fileID, theType, theID, result, _resMap[fileID]->getResName(theType, theID) };
return result;
}
}
@@ -81,22 +81,22 @@ Size Toolbox::GetHandleSize(Handle &h) {
}
Handle Toolbox::GetNamedResource(ResType theType, const Common::String &name) {
- for (auto &it : this->_resInfo) {
+ for (auto &it : _resInfo) {
if (it._value.type == theType && it._value.name == name) {
return it._value.handle;
}
}
- for (size_t i = _resIndexStart; i < this->_resOrder.size(); i++) {
- int16 fileID = this->_resOrder[i];
- uint16 resID = this->_resMap[fileID]->getResID(theType, name);
+ for (size_t i = _resIndexStart; i < _resOrder.size(); i++) {
+ int16 fileID = _resOrder[i];
+ uint16 resID = _resMap[fileID]->getResID(theType, name);
if (resID) {
- Common::SeekableReadStream *stream = this->_resMap[fileID]->getResource(theType, resID);
+ Common::SeekableReadStream *stream = _resMap[fileID]->getResource(theType, resID);
if (stream) {
Handle result = this->NewHandle(stream->size());
stream->read(result->data(), stream->size());
delete stream;
- this->_resInfo[result] = { fileID, theType, resID, result, this->_resMap[fileID]->getResName(theType, resID) };
+ _resInfo[result] = { fileID, theType, resID, result, _resMap[fileID]->getResName(theType, resID) };
return result;
}
}
@@ -123,44 +123,44 @@ int16 Toolbox::OpenResFile(const Common::Path &fileName) {
return -1;
}
int16 result = _nextResId;
- this->_resMap[result] = res;
- this->_resOrder.insert_at(0, result);
- this->_nextResId++;
- this->_resIndexStart = 0;
+ _resMap[result] = res;
+ _resOrder.insert_at(0, result);
+ _nextResId++;
+ _resIndexStart = 0;
return result;
}
void Toolbox::ReleaseResource(Handle &handle) {
- if (this->_resInfo.contains(handle)) {
- this->_resInfo.erase(handle);
+ if (_resInfo.contains(handle)) {
+ _resInfo.erase(handle);
}
}
void Toolbox::ReleaseResource(PicHandle &handle) {
// Pictures generated by GetPicture are apparently freed with ReleaseResource.
- if (this->_resPicts.contains(handle)) {
- Handle target = this->_resPicts[handle];
- this->_resPicts.erase(handle);
+ if (_resPicts.contains(handle)) {
+ Handle target = _resPicts[handle];
+ _resPicts.erase(handle);
this->ReleaseResource(target);
}
}
int32 Toolbox::SizeResource(Handle &theResource) {
- if (this->_resInfo.contains(theResource)) {
- ToolboxResInfo &info = this->_resInfo[theResource];
- return (int32)this->_resMap[info.fileID]->getResLength(info.type, info.resID);
+ if (_resInfo.contains(theResource)) {
+ ToolboxResInfo &info = _resInfo[theResource];
+ return (int32)_resMap[info.fileID]->getResLength(info.type, info.resID);
}
return -1;
}
void Toolbox::UseResFile(int16 refNum) {
if (refNum == 0) {
- this->_resIndexStart = this->_resOrder.size();
+ _resIndexStart = _resOrder.size();
return;
}
- for (size_t i = 0; i < this->_resOrder.size(); i++) {
- if (this->_resOrder[i] == refNum) {
- this->_resIndexStart = i;
+ for (size_t i = 0; i < _resOrder.size(); i++) {
+ if (_resOrder[i] == refNum) {
+ _resIndexStart = i;
return;
}
}
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
new file mode 100644
index 00000000000..1ea9369c7f5
--- /dev/null
+++ b/engines/fool/utils.cpp
@@ -0,0 +1,81 @@
+/* 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 "fool/fool.h"
+#include "fool/utils.h"
+
+namespace Fool {
+
+Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount) {
+ Graphics::ManagedSurface *s = new Graphics::ManagedSurface();
+ s->create(surface->w, surface->h, Graphics::PixelFormat::createFormatCLUT8());
+
+ byte paletteMap[256];
+ memset(paletteMap, 0, sizeof(paletteMap));
+
+ const byte monoPalette[] = {
+ 0xFF, 0xFF, 0xFF,
+ 0x00, 0x00, 0x00
+ };
+
+ if (colorCount == 0) {
+ colorCount = 2;
+ palette = monoPalette;
+ }
+
+ for (uint i = 0; i < colorCount; i++) {
+ int r = palette[3 * i];
+ int g = palette[3 * i + 1];
+ int b = palette[3 * i + 2];
+
+ uint32 c;
+
+ c = g_engine->_wm.findBestColor(r, g, b);
+ paletteMap[i] = c;
+ }
+
+ // Colors outside the palette are not remapped.
+
+ for (uint i = colorCount; i < 256; i++)
+ paletteMap[i] = i;
+
+ if (palette) {
+ for (int y = 0; y < s->h; y++) {
+ for (int x = 0; x < s->w; x++) {
+ uint color = surface->getPixel(x, y);
+ if (color > colorCount)
+ color = g_engine->_wm._colorBlack;
+ else
+ color = paletteMap[color];
+
+ s->setPixel(x, y, color);
+ }
+ }
+ } else {
+ s->copyFrom(*surface);
+ }
+
+ return s;
+}
+
+
+
+} // End of namespace Fool
diff --git a/engines/fool/utils.h b/engines/fool/utils.h
new file mode 100644
index 00000000000..67593515e82
--- /dev/null
+++ b/engines/fool/utils.h
@@ -0,0 +1,34 @@
+
+/* 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 FOOL_UTILS_H
+#define FOOL_UTILS_H
+
+#include "graphics/managed_surface.h"
+
+namespace Fool {
+
+Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount);
+
+} // End of namespace Fool
+
+#endif // FOOL_UTILS_H
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 8e5db43af6d..9e5dd1e4048 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -31,6 +31,19 @@
namespace Fool {
+ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
+ _memPool = new Common::MemoryPool(sizeof(int));
+ _window = g_engine->_wm.addWindow(false, false, false);
+ _window->disableBorder();
+ _window->resize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_engine->_wm.setBackgroundWindow(_window);
+}
+
+ZBasic::~ZBasic() {
+ delete _memPool;
+ _memPool = nullptr;
+}
+
void ZBasic::loadProgram(const Common::Path &path) {
_fileId = this->_toolbox->OpenResFile(path);
if (_fileId == -1) {
@@ -194,7 +207,15 @@ void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
warning("ZBasic::picture: Empty handle");
return;
}
- g_engine->_screen.blitFrom(*src, Common::Point(x, y));
+ if (debugLevelSet(5)) {
+ Graphics::Surface *srf = src->surfacePtr();
+ Common::hexdump((const byte *)srf->getPixels(), srf->pitch*srf->h);
+ }
+ Common::Rect srcRect(0, 0, src->w, src->h);
+ Common::Rect destRect(x, y, x+src->w, y+src->h);
+ _window->getWindowSurface()->blitFrom(*src, srcRect, destRect);
+ _window->addDirtyRect(destRect);
+ _window->setContentDirty(true);
}
void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 9b3ae818182..34913506b20 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -26,6 +26,7 @@
#include "common/ptr.h"
#include "common/str.h"
#include "common/ustr.h"
+#include "graphics/macgui/macwindow.h"
#include "graphics/surface.h"
#include "fool/toolbox.h"
@@ -231,15 +232,11 @@ private:
Toolbox *_toolbox;
Common::MemoryPool *_memPool;
int16 _fileId = -1;
+ Graphics::MacWindow *_window;
public:
- ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
- _memPool = new Common::MemoryPool(sizeof(int));
- }
- ~ZBasic() {
- delete _memPool;
- _memPool = nullptr;
- }
+ ZBasic(Toolbox *toolbox);
+ ~ZBasic();
void loadProgram(const Common::Path &path);
void loadSCOT();
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 50cbd4c84e1..0b7c75f5792 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -394,8 +394,8 @@ public:
bool isDirty() override { return _borderIsDirty || _contentIsDirty; }
- void setBorderDirty(bool dirty) { _borderIsDirty = true; }
- void setContentDirty(bool dirty) { _contentIsDirty = true; }
+ void setBorderDirty(bool dirty) { _borderIsDirty = dirty; }
+ void setContentDirty(bool dirty) { _contentIsDirty = dirty; }
void resizeBorderSurface();
void setMode(uint32 mode) { _mode = mode; }
Commit: 7f7fa5f190f0165a08b329aecafd40cbfe39ddc9
https://github.com/scummvm/scummvm/commit/7f7fa5f190f0165a08b329aecafd40cbfe39ddc9
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:47+02:00
Commit Message:
FOOL: Add type alias for BitMap
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index a0b0c2d455a..ae1e0bf00ae 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -42,7 +42,7 @@ void FoolPrologue::run() {
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
-
+ g_engine->_menu->setVisible(false);
this->sub_128_004();
delete g_zbasic;
delete g_toolbox;
@@ -61,10 +61,11 @@ void FoolPrologue::sub_128_004() {
// 41296 is an array of pointers to screen pages within the buffer
for (int i = 0; i < 12; i++) {
//this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
- this->arr_i32_41296[i].create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ this->arr_i32_41296[i] = BitMap(new Graphics::ManagedSurface());
+ this->arr_i32_41296[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
// 128:0066
- this->var_i32_4e = &this->arr_i32_41296[11];
+ this->var_i32_4e = this->arr_i32_41296[11];
// 128:0078
// stipple pattern buffer?
this->arr_pat_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
@@ -120,13 +121,13 @@ void FoolPrologue::sub_128_004() {
void FoolPrologue::sub_128_1ba(int16 screenPage) {
// 128:01ba
- this->var_i32_40 = &this->arr_i32_41296[screenPage];
- g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[screenPage];
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_1f4(int16 screenPage) {
// 128:01f4
- this->var_i32_40 = &this->arr_i32_41296[screenPage];
+ this->var_i32_40 = this->arr_i32_41296[screenPage];
g_toolbox->SetPortBits(this->var_i32_40);
}
@@ -158,10 +159,10 @@ void FoolPrologue::sub_128_2a6(int16 unk1, int16 unk2) {
g_toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right) {
+void FoolPrologue::fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right) {
// 128:02f0
g_toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
- g_toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[pattern_id]);
+ g_toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[patternID]);
}
void FoolPrologue::sub_128_354(uint16 unk1, uint16 unk2) {
@@ -213,7 +214,7 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage) {
// 128:050a
- this->var_i32_40 = &this->arr_i32_41296[screenPage];
+ this->var_i32_40 = this->arr_i32_41296[screenPage];
this->var_i16_5c.left = unk3;
this->var_i16_5c.right = unk2;
if (unk1 == 0) {
@@ -233,7 +234,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = this->arr_i16_412ea[i] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[i];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
if (i % unk1 == 0) {
this->sub_128_24a(0);
}
@@ -242,8 +243,8 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
void FoolPrologue::sub_128_610(int16 screenPage) {
// 128:0610
- this->var_i32_40 = &this->arr_i32_41296[screenPage];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[screenPage];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_64a(int16 unk1) {
@@ -264,16 +265,16 @@ void FoolPrologue::sub_128_64a(int16 unk1) {
void FoolPrologue::sub_128_6e4(int16 screenPage) {
// 128:06e4
- this->var_i32_40 = &this->arr_i32_41296[screenPage];
+ this->var_i32_40 = this->arr_i32_41296[screenPage];
for (int i = 0; i < 0x36; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
}
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
@@ -505,7 +506,7 @@ void FoolPrologue::sub_129_004() {
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
// 129:013a
- this->sub_128_2f0(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
+ this->fillRect(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
g_toolbox->SetRect(this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
g_toolbox->PenPat(this->arr_pat_194[1]);
g_toolbox->FrameRect(this->arr_i16_1bc);
@@ -552,11 +553,11 @@ void FoolPrologue::sub_129_004() {
g_toolbox->InitCursor();
g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_41296[0]);
g_zbasic->unk_6(0x19, 0x64, 0xff, 0x0);
- this->sub_128_2f0(2, 0x46, 0x64, 0xd8, 0x198);
- this->sub_128_2f0(1, 0x4b, 0x69, 0xd3, 0x193);
+ this->fillRect(2, 0x46, 0x64, 0xd8, 0x198);
+ this->fillRect(1, 0x4b, 0x69, 0xd3, 0x193);
// 129:0386
- this->sub_128_2f0(2, 0x50, 0x6e, 0xc3, 0x18e);
+ this->fillRect(2, 0x50, 0x6e, 0xc3, 0x18e);
g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
// "not enough memory" message
this->var_str_76 = g_zbasic->str(6);
@@ -622,9 +623,9 @@ void FoolPrologue::sub_129_004() {
g_toolbox->InitCursor();
g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_41296[0]);
g_zbasic->unk_6(0x19, 0x64, 0xff, 0x00);
- this->sub_128_2f0(2, 0x64, 0x7e, 0xd8, 0x17a);
- this->sub_128_2f0(1, 0x69, 0x83, 0xd3, 0x175);
- this->sub_128_2f0(2, 0x6e, 0x88, 0xce, 0x170);
+ this->fillRect(2, 0x64, 0x7e, 0xd8, 0x17a);
+ this->fillRect(1, 0x69, 0x83, 0xd3, 0x175);
+ this->fillRect(2, 0x6e, 0x88, 0xce, 0x170);
// 129:0662
g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
// "set your monitor to black and white" message"
@@ -672,15 +673,15 @@ void FoolPrologue::sub_129_772() {
void FoolPrologue::sub_130_004() {
// 130:0004
this->var_i16_3ce = 5;
- this->sub_130_d28();
+ this->prologueDrawLoadingMsg();
this->var_i16_18e = SCREEN_HEIGHT;
this->sub_128_ccc();
this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
- this->var_i16_3ce = 0xa;
- this->sub_130_d28();
+ this->var_i16_3ce = 10;
+ this->prologueDrawLoadingMsg();
this->sub_128_1f4(0xb);
- this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
g_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
g_toolbox->ReleaseResource(this->glob_i32_2ce);
@@ -690,52 +691,52 @@ void FoolPrologue::sub_130_004() {
this->sub_128_2a6(0x10d, 0xdd);
g_toolbox->SetPortBits(this->var_i32_32);
for (int i = 1; i < 5; i++) {
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
}
this->sub_128_1f4(7);
// 130:00d6
- this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ this->fillRect(2, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->sub_128_1f4(8);
// 130:011c
- this->sub_128_2f0(2, 0, 0, 0x152, 0x1fc);
+ this->fillRect(2, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0, 0x96, this->arr_i32_0[2]);
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
for (int i = 3; i < 5; i++) {
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[7]);
+ this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[7]);
}
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
this->sub_128_1f4(0);
// 130:01aa
g_zbasic->picture(0, 0, this->arr_i32_0[6]);
g_toolbox->ReleaseResource(this->arr_i32_0[6]);
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
//g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
- this->arr_i32_41296[1].copyFrom(this->arr_i32_41296[0]);
+ this->arr_i32_41296[1]->copyFrom(*this->arr_i32_41296[0]);
this->sub_128_1f4(1);
// 130:0202
g_zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
g_toolbox->ReleaseResource(this->arr_i32_0[7]);
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
this->sub_128_1f4(2);
// 130:0234
- this->sub_128_2f0(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
g_zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
g_toolbox->ReleaseResource(this->arr_i32_0[8]);
// 130:0276
for (int j = 9; j < 0xb; j++) {
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
if (j == 9) {
this->var_i16_74 = 0;
@@ -750,7 +751,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[j]);
g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
// 130:0320
this->sub_128_1f4(6);
@@ -759,7 +760,7 @@ void FoolPrologue::sub_130_004() {
// 130:034a
for (int i = 0xd; i < 0x12; i++) {
- this->sub_130_cea();
+ this->prologueBufferNextPicture();
}
this->arr_i32_0[0x48] = g_toolbox->GetPicture(0x48);
@@ -767,10 +768,10 @@ void FoolPrologue::sub_130_004() {
// 130:0380
if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
- this->sub_128_2f0(1, 0, 0, 0x14, 0x1fc);
+ this->fillRect(1, 0, 0, 0x14, 0x1fc);
} else {
g_toolbox->SetPort(this->var_i32_c);
- this->sub_128_2f0(2, 0, 0, 0x14, this->var_i16_10);
+ this->fillRect(2, 0, 0, 0x14, this->var_i16_10);
g_toolbox->SetPort(this->var_i32_8);
}
// 130:03e4
@@ -794,28 +795,28 @@ void FoolPrologue::sub_130_004() {
// 130:04ca
for (int j = 0; j < 3; j++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = &this->arr_i32_41296[8];
+ this->var_i32_40 = this->arr_i32_41296[8];
// 130:049e
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(4);
this->var_i16_192 = 0;
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = &this->arr_i32_41296[3];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[3];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
// 130:0518
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = &this->arr_i32_41296[4];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[4];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = &this->arr_i32_41296[5];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[5];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(5);
}
// 130:05b6
- this->var_i32_40 = &this->arr_i32_41296[7];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[7];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
}
@@ -824,7 +825,7 @@ void FoolPrologue::sub_130_004() {
this->sub_130_db0();
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_a8c(0xb4);
- this->var_i32_40 = &this->arr_i32_41296[1];
+ this->var_i32_40 = this->arr_i32_41296[1];
// 130:062c
int y = 0;
@@ -839,7 +840,7 @@ void FoolPrologue::sub_130_004() {
this->var_i16_5c.top = this->arr_i16_412ea[y] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[y];
// 130:068e
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
}
// 130:06b0
this->sub_128_a8c(1);
@@ -869,8 +870,8 @@ void FoolPrologue::sub_130_004() {
for (int j = 0; j < 8; j++) {
for (int i = 3; i < 5; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = &this->arr_i32_41296[i];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ this->var_i32_40 = this->arr_i32_41296[i];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
this->sub_128_a8c(3);
}
}
@@ -890,14 +891,14 @@ void FoolPrologue::sub_130_004() {
// 130:0890
// g_zbasic->52(0);
this->sub_128_1f4(0);
- this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->sub_130_f48();
this->sub_128_de2();
this->sub_128_1f4(1);
- this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->sub_130_f48();
@@ -905,7 +906,7 @@ void FoolPrologue::sub_130_004() {
// 130:0934
for (int i = 2; i < 5; i++) {
//g_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[1]);
+ this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[1]);
}
// 130:0978
for (int i = 1; i < 5; i++) {
@@ -923,11 +924,11 @@ void FoolPrologue::sub_130_004() {
}
// 130:0a42
this->sub_128_1f4(6);
- this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
this->sub_128_de2();
//g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
- this->arr_i32_41296[7].copyFrom(this->arr_i32_41296[6]);
+ this->arr_i32_41296[7]->copyFrom(*this->arr_i32_41296[6]);
this->sub_130_f48();
g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->sub_128_1f4(7);
@@ -935,8 +936,8 @@ void FoolPrologue::sub_130_004() {
g_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
this->sub_128_1f4(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
- this->arr_i32_41296[8].copyFrom(this->arr_i32_41296[7]);
- this->sub_128_2f0(0, 0x73, 0x15f, 0xf6, 0x1dc);
+ this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
+ this->fillRect(0, 0x73, 0x15f, 0xf6, 0x1dc);
g_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -991,7 +992,7 @@ void FoolPrologue::sub_130_004() {
// 130:0ca8
this->sub_128_610(0x6);
this->sub_128_e58();
- this->sub_128_50a(0, 0x7, 0, 0x1fc);
+ this->sub_128_50a(0x7, 0, 0x1fc, 0);
this->sub_128_21e(0xa);
this->sub_128_610(0x8);
this->sub_128_e58();
@@ -1002,16 +1003,16 @@ void FoolPrologue::sub_130_004() {
//this->sub_131_004();
}
-void FoolPrologue::sub_130_cea() {
+void FoolPrologue::prologueBufferNextPicture() {
// 130:0cea
this->var_i16_3d4 += 1;
this->arr_i32_0[this->var_i16_3d4] = g_toolbox->GetPicture(this->var_i16_3d4);
// 130:0d0a
- this->var_i16_3ce = this->var_i16_3d4 * 5 + 0xa;
- this->sub_130_d28();
+ this->var_i16_3ce = this->var_i16_3d4 * 5 + 10;
+ this->prologueDrawLoadingMsg();
}
-void FoolPrologue::sub_130_d28() {
+void FoolPrologue::prologueDrawLoadingMsg() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
g_zbasic->text(0, 0xc, kFacePlain, kModeSourceOR);
@@ -1020,7 +1021,7 @@ void FoolPrologue::sub_130_d28() {
this->var_str_76 += Common::U32String::format("%d", this->var_i16_3ce);
this->var_str_76 += g_zbasic->str(20);
// 130:0d70
- this->sub_128_2f0(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
+ this->fillRect(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
this->sub_128_2a6(0xe, this->var_i16_10/2);
g_toolbox->SetPort(this->var_i32_8);
}
@@ -1112,7 +1113,7 @@ void FoolPrologue::sub_131_004() {
// 131:00e6
for (int i = 6; i <= 9; i++) {
this->sub_128_1f4(i);
- this->sub_128_2f0(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, 0x152, 0x1fc);
// 131:0110
if (i < 8) {
g_zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
@@ -1153,10 +1154,10 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
- this->sub_128_2f0(0x1, 0, 0, 0x14, 0x1fc);
+ this->fillRect(0x1, 0, 0, 0x14, 0x1fc);
} else {
g_toolbox->SetPort(this->var_i32_c);
- this->sub_128_2f0(0x2, 0, 0, 0x14, this->var_i16_10);
+ this->fillRect(0x2, 0, 0, 0x14, this->var_i16_10);
g_toolbox->SetPort(this->var_i32_8);
}
// 131:02ec
@@ -1218,35 +1219,35 @@ void FoolPrologue::sub_131_004() {
// 131:04da
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i32_40 = &this->arr_i32_41296[5];
- g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
- this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->var_i32_40 = this->arr_i32_41296[5];
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
+ this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_131_4e48();
// 131:0538
- g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
g_toolbox->SetPortBits(this->var_i32_4e);
// 131:0554
- this->sub_128_2f0(0, 0, 0x9c, 0x15a, 0);
- this->sub_128_2f0(0x9c, 0x5a, 0xce, 0xa6, 0);
- this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->fillRect(0, 0, 0x9c, 0x15a, 0);
+ this->fillRect(0x9c, 0x5a, 0xce, 0xa6, 0);
+ this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
// 131:05b0
this->sub_128_1f4(6);
- g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(7);
- g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(8);
- g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
this->sub_128_1f4(9);
- g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
g_zbasic->get(0x1bc, 0xc1, 0x1ee, 0x117, this->arr_i32_3bca4);
this->sub_128_24a(0x3c);
- this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_128_50a(0x6, 0, 0x1fc, 0x3);
this->sub_131_4e48();
@@ -1254,7 +1255,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_50a(5, 0, 0x1fc, 2);
this->sub_128_50a(7, 0, 0x1fc, 2);
this->sub_128_50a(8, 0, 0x1fc, 1);
- this->sub_128_2f0(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_128_50a(0x9, 0, 0x1fc, 1);
g_toolbox->PenNormal();
g_toolbox->PenMode(0xa);
@@ -1358,7 +1359,7 @@ void FoolPrologue::sub_131_004() {
// 131:0c6c
for (int i = 0x6; i < 0xa; i++) {
//g_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i].copyFrom(this->arr_i32_41296[5]);
+ this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[5]);
}
this->sub_128_1f4(0x6);
g_zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
@@ -1394,34 +1395,34 @@ void FoolPrologue::sub_131_004() {
// 131:0e76
//g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
- this->arr_i32_41296[5].copyFrom(this->arr_i32_41296[4]);
+ this->arr_i32_41296[5]->copyFrom(*this->arr_i32_41296[4]);
this->sub_128_1f4(0x5);
g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
g_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
this->sub_128_1f4(0x6);
- this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
+ this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
this->sub_128_1f4(0x7);
- this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
+ this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
//g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
- this->arr_i32_41296[8].copyFrom(this->arr_i32_41296[5]);
+ this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
this->sub_128_1f4(0x8);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
//g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
- this->arr_i32_41296[9].copyFrom(this->arr_i32_41296[4]);
+ this->arr_i32_41296[9]->copyFrom(*this->arr_i32_41296[4]);
this->sub_128_1f4(0x9);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
this->sub_128_1f4(0xa);
- this->sub_128_2f0(0, 0, 0x152, 0x1fc, 2);
+ this->fillRect(0, 0, 0x152, 0x1fc, 2);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0x78);
- this->sub_128_2f0(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
+ this->fillRect(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
this->sub_128_21e(0x28);
@@ -1436,21 +1437,21 @@ void FoolPrologue::sub_131_004() {
// 131:10de
this->var_i32_2 = g_toolbox->TickCount();
//g_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
- this->var_i32_4e->copyFrom(this->arr_i32_41296[5]);
+ this->var_i32_4e->copyFrom(*this->arr_i32_41296[5]);
this->var_i16_64.top = i;
this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
- this->var_i32_40 = &this->arr_i32_41296[6];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
- this->var_i32_40 = &this->arr_i32_41296[7];
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
+ this->var_i32_40 = this->arr_i32_41296[6];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
+ this->var_i32_40 = this->arr_i32_41296[7];
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
this->sub_128_24a(0x2);
- g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
}
// 131:11a4
this->sub_128_1ba(0x5);
this->sub_128_1f4(0x5);
- this->sub_128_2f0(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
+ this->fillRect(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
@@ -1485,7 +1486,7 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_1f4(0x5);
- this->sub_128_2f0(0, 0, 0x152, 0x1fc, 0);
+ this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
this->sub_128_24a(0xa);
@@ -1501,7 +1502,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
this->var_i16_64.top = i - 1;
this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
- g_toolbox->CopyBits(*this->var_i32_32, *this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
this->sub_128_24a(0x1);
}
@@ -1526,23 +1527,23 @@ void FoolPrologue::sub_131_004() {
this->var_i16_3e0 = 0x64;
// 131:14d8
- this->var_i32_40 = &this->arr_i32_41296[5];
+ this->var_i32_40 = this->arr_i32_41296[5];
g_toolbox->SetPortBits(this->var_i32_4e);
for (int i = 1; i < 0xf; i++) {
this->var_i32_2 = g_toolbox->TickCount();
//g_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
- this->var_i32_4e->copyFrom(this->arr_i32_41296[6]);
+ this->var_i32_4e->copyFrom(*this->arr_i32_41296[6]);
this->var_i16_3e0 += 5 + i*2;
this->var_i16_64.left = 0x1e0;
this->var_i16_64.right = this->var_i16_64.left + 0x32;
this->var_i16_64.top = this->var_i16_3e0;
this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
- g_toolbox->CopyBits(*this->var_i32_40, *this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 2, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 2, 0);
// 131:1582
g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
this->sub_128_24a(0x1);
- g_toolbox->CopyBits(*this->var_i32_4e, *this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
}
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1590,7 +1591,7 @@ void FoolPrologue::sub_131_4dc0() {
this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
g_zbasic->bufferFlush(this->var_str_76);
// 131:4e08
- this->sub_128_2f0(0, 7, 0x13, this->var_i16_10 - 7, 0);
+ this->fillRect(0, 7, 0x13, this->var_i16_10 - 7, 0);
this->sub_128_2a6(this->var_i16_10 / 2, 0xe);
g_toolbox->SetPort(this->var_i32_8);
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index ff172d37466..e4e9aa2a254 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -45,7 +45,7 @@ public:
void sub_128_24a(int16 numTicks);
void sub_128_26c(int16 unk1, int16 unk2);
void sub_128_2a6(int16 unk1, int16 unk2);
- void sub_128_2f0(int16 pattern_id, int16 top, int16 left, int16 bottom, int16 right);
+ void fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right); // sub_128_2f0
void sub_128_354(uint16 unk1, uint16 unk2);
void sub_128_3ee(int16 unk1);
void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
@@ -70,8 +70,8 @@ public:
void sub_129_772();
void sub_130_004();
- void sub_130_cea();
- void sub_130_d28();
+ void prologueBufferNextPicture();
+ void prologueDrawLoadingMsg();
void sub_130_db0();
void sub_130_e82();
void sub_130_f48();
@@ -101,14 +101,14 @@ private:
WindowRecord var_window_24;
- Graphics::Surface *var_i32_32;
+ BitMap var_i32_32;
int16 var_i16_36;
Common::Rect var_i16_38;
- Graphics::Surface *var_i32_40;
+ BitMap var_i32_40;
int16 var_i16_44;
Common::Rect var_i16_46;
- Graphics::Surface *var_i32_4e;
+ BitMap var_i32_4e;
int16 var_i16_52;
Common::Rect var_i16_54;
@@ -178,9 +178,9 @@ private:
byte arr_i32_b54[SCREEN_PAGE_SIZE*12];
- Graphics::Surface arr_i32_3bca4;
+ BitMap arr_i32_3bca4;
- Graphics::Surface arr_i32_41296[12];
+ BitMap arr_i32_41296[12];
int16 arr_i16_412ea[SCREEN_HEIGHT];
int16 arr_i16_41598[SCREEN_HEIGHT];
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index a9a6dfa6f80..54ded0bfd92 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -86,7 +86,7 @@ void Toolbox::ClipRect(Common::Rect &r) {
warning("STUB: Toolbox::ClipRect");
}
-void Toolbox::CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn) {
+void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn) {
warning("STUB: Toolbox::CopyBits");
}
@@ -255,7 +255,7 @@ void Toolbox::SetPort(GrafPtr port) {
warning("STUB: Toolbox::SetPort");
}
-void Toolbox::SetPortBits(const Graphics::Surface *bm) {
+void Toolbox::SetPortBits(BitMap &bm) {
warning("STUB: Toolbox::SetPortBits");
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 861bcb5ecb3..769492316b8 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -38,6 +38,7 @@ namespace Fool {
typedef Common::SharedPtr<Common::Array<byte>> Handle;
typedef Handle RgnHandle;
typedef Common::SharedPtr<Graphics::ManagedSurface> PicHandle;
+typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Handle PolyHandle;
typedef uint32 ResType;
typedef size_t Size;
@@ -113,7 +114,7 @@ enum WindowDefinition {
struct GrafPort {
uint16 device;
- Graphics::Surface *portBits;
+ BitMap portBits;
Common::Rect portRect;
RgnHandle visRgn;
RgnHandle clipRgn;
@@ -286,7 +287,7 @@ public:
// just pass NIL for the maskRgn parameter. The dstRect and maskRgn coordinates are in terms of
// the dstBits.bounds coordinate system, and the srcRect coordinates are in terms of the
// srcBits.bounds coordinates.
- void CopyBits(const Graphics::Surface &srcBits, Graphics::Surface &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn);
+ void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn);
// PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
// Delay causes the system to wait for the number of ticks (sixtieths of a second) specified by numTicks, and returns in finalTicks the total number of ticks from system startup to the end of the delay.
@@ -490,7 +491,7 @@ public:
// allows you to perform all normal drawing and calculations on a buffer other than the screenâfor
// example, a small off-screen image for later "stamping" onto the screen (with the CopyBits
// procedure, described under "Bit Transfer Operations" below).
- void SetPortBits(const Graphics::Surface *bm);
+ void SetPortBits(BitMap &bm);
// PROCEDURE SetRect (VAR r: Rect; left,top,right,bottom: INTEGER);
// SetRect assigns the four boundary coordinates to the given rectangle. The result is a rectangle
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 9e5dd1e4048..f00d5fb4fc0 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -172,7 +172,7 @@ void ZBasic::coordinateWindow() {
warning("STUB: ZBasic::coordinateWindow");
}
-void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest) {
+void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest) {
warning("STUB: ZBasic::get");
}
@@ -207,10 +207,7 @@ void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
warning("ZBasic::picture: Empty handle");
return;
}
- if (debugLevelSet(5)) {
- Graphics::Surface *srf = src->surfacePtr();
- Common::hexdump((const byte *)srf->getPixels(), srf->pitch*srf->h);
- }
+
Common::Rect srcRect(0, 0, src->w, src->h);
Common::Rect destRect(x, y, x+src->w, y+src->h);
_window->getWindowSurface()->blitFrom(*src, srcRect, destRect);
@@ -222,11 +219,11 @@ void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
warning("STUB: ZBasic::picture");
}
-void ZBasic::put(int16 x, int16 y, Graphics::Surface &src) {
- this->put(x, y, x+src.w, y+src.h, src);
+void ZBasic::put(int16 x, int16 y, BitMap &src) {
+ this->put(x, y, x+src->w, y+src->h, src);
}
-void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src) {
+void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src) {
warning("STUB: ZBasic::put");
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 34913506b20..d69a5a44acb 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -246,7 +246,7 @@ public:
Common::U32String chr(uint16 code);
void close(int16 fileNo);
void coordinateWindow();
- void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &dest);
+ void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
int finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume);
bool maybe();
@@ -254,8 +254,8 @@ public:
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
- void put(int16 x, int16 y, Graphics::Surface &src);
- void put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::Surface &src);
+ void put(int16 x, int16 y, BitMap &src);
+ void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src);
Common::Array<byte> read(int16 fileNo, uint32 length);
int16 readInt();
Common::U32String readStr();
Commit: 665bd2797163e63e40b8fd359586fb78efb43330
https://github.com/scummvm/scummvm/commit/665bd2797163e63e40b8fd359586fb78efb43330
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:48+02:00
Commit Message:
FOOL: Split QuickDraw methods
Changed paths:
A engines/fool/toolbox_quickdraw.cpp
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_resman.cpp
graphics/macgui/macwindowmanager.h
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 88b4cad48ab..922bcf4c89f 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS = \
fool.o \
fool_prologue.o \
toolbox.o \
+ toolbox_quickdraw.o \
toolbox_resman.o \
zbasic.o \
console.o \
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 54ded0bfd92..74f1d2ec95d 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -19,15 +19,10 @@
*
*/
-#include "common/memstream.h"
#include "common/system.h"
-#include "graphics/macgui/macwindowmanager.h"
-#include "image/pict.h"
-
#include "fool/fool.h"
#include "fool/toolbox.h"
-#include "fool/utils.h"
namespace Fool {
@@ -70,26 +65,6 @@ void Toolbox::_updateScreen() {
_frameLimiter->startFrame();
}
-void Toolbox::BeginUpdate(WindowRecord &theWindow) {
- warning("STUB: Toolbox::BeginUpdate");
-}
-
-void Toolbox::ClearMenuBar() {
- warning("STUB: Toolbox::ClearMenuBar");
-}
-
-void Toolbox::ClosePoly() {
- warning("STUB: Toolbox::ClosePoly");
-}
-
-void Toolbox::ClipRect(Common::Rect &r) {
- warning("STUB: Toolbox::ClipRect");
-}
-
-void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn) {
- warning("STUB: Toolbox::CopyBits");
-}
-
uint32 Toolbox::Delay(uint32 numTicks) {
uint32 target = g_system->getMillis() + (numTicks * 1000 / 60);
while (g_system->getMillis() < target) {
@@ -99,38 +74,6 @@ uint32 Toolbox::Delay(uint32 numTicks) {
return (uint32)(g_system->getMillis() * 60 / 1000);
}
-void Toolbox::DrawString(const Common::String &s) {
- warning("STUB: Toolbox::DrawString");
-}
-
-void Toolbox::EndUpdate(WindowRecord &theWindow) {
- warning("STUB: Toolbox::EndUpdate");
-}
-
-void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
- warning("STUB: Toolbox::FillOval");
-}
-
-void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
- warning("STUB: Toolbox::FillRect");
-}
-
-void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle) {
- warning("STUB: Toolbox::FrameArc");
-}
-
-void Toolbox::FrameOval(const Common::Rect &r) {
- warning("STUB: Toolbox::FrameOval");
-}
-
-void Toolbox::FrameRect(const Common::Rect &r) {
- warning("STUB: Toolbox::FrameRect");
-}
-
-void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
- warning("STUB: Toolbox::GetCPixel");
-}
-
bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
warning("STUB: Toolbox::GetNextEvent");
_pumpEvents();
@@ -144,141 +87,6 @@ bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
return true;
}
-PicHandle Toolbox::GetPicture(uint16 picID) {
- Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
- if (handle) {
- Common::MemoryReadStream stream(handle->data(), handle->size());
- Image::PICTDecoder decoder;
- if (decoder.loadStream(stream)) {
- const Graphics::Surface *surface = decoder.getSurface();
- const Graphics::Palette &palette = decoder.getPalette();
- PicHandle result(createRemappedSurface(surface, palette.data(), palette.size()));
- _resPicts[result] = handle;
- return result;
- }
- }
-
- return nullptr;
-}
-
-void Toolbox::HideCursor() {
- _cursorLevel--;
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
-}
-
-void Toolbox::InitCursor() {
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
- _cursorLevel = 0;
-}
-
-void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
- warning("STUB: Toolbox::InsetRect");
-}
-
-void Toolbox::InvertOval(const Common::Rect &r) {
- warning("STUB: Toolbox::InvertOval");
-}
-
-void Toolbox::InvertRect(const Common::Rect &r) {
- warning("STUB: Toolbox::InvertRect");
-}
-
-void Toolbox::KillPoly(PolyHandle poly) {
- warning("STUB: Toolbox::KillPoly");
-}
-
-void Toolbox::LineTo(int16 h, int16 v) {
- warning("STUB: Toolbox::LineTo");
-}
-
-void Toolbox::MovePortTo(int16 leftGlobal, int16 topGlobal) {
- warning("STUB: Toolbox::MovePortTo");
-}
-
-void Toolbox::MoveTo(int16 h, int16 v) {
- warning("STUB: Toolbox::MoveTo");
-}
-
-PolyHandle Toolbox::OpenPoly() {
- warning("STUB: Toolbox::OpenPoly");
- return 0;
-}
-
-void Toolbox::OpenPort(GrafPtr port) {
- warning("STUB: Toolbox::OpenPort");
- // source: QuickDraw Routines I-163
- port->device = 0;
- //port->portBits = screenBits;
- //port->portRect = screenBits.bounds;
- //port->visRgn
- //port->clipRgn
- //port->bkPat = white
-}
-
-void Toolbox::PaintOval(const Common::Rect &r) {
- warning("STUB: Toolbox::PaintOval");
-}
-
-void Toolbox::PaintPoly(PolyHandle poly) {
- warning("STUB: Toolbox::PaintPoly");
-}
-
-void Toolbox::PaintRect(const Common::Rect &r) {
- warning("STUB: Toolbox::PaintRect");
-}
-
-void Toolbox::PenMode(uint16 mode) {
- warning("STUB: Toolbox::PenMode");
-}
-
-void Toolbox::PenNormal() {
- warning("STUB: Toolbox::PenNormal");
-}
-
-void Toolbox::PenPat(const Pattern &pat) {
- warning("STUB: Toolbox::PenPat");
-}
-
-void Toolbox::PenSize(uint16 width, uint16 height) {
- warning("STUB: Toolbox::PenSize");
-}
-
-void Toolbox::PortSize(uint16 width, uint16 height) {
- warning("STUB: Toolbox::PortSize");
-}
-
-void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
- warning("STUB: Toolbox::SetCPixel");
-}
-
-void Toolbox::SetPort(GrafPtr port) {
- warning("STUB: Toolbox::SetPort");
-}
-
-void Toolbox::SetPortBits(BitMap &bm) {
- warning("STUB: Toolbox::SetPortBits");
-}
-
-void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
- r.left = left;
- r.top = top;
- r.right = right;
- r.bottom = bottom;
-}
-
-void Toolbox::ShowCursor() {
- if (_cursorLevel < 0)
- _cursorLevel++;
- if (_cursorLevel == 0)
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
-}
-
-
-uint16 Toolbox::StringWidth(const Common::String &s) {
- warning("STUB: Toolbox::StringWidth");
- return 0;
-}
-
uint32 Toolbox::TickCount() {
return (uint32)(g_system->getMillis() * 60 / 1000);
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 769492316b8..715a168c70d 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -30,6 +30,7 @@
#include "graphics/framelimiter.h"
#include "graphics/macgui/macwindow.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "fool/siphash/halfsip.h"
@@ -163,6 +164,27 @@ public:
Toolbox();
~Toolbox();
+ // toolbox.cpp
+
+ // PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
+ // Delay causes the system to wait for the number of ticks (sixtieths of a second) specified by numTicks, and returns in finalTicks the total number of ticks from system startup to the end of the delay.
+ uint32 Delay(uint32 numTicks);
+
+ // FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord) : BOOLEAN;
+ // GetNextEvent returns the next available event of a specified type or types and, if the event is in
+ // the event queue, removes it from the queue. The event is returned in the parameter theEvent. The
+ // eventMask parameter specifies which event types are of interest. GetNextEvent returns the next
+ // available event of any type designated by the mask, subject to the priority rules discussed above
+ // under "Priority of Events". If no event of any of the designated types is available, GetNextEvent
+ // returns a null event.
+ bool GetNextEvent(uint16 eventMask, EventRecord &theEvent);
+
+ // FUNCTION TickCount : LONGINT;
+ // TickCount returns the current number of ticks (sixtieths of a second) since the system last started
+ // up.
+ uint32 TickCount();
+
+
// toolbox_resman.cpp
// FUNCTION CurResFile: INTEGER;
@@ -196,7 +218,7 @@ public:
// Given a handle to a resource, GetResInfo returns the ID number, type, and name of the resource.
// If the given handle isn't a handle to a resource, GetResInfo will do nothing and the ResError
// function will return the result code resNotFound.
- void GetResInfo(Handle &theResource, int16 &theID, ResType &theType, Common::String &name);
+ void GetResInfo(Handle &theResource, uint16 &theID, ResType &theType, Common::String &name);
// FUNCTION GetResource (theType: ResType; theID: INTEGER) : Handle;
// GetResource returns a handle to the resource having the given type and ID number, reading
@@ -251,6 +273,7 @@ public:
void UseResFile(int16 refNum);
+ // toolbox_quickdraw.cpp
// PROCEDURE BeginUpdate (theWindow: WindowPtr);
// Call BeginUpdate when an update event occurs for theWindow. BeginUpdate replaces the
@@ -289,10 +312,6 @@ public:
// srcBits.bounds coordinates.
void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn);
- // PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
- // Delay causes the system to wait for the number of ticks (sixtieths of a second) specified by numTicks, and returns in finalTicks the total number of ticks from system startup to the end of the delay.
- uint32 Delay(uint32 numTicks);
-
// PROCEDURE DrawChar (ch: CHAR);
// DrawChar places the given character to the right of the pen location, with the left end of its base
// line at the pen's location, and advances the pen accordingly. If the character isn't in the font, the
@@ -347,15 +366,6 @@ public:
// port.
void GetCPixel(int16 h, int16 v, RGBColor &cPix);
- // FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord) : BOOLEAN;
- // GetNextEvent returns the next available event of a specified type or types and, if the event is in
- // the event queue, removes it from the queue. The event is returned in the parameter theEvent. The
- // eventMask parameter specifies which event types are of interest. GetNextEvent returns the next
- // available event of any type designated by the mask, subject to the priority rules discussed above
- // under "Priority of Events". If no event of any of the designated types is available, GetNextEvent
- // returns a null event.
- bool GetNextEvent(uint16 eventMask, EventRecord &theEvent);
-
// FUNCTION GetPicture (picID: INTEGER) : PicHandle;
// GetPicture returns a handle to the picture having the given resource ID, reading it from the
// resource file if necessary. It calls the Resource Manager function GetResource('PICT',picID). If
@@ -510,11 +520,6 @@ public:
// CharWidths of all the characters in the string (see above).
uint16 StringWidth(const Common::String &s);
- // FUNCTION TickCount : LONGINT;
- // TickCount returns the current number of ticks (sixtieths of a second) since the system last started
- // up.
- uint32 TickCount();
-
private:
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
Common::Array<int16> _resOrder;
@@ -527,6 +532,8 @@ private:
Common::Queue<EventRecord> _events;
+ Graphics::MacPlotData _pd;
+
void _pumpEvents();
void _updateScreen();
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
new file mode 100644
index 00000000000..40f25a4cdaf
--- /dev/null
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -0,0 +1,222 @@
+/* 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/memstream.h"
+#include "common/system.h"
+
+#include "graphics/macgui/macwindowmanager.h"
+#include "image/pict.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+#include "fool/utils.h"
+
+namespace Fool {
+
+void Toolbox::BeginUpdate(WindowRecord &theWindow) {
+ warning("STUB: Toolbox::BeginUpdate");
+}
+
+void Toolbox::ClearMenuBar() {
+ warning("STUB: Toolbox::ClearMenuBar");
+}
+
+void Toolbox::ClosePoly() {
+ warning("STUB: Toolbox::ClosePoly");
+}
+
+void Toolbox::ClipRect(Common::Rect &r) {
+ warning("STUB: Toolbox::ClipRect");
+}
+
+void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn) {
+ warning("STUB: Toolbox::CopyBits");
+}
+
+void Toolbox::DrawString(const Common::String &s) {
+ warning("STUB: Toolbox::DrawString");
+}
+
+void Toolbox::EndUpdate(WindowRecord &theWindow) {
+ warning("STUB: Toolbox::EndUpdate");
+}
+
+void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
+ warning("STUB: Toolbox::FillOval");
+}
+
+void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
+ warning("STUB: Toolbox::FillRect");
+}
+
+void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle) {
+ warning("STUB: Toolbox::FrameArc");
+}
+
+void Toolbox::FrameOval(const Common::Rect &r) {
+ warning("STUB: Toolbox::FrameOval");
+}
+
+void Toolbox::FrameRect(const Common::Rect &r) {
+ warning("STUB: Toolbox::FrameRect");
+}
+
+void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
+ warning("STUB: Toolbox::GetCPixel");
+}
+
+PicHandle Toolbox::GetPicture(uint16 picID) {
+ Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
+ if (handle) {
+ Common::MemoryReadStream stream(handle->data(), handle->size());
+ Image::PICTDecoder decoder;
+ if (decoder.loadStream(stream)) {
+ const Graphics::Surface *surface = decoder.getSurface();
+ const Graphics::Palette &palette = decoder.getPalette();
+ PicHandle result(createRemappedSurface(surface, palette.data(), palette.size()));
+ _resPicts[result] = handle;
+ return result;
+ }
+ }
+
+ return nullptr;
+}
+
+void Toolbox::HideCursor() {
+ _cursorLevel--;
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
+}
+
+void Toolbox::InitCursor() {
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ _cursorLevel = 0;
+}
+
+void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
+ warning("STUB: Toolbox::InsetRect");
+}
+
+void Toolbox::InvertOval(const Common::Rect &r) {
+ warning("STUB: Toolbox::InvertOval");
+}
+
+void Toolbox::InvertRect(const Common::Rect &r) {
+ warning("STUB: Toolbox::InvertRect");
+}
+
+void Toolbox::KillPoly(PolyHandle poly) {
+ warning("STUB: Toolbox::KillPoly");
+}
+
+void Toolbox::LineTo(int16 h, int16 v) {
+ warning("STUB: Toolbox::LineTo");
+}
+
+void Toolbox::MovePortTo(int16 leftGlobal, int16 topGlobal) {
+ warning("STUB: Toolbox::MovePortTo");
+}
+
+void Toolbox::MoveTo(int16 h, int16 v) {
+ warning("STUB: Toolbox::MoveTo");
+}
+
+PolyHandle Toolbox::OpenPoly() {
+ warning("STUB: Toolbox::OpenPoly");
+ return 0;
+}
+
+void Toolbox::OpenPort(GrafPtr port) {
+ warning("STUB: Toolbox::OpenPort");
+ // source: QuickDraw Routines I-163
+ port->device = 0;
+ //port->portBits = screenBits;
+ //port->portRect = screenBits.bounds;
+ //port->visRgn
+ //port->clipRgn
+ //port->bkPat = white
+}
+
+void Toolbox::PaintOval(const Common::Rect &r) {
+ warning("STUB: Toolbox::PaintOval");
+}
+
+void Toolbox::PaintPoly(PolyHandle poly) {
+ warning("STUB: Toolbox::PaintPoly");
+}
+
+void Toolbox::PaintRect(const Common::Rect &r) {
+ warning("STUB: Toolbox::PaintRect");
+}
+
+void Toolbox::PenMode(uint16 mode) {
+ warning("STUB: Toolbox::PenMode");
+}
+
+void Toolbox::PenNormal() {
+ warning("STUB: Toolbox::PenNormal");
+}
+
+void Toolbox::PenPat(const Pattern &pat) {
+ warning("STUB: Toolbox::PenPat");
+}
+
+void Toolbox::PenSize(uint16 width, uint16 height) {
+ warning("STUB: Toolbox::PenSize");
+}
+
+void Toolbox::PortSize(uint16 width, uint16 height) {
+ warning("STUB: Toolbox::PortSize");
+}
+
+void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
+ warning("STUB: Toolbox::SetCPixel");
+}
+
+void Toolbox::SetPort(GrafPtr port) {
+ warning("STUB: Toolbox::SetPort");
+}
+
+void Toolbox::SetPortBits(BitMap &bm) {
+ warning("STUB: Toolbox::SetPortBits");
+}
+
+void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
+ r.left = left;
+ r.top = top;
+ r.right = right;
+ r.bottom = bottom;
+}
+
+void Toolbox::ShowCursor() {
+ if (_cursorLevel < 0)
+ _cursorLevel++;
+ if (_cursorLevel == 0)
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+}
+
+
+uint16 Toolbox::StringWidth(const Common::String &s) {
+ warning("STUB: Toolbox::StringWidth");
+ return 0;
+}
+
+
+} // namespace Fool
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index d0f9e48426a..78269c338c0 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -40,10 +40,11 @@ void Toolbox::DetachResource(Handle &handle) {
}
void Toolbox::DisposHandle(Handle &h) {
- // Our Handles are reference counted, do nothing.
+ // Our Handles are reference counted, don't free anything but invalidate this handle.
+ h = nullptr;
};
-void Toolbox::GetResInfo(Handle &theResource, int16 &theID, ResType &theType, Common::String &name) {
+void Toolbox::GetResInfo(Handle &theResource, uint16 &theID, ResType &theType, Common::String &name) {
if (_resInfo.contains(theResource)) {
ToolboxResInfo &info = _resInfo[theResource];
theID = info.resID;
@@ -134,6 +135,7 @@ void Toolbox::ReleaseResource(Handle &handle) {
if (_resInfo.contains(handle)) {
_resInfo.erase(handle);
}
+ this->DisposHandle(handle);
}
void Toolbox::ReleaseResource(PicHandle &handle) {
@@ -143,6 +145,7 @@ void Toolbox::ReleaseResource(PicHandle &handle) {
_resPicts.erase(handle);
this->ReleaseResource(target);
}
+ handle = nullptr;
}
int32 Toolbox::SizeResource(Handle &theResource) {
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 9c456099291..55375e2e3b4 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -125,6 +125,8 @@ struct MacPlotData {
uint bgColor;
bool invert;
+ MacPlotData() : surface(nullptr), mask(nullptr), patterns(nullptr), fillType(0), fillOriginX(0), fillOriginY(0), thickness(1), bgColor(0), invert(false) {}
+
MacPlotData(Graphics::ManagedSurface *s, Graphics::ManagedSurface *m, MacPatterns *p, uint f, int fx, int fy, int t, uint bg, bool inv = false) :
surface(s), mask(m), patterns(p), fillType(f), fillOriginX(fx), fillOriginY(fy), thickness(t), bgColor(bg), invert(inv) {
}
Commit: 888fecc4c2f606bd472e08fec1254b359f1af3e8
https://github.com/scummvm/scummvm/commit/888fecc4c2f606bd472e08fec1254b359f1af3e8
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:48+02:00
Commit Message:
FOOL: Implement GrafPort commands
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index ae1e0bf00ae..0409a7b0b5b 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -122,7 +122,7 @@ void FoolPrologue::sub_128_004() {
void FoolPrologue::sub_128_1ba(int16 screenPage) {
// 128:01ba
this->var_i32_40 = this->arr_i32_41296[screenPage];
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::sub_128_1f4(int16 screenPage) {
@@ -165,11 +165,11 @@ void FoolPrologue::fillRect(int16 patternID, int16 top, int16 left, int16 bottom
g_toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[patternID]);
}
-void FoolPrologue::sub_128_354(uint16 unk1, uint16 unk2) {
+void FoolPrologue::sub_128_354(PatternMode mode, uint16 unk2) {
// 128:0354
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->PenPat(this->arr_pat_194[unk2]);
- g_toolbox->PenMode(unk1);
+ g_toolbox->PenMode(mode);
g_toolbox->PenSize(6, 4);
for (int i = 0; i <= 130; i += 3) {
@@ -234,7 +234,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = this->arr_i16_412ea[i] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[i];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
if (i % unk1 == 0) {
this->sub_128_24a(0);
}
@@ -244,7 +244,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
void FoolPrologue::sub_128_610(int16 screenPage) {
// 128:0610
this->var_i32_40 = this->arr_i32_41296[screenPage];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::sub_128_64a(int16 unk1) {
@@ -272,9 +272,9 @@ void FoolPrologue::sub_128_6e4(int16 screenPage) {
this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
}
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
@@ -288,7 +288,7 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_i16_41afc.bottom = unk3;
this->arr_i16_41afc.right = unk2;
g_toolbox->PenNormal();
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
// 128:08bc
this->arr_f64_41bbe[0] = (double)this->arr_i16_41af4.top;
@@ -328,7 +328,7 @@ void FoolPrologue::sub_128_a6c(int16_t unk1, int16_t unk2) {
void FoolPrologue::sub_128_a8c(int16_t unk) {
// 128:0a8c
this->var_i16_1a4 = unk;
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
do {
// 128:0a96
this->sub_130_e82();
@@ -384,14 +384,14 @@ void FoolPrologue::sub_128_ccc() {
void FoolPrologue::sub_128_de2() {
// 128:0de2
- g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceXOR);
+ g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
this->var_str_76 = g_zbasic->str(3);
this->sub_128_a6c(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
- g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceXOR);
+ g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
this->var_str_76 = g_zbasic->str(4);
this->sub_128_26c(0x154, 0x1f7);
}
@@ -558,7 +558,7 @@ void FoolPrologue::sub_129_004() {
// 129:0386
this->fillRect(2, 0x50, 0x6e, 0xc3, 0x18e);
- g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
+ g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
// "not enough memory" message
this->var_str_76 = g_zbasic->str(6);
this->sub_128_2a6(0x64, 0xfc);
@@ -627,7 +627,7 @@ void FoolPrologue::sub_129_004() {
this->fillRect(1, 0x69, 0x83, 0xd3, 0x175);
this->fillRect(2, 0x6e, 0x88, 0xce, 0x170);
// 129:0662
- g_zbasic->text(0, 0xc, kFacePlain, kModeSourceBIC);
+ g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
// "set your monitor to black and white" message"
this->var_str_76 = g_zbasic->str(13);
this->sub_128_2a6(0x82, 0xfc);
@@ -686,7 +686,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
- g_zbasic->text(0xfb, 0x9, kFacePlain, kModeSourceBIC);
+ g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcBic);
this->var_str_76 = g_zbasic->str(18);
this->sub_128_2a6(0x10d, 0xdd);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -797,26 +797,26 @@ void FoolPrologue::sub_130_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[8];
// 130:049e
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->sub_128_a8c(4);
this->var_i16_192 = 0;
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[3];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->sub_128_a8c(5);
// 130:0518
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[4];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->sub_128_a8c(5);
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[5];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->sub_128_a8c(5);
}
// 130:05b6
this->var_i32_40 = this->arr_i32_41296[7];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
}
@@ -840,7 +840,7 @@ void FoolPrologue::sub_130_004() {
this->var_i16_5c.top = this->arr_i16_412ea[y] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[y];
// 130:068e
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
}
// 130:06b0
this->sub_128_a8c(1);
@@ -871,7 +871,7 @@ void FoolPrologue::sub_130_004() {
for (int i = 3; i < 5; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[i];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->sub_128_a8c(3);
}
}
@@ -996,7 +996,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_21e(0xa);
this->sub_128_610(0x8);
this->sub_128_e58();
- this->sub_128_354(8, 1);
+ this->sub_128_354(kPatCopy, 1);
// 130:0ce6
// JMP 1002
// g_zbasic->pushOldCodeResource(0x82);
@@ -1015,7 +1015,7 @@ void FoolPrologue::prologueBufferNextPicture() {
void FoolPrologue::prologueDrawLoadingMsg() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, kFacePlain, kModeSourceOR);
+ g_zbasic->text(0, 0xc, kFacePlain, kSrcOr);
// "loading prologue" message
this->var_str_76 = g_zbasic->str(19);
this->var_str_76 += Common::U32String::format("%d", this->var_i16_3ce);
@@ -1029,7 +1029,7 @@ void FoolPrologue::prologueDrawLoadingMsg() {
void FoolPrologue::sub_130_db0() {
// 130:0db0
g_zbasic->unk_20();
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
// 130:0dc0
@@ -1073,7 +1073,7 @@ void FoolPrologue::sub_130_f48() {
}
}
// 130:0fc8
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
this->sub_128_a6c(this->var_i16_180, this->var_i16_176);
}
}
@@ -1179,7 +1179,7 @@ void FoolPrologue::sub_131_004() {
}
// 131:0380
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
this->sub_128_3ee(0x14);
this->sub_128_3ee(0xa);
this->sub_128_3ee(0x14);
@@ -1192,7 +1192,7 @@ void FoolPrologue::sub_131_004() {
// 131:03c0
this->sub_128_21e(0x1e);
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(22));
g_zbasic->bufferFlush(this->var_str_76);
@@ -1220,12 +1220,12 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[5];
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_131_4e48();
// 131:0538
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
g_toolbox->SetPortBits(this->var_i32_4e);
// 131:0554
@@ -1235,13 +1235,13 @@ void FoolPrologue::sub_131_004() {
// 131:05b0
this->sub_128_1f4(6);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
this->sub_128_1f4(7);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
this->sub_128_1f4(8);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
this->sub_128_1f4(9);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1258,7 +1258,7 @@ void FoolPrologue::sub_131_004() {
this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_128_50a(0x9, 0, 0x1fc, 1);
g_toolbox->PenNormal();
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
g_zbasic->unk_20();
// 131:0730
@@ -1387,7 +1387,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_21e(0x3c);
// 131:0e08
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(23));
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_a6c(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
@@ -1441,11 +1441,11 @@ void FoolPrologue::sub_131_004() {
this->var_i16_64.top = i;
this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
this->var_i32_40 = this->arr_i32_41296[6];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 3, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcBic, nullptr);
this->var_i32_40 = this->arr_i32_41296[7];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 1, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcOr, nullptr);
this->sub_128_24a(0x2);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, kSrcCopy, nullptr);
}
// 131:11a4
@@ -1455,7 +1455,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
g_toolbox->PenSize(0x5, 0x5);
// 131:1208
@@ -1464,7 +1464,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24).encode().c_str());
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_26c(0x1f0, 0xd2);
@@ -1502,7 +1502,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
this->var_i16_64.top = i - 1;
this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, kSrcCopy, nullptr);
this->sub_128_24a(0x1);
}
@@ -1514,7 +1514,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
this->sub_128_1ba(0x6);
g_toolbox->PenNormal();
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
g_toolbox->PenSize(0x3, 0x3);
this->var_i16_6c.left = 0x190;
this->var_i16_6c.right = SCREEN_WIDTH;
@@ -1538,17 +1538,17 @@ void FoolPrologue::sub_131_004() {
this->var_i16_64.right = this->var_i16_64.left + 0x32;
this->var_i16_64.top = this->var_i16_3e0;
this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, 2, 0);
+ g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcXor, nullptr);
// 131:1582
g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
this->sub_128_24a(0x1);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, 0, 0);
+ g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, kSrcCopy, nullptr);
}
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
- g_toolbox->PenMode(0xa);
+ g_toolbox->PenMode(kPatXor);
for (int j = 0; j < 1; j++) {
for (int i = 1; i < 0xfa; i++) {
@@ -1573,7 +1573,7 @@ void FoolPrologue::sub_131_004() {
}
this->sub_128_24a(0x3c);
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceBIC);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
g_zbasic->bufferFlush(this->var_str_76);
this->sub_128_26c(0x17d, 0x3c);
@@ -1585,7 +1585,7 @@ void FoolPrologue::sub_131_004() {
void FoolPrologue::sub_131_4dc0() {
// 131:4dc0
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, kFacePlain, kModeSourceOR);
+ g_zbasic->text(0, 0xc, kFacePlain, kSrcOr);
// Loading Finale
this->var_str_76 += g_zbasic->str(78);
this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
@@ -1599,7 +1599,7 @@ void FoolPrologue::sub_131_4dc0() {
void FoolPrologue::sub_131_4e48() {
// 131:4e48
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceOR);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
// Uh oh . . .
this->var_str_76 += Common::U32String::format("\"%s\"", g_zbasic->str(80).c_str());
@@ -1610,7 +1610,7 @@ void FoolPrologue::sub_131_4e48() {
void FoolPrologue::sub_131_4e98() {
// 131:4e98
- g_zbasic->text(0xfa, 0xc, kFacePlain, kModeSourceXOR);
+ g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcXor);
this->var_i16_3fc = 0xa0;
// "And so the fool heeded the advice of the magician..."
this->var_str_76 += g_zbasic->str(81);
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index e4e9aa2a254..1b2b8364497 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -46,7 +46,7 @@ public:
void sub_128_26c(int16 unk1, int16 unk2);
void sub_128_2a6(int16 unk1, int16 unk2);
void fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right); // sub_128_2f0
- void sub_128_354(uint16 unk1, uint16 unk2);
+ void sub_128_354(PatternMode mode, uint16 unk2);
void sub_128_3ee(int16 unk1);
void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
void sub_128_610(int16 screenPage);
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 74f1d2ec95d..ded99d6cdab 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/events.h"
#include "common/system.h"
#include "fool/fool.h"
@@ -52,6 +53,8 @@ void Toolbox::_pumpEvents() {
newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
_events.push(newRecord);
break;
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RETURN_TO_LAUNCHER:
default:
break;
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 715a168c70d..ea271bad2dd 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -36,8 +36,13 @@
namespace Fool {
+struct Region {
+ uint16 rgnSize;
+ Common::Rect rgnBBox;
+};
+
typedef Common::SharedPtr<Common::Array<byte>> Handle;
-typedef Handle RgnHandle;
+typedef Common::SharedPtr<Region> RgnHandle;
typedef Common::SharedPtr<Graphics::ManagedSurface> PicHandle;
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Handle PolyHandle;
@@ -78,7 +83,7 @@ struct RGBColor {
uint16 blue;
};
-enum EventCode {
+enum EventCode : uint16 {
kNullEvent = 0,
kMouseDown = 1,
kMouseUp = 2,
@@ -96,6 +101,28 @@ enum EventCode {
kApp4Evt = 15
};
+enum SourceMode : uint16 {
+ kSrcCopy = 0,
+ kSrcOr = 1,
+ kSrcXor = 2,
+ kSrcBic = 3,
+ kNotSrcCopy = 4,
+ kNotSrcOr = 5,
+ kNotSrcXor = 6,
+ kNotSrcBic = 7
+};
+
+enum PatternMode : uint16 {
+ kPatCopy = 8,
+ kPatOr = 9,
+ kPatXor = 10,
+ kPatBic = 11,
+ kNotPatCopy = 12,
+ kNotPatOr = 13,
+ kNotPatXor = 14,
+ kNotPatBic = 15
+};
+
struct EventRecord {
EventCode what;
uint32 message;
@@ -114,29 +141,29 @@ enum WindowDefinition {
};
struct GrafPort {
- uint16 device;
+ uint16 device = 0;
BitMap portBits;
Common::Rect portRect;
RgnHandle visRgn;
RgnHandle clipRgn;
- Pattern bkPat;
- Pattern fillPat;
- Common::Point pnLoc;
- Common::Point pnSize;
- uint16 pnMode;
- Pattern pnPat;
- uint16 pnVis;
- uint16 txFont;
+ Pattern bkPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf } };
+ Pattern fillPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ Common::Point pnLoc = {0, 0};
+ Common::Point pnSize = {1, 1};
+ PatternMode pnMode = kPatCopy;
+ Pattern pnPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ uint16 pnVis = 0;
+ uint16 txFont = 0;
uint16 txFace;
- uint16 txMode;
- uint16 txSize;
- uint32 spExtra;
+ SourceMode txMode = kSrcOr;
+ uint16 txSize = 0;
+ uint32 spExtra = 0;
uint32 fgColor;
uint32 bkColor;
- uint16 colrBit;
- uint16 patStretch;
- Handle picSave;
- Handle rgnSave;
+ uint16 colrBit = 0;
+ uint16 patStretch = 0;
+ PicHandle picSave;
+ RgnHandle rgnSave;
Handle polySave;
};
@@ -310,7 +337,7 @@ public:
// just pass NIL for the maskRgn parameter. The dstRect and maskRgn coordinates are in terms of
// the dstBits.bounds coordinate system, and the srcRect coordinates are in terms of the
// srcBits.bounds coordinates.
- void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn);
+ void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
// PROCEDURE DrawChar (ch: CHAR);
// DrawChar places the given character to the right of the pen location, with the left end of its base
@@ -415,6 +442,12 @@ public:
// by h and v. The new pen location is (h,v) after the line is drawn.
void LineTo(int16 h, int16 v);
+ // PROCEDURE Move (dh,dv: INTEGER);
+ // The Move procedure moves the graphics pen from its current location in the current
+ // graphics port a horizontal distance that you specify in the dh parameter and a vertical
+ // distance that you specify in the dv parameter.
+ void Move(int16 dh, int16 dv);
+
// PROCEDURE MovePortTo (leftGlobal,topGlobal: INTEGER);
// MovePortTo changes the position of the current grafPort's portRect. This does not affect the
// screen; it merely changes the location at which subsequent drawing inside the port will appear.
@@ -463,7 +496,7 @@ public:
// PROCEDURE PenMode (mode: INTEGER);
// PenMode sets the transfer mode through which the pen pattern is transferred onto the bit map
// when lines or shapes are drawn in the current grafPort.
- void PenMode(uint16 mode);
+ void PenMode(PatternMode mode);
// PROCEDURE PenNormal;
// PenNormal resets the initial state of the pen in the current grafPort.
@@ -532,6 +565,8 @@ private:
Common::Queue<EventRecord> _events;
+ GrafPtr _port = nullptr;
+
Graphics::MacPlotData _pd;
void _pumpEvents();
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 40f25a4cdaf..1b08a5ca81e 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -47,8 +47,12 @@ void Toolbox::ClipRect(Common::Rect &r) {
warning("STUB: Toolbox::ClipRect");
}
-void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, uint16 mode, RgnHandle maskRgn) {
- warning("STUB: Toolbox::CopyBits");
+void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
+ if (srcBits && dstBits) {
+ if (maskRgn) {
+ warning("STUB: Toolbox::CopyBits: maskRgn unimplemented");
+ }
+ }
}
void Toolbox::DrawString(const Common::String &s) {
@@ -130,12 +134,23 @@ void Toolbox::LineTo(int16 h, int16 v) {
warning("STUB: Toolbox::LineTo");
}
+void Toolbox::Move(int16 dh, int16 dv) {
+ if (_port) {
+ MoveTo(_port->portRect.width() + dh, _port->portRect.height() + dv);
+ }
+}
+
void Toolbox::MovePortTo(int16 leftGlobal, int16 topGlobal) {
- warning("STUB: Toolbox::MovePortTo");
+ if (_port) {
+ _port->portRect.left = leftGlobal;
+ _port->portRect.top = topGlobal;
+ }
}
void Toolbox::MoveTo(int16 h, int16 v) {
- warning("STUB: Toolbox::MoveTo");
+ if (_port) {
+ _port->pnLoc = Common::Point(h, v);
+ }
}
PolyHandle Toolbox::OpenPoly() {
@@ -146,12 +161,10 @@ PolyHandle Toolbox::OpenPoly() {
void Toolbox::OpenPort(GrafPtr port) {
warning("STUB: Toolbox::OpenPort");
// source: QuickDraw Routines I-163
- port->device = 0;
//port->portBits = screenBits;
//port->portRect = screenBits.bounds;
- //port->visRgn
+ port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) }));
//port->clipRgn
- //port->bkPat = white
}
void Toolbox::PaintOval(const Common::Rect &r) {
@@ -166,24 +179,37 @@ void Toolbox::PaintRect(const Common::Rect &r) {
warning("STUB: Toolbox::PaintRect");
}
-void Toolbox::PenMode(uint16 mode) {
- warning("STUB: Toolbox::PenMode");
+void Toolbox::PenMode(PatternMode mode) {
+ if (_port) {
+ _port->pnMode = mode;
+ }
}
void Toolbox::PenNormal() {
- warning("STUB: Toolbox::PenNormal");
+ if (_port) {
+ _port->pnSize = Common::Point(1, 1);
+ _port->pnMode = kPatCopy;
+ _port->pnPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ }
}
void Toolbox::PenPat(const Pattern &pat) {
- warning("STUB: Toolbox::PenPat");
+ if (_port) {
+ _port->pnPat = pat;
+ }
}
void Toolbox::PenSize(uint16 width, uint16 height) {
- warning("STUB: Toolbox::PenSize");
+ if (_port) {
+ _port->pnSize = Common::Point(width, height);
+ }
}
void Toolbox::PortSize(uint16 width, uint16 height) {
- warning("STUB: Toolbox::PortSize");
+ if (_port) {
+ _port->portRect.setWidth(width);
+ _port->portRect.setHeight(height);
+ }
}
void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
@@ -191,11 +217,13 @@ void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
}
void Toolbox::SetPort(GrafPtr port) {
- warning("STUB: Toolbox::SetPort");
+ _port = port;
}
void Toolbox::SetPortBits(BitMap &bm) {
- warning("STUB: Toolbox::SetPortBits");
+ if (_port) {
+ _port->portBits = bm;
+ }
}
void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16 bottom) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index f00d5fb4fc0..6128be9d720 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -274,16 +274,16 @@ const Common::U32String &ZBasic::str(size_t index) {
return *_stringTable[index]->data.str;
}
-void ZBasic::text(int16 font, int16 size, int16 face, ZBasicTextMode mode) {
+void ZBasic::text(int16 font, int16 size, int16 face, SourceMode mode) {
warning("STUB: ZBasic::text");
}
void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type) {
- warning("STUB:: ZBasic::window");
+ warning("STUB: ZBasic::window");
}
void ZBasic::unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4) {
- warning("STUB:: ZBasic::unk_6");
+ warning("STUB: ZBasic::unk_6");
}
void ZBasic::unk_20() {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index d69a5a44acb..fcb43c12b09 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -132,17 +132,6 @@ enum ZBasicTextFace {
kFaceExtended = 64
};
-enum ZBasicTextMode {
- kModeSourceCOPY = 0,
- kModeSourceOR = 1,
- kModeSourceXOR = 2,
- kModeSourceBIC = 3,
- kModeNOTSourceCOPY = 4,
- kModeNOTSourceOR = 5,
- kModeNOTSourceXOR = 6,
- kModeNOTSourceBIC = 7
-};
-
enum ZBasicDatumType {
kDatumNULL = 0,
kDatumINT = 1,
@@ -260,7 +249,7 @@ public:
int16 readInt();
Common::U32String readStr();
int16 rndInt(int16 max);
- void text(int16 font, int16 size, int16 face, ZBasicTextMode mode);
+ void text(int16 font, int16 size, int16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
const Common::U32String &str(size_t index);
Commit: 95a9a8f6179a8c609e825c0b68df6bbde89754a1
https://github.com/scummvm/scummvm/commit/95a9a8f6179a8c609e825c0b68df6bbde89754a1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:48+02:00
Commit Message:
FOOL: Add blitter
Changed paths:
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/utils.cpp
engines/fool/utils.h
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index ea271bad2dd..da5873f932b 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -44,6 +44,7 @@ struct Region {
typedef Common::SharedPtr<Common::Array<byte>> Handle;
typedef Common::SharedPtr<Region> RgnHandle;
typedef Common::SharedPtr<Graphics::ManagedSurface> PicHandle;
+// BitMap is the monochrome surface format.
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Handle PolyHandle;
typedef uint32 ResType;
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 1b08a5ca81e..70c8e532bf6 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -48,11 +48,27 @@ void Toolbox::ClipRect(Common::Rect &r) {
}
void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
- if (srcBits && dstBits) {
- if (maskRgn) {
- warning("STUB: Toolbox::CopyBits: maskRgn unimplemented");
- }
+ if (!srcBits) {
+ warning("Toolbox::CopyBits: empty srcBits handle");
+ return;
+ }
+
+ if (!dstBits) {
+ warning("Toolbox::CopyBits: empty dstBits handle");
+ return;
}
+ if (maskRgn) {
+ warning("Toolbox::CopyBits: maskRgn unimplemented");
+ }
+ // scale the source
+ BitMap subsrc(new Graphics::ManagedSurface());
+ subsrc->create(*srcBits, srcRect);
+ if (srcRect.width() != dstRect.width() ||
+ srcRect.height() != dstRect.height()) {
+ subsrc->scale(dstRect.width(), dstRect.height());
+ }
+
+ blitMono(subsrc, dstBits, Common::Point(dstRect.left, dstRect.top), mode);
}
void Toolbox::DrawString(const Common::String &s) {
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index 1ea9369c7f5..432e5724129 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -20,10 +20,59 @@
*/
#include "fool/fool.h"
+#include "fool/toolbox.h"
#include "fool/utils.h"
namespace Fool {
+void blitMono(BitMap &src, BitMap &dst, const Common::Point &dstPos, SourceMode mode) {
+ Common::Rect dstRect = src->getBounds();
+ dstRect.moveTo(dstPos);
+ dstRect.clip(dst->getBounds());
+ Common::Rect srcRect = dstRect;
+ srcRect.translate(-dstPos.x, -dstPos.y);
+
+ uint32 black = g_engine->_wm._colorBlack;
+ uint32 white = g_engine->_wm._colorWhite;
+ if (mode == kSrcCopy) {
+ dst->blitFrom(*src, srcRect, dstPos);
+ } else {
+ for (int y = srcRect.top; y < srcRect.bottom; y++) {
+ byte *source = (byte *)src->getBasePtr(srcRect.left, y);
+ byte *target = (byte *)dst->getBasePtr(srcRect.left + dstPos.x, dstPos.y + y);
+ for (int x = srcRect.left; x < srcRect.right; x++) {
+ switch (mode) {
+ case kSrcOr:
+ *target = (*target == black) || (*source == black) ? black : white;
+ break;
+ case kSrcXor:
+ *target = (*target == black) ^ (*source == black) ? black : white;
+ break;
+ case kSrcBic:
+ *target = (*target == black) && (*source != black) ? black : white;
+ break;
+ case kNotSrcCopy:
+ *target = (*source != black) ? black : white;
+ break;
+ case kNotSrcOr:
+ *target = (*target == black) || (*source != black) ? black : white;
+ break;
+ case kNotSrcXor:
+ *target = (*target == black) ^ (*source != black) ? black : white;
+ break;
+ case kNotSrcBic:
+ *target = (*target == black) && (*source == black) ? black : white;
+ break;
+ default:
+ break;
+ }
+ source++;
+ target++;
+ }
+ }
+ }
+}
+
Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount) {
Graphics::ManagedSurface *s = new Graphics::ManagedSurface();
s->create(surface->w, surface->h, Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/fool/utils.h b/engines/fool/utils.h
index 67593515e82..bc199784c05 100644
--- a/engines/fool/utils.h
+++ b/engines/fool/utils.h
@@ -25,8 +25,12 @@
#include "graphics/managed_surface.h"
+#include "fool/toolbox.h"
+
namespace Fool {
+void blitMono(BitMap &src, BitMap &dst, const Common::Point &dstPos, SourceMode mode);
+
Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount);
} // End of namespace Fool
Commit: bdcb2fa4f84c026c8154da741e4a3eb8fef74219
https://github.com/scummvm/scummvm/commit/bdcb2fa4f84c026c8154da741e4a3eb8fef74219
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:49+02:00
Commit Message:
MAGCUI: Allow thickness to be specified for x and y dimensions
Changed paths:
engines/director/graphics.cpp
engines/director/sprite.cpp
engines/macventure/gui.cpp
engines/wage/gui.cpp
graphics/macgui/macbutton.cpp
graphics/macgui/macdialog.cpp
graphics/macgui/macwindowborder.cpp
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
index f97d6b234c9..178f0467c83 100644
--- a/engines/director/graphics.cpp
+++ b/engines/director/graphics.cpp
@@ -320,14 +320,14 @@ void InkPrimitives<T>::drawPoint(int x, int y, uint32 src, void *data) {
dst = (T *)p->dst->getBasePtr(x, y);
if (p->ms) {
- if (p->ms->pd->thickness > 1) {
- int prevThickness = p->ms->pd->thickness;
+ if (p->ms->pd->thickness.x > 1 || p->ms->pd->thickness.y > 1) {
+ Common::Point prevThickness = p->ms->pd->thickness;
int x1 = x;
- int x2 = x1 + prevThickness;
+ int x2 = x1 + prevThickness.x;
int y1 = y;
- int y2 = y1 + prevThickness;
+ int y2 = y1 + prevThickness.y;
- p->ms->pd->thickness = 1; // We do not want recursive loops
+ p->ms->pd->thickness = Common::Point(1, 1); // We do not want recursive loops
for (y = y1; y < y2; y++)
for (x = x1; x < x2; x++)
@@ -667,7 +667,7 @@ void DirectorPlotData::inkBlitShape(Common::Rect &srcRect) {
Common::Rect fillAreaRect((int)srcRect.width(), (int)srcRect.height());
fillAreaRect.moveTo(srcRect.left, srcRect.top);
- Graphics::MacPlotData plotFill(dst, nullptr, &d->getPatterns(), ms->pattern, srcRect.left + wpos.x, srcRect.top + wpos.y, 1, ms->backColor);
+ Graphics::MacPlotData plotFill(dst, nullptr, &d->getPatterns(), ms->pattern, srcRect.left + wpos.x, srcRect.top + wpos.y, {1, 1}, ms->backColor);
uint strokePattern = 1;
@@ -679,7 +679,7 @@ void DirectorPlotData::inkBlitShape(Common::Rect &srcRect) {
Common::Rect strokeRect(MAX((int)srcRect.width() - ms->lineSize, 0), MAX((int)srcRect.height() - ms->lineSize, 0));
strokeRect.moveTo(srcRect.left, srcRect.top);
- Graphics::MacPlotData plotStroke(dst, nullptr, &d->getPatterns(), strokePattern, strokeRect.left + wpos.x, strokeRect.top + wpos.y, ms->lineSize, ms->backColor);
+ Graphics::MacPlotData plotStroke(dst, nullptr, &d->getPatterns(), strokePattern, strokeRect.left + wpos.x, strokeRect.top + wpos.y, {(int16)ms->lineSize, (int16)ms->lineSize}, ms->backColor);
Graphics::Primitives *primitives = g_director->getInkPrimitives();
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index f96ed373d02..9b45795afe9 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -192,7 +192,7 @@ void Sprite::createQDMatte() {
Common::Rect srcRect(_width, _height);
Common::Rect fillAreaRect((int)srcRect.width(), (int)srcRect.height());
- Graphics::MacPlotData plotFill(&tmp, nullptr, &g_director->getPatterns(), getPattern(), 0, 0, 1, g_director->_wm->_colorBlack);
+ Graphics::MacPlotData plotFill(&tmp, nullptr, &g_director->getPatterns(), getPattern(), 0, 0, {1, 1}, g_director->_wm->_colorBlack);
Graphics::Primitives &primitives = g_director->_wm->getDrawPrimitives();
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index b0f023b8311..66ad534c9b9 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -849,7 +849,7 @@ void Gui::drawInventories() {
SWAP(topLeft.y, bottomRight.y);
Common::Rect lassoRect(topLeft, bottomRight);
- Graphics::MacPlotData plotData(srf, nullptr, &_wm.getBuiltinPatterns(), kPatternCheckers2, 0, 0, 1, kColorWhite, false);
+ Graphics::MacPlotData plotData(srf, nullptr, &_wm.getBuiltinPatterns(), kPatternCheckers2, 0, 0, {1, 1}, kColorWhite, false);
Graphics::Primitives &primitives = _wm.getDrawPrimitives();
primitives.drawRect(lassoRect, kColorBlack, &plotData);
}
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 05d5bae8ebc..10b557a82a7 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -742,7 +742,7 @@ void AboutDialog::paint() {
Common::Rect volBox(0, 0, volume * kVolWidth / 256, 12);
volBox.moveTo(_bbox.left + (_bbox.width() - kVolWidth) / 2, _bbox.bottom - 32);
- Graphics::MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
+ Graphics::MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, {1, 1}, _wm->_colorBlack, false);
primitives.drawFilledRect1(volBox, kColorBlack, &pd);
primitives.drawRect1(_volBbox, kColorBlack, &pd);
}
diff --git a/graphics/macgui/macbutton.cpp b/graphics/macgui/macbutton.cpp
index d2a506f22ba..bb0a32ccc6c 100644
--- a/graphics/macgui/macbutton.cpp
+++ b/graphics/macgui/macbutton.cpp
@@ -33,7 +33,7 @@
namespace Graphics {
MacButton::MacButton(MacButtonType buttonType, TextAlign textAlignment, MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *macFont, int fgcolor, int bgcolor) :
- MacText(parent, x, y, w, h, wm, s, macFont, fgcolor, bgcolor, w, textAlignment), _pd(Graphics::MacPlotData(_composeSurface, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, bgcolor, true)) {
+ MacText(parent, x, y, w, h, wm, s, macFont, fgcolor, bgcolor, w, textAlignment), _pd(Graphics::MacPlotData(_composeSurface, nullptr, &_wm->getPatterns(), 1, 0, 0, {1, 1}, bgcolor, true)) {
_buttonType = buttonType;
init();
@@ -143,7 +143,7 @@ bool MacButton::draw(bool forceRedraw) {
MacText::draw();
Common::Rect r(_dims.width() - 1, _dims.height() - 1);
- Graphics::MacPlotData pd(_composeSurface, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, 0);
+ Graphics::MacPlotData pd(_composeSurface, nullptr, &_wm->getPatterns(), 1, 0, 0, {1, 1}, 0);
Primitives &primitives = _wm->getDrawPrimitives();
diff --git a/graphics/macgui/macdialog.cpp b/graphics/macgui/macdialog.cpp
index 9ab5b28bed2..854d0933f56 100644
--- a/graphics/macgui/macdialog.cpp
+++ b/graphics/macgui/macdialog.cpp
@@ -77,7 +77,7 @@ MacDialog::MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, Ma
int height;
if (buttonBottomPos > 0)
height = buttonBottomPos + kDialogBottomPadding;
- else
+ else
height = kDialogHeight + _mactext->getTextHeight();
_font = getDialogFont();
@@ -118,7 +118,7 @@ void MacDialog::paint() {
Primitives &primitives = _wm->getDrawPrimitives();
- MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
+ MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, {1, 1}, _wm->_colorBlack, false);
primitives.drawFilledRect1(_bbox, _wm->_colorWhite, &pd);
_mactext->drawToPoint(_screen, Common::Point(_bbox.left + (_bbox.width() - _maxTextWidth)/2, _bbox.top + 16));
static int boxOutline[] = {1, 0, 0, 1, 1};
@@ -165,7 +165,7 @@ void MacDialog::blit() {
void MacDialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
Primitives &primitives = _wm->getDrawPrimitives();
- MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, false);
+ MacPlotData pd(_screen, nullptr, &_wm->getPatterns(), 1, 0, 0, {1, 1}, _wm->_colorBlack, false);
for (int i = 0; i < speclen; i++)
if (spec[i] != 0) {
Common::Rect r(bounds.left + i, bounds.top + i, bounds.right - i, bounds.bottom - i);
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index 382ad8de53d..52d8a11d177 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -190,7 +190,7 @@ void MacWindowBorder::drawScrollBar(ManagedSurface *g) {
int ry2 = ry1 + _scrollSize ;
Common::Rect rr(rx1, ry1, rx2, ry2);
- MacPlotData pd(g, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorWhite, true);
+ MacPlotData pd(g, nullptr, &_wm->getPatterns(), 1, 0, 0, {1, 1}, _wm->_colorWhite, true);
Primitives &primitives = _wm->getDrawInvertPrimitives();
primitives.drawFilledRect1(rr, _wm->_colorWhite, &pd);
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 0e0440326bf..2a6b02ed936 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -826,7 +826,7 @@ void MacDrawPrimitives<T>::drawPoint(int x, int y, uint32 color, void *data) {
const byte *pat = p->patterns->operator[](p->fillType - 1);
- if (p->thickness == 1) {
+ if (p->thickness.x == 1 && p->thickness.y == 1) {
if (x >= 0 && x < p->surface->w && y >= 0 && y < p->surface->h) {
uint xu = (uint)x; // for letting compiler optimize it
uint yu = (uint)y;
@@ -839,9 +839,9 @@ void MacDrawPrimitives<T>::drawPoint(int x, int y, uint32 color, void *data) {
}
} else {
int x1 = x;
- int x2 = x1 + p->thickness;
+ int x2 = x1 + p->thickness.x;
int y1 = y;
- int y2 = y1 + p->thickness;
+ int y2 = y1 + p->thickness.y;
for (y = y1; y < y2; y++)
for (x = x1; x < x2; x++)
@@ -943,7 +943,7 @@ void MacWindowManager::drawDesktop() {
} else {
Common::Rect r(_desktop->getBounds());
- MacPlotData pd(_desktop, nullptr, &_patterns, kPatternCheckers, 0, 0, 1, _colorWhite);
+ MacPlotData pd(_desktop, nullptr, &_patterns, kPatternCheckers, 0, 0, {1, 1}, _colorWhite);
getDrawPrimitives().drawRoundRect(r, kDesktopArc, _colorBlack, true, &pd);
}
@@ -1240,7 +1240,7 @@ void MacWindowManager::renderZoomBox(bool redraw) {
ZoomBox *box = _zoomBoxes.front();
uint32 t = g_system->getMillis();
- MacPlotData pd(_screen, nullptr, &getPatterns(), Graphics::kPatternCheckers, 0, 0, 1, 0, true);
+ MacPlotData pd(_screen, nullptr, &getPatterns(), Graphics::kPatternCheckers, 0, 0, {1, 1}, 0, true);
// Undraw the previous boxes
if (box->last.size() != 0) {
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 55375e2e3b4..afb721bb678 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -121,13 +121,13 @@ struct MacPlotData {
uint fillType;
int fillOriginX;
int fillOriginY;
- int thickness;
+ Common::Point thickness;
uint bgColor;
bool invert;
- MacPlotData() : surface(nullptr), mask(nullptr), patterns(nullptr), fillType(0), fillOriginX(0), fillOriginY(0), thickness(1), bgColor(0), invert(false) {}
+ MacPlotData() : surface(nullptr), mask(nullptr), patterns(nullptr), fillType(0), fillOriginX(0), fillOriginY(0), thickness(1, 1), bgColor(0), invert(false) {}
- MacPlotData(Graphics::ManagedSurface *s, Graphics::ManagedSurface *m, MacPatterns *p, uint f, int fx, int fy, int t, uint bg, bool inv = false) :
+ MacPlotData(Graphics::ManagedSurface *s, Graphics::ManagedSurface *m, MacPatterns *p, uint f, int fx, int fy, const Common::Point &t, uint bg, bool inv = false) :
surface(s), mask(m), patterns(p), fillType(f), fillOriginX(fx), fillOriginY(fy), thickness(t), bgColor(bg), invert(inv) {
}
};
Commit: d154de8924d1122ec88b0239440ba185af7b6a32
https://github.com/scummvm/scummvm/commit/d154de8924d1122ec88b0239440ba185af7b6a32
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:49+02:00
Commit Message:
MACGUI: Fix MacWindowManager::setScreen to always set _screenDims
Changed paths:
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 2a6b02ed936..23de0870971 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -335,6 +335,7 @@ void MacWindowManager::setScreen(ManagedSurface *screen) {
else
_desktop = new ManagedSurface();
+ _screenDims = Common::Rect(_screen->w, _screen->h);
_desktop->create(_screen->w, _screen->h, _pixelformat);
drawDesktop();
}
Commit: 1c5d358a010cdbc27d690ded28b0d954fadc8533
https://github.com/scummvm/scummvm/commit/1c5d358a010cdbc27d690ded28b0d954fadc8533
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:49+02:00
Commit Message:
FOOL: Implement some draw commands
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/utils.cpp
engines/fool/utils.h
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 0409a7b0b5b..39f0d0c731b 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -195,7 +195,7 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
this->var_i16_18c = 0xe;
}
// 128:0428
- for (int i = 1; i < this->var_i16_18e + 1; i++) {
+ for (int i = 1; i <= this->var_i16_18e + 1; i++) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->MoveTo(
unk1 - this->arr_i16_1e8[i],
@@ -230,7 +230,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
unk1 = 0x5;
}
// 128:0584
- for (int i = 1; i < SCREEN_HEIGHT; i++) {
+ for (int i = 1; i <= SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = this->arr_i16_412ea[i] - 1;
this->var_i16_5c.bottom = this->arr_i16_412ea[i];
@@ -331,7 +331,7 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
g_toolbox->PenMode(kPatXor);
do {
// 128:0a96
- this->sub_130_e82();
+ this->drawRainDrop();
this->arr_i16_1e8[this->var_i16_6] =
this->arr_i16_1e8[0x2f1+this->var_i16_6]
+ this->arr_i16_1e8[this->var_i16_6];
@@ -350,10 +350,11 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
this->arr_i16_1e8[0x2f1 + this->var_i16_6] = g_zbasic->rndInt(0xa) + 0x19;
}
// 128:0c56
- this->sub_130_e82();
+ this->drawRainDrop();
this->var_i16_6 += 1;
if (this->var_i16_6 > 0xb5) {
this->var_i16_6 = 0;
+ g_toolbox->Delay(0);
}
} while (this->var_i32_2 + this->var_i16_1a4 > g_toolbox->TickCount());
}
@@ -362,22 +363,23 @@ void FoolPrologue::sub_128_c8a() {
}
-void FoolPrologue::sub_128_ccc() {
+void FoolPrologue::shuffleScanlines() {
g_zbasic->unk_20();
- this->var_i32_1ac = &this->arr_i16_41598[0];
- this->var_i32_1b0 = &this->arr_i16_41846[0];
- this->var_i16_1b4 = this->var_i16_18e * 2 + 2;
+ this->var_i32_1ac = (byte *)&this->arr_i16_41598[0];
+ this->var_i32_1b0 = (byte *)&this->arr_i16_41846[0];
+ this->var_i16_1b4 = this->var_i16_18e * 2;
// 128:0d00
- for (int i=1; i < this->var_i16_18e; i++) {
+ for (int i=0; i < this->var_i16_18e; i++) {
this->arr_i16_41598[i] = i;
}
// 128:0d2a
- for (int i=this->var_i16_18e; i<=1; i--) {
- this->var_i16_1b6 = g_zbasic->rndInt(i);
+ for (int i=this->var_i16_18e - 1; i >= 0; i--) {
+ this->var_i16_1b6 = g_zbasic->rndInt(i + 1) - 1;
this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
g_zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
- g_zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
+ g_zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8 - 2, this->var_i16_1b4 - this->var_i16_1b8);
+ warning("shuffleScanlines: %d = %d -> %d", i, this->var_i16_1b6, this->arr_i16_412ea[i]);
}
}
@@ -675,7 +677,7 @@ void FoolPrologue::sub_130_004() {
this->var_i16_3ce = 5;
this->prologueDrawLoadingMsg();
this->var_i16_18e = SCREEN_HEIGHT;
- this->sub_128_ccc();
+ this->shuffleScanlines();
this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
this->var_i16_3ce = 10;
@@ -690,7 +692,7 @@ void FoolPrologue::sub_130_004() {
this->var_str_76 = g_zbasic->str(18);
this->sub_128_2a6(0x10d, 0xdd);
g_toolbox->SetPortBits(this->var_i32_32);
- for (int i = 1; i < 5; i++) {
+ for (int i = 1; i <= 5; i++) {
this->prologueBufferNextPicture();
}
this->sub_128_1f4(7);
@@ -707,7 +709,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
- for (int i = 3; i < 5; i++) {
+ for (int i = 3; i <= 5; i++) {
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[7]);
}
@@ -735,7 +737,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[8]);
// 130:0276
- for (int j = 9; j < 0xb; j++) {
+ for (int j = 9; j <= 0xb; j++) {
this->prologueBufferNextPicture();
if (j == 9) {
@@ -759,7 +761,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
// 130:034a
- for (int i = 0xd; i < 0x12; i++) {
+ for (int i = 0xd; i <= 0x12; i++) {
this->prologueBufferNextPicture();
}
@@ -785,7 +787,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
// 130:043c
- for (int i = 1; i < 2; i++) {
+ for (int i = 1; i <= 2; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_a8c(0xb4);
this->var_i32_2 = g_toolbox->TickCount();
@@ -793,7 +795,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_24a(1);
g_toolbox->InvertRect(this->arr_i16_1bc);
// 130:04ca
- for (int j = 0; j < 3; j++) {
+ for (int j = 0; j <= 3; j++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[8];
// 130:049e
@@ -849,7 +851,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_a8c(0xa);
this->sub_128_610(1);
// 130:06d4
- for (int i = 1; i < 4; i++) {
+ for (int i = 1; i <= 4; i++) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_a8c(0x2);
@@ -867,8 +869,8 @@ void FoolPrologue::sub_130_004() {
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
// 130:0778
- for (int j = 0; j < 8; j++) {
- for (int i = 3; i < 5; i++) {
+ for (int j = 0; j <= 8; j++) {
+ for (int i = 3; i <= 5; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[i];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
@@ -878,7 +880,7 @@ void FoolPrologue::sub_130_004() {
// 130:07ec
this->sub_128_610(6);
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- for (int i = 0; i < 0x2d; i++) {
+ for (int i = 0; i <= 0x2d; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->sub_128_24a(1);
}
@@ -904,12 +906,12 @@ void FoolPrologue::sub_130_004() {
this->sub_130_f48();
this->sub_128_de2();
// 130:0934
- for (int i = 2; i < 5; i++) {
+ for (int i = 2; i <= 5; i++) {
//g_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[1]);
}
// 130:0978
- for (int i = 1; i < 5; i++) {
+ for (int i = 1; i <= 5; i++) {
this->sub_128_1f4(i);
g_toolbox->PenPat(this->arr_pat_194[1]);
g_toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
@@ -917,7 +919,7 @@ void FoolPrologue::sub_130_004() {
g_toolbox->PenPat(this->arr_pat_194[4]);
// 130:09d0
g_toolbox->InsetRect(this->arr_i16_1bc, -i, -i);
- for (int j = 2; j < 0xd; j++) {
+ for (int j = 2; j <= 0xd; j++) {
g_toolbox->InsetRect(this->arr_i16_1bc, -j, -j);
g_toolbox->FrameOval(this->arr_i16_1bc);
}
@@ -1038,13 +1040,13 @@ void FoolPrologue::sub_130_db0() {
this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = g_zbasic->rndInt(0x5) + 1;
this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = g_zbasic->rndInt(0xa) + 0x19;
// 130:0e68
- this->sub_130_e82();
+ this->drawRainDrop();
this->var_i16_6 += 1;
}
this->var_i16_6 = 1;
}
-void FoolPrologue::sub_130_e82() {
+void FoolPrologue::drawRainDrop() {
// 130:0e82
g_toolbox->MoveTo(this->arr_i16_1e8[this->var_i16_6], this->arr_i16_1e8[this->var_i16_6 + 0xfb]);
// 130:0ec0
@@ -1149,7 +1151,7 @@ void FoolPrologue::sub_131_004() {
}
// 131:026e
this->var_i16_18e = SCREEN_HEIGHT;
- this->sub_128_ccc();
+ this->shuffleScanlines();
this->var_i32_1a6 = g_zbasic->mem(-1);
g_toolbox->SetPortBits(this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 1b2b8364497..1a7ddd6da6a 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -56,7 +56,7 @@ public:
void sub_128_a6c(int16_t unk1, int16_t unk2);
void sub_128_a8c(int16_t unk);
void sub_128_c8a();
- void sub_128_ccc();
+ void shuffleScanlines(); // sub_128_ccc
void sub_128_de2();
void sub_128_e1c();
void sub_128_e58();
@@ -73,7 +73,7 @@ public:
void prologueBufferNextPicture();
void prologueDrawLoadingMsg();
void sub_130_db0();
- void sub_130_e82();
+ void drawRainDrop(); // sub_130_e82
void sub_130_f48();
void sub_130_1002();
@@ -134,8 +134,8 @@ private:
// 1 for prologue, 2 for finale
int16 var_i16_1aa;
- int16 *var_i32_1ac;
- int16 *var_i32_1b0;
+ byte *var_i32_1ac;
+ byte *var_i32_1b0;
int16 var_i16_1b4;
int16 var_i16_1b6;
@@ -171,7 +171,7 @@ private:
Common::Rect arr_i16_1bc;
Common::Rect arr_i32_1c4;
- int16 arr_i16_1e8[1206] = { 0 };
+ int16 arr_i16_1e8[1004] = { 0 };
GrafPort arr_grafport_9c0;
GrafPort arr_grafport_a8a;
@@ -182,9 +182,9 @@ private:
BitMap arr_i32_41296[12];
- int16 arr_i16_412ea[SCREEN_HEIGHT];
- int16 arr_i16_41598[SCREEN_HEIGHT];
- int16 arr_i16_41846[SCREEN_HEIGHT];
+ int16 arr_i16_412ea[SCREEN_HEIGHT] = { 0 };
+ int16 arr_i16_41598[SCREEN_HEIGHT] = { 0 };
+ int16 arr_i16_41846[SCREEN_HEIGHT] = { 0 };
Common::Rect arr_i16_41af4;
Common::Rect arr_i16_41afc;
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index ded99d6cdab..54aa592e764 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -70,10 +70,10 @@ void Toolbox::_updateScreen() {
uint32 Toolbox::Delay(uint32 numTicks) {
uint32 target = g_system->getMillis() + (numTicks * 1000 / 60);
- while (g_system->getMillis() < target) {
+ do {
_pumpEvents();
_updateScreen();
- }
+ } while (g_system->getMillis() < target);
return (uint32)(g_system->getMillis() * 60 / 1000);
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index da5873f932b..de0a0f1c372 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -554,6 +554,9 @@ public:
// CharWidths of all the characters in the string (see above).
uint16 StringWidth(const Common::String &s);
+ Graphics::MacWindow *_defaultWindow;
+ BitMap _defaultBits;
+
private:
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
Common::Array<int16> _resOrder;
@@ -568,8 +571,6 @@ private:
GrafPtr _port = nullptr;
- Graphics::MacPlotData _pd;
-
void _pumpEvents();
void _updateScreen();
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 70c8e532bf6..b86a8d8c1a4 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -23,6 +23,7 @@
#include "common/system.h"
#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/managed_surface.h"
#include "image/pict.h"
#include "fool/fool.h"
@@ -67,8 +68,12 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
srcRect.height() != dstRect.height()) {
subsrc->scale(dstRect.width(), dstRect.height());
}
-
- blitMono(subsrc, dstBits, Common::Point(dstRect.left, dstRect.top), mode);
+ BitMap mask(nullptr);
+ Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(dstRect.left, dstRect.top), mode);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(result);
+ _defaultWindow->setDirty(true);
+ }
}
void Toolbox::DrawString(const Common::String &s) {
@@ -84,7 +89,26 @@ void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
}
void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
- warning("STUB: Toolbox::FillRect");
+ // steps:
+ // - create intermediate surface
+ // - draw to intermediate surface using MacPlotData
+ // - blit to target with blitMono
+ // - add to target dirty rect list
+ if (_port && _port->pnVis == 0) {
+ BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ BitMap mask(nullptr);
+ Graphics::MacPatterns macpat({pat.data});
+ Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ pm.drawFilledRect(intermediate->getBounds(), _port->fgColor, &pd);
+ Common::Point destPos(r.left, r.top);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+
+ }
}
void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle) {
@@ -114,6 +138,8 @@ PicHandle Toolbox::GetPicture(uint16 picID) {
PicHandle result(createRemappedSurface(surface, palette.data(), palette.size()));
_resPicts[result] = handle;
return result;
+ } else {
+ warning("Toolbox::GetPicture: failed to load PICT id %d", picID);
}
}
@@ -139,6 +165,23 @@ void Toolbox::InvertOval(const Common::Rect &r) {
}
void Toolbox::InvertRect(const Common::Rect &r) {
+ if (_port && _port->pnVis == 0) {
+ BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ BitMap mask(nullptr);
+ Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
+ Graphics::MacPatterns macpat({pat.data});
+ Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, 0, 0, {1, 1}, g_engine->_wm._colorWhite);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ pm.drawFilledRect(intermediate->getBounds(), g_engine->_wm._colorBlack, &pd);
+ Common::Point destPos(r.left, r.top);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, kPatXor);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+
+
+ }
warning("STUB: Toolbox::InvertRect");
}
@@ -147,7 +190,31 @@ void Toolbox::KillPoly(PolyHandle poly) {
}
void Toolbox::LineTo(int16 h, int16 v) {
- warning("STUB: Toolbox::LineTo");
+ if (_port && _port->pnVis == 0) {
+ Common::Point dirVec(h - _port->pnLoc.x, v - _port->pnLoc.y);
+ Common::Rect interRect(ABS(dirVec.x) + _port->pnSize.x, ABS(dirVec.y) + _port->pnSize.y);
+ Common::Point startPos(dirVec.x < 0 ? -dirVec.x : 0, dirVec.y < 0 ? -dirVec.y : 0);
+ Common::Point endPos(dirVec.x < 0 ? 0 : dirVec.x, dirVec.y < 0 ? 0 : dirVec.y);
+
+ BitMap intermediate(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
+ BitMap mask(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
+ Graphics::MacPatterns pat({_port->pnPat.data});
+
+ Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ pm.drawLine(startPos.x, startPos.y, endPos.x, endPos.y, _port->fgColor, &pd);
+ Common::Point destPos(dirVec.x < 0 ? h + dirVec.x : h - dirVec.x, dirVec.y < 0 ? v + dirVec.y : v - dirVec.y);
+
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+
+ }
+ if (_port) {
+ _port->pnLoc = Common::Point(h, v);
+ }
}
void Toolbox::Move(int16 dh, int16 dv) {
@@ -175,11 +242,13 @@ PolyHandle Toolbox::OpenPoly() {
}
void Toolbox::OpenPort(GrafPtr port) {
- warning("STUB: Toolbox::OpenPort");
// source: QuickDraw Routines I-163
//port->portBits = screenBits;
//port->portRect = screenBits.bounds;
+ port->portBits = _defaultBits;
port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) }));
+ port->fgColor = g_engine->_wm._colorBlack;
+ port->bkColor = g_engine->_wm._colorWhite;
//port->clipRgn
}
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index 432e5724129..873a367856f 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -25,7 +25,7 @@
namespace Fool {
-void blitMono(BitMap &src, BitMap &dst, const Common::Point &dstPos, SourceMode mode) {
+Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, SourceMode mode) {
Common::Rect dstRect = src->getBounds();
dstRect.moveTo(dstPos);
dstRect.clip(dst->getBounds());
@@ -40,7 +40,14 @@ void blitMono(BitMap &src, BitMap &dst, const Common::Point &dstPos, SourceMode
for (int y = srcRect.top; y < srcRect.bottom; y++) {
byte *source = (byte *)src->getBasePtr(srcRect.left, y);
byte *target = (byte *)dst->getBasePtr(srcRect.left + dstPos.x, dstPos.y + y);
+ byte *maskSource = mask ? (byte *)mask->getBasePtr(srcRect.left, y) : nullptr;
for (int x = srcRect.left; x < srcRect.right; x++) {
+ if (mask && !*maskSource) {
+ source++;
+ target++;
+ maskSource++;
+ continue;
+ }
switch (mode) {
case kSrcOr:
*target = (*target == black) || (*source == black) ? black : white;
@@ -68,9 +75,16 @@ void blitMono(BitMap &src, BitMap &dst, const Common::Point &dstPos, SourceMode
}
source++;
target++;
+ if (mask)
+ maskSource++;
}
}
}
+ return dstRect;
+}
+
+Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, PatternMode mode) {
+ return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7));
}
Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount) {
diff --git a/engines/fool/utils.h b/engines/fool/utils.h
index bc199784c05..164457f358e 100644
--- a/engines/fool/utils.h
+++ b/engines/fool/utils.h
@@ -29,7 +29,8 @@
namespace Fool {
-void blitMono(BitMap &src, BitMap &dst, const Common::Point &dstPos, SourceMode mode);
+Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, SourceMode mode);
+Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, PatternMode mode);
Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount);
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 6128be9d720..6c33b7b910a 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -37,6 +37,9 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_window->disableBorder();
_window->resize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_engine->_wm.setBackgroundWindow(_window);
+
+ _toolbox->_defaultWindow = _window;
+ _toolbox->_defaultBits = BitMap(_window->getWindowSurface());
}
ZBasic::~ZBasic() {
Commit: 7496d549b4813cd21d15bf79e0d12b24db2dbb79
https://github.com/scummvm/scummvm/commit/7496d549b4813cd21d15bf79e0d12b24db2dbb79
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:50+02:00
Commit Message:
FOOL: Offscreen pages working
Changed paths:
engines/fool/detection_tables.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/detection_tables.h b/engines/fool/detection_tables.h
index b91be070857..f604baeecf8 100644
--- a/engines/fool/detection_tables.h
+++ b/engines/fool/detection_tables.h
@@ -24,7 +24,7 @@
namespace Fool {
const PlainGameDescriptor foolGames[] = {
- { "fool", "The Fool's Errand" },
+ { "foolserrand", "The Fool's Errand" },
{ "atc", "At The Carnival" },
{ "3inthree", "3 in Three" },
{ 0, 0 }
@@ -33,7 +33,7 @@ const PlainGameDescriptor foolGames[] = {
const ADGameDescription gameDescriptions[] = {
// The Fool's Errand - Version 1.1 (1987-07-30)
{
- "fool",
+ "foolserrand",
"v1.1",
AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
Common::EN_ANY,
@@ -44,7 +44,7 @@ const ADGameDescription gameDescriptions[] = {
// The Fool's Errand - Version 2.0 (1988-07-25)
{
- "fool",
+ "foolserrand",
"v2.0",
AD_ENTRY1s("The Fool's Errand", "rt:7319cc059fde4535a196a744761b293f", 178663),
Common::EN_ANY,
@@ -55,7 +55,7 @@ const ADGameDescription gameDescriptions[] = {
// The Fool's Errand - Version 3.0 (1998-04-01)
{
- "fool",
+ "foolserrand",
"v3.0",
AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
Common::EN_ANY,
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 39f0d0c731b..5ca53008964 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -107,7 +107,7 @@ void FoolPrologue::sub_128_004() {
this->sub_129_004();
this->var_i32_1a6 = g_zbasic->mem(-1);
if (this->var_i16_1aa == 1) {
- this->sub_130_004();
+ this->prologueRun();
this->var_i32_1a6 = g_zbasic->mem(-1);
}
// 128:0cb0
@@ -125,13 +125,13 @@ void FoolPrologue::sub_128_1ba(int16 screenPage) {
g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
-void FoolPrologue::sub_128_1f4(int16 screenPage) {
+void FoolPrologue::setPortBitsToPage(int16 screenPage) {
// 128:01f4
this->var_i32_40 = this->arr_i32_41296[screenPage];
g_toolbox->SetPortBits(this->var_i32_40);
}
-void FoolPrologue::sub_128_21e(int16 numTicks) {
+void FoolPrologue::delay(int16 numTicks) {
// 128:021e
// original code would poll TickCount in a loop,
// effectively the same as Delay
@@ -215,8 +215,8 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage) {
// 128:050a
this->var_i32_40 = this->arr_i32_41296[screenPage];
- this->var_i16_5c.left = unk3;
- this->var_i16_5c.right = unk2;
+ this->var_i16_5c.left = unk2;
+ this->var_i16_5c.right = unk3;
if (unk1 == 0) {
unk1 = 0x14;
}
@@ -247,10 +247,10 @@ void FoolPrologue::sub_128_610(int16 screenPage) {
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
-void FoolPrologue::sub_128_64a(int16 unk1) {
+void FoolPrologue::scanlineTransition(int16 patternID) {
// 128:064a
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_194[unk1]);
+ g_toolbox->PenPat(this->arr_pat_194[patternID]);
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -379,8 +379,6 @@ void FoolPrologue::shuffleScanlines() {
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
g_zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
g_zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8 - 2, this->var_i16_1b4 - this->var_i16_1b8);
- warning("shuffleScanlines: %d = %d -> %d", i, this->var_i16_1b6, this->arr_i16_412ea[i]);
-
}
}
@@ -655,7 +653,7 @@ void FoolPrologue::sub_129_004() {
}
// 129:0772
// g_zbasic->pushOldCodeResource(0x81);
- this->sub_130_004();
+ this->prologueRun();
}
}
@@ -668,21 +666,21 @@ void FoolPrologue::sub_129_764() {
void FoolPrologue::sub_129_772() {
// g_zbasic->pushOldCodeResource(0x81);
- this->sub_130_004();
+ this->prologueRun();
}
-// run prologue
-void FoolPrologue::sub_130_004() {
+void FoolPrologue::prologueRun() {
// 130:0004
this->var_i16_3ce = 5;
this->prologueDrawLoadingMsg();
this->var_i16_18e = SCREEN_HEIGHT;
this->shuffleScanlines();
+ // "The Fool's Errand" title card
this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
this->var_i16_3ce = 10;
this->prologueDrawLoadingMsg();
- this->sub_128_1f4(0xb);
+ this->setPortBitsToPage(0xb);
this->fillRect(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
g_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
g_toolbox->ReleaseResource(this->glob_i32_2ce);
@@ -695,13 +693,13 @@ void FoolPrologue::sub_130_004() {
for (int i = 1; i <= 5; i++) {
this->prologueBufferNextPicture();
}
- this->sub_128_1f4(7);
+ this->setPortBitsToPage(7);
// 130:00d6
this->fillRect(2, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
- this->sub_128_1f4(8);
+ this->setPortBitsToPage(8);
// 130:011c
this->fillRect(2, 0, 0, 0x152, 0x1fc);
@@ -714,7 +712,7 @@ void FoolPrologue::sub_130_004() {
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[7]);
}
this->prologueBufferNextPicture();
- this->sub_128_1f4(0);
+ this->setPortBitsToPage(0);
// 130:01aa
g_zbasic->picture(0, 0, this->arr_i32_0[6]);
@@ -723,13 +721,13 @@ void FoolPrologue::sub_130_004() {
//g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
this->arr_i32_41296[1]->copyFrom(*this->arr_i32_41296[0]);
- this->sub_128_1f4(1);
+ this->setPortBitsToPage(1);
// 130:0202
g_zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
g_toolbox->ReleaseResource(this->arr_i32_0[7]);
this->prologueBufferNextPicture();
- this->sub_128_1f4(2);
+ this->setPortBitsToPage(2);
// 130:0234
this->fillRect(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
@@ -747,7 +745,7 @@ void FoolPrologue::sub_130_004() {
}
// 130:029a
- this->sub_128_1f4(j - 6);
+ this->setPortBitsToPage(j - 6);
g_zbasic->picture(0, 0, this->arr_i32_0[j]);
g_zbasic->picture(this->var_i16_74, 0x96, this->arr_i32_0[j - 6]);
g_toolbox->ReleaseResource(this->arr_i32_0[j]);
@@ -756,7 +754,7 @@ void FoolPrologue::sub_130_004() {
this->prologueBufferNextPicture();
// 130:0320
- this->sub_128_1f4(6);
+ this->setPortBitsToPage(6);
g_zbasic->picture(0, 0, this->arr_i32_0[0xc]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
@@ -765,6 +763,7 @@ void FoolPrologue::sub_130_004() {
this->prologueBufferNextPicture();
}
+ // fool looking up at sun
this->arr_i32_0[0x48] = g_toolbox->GetPicture(0x48);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -777,11 +776,11 @@ void FoolPrologue::sub_130_004() {
g_toolbox->SetPort(this->var_i32_8);
}
// 130:03e4
- this->sub_128_21e(0x3c);
- this->sub_128_64a(0x2);
- this->sub_128_21e(0x1e);
+ this->delay(0x3c);
+ this->scanlineTransition(0x2);
+ this->delay(0x1e);
this->sub_128_610(0xb);
- this->sub_128_21e(0x5a);
+ this->delay(0x5a);
this->sub_130_db0();
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
@@ -892,14 +891,14 @@ void FoolPrologue::sub_130_004() {
this->var_i32_2 = g_toolbox->TickCount();
// 130:0890
// g_zbasic->52(0);
- this->sub_128_1f4(0);
+ this->setPortBitsToPage(0);
this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->sub_130_f48();
this->sub_128_de2();
- this->sub_128_1f4(1);
+ this->setPortBitsToPage(1);
this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
@@ -912,7 +911,7 @@ void FoolPrologue::sub_130_004() {
}
// 130:0978
for (int i = 1; i <= 5; i++) {
- this->sub_128_1f4(i);
+ this->setPortBitsToPage(i);
g_toolbox->PenPat(this->arr_pat_194[1]);
g_toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
g_toolbox->FrameOval(this->arr_i16_1bc);
@@ -925,7 +924,7 @@ void FoolPrologue::sub_130_004() {
}
}
// 130:0a42
- this->sub_128_1f4(6);
+ this->setPortBitsToPage(6);
this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
this->sub_128_de2();
@@ -933,10 +932,10 @@ void FoolPrologue::sub_130_004() {
this->arr_i32_41296[7]->copyFrom(*this->arr_i32_41296[6]);
this->sub_130_f48();
g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
- this->sub_128_1f4(7);
+ this->setPortBitsToPage(7);
// 130:0ac2
g_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
- this->sub_128_1f4(8);
+ this->setPortBitsToPage(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
this->fillRect(0, 0x73, 0x15f, 0xf6, 0x1dc);
@@ -946,8 +945,8 @@ void FoolPrologue::sub_130_004() {
// 130:0b74
this->sub_128_24a(0xd2);
this->sub_128_e80();
- this->sub_128_64a(1);
- this->sub_128_21e(0x14);
+ this->scanlineTransition(1);
+ this->delay(0x14);
this->sub_128_6e4(0);
this->sub_128_e58();
// 130:0b98
@@ -995,7 +994,7 @@ void FoolPrologue::sub_130_004() {
this->sub_128_610(0x6);
this->sub_128_e58();
this->sub_128_50a(0x7, 0, 0x1fc, 0);
- this->sub_128_21e(0xa);
+ this->delay(0xa);
this->sub_128_610(0x8);
this->sub_128_e58();
this->sub_128_354(kPatCopy, 1);
@@ -1100,7 +1099,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->ClosePoly();
// 131:004c
this->arr_i32_0[0x1f] = g_toolbox->GetPicture(0x1f);
- this->sub_128_1f4(0x4);
+ this->setPortBitsToPage(0x4);
g_zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
this->sub_131_4dc0();
@@ -1114,7 +1113,7 @@ void FoolPrologue::sub_131_004() {
}
// 131:00e6
for (int i = 6; i <= 9; i++) {
- this->sub_128_1f4(i);
+ this->setPortBitsToPage(i);
this->fillRect(0, 0, 0, 0x152, 0x1fc);
// 131:0110
if (i < 8) {
@@ -1133,7 +1132,7 @@ void FoolPrologue::sub_131_004() {
}
// 131:01aa
this->arr_i32_0[0x13] = g_toolbox->GetPicture(0x13);
- this->sub_128_1f4(0x5);
+ this->setPortBitsToPage(0x5);
g_zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
g_zbasic->picture(0, 0, this->arr_i32_0[0x18]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x13]);
@@ -1163,7 +1162,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPort(this->var_i32_8);
}
// 131:02ec
- this->sub_128_21e(0x3c);
+ this->delay(0x3c);
this->sub_128_6e4(0x5);
this->sub_128_e58();
this->sub_131_4e98();
@@ -1193,24 +1192,24 @@ void FoolPrologue::sub_131_004() {
}
// 131:03c0
- this->sub_128_21e(0x1e);
+ this->delay(0x1e);
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(22));
g_zbasic->bufferFlush(this->var_str_76);
// 131:0400
this->sub_128_a6c(0x178, 0xb4);
- this->sub_128_21e(0x1e);
+ this->delay(0x1e);
// 131:041a
g_zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
- this->sub_128_21e(0x2);
+ this->delay(0x2);
g_zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
- this->sub_128_21e(0x3c);
+ this->delay(0x3c);
g_zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
- this->sub_128_21e(0x6);
+ this->delay(0x6);
g_zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
- this->sub_128_21e(0x6);
+ this->delay(0x6);
g_zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
// 131:04b4
@@ -1236,13 +1235,13 @@ void FoolPrologue::sub_131_004() {
this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
// 131:05b0
- this->sub_128_1f4(6);
+ this->setPortBitsToPage(6);
g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->sub_128_1f4(7);
+ this->setPortBitsToPage(7);
g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->sub_128_1f4(8);
+ this->setPortBitsToPage(8);
g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->sub_128_1f4(9);
+ this->setPortBitsToPage(9);
g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
// 131:0630
@@ -1348,7 +1347,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_1ba(5);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
g_toolbox->SetPortBits(this->var_i32_32);
- this->sub_128_21e(0x3c);
+ this->delay(0x3c);
g_zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
// 131:0c36
@@ -1363,15 +1362,15 @@ void FoolPrologue::sub_131_004() {
//g_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[5]);
}
- this->sub_128_1f4(0x6);
+ this->setPortBitsToPage(0x6);
g_zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
- this->sub_128_1f4(0x7);
+ this->setPortBitsToPage(0x7);
g_zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
- this->sub_128_1f4(0x8);
+ this->setPortBitsToPage(0x8);
g_zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
- this->sub_128_1f4(0x9);
+ this->setPortBitsToPage(0x9);
g_zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
- this->sub_128_1f4(0xa);
+ this->setPortBitsToPage(0xa);
g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
// 131:0d64
@@ -1382,11 +1381,11 @@ void FoolPrologue::sub_131_004() {
this->sub_128_24a(0x64);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
- this->sub_128_21e(0xf);
+ this->delay(0xf);
this->sub_128_50a(i, 0, 0x1fc, 1);
}
g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
- this->sub_128_21e(0x3c);
+ this->delay(0x3c);
// 131:0e08
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
@@ -1398,25 +1397,25 @@ void FoolPrologue::sub_131_004() {
// 131:0e76
//g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
this->arr_i32_41296[5]->copyFrom(*this->arr_i32_41296[4]);
- this->sub_128_1f4(0x5);
+ this->setPortBitsToPage(0x5);
g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
g_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
- this->sub_128_1f4(0x6);
+ this->setPortBitsToPage(0x6);
this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
- this->sub_128_1f4(0x7);
+ this->setPortBitsToPage(0x7);
this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
//g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
- this->sub_128_1f4(0x8);
+ this->setPortBitsToPage(0x8);
g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
//g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
this->arr_i32_41296[9]->copyFrom(*this->arr_i32_41296[4]);
- this->sub_128_1f4(0x9);
+ this->setPortBitsToPage(0x9);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
- this->sub_128_1f4(0xa);
+ this->setPortBitsToPage(0xa);
this->fillRect(0, 0, 0x152, 0x1fc, 2);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
@@ -1426,7 +1425,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_24a(0x78);
this->fillRect(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
- this->sub_128_21e(0x28);
+ this->delay(0x28);
this->var_i16_5c.left = 0x118;
this->var_i16_5c.right = 0x1d1;
@@ -1452,7 +1451,7 @@ void FoolPrologue::sub_131_004() {
// 131:11a4
this->sub_128_1ba(0x5);
- this->sub_128_1f4(0x5);
+ this->setPortBitsToPage(0x5);
this->fillRect(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1480,13 +1479,13 @@ void FoolPrologue::sub_131_004() {
// 131:12cc
this->sub_128_800(0x146, 0x1b4, 0x146, 0x1b4, 0xbc, 0x18b, 0x152, 0x1e2, 0x10);
this->sub_128_50a(0x5, 0x128, 0x1fc, 0x1);
- this->sub_128_21e(0xec);
+ this->delay(0xec);
for (int i = 8; i < 0xa; i++) {
this->sub_128_50a(i, 0, 0x1fc, 1);
}
this->var_i32_2 = g_toolbox->TickCount();
- this->sub_128_1f4(0x5);
+ this->setPortBitsToPage(0x5);
this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
@@ -1510,9 +1509,9 @@ void FoolPrologue::sub_131_004() {
// 131:1424
g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
- this->sub_128_21e(0x1);
+ this->delay(0x1);
g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
- this->sub_128_21e(0x1);
+ this->delay(0x1);
g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
this->sub_128_1ba(0x6);
g_toolbox->PenNormal();
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 1a7ddd6da6a..1d9bfded1b3 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -40,8 +40,8 @@ public:
void sub_128_004();
void sub_128_1ba(int16 screenPage);
- void sub_128_1f4(int16 screenPage);
- void sub_128_21e(int16 numTicks);
+ void setPortBitsToPage(int16 screenPage); // sub_128_1f4
+ void delay(int16 numTicks); // sub_128_21e
void sub_128_24a(int16 numTicks);
void sub_128_26c(int16 unk1, int16 unk2);
void sub_128_2a6(int16 unk1, int16 unk2);
@@ -50,7 +50,7 @@ public:
void sub_128_3ee(int16 unk1);
void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
void sub_128_610(int16 screenPage);
- void sub_128_64a(int16 unk1);
+ void scanlineTransition(int16 patternID);
void sub_128_6e4(int16 screenPage);
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
void sub_128_a6c(int16_t unk1, int16_t unk2);
@@ -69,9 +69,9 @@ public:
void sub_129_764();
void sub_129_772();
- void sub_130_004();
- void prologueBufferNextPicture();
- void prologueDrawLoadingMsg();
+ void prologueRun(); // sub_130_004
+ void prologueBufferNextPicture(); // sub_130_cea
+ void prologueDrawLoadingMsg(); // sub_130_d28
void sub_130_db0();
void drawRainDrop(); // sub_130_e82
void sub_130_f48();
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index de0a0f1c372..f7bae2a6e8a 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -394,6 +394,14 @@ public:
// port.
void GetCPixel(int16 h, int16 v, RGBColor &cPix);
+ // PROCEDURE GetPort (VAR port: GrafPtr);
+ // The GetPort procedure returns a pointer to the current graphics port in the port
+ // parameter. The current graphics port is also available through the global variable
+ // thePort, but you may prefer to use GetPort for better readability of your code. For
+ // example, your program could include GetPort(savePort) before setting a new
+ // graphics port, followed by SetPort(savePort) to restore the previous port.
+ void GetPort(GrafPtr &port);
+
// FUNCTION GetPicture (picID: INTEGER) : PicHandle;
// GetPicture returns a handle to the picture having the given resource ID, reading it from the
// resource file if necessary. It calls the Resource Manager function GetResource('PICT',picID). If
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index b86a8d8c1a4..9d6d04badd7 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -146,6 +146,10 @@ PicHandle Toolbox::GetPicture(uint16 picID) {
return nullptr;
}
+void Toolbox::GetPort(GrafPtr &port) {
+ port = _port;
+}
+
void Toolbox::HideCursor() {
_cursorLevel--;
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 6c33b7b910a..d2e892ed04d 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -211,11 +211,21 @@ void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
return;
}
+ GrafPtr port = nullptr;
+ _toolbox->GetPort(port);
+
Common::Rect srcRect(0, 0, src->w, src->h);
Common::Rect destRect(x, y, x+src->w, y+src->h);
- _window->getWindowSurface()->blitFrom(*src, srcRect, destRect);
- _window->addDirtyRect(destRect);
- _window->setContentDirty(true);
+ _toolbox->CopyBits(src, port->portBits, srcRect, destRect, kSrcCopy, nullptr);
+
+ //Common::Rect badnews = src->getBounds();
+ //_window->getWindowSurface()->blitFrom(*src, badnews, badnews);
+ //Common::Rect badnews = port->portBits->getBounds();
+ //_window->getWindowSurface()->blitFrom(*port->portBits, badnews, badnews);
+ //_window->addDirtyRect(badnews);
+ //_window->setContentDirty(true);
+ //_toolbox->Delay(0);
+ //warning("did something stupid");
}
void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
Commit: 6593d180c864f785a0e4f1c907da2e9664964059
https://github.com/scummvm/scummvm/commit/6593d180c864f785a0e4f1c907da2e9664964059
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:50+02:00
Commit Message:
FOOL: Fix raindrop blitting
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 5ca53008964..e850fd12985 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -241,7 +241,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
}
}
-void FoolPrologue::sub_128_610(int16 screenPage) {
+void FoolPrologue::blitPageToScreen(int16 screenPage) {
// 128:0610
this->var_i32_40 = this->arr_i32_41296[screenPage];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
@@ -325,7 +325,7 @@ void FoolPrologue::sub_128_a6c(int16_t unk1, int16_t unk2) {
g_toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::sub_128_a8c(int16_t unk) {
+void FoolPrologue::drawRainRecycle(int16_t unk) {
// 128:0a8c
this->var_i16_1a4 = unk;
g_toolbox->PenMode(kPatXor);
@@ -341,7 +341,7 @@ void FoolPrologue::sub_128_a8c(int16_t unk) {
+ this->arr_i16_1e8[0x2f1+this->var_i16_6];
// 128:0b52
- if ((this->arr_i16_1e8[this->var_i16_6] < 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] < 0x140)) {
+ if ((this->arr_i16_1e8[this->var_i16_6] > 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] > 0x140)) {
// 128:0bae
this->arr_i16_1e8[this->var_i16_6] = g_zbasic->rndInt(0x264) - 0xc8;
@@ -775,20 +775,29 @@ void FoolPrologue::prologueRun() {
this->fillRect(2, 0, 0, 0x14, this->var_i16_10);
g_toolbox->SetPort(this->var_i32_8);
}
+
+ // We're done loading, start the intro.
+ // Erase the screen with a bunch of cool scanlines.
+
// 130:03e4
this->delay(0x3c);
this->scanlineTransition(0x2);
this->delay(0x1e);
- this->sub_128_610(0xb);
+
+ // draw logo
+ this->blitPageToScreen(0xb);
this->delay(0x5a);
- this->sub_130_db0();
+
+ // animate rain
+ this->drawRain();
+
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
// 130:043c
for (int i = 1; i <= 2; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->sub_128_a8c(0xb4);
+ this->drawRainRecycle(0xb4);
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
this->sub_128_24a(1);
@@ -799,21 +808,21 @@ void FoolPrologue::prologueRun() {
this->var_i32_40 = this->arr_i32_41296[8];
// 130:049e
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->sub_128_a8c(4);
+ this->drawRainRecycle(4);
this->var_i16_192 = 0;
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[3];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->sub_128_a8c(5);
+ this->drawRainRecycle(5);
// 130:0518
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[4];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->sub_128_a8c(5);
+ this->drawRainRecycle(5);
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[5];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->sub_128_a8c(5);
+ this->drawRainRecycle(5);
}
// 130:05b6
this->var_i32_40 = this->arr_i32_41296[7];
@@ -822,10 +831,10 @@ void FoolPrologue::prologueRun() {
}
// 130:05fc
- this->sub_128_610(0);
- this->sub_130_db0();
+ this->blitPageToScreen(0);
+ this->drawRain();
this->var_i32_2 = g_toolbox->TickCount();
- this->sub_128_a8c(0xb4);
+ this->drawRainRecycle(0xb4);
this->var_i32_40 = this->arr_i32_41296[1];
// 130:062c
@@ -844,26 +853,26 @@ void FoolPrologue::prologueRun() {
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
}
// 130:06b0
- this->sub_128_a8c(1);
+ this->drawRainRecycle(1);
}
this->var_i32_2 = g_toolbox->TickCount();
- this->sub_128_a8c(0xa);
- this->sub_128_610(1);
+ this->drawRainRecycle(0xa);
+ this->blitPageToScreen(1);
// 130:06d4
for (int i = 1; i <= 4; i++) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
- this->sub_128_a8c(0x2);
+ this->drawRainRecycle(0x2);
}
// 130:0704
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
- this->sub_128_a8c(0xf);
+ this->drawRainRecycle(0xf);
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
- this->sub_128_a8c(0x78);
- this->sub_128_610(2);
- this->sub_130_db0();
+ this->drawRainRecycle(0x78);
+ this->blitPageToScreen(2);
+ this->drawRain();
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
@@ -873,11 +882,11 @@ void FoolPrologue::prologueRun() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[i];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->sub_128_a8c(3);
+ this->drawRainRecycle(3);
}
}
// 130:07ec
- this->sub_128_610(6);
+ this->blitPageToScreen(6);
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i <= 0x2d; i++) {
this->var_i32_2 = g_toolbox->TickCount();
@@ -963,7 +972,7 @@ void FoolPrologue::prologueRun() {
if (this->var_i16_74 == 1) {
this->var_i16_192 = 1;
}
- this->sub_128_610(this->var_i16_74);
+ this->blitPageToScreen(this->var_i16_74);
this->sub_128_24a(0xa);
// 130:0bee
this->var_i16_1ba = g_toolbox->GetNextEvent(2, this->var_ev_22);
@@ -979,7 +988,7 @@ void FoolPrologue::prologueRun() {
if (this->var_i16_74 == 1) {
this->var_i16_192 = 1;
}
- this->sub_128_610(this->var_i16_74);
+ this->blitPageToScreen(this->var_i16_74);
this->sub_128_24a(0xa);
// 130:0c56
this->var_i16_1ba = g_toolbox->GetNextEvent(-1, this->var_ev_22);
@@ -991,11 +1000,11 @@ void FoolPrologue::prologueRun() {
}
}
// 130:0ca8
- this->sub_128_610(0x6);
+ this->blitPageToScreen(0x6);
this->sub_128_e58();
this->sub_128_50a(0x7, 0, 0x1fc, 0);
this->delay(0xa);
- this->sub_128_610(0x8);
+ this->blitPageToScreen(0x8);
this->sub_128_e58();
this->sub_128_354(kPatCopy, 1);
// 130:0ce6
@@ -1027,7 +1036,7 @@ void FoolPrologue::prologueDrawLoadingMsg() {
g_toolbox->SetPort(this->var_i32_8);
}
-void FoolPrologue::sub_130_db0() {
+void FoolPrologue::drawRain() {
// 130:0db0
g_zbasic->unk_20();
g_toolbox->PenMode(kPatXor);
@@ -1053,6 +1062,7 @@ void FoolPrologue::drawRainDrop() {
this->arr_i16_1e8[this->var_i16_6] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
this->arr_i16_1e8[this->var_i16_6 + 0xfb] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6]
);
+
}
void FoolPrologue::sub_130_f48() {
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 1d9bfded1b3..8e458a395a5 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -49,12 +49,12 @@ public:
void sub_128_354(PatternMode mode, uint16 unk2);
void sub_128_3ee(int16 unk1);
void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
- void sub_128_610(int16 screenPage);
+ void blitPageToScreen(int16 screenPage); // sub_128_610
void scanlineTransition(int16 patternID);
void sub_128_6e4(int16 screenPage);
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
void sub_128_a6c(int16_t unk1, int16_t unk2);
- void sub_128_a8c(int16_t unk);
+ void drawRainRecycle(int16_t unk); // sub_128_a8c
void sub_128_c8a();
void shuffleScanlines(); // sub_128_ccc
void sub_128_de2();
@@ -72,7 +72,7 @@ public:
void prologueRun(); // sub_130_004
void prologueBufferNextPicture(); // sub_130_cea
void prologueDrawLoadingMsg(); // sub_130_d28
- void sub_130_db0();
+ void drawRain(); // sub_130_db0
void drawRainDrop(); // sub_130_e82
void sub_130_f48();
void sub_130_1002();
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 54aa592e764..323f18e56bb 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -62,6 +62,7 @@ void Toolbox::_pumpEvents() {
}
void Toolbox::_updateScreen() {
+ _defaultWindow->getWindowSurface()->copyFrom(*_defaultBits);
g_engine->_wm.draw();
_frameLimiter->delayBeforeSwap();
g_system->updateScreen();
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index f7bae2a6e8a..af8254b00eb 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -74,6 +74,8 @@ struct Common::Hash<Fool::PicHandle> {
namespace Fool {
+
+// In QuickDraw 0 means white and 1 means black
struct Pattern {
uint8 data[8];
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 9d6d04badd7..056fb0707ef 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -278,7 +278,8 @@ void Toolbox::PenNormal() {
if (_port) {
_port->pnSize = Common::Point(1, 1);
_port->pnMode = kPatCopy;
- _port->pnPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ // Solid black for the pattern
+ _port->pnPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
}
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index d2e892ed04d..07ed412739e 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -24,6 +24,7 @@
#include "common/memstream.h"
#include "common/str-enc.h"
#include "common/stream.h"
+#include "graphics/managed_surface.h"
#include "fool/fool.h"
#include "fool/toolbox.h"
@@ -39,7 +40,8 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
g_engine->_wm.setBackgroundWindow(_window);
_toolbox->_defaultWindow = _window;
- _toolbox->_defaultBits = BitMap(_window->getWindowSurface());
+ _toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
+ _toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
}
ZBasic::~ZBasic() {
Commit: 22205c5d52d8481baf81057596426de1782b912f
https://github.com/scummvm/scummvm/commit/22205c5d52d8481baf81057596426de1782b912f
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:50+02:00
Commit Message:
MACGUI: Fix pattern fill for thick pen
Changed paths:
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 23de0870971..76ba4c13f61 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -850,7 +850,7 @@ void MacDrawPrimitives<T>::drawPoint(int x, int y, uint32 color, void *data) {
uint xu = (uint)x; // for letting compiler optimize it
uint yu = (uint)y;
*((T *)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((T *)p->surface->getBasePtr(xu, yu))) :
- (pat[(yu + p->fillOriginY) % 8] & (1 << (7 + (xu - p->fillOriginX) % 8))) ? color : p->bgColor;
+ (pat[(yu + p->fillOriginY) % 8] & (1 << (7 - (xu + p->fillOriginX) % 8))) ? color : p->bgColor;
if (p->mask)
*((T *)p->mask->getBasePtr(xu, yu)) = 0xff;
Commit: 5b9ace27657a31dafdab8cdd530703d36277c0bd
https://github.com/scummvm/scummvm/commit/5b9ace27657a31dafdab8cdd530703d36277c0bd
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:51+02:00
Commit Message:
FOOL: Implement FrameOval and FrameRect
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index e850fd12985..1cd675a07e5 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -138,7 +138,7 @@ void FoolPrologue::delay(int16 numTicks) {
g_toolbox->Delay(numTicks);
}
-void FoolPrologue::sub_128_24a(int16 numTicks) {
+void FoolPrologue::delayFromMarker(int16 numTicks) {
// 128:024a
uint32 delay = (uint32)MAX<int>(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
// again, polling TickCount in a loop.
@@ -177,7 +177,7 @@ void FoolPrologue::sub_128_354(PatternMode mode, uint16 unk2) {
g_toolbox->FrameRect(this->arr_i16_1bc);
g_toolbox->InsetRect(this->arr_i16_1bc, 6, 4);
- this->sub_128_24a(1);
+ this->delayFromMarker(1);
}
g_toolbox->PenNormal();
}
@@ -206,7 +206,7 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
unk1 - this->arr_i16_1e8[i + 0x1f6]
);
if (i % this->var_i16_18c == 0) {
- this->sub_128_24a(0);
+ this->delayFromMarker(0);
};
}
@@ -236,7 +236,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
this->var_i16_5c.bottom = this->arr_i16_412ea[i];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
if (i % unk1 == 0) {
- this->sub_128_24a(0);
+ this->delayFromMarker(0);
}
}
}
@@ -257,13 +257,13 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
g_toolbox->MoveTo(0, this->arr_i16_412ea[i] - 1);
g_toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i] - 1);
if (i % 5 == 0) {
- this->sub_128_24a(0);
+ this->delayFromMarker(0);
}
}
g_toolbox->PenNormal();
}
-void FoolPrologue::sub_128_6e4(int16 screenPage) {
+void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
this->var_i32_40 = this->arr_i32_41296[screenPage];
for (int i = 0; i < 0x36; i++) {
@@ -273,8 +273,10 @@ void FoolPrologue::sub_128_6e4(int16 screenPage) {
this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ g_toolbox->Delay(0);
}
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ g_toolbox->Delay(0);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
@@ -313,7 +315,7 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_i16_41b0a.bottom = (int16_t)this->arr_f64_41bbe[2];
this->arr_i16_41b0a.right = (int16_t)this->arr_f64_41bbe[3];
g_toolbox->PaintRect(this->arr_i16_41b0a);
- this->sub_128_24a(0);
+ this->delayFromMarker(0);
}
g_toolbox->PaintRect(this->arr_i16_41afc);
g_toolbox->PenNormal();
@@ -690,6 +692,7 @@ void FoolPrologue::prologueRun() {
this->var_str_76 = g_zbasic->str(18);
this->sub_128_2a6(0x10d, 0xdd);
g_toolbox->SetPortBits(this->var_i32_32);
+ // cliffside images with lightning
for (int i = 1; i <= 5; i++) {
this->prologueBufferNextPicture();
}
@@ -711,12 +714,14 @@ void FoolPrologue::prologueRun() {
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[7]);
}
+ // high priestess skull
this->prologueBufferNextPicture();
this->setPortBitsToPage(0);
// 130:01aa
g_zbasic->picture(0, 0, this->arr_i32_0[6]);
g_toolbox->ReleaseResource(this->arr_i32_0[6]);
+ // high priestess face
this->prologueBufferNextPicture();
//g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
@@ -726,6 +731,7 @@ void FoolPrologue::prologueRun() {
// 130:0202
g_zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
g_toolbox->ReleaseResource(this->arr_i32_0[7]);
+ // priestess on mountain
this->prologueBufferNextPicture();
this->setPortBitsToPage(2);
@@ -736,6 +742,7 @@ void FoolPrologue::prologueRun() {
// 130:0276
for (int j = 9; j <= 0xb; j++) {
+ // priestess shooting lightning
this->prologueBufferNextPicture();
if (j == 9) {
@@ -751,6 +758,7 @@ void FoolPrologue::prologueRun() {
g_toolbox->ReleaseResource(this->arr_i32_0[j]);
g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
+ // priestess lightning closeup
this->prologueBufferNextPicture();
// 130:0320
@@ -760,6 +768,7 @@ void FoolPrologue::prologueRun() {
// 130:034a
for (int i = 0xd; i <= 0x12; i++) {
+ // priestess silhouette -> fool on the cliff
this->prologueBufferNextPicture();
}
@@ -800,7 +809,7 @@ void FoolPrologue::prologueRun() {
this->drawRainRecycle(0xb4);
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
- this->sub_128_24a(1);
+ this->delayFromMarker(1);
g_toolbox->InvertRect(this->arr_i16_1bc);
// 130:04ca
for (int j = 0; j <= 3; j++) {
@@ -890,7 +899,7 @@ void FoolPrologue::prologueRun() {
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i <= 0x2d; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->sub_128_24a(1);
+ this->delayFromMarker(1);
}
// 130:083c
g_zbasic->picture(0, 0, this->arr_i32_0[0xd]);
@@ -952,11 +961,16 @@ void FoolPrologue::prologueRun() {
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
// 130:0b74
- this->sub_128_24a(0xd2);
+ this->delayFromMarker(0xd2);
this->sub_128_e80();
this->scanlineTransition(1);
+
+ // rectangle zoom into the clifftop scene
+
this->delay(0x14);
- this->sub_128_6e4(0);
+ this->zoomTransition(0);
+
+ // stall until mouse click
this->sub_128_e58();
// 130:0b98
this->var_i16_74 = 0;
@@ -973,7 +987,7 @@ void FoolPrologue::prologueRun() {
this->var_i16_192 = 1;
}
this->blitPageToScreen(this->var_i16_74);
- this->sub_128_24a(0xa);
+ this->delayFromMarker(0xa);
// 130:0bee
this->var_i16_1ba = g_toolbox->GetNextEvent(2, this->var_ev_22);
}
@@ -989,7 +1003,7 @@ void FoolPrologue::prologueRun() {
this->var_i16_192 = 1;
}
this->blitPageToScreen(this->var_i16_74);
- this->sub_128_24a(0xa);
+ this->delayFromMarker(0xa);
// 130:0c56
this->var_i16_1ba = g_toolbox->GetNextEvent(-1, this->var_ev_22);
if (this->var_ev_22.what == kUpdateEvt) {
@@ -1006,6 +1020,9 @@ void FoolPrologue::prologueRun() {
this->delay(0xa);
this->blitPageToScreen(0x8);
this->sub_128_e58();
+
+ // zoom to close
+
this->sub_128_354(kPatCopy, 1);
// 130:0ce6
// JMP 1002
@@ -1173,7 +1190,7 @@ void FoolPrologue::sub_131_004() {
}
// 131:02ec
this->delay(0x3c);
- this->sub_128_6e4(0x5);
+ this->zoomTransition(0x5);
this->sub_128_e58();
this->sub_131_4e98();
// g_zbasic->52(0x4c);
@@ -1257,7 +1274,7 @@ void FoolPrologue::sub_131_004() {
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
g_zbasic->get(0x1bc, 0xc1, 0x1ee, 0x117, this->arr_i32_3bca4);
- this->sub_128_24a(0x3c);
+ this->delayFromMarker(0x3c);
this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
this->sub_128_50a(0x6, 0, 0x1fc, 0x3);
this->sub_131_4e48();
@@ -1318,7 +1335,7 @@ void FoolPrologue::sub_131_004() {
for (int i = 0; i < 0x21; i++) {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
- this->sub_128_24a(1);
+ this->delayFromMarker(1);
}
// 131:09d2
@@ -1334,7 +1351,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_192 = g_zbasic->rndInt(0xfc);
g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4);
g_toolbox->InvertRect(this->arr_i16_1bc);
- this->sub_128_24a(1);
+ this->delayFromMarker(1);
}
// 131:0aec
@@ -1388,7 +1405,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[i]);
}
g_toolbox->SetPortBits(this->var_i32_32);
- this->sub_128_24a(0x64);
+ this->delayFromMarker(0x64);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
this->delay(0xf);
@@ -1432,7 +1449,7 @@ void FoolPrologue::sub_131_004() {
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
g_toolbox->SetPortBits(this->var_i32_32);
- this->sub_128_24a(0x78);
+ this->delayFromMarker(0x78);
this->fillRect(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
this->delay(0x28);
@@ -1455,7 +1472,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcBic, nullptr);
this->var_i32_40 = this->arr_i32_41296[7];
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcOr, nullptr);
- this->sub_128_24a(0x2);
+ this->delayFromMarker(0x2);
g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, kSrcCopy, nullptr);
}
@@ -1481,7 +1498,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_26c(0x1f0, 0xd2);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
}
- this->sub_128_24a(0x2);
+ this->delayFromMarker(0x2);
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
}
@@ -1500,7 +1517,7 @@ void FoolPrologue::sub_131_004() {
this->fillRect(0, 0, 0x152, 0x1fc, 0);
g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
- this->sub_128_24a(0xa);
+ this->delayFromMarker(0xa);
this->var_i16_5c.left = 0x18b;
this->var_i16_5c.right = 0x1ef;
this->var_i16_64.left = 0x18b;
@@ -1514,7 +1531,7 @@ void FoolPrologue::sub_131_004() {
this->var_i16_64.top = i - 1;
this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, kSrcCopy, nullptr);
- this->sub_128_24a(0x1);
+ this->delayFromMarker(0x1);
}
// 131:1424
@@ -1553,7 +1570,7 @@ void FoolPrologue::sub_131_004() {
// 131:1582
g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
- this->sub_128_24a(0x1);
+ this->delayFromMarker(0x1);
g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, kSrcCopy, nullptr);
}
@@ -1573,7 +1590,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
g_toolbox->LineTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
if (i % 0x19 == 0) {
- this->sub_128_24a(0x1);
+ this->delayFromMarker(0x1);
}
}
}
@@ -1583,7 +1600,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->ReleaseResource(this->arr_i32_0[i]);
}
- this->sub_128_24a(0x3c);
+ this->delayFromMarker(0x3c);
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
g_zbasic->bufferFlush(this->var_str_76);
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 8e458a395a5..97b8836cf46 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -42,7 +42,7 @@ public:
void sub_128_1ba(int16 screenPage);
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
- void sub_128_24a(int16 numTicks);
+ void delayFromMarker(int16 numTicks); // sub_128_24a
void sub_128_26c(int16 unk1, int16 unk2);
void sub_128_2a6(int16 unk1, int16 unk2);
void fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right); // sub_128_2f0
@@ -50,8 +50,8 @@ public:
void sub_128_3ee(int16 unk1);
void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
void blitPageToScreen(int16 screenPage); // sub_128_610
- void scanlineTransition(int16 patternID);
- void sub_128_6e4(int16 screenPage);
+ void scanlineTransition(int16 patternID); // sub_128_64a
+ void zoomTransition(int16 screenPage); // sub_128_6e4
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
void sub_128_a6c(int16_t unk1, int16_t unk2);
void drawRainRecycle(int16_t unk); // sub_128_a8c
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 056fb0707ef..8b3110bbbe9 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -116,11 +116,47 @@ void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle)
}
void Toolbox::FrameOval(const Common::Rect &r) {
- warning("STUB: Toolbox::FrameOval");
+ if (_port && _port->pnVis == 0) {
+
+ BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
+ Graphics::MacPatterns pat({_port->pnPat.data});
+
+ Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ pm.drawEllipse(0, 0, r.width(), r.height(), _port->fgColor, false, &pd);
+ Common::Point destPos(r.left, r.top);
+
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+ }
}
void Toolbox::FrameRect(const Common::Rect &r) {
- warning("STUB: Toolbox::FrameRect");
+ if (_port && _port->pnVis == 0) {
+
+ BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
+ Graphics::MacPatterns pat({_port->pnPat.data});
+
+ Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Common::Rect destRect = intermediate->getBounds();
+ destRect.right -= _port->pnSize.x - 1;
+ destRect.bottom -= _port->pnSize.y - 1;
+
+ pm.drawRect(destRect, _port->fgColor, &pd);
+ Common::Point destPos(r.left, r.top);
+
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+ }
}
void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
@@ -161,7 +197,13 @@ void Toolbox::InitCursor() {
}
void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
- warning("STUB: Toolbox::InsetRect");
+ r.left += dh;
+ r.right -= dh;
+ r.top += dv;
+ r.bottom -= dv;
+ if ((r.width() < 1) || (r.height() < 1)) {
+ r = { 0, 0, 0, 0 };
+ }
}
void Toolbox::InvertOval(const Common::Rect &r) {
Commit: d4bb8b3848a1a638cf6a26a2289deac7b9df3a4c
https://github.com/scummvm/scummvm/commit/d4bb8b3848a1a638cf6a26a2289deac7b9df3a4c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:51+02:00
Commit Message:
FOOL: Fix FillRect
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 1cd675a07e5..84817de441c 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -67,10 +67,10 @@ void FoolPrologue::sub_128_004() {
// 128:0066
this->var_i32_4e = this->arr_i32_41296[11];
// 128:0078
- // stipple pattern buffer?
- this->arr_pat_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
- this->arr_pat_194[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } };
- this->arr_pat_194[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+ // pattern buffer
+ this->arr_pat_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; // solid white
+ this->arr_pat_194[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } }; // checkerboard
+ this->arr_pat_194[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; // solid black
// 128:00d6
@@ -877,12 +877,17 @@ void FoolPrologue::prologueRun() {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
this->drawRainRecycle(0xf);
+
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
this->drawRainRecycle(0x78);
this->blitPageToScreen(2);
+
+ // 130:0740
this->drawRain();
this->var_i32_2 = g_toolbox->TickCount();
+ this->drawRainRecycle(0xb4);
+
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
// 130:0778
@@ -928,6 +933,7 @@ void FoolPrologue::prologueRun() {
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[1]);
}
// 130:0978
+ // draw the sun pulsing to pages 1-5
for (int i = 1; i <= 5; i++) {
this->setPortBitsToPage(i);
g_toolbox->PenPat(this->arr_pat_194[1]);
@@ -1069,6 +1075,7 @@ void FoolPrologue::drawRain() {
this->var_i16_6 += 1;
}
this->var_i16_6 = 1;
+ g_toolbox->Delay(0);
}
void FoolPrologue::drawRainDrop() {
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 8b3110bbbe9..82c9390ca7c 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -102,7 +102,8 @@ void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawFilledRect(intermediate->getBounds(), _port->fgColor, &pd);
Common::Point destPos(r.left, r.top);
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ // FillRect always uses patCopy
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, kPatCopy);
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(dstRect);
_defaultWindow->setDirty(true);
Commit: c7eb7cf6302832ab503e69e7c1a0338163934330
https://github.com/scummvm/scummvm/commit/c7eb7cf6302832ab503e69e7c1a0338163934330
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:51+02:00
Commit Message:
FOOL: Initial implementation of text drawing
Changed paths:
A engines/fool/toolbox_text.cpp
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 922bcf4c89f..ec0c88ff806 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS = \
toolbox.o \
toolbox_quickdraw.o \
toolbox_resman.o \
+ toolbox_text.o \
zbasic.o \
console.o \
messages.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index af8254b00eb..d738c0c130c 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -143,6 +143,8 @@ enum WindowDefinition {
kRDocProc = 16,
};
+// for text style: use kMacFont*
+
struct GrafPort {
uint16 device = 0;
BitMap portBits;
@@ -187,6 +189,13 @@ struct ToolboxResInfo {
Common::String name;
};
+struct FontInfo {
+ int16 ascent;
+ int16 descent;
+ int16 widMax;
+ int16 leading;
+};
+
class Toolbox {
public:
@@ -194,6 +203,10 @@ public:
Toolbox();
~Toolbox();
+ Graphics::MacWindow *_defaultWindow;
+ BitMap _defaultBits;
+
+
// toolbox.cpp
// PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
@@ -217,6 +230,13 @@ public:
// toolbox_resman.cpp
+ // FUNCTION CountResources (theType: ResType): Integer;
+ // Given a resource type, the CountResources function reads the resource maps in
+ // memory for all resource forks open to your application. It returns as its function result
+ // the total number of resources of the given type in all resource forks open to your
+ // application.
+ uint16 CountResources(ResType theType);
+
// FUNCTION CurResFile: INTEGER;
// CurResFile returns the reference number of the current resource file. You can call it when the
// application starts up to get the reference number of its resource file.
@@ -238,6 +258,15 @@ public:
// case of an error, GetHandleSize returns 0.
Size GetHandleSize(Handle &h);
+ // FUNCTION GetIndResource (theType: ResType; index: Integer): Handle;
+ // Given an index ranging from 1 to the number of resources of a given type returned by
+ // CountResources (that is, the number of resources of that type in all resource forks open
+ // to your application), the GetIndResource function returns a handle to a resource of the
+ // given type. If you call GetIndResource repeatedly over the entire range of the index, it
+ // returns handles to all resources of the given type in all resource forks open to your
+ // application.
+ Handle GetIndResource(ResType theType, uint16 index);
+
// FUNCTION GetNamedResource (theType: ResType; name: Str255) : Handle;
// GetNamedResource is the same as GetResource (above) except that you pass a resource name
// instead of an ID number.
@@ -342,19 +371,6 @@ public:
// srcBits.bounds coordinates.
void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
- // PROCEDURE DrawChar (ch: CHAR);
- // DrawChar places the given character to the right of the pen location, with the left end of its base
- // line at the pen's location, and advances the pen accordingly. If the character isn't in the font, the
- // font's missing symbol is drawn.
- void DrawChar(Common::u32char_type_t ch);
-
- // PROCEDURE DrawString (s: Str255);
- // DrawString calls DrawChar for each character in the given string. The string is placed beginning
- // at the current pen location and extending right. No formatting (such as carriage returns and line
- // feeds) is performed by QuickDraw. The pen location ends up to the right of the last character in
- // the string.
- void DrawString(const Common::String &s);
-
// PROCEDURE EndUpdate (theWindow: WindowPtr);
// Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
// BeginUpdate as described above.
@@ -559,13 +575,46 @@ public:
// ShowCursor have no effect.
void ShowCursor();
+
+ // toolbox_text.cpp
+
+ // PROCEDURE DrawChar (ch: CHAR);
+ // DrawChar places the given character to the right of the pen location, with the left end of its base
+ // line at the pen's location, and advances the pen accordingly. If the character isn't in the font, the
+ // font's missing symbol is drawn.
+ void DrawChar(Common::u32char_type_t ch);
+
+ // PROCEDURE DrawString (s: Str255);
+ // DrawString calls DrawChar for each character in the given string. The string is placed beginning
+ // at the current pen location and extending right. No formatting (such as carriage returns and line
+ // feeds) is performed by QuickDraw. The pen location ends up to the right of the last character in
+ // the string.
+ void DrawString(const Common::U32String &s);
+
// PROCEDURE StringWidth (s: Str255) : INTEGER;
// StringWidth returns the width of the given text string, which it calculates by adding the
// CharWidths of all the characters in the string (see above).
- uint16 StringWidth(const Common::String &s);
-
- Graphics::MacWindow *_defaultWindow;
- BitMap _defaultBits;
+ uint16 StringWidth(const Common::U32String &s);
+
+ // PROCEDURE TextFace (face: Style);
+ // The TextFace procedure sets the style of the font in which the text is to be drawn in the
+ // current graphics port.
+ void TextFace(uint16 style);
+
+ // PROCEDURE TextFont (font: Integer);
+ // The TextFont procedure sets the font of the current graphics port in which the text is
+ // to be rendered.
+ void TextFont(uint16 font);
+
+ // PROCEDURE TextMode (mode: Integer);
+ // The TextMode procedure sets the transfer mode for drawing text in the current
+ // graphics port.
+ void TextMode(SourceMode mode);
+
+ // PROCEDURE TextSize (size: Integer);
+ // The TextSize procedure sets the font size for text drawn in the current graphics port to
+ // the speciï¬ed number of points.
+ void TextSize(uint16 size);
private:
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 82c9390ca7c..02010a466b6 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -76,10 +76,6 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
}
}
-void Toolbox::DrawString(const Common::String &s) {
- warning("STUB: Toolbox::DrawString");
-}
-
void Toolbox::EndUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::EndUpdate");
}
@@ -89,6 +85,15 @@ void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
}
void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
+ // maybe the better way of refactoring this would be to fork the Primitives
+ // object from MacWindowManager and make one that uses GrafPort as a state store?
+ // as it stands, all the operations fall back to calling DrawPoint over and over again,
+ // which can touch the same pixel multiple times.
+ // this is a problem for all the xor blend modes.
+ // we could have it so that the draw commands check a mask before drawing again, and it
+ // gets reset after every op. this would be pretty inefficient; e.g. in fools errand most
+ // of the time is spent drawing to the screen or to a screen-sized buffer.
+
// steps:
// - create intermediate surface
// - draw to intermediate surface using MacPlotData
@@ -215,6 +220,7 @@ void Toolbox::InvertRect(const Common::Rect &r) {
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(nullptr);
+ // set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
Graphics::MacPatterns macpat({pat.data});
Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, 0, 0, {1, 1}, g_engine->_wm._colorWhite);
@@ -226,10 +232,7 @@ void Toolbox::InvertRect(const Common::Rect &r) {
_defaultWindow->addDirtyRect(dstRect);
_defaultWindow->setDirty(true);
}
-
-
}
- warning("STUB: Toolbox::InvertRect");
}
void Toolbox::KillPoly(PolyHandle poly) {
@@ -374,10 +377,5 @@ void Toolbox::ShowCursor() {
}
-uint16 Toolbox::StringWidth(const Common::String &s) {
- warning("STUB: Toolbox::StringWidth");
- return 0;
-}
-
} // namespace Fool
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index 78269c338c0..230d9896b99 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -128,6 +128,7 @@ int16 Toolbox::OpenResFile(const Common::Path &fileName) {
_resOrder.insert_at(0, result);
_nextResId++;
_resIndexStart = 0;
+ g_engine->_wm._fontMan->loadFonts(res.get());
return result;
}
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
new file mode 100644
index 00000000000..c42469fa261
--- /dev/null
+++ b/engines/fool/toolbox_text.cpp
@@ -0,0 +1,91 @@
+/* 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 "graphics/macgui/mactext-canvas.h"
+#include "graphics/macgui/mactext.h"
+#include "graphics/managed_surface.h"
+#include "graphics/pixelformat.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+#include "fool/utils.h"
+
+namespace Fool {
+
+void Toolbox::DrawChar(Common::u32char_type_t ch) {
+ warning("STUB: Toolbox::DrawChar");
+}
+
+void Toolbox::DrawString(const Common::U32String &s) {
+ if (_port) {
+ Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
+ const Graphics::Font *font = fontRun.getFont();
+ Common::Rect bbox = font->getBoundingBox(s);
+ BitMap buffer(new Graphics::ManagedSurface(bbox.width(), bbox.height(), Graphics::PixelFormat::createFormatCLUT8()));
+ buffer->fillRect(buffer->getBounds(), _port->bkColor);
+ font->drawString(buffer->surfacePtr(), s.encode(), 0, 0, bbox.width(), _port->fgColor);
+
+ BitMap mask(nullptr);
+
+ Common::Rect result = blitMono(buffer, _port->portBits, mask, Common::Point(_port->pnLoc.x, _port->pnLoc.y-font->getFontAscent()), _port->txMode);
+ _port->pnLoc.x += bbox.width();
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(result);
+ _defaultWindow->setDirty(true);
+ }
+ }
+}
+
+uint16 Toolbox::StringWidth(const Common::U32String &s) {
+ if (_port) {
+ Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
+ uint16 result = fontRun.getFont()->getStringWidth(s);
+ warning("STUB: Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
+ return result;
+ }
+ return 0;
+}
+
+void Toolbox::TextFace(uint16 style) {
+ if (_port) {
+ _port->txFace = style;
+ }
+}
+
+void Toolbox::TextFont(uint16 font) {
+ if (_port) {
+ _port->txFont = font;
+ }
+}
+
+void Toolbox::TextMode(SourceMode mode) {
+ if (_port) {
+ _port->txMode = mode;
+ }
+}
+
+void Toolbox::TextSize(uint16 size) {
+ if (_port) {
+ _port->txSize = size;
+ }
+}
+
+} // namespace Fool
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 07ed412739e..ebd1aa817b9 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -42,6 +42,7 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_toolbox->_defaultWindow = _window;
_toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
+
}
ZBasic::~ZBasic() {
@@ -289,8 +290,11 @@ const Common::U32String &ZBasic::str(size_t index) {
return *_stringTable[index]->data.str;
}
-void ZBasic::text(int16 font, int16 size, int16 face, SourceMode mode) {
- warning("STUB: ZBasic::text");
+void ZBasic::text(uint16 font, uint16 size, uint16 face, SourceMode mode) {
+ _toolbox->TextFont(font);
+ _toolbox->TextSize(size);
+ _toolbox->TextFace(face);
+ _toolbox->TextMode(mode);
}
void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index fcb43c12b09..2268a464cf4 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -249,7 +249,7 @@ public:
int16 readInt();
Common::U32String readStr();
int16 rndInt(int16 max);
- void text(int16 font, int16 size, int16 face, SourceMode mode);
+ void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
const Common::U32String &str(size_t index);
Commit: d9fc6f5cef4eb5c7c98d6a36fc4e8e7609f24221
https://github.com/scummvm/scummvm/commit/d9fc6f5cef4eb5c7c98d6a36fc4e8e7609f24221
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:52+02:00
Commit Message:
MACGUI: Fix font colour downconversion
Changed paths:
graphics/macgui/mactext-canvas.h
diff --git a/graphics/macgui/mactext-canvas.h b/graphics/macgui/mactext-canvas.h
index 893b335597c..675ec004562 100644
--- a/graphics/macgui/mactext-canvas.h
+++ b/graphics/macgui/mactext-canvas.h
@@ -79,7 +79,7 @@ struct MacFontRun {
palinfo1 = palinfo1_;
palinfo2 = palinfo2_;
palinfo3 = palinfo3_;
- fgcolor = wm_->findBestColor(palinfo1_ & 0xff, palinfo2_ & 0xff, palinfo3_ & 0xff);
+ fgcolor = wm_->findBestColor(palinfo1_ >> 8, palinfo2_ >> 8, palinfo3_ >> 8);
font = nullptr;
}
Commit: 17cdd2cb66f79bc5e2b7c8f7f8033a7a2594b8b4
https://github.com/scummvm/scummvm/commit/17cdd2cb66f79bc5e2b7c8f7f8033a7a2594b8b4
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:52+02:00
Commit Message:
FOOL: Add per-pixel copy mode to blitter
Changed paths:
engines/fool/utils.cpp
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index 873a367856f..afd10579b9f 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -34,9 +34,11 @@ Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Poin
uint32 black = g_engine->_wm._colorBlack;
uint32 white = g_engine->_wm._colorWhite;
- if (mode == kSrcCopy) {
+ if (mode == kSrcCopy && !mask) {
+ // fast blit
dst->blitFrom(*src, srcRect, dstPos);
} else {
+ // per-pixel blit
for (int y = srcRect.top; y < srcRect.bottom; y++) {
byte *source = (byte *)src->getBasePtr(srcRect.left, y);
byte *target = (byte *)dst->getBasePtr(srcRect.left + dstPos.x, dstPos.y + y);
@@ -49,6 +51,9 @@ Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Poin
continue;
}
switch (mode) {
+ case kSrcCopy:
+ *target = (*source == black) ? black : white;
+ break;
case kSrcOr:
*target = (*target == black) || (*source == black) ? black : white;
break;
Commit: 91bac769c4d36be53261541029737f832d1c4d2f
https://github.com/scummvm/scummvm/commit/91bac769c4d36be53261541029737f832d1c4d2f
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:52+02:00
Commit Message:
MACGUI: Search font registry even if classicmacfonts is missing
Changed paths:
graphics/macgui/macfontmanager.cpp
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 2e2fde1b9e0..22b17fdb455 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -439,6 +439,7 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle | familySlant, (*assoc)[i]._fontSize);
macfont = new MacFont(_fontIds.getValOrDefault(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
+ macfont->setName(fontName);
FontMan.assignFontToName(fontName, font);
macfont->setFont(font, false);
@@ -501,63 +502,63 @@ const Font *MacFontManager::getFont(MacFont *macFont) {
if (lang == Common::JA_JPN && !_japaneseFontsLoaded) {
loadJapaneseFonts();
}
+ }
- if (macFont->getName().empty()) {
- name = getFontName(macFont->getId(), macFont->getSize(), macFont->getSlant());
- macFont->setName(name);
- }
+ if (macFont->getName().empty()) {
+ name = getFontName(macFont->getId(), macFont->getSize(), macFont->getSlant());
+ macFont->setName(name);
+ }
- if (_fontRegistry.contains(macFont->getName()))
- return _fontRegistry[macFont->getName()]->getFont();
+ if (_fontRegistry.contains(macFont->getName()))
+ return _fontRegistry[macFont->getName()]->getFont();
- if (!_fontRegistry.contains(macFont->getName())) {
- int id = macFont->getId();
+ if (!_fontRegistry.contains(macFont->getName())) {
+ int id = macFont->getId();
- if (_fontInfo.contains(id) && _winFontRegistry.contains(_fontInfo.getVal(id)->name)) {
- font = _winFontRegistry.getVal(_fontInfo.getVal(id)->name);
- const Graphics::WinFont *winfont = (const Graphics::WinFont *)font;
+ if (_fontInfo.contains(id) && _winFontRegistry.contains(_fontInfo.getVal(id)->name)) {
+ font = _winFontRegistry.getVal(_fontInfo.getVal(id)->name);
+ const Graphics::WinFont *winfont = (const Graphics::WinFont *)font;
- if (winfont->getFontSizeInPointsAtDPI(72) != macFont->getSize()) {
- Common::String fullFontName = Common::String::format("%s-%d-%d", winfont->getName().c_str(), winfont->getStyle(), winfont->getFontSizeInPointsAtDPI(72));
+ if (winfont->getFontSizeInPointsAtDPI(72) != macFont->getSize()) {
+ Common::String fullFontName = Common::String::format("%s-%d-%d", winfont->getName().c_str(), winfont->getStyle(), winfont->getFontSizeInPointsAtDPI(72));
- if (_winFontRegistry.contains(fullFontName)) {
- font = _winFontRegistry.getVal(fullFontName);
- } else {
- // Generate a scaledFont
- Graphics::WinFont *scaledWinFont = WinFont::scaleFont(winfont, macFont->getSize());
- if (scaledWinFont) {
- debugC(1, kDebugLevelMacGUI, "MacFontManager::getFont(): Generated scaled winFont %s", fullFontName.c_str());
+ if (_winFontRegistry.contains(fullFontName)) {
+ font = _winFontRegistry.getVal(fullFontName);
+ } else {
+ // Generate a scaledFont
+ Graphics::WinFont *scaledWinFont = WinFont::scaleFont(winfont, macFont->getSize());
+ if (scaledWinFont) {
+ debugC(1, kDebugLevelMacGUI, "MacFontManager::getFont(): Generated scaled winFont %s", fullFontName.c_str());
- // register font generated for reuse
- _winFontRegistry.setVal(fullFontName, scaledWinFont);
+ // register font generated for reuse
+ _winFontRegistry.setVal(fullFontName, scaledWinFont);
- font = scaledWinFont;
- }
+ font = scaledWinFont;
}
}
}
}
+ }
- if (!font) {
- if (!_fontRegistry.contains(macFont->getName())) {
- // Let's try to generate name
- if (macFont->getSlant() != kMacFontRegular) {
- name = getFontName(macFont->getId(), macFont->getSize(), macFont->getSlant(), true);
- macFont->setName(name);
- }
-
- if (!_fontRegistry.contains(macFont->getName()))
- generateFontSubstitute(*macFont);
+ if (!font) {
+ if (!_fontRegistry.contains(macFont->getName())) {
+ // Let's try to generate name
+ if (macFont->getSlant() != kMacFontRegular) {
+ name = getFontName(macFont->getId(), macFont->getSize(), macFont->getSlant(), true);
+ macFont->setName(name);
}
- font = FontMan.getFontByName(macFont->getName());
+ if (!_fontRegistry.contains(macFont->getName()))
+ generateFontSubstitute(*macFont);
}
- if (!font) {
- debugC(1, kDebugLevelMacGUI, "Cannot load font '%s'", macFont->getName().c_str());
+ font = FontMan.getFontByName(macFont->getName());
+ }
- font = FontMan.getFontByName(MacFont(kMacFontSystem, 12).getName());
- }
+ if (!font) {
+ debugC(1, kDebugLevelMacGUI, "Cannot load font '%s'", macFont->getName().c_str());
+
+ font = FontMan.getFontByName(MacFont(kMacFontSystem, 12).getName());
}
#ifdef USE_FREETYPE2
Commit: 39642d486f8d06a079c47ff058c7ac5ba2fa4958
https://github.com/scummvm/scummvm/commit/39642d486f8d06a079c47ff058c7ac5ba2fa4958
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:53+02:00
Commit Message:
FOOL: Fix pattern offset on intermediate surfaces
Changed paths:
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 02010a466b6..77662c5e8c4 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -102,11 +102,11 @@ void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(nullptr);
+ Common::Point destPos(r.left, r.top);
Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawFilledRect(intermediate->getBounds(), _port->fgColor, &pd);
- Common::Point destPos(r.left, r.top);
// FillRect always uses patCopy
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, kPatCopy);
if (_port->portBits == _defaultBits) {
@@ -126,12 +126,12 @@ void Toolbox::FrameOval(const Common::Rect &r) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
+ Common::Point destPos(r.left, r.top);
Graphics::MacPatterns pat({_port->pnPat.data});
- Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawEllipse(0, 0, r.width(), r.height(), _port->fgColor, false, &pd);
- Common::Point destPos(r.left, r.top);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
if (_port->portBits == _defaultBits) {
@@ -146,16 +146,16 @@ void Toolbox::FrameRect(const Common::Rect &r) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
+ Common::Point destPos(r.left, r.top);
Graphics::MacPatterns pat({_port->pnPat.data});
- Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
Common::Rect destRect = intermediate->getBounds();
destRect.right -= _port->pnSize.x - 1;
destRect.bottom -= _port->pnSize.y - 1;
pm.drawRect(destRect, _port->fgColor, &pd);
- Common::Point destPos(r.left, r.top);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
if (_port->portBits == _defaultBits) {
@@ -220,13 +220,13 @@ void Toolbox::InvertRect(const Common::Rect &r) {
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(nullptr);
+ Common::Point destPos(r.left, r.top);
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, 0, 0, {1, 1}, g_engine->_wm._colorWhite);
+ Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, destPos.x, destPos.y, {1, 1}, g_engine->_wm._colorWhite);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawFilledRect(intermediate->getBounds(), g_engine->_wm._colorBlack, &pd);
- Common::Point destPos(r.left, r.top);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, kPatXor);
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(dstRect);
@@ -248,12 +248,12 @@ void Toolbox::LineTo(int16 h, int16 v) {
BitMap intermediate(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
BitMap mask(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
+ Common::Point destPos(dirVec.x < 0 ? h + dirVec.x : h - dirVec.x, dirVec.y < 0 ? v + dirVec.y : v - dirVec.y);
Graphics::MacPatterns pat({_port->pnPat.data});
- Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, 0, 0, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawLine(startPos.x, startPos.y, endPos.x, endPos.y, _port->fgColor, &pd);
- Common::Point destPos(dirVec.x < 0 ? h + dirVec.x : h - dirVec.x, dirVec.y < 0 ? v + dirVec.y : v - dirVec.y);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
if (_port->portBits == _defaultBits) {
Commit: 79bcf56c69c8240dced2537507e3b9c86673127d
https://github.com/scummvm/scummvm/commit/79bcf56c69c8240dced2537507e3b9c86673127d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:53+02:00
Commit Message:
FOOL: Fix CopyBits for out-of-bounds rects
Changed paths:
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 77662c5e8c4..1e52d9fb717 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -61,15 +61,41 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
if (maskRgn) {
warning("Toolbox::CopyBits: maskRgn unimplemented");
}
+ Common::Rect clipSrcRect = srcRect;
+ Common::Rect clipDstRect = dstRect;
+ // the source rectangle can include areas out of bounds, crop it
+ clipSrcRect.clip(srcBits->getBounds());
+
// scale the source
BitMap subsrc(new Graphics::ManagedSurface());
- subsrc->create(*srcBits, srcRect);
+ subsrc->create(*srcBits, clipSrcRect);
if (srcRect.width() != dstRect.width() ||
srcRect.height() != dstRect.height()) {
- subsrc->scale(dstRect.width(), dstRect.height());
+ // source and destination are different sizes, scale it
+
+ // determine scale difference
+ float sx = srcRect.width() == 0 ? 1.0f : (float)dstRect.width() / (float)srcRect.width();
+ float sy = srcRect.height() == 0 ? 1.0f : (float)dstRect.height() / (float)srcRect.height();
+ if (clipSrcRect != srcRect) {
+ // apply clipping offsets
+ clipDstRect.left += (clipSrcRect.left - srcRect.left)*sx;
+ clipDstRect.top += (clipSrcRect.top - srcRect.top)*sy;
+ clipDstRect.right += (clipSrcRect.right - srcRect.right)*sx;
+ clipDstRect.bottom += (clipSrcRect.bottom - srcRect.bottom)*sy;
+ }
+ subsrc->scale(clipDstRect.width(), clipDstRect.height());
+ } else {
+ // source and destination are the same size, no scaling
+ if (clipSrcRect != srcRect) {
+ // apply clipping offsets
+ clipDstRect.left += clipSrcRect.left - srcRect.left;
+ clipDstRect.top += clipSrcRect.top - srcRect.top;
+ clipDstRect.right += clipSrcRect.right - srcRect.right;
+ clipDstRect.bottom += clipSrcRect.bottom - srcRect.bottom;
+ }
}
BitMap mask(nullptr);
- Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(dstRect.left, dstRect.top), mode);
+ Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(clipDstRect.left, clipDstRect.top), mode);
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(result);
_defaultWindow->setDirty(true);
Commit: 2adcfe99c8657fd337c74c0c87d53def48789c0e
https://github.com/scummvm/scummvm/commit/2adcfe99c8657fd337c74c0c87d53def48789c0e
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:53+02:00
Commit Message:
FOOL: More prologue tweaks
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 84817de441c..3b991266727 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -145,17 +145,17 @@ void FoolPrologue::delayFromMarker(int16 numTicks) {
g_toolbox->Delay(delay);
}
-void FoolPrologue::sub_128_26c(int16 unk1, int16 unk2) {
+void FoolPrologue::drawTextRightAlign(int16 y, int16 x) {
// 128:026c
this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
- g_toolbox->MoveTo(this->var_i32_182 - unk2, unk1);
+ g_toolbox->MoveTo(x - this->var_i32_182, y);
g_toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::sub_128_2a6(int16 unk1, int16 unk2) {
+void FoolPrologue::drawTextCenterAlign(int16 y, int16 x) {
// 128:02a6
this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
- g_toolbox->MoveTo(unk2 - (this->var_i32_182 / 2), unk1);
+ g_toolbox->MoveTo(x - (this->var_i32_182 / 2), y);
g_toolbox->DrawString(this->var_str_76);
}
@@ -230,10 +230,10 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
unk1 = 0x5;
}
// 128:0584
- for (int i = 1; i <= SCREEN_HEIGHT; i++) {
+ for (int i = 0; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_5c.top = this->arr_i16_412ea[i] - 1;
- this->var_i16_5c.bottom = this->arr_i16_412ea[i];
+ this->var_i16_5c.top = this->arr_i16_412ea[i];
+ this->var_i16_5c.bottom = this->arr_i16_412ea[i] + 1;
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
if (i % unk1 == 0) {
this->delayFromMarker(0);
@@ -254,8 +254,8 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->MoveTo(0, this->arr_i16_412ea[i] - 1);
- g_toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i] - 1);
+ g_toolbox->MoveTo(0, this->arr_i16_412ea[i]);
+ g_toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i]);
if (i % 5 == 0) {
this->delayFromMarker(0);
}
@@ -266,7 +266,7 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
this->var_i32_40 = this->arr_i32_41296[screenPage];
- for (int i = 0; i < 0x36; i++) {
+ for (int i = 1; i <= 0x36; i++) {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
@@ -321,9 +321,9 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
g_toolbox->PenNormal();
}
-void FoolPrologue::sub_128_a6c(int16_t unk1, int16_t unk2) {
+void FoolPrologue::drawText(int16_t y, int16_t x) {
// 128:0a6c
- g_toolbox->MoveTo(unk2, unk1);
+ g_toolbox->MoveTo(x, y);
g_toolbox->DrawString(this->var_str_76);
}
@@ -359,6 +359,7 @@ void FoolPrologue::drawRainRecycle(int16_t unk) {
g_toolbox->Delay(0);
}
} while (this->var_i32_2 + this->var_i16_1a4 > g_toolbox->TickCount());
+ g_toolbox->Delay(0);
}
void FoolPrologue::sub_128_c8a() {
@@ -388,14 +389,14 @@ void FoolPrologue::sub_128_de2() {
// 128:0de2
g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
this->var_str_76 = g_zbasic->str(3);
- this->sub_128_a6c(0x151, 0x5);
+ this->drawText(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
this->var_str_76 = g_zbasic->str(4);
- this->sub_128_26c(0x154, 0x1f7);
+ this->drawTextRightAlign(0x154, 0x1f7);
}
void FoolPrologue::sub_128_e58() {
@@ -563,15 +564,15 @@ void FoolPrologue::sub_129_004() {
g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
// "not enough memory" message
this->var_str_76 = g_zbasic->str(6);
- this->sub_128_2a6(0x64, 0xfc);
+ this->drawTextCenterAlign(0x64, 0xfc);
this->var_str_76 = g_zbasic->str(7);
- this->sub_128_2a6(0x78, 0xfc);
+ this->drawTextCenterAlign(0x78, 0xfc);
this->var_str_76 = g_zbasic->str(8);
- this->sub_128_2a6(0x96, 0xfc);
+ this->drawTextCenterAlign(0x96, 0xfc);
this->var_str_76 = g_zbasic->str(9);
- this->sub_128_2a6(0xaa, 0xfc);
+ this->drawTextCenterAlign(0xaa, 0xfc);
this->var_str_76 = g_zbasic->str(10);
- this->sub_128_2a6(0xcb, 0xfc);
+ this->drawTextCenterAlign(0xcb, 0xfc);
this->sub_128_e58();
g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
@@ -632,19 +633,19 @@ void FoolPrologue::sub_129_004() {
g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
// "set your monitor to black and white" message"
this->var_str_76 = g_zbasic->str(13);
- this->sub_128_2a6(0x82, 0xfc);
+ this->drawTextCenterAlign(0x82, 0xfc);
this->var_str_76 = g_zbasic->str(14);
- this->sub_128_2a6(0x96, 0xfc);
+ this->drawTextCenterAlign(0x96, 0xfc);
this->var_str_76 = g_zbasic->str(15);
// if this is the finale
if (this->var_i16_1aa == 2) {
this->var_str_76 = g_zbasic->str(16);
}
- this->sub_128_2a6(0xaa, 0xfc);
+ this->drawTextCenterAlign(0xaa, 0xfc);
this->var_str_76 = g_zbasic->str(17);
- this->sub_128_2a6(0xcb, 0xfc);
+ this->drawTextCenterAlign(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
@@ -676,8 +677,17 @@ void FoolPrologue::prologueRun() {
this->var_i16_3ce = 5;
this->prologueDrawLoadingMsg();
this->var_i16_18e = SCREEN_HEIGHT;
+ // fill a buffer with random screen y-positions, to use for the scanline transition
this->shuffleScanlines();
+ // Because of floppy disk read times, the game pre-loads as many PICT resources
+ // as it can stuff into memory. The below process happens a bunch of times:
+ // - Increment an ID by 1
+ // - Call GetPicture to fetch the next PICT resource for that ID (prologueBufferNextPicture)
+ // - Increment the loading progress % by 5 (prologueDrawLoadingMsg)
+ // - Blit it to an offscreen page with ZBasic's PICTURE command
+ // - Release the resource
+
// "The Fool's Errand" title card
this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
this->var_i16_3ce = 10;
@@ -690,7 +700,7 @@ void FoolPrologue::prologueRun() {
// 130:007a
g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcBic);
this->var_str_76 = g_zbasic->str(18);
- this->sub_128_2a6(0x10d, 0xdd);
+ this->drawTextCenterAlign(0x10d, 0xdd);
g_toolbox->SetPortBits(this->var_i32_32);
// cliffside images with lightning
for (int i = 1; i <= 5; i++) {
@@ -846,6 +856,8 @@ void FoolPrologue::prologueRun() {
this->drawRainRecycle(0xb4);
this->var_i32_40 = this->arr_i32_41296[1];
+ // scanline fade in priestess face
+
// 130:062c
int y = 0;
while (y != SCREEN_HEIGHT) {
@@ -856,14 +868,17 @@ void FoolPrologue::prologueRun() {
if (y < SCREEN_HEIGHT) {
y += 1;
}
- this->var_i16_5c.top = this->arr_i16_412ea[y] - 1;
- this->var_i16_5c.bottom = this->arr_i16_412ea[y];
+ this->var_i16_5c.top = this->arr_i16_412ea[y];
+ this->var_i16_5c.bottom = this->arr_i16_412ea[y] + 1;
// 130:068e
g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
}
// 130:06b0
this->drawRainRecycle(1);
}
+
+ // lightning flash over priestess face
+
this->var_i32_2 = g_toolbox->TickCount();
this->drawRainRecycle(0xa);
this->blitPageToScreen(1);
@@ -881,6 +896,8 @@ void FoolPrologue::prologueRun() {
this->var_i32_2 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_i16_1bc);
this->drawRainRecycle(0x78);
+
+ // cut to shot of cliff
this->blitPageToScreen(2);
// 130:0740
@@ -890,6 +907,7 @@ void FoolPrologue::prologueRun() {
g_toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
+ // priestess zap
// 130:0778
for (int j = 0; j <= 8; j++) {
for (int i = 3; i <= 5; i++) {
@@ -899,6 +917,8 @@ void FoolPrologue::prologueRun() {
this->drawRainRecycle(3);
}
}
+
+ // cut to closeup of priestess mid-zap
// 130:07ec
this->blitPageToScreen(6);
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -906,6 +926,8 @@ void FoolPrologue::prologueRun() {
this->var_i32_2 = g_toolbox->TickCount();
this->delayFromMarker(1);
}
+
+ // start loading some new resources into the screen buffers
// 130:083c
g_zbasic->picture(0, 0, this->arr_i32_0[0xd]);
g_zbasic->picture(5, 0, this->arr_i32_0[0xe]);
@@ -919,13 +941,13 @@ void FoolPrologue::prologueRun() {
g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
- this->sub_130_f48();
+ this->prologueRenderNextText();
this->sub_128_de2();
this->setPortBitsToPage(1);
this->fillRect(0, 0, 0, 0x152, 0x1fc);
g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
- this->sub_130_f48();
+ this->prologueRenderNextText();
this->sub_128_de2();
// 130:0934
for (int i = 2; i <= 5; i++) {
@@ -954,11 +976,12 @@ void FoolPrologue::prologueRun() {
this->sub_128_de2();
//g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
this->arr_i32_41296[7]->copyFrom(*this->arr_i32_41296[6]);
- this->sub_130_f48();
+ this->prologueRenderNextText();
g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->setPortBitsToPage(7);
// 130:0ac2
g_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
+ this->prologueRenderNextText();
this->setPortBitsToPage(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
@@ -966,6 +989,7 @@ void FoolPrologue::prologueRun() {
g_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
+
// 130:0b74
this->delayFromMarker(0xd2);
this->sub_128_e80();
@@ -1020,10 +1044,14 @@ void FoolPrologue::prologueRun() {
}
}
// 130:0ca8
+ // "who dares to interrupt my errand"
this->blitPageToScreen(0x6);
this->sub_128_e58();
- this->sub_128_50a(0x7, 0, 0x1fc, 0);
+
+
+ this->sub_128_50a(0x0, 0, 0x1fc, 7);
this->delay(0xa);
+ // "I dare"
this->blitPageToScreen(0x8);
this->sub_128_e58();
@@ -1055,8 +1083,9 @@ void FoolPrologue::prologueDrawLoadingMsg() {
this->var_str_76 += g_zbasic->str(20);
// 130:0d70
this->fillRect(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
- this->sub_128_2a6(0xe, this->var_i16_10/2);
+ this->drawTextCenterAlign(0xe, this->var_i16_10/2);
g_toolbox->SetPort(this->var_i32_8);
+ g_toolbox->Delay(0);
}
void FoolPrologue::drawRain() {
@@ -1089,7 +1118,7 @@ void FoolPrologue::drawRainDrop() {
}
-void FoolPrologue::sub_130_f48() {
+void FoolPrologue::prologueRenderNextText() {
// 130:0f48
this->var_i16_3d2 = g_zbasic->readInt();
for (int i = 1; i <= this->var_i16_3d2; i++) {
@@ -1109,7 +1138,7 @@ void FoolPrologue::sub_130_f48() {
}
// 130:0fc8
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
- this->sub_128_a6c(this->var_i16_180, this->var_i16_176);
+ this->drawText(this->var_i16_180, this->var_i16_176);
}
}
@@ -1232,7 +1261,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->bufferFlush(this->var_str_76);
// 131:0400
- this->sub_128_a6c(0x178, 0xb4);
+ this->drawText(0x178, 0xb4);
this->delay(0x1e);
// 131:041a
@@ -1425,7 +1454,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(23));
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
+ this->drawText(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
this->var_i32_2 = g_toolbox->TickCount();
// 131:0e76
@@ -1502,7 +1531,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24).encode().c_str());
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_26c(0x1f0, 0xd2);
+ this->drawTextRightAlign(0x1f0, 0xd2);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
}
this->delayFromMarker(0x2);
@@ -1611,7 +1640,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_26c(0x17d, 0x3c);
+ this->drawTextRightAlign(0x17d, 0x3c);
// 131:17c8
// ...
@@ -1628,7 +1657,7 @@ void FoolPrologue::sub_131_4dc0() {
// 131:4e08
this->fillRect(0, 7, 0x13, this->var_i16_10 - 7, 0);
- this->sub_128_2a6(this->var_i16_10 / 2, 0xe);
+ this->drawTextCenterAlign(this->var_i16_10 / 2, 0xe);
g_toolbox->SetPort(this->var_i32_8);
}
@@ -1640,7 +1669,7 @@ void FoolPrologue::sub_131_4e48() {
this->var_str_76 += Common::U32String::format("\"%s\"", g_zbasic->str(80).c_str());
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0x1aa, 0xb4);
+ this->drawText(0x1aa, 0xb4);
}
void FoolPrologue::sub_131_4e98() {
@@ -1650,23 +1679,23 @@ void FoolPrologue::sub_131_4e98() {
// "And so the fool heeded the advice of the magician..."
this->var_str_76 += g_zbasic->str(81);
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0x92, this->var_i16_3fc);
+ this->drawText(0x92, this->var_i16_3fc);
this->var_str_76 += g_zbasic->str(82);
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0x9c, this->var_i16_3fc + 0xf);
+ this->drawText(0x9c, this->var_i16_3fc + 0xf);
this->var_str_76 += g_zbasic->str(83);
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0xa6, this->var_i16_3fc + 0x1e);
+ this->drawText(0xa6, this->var_i16_3fc + 0x1e);
this->var_str_76 += g_zbasic->str(84);
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0xc4, this->var_i16_3fc + 0x2d);
+ this->drawText(0xc4, this->var_i16_3fc + 0x2d);
this->var_str_76 += g_zbasic->str(85);
g_zbasic->bufferFlush(this->var_str_76);
- this->sub_128_a6c(0xe2, this->var_i16_3fc + 0x3c);
+ this->drawText(0xe2, this->var_i16_3fc + 0x3c);
this->sub_128_de2();
}
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 97b8836cf46..8200a645228 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -43,8 +43,8 @@ public:
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
void delayFromMarker(int16 numTicks); // sub_128_24a
- void sub_128_26c(int16 unk1, int16 unk2);
- void sub_128_2a6(int16 unk1, int16 unk2);
+ void drawTextRightAlign(int16 y, int16 x); // sub_128_26c
+ void drawTextCenterAlign(int16 unk1, int16 unk2); // sub_128_2a6
void fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right); // sub_128_2f0
void sub_128_354(PatternMode mode, uint16 unk2);
void sub_128_3ee(int16 unk1);
@@ -53,7 +53,7 @@ public:
void scanlineTransition(int16 patternID); // sub_128_64a
void zoomTransition(int16 screenPage); // sub_128_6e4
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
- void sub_128_a6c(int16_t unk1, int16_t unk2);
+ void drawText(int16_t y, int16_t x); // sub_128_a6c
void drawRainRecycle(int16_t unk); // sub_128_a8c
void sub_128_c8a();
void shuffleScanlines(); // sub_128_ccc
@@ -74,7 +74,7 @@ public:
void prologueDrawLoadingMsg(); // sub_130_d28
void drawRain(); // sub_130_db0
void drawRainDrop(); // sub_130_e82
- void sub_130_f48();
+ void prologueRenderNextText(); // sub_130_f48
void sub_130_1002();
void sub_131_004();
Commit: 7b2fa0ef13ab8c9282256cc382b098f5e9e640ae
https://github.com/scummvm/scummvm/commit/7b2fa0ef13ab8c9282256cc382b098f5e9e640ae
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:54+02:00
Commit Message:
FOOL: Fix disasterous off-by-four error in homemade disassembler
Changed paths:
engines/fool/fool_prologue.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 3b991266727..d60c259e939 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -396,7 +396,7 @@ void FoolPrologue::sub_128_e1c() {
// 128:0e1c
g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
this->var_str_76 = g_zbasic->str(4);
- this->drawTextRightAlign(0x154, 0x1f7);
+ this->drawTextRightAlign(0x154, 0x1fb);
}
void FoolPrologue::sub_128_e58() {
@@ -554,25 +554,25 @@ void FoolPrologue::sub_129_004() {
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_41296[0]);
+ g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0]);
g_zbasic->unk_6(0x19, 0x64, 0xff, 0x0);
- this->fillRect(2, 0x46, 0x64, 0xd8, 0x198);
- this->fillRect(1, 0x4b, 0x69, 0xd3, 0x193);
+ this->fillRect(2, 0x46, 0x64, 0xdc, 0x19c);
+ this->fillRect(1, 0x4b, 0x69, 0xd7, 0x197);
// 129:0386
- this->fillRect(2, 0x50, 0x6e, 0xc3, 0x18e);
+ this->fillRect(2, 0x50, 0x6e, 0xd2, 0x192);
g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
// "not enough memory" message
this->var_str_76 = g_zbasic->str(6);
- this->drawTextCenterAlign(0x64, 0xfc);
+ this->drawTextCenterAlign(0x64, 0x100);
this->var_str_76 = g_zbasic->str(7);
- this->drawTextCenterAlign(0x78, 0xfc);
+ this->drawTextCenterAlign(0x78, 0x100);
this->var_str_76 = g_zbasic->str(8);
- this->drawTextCenterAlign(0x96, 0xfc);
+ this->drawTextCenterAlign(0x96, 0x100);
this->var_str_76 = g_zbasic->str(9);
- this->drawTextCenterAlign(0xaa, 0xfc);
+ this->drawTextCenterAlign(0xaa, 0x100);
this->var_str_76 = g_zbasic->str(10);
- this->drawTextCenterAlign(0xcb, 0xfc);
+ this->drawTextCenterAlign(0xcb, 0x100);
this->sub_128_e58();
g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
@@ -606,7 +606,7 @@ void FoolPrologue::sub_129_004() {
// 0x0534: LEA - [0x0764],A0
// 0x0538: MOVE.L - A0,-0x8ee(A5)
// 0x053c: SF - 0x8,D0
- g_zbasic->openR(1, this->var_i16_1c4, 0x3fc, this->var_i16_2c8);
+ g_zbasic->openR(1, this->var_i16_1c4, 0x400, this->var_i16_2c8);
Common::Array<byte> payload = g_zbasic->read(1, this->var_i16_2ca);
this->var_i16_2ce = Common::U32String((char *)&payload[0], this->var_i16_2ca, Common::kMacRoman);
@@ -624,25 +624,25 @@ void FoolPrologue::sub_129_004() {
// 129:05a6
if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, 0x1fc, 0x152, this->arr_i32_41296[0]);
+ g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0]);
g_zbasic->unk_6(0x19, 0x64, 0xff, 0x00);
- this->fillRect(2, 0x64, 0x7e, 0xd8, 0x17a);
- this->fillRect(1, 0x69, 0x83, 0xd3, 0x175);
- this->fillRect(2, 0x6e, 0x88, 0xce, 0x170);
+ this->fillRect(2, 0x64, 0x82, 0xdc, 0x17e);
+ this->fillRect(1, 0x69, 0x87, 0xd7, 0x179);
+ this->fillRect(2, 0x6e, 0x8c, 0xd2, 0x174);
// 129:0662
g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
// "set your monitor to black and white" message"
this->var_str_76 = g_zbasic->str(13);
- this->drawTextCenterAlign(0x82, 0xfc);
+ this->drawTextCenterAlign(0x82, 0x100);
this->var_str_76 = g_zbasic->str(14);
- this->drawTextCenterAlign(0x96, 0xfc);
+ this->drawTextCenterAlign(0x96, 0x100);
this->var_str_76 = g_zbasic->str(15);
// if this is the finale
if (this->var_i16_1aa == 2) {
this->var_str_76 = g_zbasic->str(16);
}
- this->drawTextCenterAlign(0xaa, 0xfc);
+ this->drawTextCenterAlign(0xaa, 0x100);
this->var_str_76 = g_zbasic->str(17);
this->drawTextCenterAlign(0xcb, 0xfc);
@@ -693,14 +693,14 @@ void FoolPrologue::prologueRun() {
this->var_i16_3ce = 10;
this->prologueDrawLoadingMsg();
this->setPortBitsToPage(0xb);
- this->fillRect(2, 0, 0, SCREEN_HEIGHT-4, SCREEN_WIDTH-4);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcBic);
this->var_str_76 = g_zbasic->str(18);
- this->drawTextCenterAlign(0x10d, 0xdd);
+ this->drawTextCenterAlign(0x10d, 0x103);
g_toolbox->SetPortBits(this->var_i32_32);
// cliffside images with lightning
for (int i = 1; i <= 5; i++) {
@@ -709,13 +709,13 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(7);
// 130:00d6
- this->fillRect(2, 0, 0, 0x152, 0x1fc);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->setPortBitsToPage(8);
// 130:011c
- this->fillRect(2, 0, 0, 0x152, 0x1fc);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0, 0x96, this->arr_i32_0[2]);
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
@@ -746,7 +746,7 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(2);
// 130:0234
- this->fillRect(2, 0, 0, SCREEN_HEIGHT - 4, SCREEN_WIDTH - 4);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
g_toolbox->ReleaseResource(this->arr_i32_0[8]);
@@ -788,7 +788,7 @@ void FoolPrologue::prologueRun() {
// 130:0380
if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
- this->fillRect(1, 0, 0, 0x14, 0x1fc);
+ this->fillRect(1, 0, 0, 0x14, SCREEN_WIDTH);
} else {
g_toolbox->SetPort(this->var_i32_c);
this->fillRect(2, 0, 0, 0x14, this->var_i16_10);
@@ -937,14 +937,14 @@ void FoolPrologue::prologueRun() {
// 130:0890
// g_zbasic->52(0);
this->setPortBitsToPage(0);
- this->fillRect(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->prologueRenderNextText();
this->sub_128_de2();
this->setPortBitsToPage(1);
- this->fillRect(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->prologueRenderNextText();
@@ -971,7 +971,7 @@ void FoolPrologue::prologueRun() {
}
// 130:0a42
this->setPortBitsToPage(6);
- this->fillRect(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
this->sub_128_de2();
//g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
@@ -985,7 +985,7 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
- this->fillRect(0, 0x73, 0x15f, 0xf6, 0x1dc);
+ this->fillRect(0, 0x73, 0x163, 0xfa, 0x1e0);
g_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1049,7 +1049,7 @@ void FoolPrologue::prologueRun() {
this->sub_128_e58();
- this->sub_128_50a(0x0, 0, 0x1fc, 7);
+ this->sub_128_50a(0x0, 0, SCREEN_HEIGHT, 7);
this->delay(0xa);
// "I dare"
this->blitPageToScreen(0x8);
@@ -1079,9 +1079,11 @@ void FoolPrologue::prologueDrawLoadingMsg() {
g_zbasic->text(0, 0xc, kFacePlain, kSrcOr);
// "loading prologue" message
this->var_str_76 = g_zbasic->str(19);
- this->var_str_76 += Common::U32String::format("%d", this->var_i16_3ce);
+ this->var_str_76 += Common::U32String::format(" %d", this->var_i16_3ce);
this->var_str_76 += g_zbasic->str(20);
// 130:0d70
+ // white out the contents of the top menu bar.
+ // the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
this->fillRect(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
this->drawTextCenterAlign(0xe, this->var_i16_10/2);
g_toolbox->SetPort(this->var_i32_8);
@@ -1177,7 +1179,7 @@ void FoolPrologue::sub_131_004() {
// 131:00e6
for (int i = 6; i <= 9; i++) {
this->setPortBitsToPage(i);
- this->fillRect(0, 0, 0, 0x152, 0x1fc);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
// 131:0110
if (i < 8) {
g_zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
@@ -1218,7 +1220,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
- this->fillRect(0x1, 0, 0, 0x14, 0x1fc);
+ this->fillRect(0x1, 0, 0, 0x14, SCREEN_WIDTH);
} else {
g_toolbox->SetPort(this->var_i32_c);
this->fillRect(0x2, 0, 0, 0x14, this->var_i16_10);
@@ -1261,7 +1263,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->bufferFlush(this->var_str_76);
// 131:0400
- this->drawText(0x178, 0xb4);
+ this->drawText(0x17c, 0xb4);
this->delay(0x1e);
// 131:041a
@@ -1285,7 +1287,7 @@ void FoolPrologue::sub_131_004() {
this->var_i32_40 = this->arr_i32_41296[5];
g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
- this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
this->sub_131_4e48();
// 131:0538
@@ -1293,9 +1295,9 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_4e);
// 131:0554
- this->fillRect(0, 0, 0x9c, 0x15a, 0);
- this->fillRect(0x9c, 0x5a, 0xce, 0xa6, 0);
- this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
+ this->fillRect(0, 0, 0, 0xa0, 0x15e);
+ this->fillRect(0, 0xa0, 0x5a, 0xd2, 0xaa);
+ this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
// 131:05b0
this->setPortBitsToPage(6);
@@ -1309,18 +1311,18 @@ void FoolPrologue::sub_131_004() {
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
- g_zbasic->get(0x1bc, 0xc1, 0x1ee, 0x117, this->arr_i32_3bca4);
+ g_zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
this->delayFromMarker(0x3c);
- this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
- this->sub_128_50a(0x6, 0, 0x1fc, 0x3);
+ this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
+ this->sub_128_50a(0x6, 0, 0x200, 0x3);
this->sub_131_4e48();
// 131:06aa
- this->sub_128_50a(5, 0, 0x1fc, 2);
- this->sub_128_50a(7, 0, 0x1fc, 2);
- this->sub_128_50a(8, 0, 0x1fc, 1);
- this->fillRect(0xa6, 0x173, 0xb5, 0x1fc, 0);
- this->sub_128_50a(0x9, 0, 0x1fc, 1);
+ this->sub_128_50a(5, 0, 0x200, 2);
+ this->sub_128_50a(7, 0, 0x200, 2);
+ this->sub_128_50a(8, 0, 0x200, 1);
+ this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
+ this->sub_128_50a(0x9, 0, 0x200, 1);
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
g_zbasic->unk_20();
@@ -1375,10 +1377,10 @@ void FoolPrologue::sub_131_004() {
}
// 131:09d2
- this->sub_128_800(0xbd, 0x1b8, 0x117, 0x1ee, 0, 0, 0x152, 0x1fc, 0x21);
- this->sub_128_800(0x152, 0, 0x152, 0, 0, 0, 0x152, 0x1fc, 0x21);
- this->sub_128_800(0, 0, 0, 0, 0, 0, 0x152, 0x1fc, 0x21);
- this->sub_128_800(0, 0x1fc, 0, 0x1fc, 0, 0, 0x152, 0x1fc, 0x21);
+ this->sub_128_800(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ this->sub_128_800(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ this->sub_128_800(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ this->sub_128_800(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
// 131:0a7a
for (int i = 1; i < 0x63; i++) {
@@ -1406,11 +1408,12 @@ void FoolPrologue::sub_131_004() {
}
// 131:0bb0
- this->sub_128_50a(4, 0, 0x1fc, 3);
+ this->sub_128_50a(4, 0, SCREEN_WIDTH, 3);
this->sub_128_1ba(5);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delay(0x3c);
+ this->sub_128_50a(5, 0, SCREEN_WIDTH, 0);
g_zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
// 131:0c36
@@ -1445,7 +1448,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
this->delay(0xf);
- this->sub_128_50a(i, 0, 0x1fc, 1);
+ this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
}
g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
this->delay(0x3c);
@@ -1465,10 +1468,10 @@ void FoolPrologue::sub_131_004() {
g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
g_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
this->setPortBitsToPage(0x6);
- this->fillRect(0, 0, 0x152, 0x1fc, 0);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
this->setPortBitsToPage(0x7);
- this->fillRect(0, 0, 0x152, 0x1fc, 0);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
//g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
@@ -1479,15 +1482,15 @@ void FoolPrologue::sub_131_004() {
this->setPortBitsToPage(0x9);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
this->setPortBitsToPage(0xa);
- this->fillRect(0, 0, 0x152, 0x1fc, 2);
+ this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delayFromMarker(0x78);
- this->fillRect(0xc4, 0x141, 0xd5, 0x1fc, 0x2);
- this->sub_128_50a(0x5, 0x64, 0x198, 0x0);
+ this->fillRect(2, 0xc8, 0x145, 0xd7, SCREEN_WIDTH);
+ this->sub_128_50a(0x5, 0x64, 0x19c, 0x0);
this->delay(0x28);
this->var_i16_5c.left = 0x118;
@@ -1515,7 +1518,7 @@ void FoolPrologue::sub_131_004() {
// 131:11a4
this->sub_128_1ba(0x5);
this->setPortBitsToPage(0x5);
- this->fillRect(0xc4, 0x141, 0xd3, 0x1fc, 0x2);
+ this->fillRect(0x2, 0xc8, 0x145, 0xd7, SCREEN_WIDTH);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
@@ -1531,7 +1534,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24).encode().c_str());
g_zbasic->bufferFlush(this->var_str_76);
- this->drawTextRightAlign(0x1f0, 0xd2);
+ this->drawTextRightAlign(0x1f4, 0xd2);
g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
}
this->delayFromMarker(0x2);
@@ -1540,17 +1543,17 @@ void FoolPrologue::sub_131_004() {
}
// 131:12cc
- this->sub_128_800(0x146, 0x1b4, 0x146, 0x1b4, 0xbc, 0x18b, 0x152, 0x1e2, 0x10);
- this->sub_128_50a(0x5, 0x128, 0x1fc, 0x1);
+ this->sub_128_800(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
+ this->sub_128_50a(0x5, 0x12c, SCREEN_WIDTH, 0x1);
this->delay(0xec);
for (int i = 8; i < 0xa; i++) {
- this->sub_128_50a(i, 0, 0x1fc, 1);
+ this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
}
this->var_i32_2 = g_toolbox->TickCount();
this->setPortBitsToPage(0x5);
- this->fillRect(0, 0, 0x152, 0x1fc, 0);
+ this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delayFromMarker(0xa);
@@ -1640,7 +1643,7 @@ void FoolPrologue::sub_131_004() {
g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
g_zbasic->bufferFlush(this->var_str_76);
- this->drawTextRightAlign(0x17d, 0x3c);
+ this->drawTextRightAlign(0x181, 0x3c);
// 131:17c8
// ...
@@ -1655,7 +1658,7 @@ void FoolPrologue::sub_131_4dc0() {
this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
g_zbasic->bufferFlush(this->var_str_76);
// 131:4e08
- this->fillRect(0, 7, 0x13, this->var_i16_10 - 7, 0);
+ this->fillRect(0, 0, 7, 0x13, this->var_i16_10 - 7);
this->drawTextCenterAlign(this->var_i16_10 / 2, 0xe);
g_toolbox->SetPort(this->var_i32_8);
Commit: 7d1020e63a24421f80f017b9b8d1ef5bf204963c
https://github.com/scummvm/scummvm/commit/7d1020e63a24421f80f017b9b8d1ef5bf204963c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:54+02:00
Commit Message:
FOOL: Initial translation of game module
Changed paths:
A engines/fool/fool_game.cpp
A engines/fool/fool_game.h
engines/fool/toolbox.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
new file mode 100644
index 00000000000..0a6d4804e3c
--- /dev/null
+++ b/engines/fool/fool_game.cpp
@@ -0,0 +1,426 @@
+/* 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 "fool/fool_game.h"
+
+namespace Fool {
+
+void FoolGame::sub_128_004() {
+ // 128:0004
+ g_zbasic->unk_331(0xdac0, 0);
+ g_zbasic->unk_331(0x1b58, 1);
+ g_zbasic->unk_331(0x1b58, 2);
+
+ g_toolbox->SetRect(this->arr_i16_1ae06, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+
+ // copyright + zbasic notice
+ this->var_str_384 = g_zbasic->str(0);
+ this->var_str_384 += g_zbasic->str(1);
+ this->var_str_384 += g_zbasic->str(2);
+
+ // 128:0086
+ // 128:0086: MOVEQ - 0x0,D0
+ // 128:0088: SNE - -0x98c(A5)
+ g_zbasic->unk_44(0);
+
+ this->var_i16_484 = 0;
+
+ // 128:0096: LEA - [0x3818],A0
+ // 128:009a: MOVE.L - A0,-0x8ee(A5)
+ // 128:009e: JMP - [0x118]
+ // 128:0118: JMP - [0x1e0]
+ // 128:01e0: JMP - [0x2ba]
+ // 128:02ba: JMP - [0x33e]
+ // 128:033e: JMP - [0x3d6]
+ // 128:03d6: JMP - [0x402]
+ // 128:0402: JMP - [0x424]
+ // 128:0424: JMP - [0x442]
+ // 128:0442: JMP - [0x45e]
+ // 128:045e: JMP - [0x478]
+ // 128:0478
+ this->var_str_69a += g_zbasic->str(6);
+ this->var_i32_79a = &this->var_str_69a;
+ // 128:0496: JMP - [0x4d6]
+ // 128:04d6: JMP - [0x50a]
+ // 128:050a: JMP - [0x558]
+ // 128:0558: JMP - [0x5fa]
+ // 128:05fa: JMP - [0x648]
+ // 128:0648: JMP - [0x698]
+ // 128:0698: JMP - [0x70e]
+ // 128:070e: JMP - [0x8b0]
+ // 128:08b0: JMP - [0x914]
+ // 128:0914: JMP - [0x95e]
+ // 128:095e: JMP - [0xbda]
+ // 128:0bda: JMP - [0xc66]
+ // 128:0c66: JMP - [0xd30]
+ // 128:0d30: JMP - [0xdfa]
+ // 128:0dfa: JMP - [0x1786]
+ //
+}
+
+void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
+ // 128:00a2
+ this->var_i16_32 = unk1;
+ this->var_i16_30 = unk2;
+ if (this->var_i16_30 == 0) {
+ g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i16_5dfc[this->var_i16_32]);
+ }
+
+ // 128:00e6
+ if (this->var_i16_30 == 1) {
+ g_zbasic->put(0, 0, 0, this->arr_i16_5dfc[this->var_i16_32], 0);
+
+ }
+}
+
+void FoolGame::sub_128_11c() {
+ // 128:011c
+ g_zbasic->unk_110(&this->var_i16_272);
+ g_zbasic->unk_110(&this->var_i16_172);
+ this->var_str_384 = g_zbasic->str(3);
+
+ this->var_i16_586 = 0;
+
+ this->sub_128_0a2(0, 0x6260);
+
+ // 128:015a
+ this->var_i16_50 = this->var_i16_58 + 0x3d;
+ this->var_i16_52 = this->var_i16_56 + 0x68;
+ this->var_i16_16c = 1;
+ this->var_i16_16e = 0;
+
+ // 128:017e
+ g_toolbox->Pack3(&this->var_i16_50, &this->var_i16_172, &this->var_i16_272, this->var_i32_16e, this->var_i16_5e, 1);
+ this->sub_128_6244();
+
+ this->sub_128_0a2(1, 0x6d60);
+
+ // 128:01b0
+ if (this->var_i8_5e[0] == 1) {
+ this->var_str_486 += this->var_str_68;
+ this->var_i16_586 = this->var_i16_64;
+ }
+
+}
+
+void FoolGame::sub_128_01e4() {
+ // 128:01e4
+ g_zbasic->unk_110(&this->var_i16_172);
+ this->var_str_588 = g_zbasic->str(4);
+ this->var_i16_688 = 0;
+
+ this->sub_128_0a2(0, 0x6260);
+ // 128:0218
+ this->var_i16_50 = this->var_i16_58 + 0x3d;
+ this->var_i16_52 = this->var_i16_56 + 0x53;
+ this->var_i16_16c = 1;
+ this->var_i32_16e = 0;
+ // 128:023c
+ this->var_i32_168 = *(this->var_ptr_172 + 1);
+ g_toolbox->Pack3(*this->var_i32_50, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, &this->var_i32_168, this->var_i32_16e, &this->var_i16_5e, 2);
+ this->sub_128_6244();
+ this->sub_128_0a2(1, 0x6d60);
+
+ if (this->var_i16_5e[0] == 1) {
+ // 128:02a2
+ this->var_str_588 += this->var_str_68;
+ this->var_i16_688 = this->var_i16_64;
+ }
+}
+
+void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
+ this->var_i16_68c = unk1;
+ this->var_i16_68a = unk2;
+ this->var_i16_68a = (this->var_i16_52 - *this->arr_i16_1ec0) / (*this->arr_i16_1ec4);
+
+ this->var_i16_68c = (this->var_i16_50 - *this->arr_i16_1ec2) / (*this->arr_i16_1ec6);
+}
+
+void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
+ // 128:0342
+ if (unk2 < 1) {
+ unk2 = 1;
+ }
+ if (*this->arr_i16_1eb8 > unk2) {
+ unk2 = *this->arr_i16_1eb8;
+ }
+ if (unk1 < 1) {
+ unk1 = 1;
+ }
+ if (*this->arr_i16_1eba > unk1) {
+ unk1 = *this->arr_i16_1eba;
+ }
+}
+
+void FoolGame::sub_128_3da(int16 unk1) {
+ // 128:03da
+ this->var_i32_68e = g_toolbox->TickCount();
+
+ do {
+ g_toolbox->Delay(1);
+ } while (g_toolbox->TickCount() < (this->var_i32_68e + unk1))
+}
+
+void FoolGame::sub_128_406(int16 unk1) {
+ // 128:0402
+ do {
+ g_toolbox->Delay(1);
+ } while (g_toolbox->TickCount() < (this->var_i32_692 + unk1))
+}
+
+int16 FoolGame::sub_128_428() {
+ // 128:0428
+ this->var_i16_30 = (byte *)this->var_i32_696;
+ this->var_i32_696 += 1;
+ return this->var_i16_30;
+}
+
+int16 FoolGame::sub_128_446() {
+ // 128:0446
+ this->var_i16_30 = *(int16 *)this->var_i32_696;
+ this->var_i32_696 += 2;
+ return this->var_i16_30;
+}
+
+int16 FoolGame::sub_128_462() {
+ // 128:0462
+ this->var_i32_68e = *(int32 *)this->var_i32_696;
+ this->var_i32_696 += 4;
+ return this->var_i32_68e;
+}
+
+void FoolGame::sub_128_49a() {
+ // 128:049a
+ this->var_i16_79e = *(byte *)this->var_i32_696;
+ g_zbasic->blockMove(this->var_i32_696, this->var_i32_79a, this->var_i32_79e+1);
+ this-var_i32_696 += this->var_i16_79e + 1;
+
+ // 128:04cc: LEA - VAR(0x69a),A0
+ // 128:04d0: JSR - "BUFFER_CONCAT"
+}
+
+void FoolGame::sub_128_4da(int16 unk1) {
+ // 128:04da
+ if (unk1 == 0) {
+ if (this->var_i16_7a0 == 1) {
+ g_toolbox->HideCursor();
+ }
+ } else {
+ if (this->var_i16_7a0 == 0) {
+ g_toolbox->ShowCursor();
+ }
+ }
+ this->var_i16_7a0 = unk1;
+}
+
+void FoolGame::sub_128_50e(int16 unk3, int16 unk2, int16 unk1) {
+ // 128:050e
+ this->var_i16_34 = unk1;
+ this->var_i16_32 = unk2;
+ this->var_i16_30 = unk3;
+ if (this->var_i16_378 != 1) {
+ g_zbasic->unk6(this->var_i16_30, this->var_i16_32, 0x96, 0);
+ if (this->var_i16_34 == 1) {
+ while (g_zbasic->unk5()) {
+ g_toolbox->Delay(1);
+ }
+ }
+ }
+}
+
+void FoolGame::sub_128_55c() {
+ // 128:055c
+ g_zbasic->unk_110(&this->var_i32_172);
+ g_toolbox->PenNormal();
+ g_toolbox->SetRect(this->arr_i32_1910c, 0x6c, 0x127, 0x84, 0x137);
+ g_toolbox->EraseRoundRect(this->arr_i32_1910c, 0x8, 0x7);
+ g_toolbox->FrameRoundRect(this->arr_i32_1910c, 0x8, 0x7);
+ g_zbasic->text(0, 0xc, 0, 0x1);
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133)
+ g_toolbox->DrawString(this->var_str_172);
+}
+
+void FoolGame::sub_128_5fe() {
+ // 128:05fe
+ ParamBlockRec pb;
+ g_toolbox->GetVol(pb);
+ this->var_i16_30 = pb.ioVRefNum;
+ return this->var_i16_30;
+}
+
+void FoolGame::sub_128_64c(int16 unk1) {
+ // 128:064c
+ ParamBlockRec pb;
+ pb.ioVRefNum = unk1;
+ g_toolbox->PBSetVol(pb);
+}
+
+void FoolGame::sub_128_69c(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // 128:069c
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[unk6]);
+ g_toolbox->PenMode(unk5);
+ g_toolbox->SetRect(this->arr_i16_5b7c, unk3, unk4, unk1, unk2);
+ g_toolbox->PaintRect(this->arr_i16_5b7c);
+ g_toolbox->PenNormal();
+}
+
+void FoolGame::sub_128_712(int16 unk3, int16 unk2, int16 unk1) {
+ // 128:0712
+ g_toolbox->PenNormal();
+ if (unk1 == 0) {
+ g_toolbox->PenSize(0x3, 0x3);
+ g_toolbox->PenPat(this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[unk3], 0xf, 0xf);
+ g_toolbox->PenSize(1, 1);
+ g_toolbox->PenPat(this->arr_pat_58f4[2]);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[unk3], 0xf, 0xf);
+ // 128:079e
+ g_zbasic->picture(this->arr_rect_1f38[unk3].left + 3, this->arr_rect_1f38[unk3].top + 3, -1, 0, this->arr_i32_192c0[this->arr_i16_5cbc[unk2/2]]);
+ }
+ // 128:0806
+ if (unk1 == 1) {
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PaintRoundRect(this->arr_rect_1f38[unk3], 0xc, 0xc);
+ }
+ if (unk1 == 2) {
+ g_toolbox->PenMode(kPatOr);
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PaintRoundRect(this->arr_rect_1f38[unk3], 0xc, 0xc);
+ }
+ if (unk1 == 3) {
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[unk3], 0xc, 0xc);
+ }
+ g_toolbox->PenNormal();
+}
+
+void FoolGame::sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // 128:08b4
+ g_toolbox->SetRect(this->arr_i16_5b7c, unk4, unk5, unk2, unk3);
+ g_toolbox->FillRect(this->arr_i16_5b7c, this->arr_pat_58f4[unk1]);
+}
+
+void FoolGame::sub_128_918() {
+ // 128:0918
+ g_zbasic->unk_110(this->var_str_172);
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ g_toolbox->MoveTo(0x100 - (this->var_i16_30 / 2), this->var_i16_7a2);
+ g_toolbox->DrawString(this->var_str_172);
+}
+
+void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // 128:0962
+ this->arr_i16_5b7c.top = unk11;
+ this->arr_i16_5b7c.left = unk10;
+ this->arr_i16_5b7c.bottom = unk9;
+ this->arr_i16_5b7c.right = unk8;
+ this->arr_i16_5b84.top = unk7;
+ this->arr_i16_5b84.left = unk6;
+ this->arr_i16_5b84.bottom = unk5;
+ this->arr_i16_5b84.right = unk4;
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[unk3]);
+ g_toolbox->PenMode(unk2);
+ // 128:0a42
+ for (int i = 0; i <= 3; i++) {
+ this->arr_bcd_5dbc[i] = (float)(this->arr_i32_5b7c+i);
+ this->arr_bcd_5dbc[i+4], (float)((this->arr_i32_5b84+i) - (this->arr_i32_5b7c+i))/(float)(this->var_i16_44);
+
+ }
+ // 128:0af0
+ g_toolbox->PaintRect(this->arr_i16_5b7c);
+ for (int i = 1; i < this->var_i16_44-1; i++) {
+ for (int j = 0; j <= 3; j++) {
+ this->arr_bcd_5dbc[j] = (float)this->arr_bcd_5dbc[j] + (float)this->arr_bcd_5dbc[j+4];
+ this->arr_i16_5b7c[j] = (int)this->arr_bcd_5dbc[j];
+ }
+ // 128:0ba6
+ g_toolbix->PaintRect(this->arr_i16_5b92);
+ }
+ // 128:0bc8
+ g_toolbox->PaintRect(this->arr_i16_5b84);
+ g_toolbox->PenNormal();
+}
+
+void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // 128:0bde
+ this->arr_i16_4758[0] = unk6;
+ this->arr_i16_4758[1] = unk5;
+ this->arr_i16_4758[2] = unk4;
+ this->arr_i16_4758[3] = unk3;
+ this->arr_i16_4758[4] = unk2;
+ this->arr_i16_4758[5] = unk1;
+ this->sub_128_4472();
+}
+
+void FoolGame::sub_128_c6a(int16 unk1) {
+ // 128:0c6a
+ EventRecord event;
+ this->var_i16_78a = g_toolbox->GetNextEvent(unk1, event);
+ if ((this->var_i16_46 == 1) && (this->var_i16_50 < 0x14)) {
+ this->sub_128_5b30();
+ }
+ // 128:0caa
+ g_toolbox->GlobalToLocal(&this->var_i32_50);
+ if (this->var_i16_46 == 3) {
+ if (this->var_i16_54 & 0x100 == 0) {
+ this->sub_128_5f9e();
+ } else {
+ this->sub_128_5baa();
+ }
+ }
+ // 128:0ce0
+ if ((this->var_i16_46 == 5) && (this->var_i16_54 & 0x100 == 0)) {
+ this->sub_128_5f9e();
+ }
+ if (this->var_i16_46 == 6) {
+ this->sub_128_5fb4();
+ }
+ if (this->var_i16_46 == 7) {
+ this->sub_128_6154();
+ }
+}
+
+void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // 128:0d34
+ this->arr_i16_5b7c.top = unk5;
+ this->arr_i16_5b7c.left = unk4;
+ this->arr_i16_5b7c.bottom = unk3;
+ this->arr_i16_57bc.right = unk2;
+ while (this->var_i16_54 & 0x80) {
+ // 128:0d94
+ do {
+ g_toolbox->InvertRect(this->arr_i16_5b7c);
+ this->var_i16_3a = 0;
+ do {
+ this->sub_128_c6a(0);
+ this->var_i16_3a += 1;
+ } while ((this->var_i16_38 == this->var_i16_3a) || (this->var_i16_54 & 0x80 == 0))
+ } while (this->var_i16_54 & 0x80 != 0)
+ }
+}
+
+
+
+// end
+// 128:62ae
+};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
new file mode 100644
index 00000000000..c4c417b838c
--- /dev/null
+++ b/engines/fool/fool_game.h
@@ -0,0 +1,39 @@
+/* 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 FOOL_GAME_H
+#define FOOL_GAME_H
+
+namespace Fool {
+
+class FoolGame {
+public:
+ FoolGame() {}
+ ~FoolGame() {}
+
+ void run();
+
+ void sub_128_004();
+}
+
+}
+
+#endif // FOOL_GAME_H
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index d738c0c130c..69908137b44 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -196,6 +196,20 @@ struct FontInfo {
int16 leading;
};
+
+typedef uint16 OSErr;
+
+struct ParamBlockRec {
+ uint32 qLink = 0;
+ uint16 qType = 0;
+ uint16 ioTrap = 0;
+ uint32 ioCmdAddr = 0;
+ uint32 ioCompletion = 0;
+ OSErr ioResult = 0;
+ Common::String ioNamePtr;
+ uint16 ioVRefNum = 0;
+};
+
class Toolbox {
public:
@@ -227,6 +241,10 @@ public:
// up.
uint32 TickCount();
+ // toolbox_fileman.cpp
+ void PBGetVol(ParamBlockRec ¶mBlock);
+
+ void PBSetVol(ParamBlockRec ¶mBlock);
// toolbox_resman.cpp
Commit: c58cbfd39c2228cee001a4ffb24294b1a4b75452
https://github.com/scummvm/scummvm/commit/c58cbfd39c2228cee001a4ffb24294b1a4b75452
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:54+02:00
Commit Message:
FOOL: More porting
Changed paths:
engines/fool/fool_game.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 0a6d4804e3c..3828fb23000 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -419,7 +419,66 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
}
}
+void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // 128:0dfe
+ this->var_i16_7b0 = unk1;
+ this->var_i16_7ae = unk2;
+ this->var_i16_7ac = unk3;
+ this->var_i16_7aa = unk4;
+ g_toolbox->SetPort(this->var_i32_4);
+ this->var_i16_7b2 = 0xa;
+ g_toolbox->InitCursor();
+ this->sub_128_4da(1);
+ if (this->var_i16_7b0 != 0) {
+ this->sub_128_50e(0x19, 0x64, 0);
+ }
+ // 128:0e46
+ this->sub_128_0a2(0, 0x6060);
+ g_zbasic->text(this->var_i16_7aa, 0xc, 0, 0x3);
+ this->var_i16_7b4 = this->var_i16_7ae*0x46;
+ this->var_i16_7b6 = 0;
+ this->var_i16_7b8 = 0;
+ for (int i = 0; i < this->var_i16_7ac; i++) {
+ // 128:0e86
+ this->var_i16_7ba = g_toolbox->StringWidth(this->arr_i32_1a8d8[this->var_i16_7ba*0x66]);
+ if (this->var_i16_7ba > this->var_i16_7b4) {
+ this->var_i16_7b4 = this->var_i16_7ba;
+ }
+ this->var_i16_7b6 += 0x11;
+ }
+ // 128:0ed6
+ if (this->var_i16_7ae >= 0) {
+ this->var_i16_7bc = 0xa4 + (this->var_i16_7b6 / 2);
+ this->var_i16_7b6 += 0x28;
+ } else {
+ this->var_i16_7b6 += 0xd;
+ }
+ // 128:0f08
+ this->var_i16_7b4 = (this->var_i16_7b4 / 2) + 0xf;
+ this->var_i16_7b6 = (this->var_i16_7b6 / 2);
+ g_toolbox->PenNormal();
+ g_toolbox->SetRect(this->arr_rect_5b7c, 0xf5-this->var_i16_7b4, 0xa0-this->var_i16_7b6, 0x10b+this->var_i16_7b4, 0xb6+this->var_i16_7b6);
+ g_toolbox->PenPat(this->arr_pat_58f4[0]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 1, 1);
+ g_toolbox->PenSize(5, 5);
+ g_toolbox->PenPat(this->arr_pat_58f4[2]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
+ g_toolbox->PenSize(5, 5);
+ // 128:0ff8
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
+ g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[2]);
+ g_toolbox->PenNormal();
+ this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
+ this->var_i16_7b8 = 0;
+ this->var_str_384 = this->arr_i32_1a8d8[this->var_i16_7b8 * 0x66];
+ this->sub_128_918(this->var_str_384);
+ // 128:1086
+}
// end
// 128:62ae
Commit: d9542fbbf436120334fbb777f916712be204895c
https://github.com/scummvm/scummvm/commit/d9542fbbf436120334fbb777f916712be204895c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:55+02:00
Commit Message:
FOOL: Rework PicHandle to support masked drawing
Changed paths:
engines/fool/fool_prologue.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_text.cpp
engines/fool/utils.cpp
engines/fool/utils.h
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index d60c259e939..d687d35a491 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -778,7 +778,20 @@ void FoolPrologue::prologueRun() {
// 130:034a
for (int i = 0xd; i <= 0x12; i++) {
- // priestess silhouette -> fool on the cliff
+ // priestess silhouette -> fool on the cliff.
+ // Image two in this sequence is a PICT that draws the words
+ // "...for no-one can undo the treachery I have inflicted upon the land!"
+ // using the ShortLine opcode. Because the lines are drawn in white,
+ // and the default background colour is white, this is an example of a PICT
+ // that needs to be drawn to the target buffer with a mask.
+
+ // FIXME: On original (slow) hardware, this image takes a while to render to the
+ // screen with the line tool and gives a cool fade-in effect. It's unclear
+ // what the best way to replicate that here would be, as we are drawing to
+ // an offscreen buffer. Maybe we could add some generic way for the PICTDecoder
+ // to run a callback between opcodes? That probably wouldn't help, given
+ // the image is decoded to a surface at stream load time. Alternatively we could
+ // dump the opcodes for just that picture and draw it ourselves.
this->prologueBufferNextPicture();
}
@@ -924,15 +937,20 @@ void FoolPrologue::prologueRun() {
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i <= 0x2d; i++) {
this->var_i32_2 = g_toolbox->TickCount();
+ // seizure warning
+ g_toolbox->InvertRect(this->arr_i16_1bc);
this->delayFromMarker(1);
}
- // start loading some new resources into the screen buffers
// 130:083c
+
+ // Draw the priestess silhouette + "treachery" message
g_zbasic->picture(0, 0, this->arr_i32_0[0xd]);
g_zbasic->picture(5, 0, this->arr_i32_0[0xe]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xd]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xe]);
+
+ // start loading some new resources from the floppy disk into the screen buffers
this->var_i32_2 = g_toolbox->TickCount();
// 130:0890
// g_zbasic->52(0);
@@ -982,6 +1000,7 @@ void FoolPrologue::prologueRun() {
// 130:0ac2
g_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
this->prologueRenderNextText();
+ g_toolbox->ReleaseResource(this->arr_i32_0[0x12]);
this->setPortBitsToPage(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 69908137b44..662124ae6fd 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -28,6 +28,7 @@
#include "common/str.h"
#include "common/ustr.h"
+#include "image/pict.h"
#include "graphics/framelimiter.h"
#include "graphics/macgui/macwindow.h"
#include "graphics/macgui/macwindowmanager.h"
@@ -43,7 +44,7 @@ struct Region {
typedef Common::SharedPtr<Common::Array<byte>> Handle;
typedef Common::SharedPtr<Region> RgnHandle;
-typedef Common::SharedPtr<Graphics::ManagedSurface> PicHandle;
+typedef Common::SharedPtr<Image::PICTDecoder> PicHandle;
// BitMap is the monochrome surface format.
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Handle PolyHandle;
@@ -389,6 +390,11 @@ public:
// srcBits.bounds coordinates.
void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
+ // PROCEDURE DrawPicture (myPicture: PicHandle; dstRect: Rect);
+ // Within the rectangle that you specify in the dstRect parameter, the DrawPicture
+ // procedure draws the picture that you specify in the myPicture parameter.
+ void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
+
// PROCEDURE EndUpdate (theWindow: WindowPtr);
// Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
// BeginUpdate as described above.
@@ -650,6 +656,7 @@ private:
void _pumpEvents();
void _updateScreen();
+ void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
};
} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 1e52d9fb717..547b2fb4d2a 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -49,17 +49,21 @@ void Toolbox::ClipRect(Common::Rect &r) {
}
void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
+ _copyBits(srcBits, BitMap(nullptr), dstBits, srcRect, dstRect, mode, maskRgn);
+}
+
+void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
if (!srcBits) {
- warning("Toolbox::CopyBits: empty srcBits handle");
+ warning("Toolbox::_copyBits: empty srcBits handle");
return;
}
if (!dstBits) {
- warning("Toolbox::CopyBits: empty dstBits handle");
+ warning("Toolbox::_copyBits: empty dstBits handle");
return;
}
if (maskRgn) {
- warning("Toolbox::CopyBits: maskRgn unimplemented");
+ warning("Toolbox::_copyBits: maskRgn unimplemented");
}
Common::Rect clipSrcRect = srcRect;
Common::Rect clipDstRect = dstRect;
@@ -94,7 +98,6 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
clipDstRect.bottom += clipSrcRect.bottom - srcRect.bottom;
}
}
- BitMap mask(nullptr);
Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(clipDstRect.left, clipDstRect.top), mode);
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(result);
@@ -102,6 +105,16 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
}
}
+void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
+ const Graphics::Surface *surface = myPicture->getSurface();
+ const Graphics::Palette &palette = myPicture->getPalette();
+ //const BitMap mask(nullptr);
+ const BitMap mask(new Graphics::ManagedSurface());
+ mask->copyFrom(*myPicture->getMask());
+ const BitMap intermediate(createRemappedSurface(surface, palette.data(), palette.size()));
+ _copyBits(intermediate, mask, _port->portBits, intermediate->getBounds(), dstRect, kSrcCopy, nullptr);
+}
+
void Toolbox::EndUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::EndUpdate");
}
@@ -199,13 +212,10 @@ PicHandle Toolbox::GetPicture(uint16 picID) {
Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
if (handle) {
Common::MemoryReadStream stream(handle->data(), handle->size());
- Image::PICTDecoder decoder;
- if (decoder.loadStream(stream)) {
- const Graphics::Surface *surface = decoder.getSurface();
- const Graphics::Palette &palette = decoder.getPalette();
- PicHandle result(createRemappedSurface(surface, palette.data(), palette.size()));
- _resPicts[result] = handle;
- return result;
+ PicHandle decoder(new Image::PICTDecoder());
+ if (decoder->loadStream(stream)) {
+ _resPicts[decoder] = handle;
+ return decoder;
} else {
warning("Toolbox::GetPicture: failed to load PICT id %d", picID);
}
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index c42469fa261..dd6b5317c6c 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -41,7 +41,7 @@ void Toolbox::DrawString(const Common::U32String &s) {
Common::Rect bbox = font->getBoundingBox(s);
BitMap buffer(new Graphics::ManagedSurface(bbox.width(), bbox.height(), Graphics::PixelFormat::createFormatCLUT8()));
buffer->fillRect(buffer->getBounds(), _port->bkColor);
- font->drawString(buffer->surfacePtr(), s.encode(), 0, 0, bbox.width(), _port->fgColor);
+ font->drawString(buffer->surfacePtr(), s, 0, 0, bbox.width(), _port->fgColor);
BitMap mask(nullptr);
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index afd10579b9f..5672cfaea98 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -25,7 +25,7 @@
namespace Fool {
-Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, SourceMode mode) {
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode) {
Common::Rect dstRect = src->getBounds();
dstRect.moveTo(dstPos);
dstRect.clip(dst->getBounds());
@@ -88,7 +88,7 @@ Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Poin
return dstRect;
}
-Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, PatternMode mode) {
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode) {
return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7));
}
diff --git a/engines/fool/utils.h b/engines/fool/utils.h
index 164457f358e..5d5095af7f4 100644
--- a/engines/fool/utils.h
+++ b/engines/fool/utils.h
@@ -29,8 +29,8 @@
namespace Fool {
-Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, SourceMode mode);
-Common::Rect blitMono(BitMap &src, BitMap &dst, BitMap &mask, const Common::Point &dstPos, PatternMode mode);
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode);
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode);
Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount);
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index ebd1aa817b9..21ea735a9e3 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -214,12 +214,8 @@ void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
return;
}
- GrafPtr port = nullptr;
- _toolbox->GetPort(port);
-
- Common::Rect srcRect(0, 0, src->w, src->h);
- Common::Rect destRect(x, y, x+src->w, y+src->h);
- _toolbox->CopyBits(src, port->portBits, srcRect, destRect, kSrcCopy, nullptr);
+ Common::Rect destRect(x, y, x+src->getSurface()->w, y+src->getSurface()->h);
+ _toolbox->DrawPicture(src, destRect);
//Common::Rect badnews = src->getBounds();
//_window->getWindowSurface()->blitFrom(*src, badnews, badnews);
Commit: a4b9b99159b49fe7a4b03a34c7baff3f353e98ad
https://github.com/scummvm/scummvm/commit/a4b9b99159b49fe7a4b03a34c7baff3f353e98ad
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:55+02:00
Commit Message:
FOOL: More porting
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 3828fb23000..fe707ce8cda 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -19,22 +19,28 @@
*
*/
+#include "fool/fool.h"
#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
namespace Fool {
+ZBasic *g_zbasic;
+Toolbox *g_toolbox;
+
void FoolGame::sub_128_004() {
// 128:0004
g_zbasic->unk_331(0xdac0, 0);
g_zbasic->unk_331(0x1b58, 1);
g_zbasic->unk_331(0x1b58, 2);
- g_toolbox->SetRect(this->arr_i16_1ae06, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->SetRect(this->arr_rect_1ae06, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
this->var_str_384 = g_zbasic->str(0);
- this->var_str_384 += g_zbasic->str(1);
- this->var_str_384 += g_zbasic->str(2);
+ this->var_str_384 = g_zbasic->str(1);
+ this->var_str_384 = g_zbasic->str(2);
// 128:0086
// 128:0086: MOVEQ - 0x0,D0
@@ -56,8 +62,8 @@ void FoolGame::sub_128_004() {
// 128:0442: JMP - [0x45e]
// 128:045e: JMP - [0x478]
// 128:0478
- this->var_str_69a += g_zbasic->str(6);
- this->var_i32_79a = &this->var_str_69a;
+ this->var_str_69a = g_zbasic->str(6);
+ //this->var_i32_79a = &this->var_str_69a;
// 128:0496: JMP - [0x4d6]
// 128:04d6: JMP - [0x50a]
// 128:050a: JMP - [0x558]
@@ -81,20 +87,22 @@ void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
this->var_i16_32 = unk1;
this->var_i16_30 = unk2;
if (this->var_i16_30 == 0) {
- g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i16_5dfc[this->var_i16_32]);
+ // FIXME: use var_i16_32 to choose start offset??
+ g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_5dfc);
}
// 128:00e6
if (this->var_i16_30 == 1) {
- g_zbasic->put(0, 0, 0, this->arr_i16_5dfc[this->var_i16_32], 0);
+ // FIXME: use var_i16_32 to choose start offset??
+ g_zbasic->put(0, 0, 0, 0, this->arr_bmp_5dfc);
}
}
-void FoolGame::sub_128_11c() {
+void FoolGame::sub_128_11c(Common::U32String &unk2, Common::U32String &unk1) {
// 128:011c
- g_zbasic->unk_110(&this->var_i16_272);
- g_zbasic->unk_110(&this->var_i16_172);
+ g_zbasic->unk_110(this->var_str_272, unk1);
+ g_zbasic->unk_110(this->var_str_172, unk2);
this->var_str_384 = g_zbasic->str(3);
this->var_i16_586 = 0;
@@ -102,56 +110,64 @@ void FoolGame::sub_128_11c() {
this->sub_128_0a2(0, 0x6260);
// 128:015a
- this->var_i16_50 = this->var_i16_58 + 0x3d;
- this->var_i16_52 = this->var_i16_56 + 0x68;
+ this->var_pt_50.y = this->var_i16_58 + 0x3d;
+ this->var_pt_50.x = this->var_i16_56 + 0x68;
this->var_i16_16c = 1;
- this->var_i16_16e = 0;
+ this->var_i32_16e = 0;
// 128:017e
- g_toolbox->Pack3(&this->var_i16_50, &this->var_i16_172, &this->var_i16_272, this->var_i32_16e, this->var_i16_5e, 1);
+ g_toolbox->SFPutFile(this->var_pt_50, this->var_str_172, this->var_str_272, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->sub_128_0a2(1, 0x6d60);
// 128:01b0
- if (this->var_i8_5e[0] == 1) {
- this->var_str_486 += this->var_str_68;
- this->var_i16_586 = this->var_i16_64;
+ if (this->var_sfr_5e.good == 1) {
+ this->var_str_486 += this->var_sfr_5e.fName;
+ this->var_i16_586 = this->var_sfr_5e.vRefNum;
}
}
-void FoolGame::sub_128_01e4() {
+void FoolGame::sub_128_1e4(Common::U32String &unk1) {
// 128:01e4
- g_zbasic->unk_110(&this->var_i16_172);
+ g_zbasic->unk_110(this->var_str_172, unk1);
this->var_str_588 = g_zbasic->str(4);
this->var_i16_688 = 0;
this->sub_128_0a2(0, 0x6260);
// 128:0218
- this->var_i16_50 = this->var_i16_58 + 0x3d;
- this->var_i16_52 = this->var_i16_56 + 0x53;
+ this->var_pt_50.y = this->var_i16_58 + 0x3d;
+ this->var_pt_50.x = this->var_i16_56 + 0x53;
this->var_i16_16c = 1;
this->var_i32_16e = 0;
// 128:023c
- this->var_i32_168 = *(this->var_ptr_172 + 1);
- g_toolbox->Pack3(*this->var_i32_50, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, &this->var_i32_168, this->var_i32_16e, &this->var_i16_5e, 2);
+ // get offset of bytes in string and pretend it's an OSType
+ // this->var_i32_168 = *(this->var_str_172 + 1);
+ SFTypeList typeList = { { 0 } };
+ typeList.types[0] = this->var_str_172.at(0) << 24;
+ typeList.types[0] += this->var_str_172.at(1) << 16;
+ typeList.types[0] += this->var_str_172.at(2) << 8;
+ typeList.types[0] += this->var_str_172.at(3) << 0;
+
+ g_toolbox->SFGetFile(this->var_pt_50, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->sub_128_0a2(1, 0x6d60);
- if (this->var_i16_5e[0] == 1) {
+ if (this->var_sfr_5e.good == 1) {
// 128:02a2
- this->var_str_588 += this->var_str_68;
- this->var_i16_688 = this->var_i16_64;
+ this->var_str_588 += this->var_sfr_5e.fName;
+ this->var_i16_688 = this->var_sfr_5e.vRefNum;
}
}
void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
+ // FIXME: why is the point inverted in the code??
this->var_i16_68c = unk1;
this->var_i16_68a = unk2;
- this->var_i16_68a = (this->var_i16_52 - *this->arr_i16_1ec0) / (*this->arr_i16_1ec4);
+ this->var_i16_68a = (this->var_pt_50.x - this->arr_rect_1ec0.top) / (this->arr_rect_1ec0.bottom);
- this->var_i16_68c = (this->var_i16_50 - *this->arr_i16_1ec2) / (*this->arr_i16_1ec6);
+ this->var_i16_68c = (this->var_pt_50.y - this->arr_rect_1ec0.left) / (this->arr_rect_1ec0.right);
}
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
@@ -159,14 +175,14 @@ void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
if (unk2 < 1) {
unk2 = 1;
}
- if (*this->arr_i16_1eb8 > unk2) {
- unk2 = *this->arr_i16_1eb8;
+ if (this->arr_i16_1eb8[0] > unk2) {
+ unk2 = this->arr_i16_1eb8[0];
}
if (unk1 < 1) {
unk1 = 1;
}
- if (*this->arr_i16_1eba > unk1) {
- unk1 = *this->arr_i16_1eba;
+ if (this->arr_i16_1eb8[1] > unk1) {
+ unk1 = this->arr_i16_1eb8[1];
}
}
@@ -176,45 +192,56 @@ void FoolGame::sub_128_3da(int16 unk1) {
do {
g_toolbox->Delay(1);
- } while (g_toolbox->TickCount() < (this->var_i32_68e + unk1))
+ } while (g_toolbox->TickCount() < (this->var_i32_68e + unk1));
}
void FoolGame::sub_128_406(int16 unk1) {
// 128:0402
do {
g_toolbox->Delay(1);
- } while (g_toolbox->TickCount() < (this->var_i32_692 + unk1))
+ } while (g_toolbox->TickCount() < (this->var_i32_692 + unk1));
}
int16 FoolGame::sub_128_428() {
// 128:0428
- this->var_i16_30 = (byte *)this->var_i32_696;
+ // read a byte
+ // FIXME
+/* this->var_i16_30 = *(byte *)this->var_i32_696;
this->var_i32_696 += 1;
- return this->var_i16_30;
+ return this->var_i16_30; */
+ return 0;
}
int16 FoolGame::sub_128_446() {
// 128:0446
- this->var_i16_30 = *(int16 *)this->var_i32_696;
+ // read a short
+ // FIXME
+/* this->var_i16_30 = *(int16 *)this->var_i32_696;
this->var_i32_696 += 2;
- return this->var_i16_30;
+ return this->var_i16_30;*/
+ return 0;
}
int16 FoolGame::sub_128_462() {
// 128:0462
- this->var_i32_68e = *(int32 *)this->var_i32_696;
+ // read a long
+ // FIXME
+/* this->var_i32_68e = *(int32 *)this->var_i32_696;
this->var_i32_696 += 4;
- return this->var_i32_68e;
+ return this->var_i32_68e;*/
+ return 0;
}
void FoolGame::sub_128_49a() {
// 128:049a
- this->var_i16_79e = *(byte *)this->var_i32_696;
- g_zbasic->blockMove(this->var_i32_696, this->var_i32_79a, this->var_i32_79e+1);
- this-var_i32_696 += this->var_i16_79e + 1;
+ // read a pascal string
+ // FIXME
+/* this->var_i16_79e = *(byte *)this->var_i32_696;
+ g_zbasic->blockMove(this->var_i32_696, this->var_str_69a, this->var_i16_79e+1);
+ this->var_i32_696 += this->var_i16_79e + 1;
// 128:04cc: LEA - VAR(0x69a),A0
- // 128:04d0: JSR - "BUFFER_CONCAT"
+ // 128:04d0: JSR - "BUFFER_CONCAT"*/
}
void FoolGame::sub_128_4da(int16 unk1) {
@@ -237,32 +264,32 @@ void FoolGame::sub_128_50e(int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_32 = unk2;
this->var_i16_30 = unk3;
if (this->var_i16_378 != 1) {
- g_zbasic->unk6(this->var_i16_30, this->var_i16_32, 0x96, 0);
+ g_zbasic->unk_6(this->var_i16_30, this->var_i16_32, 0x96, 0);
if (this->var_i16_34 == 1) {
- while (g_zbasic->unk5()) {
+ while (g_zbasic->unk_5()) {
g_toolbox->Delay(1);
}
}
}
}
-void FoolGame::sub_128_55c() {
+void FoolGame::sub_128_55c(Common::U32String &unk1) {
// 128:055c
- g_zbasic->unk_110(&this->var_i32_172);
+ g_zbasic->unk_110(this->var_str_172, unk1);
g_toolbox->PenNormal();
- g_toolbox->SetRect(this->arr_i32_1910c, 0x6c, 0x127, 0x84, 0x137);
- g_toolbox->EraseRoundRect(this->arr_i32_1910c, 0x8, 0x7);
- g_toolbox->FrameRoundRect(this->arr_i32_1910c, 0x8, 0x7);
- g_zbasic->text(0, 0xc, 0, 0x1);
+ g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
+ g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ g_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133)
+ g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133);
g_toolbox->DrawString(this->var_str_172);
}
-void FoolGame::sub_128_5fe() {
+int32 FoolGame::sub_128_5fe() {
// 128:05fe
ParamBlockRec pb;
- g_toolbox->GetVol(pb);
+ g_toolbox->PBGetVol(pb);
this->var_i16_30 = pb.ioVRefNum;
return this->var_i16_30;
}
@@ -274,13 +301,13 @@ void FoolGame::sub_128_64c(int16 unk1) {
g_toolbox->PBSetVol(pb);
}
-void FoolGame::sub_128_69c(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:069c
g_toolbox->PenNormal();
g_toolbox->PenPat(this->arr_pat_58f4[unk6]);
g_toolbox->PenMode(unk5);
- g_toolbox->SetRect(this->arr_i16_5b7c, unk3, unk4, unk1, unk2);
- g_toolbox->PaintRect(this->arr_i16_5b7c);
+ g_toolbox->SetRect(this->arr_rect_5b7c, unk3, unk4, unk1, unk2);
+ g_toolbox->PaintRect(this->arr_rect_5b7c);
g_toolbox->PenNormal();
}
@@ -295,7 +322,7 @@ void FoolGame::sub_128_712(int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->PenPat(this->arr_pat_58f4[2]);
g_toolbox->FrameRoundRect(this->arr_rect_1f38[unk3], 0xf, 0xf);
// 128:079e
- g_zbasic->picture(this->arr_rect_1f38[unk3].left + 3, this->arr_rect_1f38[unk3].top + 3, -1, 0, this->arr_i32_192c0[this->arr_i16_5cbc[unk2/2]]);
+ g_zbasic->picture(this->arr_rect_1f38[unk3].left + 3, this->arr_rect_1f38[unk3].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[unk2/2]]);
}
// 128:0806
if (unk1 == 1) {
@@ -315,53 +342,60 @@ void FoolGame::sub_128_712(int16 unk3, int16 unk2, int16 unk1) {
void FoolGame::sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:08b4
- g_toolbox->SetRect(this->arr_i16_5b7c, unk4, unk5, unk2, unk3);
- g_toolbox->FillRect(this->arr_i16_5b7c, this->arr_pat_58f4[unk1]);
+ g_toolbox->SetRect(this->arr_rect_5b7c, unk4, unk5, unk2, unk3);
+ g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[unk1]);
}
-void FoolGame::sub_128_918() {
+void FoolGame::sub_128_918(Common::U32String &unk1) {
// 128:0918
- g_zbasic->unk_110(this->var_str_172);
+ g_zbasic->unk_110(unk1, this->var_str_172);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo(0x100 - (this->var_i16_30 / 2), this->var_i16_7a2);
g_toolbox->DrawString(this->var_str_172);
}
-void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1) {
// 128:0962
- this->arr_i16_5b7c.top = unk11;
- this->arr_i16_5b7c.left = unk10;
- this->arr_i16_5b7c.bottom = unk9;
- this->arr_i16_5b7c.right = unk8;
- this->arr_i16_5b84.top = unk7;
- this->arr_i16_5b84.left = unk6;
- this->arr_i16_5b84.bottom = unk5;
- this->arr_i16_5b84.right = unk4;
+ this->arr_rect_5b7c.top = unk11;
+ this->arr_rect_5b7c.left = unk10;
+ this->arr_rect_5b7c.bottom = unk9;
+ this->arr_rect_5b7c.right = unk8;
+ this->arr_rect_5b84.top = unk7;
+ this->arr_rect_5b84.left = unk6;
+ this->arr_rect_5b84.bottom = unk5;
+ this->arr_rect_5b84.right = unk4;
g_toolbox->PenNormal();
g_toolbox->PenPat(this->arr_pat_58f4[unk3]);
g_toolbox->PenMode(unk2);
// 128:0a42
- for (int i = 0; i <= 3; i++) {
- this->arr_bcd_5dbc[i] = (float)(this->arr_i32_5b7c+i);
- this->arr_bcd_5dbc[i+4], (float)((this->arr_i32_5b84+i) - (this->arr_i32_5b7c+i))/(float)(this->var_i16_44);
-
- }
+ // unrolled loop
+ this->arr_bcd_5dbc[0] = (float)(this->arr_rect_5b7c.top);
+ this->arr_bcd_5dbc[1] = (float)(this->arr_rect_5b7c.left);
+ this->arr_bcd_5dbc[2] = (float)(this->arr_rect_5b7c.bottom);
+ this->arr_bcd_5dbc[3] = (float)(this->arr_rect_5b7c.right);
+ this->arr_bcd_5dbc[4] = (float)((this->arr_rect_5b84.top) - (this->arr_rect_5b7c.top))/(float)(this->var_i16_44);
+ this->arr_bcd_5dbc[5] = (float)((this->arr_rect_5b84.left) - (this->arr_rect_5b7c.left))/(float)(this->var_i16_44);
+ this->arr_bcd_5dbc[6] = (float)((this->arr_rect_5b84.bottom) - (this->arr_rect_5b7c.bottom))/(float)(this->var_i16_44);
+ this->arr_bcd_5dbc[7] = (float)((this->arr_rect_5b84.right) - (this->arr_rect_5b7c.right))/(float)(this->var_i16_44);
// 128:0af0
- g_toolbox->PaintRect(this->arr_i16_5b7c);
+ g_toolbox->PaintRect(this->arr_rect_5b7c);
for (int i = 1; i < this->var_i16_44-1; i++) {
for (int j = 0; j <= 3; j++) {
this->arr_bcd_5dbc[j] = (float)this->arr_bcd_5dbc[j] + (float)this->arr_bcd_5dbc[j+4];
- this->arr_i16_5b7c[j] = (int)this->arr_bcd_5dbc[j];
}
+ this->arr_rect_5b7c.top = (int)this->arr_bcd_5dbc[0];
+ this->arr_rect_5b7c.left = (int)this->arr_bcd_5dbc[1];
+ this->arr_rect_5b7c.bottom = (int)this->arr_bcd_5dbc[2];
+ this->arr_rect_5b7c.right = (int)this->arr_bcd_5dbc[3];
// 128:0ba6
- g_toolbix->PaintRect(this->arr_i16_5b92);
+ g_toolbox->PaintRect(this->arr_rect_5b92);
}
// 128:0bc8
- g_toolbox->PaintRect(this->arr_i16_5b84);
+ g_toolbox->PaintRect(this->arr_rect_5b84);
g_toolbox->PenNormal();
}
-void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::sub_128_bde(int16 unk6, int16 unk5, PatternMode unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:0bde
this->arr_i16_4758[0] = unk6;
this->arr_i16_4758[1] = unk5;
@@ -376,20 +410,20 @@ void FoolGame::sub_128_c6a(int16 unk1) {
// 128:0c6a
EventRecord event;
this->var_i16_78a = g_toolbox->GetNextEvent(unk1, event);
- if ((this->var_i16_46 == 1) && (this->var_i16_50 < 0x14)) {
+ if ((this->var_i16_46 == 1) && (this->var_pt_50.y < 0x14)) {
this->sub_128_5b30();
}
// 128:0caa
- g_toolbox->GlobalToLocal(&this->var_i32_50);
+ g_toolbox->GlobalToLocal(this->var_pt_50);
if (this->var_i16_46 == 3) {
- if (this->var_i16_54 & 0x100 == 0) {
+ if ((this->var_i16_54 & 0x100) == 0) {
this->sub_128_5f9e();
} else {
this->sub_128_5baa();
}
}
// 128:0ce0
- if ((this->var_i16_46 == 5) && (this->var_i16_54 & 0x100 == 0)) {
+ if ((this->var_i16_46 == 5) && ((this->var_i16_54 & 0x100) == 0)) {
this->sub_128_5f9e();
}
if (this->var_i16_46 == 6) {
@@ -402,20 +436,20 @@ void FoolGame::sub_128_c6a(int16 unk1) {
void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:0d34
- this->arr_i16_5b7c.top = unk5;
- this->arr_i16_5b7c.left = unk4;
- this->arr_i16_5b7c.bottom = unk3;
- this->arr_i16_57bc.right = unk2;
+ this->arr_rect_5b7c.top = unk5;
+ this->arr_rect_5b7c.left = unk4;
+ this->arr_rect_5b7c.bottom = unk3;
+ this->arr_rect_5b7c.right = unk2;
while (this->var_i16_54 & 0x80) {
// 128:0d94
do {
- g_toolbox->InvertRect(this->arr_i16_5b7c);
+ g_toolbox->InvertRect(this->arr_rect_5b7c);
this->var_i16_3a = 0;
do {
this->sub_128_c6a(0);
this->var_i16_3a += 1;
- } while ((this->var_i16_38 == this->var_i16_3a) || (this->var_i16_54 & 0x80 == 0))
- } while (this->var_i16_54 & 0x80 != 0)
+ } while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_i16_54 & 0x80) == 0));
+ } while ((this->var_i16_54 & 0x80) != 0);
}
}
@@ -434,13 +468,13 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
// 128:0e46
this->sub_128_0a2(0, 0x6060);
- g_zbasic->text(this->var_i16_7aa, 0xc, 0, 0x3);
+ g_zbasic->text(this->var_i16_7aa, 0xc, 0, kSrcBic);
this->var_i16_7b4 = this->var_i16_7ae*0x46;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
for (int i = 0; i < this->var_i16_7ac; i++) {
// 128:0e86
- this->var_i16_7ba = g_toolbox->StringWidth(this->arr_i32_1a8d8[this->var_i16_7ba*0x66]);
+ this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[this->var_i16_7ba]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
}
@@ -473,11 +507,126 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[2]);
g_toolbox->PenNormal();
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
- this->var_i16_7b8 = 0;
- this->var_str_384 = this->arr_i32_1a8d8[this->var_i16_7b8 * 0x66];
- this->sub_128_918(this->var_str_384);
- // 128:1086
+ // 128:1056
+ for (int i = 0; i < this->var_i16_7ac; i++) {
+ this->var_i16_7b8 = 0;
+ this->var_str_384 = this->arr_str_1a8d8[this->var_i16_7b8];
+ this->sub_128_918(this->var_str_384);
+ // 128:1086
+ // 128:1086: CLR.W - -0x772(A5)
+ this->var_i16_7a2 += 0x11;
+ }
+ // 128:10a0
+ if (this->var_i16_7ae != 0) {
+ g_toolbox->PenNormal();
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+
+ // 128:10c0
+ // loop to zero out three rectangles??
+ this->arr_rect_5b7c = Common::Rect(0, 0, 0, 0);
+ this->arr_rect_5b84 = Common::Rect(0, 0, 0, 0);
+ this->arr_rect_5b8c = Common::Rect(0, 0, 0, 0);
+ // 128:10e2
+ if (this->var_i16_7ae == 1) {
+ g_toolbox->SetRect(this->arr_rect_5b7c, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ // 128:1122
+ } else if (this->var_i16_7ae == 2) {
+ g_toolbox->SetRect(this->arr_rect_5b7c, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(this->arr_rect_5b84, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
+ // 128:1182
+ } else if (this->var_i16_7ae == 3) {
+ g_toolbox->SetRect(this->arr_rect_5b7c, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(this->arr_rect_5b84, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(this->arr_rect_5b8c, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
+ }
+ // 128:1208
+ if (this->var_i16_7ae >= 1) {
+ g_toolbox->EraseRoundRect(this->arr_rect_5b7c, 0xa, 0xa);
+ g_toolbox->FrameRoundRect(this->arr_rect_5b7c, 0xa, 0xa);
+ this->var_str_172 = this->arr_str_1a8d8[(this->var_i16_7ac + 1)];
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ // 128:1274
+ this->var_i16_30 = this->arr_rect_5b7c.left + ((this->arr_rect_5b7c.right - this->arr_rect_5b7c.left) / 2) - (this->var_i16_30 / 2);
+ // 128:12d4
+ g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
+ g_toolbox->DrawString(this->var_str_172);
+ if (this->var_i16_7ae > 1) {
+ g_toolbox->InsetRect(this->arr_rect_5b7c, -2, -2);
+ g_toolbox->PenPat(this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_5b7c, 0xa, 0xa);
+ g_toolbox->PenNormal();
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 2, 2);
+ }
+ }
+ // 128:134c
+ if (this->var_i16_7ae >= 2) {
+ g_toolbox->EraseRoundRect(this->arr_rect_5b84, 0xa, 0xa);
+ g_toolbox->FrameRoundRect(this->arr_rect_5b84, 0xa, 0xa);
+ this->var_str_172 = this->arr_str_1a8d8[(this->var_i16_7ac+2)];
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ this->var_i16_30 = this->arr_rect_5b84.left + ((this->arr_rect_5b84.right - this->arr_rect_5b84.left)/2) - (this->var_i16_30 / 2);
+ // 128:1418
+ g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
+ g_toolbox->DrawString(this->var_str_172);
+ }
+ // 128:1432
+ if (this->var_i16_7ae >= 3) {
+ // FIXME
+ }
+ // 128:1518
+
+ }
+ // 128:1784
+
+}
+
+
+void FoolGame::sub_128_4472() {
+ // 128:4472
+ if (this->arr_i16_4758[1] == 0) {
+ this->arr_i16_4758[1] = this->var_i16_7e2;
+ }
+ if (this->arr_i16_4758[2] == 0) {
+ this->arr_i16_4758[2] = 0x8;
+ }
+ if (this->arr_i16_4758[0] == 0) {
+ sub_128_962(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
+ return;
+ }
+ // 128:4520
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_4758[1]]);
+ g_toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
+ if (this->arr_i16_4758[5] == 0) {
+ // 128:456a
+ // FIXME
+ }
+ // 128:459a
+
+}
+
+void FoolGame::sub_128_5b30() {
+ // FIXME
+}
+
+void FoolGame::sub_128_5baa() {
+ // FIXME
+}
+
+void FoolGame::sub_128_5f9e() {
+ // FIXME
+}
+
+void FoolGame::sub_128_5fb4() {
+ // FIXME
+}
+
+void FoolGame::sub_128_6154() {
+ // FIXME
+}
+void FoolGame::sub_128_6244() {
+ // FIXME
}
// end
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index c4c417b838c..33f247eaff0 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -22,6 +22,11 @@
#ifndef FOOL_GAME_H
#define FOOL_GAME_H
+#include "common/rect.h"
+#include "common/str.h"
+
+#include "fool/toolbox.h"
+
namespace Fool {
class FoolGame {
@@ -32,7 +37,108 @@ public:
void run();
void sub_128_004();
-}
+ void sub_128_0a2(int16 unk2, int16 unk1);
+ void sub_128_11c(Common::U32String &unk2, Common::U32String &unk1);
+ void sub_128_1e4(Common::U32String &unk1);
+ void sub_128_2be(int16 unk2, int16 unk1);
+ void sub_128_342(int16 unk2, int16 unk1);
+ void sub_128_3da(int16 unk1);
+ void sub_128_406(int16 unk1);
+ int16 sub_128_428();
+ int16 sub_128_446();
+ int16 sub_128_462();
+ void sub_128_49a();
+ void sub_128_4da(int16 unk1);
+ void sub_128_50e(int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_55c(Common::U32String &unk1);
+ int32 sub_128_5fe();
+ void sub_128_64c(int16 unk1);
+ void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_712(int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_918(Common::U32String &unk1);
+ void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
+ void sub_128_bde(int16 unk6, int16 unk5, PatternMode unk4, int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_c6a(int16 unk1);
+ void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+
+ void sub_128_4472();
+ void sub_128_5b30();
+ void sub_128_5baa();
+ void sub_128_5f9e();
+ void sub_128_5fb4();
+ void sub_128_6154();
+ void sub_128_6244();
+
+private:
+ GrafPtr var_i32_4;
+ int16 var_i16_30;
+ int16 var_i16_32;
+ int16 var_i16_34;
+ int16 var_i16_38;
+ int16 var_i16_3a;
+ int16 var_i16_44;
+ int16 var_i16_46;
+ Common::Point var_pt_50;
+ int16 var_i16_54;
+ int16 var_i16_56;
+ int16 var_i16_58;
+ SFReply var_sfr_5e; // -> aa
+ int16 var_i16_16c;
+ ProcPtr var_i32_16e;
+ Common::U32String var_str_172;
+ Common::U32String var_str_272;
+ int16 var_i16_378;
+ Common::U32String var_str_384;
+ int16 var_i16_484;
+ Common::U32String var_str_486;
+ int16 var_i16_586;
+ Common::U32String var_str_588;
+ int16 var_i16_688;
+ int16 var_i16_68a;
+ int16 var_i16_68c;
+ uint32 var_i32_68e;
+ uint32 var_i32_692;
+ int32 var_i32_696;
+ Common::U32String var_str_69a;
+ int16 var_i16_78a;
+ int16 var_i16_79e;
+ int16 var_i16_7a0;
+ int16 var_i16_7a2;
+ int16 var_i16_7aa;
+ int16 var_i16_7ac;
+ int16 var_i16_7ae;
+ int16 var_i16_7b0;
+ int16 var_i16_7b2;
+ int16 var_i16_7b4;
+ int16 var_i16_7b6;
+ int16 var_i16_7b8;
+ int16 var_i16_7ba;
+ int16 var_i16_7bc;
+
+ int16 var_i16_7e2;
+
+ int16 arr_i16_1eb8[4];
+ Common::Rect arr_rect_1ec0;
+ Common::Rect arr_rect_1f38[3];
+ int16 arr_i16_4758[6];
+ Pattern arr_pat_58f4[4];
+ Common::Rect arr_rect_5b7c;
+ Common::Rect arr_rect_5b84;
+ Common::Rect arr_rect_5b8c;
+ Common::Rect arr_rect_5b92;
+ int16 arr_i16_5cbc[26];
+ float arr_bcd_5dbc[8];
+ BitMap arr_bmp_5dfc; // 22000, close to a screen page
+ BitMap arr_bmp_109dc;
+ BitMap arr_bmp_15fcc;
+ // Also 109dc and 15fcc
+ Common::Rect arr_rect_1910c;
+ PicHandle arr_i32_192c0[0x18];
+ Common::U32String arr_str_1a8d8[7]; // 0x66 each
+ Common::Rect arr_rect_1ae06;
+};
}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index ec0c88ff806..c12685a0172 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/fool
MODULE_OBJS = \
siphash/halfsip.o \
fool.o \
+ fool_game.o \
fool_prologue.o \
toolbox.o \
toolbox_quickdraw.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 662124ae6fd..d6083ad43dd 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -75,6 +75,12 @@ struct Common::Hash<Fool::PicHandle> {
namespace Fool {
+// TYPE BOOLEAN: int16
+// TYPE INTEGER: int16
+// TYPE LONGINT: int32
+// TYPE CHAR: int16
+// TYPE Rect: top: INTEGER; left: INTEGER; bottom: INTEGER; right: INTEGER;
+// TYPE Point: v: INTEGER; h: INTEGER;
// In QuickDraw 0 means white and 1 means black
struct Pattern {
@@ -180,7 +186,6 @@ struct WindowRecord {
uint16 windowKind;
};
-// TYPE Rect: top: INTEGER; left: INTEGER; bottom: INTEGER; right: INTEGER;
struct ToolboxResInfo {
int16 fileID;
@@ -198,7 +203,9 @@ struct FontInfo {
};
+typedef uint32 OSType;
typedef uint16 OSErr;
+typedef uint32 ProcPtr;
struct ParamBlockRec {
uint32 qLink = 0;
@@ -211,6 +218,19 @@ struct ParamBlockRec {
uint16 ioVRefNum = 0;
};
+struct SFTypeList {
+ OSType types[4];
+};
+
+struct SFReply {
+ bool good; // 0
+ bool copy; // 1
+ OSType fType; // 2
+ int16 vRefNum; // 6
+ int16 version; // 8
+ Common::String fName; // 10
+}; // total: 76
+
class Toolbox {
public:
@@ -243,10 +263,18 @@ public:
uint32 TickCount();
// toolbox_fileman.cpp
+ void Pack3();
+
void PBGetVol(ParamBlockRec ¶mBlock);
void PBSetVol(ParamBlockRec ¶mBlock);
+ void SFGetFile(const Common::Point &where, const Common::U32String &prompt, ProcPtr fileFilter, int16 numTypes, const SFTypeList &typeList, const ProcPtr &dlgHook, SFReply &reply);
+
+ // PROCEDURE SFPutFile (where: Point; prompt: Str255; origName:
+ // Str255; dlgHook: ProcPtr; VAR reply: SFReply);
+ void SFPutFile(const Common::Point &where, const Common::U32String &prompt, const Common::U32String &origName, const ProcPtr &dlgHook, SFReply &reply);
+
// toolbox_resman.cpp
// FUNCTION CountResources (theType: ResType): Integer;
@@ -395,6 +423,14 @@ public:
// procedure draws the picture that you specify in the myPicture parameter.
void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
+ // PROCEDURE EraseRoundRect (r: Rect; ovalWidth,ovalHeight: Integer);
+ // Using the patCopy pattern mode, the EraseRoundRect procedure draws the interior of
+ // the rounded rectangle bounded by the rectangle that you specify in the r parameter with
+ // the background pattern of the current graphics port. This effectively erases the rounded
+ // rectangle. Use the ovalWidth and ovalHeight parameters to specify the diameters of
+ // curvature for the corners of the rounded rectangle.
+ void EraseRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+
// PROCEDURE EndUpdate (theWindow: WindowPtr);
// Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
// BeginUpdate as described above.
@@ -431,6 +467,13 @@ public:
// location is not changed by this procedure.
void FrameRect(const Common::Rect &r);
+ // PROCEDURE FrameRoundRect (r: Rect; ovalWidth,ovalHeight: Integer);
+ // Using the pattern, pattern mode, and size of the graphics pen for the current graphics
+ // port, the FrameRoundRect procedure draws an outline just inside the rounded
+ // rectangle bounded by the rectangle that you specify in the r parameter. The outline is as
+ // wide as the pen width and as tall as the pen height. The pen location does not change.
+ void FrameRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+
// PROCEDURE GetCPixel (h,v: INTEGER; VAR cPix: RGBColor);
// The GetCPixel function returns the RGB of the pixel at the specified position in the current
// port.
@@ -451,6 +494,12 @@ public:
// QuickDraw.
PicHandle GetPicture(uint16 picID);
+ // PROCEDURE GlobalToLocal (VAR pt: Point);
+ // GlobalToLocal takes a point expressed in global coordinates (with the top left corner of the bit
+ // image as coordinate (0,0)) and converts it into the local coordinates of the current grafPort. The
+ // global point can be obtained with the LocalToGlobal call (see above).
+ void GlobalToLocal(Common::Point &pt);
+
// PROCEDURE HideCursor;
// HideCursor removes the cursor from the screen, restoring the bits under it, and decrements the
// cursor level (which InitCursor initialized to 0). Every call to HideCursor should be balanced by a
@@ -483,6 +532,14 @@ public:
// ignored; the pen location is not changed.
void InvertRect(const Common::Rect &r);
+ // PROCEDURE InvertRoundRect (r: Rect; ovalWidth, ovalHeight: Integer);
+ // The InvertRoundRect procedure inverts the pixels enclosed by the rounded rectangle
+ // bounded by the rectangle that you specify in the r parameter. Every white pixel becomes
+ // black and every black pixel becomes white. The ovalWidth and ovalHeight
+ // parameters specify the diameters of curvature for the corners. The pen location does not
+ // change.
+ void InvertRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+
// PROCEDURE KillPoly (poly: PolyHandle);
// KillPoly releases the memory occupied by the given polygon. Use this only when you're completely
// through with a polygon.
@@ -493,6 +550,13 @@ public:
// by h and v. The new pen location is (h,v) after the line is drawn.
void LineTo(int16 h, int16 v);
+ // PROCEDURE LocalToGlobal (VAR pt: Point);
+ // LocalToGlobal converts the given point from the current grafPort's local coordinate system into a
+ // global coordinate system with the origin (0,0) at the top left corner of the port's bit image (such
+ // as the screen). This global point can then be compared to other global points, or be changed into
+ // the local coordinates of another grafPort.
+ void LocalToGlobal(Common::Point &pt);
+
// PROCEDURE Move (dh,dv: INTEGER);
// The Move procedure moves the graphics pen from its current location in the current
// graphics port a horizontal distance that you specify in the dh parameter and a vertical
@@ -544,6 +608,13 @@ public:
// The pen location is not changed by this procedure.
void PaintRect(const Common::Rect &r);
+ // PROCEDURE PaintRoundRect (r: Rect; ovalWidth,ovalHeight: Integer);
+ // Using the pattern and pattern mode of the graphics pen for the current graphics port, the
+ // PaintRoundRect procedure draws the interior of the rounded rectangle bounded by
+ // the rectangle that you specify in the r parameter. Use the ovalWidth and ovalHeight
+ // parameters to specify the diameters of curvature for the corners of the rounded rectangle.
+ void PaintRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+
// PROCEDURE PenMode (mode: INTEGER);
// PenMode sets the transfer mode through which the pen pattern is transferred onto the bit map
// when lines or shapes are drawn in the current grafPort.
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 2268a464cf4..f65aacce59c 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -255,9 +255,14 @@ public:
const Common::U32String &str(size_t index);
+ int16 unk_5();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
void unk_20();
+ void unk_44(int16 unk1);
+ // string copy? dest, src
+ void unk_110(Common::U32String &unk1, Common::U32String &unk2);
void unk_130(int16 unk1);
+ void unk_331(uint16 unk1, int16 unk2);
};
Commit: 6cbe311de70dbc073b97d60a17c4960a1edb4541
https://github.com/scummvm/scummvm/commit/6cbe311de70dbc073b97d60a17c4960a1edb4541
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:55+02:00
Commit Message:
FOOL: More porting, add missing stubs
Changed paths:
A engines/fool/toolbox_fileman.cpp
engines/fool/fool.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index d891545e70e..fda0cb212a3 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -28,6 +28,7 @@
#include "graphics/palette.h"
#include "fool/fool.h"
+#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
#include "fool/detection.h"
#include "fool/console.h"
@@ -65,9 +66,10 @@ Common::Error FoolEngine::run() {
// Menu
_menu = _wm.addMenu();
- FoolPrologue fp;
- fp.run();
-
+ //FoolPrologue fp;
+ //fp.run();
+ FoolGame fg;
+ fg.run();
return Common::kNoError;
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index fe707ce8cda..5e2b24b2de1 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -29,6 +29,16 @@ namespace Fool {
ZBasic *g_zbasic;
Toolbox *g_toolbox;
+void FoolGame::run() {
+ g_toolbox = new Toolbox();
+ g_zbasic = new ZBasic(g_toolbox);
+ g_zbasic->loadProgram(Common::Path("The Fool's Errand"));
+ g_engine->_menu->setVisible(false);
+ this->sub_128_004();
+ delete g_zbasic;
+ delete g_toolbox;
+}
+
void FoolGame::sub_128_004() {
// 128:0004
g_zbasic->unk_331(0xdac0, 0);
@@ -110,13 +120,13 @@ void FoolGame::sub_128_11c(Common::U32String &unk2, Common::U32String &unk1) {
this->sub_128_0a2(0, 0x6260);
// 128:015a
- this->var_pt_50.y = this->var_i16_58 + 0x3d;
- this->var_pt_50.x = this->var_i16_56 + 0x68;
+ this->var_ev_46.where.y = this->var_i16_58 + 0x3d;
+ this->var_ev_46.where.x = this->var_i16_56 + 0x68;
this->var_i16_16c = 1;
this->var_i32_16e = 0;
// 128:017e
- g_toolbox->SFPutFile(this->var_pt_50, this->var_str_172, this->var_str_272, this->var_i32_16e, this->var_sfr_5e);
+ g_toolbox->SFPutFile(this->var_ev_46.where, this->var_str_172, this->var_str_272, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->sub_128_0a2(1, 0x6d60);
@@ -137,8 +147,8 @@ void FoolGame::sub_128_1e4(Common::U32String &unk1) {
this->sub_128_0a2(0, 0x6260);
// 128:0218
- this->var_pt_50.y = this->var_i16_58 + 0x3d;
- this->var_pt_50.x = this->var_i16_56 + 0x53;
+ this->var_ev_46.where.y = this->var_i16_58 + 0x3d;
+ this->var_ev_46.where.x = this->var_i16_56 + 0x53;
this->var_i16_16c = 1;
this->var_i32_16e = 0;
// 128:023c
@@ -150,7 +160,7 @@ void FoolGame::sub_128_1e4(Common::U32String &unk1) {
typeList.types[0] += this->var_str_172.at(2) << 8;
typeList.types[0] += this->var_str_172.at(3) << 0;
- g_toolbox->SFGetFile(this->var_pt_50, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
+ g_toolbox->SFGetFile(this->var_ev_46.where, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->sub_128_0a2(1, 0x6d60);
@@ -165,9 +175,9 @@ void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
// FIXME: why is the point inverted in the code??
this->var_i16_68c = unk1;
this->var_i16_68a = unk2;
- this->var_i16_68a = (this->var_pt_50.x - this->arr_rect_1ec0.top) / (this->arr_rect_1ec0.bottom);
+ this->var_i16_68a = (this->var_ev_46.where.x - this->arr_rect_1ec0.top) / (this->arr_rect_1ec0.bottom);
- this->var_i16_68c = (this->var_pt_50.y - this->arr_rect_1ec0.left) / (this->arr_rect_1ec0.right);
+ this->var_i16_68c = (this->var_ev_46.where.y - this->arr_rect_1ec0.left) / (this->arr_rect_1ec0.right);
}
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
@@ -408,28 +418,27 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, PatternMode unk4, int16 unk3,
void FoolGame::sub_128_c6a(int16 unk1) {
// 128:0c6a
- EventRecord event;
- this->var_i16_78a = g_toolbox->GetNextEvent(unk1, event);
- if ((this->var_i16_46 == 1) && (this->var_pt_50.y < 0x14)) {
+ this->var_i16_78a = g_toolbox->GetNextEvent(unk1, this->var_ev_46);
+ if ((this->var_ev_46.what == 1) && (this->var_ev_46.where.y < 0x14)) {
this->sub_128_5b30();
}
// 128:0caa
- g_toolbox->GlobalToLocal(this->var_pt_50);
- if (this->var_i16_46 == 3) {
- if ((this->var_i16_54 & 0x100) == 0) {
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ if (this->var_ev_46.what == 3) {
+ if ((this->var_ev_46.modifiers & 0x100) == 0) {
this->sub_128_5f9e();
} else {
this->sub_128_5baa();
}
}
// 128:0ce0
- if ((this->var_i16_46 == 5) && ((this->var_i16_54 & 0x100) == 0)) {
+ if ((this->var_ev_46.what == 5) && ((this->var_ev_46.modifiers & 0x100) == 0)) {
this->sub_128_5f9e();
}
- if (this->var_i16_46 == 6) {
+ if (this->var_ev_46.what == 6) {
this->sub_128_5fb4();
}
- if (this->var_i16_46 == 7) {
+ if (this->var_ev_46.what == 7) {
this->sub_128_6154();
}
}
@@ -440,7 +449,7 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
this->arr_rect_5b7c.left = unk4;
this->arr_rect_5b7c.bottom = unk3;
this->arr_rect_5b7c.right = unk2;
- while (this->var_i16_54 & 0x80) {
+ while (this->var_ev_46.modifiers & 0x80) {
// 128:0d94
do {
g_toolbox->InvertRect(this->arr_rect_5b7c);
@@ -448,8 +457,8 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
do {
this->sub_128_c6a(0);
this->var_i16_3a += 1;
- } while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_i16_54 & 0x80) == 0));
- } while ((this->var_i16_54 & 0x80) != 0);
+ } while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_ev_46.modifiers & 0x80) == 0));
+ } while ((this->var_ev_46.modifiers & 0x80) != 0);
}
}
@@ -570,16 +579,176 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->DrawString(this->var_str_172);
}
// 128:1432
- if (this->var_i16_7ae >= 3) {
- // FIXME
+ if (this->var_i16_7ae == 3) {
+ g_toolbox->EraseRoundRect(this->arr_rect_5b8c, 0xa, 0xa);
+ g_toolbox->FrameRoundRect(this->arr_rect_5b8c, 0xa, 0xa);
+ this->var_str_172 = this->arr_str_1a8d8[this->var_i16_7ac+3];
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ this->var_i16_30 = (this->arr_rect_5b8c.left + ((this->arr_rect_5b8c.right - this->arr_rect_5b8c.left)/2)) - (this->var_i16_30/2);
+
+ g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
+ g_toolbox->DrawString(this->var_str_172);
}
// 128:1518
+ this->sub_128_61ec();
+ this->var_i16_7be = 0;
+ // 128:1522
+ do {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, this->var_ev_46);
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ if (this->var_ev_46.what == 1) {
+ // 128:154a
+ this->var_i16_7be = 0;
+ Common::Rect target;
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b7c) != 0) {
+ this->var_i16_7be = 1;
+ target = this->arr_rect_5b7c;
+ }
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b84) != 0) {
+ this->var_i16_7be = 2;
+ target = this->arr_rect_5b84;
+ }
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b8c) != 0) {
+ this->var_i16_7be = 3;
+ target = this->arr_rect_5b8c;
+ }
+
+ if (this->var_i16_7be > 0) {
+ // 128:15d2
+ this->var_i16_30 = (this->var_i16_7be - 1)*4;
+ do {
+ g_toolbox->InvertRoundRect(target, 0xa, 0xa);
+
+ // 128:1624
+ while ((this->var_ev_46.what != 2) && (g_toolbox->PtInRect(this->var_ev_46.where, target) != 0)) {
+
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ }
+
+ g_toolbox->InvertRoundRect(target, 0xa, 0xa);
+ // 128:1686
+ while ((this->var_ev_46.what != 2) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ }
+ // 128:16ea
+ } while (this->var_ev_46.what != 2);
+
+ if (g_toolbox->PtInRect(this->var_ev_46.where, target) == 0) {
+ this->var_i16_7be = 0;
+ }
+ this->sub_128_61ec();
+ }
+ }
+ // 128:172c
+ if (this->var_ev_46.what == 3) {
+ this->var_i16_7c0 = this->var_ev_46.message & 0xff;
+ if (this->var_i16_7c0 == 0xd) {
+ this->var_i16_7be = 1;
+ }
+ }
+ // 128:175c
+ } while (this->var_i16_7be == 0);
+ this->sub_128_61ec();
+ this->sub_128_0a2(1, 0x6d60);
+ g_toolbox->SetPort(this->var_i32_0);
}
// 128:1784
}
+void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
+ this->var_i16_32 = unk1;
+ this->var_i16_30 = unk2;
+ if (this->var_i16_30 > 0) {
+ if ((this->arr_i16_1d24[this->var_i16_30] & 2) == 0) {
+ this->arr_i16_1d24[this->var_i16_30] ^= 0x2;
+ this->arr_i16_1d24[this->var_i16_30] |= 0x1;
+ }
+ // 128:1818
+ this->var_i16_34 = 3 + (this->var_i16_30 - 1)/0x10;
+ this->var_i16_36 = 1 + (this->var_i16_30 - 1) % 10;
+ this->var_str_172 = this->arr_str_195e8[this->var_i16_30] + g_zbasic->str(9);
+ g_zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
+ }
+ // 128:188a
+ this->sub_128_4da(0);
+ g_zbasic->picture(0, 0x14, this->var_pic_7c2);
+ g_zbasic->text(0xfa, 0x18, 0x18, kSrcBic);
+ for (int j = 0; j <= 1; j++) {
+ // 128:18c4
+ for (int i = 0; i <= 0x64; i += 4) {
+ this->var_i32_692 = g_toolbox->TickCount();
+ g_toolbox->SetRect(
+ this->arr_rect_4338,
+ ((int)(i*2.2f) - 0x105),
+ i + 0xa5,
+ ((int)(i*2.2f) + 0x105),
+ ((int)(i*1.6f) + 0xa6)
+ );
+ // 128:1982
+ g_toolbox->InvertRect(this->arr_rect_4338);
+ this->sub_128_406(0);
+ }
+ // 128:19a4
+ }
+ // 128:19b2
+ g_toolbox->PenNormal();
+ g_toolbox->PaintRect(this->arr_rect_4338);
+ g_toolbox->PenMode(kPatXor);
+ g_toolbox->FrameRect(this->arr_rect_4338);
+ g_toolbox->PenMode(kPatCopy);
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ // 128:19ec
+ g_toolbox->MoveTo(0x105 - (this->var_i16_484/2), 0x12e);
+ g_toolbox->DrawString(this->var_str_384);
+ for (int i = 0; i <= 0x4d; i++) {
+ this->var_i32_692 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(this->arr_rect_4338);
+ this->sub_128_406(0x1);
+ }
+ for (int i = 1; i <= 0x24; i++) {
+ // 128:1a4c
+ this->var_i32_692 = g_toolbox->TickCount();
+ this->arr_rect_4338.top -= (int)(this->var_i16_68a*0.4f);
+ this->arr_rect_4338.left -= (int)(this->var_i16_68a*0.1f);
+ this->arr_rect_4338.bottom += (int)(this->var_i16_68a*0.05f);
+ this->arr_rect_4338.right += (int)(this->var_i16_68a*0.1f);
+ // 128:1b82
+ if (this->arr_rect_4338.top < 0x14) {
+ this->arr_rect_4338.top = 0x14;
+ }
+ // 128:1bac
+ if (this->var_i16_32 == 0) {
+ g_toolbox->InvertRect(this->arr_rect_4338);
+ }
+ // 128:1bc2
+ if (this->var_i16_32 == 1) {
+ g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_58f4[3]);
+ }
+ // 128:1be6
+ if (this->var_i16_32 == 2) {
+ g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_5b2c);
+ }
+ // 128:1c0a
+ this->sub_128_406(1);
+ }
+ this->sub_128_4da(1);
+ g_toolbox->PenNormal();
+}
+
+void FoolGame::sub_128_1c30() {
+ // 128:1c30
+ this->var_i16_7c6 |= this->var_i16_30;
+}
+
+void FoolGame::sub_128_1c4a(int16 unk1) {
+ // 128:1c4a
+ //
+}
+
void FoolGame::sub_128_4472() {
// 128:4472
@@ -625,6 +794,10 @@ void FoolGame::sub_128_6154() {
// FIXME
}
+void FoolGame::sub_128_61ec() {
+ // FIXME
+}
+
void FoolGame::sub_128_6244() {
// FIXME
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 33f247eaff0..e190f7b8e5c 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -63,25 +63,30 @@ public:
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_178a(int16 unk2, int16 unk1);
+ void sub_128_1c30();
+ void sub_128_1c4a(int16 unk1);
+
void sub_128_4472();
void sub_128_5b30();
void sub_128_5baa();
void sub_128_5f9e();
void sub_128_5fb4();
void sub_128_6154();
+ void sub_128_61ec();
void sub_128_6244();
private:
+ GrafPtr var_i32_0;
GrafPtr var_i32_4;
int16 var_i16_30;
int16 var_i16_32;
int16 var_i16_34;
+ int16 var_i16_36;
int16 var_i16_38;
int16 var_i16_3a;
int16 var_i16_44;
- int16 var_i16_46;
- Common::Point var_pt_50;
- int16 var_i16_54;
+ EventRecord var_ev_46;
int16 var_i16_56;
int16 var_i16_58;
SFReply var_sfr_5e; // -> aa
@@ -106,6 +111,7 @@ private:
int16 var_i16_79e;
int16 var_i16_7a0;
int16 var_i16_7a2;
+ int16 var_i16_7a8;
int16 var_i16_7aa;
int16 var_i16_7ac;
int16 var_i16_7ae;
@@ -116,14 +122,20 @@ private:
int16 var_i16_7b8;
int16 var_i16_7ba;
int16 var_i16_7bc;
-
+ int16 var_i16_7be;
+ int16 var_i16_7c0;
+ PicHandle var_pic_7c2;
+ int16 var_i16_7c6;
int16 var_i16_7e2;
+ int16 arr_i16_1d24[202];
int16 arr_i16_1eb8[4];
Common::Rect arr_rect_1ec0;
Common::Rect arr_rect_1f38[3];
+ Common::Rect arr_rect_4338;
int16 arr_i16_4758[6];
Pattern arr_pat_58f4[4];
+ Pattern arr_pat_5b2c;
Common::Rect arr_rect_5b7c;
Common::Rect arr_rect_5b84;
Common::Rect arr_rect_5b8c;
@@ -136,6 +148,8 @@ private:
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
PicHandle arr_i32_192c0[0x18];
+ Common::U32String arr_str_195e8[101]; // 0x20 each
+
Common::U32String arr_str_1a8d8[7]; // 0x66 each
Common::Rect arr_rect_1ae06;
};
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index c12685a0172..421e065a38e 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
fool_game.o \
fool_prologue.o \
toolbox.o \
+ toolbox_fileman.o \
toolbox_quickdraw.o \
toolbox_resman.o \
toolbox_text.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index d6083ad43dd..9d3a068a61b 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -263,8 +263,6 @@ public:
uint32 TickCount();
// toolbox_fileman.cpp
- void Pack3();
-
void PBGetVol(ParamBlockRec ¶mBlock);
void PBSetVol(ParamBlockRec ¶mBlock);
@@ -642,6 +640,12 @@ public:
// merely changes the size of the "active area" of the grafPort.
void PortSize(uint16 width, uint16 height);
+ // FUNCTION PtInRect (pt: Point; r: Rect): Boolean;
+ // The PtInRect function determines whether the pixel below and to the right of the point
+ // you specify in the pt parameter is enclosed in the rectangle that you specify in the Rect
+ // parameter. The PtInRect function returns TRUE if it is, FALSE if it is not.
+ bool PtInRect(const Common::Point &pt, const Common::Rect &r);
+
// PROCEDURE SetCPixel (h,v: INTEGER; cPix: RGBColor);
// The SetCPixel function sets the pixel at the specified position to the pixel value that most
// closely matches the specified RGB.
diff --git a/engines/fool/toolbox_fileman.cpp b/engines/fool/toolbox_fileman.cpp
new file mode 100644
index 00000000000..90834db4bb9
--- /dev/null
+++ b/engines/fool/toolbox_fileman.cpp
@@ -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/>.
+ *
+ */
+
+#include "common/system.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+
+namespace Fool {
+
+void Toolbox::PBGetVol(ParamBlockRec ¶mBlock) {
+ warning("STUB: Toolbox::PBGetVol");
+}
+
+void Toolbox::PBSetVol(ParamBlockRec ¶mBlock) {
+ warning("STUB: Toolbox::PBSetVol");
+}
+
+void Toolbox::SFGetFile(const Common::Point &where, const Common::U32String &prompt, ProcPtr fileFilter, int16 numTypes, const SFTypeList &typeList, const ProcPtr &dlgHook, SFReply &reply) {
+ warning("STUB: Toolbox::SFGetFile");
+}
+
+void Toolbox::SFPutFile(const Common::Point &where, const Common::U32String &prompt, const Common::U32String &origName, const ProcPtr &dlgHook, SFReply &reply) {
+ warning("STUB: Toolbox::SFPutFile");
+}
+
+} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 547b2fb4d2a..d4965b7de01 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -115,6 +115,10 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
_copyBits(intermediate, mask, _port->portBits, intermediate->getBounds(), dstRect, kSrcCopy, nullptr);
}
+void Toolbox::EraseRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
+ warning("STUB: Toolbox::EraseRoundRect");
+}
+
void Toolbox::EndUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::EndUpdate");
}
@@ -204,6 +208,10 @@ void Toolbox::FrameRect(const Common::Rect &r) {
}
}
+void Toolbox::FrameRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
+ warning("STUB: Toolbox::InvertRoundRect");
+}
+
void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
warning("STUB: Toolbox::GetCPixel");
}
@@ -228,6 +236,10 @@ void Toolbox::GetPort(GrafPtr &port) {
port = _port;
}
+void Toolbox::GlobalToLocal(Common::Point &pt) {
+ warning("STUB: Toolbox::GlobalToLocal");
+}
+
void Toolbox::HideCursor() {
_cursorLevel--;
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
@@ -271,6 +283,11 @@ void Toolbox::InvertRect(const Common::Rect &r) {
}
}
+void Toolbox::InvertRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
+ warning("STUB: Toolbox::InvertRoundRect");
+}
+
+
void Toolbox::KillPoly(PolyHandle poly) {
warning("STUB: Toolbox::KillPoly");
}
@@ -303,6 +320,10 @@ void Toolbox::LineTo(int16 h, int16 v) {
}
}
+void Toolbox::LocalToGlobal(Common::Point &pt) {
+ warning("STUB: Toolbox::LocalToGlobal");
+}
+
void Toolbox::Move(int16 dh, int16 dv) {
if (_port) {
MoveTo(_port->portRect.width() + dh, _port->portRect.height() + dv);
@@ -350,6 +371,10 @@ void Toolbox::PaintRect(const Common::Rect &r) {
warning("STUB: Toolbox::PaintRect");
}
+void Toolbox::PaintRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
+ warning("STUB: Toolbox::PaintRoundRect");
+}
+
void Toolbox::PenMode(PatternMode mode) {
if (_port) {
_port->pnMode = mode;
@@ -384,6 +409,10 @@ void Toolbox::PortSize(uint16 width, uint16 height) {
}
}
+bool Toolbox::PtInRect(const Common::Point &pt, const Common::Rect &r) {
+ return r.contains(pt);
+}
+
void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
warning("STUB: Toolbox::SetCPixel");
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 21ea735a9e3..3d8f90cd277 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -204,6 +204,11 @@ uint32 ZBasic::mem(int16 index) {
return 0;
}
+void ZBasic::menu(int16 menuNo, int16 itemNo, int16 state, const Common::U32String &title) {
+ warning("STUB: ZBasic::menu");
+}
+
+
void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
warning("STUB: ZBasic::openR");
}
@@ -297,6 +302,11 @@ void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, i
warning("STUB: ZBasic::window");
}
+int16 ZBasic::unk_5() {
+ warning("STUB: ZBasic::unk_5");
+ return 0;
+}
+
void ZBasic::unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4) {
warning("STUB: ZBasic::unk_6");
}
@@ -305,9 +315,21 @@ void ZBasic::unk_20() {
warning("STUB: ZBasic::unk_20");
}
+void ZBasic::unk_44(int16 unk1) {
+ warning("STUB: ZBasic::unk_44");
+}
+
+void ZBasic::unk_110(Common::U32String &unk1, Common::U32String &unk2) {
+ warning("STUB: ZBasic::unk_110");
+}
+
void ZBasic::unk_130(int16 unk1) {
warning("STUB: ZBasic::unk_130");
}
+void ZBasic::unk_331(uint16 unk1, int16 unk2) {
+ warning("STUB: ZBasic::unk_331");
+}
+
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index f65aacce59c..4b637e34cf2 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -240,6 +240,7 @@ public:
int finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume);
bool maybe();
uint32 mem(int16 index);
+ void menu(int16 menuNo, int16 itemNo, int16 state, const Common::U32String &title);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
Commit: 50666287fcc69020d7f4306660ce123a5fe0c603
https://github.com/scummvm/scummvm/commit/50666287fcc69020d7f4306660ce123a5fe0c603
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:56+02:00
Commit Message:
FOOL: More grist for the porting mill
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox.h
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5e2b24b2de1..e89c9714138 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -89,7 +89,105 @@ void FoolGame::sub_128_004() {
// 128:0c66: JMP - [0xd30]
// 128:0d30: JMP - [0xdfa]
// 128:0dfa: JMP - [0x1786]
- //
+ // 128:1786: JMP - [0x1c28]
+ // 128:1c28: JMP - [0x1c46]
+ // 128:1c46: JMP - [0x1c7a]
+
+ // 128:1c7a
+ this->sub_129_068();
+ this->var_i32_7c8 = g_zbasic->mem(-1);
+ // 128:1c88: JMP - [0x1ee2]
+ while (this->var_i16_7c6 != 0x20) {
+ do {
+ this->sub_128_c6a(-1);
+ if ((this->var_ev_46.where.y >= 0x8c) && (this->var_ev_46.where.y <= 0x11d)) {
+ this->var_i16_7cc = -1;
+ }
+ // 128:1cbe
+ if (this->var_ev_46.where.y <= 0x11d) {
+ this->var_i16_7cc = 1;
+ }
+ // 128:1cce
+ if ((this->var_ev_46.where.x <= 0x8c) || (this->var_ev_46.where.y < 0xdc)) {
+ this->var_i16_7cc = 0;
+ }
+ // 128:1cf6
+ if (this->var_i16_7cc != this->var_i16_7b2) {
+ this->var_i16_7b2 = this->var_i16_7cc;
+ if (this->var_i16_7b2 == 0) {
+ if ((this->var_i16_7ce & 2) == 0) {
+ g_toolbox->InitCursor();
+ } else {
+ g_toolbox->SetCursor(this->arr_curs_51c8);
+ }
+ // 128:1d42
+ } else {
+ // 128:1d46
+ if (this->var_i16_7b2 == -1) {
+ g_toolbox->SetCursor(this->arr_curs_4e10);
+ }
+ // 128:1d5e
+ if (this->var_i16_7b2 == 1) {
+ g_toolbox->SetCursor(this->arr_curs_4dcc);
+ }
+ }
+ }
+ // 128:1d76
+ if (this->var_ev_46.what == 1) {
+ this->sub_128_1f76();
+ }
+ if ((this->var_i16_7d0 == 0x10) &&
+ (this->arr_i16_1c7a[0] < 0x64) &&
+ (this->var_ev_46.where.y > 0x113) &&
+ (this->var_ev_46.where.x < 0x8c)) {
+ this->sub_128_1c2c(0x80);
+ }
+ // 128:1de0
+ if (this->var_i16_7d2 && (this->var_i16_7c0 == 0x20)) {
+ this->sub_128_1c2c(0x100);
+ }
+ // 128:1e06
+ } while (this->var_i16_7c6 == 0);
+
+ if (this->var_i16_7c6 & 0x1) {
+ this->sub_128_1c4a(1);
+ }
+ if (this->var_i16_7c6 & 0x4) {
+ this->sub_128_3536();
+ }
+ if (this->var_i16_7c6 & 0x8) {
+ this->sub_128_2bc6();
+ }
+ if (this->var_i16_7c6 & 0x10) {
+ this->sub_128_2e3e();
+ }
+ if (this->var_i16_7c6 & 0x40) {
+ this->sub_128_2126();
+ }
+ if (this->var_i16_7c6 & 0x200) {
+ this->sub_128_1f44();
+ }
+ if (this->var_i16_7c6 & 0x80) {
+ this->sub_128_39a0();
+ }
+ if (this->var_i16_7c6 & 0x100) {
+ this->sub_138_004();
+ }
+ if (this->var_i16_7c6 & 0x400) {
+ this->sub_128_2b0a();
+ }
+ if (this->var_i16_7c6 & 0x800) {
+ this->sub_144_004();
+ }
+ // 128:1ee2
+ }
+ // 128:1eec
+ this->sub_128_1f1e();
+ g_zbasic->unk_158();
+ g_zbasic->unk_4();
+ g_toolbox->SetPort(this->var_i32_8);
+ this->sub_128_8b4(0, 0, 0x14, this->var_i16_5a, 2);
+ g_toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
@@ -405,7 +503,7 @@ void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int
g_toolbox->PenNormal();
}
-void FoolGame::sub_128_bde(int16 unk6, int16 unk5, PatternMode unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:0bde
this->arr_i16_4758[0] = unk6;
this->arr_i16_4758[1] = unk5;
@@ -746,9 +844,120 @@ void FoolGame::sub_128_1c30() {
void FoolGame::sub_128_1c4a(int16 unk1) {
// 128:1c4a
- //
+ this->var_i16_30 = unk1;
+ if (this->var_i16_7c6 & this->var_i16_30) {
+ this->var_i16_7c6 ^= this->var_i16_30;
+ }
+ // 128:1c78
+}
+
+void FoolGame::sub_128_1f1e() {
+ // 128:1f1e
+ g_toolbox->InitCursor();
+ this->sub_128_4da(0);
+ this->sub_128_bde(1, 1, kSrcCopy, 1, 1, 1);
}
+void FoolGame::sub_128_1f44() {
+ // 128:1f44
+ this->sub_128_61ec();
+ this->var_i16_7d4 = 0;
+ this->sub_128_1c4a(0x200);
+ this->sub_128_5fea();
+ this->sub_128_0a2(1, 0);
+ this->sub_128_2202();
+ g_toolbox->SetPort(this->var_i32_0);
+}
+
+void FoolGame::sub_128_1f76() {
+ // 128:1f76
+ if (this->var_i16_7cc != 0) {
+ do {
+ this->var_i32_692 = g_toolbox->TickCount();
+ this->sub_128_20d0();
+ this->sub_128_406(5);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ } while ((this->var_ev_46.modifiers & 0x80) == 0);
+ }
+ // 128:1fec
+}
+
+void FoolGame::sub_128_1fee() {
+ // 128:1fee
+ if ((this->var_i16_7d0 == 0x10) && (this->arr_i16_1c7a[0] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
+ return;
+ }
+ // 128:2042
+ if (!this->var_i16_7d6) {
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ this->sub_128_2078();
+ }
+ }
+ // 128:2076
+}
+
+void FoolGame::sub_128_2078() {
+ // 128:2078
+ g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ this->sub_128_6186();
+ g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ this->sub_128_21c8();
+ }
+}
+
+void FoolGame::sub_128_20d0() {
+ // 128:20d0
+ do {
+ this->var_i16_7d8 += this->var_i16_7cc;
+ if (this->var_i16_7d8 < 1) {
+ this->var_i16_7d8 = 1;
+ return;
+ }
+ if (this->var_i16_7d8 >= this->var_i16_7da) {
+ this->var_i16_7d8 = this->var_i16_7da;
+ return;
+ }
+ } while (this->arr_i16_1b90[this->var_i16_7d8]);
+ this->sub_128_2202();
+}
+
+void FoolGame::sub_128_2126() {
+ this->sub_128_1c4a(0x40);
+ // 128:2132
+ do {
+ this->var_i16_68a = this->var_i16_7dc;
+ if (this->var_i16_7dc == this->arr_i16_1a46[this->var_i16_68a]) {
+ this->var_i16_7d8 = this->var_i16_68a;
+ this->var_i16_68a = this->var_i16_7da;
+ }
+ // 128:2160
+ this->var_i16_68a += 1;
+ } while (this->var_i16_7da >= this->var_i16_68a);
+ // 128:2170
+ this->var_i16_7d0 = this->arr_i16_1a46[this->var_i16_7d8];
+ if (this->var_i16_7ce & 4) {
+ this->var_i16_7ce ^= 4;
+ if (this->arr_i16_18b2[this->var_i16_7d0] > 0) {
+ // 128:21bc
+ this->sub_128_21c8();
+ return;
+ }
+ }
+ // 128:21c2
+ this->sub_128_2202();
+}
+
+void FoolGame::sub_128_21c8() {
+ // 128:21c8
+ if ((this->var_i16_7d0 == 1) && (this->var_i16_7d2 > 0)) {
+ this->sub_128_1c2c(0x100);
+ } else {
+ this->sub_128_1c2c(0x80);
+ }
+}
+
+
void FoolGame::sub_128_4472() {
// 128:4472
@@ -802,6 +1011,10 @@ void FoolGame::sub_128_6244() {
// FIXME
}
+void FoolGame::sub_129_068() {
+ // FIXME
+}
+
// end
// 128:62ae
};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index e190f7b8e5c..4e716fb9865 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -58,27 +58,51 @@ public:
void sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_918(Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
- void sub_128_bde(int16 unk6, int16 unk5, PatternMode unk4, int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_c6a(int16 unk1);
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_178a(int16 unk2, int16 unk1);
+ void sub_128_1c2c(int16 unk1);
void sub_128_1c30();
void sub_128_1c4a(int16 unk1);
+ void sub_128_1f1e();
+ void sub_128_1f44();
+ void sub_128_1f76();
+ void sub_128_1fee();
+ void sub_128_2078();
+ void sub_128_20d0();
+ void sub_128_2126();
+ void sub_128_21c8();
+ void sub_128_2202();
+ void sub_128_2b0a();
+ void sub_128_2bc6();
+ void sub_128_2e3e();
+
+ void sub_128_3536();
+ void sub_128_39a0();
void sub_128_4472();
void sub_128_5b30();
void sub_128_5baa();
void sub_128_5f9e();
void sub_128_5fb4();
+ void sub_128_5fea();
void sub_128_6154();
+ void sub_128_6186();
void sub_128_61ec();
void sub_128_6244();
+ void sub_129_068();
+
+ void sub_138_004();
+ void sub_144_004();
+
private:
GrafPtr var_i32_0;
GrafPtr var_i32_4;
+ GrafPtr var_i32_8;
int16 var_i16_30;
int16 var_i16_32;
int16 var_i16_34;
@@ -89,6 +113,7 @@ private:
EventRecord var_ev_46;
int16 var_i16_56;
int16 var_i16_58;
+ int16 var_i16_5a;
SFReply var_sfr_5e; // -> aa
int16 var_i16_16c;
ProcPtr var_i32_16e;
@@ -126,14 +151,34 @@ private:
int16 var_i16_7c0;
PicHandle var_pic_7c2;
int16 var_i16_7c6;
+ uint32 var_i32_7c8;
+ int16 var_i16_7cc;
+ int16 var_i16_7ce;
+ int16 var_i16_7d0;
+ int16 var_i16_7d2;
+ int16 var_i16_7d4;
+ int16 var_i16_7d6;
+ int16 var_i16_7d8;
+ int16 var_i16_7da;
+ int16 var_i16_7dc;
int16 var_i16_7e2;
+ // FIXME: bounds on the following are guessed! need to trace index range
+ int16 arr_i16_18b2[101];
+ int16 arr_i16_197c[101];
+ int16 arr_i16_1a46[101];
+ int16 arr_i16_1b90[101];
+ int16 arr_i16_1c5a[16];
+ int16 arr_i16_1c7a[16];
int16 arr_i16_1d24[202];
int16 arr_i16_1eb8[4];
Common::Rect arr_rect_1ec0;
Common::Rect arr_rect_1f38[3];
Common::Rect arr_rect_4338;
int16 arr_i16_4758[6];
+ Cursor arr_curs_4dcc; // 0x44
+ Cursor arr_curs_4e10; // 0x44
+ Cursor arr_curs_51c8; // 0x44
Pattern arr_pat_58f4[4];
Pattern arr_pat_5b2c;
Common::Rect arr_rect_5b7c;
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 9d3a068a61b..ec2475ff1f1 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -87,6 +87,12 @@ struct Pattern {
uint8 data[8];
};
+struct Cursor {
+ uint16 data[16];
+ uint16 mask[16];
+ Common::Point mouse;
+}; // 0x44
+
struct RGBColor {
uint16 red;
uint16 green;
@@ -651,6 +657,8 @@ public:
// closely matches the specified RGB.
void SetCPixel(int16 h, int16 v, const RGBColor &cPix);
+ void SetCursor(const Cursor &crsr);
+
// PROCEDURE SetPort (port: GrafPtr);
// SetPort makes the specified grafPort the current port.
void SetPort(GrafPtr port);
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 4b637e34cf2..e0ae8e28542 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -256,6 +256,7 @@ public:
const Common::U32String &str(size_t index);
+ void unk_4();
int16 unk_5();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
void unk_20();
@@ -263,6 +264,7 @@ public:
// string copy? dest, src
void unk_110(Common::U32String &unk1, Common::U32String &unk2);
void unk_130(int16 unk1);
+ void unk_158();
void unk_331(uint16 unk1, int16 unk2);
};
Commit: f286d0fea9f07fa16a7a184273bfeddbcc98278a
https://github.com/scummvm/scummvm/commit/f286d0fea9f07fa16a7a184273bfeddbcc98278a
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:56+02:00
Commit Message:
FOOL: Scroll visible
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/toolbox.h
engines/fool/toolbox_fileman.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index e89c9714138..c158b7a0c12 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -40,6 +40,12 @@ void FoolGame::run() {
}
void FoolGame::sub_128_004() {
+ // Define the bitmap surfaces (normally pointers to raw memory)
+ this->arr_bmp_5dfc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_109dc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_15fcc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+
// 128:0004
g_zbasic->unk_331(0xdac0, 0);
g_zbasic->unk_331(0x1b58, 1);
@@ -133,7 +139,7 @@ void FoolGame::sub_128_004() {
}
}
// 128:1d76
- if (this->var_ev_46.what == 1) {
+ if (this->var_ev_46.what == kMouseDown) {
this->sub_128_1f76();
}
if ((this->var_i16_7d0 == 0x10) &&
@@ -202,7 +208,7 @@ void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
// 128:00e6
if (this->var_i16_30 == 1) {
// FIXME: use var_i16_32 to choose start offset??
- g_zbasic->put(0, 0, 0, 0, this->arr_bmp_5dfc);
+ g_zbasic->put(0, 0, 0, 0, this->arr_bmp_5dfc, kPutCopy);
}
}
@@ -394,7 +400,7 @@ void FoolGame::sub_128_55c(Common::U32String &unk1) {
g_toolbox->DrawString(this->var_str_172);
}
-int32 FoolGame::sub_128_5fe() {
+int16 FoolGame::sub_128_5fe() {
// 128:05fe
ParamBlockRec pb;
g_toolbox->PBGetVol(pb);
@@ -402,11 +408,11 @@ int32 FoolGame::sub_128_5fe() {
return this->var_i16_30;
}
-void FoolGame::sub_128_64c(int16 unk1) {
+OSErr FoolGame::sub_128_64c(int16 unk1) {
// 128:064c
ParamBlockRec pb;
pb.ioVRefNum = unk1;
- g_toolbox->PBSetVol(pb);
+ return g_toolbox->PBSetVol(pb);
}
void FoolGame::sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
@@ -517,12 +523,12 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16
void FoolGame::sub_128_c6a(int16 unk1) {
// 128:0c6a
this->var_i16_78a = g_toolbox->GetNextEvent(unk1, this->var_ev_46);
- if ((this->var_ev_46.what == 1) && (this->var_ev_46.where.y < 0x14)) {
+ if ((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y < 0x14)) {
this->sub_128_5b30();
}
// 128:0caa
g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == 3) {
+ if (this->var_ev_46.what == kKeyDown) {
if ((this->var_ev_46.modifiers & 0x100) == 0) {
this->sub_128_5f9e();
} else {
@@ -530,13 +536,13 @@ void FoolGame::sub_128_c6a(int16 unk1) {
}
}
// 128:0ce0
- if ((this->var_ev_46.what == 5) && ((this->var_ev_46.modifiers & 0x100) == 0)) {
+ if ((this->var_ev_46.what == kAutoKey) && ((this->var_ev_46.modifiers & 0x100) == 0)) {
this->sub_128_5f9e();
}
- if (this->var_ev_46.what == 6) {
+ if (this->var_ev_46.what == kUpdateEvt) {
this->sub_128_5fb4();
}
- if (this->var_ev_46.what == 7) {
+ if (this->var_ev_46.what == kDiskEvt) {
this->sub_128_6154();
}
}
@@ -693,8 +699,9 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:1522
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, this->var_ev_46);
+ g_toolbox->Delay(0);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == 1) {
+ if (this->var_ev_46.what == kMouseDown) {
// 128:154a
this->var_i16_7be = 0;
Common::Rect target;
@@ -718,7 +725,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1624
- while ((this->var_ev_46.what != 2) && (g_toolbox->PtInRect(this->var_ev_46.where, target) != 0)) {
+ while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target) != 0)) {
this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
@@ -726,12 +733,12 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
- while ((this->var_ev_46.what != 2) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
+ while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
}
// 128:16ea
- } while (this->var_ev_46.what != 2);
+ } while (this->var_ev_46.what != kMouseUp);
if (g_toolbox->PtInRect(this->var_ev_46.where, target) == 0) {
this->var_i16_7be = 0;
@@ -740,7 +747,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
}
// 128:172c
- if (this->var_ev_46.what == 3) {
+ if (this->var_ev_46.what == kKeyDown) {
this->var_i16_7c0 = this->var_ev_46.message & 0xff;
if (this->var_i16_7c0 == 0xd) {
this->var_i16_7be = 1;
@@ -837,6 +844,10 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
g_toolbox->PenNormal();
}
+void FoolGame::sub_128_1c2c(int16 unk1) {
+ // FIXME
+}
+
void FoolGame::sub_128_1c30() {
// 128:1c30
this->var_i16_7c6 |= this->var_i16_30;
@@ -851,6 +862,10 @@ void FoolGame::sub_128_1c4a(int16 unk1) {
// 128:1c78
}
+// FIXME
+
+
+
void FoolGame::sub_128_1f1e() {
// 128:1f1e
g_toolbox->InitCursor();
@@ -957,7 +972,33 @@ void FoolGame::sub_128_21c8() {
}
}
+void FoolGame::sub_128_2202() {
+ // FIXME
+}
+void FoolGame::sub_128_2808() {
+ // FIXME
+}
+
+void FoolGame::sub_128_2b0a() {
+ // FIXME
+}
+
+void FoolGame::sub_128_2bc6() {
+ // FIXME
+}
+
+void FoolGame::sub_128_2e3e() {
+ // FIXME
+}
+
+void FoolGame::sub_128_3536() {
+ // FIXME
+}
+
+void FoolGame::sub_128_39a0() {
+ // FIXME
+}
void FoolGame::sub_128_4472() {
// 128:4472
@@ -999,10 +1040,18 @@ void FoolGame::sub_128_5fb4() {
// FIXME
}
+void FoolGame::sub_128_5fea() {
+ // FIXME
+}
+
void FoolGame::sub_128_6154() {
// FIXME
}
+void FoolGame::sub_128_6186() {
+ // FIXME
+}
+
void FoolGame::sub_128_61ec() {
// FIXME
}
@@ -1011,10 +1060,230 @@ void FoolGame::sub_128_6244() {
// FIXME
}
+// end
+// 128:62ae
+
+void FoolGame::sub_129_004() {
+ this->var_i16_7e6 = 0;
+ // FIXME
+ // 129:000a: LEA - 0x3ea(A5),A0
+ // 129:000e: MOVE.L - A0,-0x8ee(A5)
+ // 129:0012: SF - 0x8,D0
+ g_zbasic->openR(1, g_zbasic->str(110), 0x3e8, this->var_i16_e20);
+ if (this->var_i16_7e6 == 0) {
+ this->var_str_e22 = g_zbasic->str(111);
+ this->var_i16_f22 = this->var_i16_e20;
+ g_zbasic->close(1);
+ this->var_i16_7e6 = 0;
+ }
+
+ // 129:005e: LEA - 0x3f2(A5),A0
+ // 129:0062: MOVE.L - A0,-0x8ee(A5)
+}
+
void FoolGame::sub_129_068() {
+ this->var_i16_7ce = 0x29a;
+ this->var_i16_372 = { 0, 0, 0 };
+ this->var_i16_378 = 1;
+ this->var_i16_7a0 = 1;
+ this->sub_128_4da(0);
+ for (size_t i = 0; i <= 3; i++) {
+ this->arr_pat_58f4[1].data[2*i] = 0xaa;
+ this->arr_pat_58f4[1].data[2*i+1] = 0x55;
+ this->arr_pat_58f4[2].data[2*i] = 0xff;
+ this->arr_pat_58f4[2].data[2*i+1] = 0xff;
+ }
+ // 129:00d8
+ // get current A5 - 0x72
+ // 129:00d8: MOVE.L - 0x904,D0
+ // 129:00de: JSR - "PEEKLONG"
+ // 129:00e2: SUBI.L - 0x72,D0
+ // 129:00e8: JSR - "PEEKWORD"
+ this->var_i16_5a = g_engine->_wm._screenDims.width(); // window width?
+ // 129:00f0: MOVE.L - 0x904,D0
+ // 129:00f6: JSR - "PEEKLONG"
+ // 129:00fa: SUBI.L - 0x74,D0
+ // 129:0100: JSR - "PEEKWORD"
+ this->var_i16_5c = g_engine->_wm._screenDims.height(); // window height?
+ this->var_i16_56 = (this->var_i16_5a - SCREEN_WIDTH)/2;
+ this->var_i16_58 = (this->var_i16_5c - SCREEN_HEIGHT)/2;
+ // 129:0138
+ if ((this->var_i16_56 == 0) && (this->var_i16_58 == 0)) {
+ this->var_i16_37a = 0;
+ } else {
+ this->var_i16_37a = 1;
+ }
+ // 129:0166
+ g_zbasic->window(1, g_zbasic->str(112), 0, 0, this->var_i16_5a, this->var_i16_5c, kWindowDialogOneLine);
+ g_zbasic->coordinateWindow();
+ g_toolbox->ClearMenuBar();
+ g_toolbox->DrawMenuBar();
+
+ // very cursed check for the ROM85 flag
+ // 129:0196: MOVE.L - 0x28e,D0
+ // 129:019c: JSR - "BCD_FROM_INT"
+ // 129:01a0: JSR - "CAST_INT"
+ // 129:01a4: JSR - "PEEKWORD"
+ // 129:01a8: CMPI.L - 0x3fff,D0
+ if (true) {
+ this->var_i16_372 = { 0x4e20, 0x4e20, 0x4e20 };
+ g_toolbox->SetCPixel(0x64, 0x64, this->var_i16_372);
+ g_toolbox->GetCPixel(0x64, 0x64, this->var_i16_372);
+
+ }
+
+ if ((this->var_i16_5a != SCREEN_WIDTH) || (this->var_i16_5c != SCREEN_HEIGHT)) {
+ this->sub_128_8b4(0, 0, this->var_i16_5c, this->var_i16_5a, 2);
+ } else {
+ // 129:0224
+ this->sub_128_8b4(0, 0, this->var_i16_5c, this->var_i16_5a, 1);
+ }
+ // 129:023e
+ g_toolbox->GetPort(this->var_i32_f24);
+
+ this->var_i32_8 = &this->arr_grafport_19042;
+ g_toolbox->OpenPort(this->var_i32_8);
+
+ this->var_i32_4 = &this->arr_grafport_18f78;
+ g_toolbox->OpenPort(this->var_i32_4);
+ g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ g_toolbox->ClipRect(this->arr_rect_1ae06);
+
+ this->var_i32_0 = &this->arr_grafport_18eae;
+ g_toolbox->OpenPort(this->var_i32_0);
+ g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ g_toolbox->ClipRect(this->arr_rect_1ae06);
+
+ this->sub_128_5fea();
+ // 129:02c8
+ this->sub_128_8b4(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
+
+ if (false) {
+ //if (this->var_i16_372.red + this->var_i16_372.blue + this->var_i16_372.green != 0) {
+ // we're in colour mode, chide the user
+ this->arr_str_1a8d8[0] = g_zbasic->str(113);
+ this->arr_str_1a8d8[1] = g_zbasic->str(114);
+ this->arr_str_1a8d8[2] = g_zbasic->str(115);
+ this->arr_str_1a8d8[3] = g_zbasic->str(116);
+ this->sub_128_dfe(0, 2, 1, 0);
+ g_zbasic->unk_4();
+ }
+ // 129:0390
+ this->sub_128_61ec();
+ this->var_i32_37c = g_zbasic->mem(-1);
+ if (this->var_i32_37c < 0x1d4c0) {
+ // not enough memory, chide the user
+ this->arr_str_1a8d8[0] = g_zbasic->str(117);
+ this->arr_str_1a8d8[1] = g_zbasic->str(118);
+ this->arr_str_1a8d8[2] = g_zbasic->str(119);
+ this->arr_str_1a8d8[3] = g_zbasic->str(120);
+ this->arr_str_1a8d8[4] = g_zbasic->str(121);
+ this->arr_str_1a8d8[5] = g_zbasic->str(122);
+ this->arr_str_1a8d8[6] = g_zbasic->str(123);
+ this->sub_128_dfe(0, 5, 1, 1);
+ g_zbasic->unk_4();
+ }
+ // 129:0496
+ this->var_i16_7e4 = 1;
+ this->var_str_e22 = g_zbasic->str(124);
+ this->var_str_8ec = g_zbasic->str(125);
+
+ this->var_i16_484 = g_zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
+
+ if (this->var_str_588 != g_zbasic->str(126)) {
+ if (this->var_str_588 == g_zbasic->str(127)) { // Fool's Puzzles
+ this->var_str_e22 = g_zbasic->str(128);
+ this->var_i16_f22 = this->var_i16_688;
+ } else {
+ // 129:052e
+ this->sub_128_2808();
+ if (this->var_str_588 != g_zbasic->str(129)) {
+ // 129:054c
+ this->var_str_8ec = this->var_str_588;
+ this->var_i16_9ec = this->var_i16_688;
+ }
+ }
+ }
+ // 129:0562
+ this->var_i16_f2c = this->sub_128_5fe(); // volume ref num
+ this->var_i16_e20 = this->var_i16_f2c;
+ if (this->var_str_e22 == g_zbasic->str(130)) {
+ this->sub_129_004();
+ }
+ // 129:058c
+ if (this->var_str_e22 == g_zbasic->str(131)) {
+ for (this->var_i16_f2e = 1; this->var_i16_f2e < 0x3e8; this->var_i16_f2e++) {
+ this->var_str_f30 = g_zbasic->files(-this->var_i16_f2e, g_zbasic->str(132), Common::U32String(), this->var_i16_e20);
+ if ((this->var_i16_e20 == 0) || (this->var_str_f30 == g_zbasic->str(133))) {
+ this->var_i16_f2e = 0x3e8;
+ }
+ // 129:0606
+ this->sub_129_004();
+ if (this->var_str_e22 != g_zbasic->str(134)) {
+ this->var_i16_f2e = 0x3e8;
+ }
+ }
+ }
+ // 129:0636
+ if (this->var_str_e22 == g_zbasic->str(135)) {
+ do {
+ g_zbasic->text(0, 0xc, 0, kSrcBic);
+ this->sub_128_8b4(0x17, 0x92, 0x31, 0x16e, 2);
+ this->var_i16_7a2 = 0x28;
+ // prompt to locate the fool's puzzles file
+ // 129:0690: CLR.W - -0x772(A5)
+ this->sub_128_4da(1);
+ Common::U32String PUZZ = g_zbasic->str(137);
+ this->sub_128_1e4(PUZZ);
+ // 129:06a6: CLR.W - -0x772(A5)
+ this->sub_128_8b4(0x17, 0x92, 0x31, 0x16e, 1);
+ this->sub_128_4da(0);
+ if (this->var_str_588 == g_zbasic->str(138)) {
+ g_zbasic->unk_4();
+ }
+ this->var_str_e22 = this->var_str_588;
+ this->var_i16_f22 = this->var_i16_688;
+ } while (this->var_str_e22 != g_zbasic->str(139));
+ }
+ // 129:0718
+ this->sub_128_64c(this->var_i16_f22);
+ this->var_i16_1030 = g_toolbox->OpenResFile(Common::Path(this->var_str_e22, ':'));
+ g_toolbox->UseResFile(this->var_i16_1030);
+ this->var_i16_484 = this->sub_128_64c(this->var_i16_f2c);
+ for (int i = 0; i <= 1; i++) {
+ // scroll background
+ this->arr_i32_192c0[i] = g_toolbox->GetPicture(this->var_i16_68a + 0x54);
+ PicHandle h = this->arr_i32_192c0[i];
+ g_toolbox->DetachResource(h);
+ }
+ // 129:07a2
+ g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ g_zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, this->arr_bmp_5dfc);
+ g_zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, this->arr_bmp_b3ec);
+ g_zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
+ // 129:0846
+ for (int i = 0; i <= 0x15; i++) {
+ this->var_i16_484 = g_zbasic->readInt();
+ g_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kPutCopy);
+ this->sub_128_3da(2);
+ }
+ // 129:0888
+ g_zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(0x1f9, 0x14f, this->arr_bmp_109dc, kPutCopy);
+ g_zbasic->picture(0x39, 0x29, this->arr_i32_192c0[1]);
+
+ // 129:08ee
+ // FIXME
+}
+
+void FoolGame::sub_138_004() {
+ // FIXME
+}
+
+void FoolGame::sub_144_004() {
// FIXME
}
-// end
-// 128:62ae
};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 4e716fb9865..d3b5c4951b8 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -51,8 +51,8 @@ public:
void sub_128_4da(int16 unk1);
void sub_128_50e(int16 unk3, int16 unk2, int16 unk1);
void sub_128_55c(Common::U32String &unk1);
- int32 sub_128_5fe();
- void sub_128_64c(int16 unk1);
+ int16 sub_128_5fe();
+ OSErr sub_128_64c(int16 unk1);
void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_712(int16 unk3, int16 unk2, int16 unk1);
void sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
@@ -76,6 +76,7 @@ public:
void sub_128_2126();
void sub_128_21c8();
void sub_128_2202();
+ void sub_128_2808();
void sub_128_2b0a();
void sub_128_2bc6();
void sub_128_2e3e();
@@ -94,6 +95,7 @@ public:
void sub_128_61ec();
void sub_128_6244();
+ void sub_129_004();
void sub_129_068();
void sub_138_004();
@@ -114,12 +116,16 @@ private:
int16 var_i16_56;
int16 var_i16_58;
int16 var_i16_5a;
+ int16 var_i16_5c;
SFReply var_sfr_5e; // -> aa
int16 var_i16_16c;
ProcPtr var_i32_16e;
Common::U32String var_str_172;
Common::U32String var_str_272;
+ RGBColor var_i16_372;
int16 var_i16_378;
+ int16 var_i16_37a;
+ uint32 var_i32_37c;
Common::U32String var_str_384;
int16 var_i16_484;
Common::U32String var_str_486;
@@ -162,6 +168,21 @@ private:
int16 var_i16_7da;
int16 var_i16_7dc;
int16 var_i16_7e2;
+ int16 var_i16_7e4;
+ int16 var_i16_7e6;
+ Common::U32String var_str_8ec;
+ int16 var_i16_9ec;
+
+ int16 var_i16_e20;
+ Common::U32String var_str_e22;
+ int16 var_i16_f22;
+ GrafPtr var_i32_f24;
+ OSType var_i32_f28;
+ int16 var_i16_f2c;
+ int16 var_i16_f2e;
+ Common::U32String var_str_f30;
+ int16 var_i16_1030;
+
// FIXME: bounds on the following are guessed! need to trace index range
int16 arr_i16_18b2[101];
@@ -188,8 +209,12 @@ private:
int16 arr_i16_5cbc[26];
float arr_bcd_5dbc[8];
BitMap arr_bmp_5dfc; // 22000, close to a screen page
+ BitMap arr_bmp_b3ec;
BitMap arr_bmp_109dc;
BitMap arr_bmp_15fcc;
+ GrafPort arr_grafport_18eae;
+ GrafPort arr_grafport_18f78;
+ GrafPort arr_grafport_19042;
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
PicHandle arr_i32_192c0[0x18];
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index d687d35a491..3782b7098bc 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -575,7 +575,7 @@ void FoolPrologue::sub_129_004() {
this->drawTextCenterAlign(0xcb, 0x100);
this->sub_128_e58();
- g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
+ g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kPutCopy);
this->var_i16_1aa = 0;
} else {
@@ -648,7 +648,7 @@ void FoolPrologue::sub_129_004() {
this->drawTextCenterAlign(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
- g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0]);
+ g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kPutCopy);
this->var_i16_1aa = 0;
} else {
// 129:075c
@@ -1406,7 +1406,7 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4);
+ g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kPutCopy);
g_toolbox->InvertRect(this->arr_i16_1bc);
this->delayFromMarker(1);
}
@@ -1423,7 +1423,7 @@ void FoolPrologue::sub_131_004() {
// 131:0b54
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4);
+ g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kPutCopy);
}
// 131:0bb0
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index ec2475ff1f1..6dd7aadaf1a 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -164,7 +164,7 @@ struct GrafPort {
Common::Rect portRect;
RgnHandle visRgn;
RgnHandle clipRgn;
- Pattern bkPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf } };
+ Pattern bkPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
Pattern fillPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
Common::Point pnLoc = {0, 0};
Common::Point pnSize = {1, 1};
@@ -269,9 +269,9 @@ public:
uint32 TickCount();
// toolbox_fileman.cpp
- void PBGetVol(ParamBlockRec ¶mBlock);
+ OSErr PBGetVol(ParamBlockRec ¶mBlock);
- void PBSetVol(ParamBlockRec ¶mBlock);
+ OSErr PBSetVol(ParamBlockRec ¶mBlock);
void SFGetFile(const Common::Point &where, const Common::U32String &prompt, ProcPtr fileFilter, int16 numTypes, const SFTypeList &typeList, const ProcPtr &dlgHook, SFReply &reply);
@@ -299,6 +299,7 @@ public:
// a resource; if the Resource Manager is subsequendy called to get the detached resource, a new
// handle will be allocated.
void DetachResource(Handle &h);
+ void DetachResource(PicHandle &h);
// PROCEDURE DisposHandle (h: Handle);
// DisposHandle releases the memory occupied by the relocatable block whose handle is h.
@@ -427,6 +428,13 @@ public:
// procedure draws the picture that you specify in the myPicture parameter.
void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
+ // PROCEDURE DrawMenuBar;
+ // DrawMenuBar redraws the menu bar according to the menu list, incorporating any changes since
+ // the last call to DrawMenuBar. This procedure should always be called after a sequence of
+ // InsertMenu or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other routine that
+ // changes the menu list.
+ void DrawMenuBar();
+
// PROCEDURE EraseRoundRect (r: Rect; ovalWidth,ovalHeight: Integer);
// Using the patCopy pattern mode, the EraseRoundRect procedure draws the interior of
// the rounded rectangle bounded by the rectangle that you specify in the r parameter with
diff --git a/engines/fool/toolbox_fileman.cpp b/engines/fool/toolbox_fileman.cpp
index 90834db4bb9..4539ed3cba2 100644
--- a/engines/fool/toolbox_fileman.cpp
+++ b/engines/fool/toolbox_fileman.cpp
@@ -26,12 +26,14 @@
namespace Fool {
-void Toolbox::PBGetVol(ParamBlockRec ¶mBlock) {
+OSErr Toolbox::PBGetVol(ParamBlockRec ¶mBlock) {
warning("STUB: Toolbox::PBGetVol");
+ return 0;
}
-void Toolbox::PBSetVol(ParamBlockRec ¶mBlock) {
+OSErr Toolbox::PBSetVol(ParamBlockRec ¶mBlock) {
warning("STUB: Toolbox::PBSetVol");
+ return 0;
}
void Toolbox::SFGetFile(const Common::Point &where, const Common::U32String &prompt, ProcPtr fileFilter, int16 numTypes, const SFTypeList &typeList, const ProcPtr &dlgHook, SFReply &reply) {
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index d4965b7de01..3c28bf95193 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -53,6 +53,11 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
}
void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
+ if (!_port) {
+ warning("Toolbox::_copyBits: empty port");
+ return;
+ }
+
if (!srcBits) {
warning("Toolbox::_copyBits: empty srcBits handle");
return;
@@ -105,6 +110,10 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
}
}
+void Toolbox::DrawMenuBar() {
+ warning("STUB: Toolbox::DrawMenuBar");
+}
+
void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
const Graphics::Surface *surface = myPicture->getSurface();
const Graphics::Palette &palette = myPicture->getPalette();
@@ -356,6 +365,7 @@ void Toolbox::OpenPort(GrafPtr port) {
port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) }));
port->fgColor = g_engine->_wm._colorBlack;
port->bkColor = g_engine->_wm._colorWhite;
+ _port = port;
//port->clipRgn
}
@@ -417,6 +427,10 @@ void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
warning("STUB: Toolbox::SetCPixel");
}
+void Toolbox::SetCursor(const Cursor &crsr) {
+ warning("STUB: Toolbox::SetCursor");
+}
+
void Toolbox::SetPort(GrafPtr port) {
_port = port;
}
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index 230d9896b99..78310461573 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -39,6 +39,15 @@ void Toolbox::DetachResource(Handle &handle) {
}
}
+void Toolbox::DetachResource(PicHandle &handle) {
+ // Pictures generated by GetPicture are apparently freed with ReleaseResource.
+ if (_resPicts.contains(handle)) {
+ Handle target = _resPicts[handle];
+ _resPicts.erase(handle);
+ this->DetachResource(target);
+ }
+}
+
void Toolbox::DisposHandle(Handle &h) {
// Our Handles are reference counted, don't free anything but invalidate this handle.
h = nullptr;
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 3d8f90cd277..16a4cb6a018 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -179,7 +179,11 @@ void ZBasic::coordinateWindow() {
}
void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest) {
- warning("STUB: ZBasic::get");
+ GrafPtr port;
+ _toolbox->GetPort(port);
+ Common::Rect srcRect(x1, y1, x2, y2);
+ dest->create(srcRect.width(), srcRect.height());
+ _toolbox->CopyBits(port->portBits, dest, srcRect, dest->getBounds(), kSrcCopy, nullptr);
}
int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2) {
@@ -189,6 +193,12 @@ int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Co
return (int16)(result + 1);
}
+Common::U32String ZBasic::files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume) {
+ warning("STUB: ZBasic::files");
+ return Common::U32String();
+}
+
+
int ZBasic::finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume) {
warning("STUB: ZBasic::finderInfo");
return 0;
@@ -236,12 +246,23 @@ void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
warning("STUB: ZBasic::picture");
}
-void ZBasic::put(int16 x, int16 y, BitMap &src) {
- this->put(x, y, x+src->w, y+src->h, src);
+void ZBasic::put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode) {
+ this->put(x, y, x+src->w, y+src->h, src, mode);
}
-void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src) {
- warning("STUB: ZBasic::put");
+void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutMode mode) {
+ Common::Rect destRect(x1, y1, x2, y2);
+ SourceMode sm = kSrcCopy;
+ if (mode == kPutXOR) {
+ sm = kSrcXor;
+ } else if (mode == kPutAND) {
+ sm = kSrcBic;
+ } else if (mode == kPutOR) {
+ sm = kSrcOr;
+ }
+ GrafPtr port;
+ _toolbox->GetPort(port);
+ _toolbox->CopyBits(src, port->portBits, src->getBounds(), destRect, sm, nullptr);
}
Common::Array<byte> ZBasic::read(int16 fileNo, uint32 length) {
@@ -307,6 +328,10 @@ int16 ZBasic::unk_5() {
return 0;
}
+void ZBasic::unk_4() {
+ warning("STUB: ZBasic::unk_4");
+}
+
void ZBasic::unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4) {
warning("STUB: ZBasic::unk_6");
}
@@ -327,6 +352,10 @@ void ZBasic::unk_130(int16 unk1) {
warning("STUB: ZBasic::unk_130");
}
+void ZBasic::unk_158() {
+ warning("STUB: ZBasic::unk_158");
+}
+
void ZBasic::unk_331(uint16 unk1, int16 unk2) {
warning("STUB: ZBasic::unk_331");
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index e0ae8e28542..d98bb975b58 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -148,6 +148,13 @@ enum ZBasicWindowType {
kWindowDocumentFixed = 5,
};
+enum ZBasicPutMode {
+ kPutCopy = 0,
+ kPutXOR = 1,
+ kPutOR = 2,
+ kPutAND = 3, // FIXME: check that these are right
+};
+
struct ZBasicDatum {
ZBasicDatumType type = kDatumNULL;
uint32 offset = 0;
@@ -237,15 +244,16 @@ public:
void coordinateWindow();
void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
- int finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume);
+ Common::U32String files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume);
+ int finderInfo(int16 &count, Common::U32String &var, OSType &type, uint16 volume);
bool maybe();
uint32 mem(int16 index);
void menu(int16 menuNo, int16 itemNo, int16 state, const Common::U32String &title);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
- void put(int16 x, int16 y, BitMap &src);
- void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src);
+ void put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode);
+ void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutMode mode);
Common::Array<byte> read(int16 fileNo, uint32 length);
int16 readInt();
Common::U32String readStr();
@@ -256,7 +264,7 @@ public:
const Common::U32String &str(size_t index);
- void unk_4();
+ void unk_4(); // possibly quit?
int16 unk_5();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
void unk_20();
Commit: 0f960091a533b8283d5c42fb0c89ca9cc2124d8e
https://github.com/scummvm/scummvm/commit/0f960091a533b8283d5c42fb0c89ca9cc2124d8e
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:56+02:00
Commit Message:
FOOL: More porting
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index c158b7a0c12..5e41fca7abc 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -124,17 +124,17 @@ void FoolGame::sub_128_004() {
if ((this->var_i16_7ce & 2) == 0) {
g_toolbox->InitCursor();
} else {
- g_toolbox->SetCursor(this->arr_curs_51c8);
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x20]);
}
// 128:1d42
} else {
// 128:1d46
if (this->var_i16_7b2 == -1) {
- g_toolbox->SetCursor(this->arr_curs_4e10);
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x4]);
}
// 128:1d5e
if (this->var_i16_7b2 == 1) {
- g_toolbox->SetCursor(this->arr_curs_4dcc);
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x2]);
}
}
}
@@ -319,43 +319,35 @@ void FoolGame::sub_128_406(int16 unk1) {
int16 FoolGame::sub_128_428() {
// 128:0428
// read a byte
- // FIXME
-/* this->var_i16_30 = *(byte *)this->var_i32_696;
- this->var_i32_696 += 1;
- return this->var_i16_30; */
+ this->var_i16_30 = *(byte *)this->var_ptr_696;
+ this->var_ptr_696 += 1;
+ return this->var_i16_30;
return 0;
}
int16 FoolGame::sub_128_446() {
// 128:0446
// read a short
- // FIXME
-/* this->var_i16_30 = *(int16 *)this->var_i32_696;
- this->var_i32_696 += 2;
- return this->var_i16_30;*/
- return 0;
+ this->var_i16_30 = READ_BE_INT16(this->var_ptr_696);
+ this->var_ptr_696 += 2;
+ return this->var_i16_30;
}
-int16 FoolGame::sub_128_462() {
+int32 FoolGame::sub_128_462() {
// 128:0462
// read a long
- // FIXME
-/* this->var_i32_68e = *(int32 *)this->var_i32_696;
- this->var_i32_696 += 4;
- return this->var_i32_68e;*/
- return 0;
+ this->var_i32_68e = READ_BE_INT32(this->var_ptr_696);
+ this->var_ptr_696 += 4;
+ return this->var_i32_68e;
}
void FoolGame::sub_128_49a() {
// 128:049a
// read a pascal string
- // FIXME
-/* this->var_i16_79e = *(byte *)this->var_i32_696;
- g_zbasic->blockMove(this->var_i32_696, this->var_str_69a, this->var_i16_79e+1);
- this->var_i32_696 += this->var_i16_79e + 1;
-
- // 128:04cc: LEA - VAR(0x69a),A0
- // 128:04d0: JSR - "BUFFER_CONCAT"*/
+ this->var_i16_79e = *(byte *)this->var_ptr_696;
+ this->var_ptr_696++;
+ this->var_str_69a = Common::U32String((const char *)this->var_ptr_696, this->var_i16_79e, Common::kMacRoman);
+ this->var_ptr_696 += this->var_i16_79e;
}
void FoolGame::sub_128_4da(int16 unk1) {
@@ -845,7 +837,7 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
}
void FoolGame::sub_128_1c2c(int16 unk1) {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_1c30() {
@@ -862,8 +854,6 @@ void FoolGame::sub_128_1c4a(int16 unk1) {
// 128:1c78
}
-// FIXME
-
void FoolGame::sub_128_1f1e() {
@@ -973,31 +963,31 @@ void FoolGame::sub_128_21c8() {
}
void FoolGame::sub_128_2202() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2808() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2b0a() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2bc6() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2e3e() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_3536() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_39a0() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_4472() {
@@ -1018,46 +1008,46 @@ void FoolGame::sub_128_4472() {
g_toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
if (this->arr_i16_4758[5] == 0) {
// 128:456a
- // FIXME
+ warning("STUB: %s", __func__);
}
// 128:459a
}
void FoolGame::sub_128_5b30() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_5baa() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_5f9e() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_5fb4() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_5fea() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_6154() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_6186() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_61ec() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_128_6244() {
- // FIXME
+ warning("STUB: %s", __func__);
}
// end
@@ -1065,7 +1055,7 @@ void FoolGame::sub_128_6244() {
void FoolGame::sub_129_004() {
this->var_i16_7e6 = 0;
- // FIXME
+ warning("STUB: %s", __func__);
// 129:000a: LEA - 0x3ea(A5),A0
// 129:000e: MOVE.L - A0,-0x8ee(A5)
// 129:0012: SF - 0x8,D0
@@ -1265,7 +1255,7 @@ void FoolGame::sub_129_068() {
g_zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
// 129:0846
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = g_zbasic->readInt();
+ this->var_i16_484 = g_zbasic->readDataInt();
g_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kPutCopy);
this->sub_128_3da(2);
}
@@ -1275,15 +1265,81 @@ void FoolGame::sub_129_068() {
g_zbasic->picture(0x39, 0x29, this->arr_i32_192c0[1]);
// 129:08ee
- // FIXME
+ for (int i = 0; i <= 1; i++) {
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[i]);
+ }
+ // 129:091a
+ this->var_i32_692 = g_toolbox->TickCount();
+ this->var_i16_68a = 0x28;
+ this->sub_129_123a();
+
+ // load sun's map tiles
+ byte fakePal[768];
+ Common::fill(fakePal, fakePal+3, 0xff);
+ Common::fill(fakePal+3, fakePal+768, 0x00);
+
+ for (int i = 1; i <= 0x53; i++) {
+ this->arr_i32_1912c[i] = g_toolbox->GetPicture(i);
+ this->arr_i32_1912c[i]->getSurface()->debugPrint(0, 0, 0, 0, 0, -1, 160, fakePal);
+
+ g_toolbox->DetachResource(this->arr_i32_1912c[i]);
+ }
+ // 129:097c
+ this->var_i16_68a = 0x3c;
+ this->sub_129_123a();
+ // wadjet eye
+ this->var_pic_7c2 = g_toolbox->GetPicture(0x56);
+ g_toolbox->DetachResource(this->var_pic_7c2);
+ // icon of a scroll
+ this->var_i32_c = g_toolbox->GetIcon(0x101);
+ g_toolbox->DetachResource(this->var_i32_c);
+ // 129:09c2: SF - 0x8,D0
+ g_zbasic->openR(1, g_zbasic->str(140), 1000, this->var_i16_f22);
+ this->var_i32_1036 = g_zbasic->readFileDblInt(1);
+
+ this->var_ptr_696 = &this->arr_bytes_5dfc[0];
+
+ // read into pointer
+ g_zbasic->readFile(1, this->var_ptr_696, this->var_i32_1036);
+
+ // 129:0a0a
+ this->var_i16_68a = 0x50;
+ this->sub_129_123a();
+ for (int i = 1; i <= 0x64; i++) {
+ this->arr_i32_19454[i] = this->sub_128_462();
+ }
+ // 129:0a4e
+ for (int i = 0; i <= 0x50; i++) {
+ // reworked slightly to fill the pattern buffer directly
+ for (int j = 0; j <= 0x7; j++) {
+ this->arr_pat_58f4[i].data[j] = (byte)this->sub_128_428();
+ }
+ }
+ // 129:0a8a
+ for (int i = 1; i <= 0x2a; i++) {
+ for (int j = 0; j < 16; j++) {
+ this->arr_curs_4d88[i].data[j] = (uint16)this->sub_128_446();
+ }
+ for (int j = 0; j < 16; j++) {
+ this->arr_curs_4d88[i].mask[j] = (uint16)this->sub_128_446();
+ }
+ this->arr_curs_4d88[i].mouse.y = this->sub_128_446();
+ this->arr_curs_4d88[i].mouse.x = this->sub_128_446();
+ }
+ // 129:0ad4
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_129_123a() {
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_138_004() {
- // FIXME
+ warning("STUB: %s", __func__);
}
void FoolGame::sub_144_004() {
- // FIXME
+ warning("STUB: %s", __func__);
}
};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index d3b5c4951b8..a72c3ef4e19 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -46,7 +46,7 @@ public:
void sub_128_406(int16 unk1);
int16 sub_128_428();
int16 sub_128_446();
- int16 sub_128_462();
+ int32 sub_128_462();
void sub_128_49a();
void sub_128_4da(int16 unk1);
void sub_128_50e(int16 unk3, int16 unk2, int16 unk1);
@@ -97,6 +97,7 @@ public:
void sub_129_004();
void sub_129_068();
+ void sub_129_123a();
void sub_138_004();
void sub_144_004();
@@ -105,6 +106,7 @@ private:
GrafPtr var_i32_0;
GrafPtr var_i32_4;
GrafPtr var_i32_8;
+ Handle var_i32_c;
int16 var_i16_30;
int16 var_i16_32;
int16 var_i16_34;
@@ -136,7 +138,7 @@ private:
int16 var_i16_68c;
uint32 var_i32_68e;
uint32 var_i32_692;
- int32 var_i32_696;
+ byte *var_ptr_696;
Common::U32String var_str_69a;
int16 var_i16_78a;
int16 var_i16_79e;
@@ -182,6 +184,7 @@ private:
int16 var_i16_f2e;
Common::U32String var_str_f30;
int16 var_i16_1030;
+ int32 var_i32_1036;
// FIXME: bounds on the following are guessed! need to trace index range
@@ -197,9 +200,7 @@ private:
Common::Rect arr_rect_1f38[3];
Common::Rect arr_rect_4338;
int16 arr_i16_4758[6];
- Cursor arr_curs_4dcc; // 0x44
- Cursor arr_curs_4e10; // 0x44
- Cursor arr_curs_51c8; // 0x44
+ Cursor arr_curs_4d88[0x2b]; // 0x44
Pattern arr_pat_58f4[4];
Pattern arr_pat_5b2c;
Common::Rect arr_rect_5b7c;
@@ -208,6 +209,7 @@ private:
Common::Rect arr_rect_5b92;
int16 arr_i16_5cbc[26];
float arr_bcd_5dbc[8];
+ byte arr_bytes_5dfc[22000]; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap arr_bmp_b3ec;
BitMap arr_bmp_109dc;
@@ -217,7 +219,9 @@ private:
GrafPort arr_grafport_19042;
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
+ PicHandle arr_i32_1912c[0x54];
PicHandle arr_i32_192c0[0x18];
+ int32 arr_i32_19454[0x65];
Common::U32String arr_str_195e8[101]; // 0x20 each
Common::U32String arr_str_1a8d8[7]; // 0x66 each
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 3782b7098bc..5da221d97bd 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -608,7 +608,7 @@ void FoolPrologue::sub_129_004() {
// 0x053c: SF - 0x8,D0
g_zbasic->openR(1, this->var_i16_1c4, 0x400, this->var_i16_2c8);
- Common::Array<byte> payload = g_zbasic->read(1, this->var_i16_2ca);
+ Common::Array<byte> payload = g_zbasic->readFile(1, this->var_i16_2ca);
this->var_i16_2ce = Common::U32String((char *)&payload[0], this->var_i16_2ca, Common::kMacRoman);
g_zbasic->close(1);
// 0x0570: CLR.L - -0x8ee(A5)
@@ -1141,12 +1141,12 @@ void FoolPrologue::drawRainDrop() {
void FoolPrologue::prologueRenderNextText() {
// 130:0f48
- this->var_i16_3d2 = g_zbasic->readInt();
+ this->var_i16_3d2 = g_zbasic->readDataInt();
for (int i = 1; i <= this->var_i16_3d2; i++) {
// 130:0f56
- this->var_i16_176 = g_zbasic->readInt();
- this->var_i16_180 = g_zbasic->readInt();
- this->var_str_76 = g_zbasic->readStr();
+ this->var_i16_176 = g_zbasic->readDataInt();
+ this->var_i16_180 = g_zbasic->readDataInt();
+ this->var_str_76 = g_zbasic->readDataStr();
this->var_i16_1ba = 1;
// JMP 0xfc2
@@ -1255,12 +1255,12 @@ void FoolPrologue::sub_131_004() {
this->var_i16_3da = 1;
// 131:030c
- this->var_i16_18e = g_zbasic->readInt();
+ this->var_i16_18e = g_zbasic->readDataInt();
for (int i = 1; i < this->var_i16_18e; i++) {
// 131:031a
- this->arr_i16_1e8[i] = g_zbasic->readInt();
- this->arr_i16_1e8[i + 0xfb] = g_zbasic->readInt();
- this->arr_i16_1e8[i + 0x1f6] = g_zbasic->readInt();
+ this->arr_i16_1e8[i] = g_zbasic->readDataInt();
+ this->arr_i16_1e8[i + 0xfb] = g_zbasic->readDataInt();
+ this->arr_i16_1e8[i + 0x1f6] = g_zbasic->readDataInt();
}
// 131:0380
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 6dd7aadaf1a..7845dee728e 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -435,6 +435,14 @@ public:
// changes the menu list.
void DrawMenuBar();
+ // PROCEDURE EraseRect (r: Rect);
+ // Using the patCopy pattern mode, the EraseRect procedure draws the interior of the
+ // rectangle that you specify in the r parameter with the background pattern for the current
+ // graphics port. This effectively erases the rectangle specified in the r parameter. For
+ // example, you can use EraseRect to erase the port rectangle for a window before
+ // redrawing into the window.
+ void EraseRect(const Common::Rect &r);
+
// PROCEDURE EraseRoundRect (r: Rect; ovalWidth,ovalHeight: Integer);
// Using the patCopy pattern mode, the EraseRoundRect procedure draws the interior of
// the rounded rectangle bounded by the rectangle that you specify in the r parameter with
@@ -491,6 +499,12 @@ public:
// port.
void GetCPixel(int16 h, int16 v, RGBColor &cPix);
+ // FUNCTION GetIcon(iconID: INTEGER): Handle;
+ // GetIcon returns a handle to the icon having the given resource ID, reading it from the resource file
+ // if necessary. It calls the Resource Manager function GetResource('ICON ,iconID). If the
+ // resource can't be read, GetIcon returns NIL.
+ Handle GetIcon(uint16 iconID);
+
// PROCEDURE GetPort (VAR port: GrafPtr);
// The GetPort procedure returns a pointer to the current graphics port in the port
// parameter. The current graphics port is also available through the global variable
@@ -747,6 +761,7 @@ private:
void _pumpEvents();
void _updateScreen();
+ void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 3c28bf95193..6dcd142bb3a 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -124,6 +124,27 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
_copyBits(intermediate, mask, _port->portBits, intermediate->getBounds(), dstRect, kSrcCopy, nullptr);
}
+// maybe the better way of refactoring this would be to fork the Primitives
+// object from MacWindowManager and make one that uses GrafPort as a state store?
+// as it stands, all the operations fall back to calling DrawPoint over and over again,
+// which can touch the same pixel multiple times.
+// this is a problem for all the xor blend modes.
+// we could have it so that the draw commands check a mask before drawing again, and it
+// gets reset after every op. this would be pretty inefficient; e.g. in fools errand most
+// of the time is spent drawing to the screen or to a screen-sized buffer.
+
+// steps:
+// - create intermediate surface
+// - draw to intermediate surface using MacPlotData
+// - blit to target with blitMono
+// - add to target dirty rect list
+
+void Toolbox::EraseRect(const Common::Rect &r) {
+ if (_port) {
+ _drawRect(r, _port->bkPat, kPatCopy, false);
+ }
+}
+
void Toolbox::EraseRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
warning("STUB: Toolbox::EraseRoundRect");
}
@@ -136,36 +157,43 @@ void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
warning("STUB: Toolbox::FillOval");
}
-void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
- // maybe the better way of refactoring this would be to fork the Primitives
- // object from MacWindowManager and make one that uses GrafPort as a state store?
- // as it stands, all the operations fall back to calling DrawPoint over and over again,
- // which can touch the same pixel multiple times.
- // this is a problem for all the xor blend modes.
- // we could have it so that the draw commands check a mask before drawing again, and it
- // gets reset after every op. this would be pretty inefficient; e.g. in fools errand most
- // of the time is spent drawing to the screen or to a screen-sized buffer.
-
- // steps:
- // - create intermediate surface
- // - draw to intermediate surface using MacPlotData
- // - blit to target with blitMono
- // - add to target dirty rect list
+void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame) {
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ // special case because rect fills the entire surface
BitMap mask(nullptr);
+ if (frame) {
+ mask = BitMap(new Graphics::ManagedSurface(r.width(), r.height()));
+ }
+
Common::Point destPos(r.left, r.top);
Graphics::MacPatterns macpat({pat.data});
+
Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
- pm.drawFilledRect(intermediate->getBounds(), _port->fgColor, &pd);
- // FillRect always uses patCopy
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, kPatCopy);
+ // For thicker outlines, the shape should be adjusted inward
+ Common::Rect destRect = intermediate->getBounds();
+ destRect.right -= _port->pnSize.x - 1;
+ destRect.bottom -= _port->pnSize.y - 1;
+
+ if (frame) {
+ pm.drawRect(destRect, _port->fgColor, &pd);
+ } else {
+ pm.drawFilledRect(destRect, _port->fgColor, &pd);
+ }
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+
+ // Dirty rects check
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(dstRect);
_defaultWindow->setDirty(true);
}
+ }
+}
+void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
+ if (_port) {
+ _drawRect(r, pat, kPatCopy, false);
}
}
@@ -194,26 +222,8 @@ void Toolbox::FrameOval(const Common::Rect &r) {
}
void Toolbox::FrameRect(const Common::Rect &r) {
- if (_port && _port->pnVis == 0) {
-
- BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
- BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
- Common::Point destPos(r.left, r.top);
- Graphics::MacPatterns pat({_port->pnPat.data});
-
- Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
- Common::Rect destRect = intermediate->getBounds();
- destRect.right -= _port->pnSize.x - 1;
- destRect.bottom -= _port->pnSize.y - 1;
-
- pm.drawRect(destRect, _port->fgColor, &pd);
-
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ if (_port) {
+ _drawRect(r, _port->pnPat, _port->pnMode, true);
}
}
@@ -225,6 +235,17 @@ void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
warning("STUB: Toolbox::GetCPixel");
}
+Handle Toolbox::GetIcon(uint16 iconID) {
+ Handle handle = this->GetResource(MKTAG('I', 'C', 'O', 'N'), iconID);
+ if (handle) {
+ return handle;
+ } else {
+ warning("Toolbox::GetIcon: failed to load ICON id %d", iconID);
+ }
+
+ return nullptr;
+}
+
PicHandle Toolbox::GetPicture(uint16 picID) {
Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
if (handle) {
@@ -378,7 +399,9 @@ void Toolbox::PaintPoly(PolyHandle poly) {
}
void Toolbox::PaintRect(const Common::Rect &r) {
- warning("STUB: Toolbox::PaintRect");
+ if (_port) {
+ _drawRect(r, _port->pnPat, _port->pnMode, false);
+ }
}
void Toolbox::PaintRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 16a4cb6a018..85408c29a2e 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -265,41 +265,65 @@ void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutM
_toolbox->CopyBits(src, port->portBits, src->getBounds(), destRect, sm, nullptr);
}
-Common::Array<byte> ZBasic::read(int16 fileNo, uint32 length) {
- warning("STUB: ZBasic::read");
- return Common::Array<byte>();
+int32 ZBasic::readDataDblInt() {
+ if (_dataPtr >= _dataTable.size()) {
+ warning("ZBasic::readDataDblInt: no more data left");
+ return 0;
+ }
+ Common::SharedPtr<ZBasicDatum> &el = _dataTable[_dataPtr];
+ _dataPtr++;
+ if (el->type != kDatumDBLINT) {
+ warning("ZBasic::readDataDblInt: entry %d was unexpected type %d", _dataPtr-1, el->type);
+ return 0;
+ }
+ return el->data.i32;
}
-int16 ZBasic::readInt() {
+int16 ZBasic::readDataInt() {
if (_dataPtr >= _dataTable.size()) {
- warning("ZBasic::readInt: no more data left");
+ warning("ZBasic::readDataInt: no more data left");
return 0;
}
Common::SharedPtr<ZBasicDatum> &el = _dataTable[_dataPtr];
_dataPtr++;
if (el->type != kDatumINT) {
- warning("ZBasic::readInt: entry %d was unexpected type %d", _dataPtr-1, el->type);
+ warning("ZBasic::readDataInt: entry %d was unexpected type %d", _dataPtr-1, el->type);
return 0;
}
return el->data.i16;
}
-Common::U32String ZBasic::readStr() {
+Common::U32String ZBasic::readDataStr() {
Common::U32String result;
if (_dataPtr >= _dataTable.size()) {
- warning("ZBasic::readStr: no more data left");
+ warning("ZBasic::readDataStr: no more data left");
return result;
}
Common::SharedPtr<ZBasicDatum> &el = _dataTable[_dataPtr];
_dataPtr++;
if (el->type != kDatumSTR) {
- warning("ZBasic::readStr: entry %d was unexpected type %d", _dataPtr-1, el->type);
+ warning("ZBasic::readDataStr: entry %d was unexpected type %d", _dataPtr-1, el->type);
return result;
}
result = *el->data.str;
return result;
}
+Common::Array<byte> ZBasic::readFile(int16 fileNo, uint32 length) {
+ warning("STUB: ZBasic::readFile");
+ return Common::Array<byte>();
+}
+
+uint32 ZBasic::readFile(int16 fileNo, byte *dest, uint32 length) {
+ warning("STUB: ZBasic::readFile");
+ return length;
+}
+
+int32 ZBasic::readFileDblInt(int16 fileNo) {
+ warning("STUB: ZBasic::readFileDblInt");
+ return 0;
+}
+
int16 ZBasic::rndInt(int16 max) {
if (max == 0)
return 0;
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index d98bb975b58..82d5d0d06dc 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -254,9 +254,12 @@ public:
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
void put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode);
void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutMode mode);
- Common::Array<byte> read(int16 fileNo, uint32 length);
- int16 readInt();
- Common::U32String readStr();
+ int16 readDataInt();
+ int32 readDataDblInt();
+ Common::U32String readDataStr();
+ Common::Array<byte> readFile(int16 fileNo, uint32 length);
+ uint32 readFile(int16 fileNo, byte *dest, uint32 length);
+ int32 readFileDblInt(int16 fileNo);
int16 rndInt(int16 max);
void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
Commit: 5909b79848f5a57431598adb362cd731fab802c0
https://github.com/scummvm/scummvm/commit/5909b79848f5a57431598adb362cd731fab802c0
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:57+02:00
Commit Message:
FOOL: Fix rendering regressions in introduction
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_prologue.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5e41fca7abc..26d0f0b91a8 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1031,7 +1031,22 @@ void FoolGame::sub_128_5fb4() {
}
void FoolGame::sub_128_5fea() {
- warning("STUB: %s", __func__);
+ if (this->var_i16_37a == 1) {
+ g_toolbox->SetPort(this->var_i32_8);
+ g_toolbox->PenNormal();
+ this->sub_128_8b4(0x14, 0, this->var_i16_5c, this->var_i16_56-3, 2);
+ this->sub_128_8b4(0x14, 0, this->var_i16_58+0x11, this->var_i16_5a, 2);
+ this->sub_128_8b4(0x14, this->var_i16_56+0x203, this->var_i16_5c, this->var_i16_5a, 2);
+ this->sub_128_8b4(this->var_i16_58 + 0x159, 0, this->var_i16_5c, this->var_i16_5a, 2);
+ g_toolbox->SetRect(this->arr_rect_5b7c, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->SetRect(this->arr_rect_5b7c, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
+ g_toolbox->PenPat(this->arr_pat_58f4[2]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->SetPort(this->var_i32_0);
+ }
+ // 128:6152
}
void FoolGame::sub_128_6154() {
@@ -1043,7 +1058,16 @@ void FoolGame::sub_128_6186() {
}
void FoolGame::sub_128_61ec() {
- warning("STUB: %s", __func__);
+ do {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ if (this->var_ev_46.what == 6) {
+ this->sub_128_5fb4();
+ }
+ if (this->var_ev_46.what == 7) {
+ this->sub_128_6154();
+ }
+ } while ((this->var_ev_46.what == 0) && (this->var_ev_46.modifiers & 0x80));
+ this->var_i16_7c0 = 0;
}
void FoolGame::sub_128_6244() {
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 5da221d97bd..7b3afdcb669 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -554,7 +554,7 @@ void FoolPrologue::sub_129_004() {
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0]);
+ g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
g_zbasic->unk_6(0x19, 0x64, 0xff, 0x0);
this->fillRect(2, 0x46, 0x64, 0xdc, 0x19c);
this->fillRect(1, 0x4b, 0x69, 0xd7, 0x197);
@@ -624,7 +624,7 @@ void FoolPrologue::sub_129_004() {
// 129:05a6
if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0]);
+ g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
g_zbasic->unk_6(0x19, 0x64, 0xff, 0x00);
this->fillRect(2, 0x64, 0x82, 0xdc, 0x17e);
this->fillRect(1, 0x69, 0x87, 0xd7, 0x179);
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 7845dee728e..05d0781a2e9 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -761,7 +761,7 @@ private:
void _pumpEvents();
void _updateScreen();
- void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame);
+ void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 6dcd142bb3a..816d4459318 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -141,7 +141,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
void Toolbox::EraseRect(const Common::Rect &r) {
if (_port) {
- _drawRect(r, _port->bkPat, kPatCopy, false);
+ _drawRect(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
}
}
@@ -157,7 +157,7 @@ void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
warning("STUB: Toolbox::FillOval");
}
-void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame) {
+void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
// special case because rect fills the entire surface
@@ -169,7 +169,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
Common::Point destPos(r.left, r.top);
Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
@@ -177,9 +177,9 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
destRect.bottom -= _port->pnSize.y - 1;
if (frame) {
- pm.drawRect(destRect, _port->fgColor, &pd);
+ pm.drawRect(destRect, fgColor, &pd);
} else {
- pm.drawFilledRect(destRect, _port->fgColor, &pd);
+ pm.drawFilledRect(destRect, fgColor, &pd);
}
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
@@ -193,7 +193,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
if (_port) {
- _drawRect(r, pat, kPatCopy, false);
+ _drawRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
}
}
@@ -207,9 +207,9 @@ void Toolbox::FrameOval(const Common::Rect &r) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
Common::Point destPos(r.left, r.top);
- Graphics::MacPatterns pat({_port->pnPat.data});
+ Graphics::MacPatterns macpat({_port->pnPat.data});
- Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawEllipse(0, 0, r.width(), r.height(), _port->fgColor, false, &pd);
@@ -223,12 +223,12 @@ void Toolbox::FrameOval(const Common::Rect &r) {
void Toolbox::FrameRect(const Common::Rect &r) {
if (_port) {
- _drawRect(r, _port->pnPat, _port->pnMode, true);
+ _drawRect(r, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor);
}
}
void Toolbox::FrameRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
- warning("STUB: Toolbox::InvertRoundRect");
+ warning("STUB: Toolbox::FrameRoundRect");
}
void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
@@ -295,21 +295,10 @@ void Toolbox::InvertOval(const Common::Rect &r) {
}
void Toolbox::InvertRect(const Common::Rect &r) {
- if (_port && _port->pnVis == 0) {
- BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
- BitMap mask(nullptr);
- Common::Point destPos(r.left, r.top);
+ if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
- Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(&(*intermediate), nullptr, &macpat, 1, destPos.x, destPos.y, {1, 1}, g_engine->_wm._colorWhite);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
- pm.drawFilledRect(intermediate->getBounds(), g_engine->_wm._colorBlack, &pd);
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, kPatXor);
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ _drawRect(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
}
}
@@ -332,9 +321,9 @@ void Toolbox::LineTo(int16 h, int16 v) {
BitMap intermediate(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
BitMap mask(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
Common::Point destPos(dirVec.x < 0 ? h + dirVec.x : h - dirVec.x, dirVec.y < 0 ? v + dirVec.y : v - dirVec.y);
- Graphics::MacPatterns pat({_port->pnPat.data});
+ Graphics::MacPatterns macpat({_port->pnPat.data});
- Graphics::MacPlotData pd(&(*intermediate), &(*mask), &pat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
pm.drawLine(startPos.x, startPos.y, endPos.x, endPos.y, _port->fgColor, &pd);
@@ -400,7 +389,7 @@ void Toolbox::PaintPoly(PolyHandle poly) {
void Toolbox::PaintRect(const Common::Rect &r) {
if (_port) {
- _drawRect(r, _port->pnPat, _port->pnMode, false);
+ _drawRect(r, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor);
}
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 85408c29a2e..ef9052aca06 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -178,11 +178,20 @@ void ZBasic::coordinateWindow() {
warning("STUB: ZBasic::coordinateWindow");
}
-void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest) {
+void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims) {
GrafPtr port;
_toolbox->GetPort(port);
Common::Rect srcRect(x1, y1, x2, y2);
- dest->create(srcRect.width(), srcRect.height());
+ // Real ZBasic uses a raw array for storage.
+ // Some graphical effects expect there to be a full screen page that only has part
+ // of it copied over, so we have this flag.
+ if (preserveDims) {
+ if (srcRect.width() != dest->w) {
+ warning("ZBasic::get: differing row lengths, surface not going to draw correctly");
+ }
+ } else {
+ dest->create(srcRect.width(), srcRect.height());
+ }
_toolbox->CopyBits(port->portBits, dest, srcRect, dest->getBounds(), kSrcCopy, nullptr);
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 82d5d0d06dc..0f2b2f8f26c 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -242,7 +242,7 @@ public:
Common::U32String chr(uint16 code);
void close(int16 fileNo);
void coordinateWindow();
- void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest);
+ void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims = false);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
Common::U32String files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume);
int finderInfo(int16 &count, Common::U32String &var, OSType &type, uint16 volume);
Commit: 60699d9b6a3dfa552191b2d8dbd2d28c5815af57
https://github.com/scummvm/scummvm/commit/60699d9b6a3dfa552191b2d8dbd2d28c5815af57
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:57+02:00
Commit Message:
FOOL: Implement ZBasic file read
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/toolbox.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 26d0f0b91a8..f3b359bb8e1 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -319,7 +319,8 @@ void FoolGame::sub_128_406(int16 unk1) {
int16 FoolGame::sub_128_428() {
// 128:0428
// read a byte
- this->var_i16_30 = *(byte *)this->var_ptr_696;
+ this->var_i16_30 = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ debug(5, "Read[%04x]: %02x", this->var_ptr_696, this->var_i16_30);
this->var_ptr_696 += 1;
return this->var_i16_30;
return 0;
@@ -328,7 +329,8 @@ int16 FoolGame::sub_128_428() {
int16 FoolGame::sub_128_446() {
// 128:0446
// read a short
- this->var_i16_30 = READ_BE_INT16(this->var_ptr_696);
+ this->var_i16_30 = READ_BE_INT16(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ debug(5, "Read[%04x]: %04x", this->var_ptr_696, this->var_i16_30);
this->var_ptr_696 += 2;
return this->var_i16_30;
}
@@ -336,18 +338,20 @@ int16 FoolGame::sub_128_446() {
int32 FoolGame::sub_128_462() {
// 128:0462
// read a long
- this->var_i32_68e = READ_BE_INT32(this->var_ptr_696);
+ this->var_i32_68e = READ_BE_INT32(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ debug(5, "Read[%04x]: %08x", this->var_ptr_696, this->var_i32_68e);
this->var_ptr_696 += 4;
return this->var_i32_68e;
}
-void FoolGame::sub_128_49a() {
+Common::U32String FoolGame::sub_128_49a() {
// 128:049a
// read a pascal string
- this->var_i16_79e = *(byte *)this->var_ptr_696;
- this->var_ptr_696++;
- this->var_str_69a = Common::U32String((const char *)this->var_ptr_696, this->var_i16_79e, Common::kMacRoman);
- this->var_ptr_696 += this->var_i16_79e;
+ this->var_i16_79e = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ this->var_str_69a = Common::U32String((const char *)&arr_bytes_5dfc->data()[this->var_ptr_696+1], this->var_i16_79e, Common::kMacRoman);
+ debug(5, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.encode().c_str());
+ this->var_ptr_696 += this->var_i16_79e + 1;
+ return this->var_str_69a;
}
void FoolGame::sub_128_4da(int16 unk1) {
@@ -1060,13 +1064,14 @@ void FoolGame::sub_128_6186() {
void FoolGame::sub_128_61ec() {
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
- if (this->var_ev_46.what == 6) {
+ if (this->var_ev_46.what == kUpdateEvt) {
this->sub_128_5fb4();
}
- if (this->var_ev_46.what == 7) {
+ if (this->var_ev_46.what == kDiskEvt) {
this->sub_128_6154();
}
- } while ((this->var_ev_46.what == 0) && (this->var_ev_46.modifiers & 0x80));
+ g_toolbox->Delay(1);
+ } while ((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & 0x80));
this->var_i16_7c0 = 0;
}
@@ -1079,7 +1084,6 @@ void FoolGame::sub_128_6244() {
void FoolGame::sub_129_004() {
this->var_i16_7e6 = 0;
- warning("STUB: %s", __func__);
// 129:000a: LEA - 0x3ea(A5),A0
// 129:000e: MOVE.L - A0,-0x8ee(A5)
// 129:0012: SF - 0x8,D0
@@ -1298,13 +1302,13 @@ void FoolGame::sub_129_068() {
this->sub_129_123a();
// load sun's map tiles
- byte fakePal[768];
- Common::fill(fakePal, fakePal+3, 0xff);
- Common::fill(fakePal+3, fakePal+768, 0x00);
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
for (int i = 1; i <= 0x53; i++) {
this->arr_i32_1912c[i] = g_toolbox->GetPicture(i);
- this->arr_i32_1912c[i]->getSurface()->debugPrint(0, 0, 0, 0, 0, -1, 160, fakePal);
+ //this->arr_i32_1912c[i]->getSurface()->debugPrint(0, 0, 0, 0, 0, -1, 160, fakePal);
g_toolbox->DetachResource(this->arr_i32_1912c[i]);
}
@@ -1321,10 +1325,10 @@ void FoolGame::sub_129_068() {
g_zbasic->openR(1, g_zbasic->str(140), 1000, this->var_i16_f22);
this->var_i32_1036 = g_zbasic->readFileDblInt(1);
- this->var_ptr_696 = &this->arr_bytes_5dfc[0];
+ this->var_ptr_696 = 0;
// read into pointer
- g_zbasic->readFile(1, this->var_ptr_696, this->var_i32_1036);
+ this->arr_bytes_5dfc = g_zbasic->readFile(1, this->var_i32_1036);
// 129:0a0a
this->var_i16_68a = 0x50;
@@ -1351,11 +1355,74 @@ void FoolGame::sub_129_068() {
this->arr_curs_4d88[i].mouse.x = this->sub_128_446();
}
// 129:0ad4
+ for (int i = 0; i <= 0xf; i++) {
+ this->arr_i16_4738[i] = this->sub_128_446();
+ }
+ // 129:0b02
+ for (int i = 1; i <= 0x51; i++) {
+ this->arr_i16_4c7c[i] = this->sub_128_428();
+ }
+ // 129:0b30
+ for (int i = 1; i <= 0xc; i++) {
+ for (int j = 0; j <= 3; j++) {
+ this->arr_i16_4d20[i*4 + j] = this->sub_128_446();
+ }
+ }
+ // 129:0b78
+ this->var_i16_103a = this->sub_128_446();
+ for (int i = 1; i <= this->var_i16_103a; i++) {
+ this->arr_i16_18b2[i] = this->sub_128_446();
+ this->arr_i16_197c[i] = this->sub_128_446();
+ this->arr_str_195e8[i] = this->sub_128_49a();
+ }
+ // 129:0c0a
+ this->var_i16_103a = this->sub_128_446();
+ for (int i = 1; i <= this->var_i16_103a; i++) {
+ for (int j = 0; j <= 5; j++) {
+ this->arr_i16_16b2[i*8+j] = this->sub_128_446();
+ }
+ }
+ // 129:0c5e
+ this->var_i16_7da = this->sub_128_446();
+ for (int i = 1; i <= this->var_i16_7da; i++) {
+ this->arr_i16_1a46[i] = this->sub_128_446();
+ }
+ // 129:0c98
+ for (int i = 1; i <= this->var_i16_7da; i++) {
+ this->arr_i16_0[i*2] = this->sub_128_446();
+ this->arr_i16_0[i*2 + 1] = this->sub_128_446();
+ }
+ // 129:0ce0
+ this->var_i16_103a = this->sub_128_446();
+ for (int i = 1; i <= this->var_i16_103a; i++) {
+ this->arr_i16_1b10[i*2] = this->sub_128_446();
+ this->arr_i16_1b10[i*2 + 1] = this->sub_128_446();
+ }
+ // 129:0d3c
+ this->var_i16_103c = this->sub_128_446();
+ this->var_i16_68a = 1;
+ this->var_i16_103e = this->sub_128_428();
+ if (this->var_i16_103e & 0x8) {
+ this->var_i16_103e |= 0x8;
+ this->var_str_384 = this->sub_128_49a();
+ //g_zbasic->unk_92(this->var_i16_68a, 0, 4);
+ // 129:0d76
+ }
+ // 129:0da4
+
warning("STUB: %s", __func__);
}
void FoolGame::sub_129_123a() {
- warning("STUB: %s", __func__);
+ g_toolbox->SetPort(this->var_i32_8);
+ this->sub_128_8b4(0, 7, 0x13, this->var_i16_5a - 7, 0);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ // Loading Game text
+ this->var_str_172 = Common::U32String::format("%s%d%s", g_zbasic->str(158), this->var_i16_68a, g_zbasic->str(159));
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xe);
+ g_toolbox->DrawString(this->var_str_172);
+ g_toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_138_004() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index a72c3ef4e19..fb3190ba07b 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -25,6 +25,7 @@
#include "common/rect.h"
#include "common/str.h"
+#include "common/ustr.h"
#include "fool/toolbox.h"
namespace Fool {
@@ -47,7 +48,7 @@ public:
int16 sub_128_428();
int16 sub_128_446();
int32 sub_128_462();
- void sub_128_49a();
+ Common::U32String sub_128_49a();
void sub_128_4da(int16 unk1);
void sub_128_50e(int16 unk3, int16 unk2, int16 unk1);
void sub_128_55c(Common::U32String &unk1);
@@ -138,7 +139,7 @@ private:
int16 var_i16_68c;
uint32 var_i32_68e;
uint32 var_i32_692;
- byte *var_ptr_696;
+ uint32 var_ptr_696;
Common::U32String var_str_69a;
int16 var_i16_78a;
int16 var_i16_79e;
@@ -185,12 +186,18 @@ private:
Common::U32String var_str_f30;
int16 var_i16_1030;
int32 var_i32_1036;
+ int16 var_i16_103a;
+ int16 var_i16_103c;
+ int16 var_i16_103e;
// FIXME: bounds on the following are guessed! need to trace index range
+ int16 arr_i16_0[6969];
+ int16 arr_i16_16b2[0x100];
int16 arr_i16_18b2[101];
int16 arr_i16_197c[101];
int16 arr_i16_1a46[101];
+ int16 arr_i16_1b10[6969];
int16 arr_i16_1b90[101];
int16 arr_i16_1c5a[16];
int16 arr_i16_1c7a[16];
@@ -199,7 +206,10 @@ private:
Common::Rect arr_rect_1ec0;
Common::Rect arr_rect_1f38[3];
Common::Rect arr_rect_4338;
+ int16 arr_i16_4738[16];
int16 arr_i16_4758[6];
+ int16 arr_i16_4c7c[0x52];
+ int16 arr_i16_4d20[48];
Cursor arr_curs_4d88[0x2b]; // 0x44
Pattern arr_pat_58f4[4];
Pattern arr_pat_5b2c;
@@ -209,7 +219,7 @@ private:
Common::Rect arr_rect_5b92;
int16 arr_i16_5cbc[26];
float arr_bcd_5dbc[8];
- byte arr_bytes_5dfc[22000]; // used for data buffering
+ Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap arr_bmp_b3ec;
BitMap arr_bmp_109dc;
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 7b3afdcb669..071d077b563 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -608,8 +608,8 @@ void FoolPrologue::sub_129_004() {
// 0x053c: SF - 0x8,D0
g_zbasic->openR(1, this->var_i16_1c4, 0x400, this->var_i16_2c8);
- Common::Array<byte> payload = g_zbasic->readFile(1, this->var_i16_2ca);
- this->var_i16_2ce = Common::U32String((char *)&payload[0], this->var_i16_2ca, Common::kMacRoman);
+ Handle payload = g_zbasic->readFile(1, this->var_i16_2ca);
+ this->var_i16_2ce = Common::U32String((char *)payload->data(), this->var_i16_2ca, Common::kMacRoman);
g_zbasic->close(1);
// 0x0570: CLR.L - -0x8ee(A5)
// 129:0582
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 323f18e56bb..02c49ef77e5 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -79,7 +79,7 @@ uint32 Toolbox::Delay(uint32 numTicks) {
}
bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
- warning("STUB: Toolbox::GetNextEvent");
+ //warning("STUB: Toolbox::GetNextEvent");
_pumpEvents();
if (!_events.empty()) {
theEvent = _events.pop();
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 816d4459318..ff5da56142c 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -267,7 +267,7 @@ void Toolbox::GetPort(GrafPtr &port) {
}
void Toolbox::GlobalToLocal(Common::Point &pt) {
- warning("STUB: Toolbox::GlobalToLocal");
+ //warning("STUB: Toolbox::GlobalToLocal");
}
void Toolbox::HideCursor() {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index ef9052aca06..b16f848c496 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -171,7 +171,12 @@ void ZBasic::bufferFlush(const Common::U32String &str) {
}
void ZBasic::close(int16 fileNo) {
- warning("STUB: ZBasic::close");
+ if (this->_fileStreams.contains(fileNo)) {
+ this->_fileStreams.erase(fileNo);
+ }
+ if (this->_fileLineSize.contains(fileNo)) {
+ this->_fileLineSize.erase(fileNo);
+ }
}
void ZBasic::coordinateWindow() {
@@ -229,7 +234,16 @@ void ZBasic::menu(int16 menuNo, int16 itemNo, int16 state, const Common::U32Stri
void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
- warning("STUB: ZBasic::openR");
+ if (_fileStreams.contains(fileNo)) {
+ this->close(fileNo);
+ }
+ Common::MacResManager resMan;
+ Common::SeekableReadStream *result = resMan.openFileOrDataFork(Common::Path(fileName, ':'));
+ if (!result) {
+ error("ZBasic::openR: couldn't open %s", fileName.encode().c_str());
+ }
+ _fileStreams[fileNo] = Common::SharedPtr<Common::SeekableReadStream>(result);
+ _fileLineSize[fileNo] = lineSize;
}
void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
@@ -318,19 +332,39 @@ Common::U32String ZBasic::readDataStr() {
return result;
}
-Common::Array<byte> ZBasic::readFile(int16 fileNo, uint32 length) {
- warning("STUB: ZBasic::readFile");
- return Common::Array<byte>();
+Handle ZBasic::readFile(int16 fileNo, uint32 length) {
+ if (!_fileStreams.contains(fileNo)) {
+ error("ZBasic::readFile: unknown fileNo %d", fileNo);
+ }
+ Handle result(new Common::Array<byte>());
+ result->resize(length);
+ uint32 newLen = _fileStreams[fileNo]->read(result->data(), length);
+ if (newLen != length) {
+ result->resize(newLen);
+ }
+ return result;
}
uint32 ZBasic::readFile(int16 fileNo, byte *dest, uint32 length) {
- warning("STUB: ZBasic::readFile");
+ if (!_fileStreams.contains(fileNo)) {
+ error("ZBasic::readFile: unknown fileNo %d", fileNo);
+ }
+ length = _fileStreams[fileNo]->read(dest, length);
return length;
}
int32 ZBasic::readFileDblInt(int16 fileNo) {
- warning("STUB: ZBasic::readFileDblInt");
- return 0;
+ if (!_fileStreams.contains(fileNo)) {
+ error("ZBasic::readFileDblInt: unknown fileNo %d", fileNo);
+ }
+ return _fileStreams[fileNo]->readSint32BE();
+}
+
+int16 ZBasic::readFileInt(int16 fileNo) {
+ if (!_fileStreams.contains(fileNo)) {
+ error("ZBasic::readFileInt: unknown fileNo %d", fileNo);
+ }
+ return _fileStreams[fileNo]->readSint16BE();
}
int16 ZBasic::rndInt(int16 max) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 0f2b2f8f26c..376814f1cc6 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -25,6 +25,7 @@
#include "common/memorypool.h"
#include "common/ptr.h"
#include "common/str.h"
+#include "common/stream.h"
#include "common/ustr.h"
#include "graphics/macgui/macwindow.h"
#include "graphics/surface.h"
@@ -229,6 +230,9 @@ private:
Common::MemoryPool *_memPool;
int16 _fileId = -1;
Graphics::MacWindow *_window;
+
+ Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
+ Common::HashMap<int16, uint32> _fileLineSize;
public:
ZBasic(Toolbox *toolbox);
@@ -257,9 +261,10 @@ public:
int16 readDataInt();
int32 readDataDblInt();
Common::U32String readDataStr();
- Common::Array<byte> readFile(int16 fileNo, uint32 length);
+ Handle readFile(int16 fileNo, uint32 length);
uint32 readFile(int16 fileNo, byte *dest, uint32 length);
int32 readFileDblInt(int16 fileNo);
+ int16 readFileInt(int16 fileNo);
int16 rndInt(int16 max);
void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
Commit: f8c426bfe20cb87793086df3b73cda20c02d468f
https://github.com/scummvm/scummvm/commit/f8c426bfe20cb87793086df3b73cda20c02d468f
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:57+02:00
Commit Message:
FOOL: Implement more loader
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox.h
engines/fool/toolbox_text.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index f3b359bb8e1..40dbc3abb0e 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -831,7 +831,7 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
}
// 128:1be6
if (this->var_i16_32 == 2) {
- g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_5b2c);
+ g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_58f4[0x47]);
}
// 128:1c0a
this->sub_128_406(1);
@@ -970,6 +970,17 @@ void FoolGame::sub_128_2202() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_271a() {
+ // record index
+ this->var_i16_484 = (this->arr_i32_19454[this->var_i16_7e2] - 1) / 1000;
+ // offset at record
+ this->var_i16_7e4 = (this->arr_i32_19454[this->var_i16_7e2] - 1) % 1000;
+ g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
+
+
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_128_2808() {
warning("STUB: %s", __func__);
}
@@ -979,10 +990,109 @@ void FoolGame::sub_128_2b0a() {
}
void FoolGame::sub_128_2bc6() {
- warning("STUB: %s", __func__);
+ this->sub_128_1c4a(8);
+ this->sub_128_3774();
+ this->sub_128_3744();
+ this->var_str_8ec = g_zbasic->str(33);
+
+ this->var_i16_9ec = 0;
+ this->arr_i16_4758[0] = 0x103;
+ this->arr_i16_4758[1] = 0;
+ this->arr_i16_4758[2] = 0x1e;
+ this->arr_i16_4758[3] = 0x1fc;
+ this->arr_i16_4758[4] = 0xa050;
+ this->arr_i16_4758[5] = 0x3f7;
+ this->var_i16_484 = 0;
+ for (int j = 0; j <= 0x5; j++) {
+ // 128:2c5e
+ for (int i = 0; i <= 0xf; i++) {
+ this->var_i16_484++;
+ if (this->arr_i16_4758[j] && this->arr_i16_4738[i]) {
+ this->arr_i16_1b90[this->var_i16_484] = 1;
+ } else {
+ // 128:2ca6
+ this->arr_i16_1b90[this->var_i16_484] = 0;
+ }
+ // 128:2cb6
+ }
+ }
+ // 128:2cce
+ for (int16 i = 1; i <= 0x51; i++) {
+ this->arr_i16_4bd8[i] = i;
+ }
+ g_zbasic->unk_20();
+ // 128:2cf6
+ for (int i = 1; i <= 0x64; i++) {
+ this->var_i16_484 = g_zbasic->rndInt(0x51);
+ this->var_i16_7e4 = g_zbasic->rndInt(0x51);
+ g_zbasic->swapInt(this->arr_i16_4bd8[this->var_i16_484], this->arr_i16_4bd8[this->var_i16_7e4]);
+ this->arr_i16_1c5a[i] = 0;
+ this->arr_i16_1d24[i] = 0;
+ }
+ // 128:2d6a
+ this->var_i16_484 = 0;
+ for (int i = 1; i <= this->var_i16_7da; i++) {
+ if (this->arr_i16_1a46[i] == this->var_i16_484+1) {
+ // 128:2d9c
+ this->var_i16_484++;
+ if (this->arr_i16_1b90[i] == 1) {
+ if (this->arr_i16_197c[this->var_i16_484] != 0) {
+ this->var_i16_9f2 = 2;
+ } else {
+ this->var_i16_9f2 = 1;
+ }
+ // 128:2de2
+ this->arr_i16_1d24[this->var_i16_484] = this->var_i16_9f2 + 4;
+ }
+ // 128:2e02
+ }
+ // 128:2e02
+ }
+ // 128:2e14
+ g_zbasic->unk_333(0x2);
+ this->var_i16_7d8 = 1;
+ this->var_i16_7ce = 0;
+ this->var_i16_7e2 = 0;
+ this->var_i16_7d2 = 0;
+ this->var_i16_7b2 = 0;
+ this->sub_128_3032();
+ // 128:2e3c
}
void FoolGame::sub_128_2e3e() {
+ // 128:2e3e
+ // save game loading code?
+ this->sub_128_1c4a(0x10);
+ this->sub_128_3774();
+ this->sub_128_3744();
+ this->var_str_8ec = this->var_str_588;
+ this->var_i16_9ec = this->var_i16_688;
+ this->var_i16_7e6 = 0;
+ // FIXME: disk handler??
+ // 128:2e68: LEA - [0x3808],A0
+ // 128:2e6c: MOVE.L - A0,-0x8ee(A5)
+ // 128:2e70: SF - 0x8,D0
+ g_zbasic->openR(2, this->var_str_8ec, 0x400, this->var_i16_9ec);
+
+ this->var_str_384 = g_zbasic->readFileStr(2, 0x11);
+ this->var_i16_7d8 = g_zbasic->readFileInt(2);
+ this->var_i16_7e2 = g_zbasic->readFileInt(2);
+ this->var_i16_7ce = g_zbasic->readFileInt(2);
+ this->var_i16_7d2 = g_zbasic->readFileInt(2);
+ for (int i = 1; i <= 0x64; i++) {
+ this->arr_i16_1d24[i] = g_zbasic->readFileInt(2);
+ this->arr_i16_1c5a[i] = g_zbasic->readFileInt(2);
+ this->arr_i16_1b90[i] = g_zbasic->readFileInt(2);
+ this->var_i16_484 = g_zbasic->readFileInt(2);
+ this->var_str_384 = g_zbasic->readFileStr(2, this->var_i16_484);
+ g_zbasic->unk_334(this->var_str_384, i, 2);
+ }
+ // 128:2f54
+ warning("STUB: %s", __func__);
+
+}
+
+void FoolGame::sub_128_3032() {
warning("STUB: %s", __func__);
}
@@ -990,6 +1100,14 @@ void FoolGame::sub_128_3536() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_3744() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_3774() {
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_128_39a0() {
warning("STUB: %s", __func__);
}
@@ -1076,7 +1194,18 @@ void FoolGame::sub_128_61ec() {
}
void FoolGame::sub_128_6244() {
- warning("STUB: %s", __func__);
+ do {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ if (this->var_ev_46.what == kUpdateEvt) {
+ g_toolbox->BeginUpdate(*this->var_ev_46.windowPtr);
+ g_toolbox->EndUpdate(*this->var_ev_46.windowPtr);
+ }
+ // 128:6272
+ if (this->var_ev_46.what == kDiskEvt) {
+ this->sub_128_6154();
+ }
+ g_toolbox->Delay(1);
+ } while ((this->var_ev_46.what == kNullEvent) && ((this->var_ev_46.modifiers & 0x80) == 0));
}
// end
@@ -1272,7 +1401,7 @@ void FoolGame::sub_129_068() {
this->var_i16_484 = this->sub_128_64c(this->var_i16_f2c);
for (int i = 0; i <= 1; i++) {
// scroll background
- this->arr_i32_192c0[i] = g_toolbox->GetPicture(this->var_i16_68a + 0x54);
+ this->arr_i32_192c0[i] = g_toolbox->GetPicture(i + 0x54);
PicHandle h = this->arr_i32_192c0[i];
g_toolbox->DetachResource(h);
}
@@ -1282,6 +1411,7 @@ void FoolGame::sub_129_068() {
g_zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, this->arr_bmp_b3ec);
g_zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
// 129:0846
+ // unfurl the scroll by blitting the lower half a bunch of times
for (int i = 0; i <= 0x15; i++) {
this->var_i16_484 = g_zbasic->readDataInt();
g_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kPutCopy);
@@ -1337,8 +1467,9 @@ void FoolGame::sub_129_068() {
this->arr_i32_19454[i] = this->sub_128_462();
}
// 129:0a4e
+ // quickdraw patterns
+ // reworked slightly to fill the pattern buffer directly
for (int i = 0; i <= 0x50; i++) {
- // reworked slightly to fill the pattern buffer directly
for (int j = 0; j <= 0x7; j++) {
this->arr_pat_58f4[i].data[j] = (byte)this->sub_128_428();
}
@@ -1370,8 +1501,10 @@ void FoolGame::sub_129_068() {
}
// 129:0b78
this->var_i16_103a = this->sub_128_446();
+ // story menu entries
for (int i = 1; i <= this->var_i16_103a; i++) {
this->arr_i16_18b2[i] = this->sub_128_446();
+ this->arr_i16_15e8[i] = this->sub_128_446();
this->arr_i16_197c[i] = this->sub_128_446();
this->arr_str_195e8[i] = this->sub_128_49a();
}
@@ -1399,18 +1532,123 @@ void FoolGame::sub_129_068() {
this->arr_i16_1b10[i*2 + 1] = this->sub_128_446();
}
// 129:0d3c
+ // story text
this->var_i16_103c = this->sub_128_446();
this->var_i16_68a = 1;
- this->var_i16_103e = this->sub_128_428();
- if (this->var_i16_103e & 0x8) {
- this->var_i16_103e |= 0x8;
- this->var_str_384 = this->sub_128_49a();
- //g_zbasic->unk_92(this->var_i16_68a, 0, 4);
- // 129:0d76
+ for (int i = 1; i <= this->var_i16_103c; i++) {
+ this->var_i16_103e = this->sub_128_428();
+ if (this->var_i16_103e & 0x8) {
+ this->var_i16_103e ^= 0x8;
+ this->var_str_384 = this->sub_128_49a();
+ // 129:0d7e
+ // indent at start of story paragraph
+ g_zbasic->unk_334(g_zbasic->space(4) + this->var_str_384, 0, i);
+ } else {
+ // 129:0da4
+ g_zbasic->unk_334(this->sub_128_49a(), 0, i);
+ }
+ // 129:0db8
+ if ((this->var_i16_103e == 1) || (this->var_i16_103e == 4)) {
+ this->arr_i16_194[i] = 0;
+ }
+ // 129:0dea
+ if ((this->var_i16_103e == 2) || (this->var_i16_103e == 5)) {
+ this->arr_i16_194[i] = 1;
+ }
+ // 129:0e1e
+ if ((this->var_i16_103e == 3) || (this->var_i16_103e == 6)) {
+ this->arr_i16_194[i] = 0x19;
+ }
+ // 129:0e52
+ if (this->var_i16_103e <= 3) {
+ this->arr_i16_bbe[i] = 1;
+ }
+ // 129:0e6e
}
- // 129:0da4
+ // 129:0e80
+ this->var_i16_68a = 0x64;
+ this->sub_129_123a();
+ this->var_i16_103a = this->sub_128_446();
+ for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
+ g_zbasic->unk_334(this->sub_128_49a(), 0, i);
+ }
+ // 129:0ec2
+ for (int j = 1; j <= 0x50; j++) {
+ this->var_i16_1040 = 0;
+ for (int i = 1; i <= this->var_i16_7da; i++) {
+ if (this->arr_i16_1a46[i] == j) {
+ this->var_i16_1040++;
+ }
+ // 129:0ef4
+ if (this->arr_i16_1a46[i] < j) {
+ i = this->var_i16_7da;
+ }
+ // 129:0f16
+ }
+ if (this->var_i16_1040 > 1) {
+ this->var_i16_484 = 0;
+ for (int i = 1; i <= this->var_i16_7da; i++) {
+ if (this->arr_i16_1a46[i] == j) {
+ this->var_i16_484++;
+ this->arr_str_1a288[i] = Common::U32String::format("%s %d %s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
+ }
+ // 129:0fb6
+ if (this->arr_i16_1a46[i] < j) {
+ i = this->var_i16_7da;
+ }
+ // 129:0fd8
+ }
+ }
+ // 129:0fea
+ }
+ // 129:0ff8
+ for (int j = 1; j <= this->var_i16_7da; j++) {
+ for (int i = this->arr_i16_0[j*2]; i <= this->arr_i16_0[j*2 + 1]; i++) {
+ if (this->arr_i16_bbe[i] != 0) {
+ // 129:102e
+ this->arr_i16_1dee[j]++;
+ }
+ // 129:105a
+ }
+ // 129:107a
+ }
+ // 129:108c
+ g_toolbox->UseResFile(this->var_i16_1030);
+ this->sub_128_406(0xc8);
+ this->var_i16_7ce = 0;
+ this->var_i16_7b2 = 0xa;
+ g_toolbox->InitCursor();
+ this->sub_128_4da(1);
+ // Apple menu
+ g_zbasic->menu(1, 0, 1, g_zbasic->str(143)); // wadjet eye
+ g_zbasic->menu(1, 1, 0, g_zbasic->str(144)); // sep
+ g_zbasic->menu(1, 2, 1, g_zbasic->str(145)); // about fool's errand
+ g_zbasic->menu(1, 3, 0, g_zbasic->str(146)); // sep
+
+ // File menu
+ g_zbasic->menu(2, 0, 1, g_zbasic->str(147)); // file
+ g_zbasic->menu(2, 1, 1, g_zbasic->str(148)); // new
+ g_zbasic->menu(2, 2, 1, g_zbasic->str(149)); // open
+ g_zbasic->menu(2, 3, 1, g_zbasic->str(150)); // save
+ g_zbasic->menu(2, 4, 1, g_zbasic->str(151)); // save as
+ g_zbasic->menu(2, 5, 0, g_zbasic->str(152)); // sep
+ g_zbasic->menu(2, 6, 1, g_zbasic->str(153)); // sound
+ g_zbasic->menu(2, 7, 1, g_zbasic->str(154)); // print story
+ g_zbasic->menu(2, 8, 0, g_zbasic->str(155)); // sep
+ g_zbasic->menu(2, 9, 1, g_zbasic->str(156)); // quit
- warning("STUB: %s", __func__);
+ this->sub_128_6244();
+ // 129:11f6
+ if (g_zbasic->str(157) != this->var_str_8ec) { // empty
+ this->var_i16_7c6 = 8;
+ } else {
+ this->var_i16_7c6 = 0x10;
+ this->var_str_588 = this->var_str_8ec;
+ this->var_i16_688 = this->var_i16_9ec;
+ }
+ // 129:1236
+ // JMP - [0x19f6]
+ // SEGMENT_RETURN
}
void FoolGame::sub_129_123a() {
@@ -1418,13 +1656,125 @@ void FoolGame::sub_129_123a() {
this->sub_128_8b4(0, 7, 0x13, this->var_i16_5a - 7, 0);
g_zbasic->text(0, 0xc, 0, kSrcOr);
// Loading Game text
- this->var_str_172 = Common::U32String::format("%s%d%s", g_zbasic->str(158), this->var_i16_68a, g_zbasic->str(159));
+ this->var_str_172 = Common::U32String::format("%s %d%s", g_zbasic->str(158).encode().c_str(), this->var_i16_68a, g_zbasic->str(159).encode().c_str());
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xe);
g_toolbox->DrawString(this->var_str_172);
g_toolbox->SetPort(this->var_i32_0);
}
+void FoolGame::sub_130_004() {
+ // 130:0004
+ this->var_i16_d0c = 0;
+ this->sub_128_271a();
+ this->var_i16_1056 = this->sub_128_446();
+ this->var_i16_1058 = 1;
+ this->var_i16_105a = this->sub_128_446();
+ if ((this->var_i16_105a & 0x1) == 1) {
+ for (int i = 0; i <= 0xe; i++) {
+ this->arr_i16_1eb8[i] = this->sub_128_446();
+ }
+ }
+ // 130:0066
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_rect_1ec8.top;
+ do {
+ this->var_i16_68a = this->arr_rect_1ec8.bottom;
+ do {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a,
+ this->var_i16_68c,
+ this->var_i16_68a + this->arr_pt_1ed0.x,
+ this->var_i16_68c + this->arr_pt_1ed0.y
+ );
+ // 130:00f6
+ } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_rect_1ec8.right, this->arr_rect_1ec0.bottom));
+ // 130:0126
+ } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_rect_1ec8.left, this->arr_rect_1ec0.right));
+ // 130:0156
+ if ((this->var_i16_105a & 0x2) == this->var_i16_105a) {
+ this->var_i16_105c = this->sub_128_446();
+ this->var_i16_105e = this->sub_128_446();
+ this->var_i16_1060 = this->sub_128_446();
+ this->var_i16_1062 = this->sub_128_446();
+ this->var_i16_1064 = this->sub_128_446();
+ this->var_i16_1066 = this->sub_128_446();
+ if (this->var_i16_1066 > 0) {
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ }
+ }
+ // 130:01f0
+ this->var_i16_1068 = this->sub_128_446();
+ if (this->var_i16_1068 == 6) {
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_2f38[i*32 + j] = this->sub_128_428();
+ this->arr_i16_3b38[i*32 + j] = 0;
+ }
+ }
+ } else {
+ // 130:028a
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_2f38[i*32 + j] = 0;
+ this->arr_i16_3b38[i*32 + j] = 0;
+ }
+ }
+ }
+ // 130:0306
+ this->var_i16_103a = this->sub_128_446();
+ if (this->var_i16_103a > 0) {
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_1060]);
+ this->var_i16_484 = 0;
+ for (int j = 1; j <= this->var_i16_103a; j++) {
+ this->var_i16_106a = this->sub_128_446();
+ if (this->var_i16_106a == 0) {
+ this->var_i16_484 += 10;
+ } else {
+ // 130:035a
+ for (int i = 0; i <= 0xc; i++) {
+ this->var_i16_484++;
+ if (this->var_i16_106a && this->arr_i16_4738[i]) {
+ g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_484]);
+ }
+ }
+ // 130:039e
+
+ }
+ // 103:03aa
+ }
+ }
+ // 130:03ba
+ if (this->var_i16_105e == 2) {
+ this->var_i16_106c = 3;
+ } else {
+ this->var_i16_106c = 1;
+ }
+ // 130:03d4
+ if (this->var_i16_1068 == 4) {
+ this->sub_128_8b4(0x63, 0xae, 0x108, 0x153, 2);
+ }
+ // 130:03fe
+ //if (this->var_i16_c04 <= this->var_i16_1058)
+ this->var_i16_106e = 0;
+ this->var_str_1070 = g_zbasic->str(168); // empty
+ this->var_str_1170 = g_zbasic->str(169); // empty
+ this->var_i16_1270 = this->sub_128_446();
+ this->var_i16_103a = 1;
+ this->var_str_1272 = this->sub_128_49a();
+ this->var_i16_1372 = this->var_str_1272.size();
+ this->var_str_1170 = this->var_str_1170 + this->var_str_1272;
+ // 130:047e
+
+ // 130:0c64
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index fb3190ba07b..8935aecbd74 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -77,12 +77,16 @@ public:
void sub_128_2126();
void sub_128_21c8();
void sub_128_2202();
+ void sub_128_271a();
void sub_128_2808();
void sub_128_2b0a();
void sub_128_2bc6();
void sub_128_2e3e();
+ void sub_128_3032();
void sub_128_3536();
+ void sub_128_3744();
+ void sub_128_3774();
void sub_128_39a0();
void sub_128_4472();
@@ -100,6 +104,8 @@ public:
void sub_129_068();
void sub_129_123a();
+ void sub_130_004();
+
void sub_138_004();
void sub_144_004();
@@ -175,7 +181,9 @@ private:
int16 var_i16_7e6;
Common::U32String var_str_8ec;
int16 var_i16_9ec;
+ int16 var_i16_9f2;
+ int16 var_i16_d0c;
int16 var_i16_e20;
Common::U32String var_str_e22;
int16 var_i16_f22;
@@ -189,10 +197,32 @@ private:
int16 var_i16_103a;
int16 var_i16_103c;
int16 var_i16_103e;
+ int16 var_i16_1040;
+ int16 var_i16_1056;
+ int16 var_i16_1058;
+ int16 var_i16_105a;
+ int16 var_i16_105c;
+ int16 var_i16_105e;
+ int16 var_i16_1060;
+ int16 var_i16_1062;
+ int16 var_i16_1064;
+ int16 var_i16_1066;
+ int16 var_i16_1068;
+ int16 var_i16_106a;
+ int16 var_i16_106c;
+ int16 var_i16_106e;
+ Common::U32String var_str_1070;
+ Common::U32String var_str_1170;
+ int16 var_i16_1270;
+ Common::U32String var_str_1272;
+ int16 var_i16_1372;
// FIXME: bounds on the following are guessed! need to trace index range
- int16 arr_i16_0[6969];
+ int16 arr_i16_0[202];
+ int16 arr_i16_194[202];
+ int16 arr_i16_bbe[202];
+ int16 arr_i16_15e8[101];
int16 arr_i16_16b2[0x100];
int16 arr_i16_18b2[101];
int16 arr_i16_197c[101];
@@ -202,17 +232,22 @@ private:
int16 arr_i16_1c5a[16];
int16 arr_i16_1c7a[16];
int16 arr_i16_1d24[202];
+ int16 arr_i16_1dee[202];
int16 arr_i16_1eb8[4];
Common::Rect arr_rect_1ec0;
+ Common::Rect arr_rect_1ec8;
+ Common::Point arr_pt_1ed0;
Common::Rect arr_rect_1f38[3];
+ int16 arr_i16_2f38[0xc00]; // 96x32?
+ int16 arr_i16_3b38[0xc00]; // 96x32?
Common::Rect arr_rect_4338;
int16 arr_i16_4738[16];
- int16 arr_i16_4758[6];
+ uint16 arr_i16_4758[6];
+ int16 arr_i16_4bd8[0x52];
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[48];
Cursor arr_curs_4d88[0x2b]; // 0x44
- Pattern arr_pat_58f4[4];
- Pattern arr_pat_5b2c;
+ Pattern arr_pat_58f4[0x51];
Common::Rect arr_rect_5b7c;
Common::Rect arr_rect_5b84;
Common::Rect arr_rect_5b8c;
@@ -234,6 +269,8 @@ private:
int32 arr_i32_19454[0x65];
Common::U32String arr_str_195e8[101]; // 0x20 each
+ Common::U32String arr_str_1a288[101]; // 0x10 each
+
Common::U32String arr_str_1a8d8[7]; // 0x66 each
Common::Rect arr_rect_1ae06;
};
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 05d0781a2e9..8e3d4d68316 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -139,14 +139,6 @@ enum PatternMode : uint16 {
kNotPatBic = 15
};
-struct EventRecord {
- EventCode what;
- uint32 message;
- uint32 when;
- Common::Point where;
- uint16 modifiers;
-};
-
enum WindowDefinition {
kDocumentProc = 0,
kDBoxProc = 1,
@@ -192,6 +184,14 @@ struct WindowRecord {
uint16 windowKind;
};
+struct EventRecord {
+ EventCode what; // 0
+ uint32 message; // 2
+ WindowRecord *windowPtr; // also 2
+ uint32 when; // 6
+ Common::Point where; // 10
+ uint16 modifiers; // 14
+};
struct ToolboxResInfo {
int16 fileID;
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index dd6b5317c6c..28df36e8770 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -58,7 +58,7 @@ uint16 Toolbox::StringWidth(const Common::U32String &s) {
if (_port) {
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
uint16 result = fontRun.getFont()->getStringWidth(s);
- warning("STUB: Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
+ debug(5, "Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
return result;
}
return 0;
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index b16f848c496..e52d3f1fd68 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -367,6 +367,21 @@ int16 ZBasic::readFileInt(int16 fileNo) {
return _fileStreams[fileNo]->readSint16BE();
}
+Common::U32String ZBasic::readFileStr(int16 fileNo, int16 length) {
+ if (!_fileStreams.contains(fileNo)) {
+ error("ZBasic::readFileStr: unknown fileNo %d", fileNo);
+ }
+ warning("STUB: ZBasic::readFileStr");
+ return Common::U32String();
+}
+
+void ZBasic::record(int16 fileNo, int16 recordNo, int16 location) {
+ if (!_fileStreams.contains(fileNo)) {
+ error("ZBasic::record: unknown fileNo %d", fileNo);
+ }
+ _fileStreams[fileNo]->seek(_fileLineSize[fileNo]*recordNo + location);
+}
+
int16 ZBasic::rndInt(int16 max) {
if (max == 0)
return 0;
@@ -379,6 +394,20 @@ const Common::U32String &ZBasic::str(size_t index) {
return *_stringTable[index]->data.str;
}
+Common::U32String ZBasic::space(int16 count) {
+ Common::U32String result;
+ for (int i = 0; i < count; i++) {
+ result += Common::U32String(" ");
+ }
+ return result;
+}
+
+void ZBasic::swapInt(int16 &a, int16 &b) {
+ int16 tmp = a;
+ a = b;
+ b = tmp;
+}
+
void ZBasic::text(uint16 font, uint16 size, uint16 face, SourceMode mode) {
_toolbox->TextFont(font);
_toolbox->TextSize(size);
@@ -407,6 +436,11 @@ void ZBasic::unk_20() {
warning("STUB: ZBasic::unk_20");
}
+bool ZBasic::incrAndCheck(int16 &a0, int16 d1, int16 d0) {
+ a0 += d0;
+ return (d0 < 0) ? (a0 < d1) : (d1 < a0);
+}
+
void ZBasic::unk_44(int16 unk1) {
warning("STUB: ZBasic::unk_44");
}
@@ -427,5 +461,12 @@ void ZBasic::unk_331(uint16 unk1, int16 unk2) {
warning("STUB: ZBasic::unk_331");
}
+void ZBasic::unk_333(uint16 unk1) {
+ warning("STUB: ZBasic::unk_333");
+}
+
+void ZBasic::unk_334(const Common::U32String &unk1, int32 unk2, int32 unk3) {
+ warning("STUB: ZBasic::unk_334 - %s, %d, %d", unk1.encode().c_str(), unk2, unk3);
+}
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 376814f1cc6..840c72a4805 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -265,7 +265,11 @@ public:
uint32 readFile(int16 fileNo, byte *dest, uint32 length);
int32 readFileDblInt(int16 fileNo);
int16 readFileInt(int16 fileNo);
+ Common::U32String readFileStr(int16 fileNo, int16 length);
+ void record(int16 fileNo, int16 recordNo, int16 location);
int16 rndInt(int16 max);
+ Common::U32String space(int16 count);
+ void swapInt(int16 &a, int16 &b);
void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
@@ -276,13 +280,15 @@ public:
int16 unk_5();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
void unk_20();
+ bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
void unk_44(int16 unk1);
// string copy? dest, src
void unk_110(Common::U32String &unk1, Common::U32String &unk2);
void unk_130(int16 unk1);
void unk_158();
void unk_331(uint16 unk1, int16 unk2);
-
+ void unk_333(uint16 unk1);
+ void unk_334(const Common::U32String &unk1, int32 unk2, int32 unk3);
};
} // namespace Fool
Commit: ed05481cca72eb5b4fed27418f9cd9d49379962d
https://github.com/scummvm/scummvm/commit/ed05481cca72eb5b4fed27418f9cd9d49379962d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:58+02:00
Commit Message:
GRAPHICS: MACGUI: Allow masks for custom cursors
Changed paths:
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 76ba4c13f61..32e42ddf8c9 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -1459,7 +1459,7 @@ void MacWindowManager::replaceCustomCursor(const byte *data, int w, int h, int h
void MacWindowManager::pushCustomCursor(const Graphics::Cursor *cursor) {
CursorMan.pushCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(),
- cursor->getHotspotY(), cursor->getKeyColor());
+ cursor->getHotspotY(), cursor->getKeyColor(), NULL, cursor->getMask());
if (cursor->getPalette())
CursorMan.pushCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
Commit: 409d9dba6ac80d32ba64a6bdd868f82acee01cd6
https://github.com/scummvm/scummvm/commit/409d9dba6ac80d32ba64a6bdd868f82acee01cd6
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:58+02:00
Commit Message:
FOOL: Loader complete, story invisible
Changed paths:
A engines/fool/toolbox_menu.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_text.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 40dbc3abb0e..9998a5a227a 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -110,7 +110,7 @@ void FoolGame::sub_128_004() {
this->var_i16_7cc = -1;
}
// 128:1cbe
- if (this->var_ev_46.where.y <= 0x11d) {
+ if (this->var_ev_46.where.y > 0x11d) {
this->var_i16_7cc = 1;
}
// 128:1cce
@@ -124,17 +124,19 @@ void FoolGame::sub_128_004() {
if ((this->var_i16_7ce & 2) == 0) {
g_toolbox->InitCursor();
} else {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x20]);
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
}
// 128:1d42
} else {
// 128:1d46
if (this->var_i16_7b2 == -1) {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x4]);
+ // arrow pointing up
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x2]);
}
// 128:1d5e
if (this->var_i16_7b2 == 1) {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x2]);
+ // arrow pointing down
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x1]);
}
}
}
@@ -152,6 +154,7 @@ void FoolGame::sub_128_004() {
if (this->var_i16_7d2 && (this->var_i16_7c0 == 0x20)) {
this->sub_128_1c2c(0x100);
}
+ g_toolbox->Delay(0);
// 128:1e06
} while (this->var_i16_7c6 == 0);
@@ -557,6 +560,7 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
do {
this->sub_128_c6a(0);
this->var_i16_3a += 1;
+ g_toolbox->Delay(0);
} while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_ev_46.modifiers & 0x80) == 0));
} while ((this->var_ev_46.modifiers & 0x80) != 0);
}
@@ -880,6 +884,7 @@ void FoolGame::sub_128_1f44() {
void FoolGame::sub_128_1f76() {
// 128:1f76
+ // hold down mouse on scroll
if (this->var_i16_7cc != 0) {
do {
this->var_i32_692 = g_toolbox->TickCount();
@@ -917,6 +922,7 @@ void FoolGame::sub_128_2078() {
void FoolGame::sub_128_20d0() {
// 128:20d0
+ // change page on scroll
do {
this->var_i16_7d8 += this->var_i16_7cc;
if (this->var_i16_7d8 < 1) {
@@ -967,7 +973,90 @@ void FoolGame::sub_128_21c8() {
}
void FoolGame::sub_128_2202() {
- warning("STUB: %s", __func__);
+ // 128:2202
+ if (this->var_i16_7d8 != this->var_i16_7d4) {
+ if ((this->arr_i16_1dee[this->var_i16_7d8] < 0xe) && (this->var_i16_7de > 0)) {
+ this->sub_128_69c(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
+ g_zbasic->get(0x3c, 0x122 - (0xf - this->arr_i16_1dee[this->var_i16_7d8]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
+ this->var_i16_7e0 = 1;
+ } else {
+ // 128:22d4
+ this->var_i16_7e0 = 0;
+ }
+ }
+ // 128:22da
+ this->sub_128_8b4(0x127, 0x69, 0x138, 0x190, 0);
+ this->var_i16_7d0 = this->arr_i16_1a46[this->var_i16_7d8];
+ if ((this->var_i16_7ce & 0x8) != 0) {
+ this->var_i16_7ce ^= 0x8;
+ this->sub_128_bde(1, 0, 0, 0, 1, 0);
+ this->sub_128_bde(1, 0, 0, 0, 0, 0);
+ }
+ // 128:235e
+ if (this->arr_i16_18b2[this->var_i16_7d0] > 0) {
+ this->var_str_384 = g_zbasic->str(10); // ?
+ if (this->arr_i16_1c5a[this->var_i16_7d0] == 0x63) {
+ this->var_str_384 = g_zbasic->str(11); // ~
+ }
+ // 128:23b8
+ if (this->arr_i16_1c5a[this->var_i16_7d0] >= 0x64) {
+ this->var_str_384 = g_zbasic->str(12); // *
+ }
+ // 128:23e8
+ this->sub_128_55c(this->var_str_384);
+ // 128:23f0: CLR.W - -0x772(A5)
+ this->var_i16_7d6 = 1;
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_toolbox->MoveTo(0x8a, 0x133);
+ g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
+ } else {
+ // 128:2430
+ this->var_i16_7d6 = 0;
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_toolbox->MoveTo(0x70, 0x133);
+ g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
+ }
+ // 128:2468
+ if (this->arr_str_1a288[this->var_i16_7d8] != g_zbasic->str(13)) { // blank
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ g_toolbox->DrawString(this->arr_str_1a288[this->var_i16_7d8]);
+ }
+ // 128:24be
+ if (this->var_i16_7d8 != this->var_i16_7d4) {
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ this->sub_128_8b4(0x2f, 0x37, 0x11f, 0x1db, 0);
+ if (this->var_i16_7e0 == 0) {
+ g_zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kPutCopy);
+ }
+ // 128:252a
+ // y-position where the story text should start
+ this->var_i16_7a2 = 0x11d - (this->arr_i16_1dee[this->var_i16_7d8] * 0xf);
+ if (this->arr_i16_1dee[this->var_i16_7da] < 0xf) {
+ g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
+ g_toolbox->DrawString(g_zbasic->str(14)); // infinity symbol
+ this->var_i16_7de = this->var_i16_7a2 - 0x1e;
+ } else {
+ // 128:25a6
+ this->var_i16_7de = this->var_i16_7a2 - 0xf;
+ }
+ // 128:25b6
+ // printing the story to the screen
+ g_toolbox->MoveTo(0x41, this->var_i16_7a2);
+ for (int i = this->arr_i16_0[this->var_i16_7d8*2]; i <= this->arr_i16_0[this->var_i16_7d8*2+1]; i++) {
+ g_toolbox->TextFace(this->arr_i16_194[i]);
+ this->var_str_384 = g_zbasic->index(0, i);
+ g_toolbox->DrawString(this->var_str_384);
+ if (this->arr_i16_bbe[i] != 0) {
+ // 128:262a
+ this->var_i16_7a2 += 0xf;
+ g_toolbox->MoveTo(0x41, this->var_i16_7a2);
+ }
+ // 128:263a
+ }
+ // 128:265c
+ this->var_i16_7d4 = this->var_i16_7d8;
+ }
+ // 128:2662
}
void FoolGame::sub_128_271a() {
@@ -1007,7 +1096,8 @@ void FoolGame::sub_128_2bc6() {
// 128:2c5e
for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
- if (this->arr_i16_4758[j] && this->arr_i16_4738[i]) {
+ // arr_i16_4738 is 1 << i
+ if (this->arr_i16_4758[j] & this->arr_i16_4738[i]) {
this->arr_i16_1b90[this->var_i16_484] = 1;
} else {
// 128:2ca6
@@ -1085,7 +1175,7 @@ void FoolGame::sub_128_2e3e() {
this->arr_i16_1b90[i] = g_zbasic->readFileInt(2);
this->var_i16_484 = g_zbasic->readFileInt(2);
this->var_str_384 = g_zbasic->readFileStr(2, this->var_i16_484);
- g_zbasic->unk_334(this->var_str_384, i, 2);
+ g_zbasic->indexSet(this->var_str_384, i, 2);
}
// 128:2f54
warning("STUB: %s", __func__);
@@ -1093,7 +1183,73 @@ void FoolGame::sub_128_2e3e() {
}
void FoolGame::sub_128_3032() {
- warning("STUB: %s", __func__);
+ this->var_i16_7d0 = 0;
+ this->var_i16_7c6 = 0;
+ this->var_i16_484 = 0;
+ this->var_i16_68c = 3;
+ for (int j = 3; j <= 7; j++) {
+ this->var_str_384 = g_zbasic->str(37) + g_zbasic->chr(0x7d+j) + g_zbasic->str(38);
+ g_zbasic->menu(j, 0, 1, this->var_str_384);
+ for (int i = 1; i <= 0x10; i++) {
+ this->var_i16_484++;
+ this->var_i16_9f2 = this->arr_i16_1d24[this->var_i16_484] & 3;
+ if (this->arr_i16_1c5a[this->var_i16_484] == 0x63) {
+ this->var_str_384 = g_zbasic->str(39);
+ } else {
+ // 128:30e4
+ this->var_str_384 = g_zbasic->str(40);
+ }
+ // 128:30f8
+ this->var_str_9f4 = this->arr_str_195e8[this->var_i16_484] + this->var_str_384;
+ if ((j == 3) && (i == 1)) {
+ this->var_str_9f4 = g_zbasic->str(41) + this->var_str_9f4;
+ }
+ // 128:315e
+ g_zbasic->menu(j, i, this->var_i16_9f2, this->var_str_9f4);
+ }
+ // 128:3180
+ }
+ // 128:318e
+ this->sub_128_8b4(0x13, 0x37, 0x32, 0xc8, 0);
+ this->sub_128_8b4(0x2f, 0x37, 0x11f, 0x1db, 0x0);
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ this->var_i16_7a2 = 0x3c;
+ this->var_i16_7de = 0x2d;
+ for (int i = 1; i <= 0xf; i++) {
+ // 128:31ec
+ g_toolbox->MoveTo(0x41, this->var_i16_7a2);
+ this->var_str_384 = g_zbasic->index(0, i);
+ g_toolbox->DrawString(this->var_str_384);
+ this->var_i16_7a2 += 0xf;
+ }
+ // 128:3228
+ this->sub_128_0a2(0, 0);
+ this->var_i16_7d4 = 1;
+ this->sub_128_2202();
+ if ((this->var_i16_7ce & 1) == 0) {
+ this->sub_128_378a();
+ } else {
+ if ((this->var_i16_7e2 > 0) && (this->var_i16_7e2 <= 0x50)) {
+ this->sub_128_1c2c(0x80);
+ } else {
+ this->sub_128_1c2c(0x100);
+ }
+ }
+ // 128:3294
+ this->sub_128_32c8();
+ if (this->var_i16_7d2 == 0) {
+ g_zbasic->menu(2, 7, 0, Common::U32String());
+ } else {
+ g_zbasic->menu(2, 7, 1, Common::U32String());
+ }
+}
+
+void FoolGame::sub_128_32c8() {
+ if (this->var_i16_378 == 0) {
+ g_zbasic->menu(2, 6, 1, Common::U32String());
+ } else {
+ g_zbasic->menu(2, 6, 0x86, Common::U32String());
+ }
}
void FoolGame::sub_128_3536() {
@@ -1101,11 +1257,38 @@ void FoolGame::sub_128_3536() {
}
void FoolGame::sub_128_3744() {
- warning("STUB: %s", __func__);
+ // 128:3744
+ for (int i = 3; i <= 7; i++) {
+ this->var_i32_bf8 = g_toolbox->GetMHandle(i);
+ g_toolbox->DeleteMenu(i);
+ g_toolbox->DisposeMenu(this->var_i32_bf8);
+ }
+ g_toolbox->DrawMenuBar();
}
+// watch cursor
void FoolGame::sub_128_3774() {
- warning("STUB: %s", __func__);
+ // 128:3774
+ g_toolbox->SetCursor(this->arr_curs_4d88[3]);
+ this->var_i16_7b2 = 0xa;
+}
+
+// exploding watch cursor
+void FoolGame::sub_128_378a() {
+ // 128:378a
+ for (int j = 0; j <= 1; j++) {
+ for (int i = 3; i <= 6; i++) {
+ g_toolbox->SetCursor(this->arr_curs_4d88[i]);
+ this->sub_128_3da(3);
+ }
+ // 128:37c2
+ }
+ for (int i = 7; i <= 0xf; i++) {
+ g_toolbox->SetCursor(this->arr_curs_4d88[i]);
+ this->sub_128_3da(4);
+ }
+
+ this->var_i16_7b2 = 0xa;
}
void FoolGame::sub_128_39a0() {
@@ -1137,13 +1320,44 @@ void FoolGame::sub_128_4472() {
}
void FoolGame::sub_128_5b30() {
- warning("STUB: %s", __func__);
+ // 128:5b30
+ if (this->var_i16_e12 == 0) {
+ this->var_ev_46.what = kNullEvent;
+ if (this->var_i16_e14 != 0) {
+ this->sub_128_5ef0();
+ }
+ this->var_i32_bf8 = g_toolbox->MenuSelect(this->var_ev_46.where);
+ this->var_i16_e16 = (uint16)(this->var_i32_bf8 >> 16);
+ this->var_i16_e18 = (uint16)(this->var_i32_bf8 & 0xffff);
+ if (this->var_i16_e16 > 0) {
+ // 128:5b8c
+ this->sub_128_5c20();
+ g_toolbox->HiliteMenu(0);
+ }
+ // 128:5b94
+ if (this->var_i16_e14 != 0) {
+ this->sub_128_5f16();
+ }
+ this->sub_128_61ec();
+ }
}
void FoolGame::sub_128_5baa() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_5c20() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_5ef0() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_5f16() {
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_128_5f9e() {
warning("STUB: %s", __func__);
}
@@ -1206,6 +1420,7 @@ void FoolGame::sub_128_6244() {
}
g_toolbox->Delay(1);
} while ((this->var_ev_46.what == kNullEvent) && ((this->var_ev_46.modifiers & 0x80) == 0));
+ // SEGMENT_RETURN
}
// end
@@ -1476,14 +1691,16 @@ void FoolGame::sub_129_068() {
}
// 129:0a8a
for (int i = 1; i <= 0x2a; i++) {
+ this->arr_curs_4d88[i] = Common::SharedPtr<Cursor>(new Cursor());
for (int j = 0; j < 16; j++) {
- this->arr_curs_4d88[i].data[j] = (uint16)this->sub_128_446();
+ this->arr_curs_4d88[i]->data[j] = (uint16)this->sub_128_446();
}
for (int j = 0; j < 16; j++) {
- this->arr_curs_4d88[i].mask[j] = (uint16)this->sub_128_446();
+ this->arr_curs_4d88[i]->mask[j] = (uint16)this->sub_128_446();
}
- this->arr_curs_4d88[i].mouse.y = this->sub_128_446();
- this->arr_curs_4d88[i].mouse.x = this->sub_128_446();
+ this->arr_curs_4d88[i]->mouse.y = this->sub_128_446();
+ this->arr_curs_4d88[i]->mouse.x = this->sub_128_446();
+ this->arr_curs_4d88[i]->render();
}
// 129:0ad4
for (int i = 0; i <= 0xf; i++) {
@@ -1542,10 +1759,10 @@ void FoolGame::sub_129_068() {
this->var_str_384 = this->sub_128_49a();
// 129:0d7e
// indent at start of story paragraph
- g_zbasic->unk_334(g_zbasic->space(4) + this->var_str_384, 0, i);
+ g_zbasic->indexSet(g_zbasic->space(4) + this->var_str_384, 0, i);
} else {
// 129:0da4
- g_zbasic->unk_334(this->sub_128_49a(), 0, i);
+ g_zbasic->indexSet(this->sub_128_49a(), 0, i);
}
// 129:0db8
if ((this->var_i16_103e == 1) || (this->var_i16_103e == 4)) {
@@ -1570,7 +1787,7 @@ void FoolGame::sub_129_068() {
this->sub_129_123a();
this->var_i16_103a = this->sub_128_446();
for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
- g_zbasic->unk_334(this->sub_128_49a(), 0, i);
+ g_zbasic->indexSet(this->sub_128_49a(), 0, i);
}
// 129:0ec2
for (int j = 1; j <= 0x50; j++) {
@@ -1639,9 +1856,11 @@ void FoolGame::sub_129_068() {
this->sub_128_6244();
// 129:11f6
- if (g_zbasic->str(157) != this->var_str_8ec) { // empty
+ if (g_zbasic->str(157) == this->var_str_8ec) { // empty
+ // cold start
this->var_i16_7c6 = 8;
} else {
+ // loading a save game
this->var_i16_7c6 = 0x10;
this->var_str_588 = this->var_str_8ec;
this->var_i16_688 = this->var_i16_9ec;
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 8935aecbd74..4df3599b25e 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -84,14 +84,19 @@ public:
void sub_128_2e3e();
void sub_128_3032();
+ void sub_128_32c8();
void sub_128_3536();
void sub_128_3744();
void sub_128_3774();
+ void sub_128_378a();
void sub_128_39a0();
void sub_128_4472();
void sub_128_5b30();
void sub_128_5baa();
+ void sub_128_5c20();
+ void sub_128_5ef0();
+ void sub_128_5f16();
void sub_128_5f9e();
void sub_128_5fb4();
void sub_128_5fea();
@@ -176,14 +181,23 @@ private:
int16 var_i16_7d8;
int16 var_i16_7da;
int16 var_i16_7dc;
+ int16 var_i16_7de;
+ int16 var_i16_7e0;
int16 var_i16_7e2;
int16 var_i16_7e4;
int16 var_i16_7e6;
Common::U32String var_str_8ec;
int16 var_i16_9ec;
int16 var_i16_9f2;
+ Common::U32String var_str_9f4;
+
+ MenuHandle var_i32_bf8;
int16 var_i16_d0c;
+ int16 var_i16_e12;
+ int16 var_i16_e14;
+ int16 var_i16_e16;
+ int16 var_i16_e18;
int16 var_i16_e20;
Common::U32String var_str_e22;
int16 var_i16_f22;
@@ -246,7 +260,7 @@ private:
int16 arr_i16_4bd8[0x52];
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[48];
- Cursor arr_curs_4d88[0x2b]; // 0x44
+ Common::SharedPtr<Cursor> arr_curs_4d88[0x2b]; // 0x44
Pattern arr_pat_58f4[0x51];
Common::Rect arr_rect_5b7c;
Common::Rect arr_rect_5b84;
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 071d077b563..fd41a813e49 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -448,7 +448,6 @@ void FoolPrologue::sub_128_ee0() {
void FoolPrologue::sub_128_f0a() {
// g_zbasic->pushOldCodeResource(0x80); // switch CODE resource?
- this->sub_129_004();
}
// Sources:
@@ -669,7 +668,6 @@ void FoolPrologue::sub_129_764() {
void FoolPrologue::sub_129_772() {
// g_zbasic->pushOldCodeResource(0x81);
- this->prologueRun();
}
void FoolPrologue::prologueRun() {
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 421e065a38e..b4341078c8c 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS = \
fool_prologue.o \
toolbox.o \
toolbox_fileman.o \
+ toolbox_menu.o \
toolbox_quickdraw.o \
toolbox_resman.o \
toolbox_text.o \
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 02c49ef77e5..5452fb844fc 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -41,17 +41,22 @@ void Toolbox::_pumpEvents() {
EventRecord newRecord;
newRecord.when = this->TickCount();
switch (event.type) {
+ case Common::EVENT_MOUSEMOVE:
+ _mouse = event.mouse;
+ break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
newRecord.what = kMouseDown;
- newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
+ newRecord.where = event.mouse;
_events.push(newRecord);
+ _mouse = event.mouse;
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
newRecord.what = kMouseUp;
- newRecord.where = Common::Point(event.mouse.x, event.mouse.y);
+ newRecord.where = event.mouse;
_events.push(newRecord);
+ _mouse = event.mouse;
break;
case Common::EVENT_QUIT:
case Common::EVENT_RETURN_TO_LAUNCHER:
@@ -85,6 +90,7 @@ bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
theEvent = _events.pop();
} else {
theEvent.what = kNullEvent;
+ theEvent.where = _mouse;
// pretend mouse button is up
theEvent.modifiers = 0x80;
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 8e3d4d68316..0e3bdccbf3a 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -22,12 +22,14 @@
#ifndef FOOL_TOOLBOX_H
#define FOOL_TOOLBOX_H
+#include "common/bitstream.h"
#include "common/hashmap.h"
#include "common/system.h"
#include "common/macresman.h"
#include "common/str.h"
#include "common/ustr.h"
+#include "graphics/cursor.h"
#include "image/pict.h"
#include "graphics/framelimiter.h"
#include "graphics/macgui/macwindow.h"
@@ -48,6 +50,7 @@ typedef Common::SharedPtr<Image::PICTDecoder> PicHandle;
// BitMap is the monochrome surface format.
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Handle PolyHandle;
+typedef uint32 MenuHandle;
typedef uint32 ResType;
typedef size_t Size;
@@ -87,10 +90,38 @@ struct Pattern {
uint8 data[8];
};
-struct Cursor {
+class Cursor: public Graphics::Cursor {
+public:
uint16 data[16];
uint16 mask[16];
Common::Point mouse;
+
+ void render() {
+ for (int y = 0; y < 16; y++) {
+ for (int x = 0; x < 16; x++) {
+ this->_surface[y*16+x] = (this->data[y] & (1 << x)) ? 1 : 0;
+ this->_mask[y*16+x] = (this->mask[y] & (1 << x)) ? kCursorMaskOpaque : kCursorMaskTransparent;
+ }
+ }
+ }
+
+ virtual uint16 getWidth() const { return 16; }
+ virtual uint16 getHeight() const { return 16; }
+ virtual uint16 getHotspotX() const { return mouse.x; }
+ virtual uint16 getHotspotY() const { return mouse.y; }
+ virtual byte getKeyColor() const { return 3; }
+ virtual const byte *getSurface() const { return _surface; }
+ virtual const byte *getMask() const { return _mask; }
+ virtual const byte *getPalette() const { return _palette; }
+ virtual byte getPaletteStartIndex() const { return 0; }
+ virtual uint16 getPaletteCount() const { return _paletteCount; }
+
+
+private:
+ byte _surface[16*16] = { 0 };
+ byte _mask[16*16] = { 0 };
+ byte _palette[6] = { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 };
+ uint16 _paletteCount = 2;
}; // 0x44
struct RGBColor {
@@ -384,6 +415,58 @@ public:
void UseResFile(int16 refNum);
+ // toolbox_menu.cpp
+
+ // PROCEDURE ClearMenuBar;
+ // Call ClearMenuBar to remove all menus from the menu list when you want to start afresh with all
+ // new menus. Be sure to call DrawMenuBar to update the menu bar.
+ void ClearMenuBar();
+
+ // PROCEDURE DeleteMenu(menuID: INTEGER);
+ // DeleteMenu deletes a menu from the menu list. If there's no menu with the given menu ID in the
+ // menu list, DeleteMenu has no effect. Be sure to call DrawMenuBar to update the menu bar; the
+ // menu tides following the deleted menu will move over to fill the vacancy.
+ void DeleteMenu(uint16 menuID);
+
+ // PROCEDURE DrawMenuBar;
+ // DrawMenuBar redraws the menu bar according to the menu list, incorporating any changes since
+ // the last call to DrawMenuBar. This procedure should always be called after a sequence of
+ // InsertMenu or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other routine that
+ // changes the menu list.
+ void DrawMenuBar();
+
+ // PROCEDURE DisposeMenu(theMenu: MenuHandle);
+ // Call DisposeMenu to release the memory occupied by a menu that you allocated with NewMenu.
+ // (For menus read from a resource file with GetMenu, use the Resource Manager procedure
+ // ReleaseResource instead.) This is useful if you've created temporary menus that you no longer
+ // need.
+ void DisposeMenu(MenuHandle &theMenu);
+
+ // FUNCTION GetMHandle(menuID: INTEGER): MenuHandle;
+ // Given the menu ID of a menu currentiy installed in the menu list, GetMHandle returns a handle to
+ // that menu; given any other menu ID, it returns NIL.
+ MenuHandle GetMHandle(uint16 menuID);
+
+ // PROCEDURE HiliteMenu(menuID: INTEGER);
+ // HiliteMenu highlights the title of the given menu, or does nothing if the tide is already
+ // highlighted. Since only one menu tide can be highlighted at a time, it unhighlights any previously
+ // highlighted menu tide. If menuID is 0 (or isn't the ID of any menu in the menu list), HiliteMenu
+ // simply unhighlights whichever menu title is highlighted (if any).
+ void HiliteMenu(uint16 menuID);
+
+ // FUNCTION MenuSelect(startPt: Point): LONGINT;
+ // When there's a mouse-down event in the menu bar, the application should call MenuSelect with
+ // startPt equal to the point (in global coordinates) where the mouse button was pressed.
+ // MenuSelect keeps control until the mouse button is released, tracking the mouse, pulling down
+ // menus as needed, and highlighting enabled menu items under the cursor. When the mouse button
+ // is released over an enabled item in an application menu, MenuSelect returns a long integer whose
+ // high-order word is the menu ED of the menu, and whose low-order word is the menu item
+ // number for the item chosen (see Figure 3). It leaves the selected menu tide highlighted. After
+ // performing the chosen task, your application should call HiliteMenu(O) to remove the
+ // highlighting from the menu title.
+ uint32 MenuSelect(const Common::Point &startPt);
+
+
// toolbox_quickdraw.cpp
// PROCEDURE BeginUpdate (theWindow: WindowPtr);
@@ -395,11 +478,6 @@ public:
// BeginUpdate must be balanced by a call to EndUpdate.
void BeginUpdate(WindowRecord &theWindow);
- // PROCEDURE ClearMenuBar;
- // Call ClearMenuBar to remove all menus from the menu list when you want to start afresh with all
- // new menus. Be sure to call DrawMenuBar to update the menu bar.
- void ClearMenuBar();
-
// PROCEDURE ClipRect (r: Rect);
// ClipRect changes the clipping region of the current grafPort to a rectangle that's equivalent to the
// given rectangle. Note that this doesn't change the region handle, but affects the clipping region
@@ -428,13 +506,6 @@ public:
// procedure draws the picture that you specify in the myPicture parameter.
void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
- // PROCEDURE DrawMenuBar;
- // DrawMenuBar redraws the menu bar according to the menu list, incorporating any changes since
- // the last call to DrawMenuBar. This procedure should always be called after a sequence of
- // InsertMenu or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other routine that
- // changes the menu list.
- void DrawMenuBar();
-
// PROCEDURE EraseRect (r: Rect);
// Using the patCopy pattern mode, the EraseRect procedure draws the interior of the
// rectangle that you specify in the r parameter with the background pattern for the current
@@ -679,7 +750,7 @@ public:
// closely matches the specified RGB.
void SetCPixel(int16 h, int16 v, const RGBColor &cPix);
- void SetCursor(const Cursor &crsr);
+ void SetCursor(const Common::SharedPtr<Cursor> &crsr);
// PROCEDURE SetPort (port: GrafPtr);
// SetPort makes the specified grafPort the current port.
@@ -753,7 +824,9 @@ private:
Common::HashMap<Handle, ToolboxResInfo> _resInfo;
Common::HashMap<PicHandle, Handle> _resPicts;
Graphics::FrameLimiter *_frameLimiter = nullptr;
+ Common::SharedPtr<Cursor> _cursor;
int _cursorLevel = 0;
+ Common::Point _mouse;
Common::Queue<EventRecord> _events;
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
new file mode 100644
index 00000000000..8580c05f203
--- /dev/null
+++ b/engines/fool/toolbox_menu.cpp
@@ -0,0 +1,64 @@
+/* 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 "graphics/macgui/mactext-canvas.h"
+#include "graphics/macgui/mactext.h"
+#include "graphics/managed_surface.h"
+#include "graphics/pixelformat.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+#include "fool/utils.h"
+
+namespace Fool {
+
+void Toolbox::ClearMenuBar() {
+ warning("STUB: Toolbox::ClearMenuBar");
+}
+
+void Toolbox::DeleteMenu(uint16 menuID) {
+ warning("STUB: Toolbox::DeleteMenu");
+}
+
+void Toolbox::DrawMenuBar() {
+ warning("STUB: Toolbox::DrawMenuBar");
+}
+
+void Toolbox::DisposeMenu(MenuHandle &theMenu) {
+ warning("STUB: Toolbox::DisposeMenu");
+}
+
+MenuHandle Toolbox::GetMHandle(uint16 menuID) {
+ warning("STUB: Toolbox::GetMHandle");
+ return MenuHandle();
+}
+
+void Toolbox::HiliteMenu(uint16 menuID) {
+ warning("STUB: Toolbox::HiliteMenu");
+}
+
+uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
+ warning("STUB: Toolbox::MenuSelect");
+ return 0;
+}
+
+
+} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index ff5da56142c..a9a7875c722 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -22,6 +22,7 @@
#include "common/memstream.h"
#include "common/system.h"
+#include "graphics/cursor.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/managed_surface.h"
#include "image/pict.h"
@@ -36,10 +37,6 @@ void Toolbox::BeginUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::BeginUpdate");
}
-void Toolbox::ClearMenuBar() {
- warning("STUB: Toolbox::ClearMenuBar");
-}
-
void Toolbox::ClosePoly() {
warning("STUB: Toolbox::ClosePoly");
}
@@ -110,10 +107,6 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
}
}
-void Toolbox::DrawMenuBar() {
- warning("STUB: Toolbox::DrawMenuBar");
-}
-
void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
const Graphics::Surface *surface = myPicture->getSurface();
const Graphics::Palette &palette = myPicture->getPalette();
@@ -276,8 +269,11 @@ void Toolbox::HideCursor() {
}
void Toolbox::InitCursor() {
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
_cursorLevel = 0;
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ if (_cursor) {
+ _cursor = nullptr;
+ }
}
void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
@@ -439,8 +435,10 @@ void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
warning("STUB: Toolbox::SetCPixel");
}
-void Toolbox::SetCursor(const Cursor &crsr) {
- warning("STUB: Toolbox::SetCursor");
+void Toolbox::SetCursor(const Common::SharedPtr<Cursor> &crsr) {
+ _cursor = crsr;
+ if (_cursorLevel == 0)
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, crsr.get());
}
void Toolbox::SetPort(GrafPtr port) {
@@ -463,8 +461,13 @@ void Toolbox::SetRect(Common::Rect &r, int16 left, int16 top, int16 right, int16
void Toolbox::ShowCursor() {
if (_cursorLevel < 0)
_cursorLevel++;
- if (_cursorLevel == 0)
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ if (_cursorLevel == 0) {
+ if (_cursor) {
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, _cursor.get());
+ } else {
+ g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ }
+ }
}
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index 28df36e8770..45696b2f685 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -36,6 +36,7 @@ void Toolbox::DrawChar(Common::u32char_type_t ch) {
void Toolbox::DrawString(const Common::U32String &s) {
if (_port) {
+ debugN(5, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
const Graphics::Font *font = fontRun.getFont();
Common::Rect bbox = font->getBoundingBox(s);
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index e52d3f1fd68..1dbf6bc4735 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -465,8 +465,34 @@ void ZBasic::unk_333(uint16 unk1) {
warning("STUB: ZBasic::unk_333");
}
-void ZBasic::unk_334(const Common::U32String &unk1, int32 unk2, int32 unk3) {
- warning("STUB: ZBasic::unk_334 - %s, %d, %d", unk1.encode().c_str(), unk2, unk3);
+void ZBasic::indexSet(const Common::U32String &value, int16 table, int16 index) {
+ if (index < 0) {
+ warning("ZBasic::indexSet: index must be positive, not %d", index);
+ return;
+ }
+ if (!_index.contains(table)) {
+ _index[table] = Common::Array<Common::U32String>();
+ }
+ if (_index[table].size() <= index) {
+ _index[table].resize(index+1);
+ }
+ _index[table][index] = value;
+}
+
+Common::U32String ZBasic::index(int16 table, int16 index) {
+ if (index < 0) {
+ warning("ZBasic::index: index must be positive, not %d", index);
+ return Common::U32String();
+ }
+ if (!_index.contains(table)) {
+ warning("ZBasic::index: table %d not found", table);
+ return Common::U32String();
+ }
+ if (_index[table].size() <= index) {
+ warning("ZBasic::index: asked for index %d but only %d entries in table %d", index, _index[table].size(), table);
+ return Common::U32String();
+ }
+ return _index[table][index];
}
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 840c72a4805..7fd7cdb2c13 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -233,6 +233,8 @@ private:
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
Common::HashMap<int16, uint32> _fileLineSize;
+ Common::HashMap<int16, Common::Array<Common::U32String>> _index;
+
public:
ZBasic(Toolbox *toolbox);
@@ -288,7 +290,8 @@ public:
void unk_158();
void unk_331(uint16 unk1, int16 unk2);
void unk_333(uint16 unk1);
- void unk_334(const Common::U32String &unk1, int32 unk2, int32 unk3);
+ void indexSet(const Common::U32String &value, int16 table, int16 index);
+ Common::U32String index(int16 table, int16 index);
};
} // namespace Fool
Commit: d717a6581a62d2ee89a6140a9df91a5c38215fb5
https://github.com/scummvm/scummvm/commit/d717a6581a62d2ee89a6140a9df91a5c38215fb5
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:58+02:00
Commit Message:
MACGUI: Fix insert, allow font overrides for MacMenu
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 7afcef4b646..5bb6efd23aa 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -485,7 +485,7 @@ void MacMenu::insertMenuItem(MacMenuSubMenu *submenu, const Common::String &text
return;
}
- if (pos >= submenu->items.size()) {
+ if (pos > submenu->items.size()) {
_dimensionsDirty = false;
return;
}
@@ -525,7 +525,7 @@ void MacMenu::insertMenuItem(MacMenuSubMenu *submenu, const Common::U32String &t
return;
}
- if (pos >= submenu->items.size()) {
+ if (pos > submenu->items.size()) {
_dimensionsDirty = false;
return;
}
@@ -674,6 +674,8 @@ int MacMenu::getAction(MacMenuItem *menuItem) {
}
void MacMenu::clearSubMenu(int id) {
+ if ((id < 0) || ((uint)id >= _items.size()))
+ return;
MacMenuItem *menu = _items[id];
if (menu->submenu == nullptr)
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 1c00a31264a..7b617025b81 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -149,6 +149,8 @@ public:
bool isVisible() { return _isVisible; }
void setVisible(bool visible, bool silent = false) override { _isVisible = visible; _contentIsDirty = true; }
+ void setFont(const Font *font) { _font = font; }
+
void printMenu(int level = 0, MacMenuSubMenu *submenu = nullptr);
virtual void closeMenu();
Commit: 210526284192ba870518abd6afa9518d976856f7
https://github.com/scummvm/scummvm/commit/210526284192ba870518abd6afa9518d976856f7
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:59+02:00
Commit Message:
FOOL: Menu now renders
Changed paths:
engines/fool/detection.cpp
engines/fool/detection.h
engines/fool/fool.cpp
engines/fool/fool.h
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/toolbox.h
engines/fool/toolbox_menu.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_text.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/detection.cpp b/engines/fool/detection.cpp
index 6ba2543f2e3..271f002e0d8 100644
--- a/engines/fool/detection.cpp
+++ b/engines/fool/detection.cpp
@@ -32,10 +32,7 @@
const DebugChannelDef FoolMetaEngineDetection::debugFlagList[] = {
{ Fool::kDebugGraphics, "Graphics", "Graphics debug level" },
- { Fool::kDebugPath, "Path", "Pathfinding debug level" },
- { Fool::kDebugFilePath, "FilePath", "File path debug level" },
- { Fool::kDebugScan, "Scan", "Scan for unrecognised games" },
- { Fool::kDebugScript, "Script", "Enable debug script dump" },
+ { Fool::kDebugLoading, "Loading", "Loading debug level" },
DEBUG_CHANNEL_END
};
diff --git a/engines/fool/detection.h b/engines/fool/detection.h
index 89959fb45c2..3c6c29e4756 100644
--- a/engines/fool/detection.h
+++ b/engines/fool/detection.h
@@ -34,10 +34,7 @@ struct FOOLGameDescription {
enum FoolDebugChannels {
kDebugGraphics = 1 << 0,
- kDebugPath = 1 << 1,
- kDebugScan = 1 << 2,
- kDebugFilePath = 1 << 3,
- kDebugScript = 1 << 4,
+ kDebugLoading = 1 << 1,
};
extern const PlainGameDescriptor foolGames[];
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index fda0cb212a3..d1b619c91be 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -63,9 +63,6 @@ Common::Error FoolEngine::run() {
_screen.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_wm.setScreen(&_screen);
- // Menu
- _menu = _wm.addMenu();
-
//FoolPrologue fp;
//fp.run();
FoolGame fg;
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
index 37b372253e5..9f534b6b22e 100644
--- a/engines/fool/fool.h
+++ b/engines/fool/fool.h
@@ -56,7 +56,6 @@ protected:
public:
Graphics::ManagedSurface _screen;
Graphics::MacWindowManager _wm;
- Graphics::MacMenu *_menu;
FoolEngine(OSystem *syst, const FOOLGameDescription *gameDesc);
~FoolEngine() override;
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 9998a5a227a..105042514ce 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -33,7 +33,6 @@ void FoolGame::run() {
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
g_zbasic->loadProgram(Common::Path("The Fool's Errand"));
- g_engine->_menu->setVisible(false);
this->sub_128_004();
delete g_zbasic;
delete g_toolbox;
@@ -323,7 +322,7 @@ int16 FoolGame::sub_128_428() {
// 128:0428
// read a byte
this->var_i16_30 = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
- debug(5, "Read[%04x]: %02x", this->var_ptr_696, this->var_i16_30);
+ debugC(8, kDebugLoading, "Read[%04x]: %02x", this->var_ptr_696, this->var_i16_30);
this->var_ptr_696 += 1;
return this->var_i16_30;
return 0;
@@ -333,7 +332,7 @@ int16 FoolGame::sub_128_446() {
// 128:0446
// read a short
this->var_i16_30 = READ_BE_INT16(&arr_bytes_5dfc->data()[this->var_ptr_696]);
- debug(5, "Read[%04x]: %04x", this->var_ptr_696, this->var_i16_30);
+ debugC(8, kDebugLoading, "Read[%04x]: %04x", this->var_ptr_696, this->var_i16_30);
this->var_ptr_696 += 2;
return this->var_i16_30;
}
@@ -342,7 +341,7 @@ int32 FoolGame::sub_128_462() {
// 128:0462
// read a long
this->var_i32_68e = READ_BE_INT32(&arr_bytes_5dfc->data()[this->var_ptr_696]);
- debug(5, "Read[%04x]: %08x", this->var_ptr_696, this->var_i32_68e);
+ debugC(8, kDebugLoading, "Read[%04x]: %08x", this->var_ptr_696, this->var_i32_68e);
this->var_ptr_696 += 4;
return this->var_i32_68e;
}
@@ -352,7 +351,7 @@ Common::U32String FoolGame::sub_128_49a() {
// read a pascal string
this->var_i16_79e = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
this->var_str_69a = Common::U32String((const char *)&arr_bytes_5dfc->data()[this->var_ptr_696+1], this->var_i16_79e, Common::kMacRoman);
- debug(5, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.encode().c_str());
+ debugC(8, kDebugLoading, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.encode().c_str());
this->var_ptr_696 += this->var_i16_79e + 1;
return this->var_str_69a;
}
@@ -933,7 +932,10 @@ void FoolGame::sub_128_20d0() {
this->var_i16_7d8 = this->var_i16_7da;
return;
}
- } while (this->arr_i16_1b90[this->var_i16_7d8]);
+ } while (this->arr_i16_1b90[this->var_i16_7d8] == 0);
+ // The original game took time to redraw the whole screen,
+ // which made the scroll happen at a sane rate.
+ g_toolbox->Delay(15);
this->sub_128_2202();
}
@@ -1187,6 +1189,7 @@ void FoolGame::sub_128_3032() {
this->var_i16_7c6 = 0;
this->var_i16_484 = 0;
this->var_i16_68c = 3;
+ // render chapter menu headings
for (int j = 3; j <= 7; j++) {
this->var_str_384 = g_zbasic->str(37) + g_zbasic->chr(0x7d+j) + g_zbasic->str(38);
g_zbasic->menu(j, 0, 1, this->var_str_384);
@@ -1259,9 +1262,9 @@ void FoolGame::sub_128_3536() {
void FoolGame::sub_128_3744() {
// 128:3744
for (int i = 3; i <= 7; i++) {
- this->var_i32_bf8 = g_toolbox->GetMHandle(i);
+ this->var_menu_bf8 = g_toolbox->GetMHandle(i);
g_toolbox->DeleteMenu(i);
- g_toolbox->DisposeMenu(this->var_i32_bf8);
+ g_toolbox->DisposeMenu(this->var_menu_bf8);
}
g_toolbox->DrawMenuBar();
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 4df3599b25e..be650cb055a 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -191,7 +191,9 @@ private:
int16 var_i16_9f2;
Common::U32String var_str_9f4;
- MenuHandle var_i32_bf8;
+ // Used as both a pointer and a bitstore
+ uint32 var_i32_bf8;
+ MenuHandle var_menu_bf8;
int16 var_i16_d0c;
int16 var_i16_e12;
@@ -255,7 +257,7 @@ private:
int16 arr_i16_2f38[0xc00]; // 96x32?
int16 arr_i16_3b38[0xc00]; // 96x32?
Common::Rect arr_rect_4338;
- int16 arr_i16_4738[16];
+ uint16 arr_i16_4738[16];
uint16 arr_i16_4758[6];
int16 arr_i16_4bd8[0x52];
int16 arr_i16_4c7c[0x52];
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index fd41a813e49..aded19215f9 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -42,7 +42,6 @@ void FoolPrologue::run() {
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
- g_engine->_menu->setVisible(false);
this->sub_128_004();
delete g_zbasic;
delete g_toolbox;
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 0e3bdccbf3a..076da9b84ff 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -50,7 +50,6 @@ typedef Common::SharedPtr<Image::PICTDecoder> PicHandle;
// BitMap is the monochrome surface format.
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Handle PolyHandle;
-typedef uint32 MenuHandle;
typedef uint32 ResType;
typedef size_t Size;
@@ -88,6 +87,10 @@ namespace Fool {
// In QuickDraw 0 means white and 1 means black
struct Pattern {
uint8 data[8];
+
+ Common::String format() const {
+ return Common::String::format("%02x%02x%02x%02x%02x%02x%02x%02x", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
+ }
};
class Cursor: public Graphics::Cursor {
@@ -124,6 +127,10 @@ private:
uint16 _paletteCount = 2;
}; // 0x44
+typedef uint32 OSType;
+typedef uint16 OSErr;
+typedef uint32 ProcPtr;
+
struct RGBColor {
uint16 red;
uint16 green;
@@ -239,10 +246,17 @@ struct FontInfo {
int16 leading;
};
+struct MenuInfo {
+ uint16 menuID;
+ uint16 menuWidth;
+ uint16 menuHeight;
+ Handle menuProc;
+ uint32 enableFlags;
+ // original record stores this as a single string blob, we split it up.
+ Common::Array<Common::U32String> menuData;
+};
-typedef uint32 OSType;
-typedef uint16 OSErr;
-typedef uint32 ProcPtr;
+typedef Common::SharedPtr<MenuInfo> MenuHandle;
struct ParamBlockRec {
uint32 qLink = 0;
@@ -276,6 +290,7 @@ public:
~Toolbox();
Graphics::MacWindow *_defaultWindow;
+ Graphics::MacMenu *_defaultMenu;
BitMap _defaultBits;
@@ -466,6 +481,22 @@ public:
// highlighting from the menu title.
uint32 MenuSelect(const Common::Point &startPt);
+ // FUNCTION NewMenu(menuID: INTEGER; menuTitle: Str255): MenuHandle;
+ // NewMenu allocates space for a new menu with the given menu ID and tide, and returns a handle
+ // to it. It sets up the menu to use the standard menu definition procedure. (The menu definition
+ // procedure is read into memory if it isn't already in memory.) The new menu (which is created
+ // empty) is not installed in the menu list. To use this menu, you must first call AppendMenu or
+ // AddResMenu to fill it with items, InsertMenu to place it in the menu list, and DrawMenuBar to
+ // update the menu bar to include the new tide.
+ MenuHandle NewMenu(uint16 menuID, const Common::U32String &menuTitle);
+
+ // PROCEDURE SetItem(theMenu: MenuHandle; itemString: Str255);
+ // SetItem changes the text of the given menu item to itemString. It doesn't recognize the meta-
+ // characters used in AppendMenu; if you include them in itemString, they will appear in the text of
+ // the menu item. The attributes already in effect for this itemâits character style, icon, and so
+ // onâremain in effect. ItemString may be blank but should not be the empty string.
+ void SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String &itemString);
+
// toolbox_quickdraw.cpp
@@ -827,6 +858,7 @@ private:
Common::SharedPtr<Cursor> _cursor;
int _cursorLevel = 0;
Common::Point _mouse;
+ Common::HashMap<uint16, MenuHandle> _menu;
Common::Queue<EventRecord> _events;
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 8580c05f203..23437e3a01f 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "graphics/macgui/macmenu.h"
#include "graphics/macgui/mactext-canvas.h"
#include "graphics/macgui/mactext.h"
#include "graphics/managed_surface.h"
@@ -31,27 +32,41 @@
namespace Fool {
void Toolbox::ClearMenuBar() {
- warning("STUB: Toolbox::ClearMenuBar");
+ if (_defaultMenu) {
+ _defaultMenu->setVisible(false);
+ }
}
void Toolbox::DeleteMenu(uint16 menuID) {
- warning("STUB: Toolbox::DeleteMenu");
+ if (_menu.contains(menuID)) {
+ _menu.erase(menuID);
+ }
+ if (_defaultMenu) {
+ _defaultMenu->clearSubMenu(menuID-1);
+ }
}
void Toolbox::DrawMenuBar() {
- warning("STUB: Toolbox::DrawMenuBar");
+ if (_defaultMenu) {
+ _defaultMenu->setVisible(true);
+ }
}
void Toolbox::DisposeMenu(MenuHandle &theMenu) {
- warning("STUB: Toolbox::DisposeMenu");
+ // only frees memory, DeleteMenu is responsible for removing it from the menu state
+ theMenu = nullptr;
}
MenuHandle Toolbox::GetMHandle(uint16 menuID) {
- warning("STUB: Toolbox::GetMHandle");
- return MenuHandle();
+ MenuHandle result;
+ if (_menu.contains(menuID)) {
+ result = _menu[menuID];
+ }
+ return result;
}
void Toolbox::HiliteMenu(uint16 menuID) {
+ // FIXME: this is coupled to the mouse click code
warning("STUB: Toolbox::HiliteMenu");
}
@@ -60,5 +75,49 @@ uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
return 0;
}
+MenuHandle Toolbox::NewMenu(uint16 menuID, const Common::U32String &menuTitle) {
+ MenuHandle handle(new MenuInfo());
+ handle->menuID = menuID;
+ handle->menuData.push_back(menuTitle);
+ _menu[menuID] = handle;
+ if (_defaultMenu) {
+ for (int i = 0; i < (menuID - _defaultMenu->numberOfMenus()); i++) {
+ _defaultMenu->addMenuItem(nullptr, Common::U32String());
+ }
+ _defaultMenu->clearSubMenu(menuID-1);
+ Graphics::MacMenuItem *item = _defaultMenu->getMenuItem(menuID-1);
+ item->unicodeText = menuTitle;
+ item->unicode = true;
+ _defaultMenu->addSubMenu(nullptr, menuID-1);
+ }
+ return handle;
+}
+
+void Toolbox::SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String &itemString) {
+ if (!theMenu) {
+ warning("Toolbox::SetItem: empty menu handle");
+ return;
+ }
+ if (theMenu->menuData.size() < (uint)(item + 1)) {
+ theMenu->menuData.resize(item + 1);
+ }
+ theMenu->menuData[item] = itemString;
+ if (_defaultMenu) {
+ Graphics::MacMenuSubMenu *submenu = _defaultMenu->getSubmenu(nullptr, theMenu->menuID-1);
+ if (!submenu) {
+ warning("Toolbox::SetItem: menu ID %d not found", theMenu->menuID);
+ return;
+ }
+ if (item == 0) {
+ Graphics::MacMenuItem *mi = _defaultMenu->getMenuItem(theMenu->menuID-1);
+ mi->text = itemString.encode(Common::kMacRoman);
+ mi->unicode = false;
+ } else {
+ _defaultMenu->removeMenuItem(submenu, item-1);
+ _defaultMenu->insertMenuItem(submenu, itemString.encode(Common::kMacRoman), item-1);
+ }
+ }
+}
+
} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index a9a7875c722..570baba1b81 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -19,9 +19,11 @@
*
*/
+#include "common/debug.h"
#include "common/memstream.h"
#include "common/system.h"
+#include "fool/detection.h"
#include "graphics/cursor.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/managed_surface.h"
@@ -176,6 +178,10 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
}
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+ if (debugChannelSet(5, kDebugGraphics)) {
+ debugC(5, kDebugGraphics, "Toolbox::_drawRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
+ }
+
// Dirty rects check
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(dstRect);
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index 45696b2f685..fd31c01b879 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -36,13 +36,14 @@ void Toolbox::DrawChar(Common::u32char_type_t ch) {
void Toolbox::DrawString(const Common::U32String &s) {
if (_port) {
+ Common::String macString = s.encode(Common::kMacRoman);
debugN(5, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
const Graphics::Font *font = fontRun.getFont();
Common::Rect bbox = font->getBoundingBox(s);
BitMap buffer(new Graphics::ManagedSurface(bbox.width(), bbox.height(), Graphics::PixelFormat::createFormatCLUT8()));
buffer->fillRect(buffer->getBounds(), _port->bkColor);
- font->drawString(buffer->surfacePtr(), s, 0, 0, bbox.width(), _port->fgColor);
+ font->drawString(buffer->surfacePtr(), macString, 0, 0, bbox.width(), _port->fgColor);
BitMap mask(nullptr);
@@ -57,8 +58,9 @@ void Toolbox::DrawString(const Common::U32String &s) {
uint16 Toolbox::StringWidth(const Common::U32String &s) {
if (_port) {
+ Common::String macString = s.encode(Common::kMacRoman);
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
- uint16 result = fontRun.getFont()->getStringWidth(s);
+ uint16 result = fontRun.getFont()->getStringWidth(macString);
debug(5, "Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
return result;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 1dbf6bc4735..5bbbc9d5ec0 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -24,9 +24,11 @@
#include "common/memstream.h"
#include "common/str-enc.h"
#include "common/stream.h"
+#include "graphics/fontman.h"
#include "graphics/managed_surface.h"
#include "fool/fool.h"
+#include "fool/detection.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
@@ -38,8 +40,10 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_window->disableBorder();
_window->resize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_engine->_wm.setBackgroundWindow(_window);
+ _menu = g_engine->_wm.addMenu();
_toolbox->_defaultWindow = _window;
+ _toolbox->_defaultMenu = _menu;
_toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
@@ -61,6 +65,10 @@ void ZBasic::loadProgram(const Common::Path &path) {
warning("ZBasic::loadProgram: could not find SCOT chunk");
return;
}
+ // Fool's Errand has an embedded version of Chicago with custom characters
+ Graphics::MacFont macFont = Graphics::MacFont(g_engine->_wm._fontMan->getFontIdByName("Chicago"), 12, 0);
+ _menu->setFont(g_engine->_wm._fontMan->getFont(&macFont));
+
Common::MemoryReadStream *scot = new Common::MemoryReadStream(scotRes->data(), scotRes->size());
this->_dataTable.clear();
@@ -76,7 +84,7 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
switch (opcode) {
case kDatumNULL:
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, NULL\n", this->_dataTable.size(), offset);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, NULL\n", this->_dataTable.size(), offset);
this->_dataTable.push_back(ZBasicDatum::newNull(offset));
break;
case kDatumINT:
@@ -85,11 +93,11 @@ void ZBasic::loadProgram(const Common::Path &path) {
Common::SharedPtr<ZBasicDatum> result;
if (size == 0) {
result = ZBasicDatum::newInt(offset, 0);
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
this->_dataTable.push_back(result);
} else if (size == 2) {
result = ZBasicDatum::newInt(offset, scot->readSint16BE());
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
this->_dataTable.push_back(result);
} else {
warning("ZBasic::loadProgram: unexpected size for int %d", size);
@@ -103,11 +111,11 @@ void ZBasic::loadProgram(const Common::Path &path) {
Common::SharedPtr<ZBasicDatum> result;
if (size == 0) {
result = ZBasicDatum::newDblInt(offset, 0);
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
this->_dataTable.push_back(result);
} else if (size == 4) {
result = ZBasicDatum::newDblInt(offset, scot->readSint32BE());
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
this->_dataTable.push_back(result);
} else {
warning("ZBasic::loadProgram: unexpected size for dblint %d", size);
@@ -121,7 +129,7 @@ void ZBasic::loadProgram(const Common::Path &path) {
char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
Common::SharedPtr<ZBasicDatum> result = ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman));
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, \"%s\"\n", this->_dataTable.size(), offset, result->data.str->encode().c_str());
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, \"%s\"\n", this->_dataTable.size(), offset, result->data.str->encode().c_str());
this->_dataTable.push_back(result);
free(buf);
}
@@ -129,7 +137,7 @@ void ZBasic::loadProgram(const Common::Path &path) {
case kDatumBCD:
{
scot->seek(-1);
- debugN(5, "ZBasic::loadProgram: _dataTable[%d]: offset %d, BCD\n", this->_dataTable.size(), offset);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, BCD\n", this->_dataTable.size(), offset);
this->_dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
}
break;
@@ -146,7 +154,7 @@ void ZBasic::loadProgram(const Common::Path &path) {
char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
Common::SharedPtr<ZBasicDatum> result = ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman));
- debugN(5, "ZBasic::loadProgram: _stringTable[%d]: offset %d, \"%s\"\n", this->_stringTable.size(), offset, result->data.str->encode().c_str());
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _stringTable[%d]: offset %d, \"%s\"\n", this->_stringTable.size(), offset, result->data.str->encode().c_str());
this->_stringTable.push_back(result);
offset += size + 1;
free(buf);
@@ -163,7 +171,9 @@ void ZBasic::blockMove(void *srcptr, void *destptr, uint16 size) {
}
Common::U32String ZBasic::chr(uint16 code) {
- return Common::U32String(code, Common::kMacRoman);
+ char buf[2] = { 0x00, 0x00 };
+ buf[0] = (char)(code & 0xff);
+ return Common::U32String(buf, 1, Common::kMacRoman);
}
void ZBasic::bufferFlush(const Common::U32String &str) {
@@ -228,8 +238,12 @@ uint32 ZBasic::mem(int16 index) {
return 0;
}
-void ZBasic::menu(int16 menuNo, int16 itemNo, int16 state, const Common::U32String &title) {
- warning("STUB: ZBasic::menu");
+void ZBasic::menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title) {
+ MenuHandle handle = _toolbox->GetMHandle(menuNo);
+ if (!handle) {
+ handle = _toolbox->NewMenu(menuNo, Common::U32String());
+ }
+ _toolbox->SetItem(handle, itemNo, title);
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 7fd7cdb2c13..9ff6a1ef571 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -230,6 +230,7 @@ private:
Common::MemoryPool *_memPool;
int16 _fileId = -1;
Graphics::MacWindow *_window;
+ Graphics::MacMenu *_menu;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
Common::HashMap<int16, uint32> _fileLineSize;
@@ -254,7 +255,7 @@ public:
int finderInfo(int16 &count, Common::U32String &var, OSType &type, uint16 volume);
bool maybe();
uint32 mem(int16 index);
- void menu(int16 menuNo, int16 itemNo, int16 state, const Common::U32String &title);
+ void menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
Commit: e597fa5bf072f68f4da1e2aed2c2a6ea634388bf
https://github.com/scummvm/scummvm/commit/e597fa5bf072f68f4da1e2aed2c2a6ea634388bf
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:59+02:00
Commit Message:
MACGUI: Allow externally-owned surface for MacWidget
Changed paths:
graphics/macgui/macwidget.cpp
graphics/macgui/macwidget.h
diff --git a/graphics/macgui/macwidget.cpp b/graphics/macgui/macwidget.cpp
index ab88ede6d0a..fadd32cc755 100644
--- a/graphics/macgui/macwidget.cpp
+++ b/graphics/macgui/macwidget.cpp
@@ -44,6 +44,7 @@ MacWidget::MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowMan
_composeSurface = new ManagedSurface(_dims.width(), _dims.height(), _wm->_pixelformat);
_composeSurface->clear(_bgcolor);
+ _dispose = DisposeAfterUse::YES;
_active = false;
_editable = false;
@@ -58,7 +59,7 @@ MacWidget::~MacWidget() {
if (_wm)
_wm->clearWidgetRefs(this);
- if (_composeSurface) {
+ if (_composeSurface && (_dispose == DisposeAfterUse::YES)) {
_composeSurface->free();
delete _composeSurface;
}
@@ -173,4 +174,13 @@ Common::Rect MacWidget::getAbsoluteDimensions() {
return dims;
}
+void MacWidget::setSurface(Graphics::ManagedSurface *srf, DisposeAfterUse::Flag dispose) {
+ if (_composeSurface && (_dispose == DisposeAfterUse::YES)) {
+ _composeSurface->free();
+ delete _composeSurface;
+ }
+ _composeSurface = srf;
+ _dispose = dispose;
+}
+
} // End of namespace Graphics
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index d08860eaac1..6bc3fb78c49 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -87,6 +87,7 @@ public:
void removeWidget(MacWidget *child, bool del = true);
virtual Graphics::ManagedSurface *getSurface() final { return _composeSurface; }
+ void setSurface(Graphics::ManagedSurface *srf, DisposeAfterUse::Flag dispose);
protected:
uint16 _border;
@@ -97,6 +98,7 @@ protected:
uint32 _fgcolor, _bgcolor;
Graphics::ManagedSurface *_composeSurface;
+ DisposeAfterUse::Flag _dispose;
bool _contentIsDirty;
Commit: 257b8bd25fa4f98d6f2cf62731aa6e2d462bb067
https://github.com/scummvm/scummvm/commit/257b8bd25fa4f98d6f2cf62731aa6e2d462bb067
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:07:59+02:00
Commit Message:
FOOL: Add quit event
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_menu.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 105042514ce..97ad6a097df 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -543,6 +543,9 @@ void FoolGame::sub_128_c6a(int16 unk1) {
if (this->var_ev_46.what == kDiskEvt) {
this->sub_128_6154();
}
+ if ((this->var_ev_46.what == kScummVMQuitEvt) || (this->var_ev_46.what == kScummVMReturnToLauncherEvt)) {
+ _quit = true;
+ }
}
void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
@@ -726,14 +729,14 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:1624
while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target) != 0)) {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
}
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
}
// 128:16ea
@@ -889,7 +892,7 @@ void FoolGame::sub_128_1f76() {
this->var_i32_692 = g_toolbox->TickCount();
this->sub_128_20d0();
this->sub_128_406(5);
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
} while ((this->var_ev_46.modifiers & 0x80) == 0);
}
// 128:1fec
@@ -1398,7 +1401,7 @@ void FoolGame::sub_128_6186() {
void FoolGame::sub_128_61ec() {
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
if (this->var_ev_46.what == kUpdateEvt) {
this->sub_128_5fb4();
}
@@ -1412,7 +1415,7 @@ void FoolGame::sub_128_61ec() {
void FoolGame::sub_128_6244() {
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xffff, this->var_ev_46);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
if (this->var_ev_46.what == kUpdateEvt) {
g_toolbox->BeginUpdate(*this->var_ev_46.windowPtr);
g_toolbox->EndUpdate(*this->var_ev_46.windowPtr);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index be650cb055a..055ed84e328 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -115,6 +115,8 @@ public:
void sub_144_004();
private:
+ bool _quit = false;
+
GrafPtr var_i32_0;
GrafPtr var_i32_4;
GrafPtr var_i32_8;
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index aded19215f9..5d039adf2cf 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -104,6 +104,8 @@ void FoolPrologue::sub_128_004() {
// JMP 0xc8a
// 128:0c8a
this->sub_129_004();
+ if (_quit)
+ return;
this->var_i32_1a6 = g_zbasic->mem(-1);
if (this->var_i16_1aa == 1) {
this->prologueRun();
@@ -402,9 +404,14 @@ void FoolPrologue::sub_128_e58() {
// 128:0e58
this->sub_128_e80();
while (true) {
- this->var_i16_1ba = g_toolbox->GetNextEvent(0x2, this->var_ev_22);
+ // was: 2
+ this->var_i16_1ba = g_toolbox->GetNextEvent(-1, this->var_ev_22);
if (this->var_ev_22.what == kMouseDown)
break;
+ if ((this->var_ev_22.what == kScummVMQuitEvt) || (this->var_ev_22.what == kScummVMReturnToLauncherEvt)) {
+ _quit = true;
+ return;
+ }
// wait until next redraw
g_toolbox->Delay(1);
}
@@ -421,6 +428,10 @@ void FoolPrologue::sub_128_e80() {
if (this->var_ev_22.what == kDiskEvt) {
this->sub_128_ee0();
}
+ if (this->var_ev_22.what == kScummVMQuitEvt || this->var_ev_22.what == kScummVMReturnToLauncherEvt) {
+ _quit = true;
+ return;
+ }
// keep looping until mouse is seen as up??
// see I-252
if ((this->var_ev_22.modifiers & 0x80) && (this->var_ev_22.what == kNullEvent)) {
@@ -572,6 +583,8 @@ void FoolPrologue::sub_129_004() {
this->var_str_76 = g_zbasic->str(10);
this->drawTextCenterAlign(0xcb, 0x100);
this->sub_128_e58();
+ if (_quit)
+ return;
g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kPutCopy);
this->var_i16_1aa = 0;
@@ -646,6 +659,8 @@ void FoolPrologue::sub_129_004() {
this->drawTextCenterAlign(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
+ if (_quit)
+ return;
g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kPutCopy);
this->var_i16_1aa = 0;
} else {
@@ -1009,6 +1024,8 @@ void FoolPrologue::prologueRun() {
// 130:0b74
this->delayFromMarker(0xd2);
this->sub_128_e80();
+ if (_quit)
+ return;
this->scanlineTransition(1);
// rectangle zoom into the clifftop scene
@@ -1018,6 +1035,8 @@ void FoolPrologue::prologueRun() {
// stall until mouse click
this->sub_128_e58();
+ if (_quit)
+ return;
// 130:0b98
this->var_i16_74 = 0;
this->var_i16_192 = 1;
@@ -1063,13 +1082,16 @@ void FoolPrologue::prologueRun() {
// "who dares to interrupt my errand"
this->blitPageToScreen(0x6);
this->sub_128_e58();
-
+ if (_quit)
+ return;
this->sub_128_50a(0x0, 0, SCREEN_HEIGHT, 7);
this->delay(0xa);
// "I dare"
this->blitPageToScreen(0x8);
this->sub_128_e58();
+ if (_quit)
+ return;
// zoom to close
@@ -1246,6 +1268,9 @@ void FoolPrologue::sub_131_004() {
this->delay(0x3c);
this->zoomTransition(0x5);
this->sub_128_e58();
+ if (_quit)
+ return;
+
this->sub_131_4e98();
// g_zbasic->52(0x4c);
for (int j = 1; j < 0xe; j++) {
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 8200a645228..5375115dcc0 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -85,6 +85,8 @@ public:
void sub_131_4f96();
private:
+ bool _quit = false;
+
// last tick count
uint32 var_i32_2;
int16 var_i16_6;
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 5452fb844fc..6ccda9da960 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -37,7 +37,8 @@ Toolbox::~Toolbox() {
void Toolbox::_pumpEvents() {
Common::Event event;
- while (g_system->getEventManager()->pollEvent(event)) {
+ Common::EventManager *manager = g_system->getEventManager();
+ while (manager->pollEvent(event)) {
EventRecord newRecord;
newRecord.when = this->TickCount();
switch (event.type) {
@@ -48,26 +49,37 @@ void Toolbox::_pumpEvents() {
case Common::EVENT_RBUTTONDOWN:
newRecord.what = kMouseDown;
newRecord.where = event.mouse;
- _events.push(newRecord);
+ _events.push_back(newRecord);
_mouse = event.mouse;
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
newRecord.what = kMouseUp;
newRecord.where = event.mouse;
- _events.push(newRecord);
+ _events.push_back(newRecord);
_mouse = event.mouse;
break;
case Common::EVENT_QUIT:
+ manager->resetQuit();
+ newRecord.what = kScummVMQuitEvt;
+ _events.push_back(newRecord);
+ break;
case Common::EVENT_RETURN_TO_LAUNCHER:
+ manager->resetReturnToLauncher();
+ newRecord.what = kScummVMReturnToLauncherEvt;
+ _events.push_back(newRecord);
+ break;
default:
break;
}
}
+ // erase the older events if they aren't consumed in time
+ while (_events.size() > 2048) {
+ _events.pop_front();
+ }
}
void Toolbox::_updateScreen() {
- _defaultWindow->getWindowSurface()->copyFrom(*_defaultBits);
g_engine->_wm.draw();
_frameLimiter->delayBeforeSwap();
g_system->updateScreen();
@@ -83,18 +95,23 @@ uint32 Toolbox::Delay(uint32 numTicks) {
return (uint32)(g_system->getMillis() * 60 / 1000);
}
-bool Toolbox::GetNextEvent(uint16 eventMask, EventRecord &theEvent) {
+bool Toolbox::GetNextEvent(uint32 eventMask, EventRecord &theEvent) {
//warning("STUB: Toolbox::GetNextEvent");
_pumpEvents();
- if (!_events.empty()) {
- theEvent = _events.pop();
- } else {
- theEvent.what = kNullEvent;
- theEvent.where = _mouse;
- // pretend mouse button is up
- theEvent.modifiers = 0x80;
+ if (!_events.empty() && eventMask) {
+ for (auto it = _events.begin(); it != _events.end(); ++it) {
+ if ((1 << it->what) & eventMask) {
+ theEvent = Common::move(*it);
+ _events.erase(it);
+ return true;
+ }
+ }
}
- return true;
+ theEvent.what = kNullEvent;
+ theEvent.where = _mouse;
+ // FIXME: pretend mouse button is up
+ theEvent.modifiers = 0x80;
+ return false;
}
uint32 Toolbox::TickCount() {
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 076da9b84ff..0e373fc2c79 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -152,7 +152,10 @@ enum EventCode : uint16 {
kApp1Evt = 12,
kApp2Evt = 13,
kApp3Evt = 14,
- kApp4Evt = 15
+ kOsEvt = 15,
+ kHighLevelEvt = 23,
+ kScummVMQuitEvt = 24,
+ kScummVMReturnToLauncherEvt = 25,
};
enum SourceMode : uint16 {
@@ -223,12 +226,12 @@ struct WindowRecord {
};
struct EventRecord {
- EventCode what; // 0
- uint32 message; // 2
- WindowRecord *windowPtr; // also 2
- uint32 when; // 6
+ EventCode what = kNullEvent; // 0
+ uint32 message = 0; // 2
+ WindowRecord *windowPtr = nullptr; // also 2
+ uint32 when = 0; // 6
Common::Point where; // 10
- uint16 modifiers; // 14
+ uint16 modifiers = 0; // 14
};
struct ToolboxResInfo {
@@ -307,7 +310,7 @@ public:
// available event of any type designated by the mask, subject to the priority rules discussed above
// under "Priority of Events". If no event of any of the designated types is available, GetNextEvent
// returns a null event.
- bool GetNextEvent(uint16 eventMask, EventRecord &theEvent);
+ bool GetNextEvent(uint32 eventMask, EventRecord &theEvent);
// FUNCTION TickCount : LONGINT;
// TickCount returns the current number of ticks (sixtieths of a second) since the system last started
@@ -860,7 +863,7 @@ private:
Common::Point _mouse;
Common::HashMap<uint16, MenuHandle> _menu;
- Common::Queue<EventRecord> _events;
+ Common::List<EventRecord> _events;
GrafPtr _port = nullptr;
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 23437e3a01f..9417a174424 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -71,7 +71,13 @@ void Toolbox::HiliteMenu(uint16 menuID) {
}
uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
- warning("STUB: Toolbox::MenuSelect");
+ if (_defaultMenu) {
+ if (_defaultMenu->mouseClick(startPt.x, startPt.y)) {
+ Common::Event ev;
+ g_system->getEventManager()->pollEvent(ev);
+ _defaultMenu->processEvent(ev);
+ }
+ }
return 0;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 5bbbc9d5ec0..82204659b4f 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -46,6 +46,7 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_toolbox->_defaultMenu = _menu;
_toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
+ _window->setSurface(_toolbox->_defaultBits.get(), DisposeAfterUse::NO);
}
@@ -197,6 +198,7 @@ void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool pres
GrafPtr port;
_toolbox->GetPort(port);
Common::Rect srcRect(x1, y1, x2, y2);
+ Common::Rect dstRect(srcRect.width(), srcRect.height());
// Real ZBasic uses a raw array for storage.
// Some graphical effects expect there to be a full screen page that only has part
// of it copied over, so we have this flag.
@@ -205,9 +207,9 @@ void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool pres
warning("ZBasic::get: differing row lengths, surface not going to draw correctly");
}
} else {
- dest->create(srcRect.width(), srcRect.height());
+ dest->create(dstRect.width(), dstRect.height());
}
- _toolbox->CopyBits(port->portBits, dest, srcRect, dest->getBounds(), kSrcCopy, nullptr);
+ _toolbox->CopyBits(port->portBits, dest, srcRect, dstRect, kSrcCopy, nullptr);
}
int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2) {
@@ -487,7 +489,7 @@ void ZBasic::indexSet(const Common::U32String &value, int16 table, int16 index)
if (!_index.contains(table)) {
_index[table] = Common::Array<Common::U32String>();
}
- if (_index[table].size() <= index) {
+ if (_index[table].size() <= (uint)index) {
_index[table].resize(index+1);
}
_index[table][index] = value;
@@ -502,7 +504,7 @@ Common::U32String ZBasic::index(int16 table, int16 index) {
warning("ZBasic::index: table %d not found", table);
return Common::U32String();
}
- if (_index[table].size() <= index) {
+ if (_index[table].size() <= (uint)index) {
warning("ZBasic::index: asked for index %d but only %d entries in table %d", index, _index[table].size(), table);
return Common::U32String();
}
Commit: 798f58d87e27b9f3141ee0b9fd118f0661207c8c
https://github.com/scummvm/scummvm/commit/798f58d87e27b9f3141ee0b9fd118f0661207c8c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:00+02:00
Commit Message:
FOOL: Menu events wired up
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_menu.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 97ad6a097df..4daa1477ca6 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -105,6 +105,9 @@ void FoolGame::sub_128_004() {
while (this->var_i16_7c6 != 0x20) {
do {
this->sub_128_c6a(-1);
+ if (_quit)
+ return;
+
if ((this->var_ev_46.where.y >= 0x8c) && (this->var_ev_46.where.y <= 0x11d)) {
this->var_i16_7cc = -1;
}
@@ -1075,10 +1078,37 @@ void FoolGame::sub_128_271a() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_27d6() {
+ warning("STUB: %s", __func__);
+}
+
+
void FoolGame::sub_128_2808() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_2988() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_2a06() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_2a92() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_2ab6() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_128_2ae8() {
+ warning("STUB: %s", __func__);
+}
+
+
+
void FoolGame::sub_128_2b0a() {
warning("STUB: %s", __func__);
}
@@ -1325,6 +1355,10 @@ void FoolGame::sub_128_4472() {
}
+void FoolGame::sub_128_4a92() {
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_128_5b30() {
// 128:5b30
if (this->var_i16_e12 == 0) {
@@ -1353,7 +1387,86 @@ void FoolGame::sub_128_5baa() {
}
void FoolGame::sub_128_5c20() {
- warning("STUB: %s", __func__);
+ this->var_i16_7c6 = 0;
+ if (this->var_i16_e16 == 1) {
+ this->sub_128_4a92();
+ }
+ if (this->var_i16_e16 == 2) {
+ if (this->var_i16_e18 == 1) {
+ this->sub_128_27d6();
+ } else if (this->var_i16_e18 == 2) {
+ // 128:5c5c
+ this->sub_128_2988();
+ } else if (this->var_i16_e18 == 3) {
+ // 128:5c6c
+ this->sub_128_2a06();
+ } else if (this->var_i16_e18 == 4) {
+ this->sub_128_2a92();
+ } else if (this->var_i16_e18 == 6) {
+ if (this->var_i16_378 == 0) {
+ this->var_i16_378 = 1;
+ } else {
+ this->var_i16_378 = 0;
+ }
+ // 128:5cbc
+ this->sub_128_32c8();
+ // 128:5cc4
+ } else if (this->var_i16_e18 == 7) {
+ this->sub_128_2ae8();
+ } else if (this->var_i16_e18 == 9) {
+ this->sub_128_2ab6();
+ }
+ }
+ // 128:5cea
+ if ((this->var_i16_e16 >= 3) && (this->var_i16_e16 <= 7)) {
+ this->var_i16_e1a = 0;
+ this->var_i16_7dc = this->var_i16_e18 + (this->var_i16_e16 - 3)*0x10;
+ if ((this->var_i16_7dc == 1) && (this->var_ev_46.what == 3)) {
+ this->var_i16_e1a = 1;
+ }
+ // 128:5d56
+ if ((this->var_ev_46.modifiers & 0x800) != 0) {
+ this->var_i16_e1a = 1;
+ } else {
+ // 128:5d74
+ do {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0x8, this->var_ev_46);
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ if ((this->var_ev_46.modifiers & 0x800) != 0) {
+ this->var_i16_e1a = 1;
+ }
+ } while (this->var_ev_46.what != kNullEvent);
+ }
+ // 128:5dae
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->var_i16_7d0 != this->var_i16_7dc)) {
+ this->sub_128_1c2c(0x40);
+ }
+ // 128:5df6
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1)) {
+ this->sub_128_1c2c(0x40);
+
+ }
+ // 128:5e38
+ if (((this->var_i16_7ce & 1) != 0) && (this->var_i16_e1a == 0)) {
+ this->sub_128_1c2c(0x41);
+ }
+ // 128:5e5e
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->var_i16_7d0 != this->var_i16_7dc)) {
+ this->sub_128_1c2c(0x41);
+ this->var_i16_7ce |= 0x4;
+ }
+ }
+ // 128:5eaa
+ if (this->var_i16_e16 == 8) {
+ if (this->var_i16_e18 == 1) {
+ this->sub_128_1c2c(1);
+ }
+ // 128:5ec6
+ if ((this->var_i16_e18 == 3) && (this->var_i16_c00 == 1)) {
+ this->sub_128_1c2c(2);
+ }
+ }
+ // 128:5eee
}
void FoolGame::sub_128_5ef0() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 055ed84e328..e90bfe5e59e 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -78,7 +78,13 @@ public:
void sub_128_21c8();
void sub_128_2202();
void sub_128_271a();
+ void sub_128_27d6();
void sub_128_2808();
+ void sub_128_2988();
+ void sub_128_2a06();
+ void sub_128_2a92();
+ void sub_128_2ab6();
+ void sub_128_2ae8();
void sub_128_2b0a();
void sub_128_2bc6();
void sub_128_2e3e();
@@ -92,6 +98,7 @@ public:
void sub_128_39a0();
void sub_128_4472();
+ void sub_128_4a92();
void sub_128_5b30();
void sub_128_5baa();
void sub_128_5c20();
@@ -196,12 +203,14 @@ private:
// Used as both a pointer and a bitstore
uint32 var_i32_bf8;
MenuHandle var_menu_bf8;
+ int16 var_i16_c00;
int16 var_i16_d0c;
int16 var_i16_e12;
int16 var_i16_e14;
int16 var_i16_e16;
int16 var_i16_e18;
+ int16 var_i16_e1a;
int16 var_i16_e20;
Common::U32String var_str_e22;
int16 var_i16_f22;
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 6ccda9da960..8aee9c39bb1 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -47,26 +47,34 @@ void Toolbox::_pumpEvents() {
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
+ _mouse = event.mouse;
+ _modifiers &= !0x80;
newRecord.what = kMouseDown;
- newRecord.where = event.mouse;
+ newRecord.where = _mouse;
+ newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
- _mouse = event.mouse;
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
+ _mouse = event.mouse;
+ _modifiers |= 0x80;
newRecord.what = kMouseUp;
- newRecord.where = event.mouse;
+ newRecord.where = _mouse;
+ newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
- _mouse = event.mouse;
break;
case Common::EVENT_QUIT:
manager->resetQuit();
newRecord.what = kScummVMQuitEvt;
+ newRecord.where = _mouse;
+ newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
break;
case Common::EVENT_RETURN_TO_LAUNCHER:
manager->resetReturnToLauncher();
newRecord.what = kScummVMReturnToLauncherEvt;
+ newRecord.where = _mouse;
+ newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
break;
default:
@@ -109,8 +117,7 @@ bool Toolbox::GetNextEvent(uint32 eventMask, EventRecord &theEvent) {
}
theEvent.what = kNullEvent;
theEvent.where = _mouse;
- // FIXME: pretend mouse button is up
- theEvent.modifiers = 0x80;
+ theEvent.modifiers = _modifiers;
return false;
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 0e373fc2c79..75d298368aa 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -861,6 +861,7 @@ private:
Common::SharedPtr<Cursor> _cursor;
int _cursorLevel = 0;
Common::Point _mouse;
+ uint16 _modifiers = 0x80;
Common::HashMap<uint16, MenuHandle> _menu;
Common::List<EventRecord> _events;
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 9417a174424..4ffccb95404 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -71,14 +71,26 @@ void Toolbox::HiliteMenu(uint16 menuID) {
}
uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
+ uint32 result = 0;
if (_defaultMenu) {
if (_defaultMenu->mouseClick(startPt.x, startPt.y)) {
- Common::Event ev;
- g_system->getEventManager()->pollEvent(ev);
- _defaultMenu->processEvent(ev);
+ while (_defaultMenu->_active) {
+ Common::Event ev;
+ while (g_system->getEventManager()->pollEvent(ev)) {
+ _defaultMenu->processEvent(ev);
+ }
+ _updateScreen();
+ }
+ int menuItem = _defaultMenu->getLastSelectedMenuItem();
+ int menuSubItem = _defaultMenu->getLastSelectedSubmenuItem();
+ if ((menuItem != -1) && (menuSubItem != -1)) {
+ result |= ((menuItem + 1) & 0xffff) << 16;
+ result |= ((menuSubItem + 1) & 0xffff);
+ }
}
}
- return 0;
+ warning("Toolbox::MenuSelect: %08x", result);
+ return result;
}
MenuHandle Toolbox::NewMenu(uint16 menuID, const Common::U32String &menuTitle) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 82204659b4f..0281b5707f2 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -34,6 +34,10 @@
namespace Fool {
+void menuCommandsCallback(int action, Common::String &text, void *data) {
+ // unused
+}
+
ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_memPool = new Common::MemoryPool(sizeof(int));
_window = g_engine->_wm.addWindow(false, false, false);
@@ -41,6 +45,7 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_window->resize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_engine->_wm.setBackgroundWindow(_window);
_menu = g_engine->_wm.addMenu();
+ _menu->setCommandsCallback(menuCommandsCallback, nullptr);
_toolbox->_defaultWindow = _window;
_toolbox->_defaultMenu = _menu;
Commit: bca38ee631341fc9a36361688dc7d51215ef227d
https://github.com/scummvm/scummvm/commit/bca38ee631341fc9a36361688dc7d51215ef227d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:00+02:00
Commit Message:
FOOL: Fix story text layout
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/toolbox.cpp
engines/fool/toolbox.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 4daa1477ca6..ee4842ad6e2 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -197,7 +197,7 @@ void FoolGame::sub_128_004() {
g_zbasic->unk_158();
g_zbasic->unk_4();
g_toolbox->SetPort(this->var_i32_8);
- this->sub_128_8b4(0, 0, 0x14, this->var_i16_5a, 2);
+ this->fillRect(0, 0, 0x14, this->var_i16_5a, 2);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -321,7 +321,7 @@ void FoolGame::sub_128_406(int16 unk1) {
} while (g_toolbox->TickCount() < (this->var_i32_692 + unk1));
}
-int16 FoolGame::sub_128_428() {
+int16 FoolGame::puzzlesReadByte() {
// 128:0428
// read a byte
this->var_i16_30 = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
@@ -331,7 +331,7 @@ int16 FoolGame::sub_128_428() {
return 0;
}
-int16 FoolGame::sub_128_446() {
+int16 FoolGame::puzzlesReadShort() {
// 128:0446
// read a short
this->var_i16_30 = READ_BE_INT16(&arr_bytes_5dfc->data()[this->var_ptr_696]);
@@ -340,7 +340,7 @@ int16 FoolGame::sub_128_446() {
return this->var_i16_30;
}
-int32 FoolGame::sub_128_462() {
+int32 FoolGame::puzzlesReadLong() {
// 128:0462
// read a long
this->var_i32_68e = READ_BE_INT32(&arr_bytes_5dfc->data()[this->var_ptr_696]);
@@ -349,7 +349,7 @@ int32 FoolGame::sub_128_462() {
return this->var_i32_68e;
}
-Common::U32String FoolGame::sub_128_49a() {
+Common::U32String FoolGame::puzzlesReadString() {
// 128:049a
// read a pascal string
this->var_i16_79e = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
@@ -455,10 +455,10 @@ void FoolGame::sub_128_712(int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->PenNormal();
}
-void FoolGame::sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:08b4
- g_toolbox->SetRect(this->arr_rect_5b7c, unk4, unk5, unk2, unk3);
- g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[unk1]);
+ g_toolbox->SetRect(this->arr_rect_5b7c, left, top, right, bottom);
+ g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[patternID]);
}
void FoolGame::sub_128_918(Common::U32String &unk1) {
@@ -530,14 +530,14 @@ void FoolGame::sub_128_c6a(int16 unk1) {
// 128:0caa
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kKeyDown) {
- if ((this->var_ev_46.modifiers & 0x100) == 0) {
+ if ((this->var_ev_46.modifiers & kModCommandKeyDown) == 0) {
this->sub_128_5f9e();
} else {
this->sub_128_5baa();
}
}
// 128:0ce0
- if ((this->var_ev_46.what == kAutoKey) && ((this->var_ev_46.modifiers & 0x100) == 0)) {
+ if ((this->var_ev_46.what == kAutoKey) && ((this->var_ev_46.modifiers & kModCommandKeyDown) == 0)) {
this->sub_128_5f9e();
}
if (this->var_ev_46.what == kUpdateEvt) {
@@ -557,7 +557,7 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
this->arr_rect_5b7c.left = unk4;
this->arr_rect_5b7c.bottom = unk3;
this->arr_rect_5b7c.right = unk2;
- while (this->var_ev_46.modifiers & 0x80) {
+ while (this->var_ev_46.modifiers & kModMouseButtonUp) {
// 128:0d94
do {
g_toolbox->InvertRect(this->arr_rect_5b7c);
@@ -566,8 +566,8 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
this->sub_128_c6a(0);
this->var_i16_3a += 1;
g_toolbox->Delay(0);
- } while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_ev_46.modifiers & 0x80) == 0));
- } while ((this->var_ev_46.modifiers & 0x80) != 0);
+ } while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0));
+ } while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0);
}
}
@@ -850,11 +850,7 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
}
void FoolGame::sub_128_1c2c(int16 unk1) {
- warning("STUB: %s", __func__);
-}
-
-void FoolGame::sub_128_1c30() {
- // 128:1c30
+ this->var_i16_30 = unk1;
this->var_i16_7c6 |= this->var_i16_30;
}
@@ -879,11 +875,11 @@ void FoolGame::sub_128_1f1e() {
void FoolGame::sub_128_1f44() {
// 128:1f44
this->sub_128_61ec();
- this->var_i16_7d4 = 0;
+ this->storyCurrentPage = 0;
this->sub_128_1c4a(0x200);
this->sub_128_5fea();
this->sub_128_0a2(1, 0);
- this->sub_128_2202();
+ this->storyRenderPage();
g_toolbox->SetPort(this->var_i32_0);
}
@@ -894,9 +890,12 @@ void FoolGame::sub_128_1f76() {
do {
this->var_i32_692 = g_toolbox->TickCount();
this->sub_128_20d0();
- this->sub_128_406(5);
+ // original was 5 ticks
+ this->sub_128_406(10);
+ // new: empty the event queue, so feedback is instant
+ g_toolbox->FlushEvents(-1, 0);
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- } while ((this->var_ev_46.modifiers & 0x80) == 0);
+ } while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
}
// 128:1fec
}
@@ -929,36 +928,31 @@ void FoolGame::sub_128_20d0() {
// 128:20d0
// change page on scroll
do {
- this->var_i16_7d8 += this->var_i16_7cc;
- if (this->var_i16_7d8 < 1) {
- this->var_i16_7d8 = 1;
+ this->storyNextPage += this->var_i16_7cc;
+ if (this->storyNextPage < 1) {
+ this->storyNextPage = 1;
return;
}
- if (this->var_i16_7d8 >= this->var_i16_7da) {
- this->var_i16_7d8 = this->var_i16_7da;
+ if (this->storyNextPage >= this->storyPageCount) {
+ this->storyNextPage = this->storyPageCount;
return;
}
- } while (this->arr_i16_1b90[this->var_i16_7d8] == 0);
- // The original game took time to redraw the whole screen,
- // which made the scroll happen at a sane rate.
- g_toolbox->Delay(15);
- this->sub_128_2202();
+ } while (this->arr_i16_1b90[this->storyNextPage] == 0);
+ this->storyRenderPage();
}
void FoolGame::sub_128_2126() {
this->sub_128_1c4a(0x40);
// 128:2132
- do {
- this->var_i16_68a = this->var_i16_7dc;
- if (this->var_i16_7dc == this->arr_i16_1a46[this->var_i16_68a]) {
- this->var_i16_7d8 = this->var_i16_68a;
- this->var_i16_68a = this->var_i16_7da;
+ for (int i = this->selectedMenuChapter; i <= this->storyPageCount; i++) {
+ if (this->selectedMenuChapter == this->pageToChapter[i]) {
+ this->storyNextPage = i;
+ i = this->storyPageCount;
}
// 128:2160
- this->var_i16_68a += 1;
- } while (this->var_i16_7da >= this->var_i16_68a);
+ }
// 128:2170
- this->var_i16_7d0 = this->arr_i16_1a46[this->var_i16_7d8];
+ this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
if (this->var_i16_7ce & 4) {
this->var_i16_7ce ^= 4;
if (this->arr_i16_18b2[this->var_i16_7d0] > 0) {
@@ -968,7 +962,7 @@ void FoolGame::sub_128_2126() {
}
}
// 128:21c2
- this->sub_128_2202();
+ this->storyRenderPage();
}
void FoolGame::sub_128_21c8() {
@@ -980,12 +974,14 @@ void FoolGame::sub_128_21c8() {
}
}
-void FoolGame::sub_128_2202() {
+void FoolGame::storyRenderPage() {
// 128:2202
- if (this->var_i16_7d8 != this->var_i16_7d4) {
- if ((this->arr_i16_1dee[this->var_i16_7d8] < 0xe) && (this->var_i16_7de > 0)) {
+ if (this->storyNextPage != this->storyCurrentPage) {
+ if ((this->arr_i16_1dee[this->storyNextPage] < 0xe) && (this->var_i16_7de > 0)) {
this->sub_128_69c(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
- g_zbasic->get(0x3c, 0x122 - (0xf - this->arr_i16_1dee[this->var_i16_7d8]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
+ // 128:226e
+ // grab the last N-1 lines of text from the screen
+ g_zbasic->get(0x3c, 0x122 - (0xf - this->arr_i16_1dee[this->storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
this->var_i16_7e0 = 1;
} else {
// 128:22d4
@@ -993,8 +989,9 @@ void FoolGame::sub_128_2202() {
}
}
// 128:22da
- this->sub_128_8b4(0x127, 0x69, 0x138, 0x190, 0);
- this->var_i16_7d0 = this->arr_i16_1a46[this->var_i16_7d8];
+ // erase lower controls on scroll
+ this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
+ this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
if ((this->var_i16_7ce & 0x8) != 0) {
this->var_i16_7ce ^= 0x8;
this->sub_128_bde(1, 0, 0, 0, 1, 0);
@@ -1025,21 +1022,22 @@ void FoolGame::sub_128_2202() {
g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
}
// 128:2468
- if (this->arr_str_1a288[this->var_i16_7d8] != g_zbasic->str(13)) { // blank
+ if (this->arr_str_1a288[this->storyNextPage] != g_zbasic->str(13)) { // blank
g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
- g_toolbox->DrawString(this->arr_str_1a288[this->var_i16_7d8]);
+ g_toolbox->DrawString(this->arr_str_1a288[this->storyNextPage]);
}
// 128:24be
- if (this->var_i16_7d8 != this->var_i16_7d4) {
+ if (this->storyNextPage != this->storyCurrentPage) {
g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
- this->sub_128_8b4(0x2f, 0x37, 0x11f, 0x1db, 0);
- if (this->var_i16_7e0 == 0) {
+ this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
+ if (this->var_i16_7e0 != 0) {
+ // Paste the previous lines of text, if we copied them
g_zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kPutCopy);
}
// 128:252a
// y-position where the story text should start
- this->var_i16_7a2 = 0x11d - (this->arr_i16_1dee[this->var_i16_7d8] * 0xf);
- if (this->arr_i16_1dee[this->var_i16_7da] < 0xf) {
+ this->var_i16_7a2 = 0x11d - (this->arr_i16_1dee[this->storyNextPage] * 0xf);
+ if (this->arr_i16_1dee[this->storyPageCount] < 0xf) {
g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
g_toolbox->DrawString(g_zbasic->str(14)); // infinity symbol
this->var_i16_7de = this->var_i16_7a2 - 0x1e;
@@ -1050,11 +1048,11 @@ void FoolGame::sub_128_2202() {
// 128:25b6
// printing the story to the screen
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
- for (int i = this->arr_i16_0[this->var_i16_7d8*2]; i <= this->arr_i16_0[this->var_i16_7d8*2+1]; i++) {
- g_toolbox->TextFace(this->arr_i16_194[i]);
+ for (int i = this->pageLineRanges[this->storyNextPage*2]; i <= this->pageLineRanges[this->storyNextPage*2+1]; i++) {
+ g_toolbox->TextFace(this->pageLineFace[i]);
this->var_str_384 = g_zbasic->index(0, i);
g_toolbox->DrawString(this->var_str_384);
- if (this->arr_i16_bbe[i] != 0) {
+ if (this->pageLineBreak[i] != 0) {
// 128:262a
this->var_i16_7a2 += 0xf;
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
@@ -1062,7 +1060,7 @@ void FoolGame::sub_128_2202() {
// 128:263a
}
// 128:265c
- this->var_i16_7d4 = this->var_i16_7d8;
+ this->storyCurrentPage = this->storyNextPage;
}
// 128:2662
}
@@ -1156,8 +1154,8 @@ void FoolGame::sub_128_2bc6() {
}
// 128:2d6a
this->var_i16_484 = 0;
- for (int i = 1; i <= this->var_i16_7da; i++) {
- if (this->arr_i16_1a46[i] == this->var_i16_484+1) {
+ for (int i = 1; i <= this->storyPageCount; i++) {
+ if (this->pageToChapter[i] == this->var_i16_484+1) {
// 128:2d9c
this->var_i16_484++;
if (this->arr_i16_1b90[i] == 1) {
@@ -1175,7 +1173,7 @@ void FoolGame::sub_128_2bc6() {
}
// 128:2e14
g_zbasic->unk_333(0x2);
- this->var_i16_7d8 = 1;
+ this->storyNextPage = 1;
this->var_i16_7ce = 0;
this->var_i16_7e2 = 0;
this->var_i16_7d2 = 0;
@@ -1200,7 +1198,7 @@ void FoolGame::sub_128_2e3e() {
g_zbasic->openR(2, this->var_str_8ec, 0x400, this->var_i16_9ec);
this->var_str_384 = g_zbasic->readFileStr(2, 0x11);
- this->var_i16_7d8 = g_zbasic->readFileInt(2);
+ this->storyNextPage = g_zbasic->readFileInt(2);
this->var_i16_7e2 = g_zbasic->readFileInt(2);
this->var_i16_7ce = g_zbasic->readFileInt(2);
this->var_i16_7d2 = g_zbasic->readFileInt(2);
@@ -1246,11 +1244,12 @@ void FoolGame::sub_128_3032() {
// 128:3180
}
// 128:318e
- this->sub_128_8b4(0x13, 0x37, 0x32, 0xc8, 0);
- this->sub_128_8b4(0x2f, 0x37, 0x11f, 0x1db, 0x0);
+ this->fillRect(0x13, 0x37, 0x32, 0xc8, 0);
+ this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
this->var_i16_7a2 = 0x3c;
this->var_i16_7de = 0x2d;
+ // draw the first page of text
for (int i = 1; i <= 0xf; i++) {
// 128:31ec
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
@@ -1260,8 +1259,8 @@ void FoolGame::sub_128_3032() {
}
// 128:3228
this->sub_128_0a2(0, 0);
- this->var_i16_7d4 = 1;
- this->sub_128_2202();
+ this->storyCurrentPage = 1;
+ this->storyRenderPage();
if ((this->var_i16_7ce & 1) == 0) {
this->sub_128_378a();
} else {
@@ -1367,9 +1366,9 @@ void FoolGame::sub_128_5b30() {
this->sub_128_5ef0();
}
this->var_i32_bf8 = g_toolbox->MenuSelect(this->var_ev_46.where);
- this->var_i16_e16 = (uint16)(this->var_i32_bf8 >> 16);
- this->var_i16_e18 = (uint16)(this->var_i32_bf8 & 0xffff);
- if (this->var_i16_e16 > 0) {
+ this->selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
+ this->selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
+ if (this->selectedMenuID > 0) {
// 128:5b8c
this->sub_128_5c20();
g_toolbox->HiliteMenu(0);
@@ -1388,21 +1387,21 @@ void FoolGame::sub_128_5baa() {
void FoolGame::sub_128_5c20() {
this->var_i16_7c6 = 0;
- if (this->var_i16_e16 == 1) {
+ if (this->selectedMenuID == 1) { // Eye menu
this->sub_128_4a92();
}
- if (this->var_i16_e16 == 2) {
- if (this->var_i16_e18 == 1) {
+ if (this->selectedMenuID == 2) { // File menu
+ if (this->selectedMenuItem == 1) {
this->sub_128_27d6();
- } else if (this->var_i16_e18 == 2) {
+ } else if (this->selectedMenuItem == 2) {
// 128:5c5c
this->sub_128_2988();
- } else if (this->var_i16_e18 == 3) {
+ } else if (this->selectedMenuItem == 3) {
// 128:5c6c
this->sub_128_2a06();
- } else if (this->var_i16_e18 == 4) {
+ } else if (this->selectedMenuItem == 4) {
this->sub_128_2a92();
- } else if (this->var_i16_e18 == 6) {
+ } else if (this->selectedMenuItem == 6) {
if (this->var_i16_378 == 0) {
this->var_i16_378 = 1;
} else {
@@ -1411,34 +1410,34 @@ void FoolGame::sub_128_5c20() {
// 128:5cbc
this->sub_128_32c8();
// 128:5cc4
- } else if (this->var_i16_e18 == 7) {
+ } else if (this->selectedMenuItem == 7) {
this->sub_128_2ae8();
- } else if (this->var_i16_e18 == 9) {
+ } else if (this->selectedMenuItem == 9) {
this->sub_128_2ab6();
}
}
// 128:5cea
- if ((this->var_i16_e16 >= 3) && (this->var_i16_e16 <= 7)) {
+ if ((this->selectedMenuID >= 3) && (this->selectedMenuID <= 7)) { // Chapter menus
this->var_i16_e1a = 0;
- this->var_i16_7dc = this->var_i16_e18 + (this->var_i16_e16 - 3)*0x10;
- if ((this->var_i16_7dc == 1) && (this->var_ev_46.what == 3)) {
+ this->selectedMenuChapter = this->selectedMenuItem + (this->selectedMenuID - 3)*0x10;
+ if ((this->selectedMenuChapter == 1) && (this->var_ev_46.what == kKeyDown)) {
this->var_i16_e1a = 1;
}
// 128:5d56
- if ((this->var_ev_46.modifiers & 0x800) != 0) {
+ if ((this->var_ev_46.modifiers & kModLOptionKeyDown) != 0) {
this->var_i16_e1a = 1;
} else {
// 128:5d74
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0x8, this->var_ev_46);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(1 << kKeyDown, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if ((this->var_ev_46.modifiers & 0x800) != 0) {
+ if ((this->var_ev_46.modifiers & kModLOptionKeyDown) != 0) {
this->var_i16_e1a = 1;
}
} while (this->var_ev_46.what != kNullEvent);
}
// 128:5dae
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->var_i16_7d0 != this->var_i16_7dc)) {
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
this->sub_128_1c2c(0x40);
}
// 128:5df6
@@ -1451,18 +1450,18 @@ void FoolGame::sub_128_5c20() {
this->sub_128_1c2c(0x41);
}
// 128:5e5e
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->var_i16_7d0 != this->var_i16_7dc)) {
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
this->sub_128_1c2c(0x41);
this->var_i16_7ce |= 0x4;
}
}
// 128:5eaa
- if (this->var_i16_e16 == 8) {
- if (this->var_i16_e18 == 1) {
+ if (this->selectedMenuID == 8) { // Puzzle menu
+ if (this->selectedMenuItem == 1) {
this->sub_128_1c2c(1);
}
// 128:5ec6
- if ((this->var_i16_e18 == 3) && (this->var_i16_c00 == 1)) {
+ if ((this->selectedMenuItem == 3) && (this->var_i16_c00 == 1)) {
this->sub_128_1c2c(2);
}
}
@@ -1489,10 +1488,10 @@ void FoolGame::sub_128_5fea() {
if (this->var_i16_37a == 1) {
g_toolbox->SetPort(this->var_i32_8);
g_toolbox->PenNormal();
- this->sub_128_8b4(0x14, 0, this->var_i16_5c, this->var_i16_56-3, 2);
- this->sub_128_8b4(0x14, 0, this->var_i16_58+0x11, this->var_i16_5a, 2);
- this->sub_128_8b4(0x14, this->var_i16_56+0x203, this->var_i16_5c, this->var_i16_5a, 2);
- this->sub_128_8b4(this->var_i16_58 + 0x159, 0, this->var_i16_5c, this->var_i16_5a, 2);
+ this->fillRect(0x14, 0, this->var_i16_5c, this->var_i16_56-3, 2);
+ this->fillRect(0x14, 0, this->var_i16_58+0x11, this->var_i16_5a, 2);
+ this->fillRect(0x14, this->var_i16_56+0x203, this->var_i16_5c, this->var_i16_5a, 2);
+ this->fillRect(this->var_i16_58 + 0x159, 0, this->var_i16_5c, this->var_i16_5a, 2);
g_toolbox->SetRect(this->arr_rect_5b7c, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->FrameRect(this->arr_rect_5b7c);
@@ -1522,7 +1521,7 @@ void FoolGame::sub_128_61ec() {
this->sub_128_6154();
}
g_toolbox->Delay(1);
- } while ((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & 0x80));
+ } while ((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp));
this->var_i16_7c0 = 0;
}
@@ -1538,7 +1537,7 @@ void FoolGame::sub_128_6244() {
this->sub_128_6154();
}
g_toolbox->Delay(1);
- } while ((this->var_ev_46.what == kNullEvent) && ((this->var_ev_46.modifiers & 0x80) == 0));
+ } while ((this->var_ev_46.what == kNullEvent) && ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0));
// SEGMENT_RETURN
}
@@ -1614,10 +1613,10 @@ void FoolGame::sub_129_068() {
}
if ((this->var_i16_5a != SCREEN_WIDTH) || (this->var_i16_5c != SCREEN_HEIGHT)) {
- this->sub_128_8b4(0, 0, this->var_i16_5c, this->var_i16_5a, 2);
+ this->fillRect(0, 0, this->var_i16_5c, this->var_i16_5a, 2);
} else {
// 129:0224
- this->sub_128_8b4(0, 0, this->var_i16_5c, this->var_i16_5a, 1);
+ this->fillRect(0, 0, this->var_i16_5c, this->var_i16_5a, 1);
}
// 129:023e
g_toolbox->GetPort(this->var_i32_f24);
@@ -1639,7 +1638,7 @@ void FoolGame::sub_129_068() {
this->sub_128_5fea();
// 129:02c8
- this->sub_128_8b4(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
if (false) {
//if (this->var_i16_372.red + this->var_i16_372.blue + this->var_i16_372.green != 0) {
@@ -1711,7 +1710,7 @@ void FoolGame::sub_129_068() {
if (this->var_str_e22 == g_zbasic->str(135)) {
do {
g_zbasic->text(0, 0xc, 0, kSrcBic);
- this->sub_128_8b4(0x17, 0x92, 0x31, 0x16e, 2);
+ this->fillRect(0x17, 0x92, 0x31, 0x16e, 2);
this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
@@ -1719,7 +1718,7 @@ void FoolGame::sub_129_068() {
Common::U32String PUZZ = g_zbasic->str(137);
this->sub_128_1e4(PUZZ);
// 129:06a6: CLR.W - -0x772(A5)
- this->sub_128_8b4(0x17, 0x92, 0x31, 0x16e, 1);
+ this->fillRect(0x17, 0x92, 0x31, 0x16e, 1);
this->sub_128_4da(0);
if (this->var_str_588 == g_zbasic->str(138)) {
g_zbasic->unk_4();
@@ -1798,139 +1797,144 @@ void FoolGame::sub_129_068() {
this->var_i16_68a = 0x50;
this->sub_129_123a();
for (int i = 1; i <= 0x64; i++) {
- this->arr_i32_19454[i] = this->sub_128_462();
+ this->arr_i32_19454[i] = this->puzzlesReadLong();
}
// 129:0a4e
// quickdraw patterns
// reworked slightly to fill the pattern buffer directly
for (int i = 0; i <= 0x50; i++) {
for (int j = 0; j <= 0x7; j++) {
- this->arr_pat_58f4[i].data[j] = (byte)this->sub_128_428();
+ this->arr_pat_58f4[i].data[j] = (byte)this->puzzlesReadByte();
}
}
// 129:0a8a
for (int i = 1; i <= 0x2a; i++) {
this->arr_curs_4d88[i] = Common::SharedPtr<Cursor>(new Cursor());
for (int j = 0; j < 16; j++) {
- this->arr_curs_4d88[i]->data[j] = (uint16)this->sub_128_446();
+ this->arr_curs_4d88[i]->data[j] = (uint16)this->puzzlesReadShort();
}
for (int j = 0; j < 16; j++) {
- this->arr_curs_4d88[i]->mask[j] = (uint16)this->sub_128_446();
+ this->arr_curs_4d88[i]->mask[j] = (uint16)this->puzzlesReadShort();
}
- this->arr_curs_4d88[i]->mouse.y = this->sub_128_446();
- this->arr_curs_4d88[i]->mouse.x = this->sub_128_446();
+ this->arr_curs_4d88[i]->mouse.y = this->puzzlesReadShort();
+ this->arr_curs_4d88[i]->mouse.x = this->puzzlesReadShort();
this->arr_curs_4d88[i]->render();
}
// 129:0ad4
for (int i = 0; i <= 0xf; i++) {
- this->arr_i16_4738[i] = this->sub_128_446();
+ this->arr_i16_4738[i] = this->puzzlesReadShort();
}
// 129:0b02
for (int i = 1; i <= 0x51; i++) {
- this->arr_i16_4c7c[i] = this->sub_128_428();
+ this->arr_i16_4c7c[i] = this->puzzlesReadByte();
}
// 129:0b30
for (int i = 1; i <= 0xc; i++) {
for (int j = 0; j <= 3; j++) {
- this->arr_i16_4d20[i*4 + j] = this->sub_128_446();
+ this->arr_i16_4d20[i*4 + j] = this->puzzlesReadShort();
}
}
// 129:0b78
- this->var_i16_103a = this->sub_128_446();
- // story menu entries
+ this->var_i16_103a = this->puzzlesReadShort();
+ // story menu entries + endgame puzzles
for (int i = 1; i <= this->var_i16_103a; i++) {
- this->arr_i16_18b2[i] = this->sub_128_446();
- this->arr_i16_15e8[i] = this->sub_128_446();
- this->arr_i16_197c[i] = this->sub_128_446();
- this->arr_str_195e8[i] = this->sub_128_49a();
+ this->arr_i16_18b2[i] = this->puzzlesReadShort();
+ this->arr_i16_15e8[i] = this->puzzlesReadShort();
+ this->arr_i16_197c[i] = this->puzzlesReadShort();
+ this->arr_str_195e8[i] = this->puzzlesReadString();
}
// 129:0c0a
- this->var_i16_103a = this->sub_128_446();
+ this->var_i16_103a = this->puzzlesReadShort();
for (int i = 1; i <= this->var_i16_103a; i++) {
for (int j = 0; j <= 5; j++) {
- this->arr_i16_16b2[i*8+j] = this->sub_128_446();
+ this->arr_i16_16b2[i*8+j] = this->puzzlesReadShort();
}
}
// 129:0c5e
- this->var_i16_7da = this->sub_128_446();
- for (int i = 1; i <= this->var_i16_7da; i++) {
- this->arr_i16_1a46[i] = this->sub_128_446();
+ this->storyPageCount = this->puzzlesReadShort();
+ for (int i = 1; i <= this->storyPageCount; i++) {
+ this->pageToChapter[i] = this->puzzlesReadShort();
}
// 129:0c98
- for (int i = 1; i <= this->var_i16_7da; i++) {
- this->arr_i16_0[i*2] = this->sub_128_446();
- this->arr_i16_0[i*2 + 1] = this->sub_128_446();
+ for (int i = 1; i <= this->storyPageCount; i++) {
+ this->pageLineRanges[i*2] = this->puzzlesReadShort();
+ this->pageLineRanges[i*2 + 1] = this->puzzlesReadShort();
}
// 129:0ce0
- this->var_i16_103a = this->sub_128_446();
+ this->var_i16_103a = this->puzzlesReadShort();
for (int i = 1; i <= this->var_i16_103a; i++) {
- this->arr_i16_1b10[i*2] = this->sub_128_446();
- this->arr_i16_1b10[i*2 + 1] = this->sub_128_446();
+ this->arr_i16_1b10[i*2] = this->puzzlesReadShort();
+ this->arr_i16_1b10[i*2 + 1] = this->puzzlesReadShort();
}
// 129:0d3c
// story text
- this->var_i16_103c = this->sub_128_446();
+ this->var_i16_103c = this->puzzlesReadShort();
this->var_i16_68a = 1;
for (int i = 1; i <= this->var_i16_103c; i++) {
- this->var_i16_103e = this->sub_128_428();
+ this->var_i16_103e = this->puzzlesReadByte();
+ // indent at start of story paragraph
if (this->var_i16_103e & 0x8) {
this->var_i16_103e ^= 0x8;
- this->var_str_384 = this->sub_128_49a();
+ this->var_str_384 = this->puzzlesReadString();
// 129:0d7e
- // indent at start of story paragraph
g_zbasic->indexSet(g_zbasic->space(4) + this->var_str_384, 0, i);
} else {
// 129:0da4
- g_zbasic->indexSet(this->sub_128_49a(), 0, i);
+ g_zbasic->indexSet(this->puzzlesReadString(), 0, i);
}
// 129:0db8
+ // 0x4 == newline
+ // 0x1 == normal formatting
if ((this->var_i16_103e == 1) || (this->var_i16_103e == 4)) {
- this->arr_i16_194[i] = 0;
+ this->pageLineFace[i] = 0;
}
+
// 129:0dea
+ // 0x2 = bold formatting
if ((this->var_i16_103e == 2) || (this->var_i16_103e == 5)) {
- this->arr_i16_194[i] = 1;
+ this->pageLineFace[i] = 1;
}
// 129:0e1e
+ // 0x3 = outlined
if ((this->var_i16_103e == 3) || (this->var_i16_103e == 6)) {
- this->arr_i16_194[i] = 0x19;
+ this->pageLineFace[i] = 0x19;
}
// 129:0e52
- if (this->var_i16_103e <= 3) {
- this->arr_i16_bbe[i] = 1;
+ if (this->var_i16_103e > 3) {
+ this->pageLineBreak[i] = 1;
}
// 129:0e6e
}
// 129:0e80
this->var_i16_68a = 0x64;
this->sub_129_123a();
- this->var_i16_103a = this->sub_128_446();
+ this->var_i16_103a = this->puzzlesReadShort();
for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
- g_zbasic->indexSet(this->sub_128_49a(), 0, i);
+ g_zbasic->indexSet(this->puzzlesReadString(), 0, i);
}
// 129:0ec2
for (int j = 1; j <= 0x50; j++) {
this->var_i16_1040 = 0;
- for (int i = 1; i <= this->var_i16_7da; i++) {
- if (this->arr_i16_1a46[i] == j) {
+ for (int i = 1; i <= this->storyPageCount; i++) {
+ if (this->pageToChapter[i] == j) {
this->var_i16_1040++;
}
// 129:0ef4
- if (this->arr_i16_1a46[i] < j) {
- i = this->var_i16_7da;
+ if (this->pageToChapter[i] < j) {
+ i = this->storyPageCount;
}
// 129:0f16
}
if (this->var_i16_1040 > 1) {
this->var_i16_484 = 0;
- for (int i = 1; i <= this->var_i16_7da; i++) {
- if (this->arr_i16_1a46[i] == j) {
+ for (int i = 1; i <= this->storyPageCount; i++) {
+ if (this->pageToChapter[i] == j) {
this->var_i16_484++;
this->arr_str_1a288[i] = Common::U32String::format("%s %d %s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
}
// 129:0fb6
- if (this->arr_i16_1a46[i] < j) {
- i = this->var_i16_7da;
+ if (this->pageToChapter[i] < j) {
+ i = this->storyPageCount;
}
// 129:0fd8
}
@@ -1938,9 +1942,9 @@ void FoolGame::sub_129_068() {
// 129:0fea
}
// 129:0ff8
- for (int j = 1; j <= this->var_i16_7da; j++) {
- for (int i = this->arr_i16_0[j*2]; i <= this->arr_i16_0[j*2 + 1]; i++) {
- if (this->arr_i16_bbe[i] != 0) {
+ for (int j = 1; j <= this->storyPageCount; j++) {
+ for (int i = this->pageLineRanges[j*2]; i <= this->pageLineRanges[j*2 + 1]; i++) {
+ if (this->pageLineBreak[i] != 0) {
// 129:102e
this->arr_i16_1dee[j]++;
}
@@ -1991,7 +1995,7 @@ void FoolGame::sub_129_068() {
void FoolGame::sub_129_123a() {
g_toolbox->SetPort(this->var_i32_8);
- this->sub_128_8b4(0, 7, 0x13, this->var_i16_5a - 7, 0);
+ this->fillRect(0, 7, 0x13, this->var_i16_5a - 7, 0);
g_zbasic->text(0, 0xc, 0, kSrcOr);
// Loading Game text
this->var_str_172 = Common::U32String::format("%s %d%s", g_zbasic->str(158).encode().c_str(), this->var_i16_68a, g_zbasic->str(159).encode().c_str());
@@ -2005,12 +2009,12 @@ void FoolGame::sub_130_004() {
// 130:0004
this->var_i16_d0c = 0;
this->sub_128_271a();
- this->var_i16_1056 = this->sub_128_446();
+ this->var_i16_1056 = this->puzzlesReadShort();
this->var_i16_1058 = 1;
- this->var_i16_105a = this->sub_128_446();
+ this->var_i16_105a = this->puzzlesReadShort();
if ((this->var_i16_105a & 0x1) == 1) {
for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = this->sub_128_446();
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
}
}
// 130:0066
@@ -2033,12 +2037,12 @@ void FoolGame::sub_130_004() {
} while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_rect_1ec8.left, this->arr_rect_1ec0.right));
// 130:0156
if ((this->var_i16_105a & 0x2) == this->var_i16_105a) {
- this->var_i16_105c = this->sub_128_446();
- this->var_i16_105e = this->sub_128_446();
- this->var_i16_1060 = this->sub_128_446();
- this->var_i16_1062 = this->sub_128_446();
- this->var_i16_1064 = this->sub_128_446();
- this->var_i16_1066 = this->sub_128_446();
+ this->var_i16_105c = this->puzzlesReadShort();
+ this->var_i16_105e = this->puzzlesReadShort();
+ this->var_i16_1060 = this->puzzlesReadShort();
+ this->var_i16_1062 = this->puzzlesReadShort();
+ this->var_i16_1064 = this->puzzlesReadShort();
+ this->var_i16_1066 = this->puzzlesReadShort();
if (this->var_i16_1066 > 0) {
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
@@ -2046,11 +2050,11 @@ void FoolGame::sub_130_004() {
}
}
// 130:01f0
- this->var_i16_1068 = this->sub_128_446();
+ this->var_i16_1068 = this->puzzlesReadShort();
if (this->var_i16_1068 == 6) {
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_2f38[i*32 + j] = this->sub_128_428();
+ this->arr_i16_2f38[i*32 + j] = this->puzzlesReadByte();
this->arr_i16_3b38[i*32 + j] = 0;
}
}
@@ -2064,13 +2068,13 @@ void FoolGame::sub_130_004() {
}
}
// 130:0306
- this->var_i16_103a = this->sub_128_446();
+ this->var_i16_103a = this->puzzlesReadShort();
if (this->var_i16_103a > 0) {
g_toolbox->PenNormal();
g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_1060]);
this->var_i16_484 = 0;
for (int j = 1; j <= this->var_i16_103a; j++) {
- this->var_i16_106a = this->sub_128_446();
+ this->var_i16_106a = this->puzzlesReadShort();
if (this->var_i16_106a == 0) {
this->var_i16_484 += 10;
} else {
@@ -2095,16 +2099,16 @@ void FoolGame::sub_130_004() {
}
// 130:03d4
if (this->var_i16_1068 == 4) {
- this->sub_128_8b4(0x63, 0xae, 0x108, 0x153, 2);
+ this->fillRect(0x63, 0xae, 0x108, 0x153, 2);
}
// 130:03fe
//if (this->var_i16_c04 <= this->var_i16_1058)
this->var_i16_106e = 0;
this->var_str_1070 = g_zbasic->str(168); // empty
this->var_str_1170 = g_zbasic->str(169); // empty
- this->var_i16_1270 = this->sub_128_446();
+ this->var_i16_1270 = this->puzzlesReadShort();
this->var_i16_103a = 1;
- this->var_str_1272 = this->sub_128_49a();
+ this->var_str_1272 = this->puzzlesReadString();
this->var_i16_1372 = this->var_str_1272.size();
this->var_str_1170 = this->var_str_1170 + this->var_str_1272;
// 130:047e
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index e90bfe5e59e..65e611ac5c3 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -45,10 +45,10 @@ public:
void sub_128_342(int16 unk2, int16 unk1);
void sub_128_3da(int16 unk1);
void sub_128_406(int16 unk1);
- int16 sub_128_428();
- int16 sub_128_446();
- int32 sub_128_462();
- Common::U32String sub_128_49a();
+ int16 puzzlesReadByte(); // sub_128_428
+ int16 puzzlesReadShort(); // sub_128_446
+ int32 puzzlesReadLong(); // sub_128_462
+ Common::U32String puzzlesReadString(); // sub_128_49a
void sub_128_4da(int16 unk1);
void sub_128_50e(int16 unk3, int16 unk2, int16 unk1);
void sub_128_55c(Common::U32String &unk1);
@@ -56,7 +56,7 @@ public:
OSErr sub_128_64c(int16 unk1);
void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_712(int16 unk3, int16 unk2, int16 unk1);
- void sub_128_8b4(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
void sub_128_918(Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
@@ -66,7 +66,6 @@ public:
void sub_128_178a(int16 unk2, int16 unk1);
void sub_128_1c2c(int16 unk1);
- void sub_128_1c30();
void sub_128_1c4a(int16 unk1);
void sub_128_1f1e();
void sub_128_1f44();
@@ -76,7 +75,7 @@ public:
void sub_128_20d0();
void sub_128_2126();
void sub_128_21c8();
- void sub_128_2202();
+ void storyRenderPage();
void sub_128_271a();
void sub_128_27d6();
void sub_128_2808();
@@ -185,11 +184,11 @@ private:
int16 var_i16_7ce;
int16 var_i16_7d0;
int16 var_i16_7d2;
- int16 var_i16_7d4;
+ int16 storyCurrentPage; // var_i16_7d4
int16 var_i16_7d6;
- int16 var_i16_7d8;
- int16 var_i16_7da;
- int16 var_i16_7dc;
+ int16 storyNextPage; // var_i16_7d8
+ int16 storyPageCount; // var_i16_7da
+ int16 selectedMenuChapter; // var_i16_7dc
int16 var_i16_7de;
int16 var_i16_7e0;
int16 var_i16_7e2;
@@ -208,8 +207,8 @@ private:
int16 var_i16_d0c;
int16 var_i16_e12;
int16 var_i16_e14;
- int16 var_i16_e16;
- int16 var_i16_e18;
+ int16 selectedMenuID; // var_i16_e16
+ int16 selectedMenuItem; // var_i16_e18
int16 var_i16_e1a;
int16 var_i16_e20;
Common::U32String var_str_e22;
@@ -246,14 +245,14 @@ private:
// FIXME: bounds on the following are guessed! need to trace index range
- int16 arr_i16_0[202];
- int16 arr_i16_194[202];
- int16 arr_i16_bbe[202];
+ int16 pageLineRanges[202]; // arr_i16_0
+ int16 pageLineFace[1301]; // arr_i16_194
+ int16 pageLineBreak[1301]; // arr_i16_bbe
int16 arr_i16_15e8[101];
int16 arr_i16_16b2[0x100];
int16 arr_i16_18b2[101];
int16 arr_i16_197c[101];
- int16 arr_i16_1a46[101];
+ int16 pageToChapter[101]; // arr_i16_1a46
int16 arr_i16_1b10[6969];
int16 arr_i16_1b90[101];
int16 arr_i16_1c5a[16];
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 5d039adf2cf..a1342ca6571 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -434,7 +434,7 @@ void FoolPrologue::sub_128_e80() {
}
// keep looping until mouse is seen as up??
// see I-252
- if ((this->var_ev_22.modifiers & 0x80) && (this->var_ev_22.what == kNullEvent)) {
+ if ((this->var_ev_22.modifiers & kModMouseButtonUp) && (this->var_ev_22.what == kNullEvent)) {
break;
}
// wait until next redraw
@@ -1056,7 +1056,7 @@ void FoolPrologue::prologueRun() {
// 130:0bee
this->var_i16_1ba = g_toolbox->GetNextEvent(2, this->var_ev_22);
}
- while (!((this->var_ev_22.what == kNullEvent) && (this->var_ev_22.modifiers & 0x80))) {
+ while (!((this->var_ev_22.what == kNullEvent) && (this->var_ev_22.modifiers & kModMouseButtonUp))) {
// 130:0c0c
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_74 += this->var_i16_192;
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 8aee9c39bb1..cd31a9ba21c 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -103,6 +103,22 @@ uint32 Toolbox::Delay(uint32 numTicks) {
return (uint32)(g_system->getMillis() * 60 / 1000);
}
+void Toolbox::FlushEvents(uint32 eventMask, uint32 stopMask) {
+ if ((eventMask == 0xffffffff) && (stopMask == 0)) {
+ _events.clear();
+ return;
+ }
+ for (auto it = _events.begin(); it != _events.end(); ) {
+ if ((1 << it->what) & stopMask) {
+ return;
+ } else if ((1 << it->what) & eventMask) {
+ it = _events.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
bool Toolbox::GetNextEvent(uint32 eventMask, EventRecord &theEvent) {
//warning("STUB: Toolbox::GetNextEvent");
_pumpEvents();
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 75d298368aa..e894aa167ae 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -158,6 +158,19 @@ enum EventCode : uint16 {
kScummVMReturnToLauncherEvt = 25,
};
+enum ModifierMask : uint16 {
+ kModForegroundSwitch = 0x0001,
+ kModMouseButtonUp = 0x0080,
+ kModCommandKeyDown = 0x0100,
+ kModLShiftKeyDown = 0x0200,
+ kModCapsLockKeyDown = 0x0400,
+ kModLOptionKeyDown = 0x0800,
+ kModLControlKeyDown = 0x1000,
+ kModRShiftKeyDown = 0x2000,
+ kModROptionKeyDown = 0x4000,
+ kModRControlKeyDown = 0x8000,
+};
+
enum SourceMode : uint16 {
kSrcCopy = 0,
kSrcOr = 1,
@@ -303,6 +316,14 @@ public:
// Delay causes the system to wait for the number of ticks (sixtieths of a second) specified by numTicks, and returns in finalTicks the total number of ticks from system startup to the end of the delay.
uint32 Delay(uint32 numTicks);
+ // PROCEDURE FlushEvents (eventMask, stopMask: INTEGER);
+ // FlushEvents removes events from the event queue as specified by the given event masks. It
+ // removes all events of the type or types specified by eventMask, up to but not including the first
+ // event of any type specified by stopMask; if the event queue doesn't contain any events of the
+ // types specified by eventMask, it does nothing. To remove all events specified by eventMask, use
+ // a stopMask value of 0.
+ void FlushEvents(uint32 eventMask, uint32 stopMask);
+
// FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord) : BOOLEAN;
// GetNextEvent returns the next available event of a specified type or types and, if the event is in
// the event queue, removes it from the queue. The event is returned in the parameter theEvent. The
Commit: 7e328ddb5dabc338a8e9acddbc8ebe335228e3c2
https://github.com/scummvm/scummvm/commit/7e328ddb5dabc338a8e9acddbc8ebe335228e3c2
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:00+02:00
Commit Message:
MACGUI: Add MacMenu::appendMenu
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 5bb6efd23aa..9e8d11ffc17 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -399,14 +399,14 @@ MacMenuSubMenu *MacMenu::addSubMenu(MacMenuSubMenu *submenu, int index) {
index = _items.size() - 1;
if (_items[index]->submenu != nullptr)
- warning("Overwritting submenu #%d", index);
+ warning("MacMenu::addSubMenu: Overwriting submenu #%d", index);
return (_items[index]->submenu = new MacMenuSubMenu());
} else {
if (index == -1)
index = submenu->items.size() - 1;
if (submenu->items[index]->submenu != nullptr)
- warning("Overwritting submenu #%d", index);
+ warning("MacMenu::addSubMenu: Overwriting submenu #%d", index);
return (submenu->items[index]->submenu = new MacMenuSubMenu());
}
}
@@ -692,11 +692,15 @@ void MacMenu::createSubMenuFromString(int id, const char *str, int commandId) {
clearSubMenu(id);
Common::String string(str);
- Common::String item;
MacMenuSubMenu *submenu = getSubmenu(nullptr, id);
if (submenu == nullptr)
submenu = addSubMenu(nullptr, id);
+ appendMenu(submenu, string, commandId);
+}
+
+void MacMenu::appendMenu(MacMenuSubMenu *submenu, const Common::String &string, int commandId) {
+ Common::String item;
for (uint i = 0; i < string.size(); i++) {
while (i < string.size() && (string[i] != ';' && string[i] != '\r')) // Read token, consume \r for popup menu (MacPopUp)
@@ -718,7 +722,7 @@ void MacMenu::createSubMenuFromString(int id, const char *str, int commandId) {
item = Common::String(item.c_str(), p - 1);
}
- if (item == "(-") {
+ if ((item == "(-") || (item.hasPrefix("-"))) {
addMenuItem(submenu, NULL, 0);
} else {
bool enabled = true;
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 7b617025b81..72b2e925281 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -128,6 +128,7 @@ public:
void loadMenuResource(Common::MacResManager *resFork, uint16 id);
void loadMenuBarResource(Common::MacResManager *resFork, uint16 id);
void createSubMenuFromString(int id, const char *string, int commandId);
+ void appendMenu(MacMenuSubMenu *submenu, const Common::String &string, int commandId);
void clearSubMenu(int id);
MacMenuSubMenu *getSubmenu(MacMenuSubMenu *submenu, int index);
Commit: b5e4b427c67f0d8e9465ed6cee10ab5bb8b95806
https://github.com/scummvm/scummvm/commit/b5e4b427c67f0d8e9465ed6cee10ab5bb8b95806
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:01+02:00
Commit Message:
FOOL: Menu mostly works, story looks good
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox.h
engines/fool/toolbox_menu.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index ee4842ad6e2..9293c9f6bbf 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -173,7 +173,7 @@ void FoolGame::sub_128_004() {
this->sub_128_2e3e();
}
if (this->var_i16_7c6 & 0x40) {
- this->sub_128_2126();
+ this->menuChapterSelect();
}
if (this->var_i16_7c6 & 0x200) {
this->sub_128_1f44();
@@ -220,8 +220,8 @@ void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
void FoolGame::sub_128_11c(Common::U32String &unk2, Common::U32String &unk1) {
// 128:011c
- g_zbasic->unk_110(this->var_str_272, unk1);
- g_zbasic->unk_110(this->var_str_172, unk2);
+ g_zbasic->stringCopy(this->var_str_272, unk1);
+ g_zbasic->stringCopy(this->var_str_172, unk2);
this->var_str_384 = g_zbasic->str(3);
this->var_i16_586 = 0;
@@ -250,7 +250,7 @@ void FoolGame::sub_128_11c(Common::U32String &unk2, Common::U32String &unk1) {
void FoolGame::sub_128_1e4(Common::U32String &unk1) {
// 128:01e4
- g_zbasic->unk_110(this->var_str_172, unk1);
+ g_zbasic->stringCopy(this->var_str_172, unk1);
this->var_str_588 = g_zbasic->str(4);
this->var_i16_688 = 0;
@@ -390,7 +390,7 @@ void FoolGame::sub_128_50e(int16 unk3, int16 unk2, int16 unk1) {
void FoolGame::sub_128_55c(Common::U32String &unk1) {
// 128:055c
- g_zbasic->unk_110(this->var_str_172, unk1);
+ g_zbasic->stringCopy(this->var_str_172, unk1);
g_toolbox->PenNormal();
g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
@@ -463,7 +463,7 @@ void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16
void FoolGame::sub_128_918(Common::U32String &unk1) {
// 128:0918
- g_zbasic->unk_110(unk1, this->var_str_172);
+ g_zbasic->stringCopy(this->var_str_172, unk1);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo(0x100 - (this->var_i16_30 / 2), this->var_i16_7a2);
g_toolbox->DrawString(this->var_str_172);
@@ -941,7 +941,7 @@ void FoolGame::sub_128_20d0() {
this->storyRenderPage();
}
-void FoolGame::sub_128_2126() {
+void FoolGame::menuChapterSelect() {
this->sub_128_1c4a(0x40);
// 128:2132
for (int i = this->selectedMenuChapter; i <= this->storyPageCount; i++) {
@@ -1997,7 +1997,7 @@ void FoolGame::sub_129_123a() {
g_toolbox->SetPort(this->var_i32_8);
this->fillRect(0, 7, 0x13, this->var_i16_5a - 7, 0);
g_zbasic->text(0, 0xc, 0, kSrcOr);
- // Loading Game text
+ // Loading Game text during initial puzzle load
this->var_str_172 = Common::U32String::format("%s %d%s", g_zbasic->str(158).encode().c_str(), this->var_i16_68a, g_zbasic->str(159).encode().c_str());
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xe);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 65e611ac5c3..86a6476ddcf 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -73,9 +73,9 @@ public:
void sub_128_1fee();
void sub_128_2078();
void sub_128_20d0();
- void sub_128_2126();
+ void menuChapterSelect(); // sub_128_2126
void sub_128_21c8();
- void storyRenderPage();
+ void storyRenderPage(); // sub_128_2202
void sub_128_271a();
void sub_128_27d6();
void sub_128_2808();
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index e894aa167ae..acfb77dcd0c 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -456,23 +456,40 @@ public:
// toolbox_menu.cpp
+ // PROCEDURE AppendMenu(theMenu: MenuHandle; data: Str255);
+ // AppendMenu adds an item or items to the end of the given menu, which must previously have
+ // been allocated by NewMenu or read from a resource file by GetMenu. The data string consists of
+ // the text of the menu item; it may be blank but should not be the empty string. If it begins with a
+ // hyphen (-), the item will be a dividing line across the width of the menu. As described in the
+ // section "Creating a Menu in Your Program", meta-characters may be embedded in the data string.
+ void AppendMenu(MenuHandle &theMenu, const Common::U32String &data);
+
+ // PROCEDURE CheckItem (theMenu: MenuHandle; item: INTEGER, checked: BOOLEAN);
+ // CheckItem places or removes a check mark at the left of the given menu item. After you call
+ // CheckItem with checked=TRUE, a check mark will appear each subsequent time the menu is
+ // pulled down. Calling CheckItem with checked=FALSE removes the check mark from the menu
+ // item (or, if it's marked with a different character, removes that mark).
+ void CheckItem(MenuHandle &theMenu, uint16 item, bool checked);
+
// PROCEDURE ClearMenuBar;
// Call ClearMenuBar to remove all menus from the menu list when you want to start afresh with all
// new menus. Be sure to call DrawMenuBar to update the menu bar.
void ClearMenuBar();
+ // FUNCTION CountMItems (theMenu: MenuHandle): INTEGER;
+ // CountMItems returns the number of menu items in the given menu.
+ uint16 CountMItems(MenuHandle &theMenu);
+
// PROCEDURE DeleteMenu(menuID: INTEGER);
// DeleteMenu deletes a menu from the menu list. If there's no menu with the given menu ID in the
// menu list, DeleteMenu has no effect. Be sure to call DrawMenuBar to update the menu bar; the
// menu tides following the deleted menu will move over to fill the vacancy.
void DeleteMenu(uint16 menuID);
- // PROCEDURE DrawMenuBar;
- // DrawMenuBar redraws the menu bar according to the menu list, incorporating any changes since
- // the last call to DrawMenuBar. This procedure should always be called after a sequence of
- // InsertMenu or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other routine that
- // changes the menu list.
- void DrawMenuBar();
+ // PROCEDURE DisableItem(theMenu: MenuHandle; item: INTEGER);
+ // Given a menu item number in the item parameter, Disableltem disables that menu item; given 0 in
+ // the item parameter, it disables the entire menu.
+ void DisableItem(MenuHandle &theMenu, uint16 item);
// PROCEDURE DisposeMenu(theMenu: MenuHandle);
// Call DisposeMenu to release the memory occupied by a menu that you allocated with NewMenu.
@@ -481,6 +498,19 @@ public:
// need.
void DisposeMenu(MenuHandle &theMenu);
+ // PROCEDURE DrawMenuBar;
+ // DrawMenuBar redraws the menu bar according to the menu list, incorporating any changes since
+ // the last call to DrawMenuBar. This procedure should always be called after a sequence of
+ // InsertMenu or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other routine that
+ // changes the menu list.
+ void DrawMenuBar();
+
+ // PROCEDURE EnableItem(theMenu: MenuHandle; item: INTEGER);
+ // Given a menu item number in the item parameter, EnableItem enables the item (which may have
+ // been disabled with the Disableltem procedure, or with the "(" meta-character in the AppendMenu
+ // string).
+ void EnableItem(MenuHandle &theMenu, uint16 item);
+
// FUNCTION GetMHandle(menuID: INTEGER): MenuHandle;
// Given the menu ID of a menu currentiy installed in the menu list, GetMHandle returns a handle to
// that menu; given any other menu ID, it returns NIL.
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 4ffccb95404..340b057927e 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -19,37 +19,85 @@
*
*/
+#include "common/tokenizer.h"
#include "graphics/macgui/macmenu.h"
-#include "graphics/macgui/mactext-canvas.h"
-#include "graphics/macgui/mactext.h"
-#include "graphics/managed_surface.h"
-#include "graphics/pixelformat.h"
-#include "fool/fool.h"
+#include "fool/detection.h"
#include "fool/toolbox.h"
-#include "fool/utils.h"
namespace Fool {
+void Toolbox::AppendMenu(MenuHandle &theMenu, const Common::U32String &data) {
+ if (!theMenu) {
+ error("Toolbox::AppendMenu: Invalid menu handle");
+ return;
+ }
+
+ debugC(5, kDebugLoading, "Toolbox::AppendMenu: menuID %d, data \"%s\"", theMenu->menuID, data.encode().c_str());
+
+ if (_defaultMenu) {
+ Graphics::MacMenuSubMenu *sub = _defaultMenu->getSubmenu(nullptr, theMenu->menuID-1);
+ if (!sub) {
+ warning("Toolbox::AppendMenu: menu ID %d not found, skipping", theMenu->menuID);
+ return;
+ }
+ _defaultMenu->appendMenu(sub, data.encode(Common::kMacRoman), 0);
+ Common::U32StringTokenizer tok(data, "\r;");
+ while (!tok.empty()) {
+ Common::U32String token = tok.nextToken();
+ theMenu->menuData.push_back(token);
+ }
+ }
+}
+
+void Toolbox::CheckItem(MenuHandle &theMenu, uint16 item, bool checked) {
+ if (!theMenu) {
+ warning("Toolbox::CheckItem: empty menu handle");
+ return;
+ }
+ if (theMenu->menuData.size() < (uint)(item + 1)) {
+ warning("Toolbox::CheckItem: item %d out of range for menu %d", item, theMenu->menuID);
+ return;
+ }
+ warning("STUB: Toolbox::CheckItem");
+}
+
void Toolbox::ClearMenuBar() {
if (_defaultMenu) {
_defaultMenu->setVisible(false);
}
}
+uint16 Toolbox::CountMItems(MenuHandle &theMenu) {
+ if (!theMenu) {
+ error("Toolbox::CountMItems: Invalid menu handle");
+ return 0;
+ }
+ return theMenu->menuData.size();
+}
+
void Toolbox::DeleteMenu(uint16 menuID) {
+ debugC(5, kDebugLoading, "Toolbox::DeleteMenu: menuID %d", menuID);
if (_menu.contains(menuID)) {
_menu.erase(menuID);
}
if (_defaultMenu) {
_defaultMenu->clearSubMenu(menuID-1);
+ _defaultMenu->removeMenuItem(nullptr, menuID-1);
+ _defaultMenu->insertMenuItem(nullptr, "", menuID-1);
}
}
-void Toolbox::DrawMenuBar() {
- if (_defaultMenu) {
- _defaultMenu->setVisible(true);
+void Toolbox::DisableItem(MenuHandle &theMenu, uint16 item) {
+ if (!theMenu) {
+ warning("Toolbox::DisableItem: empty menu handle");
+ return;
+ }
+ if (theMenu->menuData.size() < (uint)(item + 1)) {
+ warning("Toolbox::DisableItem: item %d out of range for menu %d", item, theMenu->menuID);
+ return;
}
+ warning("STUB: Toolbox::DisableItem");
}
void Toolbox::DisposeMenu(MenuHandle &theMenu) {
@@ -57,6 +105,25 @@ void Toolbox::DisposeMenu(MenuHandle &theMenu) {
theMenu = nullptr;
}
+void Toolbox::DrawMenuBar() {
+ if (_defaultMenu) {
+ _defaultMenu->setVisible(true);
+ }
+}
+
+void Toolbox::EnableItem(MenuHandle &theMenu, uint16 item) {
+ if (!theMenu) {
+ warning("Toolbox::EnableItem: empty menu handle");
+ return;
+ }
+ if (theMenu->menuData.size() < (uint)(item + 1)) {
+ warning("Toolbox::EnableItem: item %d out of range for menu %d", item, theMenu->menuID);
+ return;
+ }
+ warning("STUB: Toolbox::EnableItem");
+}
+
+
MenuHandle Toolbox::GetMHandle(uint16 menuID) {
MenuHandle result;
if (_menu.contains(menuID)) {
@@ -104,8 +171,8 @@ MenuHandle Toolbox::NewMenu(uint16 menuID, const Common::U32String &menuTitle) {
}
_defaultMenu->clearSubMenu(menuID-1);
Graphics::MacMenuItem *item = _defaultMenu->getMenuItem(menuID-1);
- item->unicodeText = menuTitle;
- item->unicode = true;
+ item->text = menuTitle.encode(Common::kMacRoman);
+ item->unicode = false;
_defaultMenu->addSubMenu(nullptr, menuID-1);
}
return handle;
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 570baba1b81..614b75f4322 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -371,9 +371,8 @@ PolyHandle Toolbox::OpenPoly() {
void Toolbox::OpenPort(GrafPtr port) {
// source: QuickDraw Routines I-163
- //port->portBits = screenBits;
- //port->portRect = screenBits.bounds;
port->portBits = _defaultBits;
+ port->portRect = Common::Rect(SCREEN_WIDTH, SCREEN_HEIGHT);
port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) }));
port->fgColor = g_engine->_wm._colorBlack;
port->bkColor = g_engine->_wm._colorWhite;
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 0281b5707f2..d65b4d638be 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -24,7 +24,7 @@
#include "common/memstream.h"
#include "common/str-enc.h"
#include "common/stream.h"
-#include "graphics/fontman.h"
+#include "common/tokenizer.h"
#include "graphics/managed_surface.h"
#include "fool/fool.h"
@@ -246,11 +246,83 @@ uint32 ZBasic::mem(int16 index) {
}
void ZBasic::menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title) {
+ debugC(5, kDebugLoading, "ZBasic::menu: menuNo %d, itemNo %d, state %d, title \"%s\"", menuNo, itemNo, state, title.encode().c_str());
MenuHandle handle = _toolbox->GetMHandle(menuNo);
if (!handle) {
handle = _toolbox->NewMenu(menuNo, Common::U32String());
}
- _toolbox->SetItem(handle, itemNo, title);
+
+ int menuCount = _toolbox->CountMItems(handle);
+ if (title.empty()) {
+ // no text, modify the state of an existing item
+ if (itemNo <= menuCount) {
+ if (state == 0) {
+ _toolbox->DisableItem(handle, itemNo);
+ _toolbox->CheckItem(handle, itemNo, false);
+ } else if (state == 1) {
+ _toolbox->EnableItem(handle, itemNo);
+ _toolbox->CheckItem(handle, itemNo, false);
+ } else if (state == 2) {
+ _toolbox->EnableItem(handle, itemNo);
+ _toolbox->CheckItem(handle, itemNo, true);
+ } else if (state >= 3) {
+ warning("ZBasic::menu: custom checkmarks not supported");
+ _toolbox->EnableItem(handle, itemNo);
+ _toolbox->CheckItem(handle, itemNo, true);
+ }
+ } else {
+ warning("ZBasic::menu: no item %d in menu %d, ignoring", itemNo, menuNo);
+ }
+ return;
+ }
+
+ // if requested location is further ahead, pad menu with blanks
+ if (itemNo > menuCount + 1) {
+ for (; menuCount < itemNo-1; menuCount++) {
+ _toolbox->SetItem(handle, menuCount+1, Common::U32String());
+ }
+ }
+
+ Common::U32StringTokenizer tok(title, "\r;");
+ Common::Array<Common::U32String> tokList = tok.split();
+ for (auto &it : tokList) {
+ if (state == 0) {
+ it = Common::U32String("(") + it;
+ } else if (state == 2) {
+ it = Common::U32String("!â") + it;
+ } else if (state >= 3) {
+ warning("ZBasic::menu: custom checkmarks not supported");
+ it = Common::U32String("!â") + it;
+ }
+ }
+
+ if (itemNo != 0 && itemNo == menuCount) {
+ for (auto &it : tokList) {
+ _toolbox->AppendMenu(handle, it);
+ }
+ } else {
+ // the Toolbox API only provides AppendMenu for adding
+ // entries to the end of the list using macro text.
+ // ZBasic wraps it so that it is positional.
+ // need to cut around the stuff that gets overwritten
+
+ Common::Array<Common::U32String> after;
+ for (size_t i = 0; i < (itemNo); i++) {
+ after.push_back(handle->menuData[i]);
+ }
+ for (auto &it : tokList) {
+ after.push_back(it);
+ }
+ for (size_t i = (itemNo)+tokList.size(); i < handle->menuData.size(); i++) {
+ after.push_back(handle->menuData[i]);
+ }
+ _toolbox->DeleteMenu(menuNo);
+ handle = _toolbox->NewMenu(menuNo, after.remove_at(0));
+ for (auto &it : after) {
+ _toolbox->AppendMenu(handle, it);
+ }
+ }
+
}
@@ -466,8 +538,9 @@ void ZBasic::unk_44(int16 unk1) {
warning("STUB: ZBasic::unk_44");
}
-void ZBasic::unk_110(Common::U32String &unk1, Common::U32String &unk2) {
- warning("STUB: ZBasic::unk_110");
+void ZBasic::stringCopy(Common::U32String &target, const Common::U32String &src) {
+ // was: unk_110
+ target = src;
}
void ZBasic::unk_130(int16 unk1) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 9ff6a1ef571..91d987346f3 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -285,8 +285,7 @@ public:
void unk_20();
bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
void unk_44(int16 unk1);
- // string copy? dest, src
- void unk_110(Common::U32String &unk1, Common::U32String &unk2);
+ void stringCopy(Common::U32String &dest, const Common::U32String &src);
void unk_130(int16 unk1);
void unk_158();
void unk_331(uint16 unk1, int16 unk2);
Commit: 14a66db0231cd3cc6afcf17ec65a90042a3130a1
https://github.com/scummvm/scummvm/commit/14a66db0231cd3cc6afcf17ec65a90042a3130a1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:01+02:00
Commit Message:
FOOL: Add story buttons, giant switch statement
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 9293c9f6bbf..27e6db3096f 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -896,24 +896,22 @@ void FoolGame::sub_128_1f76() {
g_toolbox->FlushEvents(-1, 0);
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
- }
- // 128:1fec
-}
-
-void FoolGame::sub_128_1fee() {
- // 128:1fee
- if ((this->var_i16_7d0 == 0x10) && (this->arr_i16_1c7a[0] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
- return;
- }
- // 128:2042
- if (!this->var_i16_7d6) {
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
- this->sub_128_2078();
+ } else {
+ // 128:1fee
+ if ((this->var_i16_7d0 == 0x10) && (this->arr_i16_1c7a[0] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
+ return;
}
+ // 128:2042
+ if (this->var_i16_7d6 != 0) {
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ this->sub_128_2078();
+ }
+ }
+ // 128:2076
}
- // 128:2076
}
+
void FoolGame::sub_128_2078() {
// 128:2078
g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
@@ -1065,6 +1063,13 @@ void FoolGame::storyRenderPage() {
// 128:2662
}
+void FoolGame::sub_128_26f6() {
+ // 128:26f6
+ for (int i = 0; i <= 0x28; i++) {
+ this->arr_i16_1eb8[i] = 0;
+ }
+}
+
void FoolGame::sub_128_271a() {
// record index
this->var_i16_484 = (this->arr_i32_19454[this->var_i16_7e2] - 1) / 1000;
@@ -1244,7 +1249,7 @@ void FoolGame::sub_128_3032() {
// 128:3180
}
// 128:318e
- this->fillRect(0x13, 0x37, 0x32, 0xc8, 0);
+ this->fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
this->var_i16_7a2 = 0x3c;
@@ -1327,9 +1332,268 @@ void FoolGame::sub_128_378a() {
}
void FoolGame::sub_128_39a0() {
+ // 128:39a0
+ this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
+ this->var_i16_7c6 = 0;
+ this->var_i16_c00 = 0;
+ this->var_i16_7d6 = 0;
+ this->var_i16_7b2 = 0xa;
+ this->var_i16_7e2 = this->var_i16_7d0;
+ this->var_i16_7ce |= 1;
+ g_toolbox->InitCursor();
+ this->sub_128_0a2(0, 0);
+ // 128:39fa
+ if (this->arr_i16_15e8[this->var_i16_7d0] > 0) {
+ this->sub_128_41d8();
+ }
+ // 128:3a12
+ this->sub_128_3fb6();
+ this->sub_128_26f6();
+ this->sub_128_61ec();
+ this->sub_128_4168();
+ // 128:3a22
+ // 128:3a38: JSR - "ZBASIC_115"
+ switch (this->arr_i16_18b2[this->var_i16_7d0]) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ this->sub_130_004();
+ break;
+ case 4:
+ this->sub_131_004();
+ break;
+ case 5:
+ this->sub_132_004();
+ break;
+ case 6:
+ this->sub_133_004();
+ break;
+ case 7:
+ this->sub_134_004();
+ break;
+ case 8:
+ this->sub_135_004();
+ break;
+ case 9:
+ this->sub_136_004();
+ break;
+ case 10:
+ this->sub_130_004();
+ break;
+ case 11:
+ this->sub_137_004();
+ break;
+ case 12:
+ this->sub_139_004();
+ break;
+ case 13:
+ this->sub_140_004();
+ break;
+ case 14:
+ this->sub_141_004();
+ break;
+ case 15:
+ this->sub_128_5140();
+ break;
+ case 16:
+ this->sub_142_004();
+ break;
+ case 17:
+ this->sub_142_852();
+ break;
+ case 18:
+ this->sub_142_12ac();
+ break;
+ default:
+ warning("%s: broke out of switch", __func__);
+ break;
+ }
+ // 128:3a8a
+ this->sub_128_5fea();
+ if (this->var_i16_7d2 == 1) {
+ this->sub_128_1c2c(0x100);
+ return;
+ }
+ // 128:3aa4
+ this->sub_128_41aa();
+ if ((this->var_i16_7c6 & 0x20) == 0) {
+ g_toolbox->PenNormal();
+ this->sub_128_0a2(1, 0);
+ this->var_menu_bf8 = g_toolbox->GetMHandle(8);
+ g_toolbox->DeleteMenu(8);
+ g_toolbox->DisposeMenu(this->var_menu_bf8);
+ g_toolbox->DrawMenuBar();
+ }
+ // 128:3aea
+ g_zbasic->unk_333(1);
+ if (this->arr_i16_1c5a[this->var_i16_7d0] == 0x63) {
+ this->sub_128_3de6();
+ }
+ if (this->arr_i16_1c5a[this->var_i16_7d0] == 0x64) {
+ if (this->var_i16_7d0 == 0x41) {
+ if ((this->arr_i16_1d24[0x41] & 2) != 0) {
+ this->arr_i16_1d24[0x41] ^= 2;
+ this->arr_i16_1d24[0x41] |= 1;
+ }
+ // 128:3b9e
+ for (int i = 1; i <= 5; i++) {
+ g_zbasic->menu(7, i, 1, Common::U32String());
+ if (i > 1) {
+ this->arr_i16_1d24[0x40 + i] |= 0x5;
+ }
+ }
+ // 128:3c04
+ this->var_i16_7d8 = 0;
+ this->var_i16_68c = 0x42;
+ for (int i = 0x42; i <= 0x45; i++) {
+ for (int j = 1; j <= this->var_i16_7da; j++) {
+ if (this->pageToChapter[j] == i) {
+ this->arr_i16_1b90[j] = 1;
+ if ((i == 0x42) && (this->var_i16_7d8 == 0)) {
+ this->var_i16_7d8 = j;
+ }
+ }
+ // 128:3c6c
+ if (this->pageToChapter[j] < i) {
+ j = this->var_i16_7da;
+ }
+ // 128:3c8e
+ }
+ }
+ // 128:3cae
+ this->var_i16_7ce |= 8;
+ } else {
+ // 128:3cc0
+ if ((this->arr_i16_1d24[this->var_i16_7d0] & 2) != 0) {
+ this->arr_i16_1d24[this->var_i16_7d0] ^= 2;
+ this->arr_i16_1d24[this->var_i16_7d0] |= 1;
+ }
+ // 128:3d3a
+ this->var_i16_484 = 3 + ((this->var_i16_7d0 - 1) / 0x10);
+ this->var_i16_7e4 = 1 + ((this->var_i16_7d0 - 1) % 0x10);
+ g_zbasic->menu(this->var_i16_7e4, this->var_i16_484, 1, Common::U32String());
+ this->sub_128_3de6();
+ }
+ }
+ // 128:3d82
+ this->var_i16_c02 = 0;
+ this->var_i16_c00 = 0;
+ g_toolbox->SetPort(this->var_i32_0);
+ if ((this->var_i16_7c6 & 0x38) == 0) {
+ if ((this->var_i16_7ce & 1) == 0) {
+ this->var_i16_7ce ^= 1;
+ }
+ if ((this->var_i16_7c6 & 0x40) == 0) {
+ this->storyRenderPage();
+ }
+ }
+ // 128:3de0
+ this->sub_128_61ec();
+ // 128:3de4
+}
+
+void FoolGame::sub_128_3de6() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_3fb6() {
+ // 128:3fb6
+ g_zbasic->menu(8, 0, 1, this->arr_str_195e8[this->var_i16_7e2]);
+ this->var_str_384 = g_zbasic->str(72); // return to scroll
+ if ((this->var_i16_7e2 == 0x34) || (this->var_i16_7e2 == 0x35)) {
+ this->var_str_384 = g_zbasic->str(73); // run for your life
+ }
+ // 128:4024
+ if (this->var_i16_7e2 > 0x50) {
+ this->var_str_384 = g_zbasic->str(74); // return to map
+ }
+ g_zbasic->menu(8, 1, 1, this->var_str_384);
+ // 128:4056
+ if (this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2] <= this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2 + 1]) {
+ g_zbasic->menu(8, 2, 0, g_zbasic->str(75)); // line
+ for (int i = this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2]; i <= this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2 + 1]; i++) {
+ // 128:40f6
+ this->var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(76);
+ g_zbasic->menu(8, this->var_i16_484, 1, this->var_str_384);
+ }
+ }
+ // 128:4166
+}
+
+void FoolGame::sub_128_4168() {
+ // 128:4168
+ this->var_i16_c04 = this->arr_i16_1c5a[this->var_i16_7e2];
+ if (this->var_i16_c04 == 0x64) {
+ this->var_i16_c04 = 0x65;
+ }
+ this->var_str_c06 = g_zbasic->index(2, this->var_i16_7e2);
+}
+
+void FoolGame::sub_128_41aa() {
+ // 128:41aa
+ this->arr_i16_1c5a[this->var_i16_7e2] = this->var_i16_c04;
+ g_zbasic->indexSet(this->var_str_c06, 2, this->var_i16_7e2);
+}
+
+void FoolGame::sub_128_41d8() {
+ // 128:41d8
+ for (int i = 0; i <= 5; i++) {
+ this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[this->var_i16_7e2]*8)];
+ }
+ // 128:422e
+ if ((this->var_i16_7e2 == 0x34) && (this->arr_i16_1cc2 > 1)) {
+ // 128:4262
+ if (this->arr_i16_1cc2 == 2) {
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 2;
+ this->arr_i16_4758[2] = 0xa;
+ }
+ // 128:42aa
+ if (this->arr_i16_1cc2 == 3) {
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 3;
+ this->arr_i16_4758[2] = 0;
+ }
+ // 128:42f0
+ if (this->arr_i16_1cc2 >= 4) {
+ if (this->var_i16_7d2 == 0) {
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 0x47;
+ this->arr_i16_4758[2] = 0;
+ } else {
+ // 128:4346
+ return;
+ }
+ }
+ // 128:4348
+ }
+ // 128:4348
+ if ((this->var_i16_7e2 == 0x17) && (this->arr_i16_1c7a[15] == 0x63)) {
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 2;
+ this->arr_i16_4758[1] = 0xa;
+ }
+ // 128:43aa
+ if ((this->var_i16_7e2 == 0x3f) && (this->arr_i16_1cd8 == 0x63)) {
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 3;
+ this->arr_i16_4758[2] = 0;
+ }
+ // 128:440a
+ if (this->var_i16_7e2 == 0x48) {
+ if (this->arr_i16_1cea == 0x63) {
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 0x47;
+ this->arr_i16_4758[2] = 0;
+ } else {
+ // 128:4462
+ this->arr_i16_4758[1] = 0x31;
+ }
+ }
+ sub_128_4472();
+}
+
void FoolGame::sub_128_4472() {
// 128:4472
if (this->arr_i16_4758[1] == 0) {
@@ -1358,6 +1622,10 @@ void FoolGame::sub_128_4a92() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_128_5140() {
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_128_5b30() {
// 128:5b30
if (this->var_i16_e12 == 0) {
@@ -1504,14 +1772,24 @@ void FoolGame::sub_128_5fea() {
}
void FoolGame::sub_128_6154() {
- warning("STUB: %s", __func__);
+ this->var_i16_e1c = this->var_ev_46.message >> 16;
+ this->var_i16_e1e = this->var_ev_46.message & 0xffff;
+ if (this->var_i16_e1c != 0) {
+ g_zbasic->unk_11(this->var_i16_e1e);
+ }
}
void FoolGame::sub_128_6186() {
- warning("STUB: %s", __func__);
+ // 128:6186
+ do {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(6, this->var_ev_46);
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ g_toolbox->Delay(0);
+ } while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
}
void FoolGame::sub_128_61ec() {
+ // 128:61ec
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
if (this->var_ev_46.what == kUpdateEvt) {
@@ -1521,7 +1799,7 @@ void FoolGame::sub_128_61ec() {
this->sub_128_6154();
}
g_toolbox->Delay(1);
- } while ((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp));
+ } while (!((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp)));
this->var_i16_7c0 = 0;
}
@@ -2117,10 +2395,62 @@ void FoolGame::sub_130_004() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_131_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_132_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_133_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_134_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_135_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_137_004() {
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_139_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_140_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_141_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_004() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_852() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_12ac() {
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_144_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 86a6476ddcf..de7fe63fbe2 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -70,12 +70,12 @@ public:
void sub_128_1f1e();
void sub_128_1f44();
void sub_128_1f76();
- void sub_128_1fee();
void sub_128_2078();
void sub_128_20d0();
void menuChapterSelect(); // sub_128_2126
void sub_128_21c8();
void storyRenderPage(); // sub_128_2202
+ void sub_128_26f6();
void sub_128_271a();
void sub_128_27d6();
void sub_128_2808();
@@ -95,9 +95,15 @@ public:
void sub_128_3774();
void sub_128_378a();
void sub_128_39a0();
+ void sub_128_3de6();
+ void sub_128_3fb6();
+ void sub_128_4168();
+ void sub_128_41aa();
+ void sub_128_41d8();
void sub_128_4472();
void sub_128_4a92();
+ void sub_128_5140();
void sub_128_5b30();
void sub_128_5baa();
void sub_128_5c20();
@@ -116,8 +122,21 @@ public:
void sub_129_123a();
void sub_130_004();
-
+ void sub_131_004();
+ void sub_132_004();
+ void sub_133_004();
+ void sub_134_004();
+ void sub_135_004();
+ void sub_136_004();
+ void sub_137_004();
void sub_138_004();
+ void sub_139_004();
+ void sub_140_004();
+ void sub_141_004();
+
+ void sub_142_004();
+ void sub_142_852();
+ void sub_142_12ac();
void sub_144_004();
private:
@@ -186,6 +205,8 @@ private:
int16 var_i16_7d2;
int16 storyCurrentPage; // var_i16_7d4
int16 var_i16_7d6;
+ int16 var_i16_7d8;
+ int16 var_i16_7da;
int16 storyNextPage; // var_i16_7d8
int16 storyPageCount; // var_i16_7da
int16 selectedMenuChapter; // var_i16_7dc
@@ -203,6 +224,9 @@ private:
uint32 var_i32_bf8;
MenuHandle var_menu_bf8;
int16 var_i16_c00;
+ int16 var_i16_c02;
+ int16 var_i16_c04;
+ Common::U32String var_str_c06;
int16 var_i16_d0c;
int16 var_i16_e12;
@@ -210,6 +234,8 @@ private:
int16 selectedMenuID; // var_i16_e16
int16 selectedMenuItem; // var_i16_e18
int16 var_i16_e1a;
+ int16 var_i16_e1c;
+ int16 var_i16_e1e;
int16 var_i16_e20;
Common::U32String var_str_e22;
int16 var_i16_f22;
@@ -257,6 +283,9 @@ private:
int16 arr_i16_1b90[101];
int16 arr_i16_1c5a[16];
int16 arr_i16_1c7a[16];
+ int16 arr_i16_1cc2;
+ int16 arr_i16_1cd8;
+ int16 arr_i16_1cea;
int16 arr_i16_1d24[202];
int16 arr_i16_1dee[202];
int16 arr_i16_1eb8[4];
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index acfb77dcd0c..710313e08b8 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -210,12 +210,12 @@ struct GrafPort {
Common::Rect portRect;
RgnHandle visRgn;
RgnHandle clipRgn;
- Pattern bkPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
- Pattern fillPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ Pattern bkPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; // white
+ Pattern fillPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; // black
Common::Point pnLoc = {0, 0};
Common::Point pnSize = {1, 1};
PatternMode pnMode = kPatCopy;
- Pattern pnPat = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+ Pattern pnPat = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; // black
uint16 pnVis = 0;
uint16 txFont = 0;
uint16 txFace;
@@ -605,7 +605,7 @@ public:
// the background pattern of the current graphics port. This effectively erases the rounded
// rectangle. Use the ovalWidth and ovalHeight parameters to specify the diameters of
// curvature for the corners of the rounded rectangle.
- void EraseRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+ void EraseRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight);
// PROCEDURE EndUpdate (theWindow: WindowPtr);
// Call EndUpdate to restore the normal visRgn of theWindow's grafPort, which was changed by
@@ -648,7 +648,7 @@ public:
// port, the FrameRoundRect procedure draws an outline just inside the rounded
// rectangle bounded by the rectangle that you specify in the r parameter. The outline is as
// wide as the pen width and as tall as the pen height. The pen location does not change.
- void FrameRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+ void FrameRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight);
// PROCEDURE GetCPixel (h,v: INTEGER; VAR cPix: RGBColor);
// The GetCPixel function returns the RGB of the pixel at the specified position in the current
@@ -720,7 +720,7 @@ public:
// black and every black pixel becomes white. The ovalWidth and ovalHeight
// parameters specify the diameters of curvature for the corners. The pen location does not
// change.
- void InvertRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+ void InvertRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight);
// PROCEDURE KillPoly (poly: PolyHandle);
// KillPoly releases the memory occupied by the given polygon. Use this only when you're completely
@@ -795,7 +795,7 @@ public:
// PaintRoundRect procedure draws the interior of the rounded rectangle bounded by
// the rectangle that you specify in the r parameter. Use the ovalWidth and ovalHeight
// parameters to specify the diameters of curvature for the corners of the rounded rectangle.
- void PaintRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight);
+ void PaintRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight);
// PROCEDURE PenMode (mode: INTEGER);
// PenMode sets the transfer mode through which the pen pattern is transferred onto the bit map
@@ -922,6 +922,7 @@ private:
void _pumpEvents();
void _updateScreen();
void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
+ void _drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 614b75f4322..7e8ab654dd7 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -140,8 +140,10 @@ void Toolbox::EraseRect(const Common::Rect &r) {
}
}
-void Toolbox::EraseRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
- warning("STUB: Toolbox::EraseRoundRect");
+void Toolbox::EraseRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
+ if (_port) {
+ _drawRoundRect(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ }
}
void Toolbox::EndUpdate(WindowRecord &theWindow) {
@@ -190,6 +192,40 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
}
}
+void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight) {
+ if (_port && _port->pnVis == 0) {
+ BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
+
+ Common::Point destPos(r.left, r.top);
+ Graphics::MacPatterns macpat({pat.data});
+
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ // For thicker outlines, the shape should be adjusted inward
+ Common::Rect destRect = intermediate->getBounds();
+ destRect.right -= _port->pnSize.x - 1;
+ destRect.bottom -= _port->pnSize.y - 1;
+
+ if (ovalWidth != ovalHeight) {
+ warning("Toolbox::_drawRoundRect: different corner diameters not supported");
+ }
+ pm.drawRoundRect(destRect, ovalHeight/2, fgColor, !frame, &pd);
+
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+
+ if (debugChannelSet(5, kDebugGraphics)) {
+ debugC(5, kDebugGraphics, "Toolbox::_drawRoundRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x, ovalWidth %d, ovalHeight %d", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor, ovalWidth, ovalHeight);
+ }
+
+ // Dirty rects check
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+ }
+}
+
void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
if (_port) {
_drawRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
@@ -226,8 +262,10 @@ void Toolbox::FrameRect(const Common::Rect &r) {
}
}
-void Toolbox::FrameRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
- warning("STUB: Toolbox::FrameRoundRect");
+void Toolbox::FrameRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
+ if (_port) {
+ _drawRoundRect(r, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ }
}
void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
@@ -304,8 +342,12 @@ void Toolbox::InvertRect(const Common::Rect &r) {
}
}
-void Toolbox::InvertRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
- warning("STUB: Toolbox::InvertRoundRect");
+void Toolbox::InvertRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
+ if (_port) {
+ // set pattern to full black
+ Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
+ _drawRoundRect(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite, ovalWidth, ovalHeight);
+ }
}
@@ -394,8 +436,10 @@ void Toolbox::PaintRect(const Common::Rect &r) {
}
}
-void Toolbox::PaintRoundRect(const Common::Rect &r, int16 ovalWidth, int16 ovalHeight) {
- warning("STUB: Toolbox::PaintRoundRect");
+void Toolbox::PaintRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
+ if (_port) {
+ _drawRoundRect(r, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ }
}
void Toolbox::PenMode(PatternMode mode) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index d65b4d638be..785d95eadbd 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -525,6 +525,10 @@ void ZBasic::unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4) {
warning("STUB: ZBasic::unk_6");
}
+void ZBasic::unk_11(int16 unk1) {
+ warning("STUB: ZBasic::unk_11");
+}
+
void ZBasic::unk_20() {
warning("STUB: ZBasic::unk_20");
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 91d987346f3..097977e83f0 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -282,6 +282,7 @@ public:
void unk_4(); // possibly quit?
int16 unk_5();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
+ void unk_11(int16 unk1);
void unk_20();
bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
void unk_44(int16 unk1);
Commit: 9214cb0a8da76639d02788769f9d38fa66a6836e
https://github.com/scummvm/scummvm/commit/9214cb0a8da76639d02788769f9d38fa66a6836e
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:01+02:00
Commit Message:
FOOL: First pass of jigsaw module
Changed paths:
A engines/fool/fool_jigsaw.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox_menu.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 27e6db3096f..ae1999bd439 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -213,7 +213,7 @@ void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
// 128:00e6
if (this->var_i16_30 == 1) {
// FIXME: use var_i16_32 to choose start offset??
- g_zbasic->put(0, 0, 0, 0, this->arr_bmp_5dfc, kPutCopy);
+ g_zbasic->put(0, 0, this->arr_bmp_5dfc, kPutCopy);
}
}
@@ -281,12 +281,11 @@ void FoolGame::sub_128_1e4(Common::U32String &unk1) {
}
void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
- // FIXME: why is the point inverted in the code??
this->var_i16_68c = unk1;
this->var_i16_68a = unk2;
- this->var_i16_68a = (this->var_ev_46.where.x - this->arr_rect_1ec0.top) / (this->arr_rect_1ec0.bottom);
+ this->var_i16_68a = (this->var_ev_46.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
- this->var_i16_68c = (this->var_ev_46.where.y - this->arr_rect_1ec0.left) / (this->arr_rect_1ec0.right);
+ this->var_i16_68c = (this->var_ev_46.where.y - this->arr_i16_1eb8[5]) / (this->arr_i16_1eb8[7]);
}
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
@@ -324,7 +323,7 @@ void FoolGame::sub_128_406(int16 unk1) {
int16 FoolGame::puzzlesReadByte() {
// 128:0428
// read a byte
- this->var_i16_30 = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ this->var_i16_30 = *(byte *)(&var_bytes_696->data()[this->var_ptr_696]);
debugC(8, kDebugLoading, "Read[%04x]: %02x", this->var_ptr_696, this->var_i16_30);
this->var_ptr_696 += 1;
return this->var_i16_30;
@@ -334,7 +333,7 @@ int16 FoolGame::puzzlesReadByte() {
int16 FoolGame::puzzlesReadShort() {
// 128:0446
// read a short
- this->var_i16_30 = READ_BE_INT16(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ this->var_i16_30 = READ_BE_INT16(&var_bytes_696->data()[this->var_ptr_696]);
debugC(8, kDebugLoading, "Read[%04x]: %04x", this->var_ptr_696, this->var_i16_30);
this->var_ptr_696 += 2;
return this->var_i16_30;
@@ -343,7 +342,7 @@ int16 FoolGame::puzzlesReadShort() {
int32 FoolGame::puzzlesReadLong() {
// 128:0462
// read a long
- this->var_i32_68e = READ_BE_INT32(&arr_bytes_5dfc->data()[this->var_ptr_696]);
+ this->var_i32_68e = READ_BE_INT32(&var_bytes_696->data()[this->var_ptr_696]);
debugC(8, kDebugLoading, "Read[%04x]: %08x", this->var_ptr_696, this->var_i32_68e);
this->var_ptr_696 += 4;
return this->var_i32_68e;
@@ -352,8 +351,8 @@ int32 FoolGame::puzzlesReadLong() {
Common::U32String FoolGame::puzzlesReadString() {
// 128:049a
// read a pascal string
- this->var_i16_79e = *(byte *)(&arr_bytes_5dfc->data()[this->var_ptr_696]);
- this->var_str_69a = Common::U32String((const char *)&arr_bytes_5dfc->data()[this->var_ptr_696+1], this->var_i16_79e, Common::kMacRoman);
+ this->var_i16_79e = *(byte *)(&var_bytes_696->data()[this->var_ptr_696]);
+ this->var_str_69a = Common::U32String((const char *)&var_bytes_696->data()[this->var_ptr_696+1], this->var_i16_79e, Common::kMacRoman);
debugC(8, kDebugLoading, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.encode().c_str());
this->var_ptr_696 += this->var_i16_79e + 1;
return this->var_str_69a;
@@ -1076,9 +1075,10 @@ void FoolGame::sub_128_271a() {
// offset at record
this->var_i16_7e4 = (this->arr_i32_19454[this->var_i16_7e2] - 1) % 1000;
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
+ this->var_ptr_696 = 0;
+ this->arr_bytes_109dc = g_zbasic->readFile(1, this->arr_i32_19454[this->var_i16_7e2 + 1] - this->arr_i32_19454[this->var_i16_7e2]);
+ this->var_bytes_696 = this->arr_bytes_109dc;
-
- warning("STUB: %s", __func__);
}
void FoolGame::sub_128_27d6() {
@@ -1353,7 +1353,7 @@ void FoolGame::sub_128_39a0() {
this->sub_128_4168();
// 128:3a22
// 128:3a38: JSR - "ZBASIC_115"
- switch (this->arr_i16_18b2[this->var_i16_7d0]) {
+ switch (this->arr_i16_18b2[this->var_i16_7d0]-1) {
case 0:
case 1:
case 2:
@@ -1798,7 +1798,8 @@ void FoolGame::sub_128_61ec() {
if (this->var_ev_46.what == kDiskEvt) {
this->sub_128_6154();
}
- g_toolbox->Delay(1);
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(1);
} while (!((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp)));
this->var_i16_7c0 = 0;
}
@@ -2070,6 +2071,7 @@ void FoolGame::sub_129_068() {
// read into pointer
this->arr_bytes_5dfc = g_zbasic->readFile(1, this->var_i32_1036);
+ this->var_bytes_696 = this->arr_bytes_5dfc;
// 129:0a0a
this->var_i16_68a = 0x50;
@@ -2297,22 +2299,22 @@ void FoolGame::sub_130_004() {
}
// 130:0066
this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_rect_1ec8.top;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
do {
- this->var_i16_68a = this->arr_rect_1ec8.bottom;
+ this->var_i16_68a = this->arr_i16_1eb8[10];
do {
this->var_i16_484++;
g_toolbox->SetRect(
this->arr_rect_1f38[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
- this->var_i16_68a + this->arr_pt_1ed0.x,
- this->var_i16_68c + this->arr_pt_1ed0.y
+ this->var_i16_68a + this->arr_i16_1eb8[13],
+ this->var_i16_68c + this->arr_i16_1eb8[12]
);
// 130:00f6
- } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_rect_1ec8.right, this->arr_rect_1ec0.bottom));
+ } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[11], this->arr_i16_1eb8[6]));
// 130:0126
- } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_rect_1ec8.left, this->arr_rect_1ec0.right));
+ } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
// 130:0156
if ((this->var_i16_105a & 0x2) == this->var_i16_105a) {
this->var_i16_105c = this->puzzlesReadShort();
@@ -2399,11 +2401,81 @@ void FoolGame::sub_131_004() {
warning("STUB: %s", __func__);
}
-void FoolGame::sub_132_004() {
- warning("STUB: %s", __func__);
-}
void FoolGame::sub_133_004() {
+ // 133:0004
+ this->sub_128_271a();
+ this->var_i16_c00 = 1;
+ for (int i = 0; i <= 0x11; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ // 133:003c
+ this->var_str_384 = this->puzzlesReadString();
+ // "the completed puzzle will reveal..."
+ this->var_str_384 = g_zbasic->str(209) + this->var_str_384 + g_zbasic->str(210);
+ g_zbasic->menu(8, 0xf, 1, this->var_str_384);
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
+ do {
+ // 133:009e
+ this->var_i16_68a = this->arr_i16_1eb8[10];
+ do {
+ // 133:00b2
+ this->var_i16_484 += 1;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a,
+ this->var_i16_68c,
+ this->var_i16_68a + this->arr_i16_1eb8[13],
+ this->var_i16_68c + this->arr_i16_1eb8[12]
+ );
+ // 133:0112
+ } while (g_zbasic->incrAndCheck(
+ this->var_i16_68a,
+ this->arr_i16_1eb8[11],
+ this->arr_i16_1eb8[6]
+ ));
+ // 133:0142
+ } while (g_zbasic->incrAndCheck(
+ this->var_i16_68c,
+ this->arr_i16_1eb8[9],
+ this->arr_i16_1eb8[7]
+ ));
+ // 133:0172
+ this->var_i16_484 = 0;
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ // 133:0184
+ this->var_i16_484++;
+ this->arr_i16_2f38[i*32 + j] = 0;
+ this->arr_i16_3b38[i*32 + j] = this->var_i16_484;
+ }
+ }
+ // 133:01fa
+ for (int i = 0x12; i <= 0x19; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ // 133:0228
+ g_toolbox->SetPort(this->var_i32_f24);
+ g_zbasic->text(0xfb, 0x18, 0, kSrcOr);
+ this->var_i16_7cc = 1;
+ this->var_i16_103a = this->puzzlesReadShort();
+ for (int i = 0; i <= 4; i++) {
+ this->arr_i16_47d8[this->var_i16_7cc*8 + i] = this->puzzlesReadShort();
+ }
+ // 133:0284
+ for (int i = 5; i <= 6; i++) {
+ this->arr_i16_47d8[this->var_i16_7cc*8 + i] = this->arr_i16_47d8[this->var_i16_7cc*8 + i - 2];
+ }
+ // 133:02de
+ if (this->var_str_c06 != g_zbasic->str(211)) {
+ if (this->var_i16_7cc != 1) {
+ this->var_i16_1aa8 = 1;
+ }
+ this->var_i16_1aaa = 3;
+ //this->arr_i16_47d8[this->var_i16_7cc*8 + this->var_i16_1aaa], this->var_str_c06
+ }
+ // 133:0356
warning("STUB: %s", __func__);
}
@@ -2427,6 +2499,7 @@ void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
+// wheel of fortune game
void FoolGame::sub_139_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index de7fe63fbe2..4cfabffc58b 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -123,7 +123,17 @@ public:
void sub_130_004();
void sub_131_004();
+
void sub_132_004();
+ void sub_132_518();
+ void sub_132_67a();
+ void sub_132_962();
+ void sub_132_e5a();
+ void sub_132_ed8();
+ void sub_132_1384();
+ void sub_132_13ea();
+ void sub_132_1444();
+
void sub_133_004();
void sub_134_004();
void sub_135_004();
@@ -177,7 +187,10 @@ private:
int16 var_i16_68c;
uint32 var_i32_68e;
uint32 var_i32_692;
+ // this is normally a raw pointer to some memory,
+ // instead we track it as a handle + offset
uint32 var_ptr_696;
+ Handle var_bytes_696;
Common::U32String var_str_69a;
int16 var_i16_78a;
int16 var_i16_79e;
@@ -269,6 +282,13 @@ private:
Common::U32String var_str_1272;
int16 var_i16_1372;
+ int16 var_i16_1a9e;
+ int16 var_i16_1aa0;
+ int16 var_i16_1aa4;
+ int16 var_i16_1aa6;
+ int16 var_i16_1aa8;
+ int16 var_i16_1aaa;
+
// FIXME: bounds on the following are guessed! need to trace index range
int16 pageLineRanges[202]; // arr_i16_0
@@ -288,16 +308,18 @@ private:
int16 arr_i16_1cea;
int16 arr_i16_1d24[202];
int16 arr_i16_1dee[202];
- int16 arr_i16_1eb8[4];
- Common::Rect arr_rect_1ec0;
- Common::Rect arr_rect_1ec8;
- Common::Point arr_pt_1ed0;
- Common::Rect arr_rect_1f38[3];
+ int16 arr_i16_1eb8[0x29];
+ Common::Rect arr_rect_1f38[0x200];
int16 arr_i16_2f38[0xc00]; // 96x32?
+ int16 arr_i16_3738[0x400];
int16 arr_i16_3b38[0xc00]; // 96x32?
Common::Rect arr_rect_4338;
- uint16 arr_i16_4738[16];
- uint16 arr_i16_4758[6];
+ int16 arr_i16_4738[16];
+ int16 arr_i16_4758[11];
+ Common::Rect arr_rect_476e;
+ Common::Rect arr_rect_4776;
+ int16 arr_i16_47d8[0x100];
+ int16 arr_i16_49d8[0x100];
int16 arr_i16_4bd8[0x52];
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[48];
@@ -311,7 +333,9 @@ private:
float arr_bcd_5dbc[8];
Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
+ BitMap arr_jigsaw_5dfc[128];
BitMap arr_bmp_b3ec;
+ Handle arr_bytes_109dc; // used for data buffering
BitMap arr_bmp_109dc;
BitMap arr_bmp_15fcc;
GrafPort arr_grafport_18eae;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
new file mode 100644
index 00000000000..48fd8e636ee
--- /dev/null
+++ b/engines/fool/fool_jigsaw.cpp
@@ -0,0 +1,365 @@
+/* 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/ustr.h"
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+#include "graphics/managed_surface.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// jigsaw puzzle game
+void FoolGame::sub_132_004() {
+ // 132:0004
+ this->var_i16_c00 = 1;
+ this->sub_128_271a();
+ this->var_i16_1066 = this->puzzlesReadShort();
+ for (int i = 0; i <= 0xe; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ // 132:0044
+ // puzzle dimensions
+ this->var_i16_1a9e = this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1];
+ for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ this->arr_i16_3738[i] = this->puzzlesReadByte();
+ }
+ // 132:00a2
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
+ g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ this->var_i16_1aa0 = 4 + ((this->arr_i16_1eb8[12] + 1)*2) * ((this->arr_i16_1eb8[13]+0x10)/0x10);
+ // 132:0136
+ this->var_i16_1aa0 = (this->var_i16_1aa0 / 2) + 1;
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
+ do {
+ this->var_i16_68a = this->arr_i16_1eb8[10];
+ do {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a + 1,
+ this->var_i16_68c + 1,
+ this->var_i16_68a + this->arr_i16_1eb8[13],
+ this->var_i16_68c + this->arr_i16_1eb8[12]
+ );
+ //this->var_i16_1aa2 = 0x2af8 + this->var_i16_1aa0*(this->arr_i16_3738[this->var_i16_484] - 1);
+ // 132:0216
+ this->arr_jigsaw_5dfc[this->var_i16_484] = BitMap(new Graphics::ManagedSurface());
+ g_zbasic->get(
+ this->arr_rect_1f38[this->var_i16_484].left,
+ this->arr_rect_1f38[this->var_i16_484].top,
+ this->arr_rect_1f38[this->var_i16_484].right,
+ this->arr_rect_1f38[this->var_i16_484].bottom,
+ this->arr_jigsaw_5dfc[this->var_i16_484]
+ );
+ } while (g_zbasic->incrAndCheck(
+ this->var_i16_68a,
+ this->arr_i16_1eb8[11],
+ this->arr_i16_1eb8[6]
+ ));
+ // 132:02dc
+ } while (g_zbasic->incrAndCheck(
+ this->var_i16_68c,
+ this->arr_i16_1eb8[9],
+ this->arr_i16_1eb8[7]
+ ));
+ // 132:030c
+ this->var_i16_484 = 0;
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->var_i16_484++;
+ this->arr_i16_2f38[i*32 + j] = this->var_i16_484;
+ }
+ }
+ // 132:0376
+ // rearrange picture tiles to match state
+ if (this->var_str_c06 != g_zbasic->str(207)) { // empty
+ for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ this->arr_i16_3738[i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, i*2 - 1, 2));
+ g_zbasic->put(
+ this->arr_rect_1f38[i].left,
+ this->arr_rect_1f38[i].top,
+ this->arr_jigsaw_5dfc[i],
+ kPutCopy
+ );
+ // 132:0452
+ }
+ }
+ // 132:0464
+ this->var_i16_7c6 = 0;
+ g_zbasic->menu(8, 3, 0, Common::U32String());
+ g_toolbox->InitCursor();
+ this->sub_132_13ea();
+ // JMP 0x4d8
+
+ // 132:04d8
+ // input loop
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
+ // 132:0484
+ // 132:049c
+ while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
+ // 132:0488
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == kMouseDown) {
+ this->sub_132_518();
+ }
+ g_toolbox->Delay(0);
+ }
+ // 132:04b8
+ if (this->var_i16_7c6 == 2) {
+ this->sub_132_e5a();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_132_1384();
+ this->sub_128_3536();
+ }
+ }
+ // 132:0500
+ if (this->var_i16_d0c != 0) {
+ this->sub_132_1444();
+ }
+ this->sub_132_1384();
+ // JMP 0x14a6
+ // 132:14a6
+}
+
+void FoolGame::sub_132_518() {
+ // 132:0518
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ if ((this->var_i16_68a < 1) || ((this->var_i16_68a - (this->arr_i16_1eb8[0])) > 0) || (this->var_i16_68c < 1) || ((this->var_i16_68c - (this->arr_i16_1eb8[1])) > 0)) {
+ return;
+ }
+ // 132:059c
+ this->var_i16_e12 = 1;
+ g_zbasic->menu(8, 3, 0, Common::U32String());
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(3, 3);
+ g_toolbox->PenMode(kPatXor);
+ // 132:05c4
+ this->arr_i16_4758[0] = this->var_i16_68a;
+ this->arr_i16_4758[1] = this->var_i16_68c;
+ this->sub_132_67a();
+ g_toolbox->FrameRect(this->arr_rect_476e);
+ this->arr_i16_4758[0] -= this->var_i16_68a;
+ this->arr_i16_4758[1] -= this->var_i16_68c;
+ // 132:0642
+ this->sub_132_962();
+ g_toolbox->FrameRect(this->arr_rect_476e);
+ this->sub_132_ed8();
+ this->sub_132_13ea();
+ this->sub_128_6186();
+ g_zbasic->menu(8, 3, 1, Common::U32String());
+ this->var_i16_e12 = 0;
+}
+
+void FoolGame::sub_132_67a() {
+ do {
+ this->sub_128_c6a(4);
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
+ if (this->var_i16_68a >= this->arr_i16_4758[0]) {
+ this->arr_i16_4758[2] = this->arr_i16_4758[0];
+ this->arr_i16_4758[3] = this->var_i16_68a;
+ } else {
+ // 132:06fc
+ this->arr_i16_4758[2] = this->var_i16_68a;
+ this->arr_i16_4758[3] = this->arr_i16_4758[0];
+ }
+ // 132:072c
+ if (this->var_i16_68c >= this->arr_i16_4758[1]) {
+ this->arr_i16_4758[6] = this->arr_i16_4758[1];
+ this->arr_i16_4758[7] = this->var_i16_68c;
+ } else {
+ this->arr_i16_4758[6] = this->var_i16_68c;
+ this->arr_i16_4758[7] = this->arr_i16_4758[1];
+ }
+ // 132:07b0
+ this->arr_rect_476e.top = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
+ // 132:080e
+ this->arr_rect_476e.left = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
+ this->arr_rect_476e.bottom = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
+ this->arr_rect_476e.right = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
+ // 132:092e
+ g_toolbox->FrameRect(this->arr_rect_476e);
+ this->sub_128_3da(2);
+ g_toolbox->FrameRect(this->arr_rect_476e);
+ this->sub_128_3da(1);
+ } while (this->var_ev_46.what != kMouseUp);
+}
+
+void FoolGame::sub_132_962() {
+ do {
+ this->sub_128_c6a(2);
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
+ if (this->arr_i16_4758[0] >= 0) {
+ this->arr_i16_4758[4] = this->var_i16_68a;
+ this->arr_i16_4758[5] = this->var_i16_68a + this->arr_i16_4758[0];
+ } else {
+ // 132:09e2
+ this->arr_i16_4758[4] = this->var_i16_68a + this->arr_i16_4758[0];
+ this->arr_i16_4758[5] = this->var_i16_68a;
+ }
+ // 132:0a1e
+ if (this->arr_i16_4758[1] >= 0) {
+ this->arr_i16_4758[8] = this->var_i16_68c;
+ this->arr_i16_4758[9] = this->var_i16_68c + this->arr_i16_4758[1];
+ } else {
+ // 132:0a70
+ this->arr_i16_4758[8] = this->var_i16_68c + this->arr_i16_4758[1];
+ this->arr_i16_4758[9] = this->var_i16_68c;
+ }
+ // 132:0aac
+ if (this->arr_i16_4758[4] < 1) {
+ this->arr_i16_4758[4] = 1;
+ this->arr_i16_4758[5] = 1 + ABS(this->arr_i16_4758[0]);
+ }
+ // 132:0b10
+ if (this->arr_i16_4758[8] < 1) {
+ this->arr_i16_4758[8] = 1;
+ this->arr_i16_4758[9] = 1 + ABS(this->arr_i16_4758[1]);
+ }
+ // 132:0b74
+ if ((this->arr_i16_4758[5] - this->arr_i16_1eb8[0]) > 0) {
+ this->arr_i16_4758[4] = this->arr_i16_1eb8[0] - ABS(this->arr_i16_4758[0]);
+ this->arr_i16_4758[5] = this->arr_i16_1eb8[0];
+ }
+ // 132:0c02
+ if ((this->arr_i16_4758[9] - this->arr_i16_1eb8[1]) > 0) {
+ this->arr_i16_4758[8] = this->arr_i16_1eb8[1] - ABS(this->arr_i16_4758[1]);
+ this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
+ }
+ // 132:0c90
+ this->arr_rect_4776.top = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
+ this->arr_rect_4776.left = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
+ // 132:0d4e
+ this->arr_rect_4776.bottom = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
+ this->arr_rect_4776.right = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
+ // 132:0e0e
+ g_toolbox->FrameRect(this->arr_rect_4776);
+ this->sub_128_3da(2);
+ g_toolbox->FrameRect(this->arr_rect_4776);
+ this->sub_128_3da(1);
+ }
+ while ((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y > 0x14));
+}
+
+void FoolGame::sub_132_e5a() {
+ // 132:0e5a
+ this->var_i16_7c6 = 0;
+ g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
+ g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
+ g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
+ g_zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
+ sub_132_ed8();
+}
+
+void FoolGame::sub_132_ed8() {
+ // 132:0ed8
+ this->var_i16_1aa4 = this->var_i16_1a9e;
+ this->var_i16_68c = this->arr_i16_4758[6];
+ for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
+ for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
+ this->var_i16_1aa4++;
+ this->arr_i16_3738[this->var_i16_1aa4] = this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]];
+ // 132:0f54
+ this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] = 0;
+ }
+ }
+ // 132:0fbc
+ this->var_i16_1aa6 = this->var_i16_1aa4;
+ this->var_i16_1aa4 = this->var_i16_1a9e;
+ // 132:0fc8
+ for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
+ for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
+ this->var_i16_1aa4++;
+ if (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] > 0) {
+ this->var_i16_1aa6++;
+ this->arr_i16_3738[this->var_i16_1aa6] = this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]];
+ }
+ // 132:1076
+ this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
+ // 132:10ba
+ // 0x2af8, this->var_i16_1aa0 * (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] - 1)
+ g_zbasic->put(
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
+ this->arr_jigsaw_5dfc[this->arr_i16_2f38[i*32 + j]],
+ kPutCopy
+ );
+ }
+ }
+ // 132:11c8
+ this->var_i16_1aa6 = this->var_i16_1aa4;
+ for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
+ for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
+ if (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] == 0) {
+ this->var_i16_1aa6++;
+ this->arr_i16_3738[this->arr_i16_2f38[i*32+j]] = this->arr_i16_3738[this->var_i16_1aa6];
+ g_zbasic->put(
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32+j]].left,
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32+j]].top,
+ this->arr_jigsaw_5dfc[this->arr_i16_2f38[i*32 + j]],
+ kPutCopy
+ );
+ }
+ // 132:134a
+ }
+ }
+}
+
+void FoolGame::sub_132_1384() {
+ // 132:1384
+ this->var_str_c06 = g_zbasic->str(208);
+ for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ this->var_str_384 = g_zbasic->unk_88(this->arr_i16_3738[i]);
+ this->var_str_c06 += this->var_str_384;
+ }
+}
+
+
+void FoolGame::sub_132_13ea() {
+ // 132:13ea
+ this->var_i16_d0c = 1;
+ for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ if (this->arr_i16_3738[i] != i) {
+ this->var_i16_d0c = 0;
+ this->var_i16_68a = this->var_i16_1a9e;
+ }
+ // 132:1420
+ }
+ // 132:1430
+ if (this->var_i16_d0c != 0) {
+ this->var_i16_7c6 = 1;
+ }
+}
+
+void FoolGame::sub_132_1444() {
+ warning("STUB: %s", __func__);
+}
+
+};
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index b4341078c8c..140acc4f00f 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
siphash/halfsip.o \
fool.o \
fool_game.o \
+ fool_jigsaw.o \
fool_prologue.o \
toolbox.o \
toolbox_fileman.o \
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index cd31a9ba21c..0de7ae7eefb 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -106,6 +106,7 @@ uint32 Toolbox::Delay(uint32 numTicks) {
void Toolbox::FlushEvents(uint32 eventMask, uint32 stopMask) {
if ((eventMask == 0xffffffff) && (stopMask == 0)) {
_events.clear();
+ _modifiers = kModMouseButtonUp;
return;
}
for (auto it = _events.begin(); it != _events.end(); ) {
@@ -117,6 +118,9 @@ void Toolbox::FlushEvents(uint32 eventMask, uint32 stopMask) {
++it;
}
}
+ if (eventMask & 0x6) {
+ _modifiers = kModMouseButtonUp;
+ }
}
bool Toolbox::GetNextEvent(uint32 eventMask, EventRecord &theEvent) {
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 340b057927e..8a2a4e1abd3 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -151,11 +151,17 @@ uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
int menuItem = _defaultMenu->getLastSelectedMenuItem();
int menuSubItem = _defaultMenu->getLastSelectedSubmenuItem();
if ((menuItem != -1) && (menuSubItem != -1)) {
- result |= ((menuItem + 1) & 0xffff) << 16;
- result |= ((menuSubItem + 1) & 0xffff);
+ Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(menuItem);
+ Graphics::MacMenuItem *item = _defaultMenu->getSubMenuItem(sub, menuSubItem);
+ if (item->enabled) {
+ result |= ((menuItem + 1) & 0xffff) << 16;
+ result |= ((menuSubItem + 1) & 0xffff);
+ }
}
}
}
+ // we've eaten a ton of events, fix the mouseUp modifier
+ _modifiers |= kModMouseButtonUp;
warning("Toolbox::MenuSelect: %08x", result);
return result;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 785d95eadbd..be153f94ea8 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -25,6 +25,7 @@
#include "common/str-enc.h"
#include "common/stream.h"
#include "common/tokenizer.h"
+#include "common/ustr.h"
#include "graphics/managed_surface.h"
#include "fool/fool.h"
@@ -325,6 +326,11 @@ void ZBasic::menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32S
}
+Common::U32String ZBasic::midStr(const Common::U32String &str, int16 expr1, int16 expr2) {
+ Common::U32String result = str.substr(expr1-1, expr2);
+ return result;
+}
+
void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
if (_fileStreams.contains(fileNo)) {
@@ -535,7 +541,7 @@ void ZBasic::unk_20() {
bool ZBasic::incrAndCheck(int16 &a0, int16 d1, int16 d0) {
a0 += d0;
- return (d0 < 0) ? (a0 < d1) : (d1 < a0);
+ return (d0 < 0) ? (a0 >= d1) : (a0 <= d1);
}
void ZBasic::unk_44(int16 unk1) {
@@ -547,6 +553,13 @@ void ZBasic::stringCopy(Common::U32String &target, const Common::U32String &src)
target = src;
}
+Common::U32String ZBasic::unk_88(uint16 unk1) {
+ Common::U32String result;
+ result.push_back(unk1 >> 8);
+ result.push_back(unk1 & 0xff);
+ return result;
+}
+
void ZBasic::unk_130(int16 unk1) {
warning("STUB: ZBasic::unk_130");
}
@@ -555,6 +568,13 @@ void ZBasic::unk_158() {
warning("STUB: ZBasic::unk_158");
}
+uint16 ZBasic::unk_310(const Common::U32String &unk1) {
+ uint16 result = 0;
+ result |= unk1[0] << 8;
+ result |= unk1[1];
+ return result;
+}
+
void ZBasic::unk_331(uint16 unk1, int16 unk2) {
warning("STUB: ZBasic::unk_331");
}
@@ -574,6 +594,7 @@ void ZBasic::indexSet(const Common::U32String &value, int16 table, int16 index)
if (_index[table].size() <= (uint)index) {
_index[table].resize(index+1);
}
+ debugC(5, kDebugLoading, "ZBasic::indexSet: [%d][%d] = %s", table, index, value.encode().c_str());
_index[table][index] = value;
}
@@ -590,6 +611,7 @@ Common::U32String ZBasic::index(int16 table, int16 index) {
warning("ZBasic::index: asked for index %d but only %d entries in table %d", index, _index[table].size(), table);
return Common::U32String();
}
+ debugC(5, kDebugLoading, "ZBasic::indexSet: [%d][%d] = %s", table, index, _index[table][index].encode().c_str());
return _index[table][index];
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 097977e83f0..7418cf0d7a8 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -256,6 +256,7 @@ public:
bool maybe();
uint32 mem(int16 index);
void menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title);
+ Common::U32String midStr(const Common::U32String &str, int16 expr1, int16 expr2);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
@@ -286,9 +287,11 @@ public:
void unk_20();
bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
void unk_44(int16 unk1);
+ Common::U32String unk_88(uint16 unk1);
void stringCopy(Common::U32String &dest, const Common::U32String &src);
void unk_130(int16 unk1);
void unk_158();
+ uint16 unk_310(const Common::U32String &unk1);
void unk_331(uint16 unk1, int16 unk2);
void unk_333(uint16 unk1);
void indexSet(const Common::U32String &value, int16 table, int16 index);
Commit: 95dfb3af0a9159ad73209cb3b5d2accec4798e56
https://github.com/scummvm/scummvm/commit/95dfb3af0a9159ad73209cb3b5d2accec4798e56
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:02+02:00
Commit Message:
FOOL: Fix screen fill when clicking story button
Changed paths:
engines/fool/fool_game.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index ae1999bd439..4ebd77a30ff 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -469,6 +469,8 @@ void FoolGame::sub_128_918(Common::U32String &unk1) {
}
void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1) {
+ // Zoom-fill the screen with checkerboard pattern
+ // after e.g. clicking a story button.
// 128:0962
this->arr_rect_5b7c.top = unk11;
this->arr_rect_5b7c.left = unk10;
@@ -487,22 +489,24 @@ void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int
this->arr_bcd_5dbc[1] = (float)(this->arr_rect_5b7c.left);
this->arr_bcd_5dbc[2] = (float)(this->arr_rect_5b7c.bottom);
this->arr_bcd_5dbc[3] = (float)(this->arr_rect_5b7c.right);
- this->arr_bcd_5dbc[4] = (float)((this->arr_rect_5b84.top) - (this->arr_rect_5b7c.top))/(float)(this->var_i16_44);
- this->arr_bcd_5dbc[5] = (float)((this->arr_rect_5b84.left) - (this->arr_rect_5b7c.left))/(float)(this->var_i16_44);
- this->arr_bcd_5dbc[6] = (float)((this->arr_rect_5b84.bottom) - (this->arr_rect_5b7c.bottom))/(float)(this->var_i16_44);
- this->arr_bcd_5dbc[7] = (float)((this->arr_rect_5b84.right) - (this->arr_rect_5b7c.right))/(float)(this->var_i16_44);
+ this->arr_bcd_5dbc[4] = (float)((this->arr_rect_5b84.top) - (this->arr_rect_5b7c.top))/(float)(unk1);
+ this->arr_bcd_5dbc[5] = (float)((this->arr_rect_5b84.left) - (this->arr_rect_5b7c.left))/(float)(unk1);
+ this->arr_bcd_5dbc[6] = (float)((this->arr_rect_5b84.bottom) - (this->arr_rect_5b7c.bottom))/(float)(unk1);
+ this->arr_bcd_5dbc[7] = (float)((this->arr_rect_5b84.right) - (this->arr_rect_5b7c.right))/(float)(unk1);
// 128:0af0
g_toolbox->PaintRect(this->arr_rect_5b7c);
- for (int i = 1; i < this->var_i16_44-1; i++) {
+ for (int i = 1; i < unk1-1; i++) {
for (int j = 0; j <= 3; j++) {
this->arr_bcd_5dbc[j] = (float)this->arr_bcd_5dbc[j] + (float)this->arr_bcd_5dbc[j+4];
}
- this->arr_rect_5b7c.top = (int)this->arr_bcd_5dbc[0];
- this->arr_rect_5b7c.left = (int)this->arr_bcd_5dbc[1];
- this->arr_rect_5b7c.bottom = (int)this->arr_bcd_5dbc[2];
- this->arr_rect_5b7c.right = (int)this->arr_bcd_5dbc[3];
+ this->arr_rect_5b92.top = (int)this->arr_bcd_5dbc[0];
+ this->arr_rect_5b92.left = (int)this->arr_bcd_5dbc[1];
+ this->arr_rect_5b92.bottom = (int)this->arr_bcd_5dbc[2];
+ this->arr_rect_5b92.right = (int)this->arr_bcd_5dbc[3];
// 128:0ba6
g_toolbox->PaintRect(this->arr_rect_5b92);
+ // new: force a redraw delay
+ g_toolbox->Delay(0);
}
// 128:0bc8
g_toolbox->PaintRect(this->arr_rect_5b84);
Commit: ff732b5a52527b875157ecf794b1f4a54217089d
https://github.com/scummvm/scummvm/commit/ff732b5a52527b875157ecf794b1f4a54217089d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:02+02:00
Commit Message:
FOOL: Jigsaw working
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 4ebd77a30ff..8fc527dce75 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -290,17 +290,20 @@ void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
// 128:0342
- if (unk2 < 1) {
- unk2 = 1;
+ this->var_i16_68c = unk1;
+ this->var_i16_68a = unk2;
+ if (this->var_i16_68a < 1) {
+ this->var_i16_68a = 1;
}
- if (this->arr_i16_1eb8[0] > unk2) {
- unk2 = this->arr_i16_1eb8[0];
+ // 128:035c
+ if (this->var_i16_68a > this->arr_i16_1eb8[0]) {
+ this->var_i16_68a = this->arr_i16_1eb8[0];
}
- if (unk1 < 1) {
- unk1 = 1;
+ if (this->var_i16_68c < 1) {
+ this->var_i16_68c = 1;
}
- if (this->arr_i16_1eb8[1] > unk1) {
- unk1 = this->arr_i16_1eb8[1];
+ if (this->var_i16_68c > this->arr_i16_1eb8[1]) {
+ this->var_i16_68c = this->arr_i16_1eb8[1];
}
}
@@ -1066,6 +1069,19 @@ void FoolGame::storyRenderPage() {
// 128:2662
}
+void FoolGame::sub_128_2664() {
+ // 128:2664
+ // hide menu and replace with "click mouse to continue" message
+ g_toolbox->SetPort(this->var_i32_8);
+ this->fillRect(0, 7, 0x13, this->var_i16_5a-7, 0);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_172 = g_zbasic->str(15); // click mouse to continue
+ this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xf);
+ g_toolbox->DrawString(this->var_str_172);
+ g_toolbox->SetPort(this->var_i32_0);
+}
+
void FoolGame::sub_128_26f6() {
// 128:26f6
for (int i = 0; i <= 0x28; i++) {
@@ -1095,14 +1111,17 @@ void FoolGame::sub_128_2808() {
}
void FoolGame::sub_128_2988() {
+ // File -> Open
warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2a06() {
+ // File -> Save
warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2a92() {
+ // File -> Save As
warning("STUB: %s", __func__);
}
@@ -1131,7 +1150,7 @@ void FoolGame::sub_128_2bc6() {
this->arr_i16_4758[1] = 0;
this->arr_i16_4758[2] = 0x1e;
this->arr_i16_4758[3] = 0x1fc;
- this->arr_i16_4758[4] = 0xa050;
+ this->arr_i16_4758[4] = (int16)0xa050;
this->arr_i16_4758[5] = 0x3f7;
this->var_i16_484 = 0;
for (int j = 0; j <= 0x5; j++) {
@@ -1776,6 +1795,7 @@ void FoolGame::sub_128_5fea() {
}
void FoolGame::sub_128_6154() {
+ // 128:6154
this->var_i16_e1c = this->var_ev_46.message >> 16;
this->var_i16_e1e = this->var_ev_46.message & 0xffff;
if (this->var_i16_e1c != 0) {
@@ -1783,6 +1803,7 @@ void FoolGame::sub_128_6154() {
}
}
+
void FoolGame::sub_128_6186() {
// 128:6186
do {
@@ -1792,6 +1813,18 @@ void FoolGame::sub_128_6186() {
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
}
+void FoolGame::sub_128_61c2() {
+ // 128:61c2
+ do {
+ this->sub_128_6186();
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(2, this->var_ev_46);
+ g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ g_toolbox->Delay(0);
+ } while ((this->var_ev_46.what != 1));
+ this->sub_128_6186();
+}
+
+
void FoolGame::sub_128_61ec() {
// 128:61ec
do {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 4cfabffc58b..36ac6f01712 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -75,6 +75,7 @@ public:
void menuChapterSelect(); // sub_128_2126
void sub_128_21c8();
void storyRenderPage(); // sub_128_2202
+ void sub_128_2664();
void sub_128_26f6();
void sub_128_271a();
void sub_128_27d6();
@@ -114,6 +115,7 @@ public:
void sub_128_5fea();
void sub_128_6154();
void sub_128_6186();
+ void sub_128_61c2();
void sub_128_61ec();
void sub_128_6244();
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 48fd8e636ee..e637559e071 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -19,12 +19,12 @@
*
*/
-#include "common/ustr.h"
+#include "graphics/managed_surface.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
-#include "graphics/managed_surface.h"
namespace Fool {
@@ -68,13 +68,13 @@ void FoolGame::sub_132_004() {
);
//this->var_i16_1aa2 = 0x2af8 + this->var_i16_1aa0*(this->arr_i16_3738[this->var_i16_484] - 1);
// 132:0216
- this->arr_jigsaw_5dfc[this->var_i16_484] = BitMap(new Graphics::ManagedSurface());
+ this->arr_jigsaw_5dfc[this->arr_i16_3738[this->var_i16_484]] = BitMap(new Graphics::ManagedSurface());
g_zbasic->get(
this->arr_rect_1f38[this->var_i16_484].left,
this->arr_rect_1f38[this->var_i16_484].top,
this->arr_rect_1f38[this->var_i16_484].right,
this->arr_rect_1f38[this->var_i16_484].bottom,
- this->arr_jigsaw_5dfc[this->var_i16_484]
+ this->arr_jigsaw_5dfc[this->arr_i16_3738[this->var_i16_484]]
);
} while (g_zbasic->incrAndCheck(
this->var_i16_68a,
@@ -103,7 +103,7 @@ void FoolGame::sub_132_004() {
g_zbasic->put(
this->arr_rect_1f38[i].left,
this->arr_rect_1f38[i].top,
- this->arr_jigsaw_5dfc[i],
+ this->arr_jigsaw_5dfc[this->arr_i16_3738[i]],
kPutCopy
);
// 132:0452
@@ -148,6 +148,7 @@ void FoolGame::sub_132_004() {
}
void FoolGame::sub_132_518() {
+ warning("call: %s", __func__);
// 132:0518
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || ((this->var_i16_68a - (this->arr_i16_1eb8[0])) > 0) || (this->var_i16_68c < 1) || ((this->var_i16_68c - (this->arr_i16_1eb8[1])) > 0)) {
@@ -162,13 +163,20 @@ void FoolGame::sub_132_518() {
// 132:05c4
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
+
+ // change select area while mouse button held down
this->sub_132_67a();
+ // leave an XOR outline on the page for the selected block
g_toolbox->FrameRect(this->arr_rect_476e);
this->arr_i16_4758[0] -= this->var_i16_68a;
this->arr_i16_4758[1] -= this->var_i16_68c;
+
// 132:0642
+ // move select area to new target
this->sub_132_962();
+ // remove XOR outline
g_toolbox->FrameRect(this->arr_rect_476e);
+
this->sub_132_ed8();
this->sub_132_13ea();
this->sub_128_6186();
@@ -177,6 +185,8 @@ void FoolGame::sub_132_518() {
}
void FoolGame::sub_132_67a() {
+ // change select area while mouse button held down
+ warning("call: %s", __func__);
do {
this->sub_128_c6a(4);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -212,6 +222,8 @@ void FoolGame::sub_132_67a() {
}
void FoolGame::sub_132_962() {
+ // move select area to new target
+ warning("call: %s", __func__);
do {
this->sub_128_c6a(2);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -265,10 +277,11 @@ void FoolGame::sub_132_962() {
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(1);
}
- while ((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y > 0x14));
+ while (!((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y > 0x14)));
}
void FoolGame::sub_132_e5a() {
+ warning("call: %s", __func__);
// 132:0e5a
this->var_i16_7c6 = 0;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
@@ -279,51 +292,79 @@ void FoolGame::sub_132_e5a() {
}
void FoolGame::sub_132_ed8() {
+ warning("call: %s", __func__);
// 132:0ed8
+ // skip the tile pointer to past the end of the list
this->var_i16_1aa4 = this->var_i16_1a9e;
- this->var_i16_68c = this->arr_i16_4758[6];
+
+ // arr_i16_4758[2]: src_left
+ // arr_i16_4758[3]: src_right
+ // arr_i16_4758[4]: dest_left
+ // arr_i16_4758[5]: dest_right
+ // arr_i16_4758[6]: src_top
+ // arr_i16_4758[7]: src_bottom
+ // arr_i16_4758[8]: dest_top
+ // arr_i16_4758[9]: dest_bottom
+
+ // iterate through src tile positions
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
this->var_i16_1aa4++;
+ // buffer 1: make a copy of source tile positions
this->arr_i16_3738[this->var_i16_1aa4] = this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]];
+ debug(8, "(%d, %d) [src]: %d -> buffer 1", i, j, this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]);
// 132:0f54
+ // buffer 0: zero out source tiles
this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] = 0;
}
}
// 132:0fbc
+ // tile pointer to buffer 2
this->var_i16_1aa6 = this->var_i16_1aa4;
this->var_i16_1aa4 = this->var_i16_1a9e;
+
// 132:0fc8
+ // iterate through dest tile positions
for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
this->var_i16_1aa4++;
+
+ // if the dest tile isn't part of the src tile set, copy to buffer 2
if (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] > 0) {
this->var_i16_1aa6++;
+ debug(8, "(%d, %d) [dest]: %d -> buffer 2", i, j, this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]);
this->arr_i16_3738[this->var_i16_1aa6] = this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]];
}
// 132:1076
+ // write src tile from buffer 1 to dest position
this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
+ debug(8, "(%d, %d) [dest]: %d <- buffer 1", i, j, this->arr_i16_3738[this->var_i16_1aa4]);
// 132:10ba
// 0x2af8, this->var_i16_1aa0 * (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] - 1)
+ // blit tiles to screen
g_zbasic->put(
this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_jigsaw_5dfc[this->arr_i16_2f38[i*32 + j]],
+ this->arr_jigsaw_5dfc[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
kPutCopy
);
}
}
// 132:11c8
+ // tile pointer to buffer 2
this->var_i16_1aa6 = this->var_i16_1aa4;
+ // iterate through source tile positions
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
+ // if the source tile has been zeroed out, fill it with tile from buffer 2
if (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] == 0) {
this->var_i16_1aa6++;
+ debug(8, "(%d, %d) [src]: %d <- buffer 2", i, j, this->arr_i16_3738[this->var_i16_1aa6]);
this->arr_i16_3738[this->arr_i16_2f38[i*32+j]] = this->arr_i16_3738[this->var_i16_1aa6];
g_zbasic->put(
this->arr_rect_1f38[this->arr_i16_2f38[i*32+j]].left,
this->arr_rect_1f38[this->arr_i16_2f38[i*32+j]].top,
- this->arr_jigsaw_5dfc[this->arr_i16_2f38[i*32 + j]],
+ this->arr_jigsaw_5dfc[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
kPutCopy
);
}
@@ -333,6 +374,8 @@ void FoolGame::sub_132_ed8() {
}
void FoolGame::sub_132_1384() {
+ // convert jigsaw positions to string
+ warning("call: %s", __func__);
// 132:1384
this->var_str_c06 = g_zbasic->str(208);
for (int i = 1; i <= this->var_i16_1a9e; i++) {
@@ -343,12 +386,14 @@ void FoolGame::sub_132_1384() {
void FoolGame::sub_132_13ea() {
+ // check if puzzle is solved
+ warning("call: %s", __func__);
// 132:13ea
this->var_i16_d0c = 1;
for (int i = 1; i <= this->var_i16_1a9e; i++) {
if (this->arr_i16_3738[i] != i) {
this->var_i16_d0c = 0;
- this->var_i16_68a = this->var_i16_1a9e;
+ i = this->var_i16_1a9e;
}
// 132:1420
}
@@ -359,7 +404,19 @@ void FoolGame::sub_132_13ea() {
}
void FoolGame::sub_132_1444() {
- warning("STUB: %s", __func__);
+ // strobe puzzle pieces once on victory
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ for (int j = 0; j <= 1; j++) {
+ for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ g_toolbox->InvertRect(this->arr_rect_1f38[i]);
+ this->sub_128_3da(1);
+ }
+ }
+ }
+ // 132:149c
+ this->sub_128_2664();
+ this->sub_128_61c2();
}
};
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 7e8ab654dd7..0f33df3e7bd 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -155,6 +155,10 @@ void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
}
void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
+ if (!r.isValidRect()) {
+ warning("Toolbox::_drawRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
+ return;
+ }
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
// special case because rect fills the entire surface
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index be153f94ea8..ecc6b046e82 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -205,6 +205,7 @@ void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool pres
_toolbox->GetPort(port);
Common::Rect srcRect(x1, y1, x2, y2);
Common::Rect dstRect(srcRect.width(), srcRect.height());
+ debugC(8, kDebugGraphics, "ZBasic::get: (%d, %d) (%d, %d) -> %p", x1, y1, x2, y2, (void *)dest.get());
// Real ZBasic uses a raw array for storage.
// Some graphical effects expect there to be a full screen page that only has part
// of it copied over, so we have this flag.
@@ -373,6 +374,7 @@ void ZBasic::put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode) {
}
void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutMode mode) {
+ debugC(8, kDebugGraphics, "ZBasic::put: %p -> (%d, %d) (%d, %d)", (void *)src.get(), x1, y1, x2, y2);
Common::Rect destRect(x1, y1, x2, y2);
SourceMode sm = kSrcCopy;
if (mode == kPutXOR) {
Commit: 9a03c10a474ce0ab0319ebee50384efa8ecbf467
https://github.com/scummvm/scummvm/commit/9a03c10a474ce0ab0319ebee50384efa8ecbf467
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:02+02:00
Commit Message:
FOOL: Add save/load
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox_fileman.cpp
engines/fool/toolbox_menu.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 8fc527dce75..00393caadf6 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -218,7 +218,7 @@ void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
}
}
-void FoolGame::sub_128_11c(Common::U32String &unk2, Common::U32String &unk1) {
+void FoolGame::sub_128_11c(const Common::U32String &unk2, const Common::U32String &unk1) {
// 128:011c
g_zbasic->stringCopy(this->var_str_272, unk1);
g_zbasic->stringCopy(this->var_str_172, unk2);
@@ -248,7 +248,7 @@ void FoolGame::sub_128_11c(Common::U32String &unk2, Common::U32String &unk1) {
}
-void FoolGame::sub_128_1e4(Common::U32String &unk1) {
+void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
// 128:01e4
g_zbasic->stringCopy(this->var_str_172, unk1);
this->var_str_588 = g_zbasic->str(4);
@@ -1101,34 +1101,115 @@ void FoolGame::sub_128_271a() {
}
+// new game
void FoolGame::sub_128_27d6() {
warning("STUB: %s", __func__);
}
void FoolGame::sub_128_2808() {
- warning("STUB: %s", __func__);
+ // 128:2808
+ this->var_i16_7e6 = 0;
+ // 128:280e: LEA - [0x3808],A0
+ // 128:2812: MOVE.L - A0,-0x8ee(A5)
+ g_zbasic->openR(2, this->var_str_588, 0x400, this->var_i16_688);
+ this->var_str_7e8 = g_zbasic->readFileStr(2, 0x11);
+ if (this->var_str_7e8 == g_zbasic->str(16)) {
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ for (int i = 1; i <= 0x64; i++) {
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_str_7e8 = g_zbasic->readFileStr(2, this->var_i16_8e8);
+ }
+ // 128:28c8
+ for (int i = 1; i <= 0x51; i++) {
+ this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ }
+
+ } else {
+ // 128:28ec
+ this->var_i16_7e6 = 1;
+ }
+ g_zbasic->close(2);
+ // 128:28f8: LEA - [0x3818],A0
+ // 128:28fc: MOVE.L - A0,-0x8ee(A5)
+ if (this->var_i16_7e6 != 0) {
+ this->arr_str_1a8d8[0] = g_zbasic->str(17) + this->var_str_588 + g_zbasic->str(18);
+ this->arr_str_1a8d8[1] = g_zbasic->str(19);
+ this->sub_128_dfe(0, 0, 1, 1);
+ this->var_str_588 = g_zbasic->str(20);
+ this->var_i16_7e6 = 0;
+ }
}
void FoolGame::sub_128_2988() {
+ // 128:2988
// File -> Open
- warning("STUB: %s", __func__);
+ this->sub_128_1e4(g_zbasic->str(21)); // FOOL
+ if (this->var_str_588 == g_zbasic->str(22)) { // empty
+ return;
+ }
+ this->sub_128_2808();
+ if (this->var_str_588 == g_zbasic->str(23)) {
+ return;
+ }
+ this->sub_128_32fa();
+ // 128:29d4
+ if (this->var_i16_7be != 3) {
+ if ((this->var_i16_7ce & 1) != 0) {
+ this->sub_128_1c2c(0x11);
+ } else {
+ // 128:29fa
+ this->sub_128_1c2c(0x10);
+ }
+ this->sub_128_3774();
+ }
}
void FoolGame::sub_128_2a06() {
+ // 128:2a06
// File -> Save
- warning("STUB: %s", __func__);
+ this->sub_128_1c2c(4);
+}
+
+void FoolGame::sub_128_2a0e() {
+ // 128:2a0e
+ if (this->var_str_8ec == g_zbasic->str(24)) {
+ // 128:2a28
+ this->sub_128_11c(g_zbasic->str(25), g_zbasic->str(26)); // name of game, blank
+ } else {
+ // 128:2a48
+ this->sub_128_11c(g_zbasic->str(27), this->var_str_8ec); // New Name?
+ }
+ // 128:2a60
+ if (this->var_str_486 != g_zbasic->str(28)) { // empty
+ this->var_str_8ec = this->var_str_486;
+ this->var_i16_9ec = this->var_i16_586;
+ // 128:2a90
+ }
}
void FoolGame::sub_128_2a92() {
+ // 128:2a92
// File -> Save As
- warning("STUB: %s", __func__);
+ this->sub_128_2a0e();
+ if (this->var_str_486 != g_zbasic->str(29)) { // empty
+ this->sub_128_1c2c(4);
+ }
+
}
+// quit
void FoolGame::sub_128_2ab6() {
warning("STUB: %s", __func__);
}
+// print story
void FoolGame::sub_128_2ae8() {
warning("STUB: %s", __func__);
}
@@ -1219,7 +1300,7 @@ void FoolGame::sub_128_2e3e() {
this->var_str_8ec = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
this->var_i16_7e6 = 0;
- // FIXME: disk handler??
+ // FIXME: disk error handler??
// 128:2e68: LEA - [0x3808],A0
// 128:2e6c: MOVE.L - A0,-0x8ee(A5)
// 128:2e70: SF - 0x8,D0
@@ -1239,7 +1320,24 @@ void FoolGame::sub_128_2e3e() {
g_zbasic->indexSet(this->var_str_384, i, 2);
}
// 128:2f54
- warning("STUB: %s", __func__);
+ for (int i = 1; i <= 0x51; i++) {
+ this->arr_i16_4bd8[i] = g_zbasic->readFileInt(2);
+ }
+ // 128:2f84
+ g_zbasic->close(2);
+ if (this->var_i16_7e6 != 0) {
+ this->arr_str_1a8d8[0] = g_zbasic->str(34) + this->var_str_8ec + g_zbasic->str(35); // file cannot be opened
+ this->arr_str_1a8d8[1] = g_zbasic->str(36);
+ this->var_i16_7e6 = 0;
+ if ((this->var_i16_7ce & 1) == 0) {
+ this->sub_128_1c2c(9);
+ } else {
+ this->sub_128_1c2c(8);
+ }
+ } else {
+ // 128:302c
+ this->sub_128_3032();
+ }
}
@@ -1315,8 +1413,100 @@ void FoolGame::sub_128_32c8() {
}
}
+void FoolGame::sub_128_32fa() {
+ // 128:32fa
+ if (this->var_i16_7ce == 0x29a) {
+ return;
+ }
+ this->var_i16_7be = 0;
+ if (this->var_str_8ec == g_zbasic->str(42)) {
+ this->arr_str_1a8d8[0] = g_zbasic->str(43); // do you wish to save this game
+ this->arr_str_1a8d8[1] = g_zbasic->str(44); // yes
+ this->arr_str_1a8d8[2] = g_zbasic->str(45); // no
+ this->arr_str_1a8d8[3] = g_zbasic->str(46); // cancel
+ this->sub_128_dfe(0, 0, 3, 0);
+ if (this->var_i16_7be > 1) {
+ return;
+ }
+ this->sub_128_2a0e();
+ if (this->var_str_8ec == g_zbasic->str(47)) {
+ // 128:33da
+ this->var_i16_7be = 3;
+ return;
+ }
+ }
+ // 128:33e2
+ this->sub_128_1c2c(4);
+
+}
+
void FoolGame::sub_128_3536() {
- warning("STUB: %s", __func__);
+ // write save file
+ this->sub_128_1c4a(4);
+ if (this->var_i16_7ce == 0x29a)
+ return;
+ // 128:3548
+ if (this->var_str_8ec == g_zbasic->str(57)) { // empty
+ this->sub_128_2a0e();
+ if (this->var_str_8ec == g_zbasic->str(58)) { // empty
+ return;
+ }
+ }
+ // 128:3580
+ if ((this->var_i16_7ce & 1) != 0) {
+ this->sub_128_41aa();
+ }
+ // 128:3594
+ do {
+ this->sub_128_3774();
+ // 128:3598
+ this->var_i16_7e6 = 0;
+ // 128:359e: LEA - [0x3808],A0
+ // 128:35a2: MOVE.L - A0,-0x8ee(A5)
+ g_zbasic->defOpen(g_zbasic->str(59)); // FOOLgf87
+ g_zbasic->openW(2, this->var_str_8ec, 0x400, this->var_i16_9ec);
+
+ if (this->var_i16_7e6 != 0xa) {
+ this->var_str_af4 = g_zbasic->str(60); // The Fool's Errand
+ g_zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
+ g_zbasic->writeFileInt(2, this->var_i16_7d8);
+ g_zbasic->writeFileInt(2, this->var_i16_7e2);
+ g_zbasic->writeFileInt(2, this->var_i16_7ce);
+ g_zbasic->writeFileInt(2, this->var_i16_7d2);
+ for (int i = 1; i <= 0x64; i++) {
+ g_zbasic->writeFileInt(2, this->arr_i16_1d24[i]);
+ g_zbasic->writeFileInt(2, this->arr_i16_1c5a[i]);
+ g_zbasic->writeFileInt(2, this->arr_i16_1b90[i]);
+ this->var_str_af4 = g_zbasic->index(2, i);
+ g_zbasic->writeFileInt(2, (int16)this->var_str_af4.size());
+ g_zbasic->writeFileStr(2, this->var_str_af4);
+ }
+ // 128:36ba
+ for (int i = 1; i <= 0x51; i++) {
+ g_zbasic->writeFileInt(2, this->arr_i16_4bd8[i]);
+ }
+ g_zbasic->close(2);
+ }
+ // 128:36fe
+ if (this->var_i16_7e6 != 0) {
+ // problem with saving
+ this->sub_128_388a();
+ do {
+ this->sub_128_2a0e();
+ } while (this->var_str_8ec == g_zbasic->str(61)); // empty
+ // 128:3726: BRA - [0x3594]
+
+ } else {
+ break;
+ }
+ } while (true);
+ // 128:372a
+ // 128:372a: LEA - [0x3818],A0
+ // 128:372e: MOVE.L - A0,-0x8ee(A5)
+ if (this->var_i16_7c6 == 0) {
+ this->sub_128_37ce();
+ g_toolbox->InitCursor();
+ }
}
void FoolGame::sub_128_3744() {
@@ -1354,6 +1544,23 @@ void FoolGame::sub_128_378a() {
this->var_i16_7b2 = 0xa;
}
+void FoolGame::sub_128_37ce() {
+ // 128:37ce
+ for (int i = 7; i <= 0xf; i++) {
+ g_toolbox->SetCursor(this->arr_curs_4d88[i]);
+ this->sub_128_3da(4);
+ }
+ this->var_i16_7b2 = 0xa;
+}
+
+void FoolGame::sub_128_388a() {
+ // 128:388a
+ if ((this->var_i16_7e6 & 0xff) == 2) {
+ // problem with saving
+ }
+ warning("STUB: %s", __func__);
+}
+
void FoolGame::sub_128_39a0() {
// 128:39a0
this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
@@ -1495,7 +1702,7 @@ void FoolGame::sub_128_39a0() {
// 128:3d3a
this->var_i16_484 = 3 + ((this->var_i16_7d0 - 1) / 0x10);
this->var_i16_7e4 = 1 + ((this->var_i16_7d0 - 1) % 0x10);
- g_zbasic->menu(this->var_i16_7e4, this->var_i16_484, 1, Common::U32String());
+ g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
this->sub_128_3de6();
}
}
@@ -1641,6 +1848,7 @@ void FoolGame::sub_128_4472() {
}
+// about screen
void FoolGame::sub_128_4a92() {
warning("STUB: %s", __func__);
}
@@ -2322,6 +2530,7 @@ void FoolGame::sub_129_123a() {
g_toolbox->SetPort(this->var_i32_0);
}
+// word jumble/substitute puzzle
void FoolGame::sub_130_004() {
// 130:0004
this->var_i16_d0c = 0;
@@ -2434,11 +2643,12 @@ void FoolGame::sub_130_004() {
warning("STUB: %s", __func__);
}
+// word search game
void FoolGame::sub_131_004() {
warning("STUB: %s", __func__);
}
-
+// polyomino puzzle
void FoolGame::sub_133_004() {
// 133:0004
this->sub_128_271a();
@@ -2516,6 +2726,7 @@ void FoolGame::sub_133_004() {
warning("STUB: %s", __func__);
}
+// mask reveal puzzle
void FoolGame::sub_134_004() {
warning("STUB: %s", __func__);
}
@@ -2528,6 +2739,7 @@ void FoolGame::sub_136_004() {
warning("STUB: %s", __func__);
}
+// the sun's map
void FoolGame::sub_137_004() {
warning("STUB: %s", __func__);
}
@@ -2541,10 +2753,12 @@ void FoolGame::sub_139_004() {
warning("STUB: %s", __func__);
}
+// high priestess challenge
void FoolGame::sub_140_004() {
warning("STUB: %s", __func__);
}
+// death
void FoolGame::sub_141_004() {
warning("STUB: %s", __func__);
}
@@ -2553,10 +2767,12 @@ void FoolGame::sub_142_004() {
warning("STUB: %s", __func__);
}
+// lights on
void FoolGame::sub_142_852() {
warning("STUB: %s", __func__);
}
+// hermit key trace
void FoolGame::sub_142_12ac() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 36ac6f01712..b7acc8a1843 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -39,8 +39,8 @@ public:
void sub_128_004();
void sub_128_0a2(int16 unk2, int16 unk1);
- void sub_128_11c(Common::U32String &unk2, Common::U32String &unk1);
- void sub_128_1e4(Common::U32String &unk1);
+ void sub_128_11c(const Common::U32String &unk2, const Common::U32String &unk1);
+ void sub_128_1e4(const Common::U32String &unk1);
void sub_128_2be(int16 unk2, int16 unk1);
void sub_128_342(int16 unk2, int16 unk1);
void sub_128_3da(int16 unk1);
@@ -82,6 +82,7 @@ public:
void sub_128_2808();
void sub_128_2988();
void sub_128_2a06();
+ void sub_128_2a0e();
void sub_128_2a92();
void sub_128_2ab6();
void sub_128_2ae8();
@@ -91,10 +92,13 @@ public:
void sub_128_3032();
void sub_128_32c8();
+ void sub_128_32fa();
void sub_128_3536();
void sub_128_3744();
void sub_128_3774();
void sub_128_378a();
+ void sub_128_37ce();
+ void sub_128_388a();
void sub_128_39a0();
void sub_128_3de6();
void sub_128_3fb6();
@@ -126,6 +130,7 @@ public:
void sub_130_004();
void sub_131_004();
+ // fool_jigsaw.cpp
void sub_132_004();
void sub_132_518();
void sub_132_67a();
@@ -230,11 +235,15 @@ private:
int16 var_i16_7e2;
int16 var_i16_7e4;
int16 var_i16_7e6;
+ Common::U32String var_str_7e8;
+ int16 var_i16_8e8;
Common::U32String var_str_8ec;
int16 var_i16_9ec;
int16 var_i16_9f2;
Common::U32String var_str_9f4;
+ Common::U32String var_str_af4;
+
// Used as both a pointer and a bitstore
uint32 var_i32_bf8;
MenuHandle var_menu_bf8;
diff --git a/engines/fool/toolbox_fileman.cpp b/engines/fool/toolbox_fileman.cpp
index 4539ed3cba2..0d8ae80a83c 100644
--- a/engines/fool/toolbox_fileman.cpp
+++ b/engines/fool/toolbox_fileman.cpp
@@ -20,12 +20,28 @@
*/
#include "common/system.h"
+#include "common/savefile.h"
+
+#include "gui/filebrowser-dialog.h"
#include "fool/fool.h"
#include "fool/toolbox.h"
namespace Fool {
+Common::String getFileNameFromModal(bool save, const Common::String &suggested, const Common::String &title) {
+ Common::String prefix = g_engine->getGameId() + '-';
+ Common::String mask = prefix + "*";
+ GUI::FileBrowserDialog browser(title.c_str(), "fool", save ? GUI::kFBModeSave : GUI::kFBModeLoad, mask.c_str(), suggested.c_str());
+ if (browser.runModal() <= 0) {
+ return Common::String();
+ }
+ Common::String result = browser.getResult();
+ if (!result.empty() && !result.hasPrefixIgnoreCase(prefix))
+ result = prefix + result;
+ return result;
+}
+
OSErr Toolbox::PBGetVol(ParamBlockRec ¶mBlock) {
warning("STUB: Toolbox::PBGetVol");
return 0;
@@ -37,11 +53,15 @@ OSErr Toolbox::PBSetVol(ParamBlockRec ¶mBlock) {
}
void Toolbox::SFGetFile(const Common::Point &where, const Common::U32String &prompt, ProcPtr fileFilter, int16 numTypes, const SFTypeList &typeList, const ProcPtr &dlgHook, SFReply &reply) {
- warning("STUB: Toolbox::SFGetFile");
+ Common::String fileName = getFileNameFromModal(false, Common::String(), prompt.encode());
+ reply.fName = fileName;
+ reply.good = !fileName.empty() ? 1 : 0;
}
void Toolbox::SFPutFile(const Common::Point &where, const Common::U32String &prompt, const Common::U32String &origName, const ProcPtr &dlgHook, SFReply &reply) {
- warning("STUB: Toolbox::SFPutFile");
+ Common::String fileName = getFileNameFromModal(true, origName.encode(), prompt.encode());
+ reply.fName = fileName;
+ reply.good = !fileName.empty() ? 1 : 0;
}
} // namespace Fool
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 8a2a4e1abd3..adb76b7f527 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -59,7 +59,15 @@ void Toolbox::CheckItem(MenuHandle &theMenu, uint16 item, bool checked) {
warning("Toolbox::CheckItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
- warning("STUB: Toolbox::CheckItem");
+ if (_defaultMenu) {
+ Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
+ if (sub) {
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item);
+ if (it) {
+ it->checked = checked;
+ }
+ }
+ }
}
void Toolbox::ClearMenuBar() {
@@ -97,7 +105,15 @@ void Toolbox::DisableItem(MenuHandle &theMenu, uint16 item) {
warning("Toolbox::DisableItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
- warning("STUB: Toolbox::DisableItem");
+ if (_defaultMenu) {
+ Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
+ if (sub) {
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item);
+ if (it) {
+ it->enabled = false;
+ }
+ }
+ }
}
void Toolbox::DisposeMenu(MenuHandle &theMenu) {
@@ -120,7 +136,15 @@ void Toolbox::EnableItem(MenuHandle &theMenu, uint16 item) {
warning("Toolbox::EnableItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
- warning("STUB: Toolbox::EnableItem");
+ if (_defaultMenu) {
+ Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
+ if (sub) {
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item);
+ if (it) {
+ it->enabled = true;
+ }
+ }
+ }
}
@@ -177,9 +201,13 @@ MenuHandle Toolbox::NewMenu(uint16 menuID, const Common::U32String &menuTitle) {
}
_defaultMenu->clearSubMenu(menuID-1);
Graphics::MacMenuItem *item = _defaultMenu->getMenuItem(menuID-1);
- item->text = menuTitle.encode(Common::kMacRoman);
- item->unicode = false;
- _defaultMenu->addSubMenu(nullptr, menuID-1);
+ if (!item) {
+ warning("NewMenu: new menu didn't add for some reason??");
+ } else {
+ item->text = menuTitle.encode(Common::kMacRoman);
+ item->unicode = false;
+ _defaultMenu->addSubMenu(nullptr, menuID-1);
+ }
}
return handle;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index ecc6b046e82..ebf35954f08 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -22,6 +22,7 @@
#include "common/macresman.h"
#include "common/memorypool.h"
#include "common/memstream.h"
+#include "common/savefile.h"
#include "common/str-enc.h"
#include "common/stream.h"
#include "common/tokenizer.h"
@@ -191,6 +192,9 @@ void ZBasic::close(int16 fileNo) {
if (this->_fileStreams.contains(fileNo)) {
this->_fileStreams.erase(fileNo);
}
+ if (this->_fileWriteStreams.contains(fileNo)) {
+ this->_fileWriteStreams.erase(fileNo);
+ }
if (this->_fileLineSize.contains(fileNo)) {
this->_fileLineSize.erase(fileNo);
}
@@ -200,6 +204,11 @@ void ZBasic::coordinateWindow() {
warning("STUB: ZBasic::coordinateWindow");
}
+void ZBasic::defOpen(const Common::U32String &str) {
+ _fileType = str.substr(0, 4).encode(Common::kMacRoman);
+ _fileCreator = str.substr(4, 4).encode(Common::kMacRoman);
+}
+
void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims) {
GrafPtr port;
_toolbox->GetPort(port);
@@ -310,13 +319,13 @@ void ZBasic::menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32S
Common::Array<Common::U32String> after;
for (size_t i = 0; i < (itemNo); i++) {
- after.push_back(handle->menuData[i]);
+ after.push_back(i < handle->menuData.size() ? handle->menuData[i] : Common::U32String());
}
for (auto &it : tokList) {
after.push_back(it);
}
for (size_t i = (itemNo)+tokList.size(); i < handle->menuData.size(); i++) {
- after.push_back(handle->menuData[i]);
+ after.push_back(i < handle->menuData.size() ? handle->menuData[i] : Common::U32String());
}
_toolbox->DeleteMenu(menuNo);
handle = _toolbox->NewMenu(menuNo, after.remove_at(0));
@@ -338,11 +347,33 @@ void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineS
this->close(fileNo);
}
Common::MacResManager resMan;
- Common::SeekableReadStream *result = resMan.openFileOrDataFork(Common::Path(fileName, ':'));
+ Common::SaveFileManager *saves = g_system->getSavefileManager();
+ // first load from the save manager
+ Common::SeekableReadStream *result = saves->openForLoading(fileName.encode());
+ if (!result) {
+ // if that fails, load from the filesystem
+ result = resMan.openFileOrDataFork(Common::Path(fileName, ':'));
+ }
if (!result) {
error("ZBasic::openR: couldn't open %s", fileName.encode().c_str());
}
_fileStreams[fileNo] = Common::SharedPtr<Common::SeekableReadStream>(result);
+ _fileWriteStreams[fileNo] = nullptr;
+ _fileLineSize[fileNo] = lineSize;
+}
+
+void ZBasic::openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
+ if (_fileStreams.contains(fileNo)) {
+ this->close(fileNo);
+ }
+ Common::MacResManager resMan;
+ Common::SaveFileManager *saves = g_system->getSavefileManager();
+ Common::SeekableWriteStream *result = saves->openForSaving(fileName, false);
+ if (!result) {
+ error("ZBasic::openW: couldn't open %s", fileName.encode().c_str());
+ }
+ _fileStreams[fileNo] = nullptr;
+ _fileWriteStreams[fileNo] = Common::SharedPtr<Common::SeekableWriteStream>(result);
_fileLineSize[fileNo] = lineSize;
}
@@ -472,8 +503,7 @@ Common::U32String ZBasic::readFileStr(int16 fileNo, int16 length) {
if (!_fileStreams.contains(fileNo)) {
error("ZBasic::readFileStr: unknown fileNo %d", fileNo);
}
- warning("STUB: ZBasic::readFileStr");
- return Common::U32String();
+ return _fileStreams[fileNo]->readString(0, length).decode(Common::kMacRoman);
}
void ZBasic::record(int16 fileNo, int16 recordNo, int16 location) {
@@ -555,6 +585,27 @@ void ZBasic::stringCopy(Common::U32String &target, const Common::U32String &src)
target = src;
}
+void ZBasic::writeFileStr(int16 fileNo, const Common::U32String &str) {
+ if (!_fileWriteStreams.contains(fileNo)) {
+ error("ZBasic::writeFileStr: unknown fileNo %d", fileNo);
+ }
+ _fileWriteStreams[fileNo]->writeString(str.encode(Common::kMacRoman));
+}
+
+void ZBasic::writeFileInt(int16 fileNo, int16 data) {
+ if (!_fileWriteStreams.contains(fileNo)) {
+ error("ZBasic::writeFileInt: unknown fileNo %d", fileNo);
+ }
+ _fileWriteStreams[fileNo]->writeSint16BE(data);
+}
+
+void ZBasic::writeFileDblInt(int16 fileNo, int32 data) {
+ if (!_fileWriteStreams.contains(fileNo)) {
+ error("ZBasic::writeFileDblInt: unknown fileNo %d", fileNo);
+ }
+ _fileWriteStreams[fileNo]->writeSint32BE(data);
+}
+
Common::U32String ZBasic::unk_88(uint16 unk1) {
Common::U32String result;
result.push_back(unk1 >> 8);
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 7418cf0d7a8..c5ac771d374 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -233,9 +233,13 @@ private:
Graphics::MacMenu *_menu;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
+ Common::HashMap<int16, Common::SharedPtr<Common::SeekableWriteStream>> _fileWriteStreams;
Common::HashMap<int16, uint32> _fileLineSize;
Common::HashMap<int16, Common::Array<Common::U32String>> _index;
+ Common::String _fileType;
+ Common::String _fileCreator;
+
public:
ZBasic(Toolbox *toolbox);
@@ -249,6 +253,7 @@ public:
Common::U32String chr(uint16 code);
void close(int16 fileNo);
void coordinateWindow();
+ void defOpen(const Common::U32String &str);
void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims = false);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
Common::U32String files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume);
@@ -258,6 +263,7 @@ public:
void menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title);
Common::U32String midStr(const Common::U32String &str, int16 expr1, int16 expr2);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
+ void openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
void put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode);
@@ -276,6 +282,9 @@ public:
void swapInt(int16 &a, int16 &b);
void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
+ void writeFileStr(int16 fileNo, const Common::U32String &str);
+ void writeFileInt(int16 fileNo, int16 data);
+ void writeFileDblInt(int16 fileNo, int32 data);
const Common::U32String &str(size_t index);
@@ -283,6 +292,7 @@ public:
void unk_4(); // possibly quit?
int16 unk_5();
void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
+ void unk_10();
void unk_11(int16 unk1);
void unk_20();
bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
Commit: 2f44bfa90a7391bd4acab76b17f86d3841f5deae
https://github.com/scummvm/scummvm/commit/2f44bfa90a7391bd4acab76b17f86d3841f5deae
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:03+02:00
Commit Message:
FOOL: Fix menu indexing
Changed paths:
engines/fool/toolbox_menu.cpp
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index adb76b7f527..db475acc759 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -55,14 +55,14 @@ void Toolbox::CheckItem(MenuHandle &theMenu, uint16 item, bool checked) {
warning("Toolbox::CheckItem: empty menu handle");
return;
}
- if (theMenu->menuData.size() < (uint)(item + 1)) {
+ if (theMenu->menuData.size() < (uint)(item)) {
warning("Toolbox::CheckItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
if (_defaultMenu) {
Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
if (sub) {
- Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item);
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item-1);
if (it) {
it->checked = checked;
}
@@ -101,14 +101,14 @@ void Toolbox::DisableItem(MenuHandle &theMenu, uint16 item) {
warning("Toolbox::DisableItem: empty menu handle");
return;
}
- if (theMenu->menuData.size() < (uint)(item + 1)) {
+ if (theMenu->menuData.size() < (uint)(item)) {
warning("Toolbox::DisableItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
if (_defaultMenu) {
Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
if (sub) {
- Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item);
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item-1);
if (it) {
it->enabled = false;
}
@@ -132,14 +132,14 @@ void Toolbox::EnableItem(MenuHandle &theMenu, uint16 item) {
warning("Toolbox::EnableItem: empty menu handle");
return;
}
- if (theMenu->menuData.size() < (uint)(item + 1)) {
+ if (theMenu->menuData.size() < (uint)(item)) {
warning("Toolbox::EnableItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
if (_defaultMenu) {
Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
if (sub) {
- Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item);
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item-1);
if (it) {
it->enabled = true;
}
Commit: 30d8f1b6d57f7f53768148b306de6176f4028bc9
https://github.com/scummvm/scummvm/commit/30d8f1b6d57f7f53768148b306de6176f4028bc9
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:03+02:00
Commit Message:
FOOL: Fixed post-puzzle story actions
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/utils.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 00393caadf6..4a24f470983 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -784,8 +784,8 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
this->arr_i16_1d24[this->var_i16_30] |= 0x1;
}
// 128:1818
- this->var_i16_34 = 3 + (this->var_i16_30 - 1)/0x10;
- this->var_i16_36 = 1 + (this->var_i16_30 - 1) % 10;
+ this->var_i16_34 = 3 + ((this->var_i16_30 - 1) / 0x10);
+ this->var_i16_36 = 1 + ((this->var_i16_30 - 1) % 0x10);
this->var_str_172 = this->arr_str_195e8[this->var_i16_30] + g_zbasic->str(9);
g_zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
}
@@ -996,6 +996,7 @@ void FoolGame::storyRenderPage() {
// erase lower controls on scroll
this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
+ // if we've solved a puzzle, fill the scroll with crazy patterns
if ((this->var_i16_7ce & 0x8) != 0) {
this->var_i16_7ce ^= 0x8;
this->sub_128_bde(1, 0, 0, 0, 1, 0);
@@ -1469,7 +1470,7 @@ void FoolGame::sub_128_3536() {
if (this->var_i16_7e6 != 0xa) {
this->var_str_af4 = g_zbasic->str(60); // The Fool's Errand
g_zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
- g_zbasic->writeFileInt(2, this->var_i16_7d8);
+ g_zbasic->writeFileInt(2, this->storyNextPage);
g_zbasic->writeFileInt(2, this->var_i16_7e2);
g_zbasic->writeFileInt(2, this->var_i16_7ce);
g_zbasic->writeFileInt(2, this->var_i16_7d2);
@@ -1674,19 +1675,19 @@ void FoolGame::sub_128_39a0() {
}
}
// 128:3c04
- this->var_i16_7d8 = 0;
+ this->storyNextPage = 0;
this->var_i16_68c = 0x42;
for (int i = 0x42; i <= 0x45; i++) {
- for (int j = 1; j <= this->var_i16_7da; j++) {
+ for (int j = 1; j <= this->storyPageCount; j++) {
if (this->pageToChapter[j] == i) {
this->arr_i16_1b90[j] = 1;
- if ((i == 0x42) && (this->var_i16_7d8 == 0)) {
- this->var_i16_7d8 = j;
+ if ((i == 0x42) && (this->storyNextPage == 0)) {
+ this->storyNextPage = j;
}
}
// 128:3c6c
if (this->pageToChapter[j] < i) {
- j = this->var_i16_7da;
+ j = this->storyPageCount;
}
// 128:3c8e
}
@@ -1724,7 +1725,39 @@ void FoolGame::sub_128_39a0() {
}
void FoolGame::sub_128_3de6() {
- warning("STUB: %s", __func__);
+ // 128:3de6
+ if ((this->arr_i16_197c[this->var_i16_7d0] > 0) && ((this->arr_i16_1d24[this->arr_i16_197c[this->var_i16_7d0]] & 3) == 0)) {
+ this->storyNextPage = 0;
+ this->var_i16_7ce |= 8;
+ for (int i = 1; i <= this->storyPageCount; i++ ) {
+ // 128:3e56
+ if (this->pageToChapter[i] == this->arr_i16_197c[this->var_i16_7d0]) {
+ this->arr_i16_1b90[i] = 1;
+ if (this->storyNextPage == 0) {
+ this->storyNextPage = i;
+ }
+ }
+ // 128:3ea6
+ if (this->pageToChapter[i] - this->arr_i16_197c[this->var_i16_7d0] > 0) {
+ i = this->storyPageCount;
+ }
+ // 128:3eda
+ }
+ // 128:3eec
+ this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
+ this->var_i16_484 = 3 + ((this->var_i16_7d0 - 1) / 0x10);
+ this->var_i16_7e4 = 1 + ((this->var_i16_7d0 - 1) % 0x10);
+ if (this->arr_i16_197c[this->var_i16_7d0] == 0) {
+ this->var_i16_9f2 = 1;
+ this->arr_i16_1c5a[this->var_i16_7d0] = 0x64;
+ } else {
+ // 128:3f66
+ this->var_i16_9f2 = 2;
+ }
+ this->arr_i16_1d24[this->var_i16_7d0] |= (this->var_i16_9f2 + 4);
+ g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, this->var_i16_9f2, Common::U32String());
+ }
+ // 128:3fb4
}
void FoolGame::sub_128_3fb6() {
@@ -1833,6 +1866,7 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[2] = 0x8;
}
if (this->arr_i16_4758[0] == 0) {
+ // user clicked the puzzle button, zoom-fill with checkerboard
sub_128_962(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
return;
}
@@ -1842,10 +1876,83 @@ void FoolGame::sub_128_4472() {
g_toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
if (this->arr_i16_4758[5] == 0) {
// 128:456a
- warning("STUB: %s", __func__);
+ this->arr_i16_4758[12] = 0x1d;
+ this->arr_i16_4758[6] = 0x4;
+ this->arr_i16_4758[7] = 0x7;
}
// 128:459a
-
+ if (this->arr_i16_4758[5] == 1) {
+ this->arr_i16_4758[12] = 0x2a;
+ this->arr_i16_4758[6] = 0x4;
+ this->arr_i16_4758[7] = 0x6;
+ }
+ // 128:45e4
+ g_toolbox->PenSize(this->arr_i16_4758[7], this->arr_i16_4758[6]);
+ if ((this->arr_i16_4758[4] == 0) && (this->arr_i16_4758[5] == 0)) {
+ this->arr_i16_4758[8] = 0xa7;
+ this->arr_i16_4758[9] = 0x109;
+ this->arr_i16_4758[10] = 0xa7;
+ this->arr_i16_4758[11] = 0x109;
+ }
+ // 128:467c
+ if ((this->arr_i16_4758[4] == 0) && (this->arr_i16_4758[5] == 1)) {
+ this->arr_i16_4758[8] = 0xb5;
+ this->arr_i16_4758[9] = 0x100;
+ this->arr_i16_4758[10] = 0xb5;
+ this->arr_i16_4758[11] = 0x100;
+ }
+ // 128:46f6
+ if (this->arr_i16_4758[4] == 1) {
+ this->arr_i16_4758[6] *= -1;
+ this->arr_i16_4758[7] *= -1;
+ }
+ // 128:4754
+ if ((this->arr_i16_4758[4] == 1) && (this->arr_i16_4758[5] == 0)) {
+ this->arr_i16_4758[8] = 0x2b;
+ this->arr_i16_4758[9] = 0x31;
+ this->arr_i16_4758[10] = 0x123;
+ this->arr_i16_4758[11] = 0x1e1;
+ }
+ // 128:47ce
+ if ((this->arr_i16_4758[4] == 1) && (this->arr_i16_4758[5] == 1)) {
+ this->arr_i16_4758[8] = 0x10;
+ this->arr_i16_4758[9] = -0x7;
+ this->arr_i16_4758[10] = 0x15a;
+ this->arr_i16_4758[11] = 0x207;
+ }
+ // 128:4850
+ if ((this->arr_i16_15e8[this->var_i16_7e2] == 0xd) || (this->arr_i16_15e8[this->var_i16_7e2] == 0xe)) {
+ this->fillRect(0x14f, 0, 0x156, 0x7, 1);
+ this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 1);
+ }
+ // 128:48d6
+ for (int i = 0; i <= this->arr_i16_4758[12]; i++) {
+ this->arr_i16_4758[8] -= this->arr_i16_4758[6];
+ this->arr_i16_4758[9] -= this->arr_i16_4758[7];
+ this->arr_i16_4758[10] += this->arr_i16_4758[6];
+ this->arr_i16_4758[11] += this->arr_i16_4758[7];
+ if (this->arr_i16_4758[8] < 0x14) {
+ this->arr_i16_4758[8] = 0x14;
+ }
+ // 128:49e2
+ if (this->arr_i16_4758[3] == 0) {
+ this->arr_i16_4758[1] += 1;
+ if (this->arr_i16_4758[1] > 0x50) {
+ this->arr_i16_4758[1] = 1;
+ }
+ // 128:4a42
+ g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_4758[1]]);
+ }
+ // 128:4a64
+ Common::Rect temp(this->arr_i16_4758[9], this->arr_i16_4758[8], this->arr_i16_4758[11], this->arr_i16_4758[10]);
+ g_toolbox->FrameRect(temp);
+ // add fake delay for drawing visibility
+ if ((i % 4) == 0) {
+ g_toolbox->Delay(0);
+ }
+ }
+ // 128:4a8e
+ g_toolbox->PenNormal();
}
// about screen
@@ -2726,11 +2833,6 @@ void FoolGame::sub_133_004() {
warning("STUB: %s", __func__);
}
-// mask reveal puzzle
-void FoolGame::sub_134_004() {
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_135_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index b7acc8a1843..346d2c34617 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -142,7 +142,10 @@ public:
void sub_132_1444();
void sub_133_004();
+
+ // fool_reveal.cpp
void sub_134_004();
+
void sub_135_004();
void sub_136_004();
void sub_137_004();
@@ -225,8 +228,6 @@ private:
int16 var_i16_7d2;
int16 storyCurrentPage; // var_i16_7d4
int16 var_i16_7d6;
- int16 var_i16_7d8;
- int16 var_i16_7da;
int16 storyNextPage; // var_i16_7d8
int16 storyPageCount; // var_i16_7da
int16 selectedMenuChapter; // var_i16_7dc
@@ -326,8 +327,7 @@ private:
int16 arr_i16_3b38[0xc00]; // 96x32?
Common::Rect arr_rect_4338;
int16 arr_i16_4738[16];
- int16 arr_i16_4758[11];
- Common::Rect arr_rect_476e;
+ int16 arr_i16_4758[15];
Common::Rect arr_rect_4776;
int16 arr_i16_47d8[0x100];
int16 arr_i16_49d8[0x100];
@@ -356,6 +356,7 @@ private:
Common::Rect arr_rect_1910c;
PicHandle arr_i32_1912c[0x54];
PicHandle arr_i32_192c0[0x18];
+ PolyHandle arr_poly_192c0[0x18];
int32 arr_i32_19454[0x65];
Common::U32String arr_str_195e8[101]; // 0x20 each
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index e637559e071..1af0039cbc5 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -167,7 +167,8 @@ void FoolGame::sub_132_518() {
// change select area while mouse button held down
this->sub_132_67a();
// leave an XOR outline on the page for the selected block
- g_toolbox->FrameRect(this->arr_rect_476e);
+ Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
+ g_toolbox->FrameRect(temp);
this->arr_i16_4758[0] -= this->var_i16_68a;
this->arr_i16_4758[1] -= this->var_i16_68c;
@@ -175,7 +176,8 @@ void FoolGame::sub_132_518() {
// move select area to new target
this->sub_132_962();
// remove XOR outline
- g_toolbox->FrameRect(this->arr_rect_476e);
+ temp = Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
+ g_toolbox->FrameRect(temp);
this->sub_132_ed8();
this->sub_132_13ea();
@@ -208,15 +210,16 @@ void FoolGame::sub_132_67a() {
this->arr_i16_4758[7] = this->arr_i16_4758[1];
}
// 132:07b0
- this->arr_rect_476e.top = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
+ this->arr_i16_4758[11] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
// 132:080e
- this->arr_rect_476e.left = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
- this->arr_rect_476e.bottom = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
- this->arr_rect_476e.right = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
+ this->arr_i16_4758[12] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
+ this->arr_i16_4758[13] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
+ this->arr_i16_4758[14] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
+ Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
// 132:092e
- g_toolbox->FrameRect(this->arr_rect_476e);
+ g_toolbox->FrameRect(temp);
this->sub_128_3da(2);
- g_toolbox->FrameRect(this->arr_rect_476e);
+ g_toolbox->FrameRect(temp);
this->sub_128_3da(1);
} while (this->var_ev_46.what != kMouseUp);
}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 140acc4f00f..d52d94fa90c 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
fool_game.o \
fool_jigsaw.o \
fool_prologue.o \
+ fool_reveal.o \
toolbox.o \
toolbox_fileman.o \
toolbox_menu.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 710313e08b8..b2e213c3b2d 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -44,12 +44,18 @@ struct Region {
Common::Rect rgnBBox;
};
+struct Polygon {
+ uint16 polySize;
+ Common::Rect polyBBox;
+ Common::Array<Common::Point> polyPoints;
+};
+
typedef Common::SharedPtr<Common::Array<byte>> Handle;
typedef Common::SharedPtr<Region> RgnHandle;
typedef Common::SharedPtr<Image::PICTDecoder> PicHandle;
// BitMap is the monochrome surface format.
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
-typedef Handle PolyHandle;
+typedef Common::SharedPtr<Polygon> PolyHandle;
typedef uint32 ResType;
typedef size_t Size;
@@ -688,6 +694,15 @@ public:
// subsequent call to ShowCursor.
void HideCursor();
+ // PROCEDURE HidePen;
+ // HidePen decrements the current grafPort's pnVis field, which is initialized to 0 by OpenPort;
+ // whenever pnVis is negative, the pen doesn't draw on the screen. PnVis keeps track of the
+ // number of times the pen has been hidden to compensate for nested calls to HidePen and ShowPen
+ // (below). Every call to HidePen should be balanced by a subsequent call to ShowPen. HidePen
+ // is called by OpenRgn, OpenPicture, and OpenPoly so that you can define regions, pictures, and
+ // polygons without drawing on the screen.
+ void HidePen();
+
// PROCEDURE InitCursor;
// InitCursor sets the current cursor to the standard arrow and sets the cursor level to 0, making
// the cursor visible. The cursor level keeps track of the number of times the cursor has been
@@ -860,6 +875,12 @@ public:
// ShowCursor have no effect.
void ShowCursor();
+ // PROCEDURE ShowPen;
+ // ShowPen increments the current grafPort's pnVis field, which may have been decremented by
+ // HidePen; if pnVis becomes 0, QuickDraw resumes drawing on the screen. Extra calls to
+ // ShowPen will increment pnVis beyond 0, so every call to ShowPen should be balanced by a call
+ // to HidePen. ShowPen is called by CloseRgn, ClosePicture, and ClosePoly.
+ void ShowPen();
// toolbox_text.cpp
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 0f33df3e7bd..bd89fb2b70a 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -41,6 +41,7 @@ void Toolbox::BeginUpdate(WindowRecord &theWindow) {
void Toolbox::ClosePoly() {
warning("STUB: Toolbox::ClosePoly");
+ ShowPen();
}
void Toolbox::ClipRect(Common::Rect &r) {
@@ -316,6 +317,12 @@ void Toolbox::HideCursor() {
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
}
+void Toolbox::HidePen() {
+ if (_port) {
+ _port->pnVis--;
+ }
+}
+
void Toolbox::InitCursor() {
_cursorLevel = 0;
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
@@ -411,8 +418,10 @@ void Toolbox::MoveTo(int16 h, int16 v) {
}
PolyHandle Toolbox::OpenPoly() {
+ HidePen();
warning("STUB: Toolbox::OpenPoly");
- return 0;
+ PolyHandle handle(new Polygon());
+ return handle;
}
void Toolbox::OpenPort(GrafPtr port) {
@@ -523,6 +532,11 @@ void Toolbox::ShowCursor() {
}
}
+void Toolbox::ShowPen() {
+ if (_port) {
+ _port->pnVis++;
+ }
+}
} // namespace Fool
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index 5672cfaea98..22120cfd8cd 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -89,7 +89,13 @@ Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const
}
Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode) {
- return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7));
+ if ((mode >= 8) && (mode < 16)) {
+ // If the mode is one of the source transfer modes (or negative), no drawing is performed.
+ // Source: Inside Macintosh I-170
+ return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7));
+ }
+ warning("blitMono: Called with an invalid PatternMode, ignoring");
+ return Common::Rect();
}
Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount) {
Commit: e7422f8f2e85d48f07248e5a7bfbb4a3d26d5b33
https://github.com/scummvm/scummvm/commit/e7422f8f2e85d48f07248e5a7bfbb4a3d26d5b33
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:03+02:00
Commit Message:
MACGUI: Slightly modify drawPolygonScan code
Changed paths:
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 32e42ddf8c9..643121ec398 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -178,6 +178,7 @@ template<typename T>
class MacDrawPrimitives : public Primitives {
public:
void drawPoint(int x, int y, uint32 color, void *data) override;
+ void drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color, void *data) override;
};
template<typename T>
@@ -858,6 +859,49 @@ void MacDrawPrimitives<T>::drawPoint(int x, int y, uint32 color, void *data) {
}
}
+// Based on public-domain code by Darel Rex Finley, 2007
+// https://alienryderflex.com/polygon_fill/
+// Basically the same as the one in Graphics::Primitives, only tweaked to produce similar output to QuickDraw.
+template<typename T>
+void MacDrawPrimitives<T>::drawPolygonScan(const int *polyX, const int *polyY, int npoints, const Common::Rect &bbox, uint32 color, void *data) {
+ int *nodeX = (int *)calloc(npoints, sizeof(int));
+ int i, j;
+
+ // Loop through the rows of the image.
+ for (int pixelY = bbox.top; pixelY < bbox.bottom; pixelY++) {
+ // Build a list of nodes.
+ int nodes = 0;
+ j = npoints - 1;
+
+ for (i = 0; i < npoints; i++) {
+ if ((polyY[i] <= pixelY && polyY[j] > pixelY) || (polyY[j] <= pixelY && polyY[i] > pixelY)) {
+ nodeX[nodes++] = (int)(polyX[i] + (double)(pixelY - polyY[i]) / (double)(polyY[j]-polyY[i]) *
+ (double)(polyX[j] - polyX[i]) + 0.5);
+ }
+ j = i;
+ }
+
+ // Sort the nodes
+ Common::sort(nodeX, &nodeX[nodes]);
+
+ // Fill the pixels between node pairs.
+ for (i = 0; i < nodes; i += 2) {
+ if (nodeX[i ] >= bbox.right)
+ break;
+ if (nodeX[i + 1] > bbox.left) {
+ nodeX[i] = MAX<int16>(nodeX[i], bbox.left);
+ nodeX[i + 1] = MIN<int16>(nodeX[i + 1] - 1, bbox.right);
+ if (nodeX[i] < nodeX[i + 1])
+ drawHLine(nodeX[i], nodeX[i + 1], pixelY, color, data);
+ }
+ }
+ }
+
+ free(nodeX);
+}
+
+
+
// TODO: implement for other bpp
template<>
Commit: 4533a36ed807e602d82f1e55387d2f504e5b5d46
https://github.com/scummvm/scummvm/commit/4533a36ed807e602d82f1e55387d2f504e5b5d46
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:04+02:00
Commit Message:
COMMON: Add method for extending Rect with a Point
Changed paths:
common/rect.h
diff --git a/common/rect.h b/common/rect.h
index 8810a10dee9..275626e3a81 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -318,6 +318,18 @@ struct RectBase {
bottom = MAX(bottom, r.bottom);
}
+ /**
+ * Extend this rectangle so that it contains @p p.
+ *
+ * @param p The point to extend by.
+ */
+ void extend(const ConcretePoint &p) {
+ left = MIN(left, p.x);
+ right = MAX(right, p.x);
+ top = MIN(top, p.y);
+ bottom = MAX(bottom, p.y);
+ }
+
/**
* Extend this rectangle in all four directions by the given number of pixels.
*
Commit: eec7025a876a09c90a314eabc338df440e930e32
https://github.com/scummvm/scummvm/commit/eec7025a876a09c90a314eabc338df440e930e32
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:04+02:00
Commit Message:
FOOL: Implement polygon draw methods
Changed paths:
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index b2e213c3b2d..7e47959ad47 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -234,7 +234,7 @@ struct GrafPort {
uint16 patStretch = 0;
PicHandle picSave;
RgnHandle rgnSave;
- Handle polySave;
+ PolyHandle polySave;
};
typedef GrafPort * GrafPtr;
@@ -597,6 +597,12 @@ public:
// procedure draws the picture that you specify in the myPicture parameter.
void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
+ // PROCEDURE ErasePoly (poly: PolyHandle);
+ // Using the patCopy pattern mode, the ErasePoly procedure draws the interior of the
+ // polygon whose handle you pass in the poly parameter with the background pattern for
+ // the current graphics port.
+ void ErasePoly(PolyHandle &poly);
+
// PROCEDURE EraseRect (r: Rect);
// Using the patCopy pattern mode, the EraseRect procedure draws the interior of the
// rectangle that you specify in the r parameter with the background pattern for the current
@@ -623,11 +629,23 @@ public:
// The grafPort's pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
void FillOval(const Common::Rect &r, const Pattern &pat);
+ // PROCEDURE FillPoly (poly: PolyHandle; pat: Pattern);
+ // Using the patCopy pattern mode, the FillPoly procedure draws the interior of the
+ // polygon whose handle you pass in the poly parameter with the pattern defined in the
+ // Pattern record that you specify in the pat parameter.
+ void FillPoly(PolyHandle &poly, const Pattern &pat);
+
// PROCEDURE FillRect (r: Rect; pat: Pattern);
// FillRect fills the specified rectangle with the given pattern (in patCopy mode). The grafPort's
// pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
void FillRect(const Common::Rect &r, const Pattern &pat);
+ // PROCEDURE FillRoundRect (r: Rect; ovalWidth, ovalHeight: INTEGER, pat: Pattern);
+ // FillRoundRect fills the specified rounded-comer rectangle with the given pattern (in patCopy
+ // mode). OvalWidth and ovalHeight specify the diameters of curvature for the corners. The
+ // grafPort's pnPat, pnMode, and bkPat are all ignored; the pen location is not changed.
+ void FillRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight, const Pattern &pat);
+
// PROCEDURE FrameArc (r: Rect; startAngle,arcAngle: INTEGER);
// FrameArc draws an arc of the oval that fits inside the specified rectangle, using the current
// grafPort's pen pattern, mode, and size. StartAngle indicates where the arc begins and is treated
@@ -642,6 +660,12 @@ public:
// pnMode. The pen location is not changed by this procedure.
void FrameOval(const Common::Rect &r);
+ // PROCEDURE FramePoly (poly: PolyHandle);
+ // Using the current graphics portâs pen pattern, pattern mode, and size, the FramePoly
+ // procedure plays back the line-drawing commands that define the polygon whose handle
+ // you pass in the poly parameter.
+ void FramePoly(PolyHandle &poly);
+
// PROCEDURE FrameRect (r: Rect);
// FrameRect draws an outline just inside the specified rectangle, using the current grafPort's pen
// pattern, mode, and size. The outline is as wide as the pen width and as tall as the pen height. It's
@@ -723,6 +747,12 @@ public:
// bkPat are all ignored; the pen location is not changed.
void InvertOval(const Common::Rect &r);
+ // PROCEDURE InvertPoly (poly: PolyHandle);
+ // The InvertPoly procedure inverts the pixels enclosed by the polygon whose handle
+ // you pass in the poly parameter. Every white pixel becomes black and every black pixel
+ // becomes white.
+ void InvertPoly(PolyHandle &poly);
+
// PROCEDURE InvertRect (r: Rect);
// InvertRect inverts the pixels enclosed by the specified rectangle: Every white pixel becomes
// black and every black pixel becomes white. The grafPort's pnPat, pnMode, and bkPat are all
@@ -740,7 +770,14 @@ public:
// PROCEDURE KillPoly (poly: PolyHandle);
// KillPoly releases the memory occupied by the given polygon. Use this only when you're completely
// through with a polygon.
- void KillPoly(PolyHandle poly);
+ void KillPoly(PolyHandle &poly);
+
+ // PROCEDURE Line(dh, dv: INTEGER);
+ // This procedure draws a line to the location that's a distance of dh horizontally and dv vertically
+ // from the current pen location; it calls LineTo(h+dh,v+dv), where (h,v) is the current location.
+ // The positive directions are to the right and down. The pen location becomes the coordinates of
+ // the end of the line after the line is drawn. See the "General Discussion of Drawing" section.
+ void Line(int16 dh, int16 dv);
// PROCEDURE LineTo (h,v: INTEGER);
// LineTo draws a line from the current pen location to the location specified (in local coordinates)
@@ -797,7 +834,7 @@ public:
// PaintPoly paints the specified polygon with the current grafPort's pen pattern and pen mode. The
// polygon is filled with the pnPat, according to the pattern transfer mode specified by pnMode.
// The pen location is not changed by this procedure.
- void PaintPoly(PolyHandle poly);
+ void PaintPoly(PolyHandle &poly);
// PROCEDURE PaintRect (r: Rect);
// PaintRect paints the specified rectangle with the current grafPoit's pen pattern and mode. The
@@ -942,6 +979,7 @@ private:
void _pumpEvents();
void _updateScreen();
+ void _drawPoly(const PolyHandle &p, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index bd89fb2b70a..9e3cba51ab7 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -40,8 +40,26 @@ void Toolbox::BeginUpdate(WindowRecord &theWindow) {
}
void Toolbox::ClosePoly() {
- warning("STUB: Toolbox::ClosePoly");
ShowPen();
+ if (_port) {
+ if (_port->polySave) {
+ if (_port->polySave->polyPoints.size() >= 2) {
+ Common::Point p1 = _port->polySave->polyPoints[0];
+ Common::Point p2 = _port->polySave->polyPoints[1];
+ _port->polySave->polyBBox = Common::Rect(
+ p1.x < p2.x ? p1.x : p2.x,
+ p1.y < p2.y ? p1.y : p2.y,
+ p1.x < p2.x ? p2.x : p1.x,
+ p1.y < p2.y ? p2.y : p1.y
+ );
+ for (size_t i = 2; i < _port->polySave->polyPoints.size(); i++) {
+ _port->polySave->polyBBox.extend(_port->polySave->polyPoints[i]);
+ }
+ _port->polySave->polySize = _port->polySave->polyPoints.size();
+ }
+ _port->polySave = nullptr;
+ }
+ }
}
void Toolbox::ClipRect(Common::Rect &r) {
@@ -135,6 +153,12 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
// - blit to target with blitMono
// - add to target dirty rect list
+void Toolbox::ErasePoly(PolyHandle &poly) {
+ if (_port) {
+ _drawPoly(poly, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ }
+}
+
void Toolbox::EraseRect(const Common::Rect &r) {
if (_port) {
_drawRect(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
@@ -155,6 +179,69 @@ void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
warning("STUB: Toolbox::FillOval");
}
+void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
+ if (!poly) {
+ warning("_drawPoly: Polygon data not found, skipping");
+ return;
+ }
+ if (poly->polyPoints.size() < 2) {
+ warning("_drawPoly: need at least 2 points");
+ return;
+ }
+ if (_port && _port->pnVis == 0) {
+ Common::Rect bbox = poly->polyBBox;
+ Common::Rect destRect(bbox.width(), bbox.height());
+ // For thicker outlines, the shape will overflow the dimensions a little bit
+ destRect.right += _port->pnSize.x - 1;
+ destRect.bottom += _port->pnSize.y - 1;
+
+ BitMap intermediate(new Graphics::ManagedSurface(destRect.width(), destRect.height()));
+ BitMap mask(new Graphics::ManagedSurface(destRect.width(), destRect.height()));
+
+ Common::Point destPos(bbox.left, bbox.top);
+ Graphics::MacPatterns macpat({pat.data});
+
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+
+ if (frame) {
+ for (int i = 0; i < (int)poly->polyPoints.size() - 1; i++) {
+ Common::Point p1 = poly->polyPoints[i] - destPos;
+ Common::Point p2 = poly->polyPoints[i+1] - destPos;
+ pm.drawLine(p1.x, p1.y, p2.x, p2.y, fgColor, &pd);
+ }
+ } else {
+ Common::Array<int> polyX;
+ Common::Array<int> polyY;
+ for (auto &it : poly->polyPoints) {
+ polyX.push_back(it.x - destPos.x);
+ polyY.push_back(it.y - destPos.y);
+ debugC(5, kDebugGraphics, "Toolbox::_drawPoly: (%d, %d)", it.x - destPos.x, it.y - destPos.y);
+ }
+ pm.drawPolygonScan(polyX.data(), polyY.data(), poly->polyPoints.size(), destRect, fgColor, &pd);
+ }
+
+
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+
+ if (debugChannelSet(5, kDebugGraphics)) {
+ byte fakePal[768];
+ Common::fill(fakePal, fakePal+3, 0xff);
+ Common::fill(fakePal+3, fakePal+768, 0x00);
+ mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
+
+ debugC(5, kDebugGraphics, "Toolbox::_drawPoly: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
+ }
+
+ // Dirty rects check
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+ }
+}
+
+
void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
if (!r.isValidRect()) {
warning("Toolbox::_drawRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
@@ -231,12 +318,24 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
}
}
+void Toolbox::FillPoly(PolyHandle &poly, const Pattern &pat) {
+ if (_port) {
+ _drawPoly(poly, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ }
+}
+
void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
if (_port) {
_drawRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
}
}
+void Toolbox::FillRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight, const Pattern &pat) {
+ if (_port) {
+ _drawRoundRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ }
+}
+
void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle) {
warning("STUB: Toolbox::FrameArc");
}
@@ -261,6 +360,12 @@ void Toolbox::FrameOval(const Common::Rect &r) {
}
}
+void Toolbox::FramePoly(PolyHandle &poly) {
+ if (_port) {
+ _drawPoly(poly, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor);
+ }
+}
+
void Toolbox::FrameRect(const Common::Rect &r) {
if (_port) {
_drawRect(r, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor);
@@ -345,6 +450,15 @@ void Toolbox::InvertOval(const Common::Rect &r) {
warning("STUB: Toolbox::InvertOval");
}
+void Toolbox::InvertPoly(PolyHandle &poly) {
+ if (_port) {
+ // set pattern to full black
+ Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
+ _drawPoly(poly, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ }
+}
+
+
void Toolbox::InvertRect(const Common::Rect &r) {
if (_port) {
// set pattern to full black
@@ -362,8 +476,15 @@ void Toolbox::InvertRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ov
}
-void Toolbox::KillPoly(PolyHandle poly) {
- warning("STUB: Toolbox::KillPoly");
+void Toolbox::KillPoly(PolyHandle &poly) {
+ // zero out the destination pointer
+ poly = nullptr;
+}
+
+void Toolbox::Line(int16 dh, int16 dv) {
+ if (_port) {
+ LineTo(_port->pnLoc.x + dh, _port->pnLoc.x + dv);
+ }
}
void Toolbox::LineTo(int16 h, int16 v) {
@@ -390,6 +511,14 @@ void Toolbox::LineTo(int16 h, int16 v) {
}
if (_port) {
+ // update polygon if we're in ypenPoly mode
+ if (_port->polySave) {
+ if (_port->polySave->polyPoints.size() == 0) {
+ _port->polySave->polyPoints.push_back(_port->pnLoc);
+ }
+ _port->polySave->polyPoints.push_back(Common::Point(h, v));
+ }
+
_port->pnLoc = Common::Point(h, v);
}
}
@@ -419,8 +548,10 @@ void Toolbox::MoveTo(int16 h, int16 v) {
PolyHandle Toolbox::OpenPoly() {
HidePen();
- warning("STUB: Toolbox::OpenPoly");
PolyHandle handle(new Polygon());
+ if (_port) {
+ _port->polySave = handle;
+ }
return handle;
}
@@ -439,8 +570,10 @@ void Toolbox::PaintOval(const Common::Rect &r) {
warning("STUB: Toolbox::PaintOval");
}
-void Toolbox::PaintPoly(PolyHandle poly) {
- warning("STUB: Toolbox::PaintPoly");
+void Toolbox::PaintPoly(PolyHandle &poly) {
+ if (_port) {
+ _drawPoly(poly, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor);
+ }
}
void Toolbox::PaintRect(const Common::Rect &r) {
Commit: eb7bd647a71755c8a49aaab6d536b79840da2992
https://github.com/scummvm/scummvm/commit/eb7bd647a71755c8a49aaab6d536b79840da2992
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:05+02:00
Commit Message:
FOOL: First pass of reveal puzzle
Changed paths:
A engines/fool/fool_reveal.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 4a24f470983..5764d4ee3f4 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -377,11 +377,12 @@ void FoolGame::sub_128_4da(int16 unk1) {
void FoolGame::sub_128_50e(int16 unk3, int16 unk2, int16 unk1) {
// 128:050e
+ // audio tone
this->var_i16_34 = unk1;
this->var_i16_32 = unk2;
this->var_i16_30 = unk3;
- if (this->var_i16_378 != 1) {
- g_zbasic->unk_6(this->var_i16_30, this->var_i16_32, 0x96, 0);
+ if (this->var_i16_378 == 1) {
+ g_zbasic->sound(this->var_i16_30, this->var_i16_32, 0x96, 0);
if (this->var_i16_34 == 1) {
while (g_zbasic->unk_5()) {
g_toolbox->Delay(1);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 346d2c34617..43c88764cdf 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -145,6 +145,10 @@ public:
// fool_reveal.cpp
void sub_134_004();
+ void sub_134_67c();
+ void sub_134_74a();
+ void sub_134_7bc();
+ void sub_134_872();
void sub_135_004();
void sub_136_004();
@@ -300,6 +304,7 @@ private:
int16 var_i16_1aa6;
int16 var_i16_1aa8;
int16 var_i16_1aaa;
+ int16 var_i16_1aba;
// FIXME: bounds on the following are guessed! need to trace index range
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index a1342ca6571..dcca37185bc 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -564,7 +564,7 @@ void FoolPrologue::sub_129_004() {
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
- g_zbasic->unk_6(0x19, 0x64, 0xff, 0x0);
+ g_zbasic->sound(0x19, 0x64, 0xff, 0x0);
this->fillRect(2, 0x46, 0x64, 0xdc, 0x19c);
this->fillRect(1, 0x4b, 0x69, 0xd7, 0x197);
@@ -636,7 +636,7 @@ void FoolPrologue::sub_129_004() {
if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
g_toolbox->InitCursor();
g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
- g_zbasic->unk_6(0x19, 0x64, 0xff, 0x00);
+ g_zbasic->sound(0x19, 0x64, 0xff, 0x00);
this->fillRect(2, 0x64, 0x82, 0xdc, 0x17e);
this->fillRect(1, 0x69, 0x87, 0xd7, 0x179);
this->fillRect(2, 0x6e, 0x8c, 0xd2, 0x174);
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
new file mode 100644
index 00000000000..478aafa7adc
--- /dev/null
+++ b/engines/fool/fool_reveal.cpp
@@ -0,0 +1,212 @@
+/* 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 "graphics/managed_surface.h"
+
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// mask reveal puzzle
+void FoolGame::sub_134_004() {
+ // 134:0004
+ this->sub_128_271a();
+ this->var_i16_c00 = 1;
+ this->arr_i16_1eb8[15] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[16] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[21] = this->puzzlesReadShort();
+ this->var_str_384 = this->puzzlesReadString();
+ this->var_str_384 = g_zbasic->str(213) + this->var_str_384 + g_zbasic->str(214);
+ g_zbasic->menu(8, 6, 1, this->var_str_384);
+ for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ this->arr_i16_3738[i] = this->puzzlesReadByte();
+ }
+ // 134:00ce
+ g_toolbox->SetPort(this->var_i32_f24);
+ this->arr_i16_1eb8[20] = 0;
+ for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ this->var_i16_103a = this->puzzlesReadShort();
+ this->arr_poly_192c0[i] = g_toolbox->OpenPoly();
+ // 134:010e
+ for (int j = 5; j <= this->var_i16_103a - 1; j += 2) {
+ this->var_i16_484 = this->puzzlesReadShort();
+ this->var_i16_7e4 = this->puzzlesReadShort();
+ if (j == 5) {
+ g_toolbox->MoveTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
+ } else {
+ g_toolbox->LineTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
+ }
+ // 134:015c
+ }
+ g_toolbox->ClosePoly();
+ if (this->arr_i16_1eb8[16] <= i) {
+ this->arr_i16_1eb8[20] |= this->arr_i16_4738[i - 1];
+ }
+ // 134:01ce
+ }
+ // 134:01ea
+ g_toolbox->SetPort(this->var_i32_0);
+ this->arr_i16_1eb8[17] = (0x1c2 / this->arr_i16_1eb8[15]);
+ this->arr_i16_1eb8[18] = 0x100 - ((this->arr_i16_1eb8[15] * this->arr_i16_1eb8[17]) / 2);
+ this->var_str_1272 = this->puzzlesReadString();
+ this->sub_128_962(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ this->sub_128_962(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
+ // 134:02f0
+ this->arr_i16_1eb8[19] = g_zbasic->unk_310(this->var_str_c06);
+ this->var_i16_1aba = this->arr_i16_1eb8[18];
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ this->sub_128_50e(
+ g_zbasic->rndInt(0x3e8) + 0x19,
+ 0x28,
+ 1
+ );
+ // 134:0352
+ this->arr_rect_1f38[i].top = 0x10f;
+ this->arr_rect_1f38[i].left = this->var_i16_1aba;
+ this->arr_rect_1f38[i].bottom = 0x137;
+ this->arr_rect_1f38[i].right = this->var_i16_1aba + this->arr_i16_1eb8[17];
+
+ this->var_i16_1aba += this->arr_i16_1eb8[17];
+ // 134:03fc
+ g_toolbox->FillRoundRect(this->arr_rect_1f38[i], 0x19, 0x19, this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[i], 0x19, 0x19);
+ // 134:0448
+ this->var_str_384 = g_zbasic->midStr(this->var_str_1272, i, 1);
+ this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_384);
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[i].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
+ 0x127
+ );
+ g_toolbox->DrawString(this->var_str_384);
+ // 134:04d6
+ if (this->arr_i16_1eb8[19] && this->arr_i16_4738[this->arr_i16_3738[i] - 1]) {
+ this->sub_134_74a();
+ }
+ }
+ // 134:0538
+ this->var_i16_7c6 = 0;
+ if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
+ this->var_i16_d0c = 1;
+ } else {
+ // 134:0572
+ this->var_i16_d0c = 0;
+ }
+ g_toolbox->PenNormal();
+ // 134:057a
+ // 134:057a: JMP - [0x61e]
+ // main event loop
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
+ // 134:057e
+ while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
+ // 134:0582
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == kMouseDown) {
+ this->sub_134_67c();
+ }
+ if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
+ this->var_i16_d0c = 1;
+ }
+ // render screen
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+ }
+ // 134:05e2
+ if (this->var_i16_7c6 == 2) {
+ this->sub_134_7bc();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
+ this->sub_128_3536();
+ }
+ // 134:061e
+ }
+ // 134:0648
+ if (this->var_i16_d0c == 0) {
+ this->sub_134_872();
+ }
+ this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
+ // 134:0678: JMP - [0x8ae]
+ for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ g_toolbox->KillPoly(this->arr_poly_192c0[i]);
+ }
+}
+
+void FoolGame::sub_134_67c() {
+ // 134:067c
+ this->var_i16_7be = 0;
+ for (int j = 1; j <= this->arr_i16_1eb8[15]; j++) {
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1f38[j])) {
+ this->var_i16_7be = j;
+ j = this->arr_i16_1eb8[15];
+ }
+ }
+ // 134:06d0
+ if (this->var_i16_7be == 0) {
+ return;
+ }
+ // 134:06f4
+ this->sub_134_74a();
+ this->arr_i16_1eb8[19] ^= this->arr_i16_4738[this->arr_i16_3738[this->var_i16_7be]-1];
+ this->sub_128_6186();
+}
+
+void FoolGame::sub_134_74a() {
+ // 134:074a
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19);
+ g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[21]]);
+ g_toolbox->PenMode(kPatXor);
+ g_toolbox->PaintPoly(this->arr_poly_192c0[this->arr_i16_3738[this->var_i16_7be]]);
+ g_toolbox->PenNormal();
+}
+
+void FoolGame::sub_134_7bc() {
+ // 134:07bc
+ this->fillRect(0x37, 0x13, 0xff, 0x1ee, 0);
+ for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ this->var_i16_7be = 1;
+ if (this->arr_i16_1eb8[19] & this->arr_i16_4738[this->arr_i16_3738[i]-1]) {
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[i], 0x19, 0x19);
+ }
+ }
+ // 134:085c
+ this->arr_i16_1eb8[19] = 0;
+ this->var_i16_7c6 = 0;
+}
+
+void FoolGame::sub_134_872() {
+ // 134:0872
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ }
+ this->sub_128_2664();
+ this->sub_128_6186();
+ this->sub_128_d34(0x37, 0x13, 0xff, 0x1ee, 0xc8);
+}
+
+}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index ebf35954f08..4d879f2fb7e 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -54,6 +54,9 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
_window->setSurface(_toolbox->_defaultBits.get(), DisposeAfterUse::NO);
+ GrafPtr port(new GrafPort);
+ _toolbox->OpenPort(port);
+ _toolbox->SetPort(port);
}
@@ -550,17 +553,17 @@ void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, i
warning("STUB: ZBasic::window");
}
+void ZBasic::unk_4() {
+ warning("STUB: ZBasic::unk_4");
+}
+
int16 ZBasic::unk_5() {
warning("STUB: ZBasic::unk_5");
return 0;
}
-void ZBasic::unk_4() {
- warning("STUB: ZBasic::unk_4");
-}
-
-void ZBasic::unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4) {
- warning("STUB: ZBasic::unk_6");
+void ZBasic::sound(int16 frequency, int32 duration, int16 volume, int16 voice) {
+ warning("STUB: ZBasic::unk_6: frequency %d, duration %d, volume %d, voice %d", frequency, duration, volume, voice);
}
void ZBasic::unk_11(int16 unk1) {
@@ -623,7 +626,11 @@ void ZBasic::unk_158() {
uint16 ZBasic::unk_310(const Common::U32String &unk1) {
uint16 result = 0;
+ if (unk1.size() == 0)
+ return result;
result |= unk1[0] << 8;
+ if (unk1.size() == 1)
+ return result;
result |= unk1[1];
return result;
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index c5ac771d374..1b65fe745a4 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -291,7 +291,7 @@ public:
void unk_4(); // possibly quit?
int16 unk_5();
- void unk_6(int16 unk1, int32 unk2, int16 unk3, int16 unk4);
+ void sound(int16 frequency, int32 duration, int16 volume, int16 voice);
void unk_10();
void unk_11(int16 unk1);
void unk_20();
Commit: bab032b68475aa26f14aced6b2a5cf5e7555007b
https://github.com/scummvm/scummvm/commit/bab032b68475aa26f14aced6b2a5cf5e7555007b
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:05+02:00
Commit Message:
FOOL: First pass at sound API
Changed paths:
A engines/fool/toolbox_sound.cpp
engines/fool/fool_reveal.cpp
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 478aafa7adc..c317ae98ed2 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -46,8 +46,10 @@ void FoolGame::sub_134_004() {
this->arr_i16_3738[i] = this->puzzlesReadByte();
}
// 134:00ce
+ // rack up polygon information
g_toolbox->SetPort(this->var_i32_f24);
this->arr_i16_1eb8[20] = 0;
+
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
this->var_i16_103a = this->puzzlesReadShort();
this->arr_poly_192c0[i] = g_toolbox->OpenPoly();
@@ -70,6 +72,7 @@ void FoolGame::sub_134_004() {
}
// 134:01ea
g_toolbox->SetPort(this->var_i32_0);
+
this->arr_i16_1eb8[17] = (0x1c2 / this->arr_i16_1eb8[15]);
this->arr_i16_1eb8[18] = 0x100 - ((this->arr_i16_1eb8[15] * this->arr_i16_1eb8[17]) / 2);
this->var_str_1272 = this->puzzlesReadString();
@@ -80,6 +83,7 @@ void FoolGame::sub_134_004() {
this->var_i16_1aba = this->arr_i16_1eb8[18];
g_zbasic->text(0, 0xc, 0, kSrcOr);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ // play a random tone and draw each of the letter buttons in sequence
this->sub_128_50e(
g_zbasic->rndInt(0x3e8) + 0x19,
0x28,
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index d52d94fa90c..944103bdbdb 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS = \
toolbox_menu.o \
toolbox_quickdraw.o \
toolbox_resman.o \
+ toolbox_sound.o \
toolbox_text.o \
zbasic.o \
console.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 7e47959ad47..e79a3880d46 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -304,6 +304,27 @@ struct SFReply {
Common::String fName; // 10
}; // total: 76
+enum SynthMode : int16 {
+ swMode = -1, // square-wave
+ ftMode = 1, // four-tone
+ ffMode = 0, // free-form
+};
+
+struct Tone {
+ uint16 count;
+ uint16 amplitude;
+ uint16 duration;
+};
+
+struct SynthRec {
+ SynthMode mode;
+};
+typedef SynthRec * SynthPtr;
+
+struct SWSynthRec : SynthRec {
+ Common::Array<Tone> triplets;
+};
+
class Toolbox {
public:
@@ -355,6 +376,19 @@ public:
// Str255; dlgHook: ProcPtr; VAR reply: SFReply);
void SFPutFile(const Common::Point &where, const Common::U32String &prompt, const Common::U32String &origName, const ProcPtr &dlgHook, SFReply &reply);
+ // toolbox_sound.cpp
+
+ // PROCEDURE StartSound (synthRec: Ptr; numBytes: LONGINT; completionRtn: ProcPtr);
+ // StartSound begins producing the sound described by the synthesizer buffer pointed to by
+ // synthRec. NumBytes indicates the size of the synthesizer buffer (in bytes), and completionRtn
+ // points to a completion routine to be executed when the sound finishes:
+ // ⢠If completionRtn is POINTER(-l), the sound will be produced synchronously.
+ // ⢠If completionRtn is NIL, the sound will be produced asynchronously, but no completion
+ // routine will be executed.
+ // ⢠Otherwise, the sound will be produced asynchronously and the routine pointed to by
+ // completionRtn will be executed when the sound finishes.
+ void StartSound(SynthPtr synthRec, uint32 numBytes, ProcPtr completionRtn);
+
// toolbox_resman.cpp
// FUNCTION CountResources (theType: ResType): Integer;
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 9e3cba51ab7..70665fb89db 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -225,10 +225,10 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
if (debugChannelSet(5, kDebugGraphics)) {
- byte fakePal[768];
- Common::fill(fakePal, fakePal+3, 0xff);
- Common::fill(fakePal+3, fakePal+768, 0x00);
- mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
debugC(5, kDebugGraphics, "Toolbox::_drawPoly: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
diff --git a/engines/fool/toolbox_sound.cpp b/engines/fool/toolbox_sound.cpp
new file mode 100644
index 00000000000..08dffdb73a4
--- /dev/null
+++ b/engines/fool/toolbox_sound.cpp
@@ -0,0 +1,46 @@
+/* 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/system.h"
+#include "common/savefile.h"
+
+#include "gui/filebrowser-dialog.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+
+namespace Fool {
+
+void Toolbox::StartSound(SynthPtr synthRec, uint32 numBytes, ProcPtr completionRtn) {
+ if (!synthRec) {
+ warning("Toolbox::startSound: record not found");
+ return;
+ }
+ if (synthRec->mode == swMode) {
+ SWSynthRec *rec = static_cast<SWSynthRec *>(synthRec);
+ } else {
+ warning("Toolbox::startSound: unimplemented synth mode %d", synthRec->mode);
+ return;
+ }
+}
+
+
+} // namespace Fool
Commit: 8cfa24bd696b9eec64caad3a3a1b8fae41e9307c
https://github.com/scummvm/scummvm/commit/8cfa24bd696b9eec64caad3a3a1b8fae41e9307c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:05+02:00
Commit Message:
FOOL: First pass at QuickDraw-backed PICT decoder
Changed paths:
A engines/fool/fool_polyomino.cpp
A engines/fool/toolbox_pict.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/fool_reveal.cpp
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5764d4ee3f4..37f2fc045ae 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -559,6 +559,7 @@ void FoolGame::sub_128_c6a(int16 unk1) {
}
void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+ // flash a rectangle on the screen until we get a click
// 128:0d34
this->arr_rect_5b7c.top = unk5;
this->arr_rect_5b7c.left = unk4;
@@ -567,13 +568,15 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
while (this->var_ev_46.modifiers & kModMouseButtonUp) {
// 128:0d94
do {
+ // FIXME: Flashing far too intense
g_toolbox->InvertRect(this->arr_rect_5b7c);
this->var_i16_3a = 0;
do {
this->sub_128_c6a(0);
this->var_i16_3a += 1;
- g_toolbox->Delay(0);
- } while ((this->var_i16_38 == this->var_i16_3a) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0));
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+ } while (!((unk1 == this->var_i16_3a) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0);
}
}
@@ -1240,8 +1243,7 @@ void FoolGame::sub_128_2bc6() {
// 128:2c5e
for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
- // arr_i16_4738 is 1 << i
- if (this->arr_i16_4758[j] & this->arr_i16_4738[i]) {
+ if (this->arr_i16_4758[j] & this->bitLUT[i]) {
this->arr_i16_1b90[this->var_i16_484] = 1;
} else {
// 128:2ca6
@@ -1602,7 +1604,7 @@ void FoolGame::sub_128_39a0() {
this->sub_133_004();
break;
case 7:
- this->sub_134_004();
+ this->revealRun();
break;
case 8:
this->sub_135_004();
@@ -1945,7 +1947,13 @@ void FoolGame::sub_128_4472() {
g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_4758[1]]);
}
// 128:4a64
- Common::Rect temp(this->arr_i16_4758[9], this->arr_i16_4758[8], this->arr_i16_4758[11], this->arr_i16_4758[10]);
+ // FIXME: These can sometimes be invalid.
+ // Create manually to avoid the assert crash in the constructor.
+ Common::Rect temp;
+ temp.left = this->arr_i16_4758[9];
+ temp.top = this->arr_i16_4758[8];
+ temp.right = this->arr_i16_4758[11];
+ temp.bottom = this->arr_i16_4758[10];
g_toolbox->FrameRect(temp);
// add fake delay for drawing visibility
if ((i % 4) == 0) {
@@ -2455,7 +2463,8 @@ void FoolGame::sub_129_068() {
}
// 129:0ad4
for (int i = 0; i <= 0xf; i++) {
- this->arr_i16_4738[i] = this->puzzlesReadShort();
+ // bitLUT is 1 << i
+ this->bitLUT[i] = this->puzzlesReadShort();
}
// 129:0b02
for (int i = 1; i <= 0x51; i++) {
@@ -2575,6 +2584,7 @@ void FoolGame::sub_129_068() {
// 129:0fea
}
// 129:0ff8
+ Common::fill(this->arr_i16_1dee, this->arr_i16_1dee + 202, 0);
for (int j = 1; j <= this->storyPageCount; j++) {
for (int i = this->pageLineRanges[j*2]; i <= this->pageLineRanges[j*2 + 1]; i++) {
if (this->pageLineBreak[i] != 0) {
@@ -2715,7 +2725,7 @@ void FoolGame::sub_130_004() {
// 130:035a
for (int i = 0; i <= 0xc; i++) {
this->var_i16_484++;
- if (this->var_i16_106a && this->arr_i16_4738[i]) {
+ if (this->var_i16_106a & this->bitLUT[i]) {
g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_484]);
}
}
@@ -2756,84 +2766,6 @@ void FoolGame::sub_131_004() {
warning("STUB: %s", __func__);
}
-// polyomino puzzle
-void FoolGame::sub_133_004() {
- // 133:0004
- this->sub_128_271a();
- this->var_i16_c00 = 1;
- for (int i = 0; i <= 0x11; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
- }
- // 133:003c
- this->var_str_384 = this->puzzlesReadString();
- // "the completed puzzle will reveal..."
- this->var_str_384 = g_zbasic->str(209) + this->var_str_384 + g_zbasic->str(210);
- g_zbasic->menu(8, 0xf, 1, this->var_str_384);
- this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[8];
- do {
- // 133:009e
- this->var_i16_68a = this->arr_i16_1eb8[10];
- do {
- // 133:00b2
- this->var_i16_484 += 1;
- g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
- this->var_i16_68a,
- this->var_i16_68c,
- this->var_i16_68a + this->arr_i16_1eb8[13],
- this->var_i16_68c + this->arr_i16_1eb8[12]
- );
- // 133:0112
- } while (g_zbasic->incrAndCheck(
- this->var_i16_68a,
- this->arr_i16_1eb8[11],
- this->arr_i16_1eb8[6]
- ));
- // 133:0142
- } while (g_zbasic->incrAndCheck(
- this->var_i16_68c,
- this->arr_i16_1eb8[9],
- this->arr_i16_1eb8[7]
- ));
- // 133:0172
- this->var_i16_484 = 0;
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- // 133:0184
- this->var_i16_484++;
- this->arr_i16_2f38[i*32 + j] = 0;
- this->arr_i16_3b38[i*32 + j] = this->var_i16_484;
- }
- }
- // 133:01fa
- for (int i = 0x12; i <= 0x19; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
- }
- // 133:0228
- g_toolbox->SetPort(this->var_i32_f24);
- g_zbasic->text(0xfb, 0x18, 0, kSrcOr);
- this->var_i16_7cc = 1;
- this->var_i16_103a = this->puzzlesReadShort();
- for (int i = 0; i <= 4; i++) {
- this->arr_i16_47d8[this->var_i16_7cc*8 + i] = this->puzzlesReadShort();
- }
- // 133:0284
- for (int i = 5; i <= 6; i++) {
- this->arr_i16_47d8[this->var_i16_7cc*8 + i] = this->arr_i16_47d8[this->var_i16_7cc*8 + i - 2];
- }
- // 133:02de
- if (this->var_str_c06 != g_zbasic->str(211)) {
- if (this->var_i16_7cc != 1) {
- this->var_i16_1aa8 = 1;
- }
- this->var_i16_1aaa = 3;
- //this->arr_i16_47d8[this->var_i16_7cc*8 + this->var_i16_1aaa], this->var_str_c06
- }
- // 133:0356
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_135_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 43c88764cdf..8cceef071a0 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -141,14 +141,24 @@ public:
void sub_132_13ea();
void sub_132_1444();
+ // fool_polyomino.cpp
void sub_133_004();
+ void sub_133_87c();
+ void sub_133_eb2();
+ void sub_133_f04();
+ void sub_133_10a0();
+ void sub_133_11cc();
+ void sub_133_12d4();
+ void sub_133_12f2();
+ void sub_133_13e2();
+ void sub_133_1452();
// fool_reveal.cpp
- void sub_134_004();
- void sub_134_67c();
- void sub_134_74a();
- void sub_134_7bc();
- void sub_134_872();
+ void revealRun(); // sub_134_004
+ void revealOnClick(); // sub_134_67c
+ void revealSelectButton(); // sub_134_74a
+ void revealReset(); // sub_134_7bc
+ void revealSuccess(); // sub_134_872
void sub_135_004();
void sub_136_004();
@@ -298,12 +308,21 @@ private:
Common::U32String var_str_1272;
int16 var_i16_1372;
+ int16 var_i16_1a96;
+ int16 var_i16_1a98;
+ uint16 var_i16_1a9c;
int16 var_i16_1a9e;
int16 var_i16_1aa0;
int16 var_i16_1aa4;
int16 var_i16_1aa6;
int16 var_i16_1aa8;
int16 var_i16_1aaa;
+ PolyHandle var_poly_1aac;
+ int16 var_i16_1ab0;
+ int16 var_i16_1ab2;
+ int16 var_i16_1ab4;
+ int16 var_i16_1ab6;
+ int16 var_i16_1ab8;
int16 var_i16_1aba;
@@ -331,11 +350,13 @@ private:
int16 arr_i16_3738[0x400];
int16 arr_i16_3b38[0xc00]; // 96x32?
Common::Rect arr_rect_4338;
- int16 arr_i16_4738[16];
+ // general-purpose puzzle buffer
+ int16 arr_i16_4338[0x200];
+ uint16 bitLUT[16]; // arr_i16_4738
int16 arr_i16_4758[15];
Common::Rect arr_rect_4776;
int16 arr_i16_47d8[0x100];
- int16 arr_i16_49d8[0x100];
+ PicHandle arr_pic_49d8[0x80];
int16 arr_i16_4bd8[0x52];
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[48];
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
new file mode 100644
index 00000000000..905992bb200
--- /dev/null
+++ b/engines/fool/fool_polyomino.cpp
@@ -0,0 +1,448 @@
+/* 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 "graphics/managed_surface.h"
+
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// polyomino puzzle
+void FoolGame::sub_133_004() {
+ // 133:0004
+ this->sub_128_271a();
+ this->var_i16_c00 = 1;
+ for (int i = 0; i <= 0x11; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ // 133:003c
+ this->var_str_384 = this->puzzlesReadString();
+ // "the completed puzzle will reveal..."
+ this->var_str_384 = g_zbasic->str(209) + this->var_str_384 + g_zbasic->str(210);
+ g_zbasic->menu(8, 0xf, 1, this->var_str_384);
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
+ do {
+ // 133:009e
+ this->var_i16_68a = this->arr_i16_1eb8[10];
+ do {
+ // 133:00b2
+ this->var_i16_484 += 1;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a,
+ this->var_i16_68c,
+ this->var_i16_68a + this->arr_i16_1eb8[13],
+ this->var_i16_68c + this->arr_i16_1eb8[12]
+ );
+ // 133:0112
+ } while (g_zbasic->incrAndCheck(
+ this->var_i16_68a,
+ this->arr_i16_1eb8[11],
+ this->arr_i16_1eb8[6]
+ ));
+ // 133:0142
+ } while (g_zbasic->incrAndCheck(
+ this->var_i16_68c,
+ this->arr_i16_1eb8[9],
+ this->arr_i16_1eb8[7]
+ ));
+ // 133:0172
+ this->var_i16_484 = 0;
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ // 133:0184
+ this->var_i16_484++;
+ this->arr_i16_2f38[i*32 + j] = 0;
+ this->arr_i16_3b38[i*32 + j] = this->var_i16_484;
+ }
+ }
+ // 133:01fa
+ for (int i = 0x12; i <= 0x19; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ // 133:0228
+ g_toolbox->SetPort(this->var_i32_f24);
+ g_zbasic->text(0xfb, 0x18, 0, kSrcOr);
+
+ for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
+ this->var_i16_103a = this->puzzlesReadShort();
+ for (int i = 0; i <= 4; i++) {
+ this->arr_i16_47d8[j*8 + i] = this->puzzlesReadShort();
+ }
+ // 133:0284
+ for (int i = 5; i <= 6; i++) {
+ this->arr_i16_47d8[j*8 + i] = this->arr_i16_47d8[j*8 + i - 2];
+ }
+ // 133:02de
+ if (this->var_str_c06 != g_zbasic->str(211)) {
+ if (j != 1) {
+ this->var_i16_1aa8 = 1;
+ }
+ for (int i = 3; i <= 4; i++) {
+ this->arr_i16_47d8[j*8 + i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, i, 2));
+ this->var_i16_1aa8 += 2;
+ }
+ }
+ // 133:0356
+ for (int i = 0; i <= this->var_i16_103a; i++) {
+ this->arr_i16_4338[i] = this->puzzlesReadByte();
+ }
+ // 133:0388
+ this->var_poly_1aac = g_toolbox->OpenPoly();
+ g_toolbox->MoveTo(this->arr_i16_4338[1], this->arr_i16_4338[0]);
+ for (int i = 2; i <= this->var_i16_103a; i += 2) {
+ g_toolbox->LineTo(this->arr_i16_4338[i+1], this->arr_i16_4338[i]);
+ }
+ g_toolbox->ClosePoly();
+ // 133:0408
+ this->var_i16_103a = this->puzzlesReadShort();
+ if (this->var_i16_103a >= 3) {
+ for (int i = 1; i <= this->var_i16_103a; i++) {
+ this->arr_i16_3738[i] = this->puzzlesReadByte();
+ }
+ }
+ // 133:044a
+ this->arr_i16_1eb8[0x1a] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[0x1b] = this->puzzlesReadShort();
+ g_toolbox->PenNormal();
+ // 133:0476: JSR - "PICTURE_ON"
+ PicHandle handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ g_toolbox->PenMode(kPatXor);
+ if (this->var_i16_103a >= 3) {
+ g_toolbox->TextMode(kSrcXor);
+ for (int i = 1; i <= this->var_i16_103a; i += 3) {
+ g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
+ this->var_str_384 = g_zbasic->chr(this->arr_i16_3738[i+2]);
+ g_toolbox->DrawString(this->var_str_384);
+ }
+ }
+ // 133:050a
+ g_toolbox->InvertPoly(this->var_poly_1aac);
+ g_toolbox->ClosePicture();
+ this->arr_pic_49d8[j*4] = handle;
+ g_toolbox->PenNormal();
+ // 133:0530: JSR - "PICTURE_ON"
+ handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ g_toolbox->FillPoly(this->var_poly_1aac, this->arr_pat_58f4[this->arr_i16_1eb8[0x1a]]);
+ g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xd]]);
+ g_toolbox->FramePoly(this->var_poly_1aac);
+ // 133:0582
+ if (this->var_i16_103a >= 3) {
+ g_toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
+ for (int i = 1; i <= this->var_i16_103a; i += 3) {
+ g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
+ this->var_str_384 = g_zbasic->str(this->arr_i16_3738[i+2]);
+ g_toolbox->DrawString(this->var_str_384);
+ }
+ }
+ // 133:061a
+ g_toolbox->FramePoly(this->var_poly_1aac);
+ g_toolbox->ClosePicture();
+ // 133:0622
+ this->arr_pic_49d8[j*4 + 1] = handle;
+ g_toolbox->PenNormal();
+ // 133:0642: JSR - "PICTURE_ON"
+ handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xf]]);
+ g_toolbox->FramePoly(this->var_poly_1aac);
+ g_toolbox->PaintPoly(this->var_poly_1aac);
+ g_toolbox->ClosePicture();
+ this->arr_pic_49d8[j*4 + 2] = handle;
+ g_toolbox->KillPoly(this->var_poly_1aac);
+ // 133:0698
+ }
+ // 133:06b4
+ g_toolbox->SetPort(this->var_i32_0);
+ this->var_i16_484 = 0;
+ for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
+ for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
+ this->var_i16_484++;
+ this->arr_i16_4338[this->var_i16_484] = this->puzzlesReadByte();
+ }
+ }
+ // 133:073c
+ this->sub_128_bde(1, this->arr_i16_1eb8[0xf], 0, 1, 1, 1);
+ this->var_i16_1ab0 = 0;
+ for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
+ this->var_i16_68a = this->arr_i16_47d8[i*8 + 3];
+ this->var_i16_68c = this->arr_i16_47d8[i*8 + 4];
+ this->sub_133_f04();
+ }
+ this->var_i16_1ab0 = 1;
+ this->sub_133_12d4();
+ this->sub_133_12f2();
+ this->var_i16_7c6 = 0;
+ do {
+ do {
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_133_87c();
+ }
+ // yield to renderer
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+ // 133:0800
+ } while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0));
+ // 133:081c
+ if (this->var_i16_7c6 == 2) {
+ this->sub_133_11cc();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_133_1452();
+ this->sub_128_3536();
+ }
+ } while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0));
+ // 133:0864
+ if (this->var_i16_d0c != 0) {
+ this->sub_133_13e2();
+ }
+ this->sub_133_1452();
+
+ //133:0878: JMP - [0x1502]
+ for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
+ for (int i = 0; i <= 2; i++) {
+ g_toolbox->KillPicture(this->arr_pic_49d8[j*4 + i]);
+ }
+ }
+}
+
+void FoolGame::sub_133_87c() {
+ // 133:087c
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
+ this->sub_128_6186();
+ return;
+ }
+ // 133:0904
+ this->var_i16_7cc = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
+ if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == 0) {
+ this->sub_128_6186();
+ return;
+ }
+ // 133:0950
+ if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] <= this->arr_i16_1eb8[0x11]) {
+ this->sub_133_10a0();
+ return;
+ }
+ // 133:0990
+ this->var_i16_106a = 0;
+ this->var_i16_1a96 = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
+ this->var_i16_1a98 = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
+ for (int j = this->var_i16_1a98; j <= this->var_i16_1a98 + 3; j++) {
+ // 133:09dc
+ for (int i = this->var_i16_1a96; i <= this->var_i16_1a96 + 3; i++) {
+ if (this->arr_i16_47d8[this->var_i16_7cc*8] & this->bitLUT[this->var_i16_106a]) {
+ this->arr_i16_2f38[i*32 + j] = 0;
+ }
+ // 133:0a36
+ this->var_i16_106a++;
+ }
+ }
+ // 133:0a60
+ this->var_i16_1ab2 = this->var_i16_1a96 - this->var_i16_68a;
+ this->var_i16_1ab4 = this->var_i16_1a98 - this->var_i16_68c;
+ this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].left;
+ this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].top;
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 2]);
+ // 133:0b5a: JMP - [0xde0]
+ while (this->var_ev_46.what != 2) {
+ // 133:0d3a
+ while ((this->var_i16_1ab6 == this->var_i16_1062) && (this->var_i16_1ab8 == this->var_i16_1064) && (this->var_ev_46.what != 2)) {
+ // 133:0b62
+ this->sub_128_c6a(4);
+ this->var_i16_68a = (this->arr_i16_1eb8[6] / (this->var_ev_46.where.x - this->arr_i16_1eb8[4])) + this->var_i16_1ab2;
+ this->var_i16_68c = (this->arr_i16_1eb8[7] / (this->var_ev_46.where.y - this->arr_i16_1eb8[5])) + this->var_i16_1ab4;
+ if (this->var_i16_68a < 1) {
+ this->var_i16_68a = 1;
+ }
+ // 133:0bf8
+ if (this->var_i16_68a > (0x12 - this->arr_i16_47d8[this->var_i16_7cc*8 + 1])) {
+ this->var_i16_68a = 0x12 - this->arr_i16_47d8[this->var_i16_7cc*8 + 1];
+ }
+ // 133:0c58
+ if (this->var_i16_68c < 1) {
+ this->var_i16_68c = 1;
+ }
+ // 133:0c68
+ if (this->var_i16_68c > (0xb - this->arr_i16_47d8[this->var_i16_7cc*8 + 2])) {
+ this->var_i16_68c = 0xb - this->arr_i16_47d8[this->var_i16_7cc*8 + 2];
+ }
+ // 133:0cc8
+ this->var_i16_1ab6 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
+ this->var_i16_1ab8 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ }
+ // 133:0d78
+ if (this->var_ev_46.what != 2) {
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ this->var_i16_1062 = this->var_i16_1ab6;
+ this->var_i16_1064 = this->var_i16_1ab8;
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ }
+ // 133:0de0
+
+ // yield to renderer
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+
+ }
+ // 133:0dea
+ this->var_i16_106a = 0;
+ this->var_i16_1a9c = 0;
+ for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
+ for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
+ if (this->arr_i16_2f38[i*32 + j] > 0) {
+ this->var_i16_1a9c |= this->bitLUT[this->var_i16_106a];
+ }
+ // 133:0e44
+ this->var_i16_106a++;
+ }
+ // 133:0e5a
+ }
+ // 133:0e6c
+ if ((this->var_i16_1a9c & this->arr_i16_47d8[this->var_i16_7cc*8]) != 0) {
+ this->sub_133_eb2();
+ } else {
+ this->sub_133_f04();
+ }
+ // 133:0ea2
+ this->sub_133_12d4();
+ this->sub_133_12f2();
+ this->sub_128_4da(1);
+}
+
+void FoolGame::sub_133_eb2() {
+ // 133:0eb2
+ this->sub_128_50e(0x14, 0x64, 0);
+ this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
+ this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
+
+ sub_133_f04();
+}
+
+void FoolGame::sub_133_f04() {
+ // 133:0f04
+ this->var_i16_106a = 0;
+ for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
+ for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
+ this->var_i16_1a96 = this->var_i16_68a;
+ if ((this->arr_i16_47d8[this->var_i16_7cc*8 + 1] & this->bitLUT[this->var_i16_106a]) != 0) {
+ this->arr_i16_2f38[i*32 + j] = this->var_i16_7cc;
+ }
+ // 133:0f6c
+ this->var_i16_106a++;
+ }
+ }
+ // 133:0f96
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 3] = this->var_i16_68a;
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 4] = this->var_i16_68c;
+
+ // 133:0fce
+ if (this->var_i16_1ab0 != 0) {
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ }
+ // 133:1002
+ this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
+ this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
+
+}
+
+void FoolGame::sub_133_10a0() {
+ // 133:10a0
+ this->var_i16_484 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
+ this->var_i16_7e4 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
+ this->sub_128_50e(0x14, 0x64, 0);
+ // why do this???
+ // 133:1188
+ for (int i = 0; i <= 9; i++) {
+ g_zbasic->picture(this->var_i16_484, this->var_i16_7e4, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ }
+ // 133:11c2
+ this->sub_133_12d4();
+ this->sub_128_6186();
+}
+
+void FoolGame::sub_133_11cc() {
+ // 133:11cc
+ for (int j = 1; j <= this->arr_i16_1eb8[1] + 1; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0] + 1; i++) {
+ this->arr_i16_2f38[i*32 + j] = 0;
+ }
+ }
+ // 133:122e
+ this->fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_1eb8[0xf]);
+ this->var_i16_1ab0 = 0;
+ this->var_i16_7cc = 1;
+ for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
+ this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 5];
+ this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 6];
+ this->sub_133_f04();
+ }
+ // 133:12c2
+ this->var_i16_1ab0 = 1;
+ this->sub_133_12d4();
+ this->var_i16_7c6 = 0;
+}
+
+void FoolGame::sub_133_12d4() {
+ // 133:12d4
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(3, 3);
+ Common::Rect temp;
+ temp.top = this->arr_i16_1eb8[12];
+ temp.left = this->arr_i16_1eb8[13];
+ temp.bottom = this->arr_i16_1eb8[14];
+ temp.right = this->arr_i16_1eb8[15];
+ g_toolbox->FrameRect(temp);
+ g_toolbox->PenNormal();
+}
+
+void FoolGame::sub_133_12f2() {
+ // 133:12f2
+ this->var_i16_d0c = 1;
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[0x16];
+ this->var_i16_68a = this->arr_i16_1eb8[0x18];
+ this->var_i16_484++;
+
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_133_13e2() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_133_1452() {
+ warning("STUB: %s", __func__);
+}
+
+
+
+};
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index dcca37185bc..126b55c827a 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -791,19 +791,6 @@ void FoolPrologue::prologueRun() {
// 130:034a
for (int i = 0xd; i <= 0x12; i++) {
// priestess silhouette -> fool on the cliff.
- // Image two in this sequence is a PICT that draws the words
- // "...for no-one can undo the treachery I have inflicted upon the land!"
- // using the ShortLine opcode. Because the lines are drawn in white,
- // and the default background colour is white, this is an example of a PICT
- // that needs to be drawn to the target buffer with a mask.
-
- // FIXME: On original (slow) hardware, this image takes a while to render to the
- // screen with the line tool and gives a cool fade-in effect. It's unclear
- // what the best way to replicate that here would be, as we are drawing to
- // an offscreen buffer. Maybe we could add some generic way for the PICTDecoder
- // to run a callback between opcodes? That probably wouldn't help, given
- // the image is decoded to a surface at stream load time. Alternatively we could
- // dump the opcodes for just that picture and draw it ourselves.
this->prologueBufferNextPicture();
}
@@ -956,9 +943,21 @@ void FoolPrologue::prologueRun() {
// 130:083c
- // Draw the priestess silhouette + "treachery" message
+ // Draw the priestess silhouette
g_zbasic->picture(0, 0, this->arr_i32_0[0xd]);
+
+ // Image two in this sequence is a PICT that draws the words
+ // "...for no-one can undo the treachery I have inflicted upon the land!"
+ // using the ShortLine opcode to fill in random rows of pixels.
+ // Because the lines are drawn in white, and the default background colour
+ // is white, this is an example of a PICT that needs to be drawn to the
+ // target buffer live, or with a mask.
+ // On original (i.e. slow) hardware, this image takes a while to render to the
+ // screen with the line tool and gives a cool fade-in effect, which we
+ // simulate here.
+ this->arr_i32_0[0xe]->_opsPerTick = 32;
g_zbasic->picture(5, 0, this->arr_i32_0[0xe]);
+
g_toolbox->ReleaseResource(this->arr_i32_0[0xd]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xe]);
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index c317ae98ed2..1399dacaf24 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -19,8 +19,6 @@
*
*/
-#include "graphics/managed_surface.h"
-
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
@@ -32,13 +30,14 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// mask reveal puzzle
-void FoolGame::sub_134_004() {
+void FoolGame::revealRun() {
// 134:0004
this->sub_128_271a();
this->var_i16_c00 = 1;
this->arr_i16_1eb8[15] = this->puzzlesReadShort();
this->arr_i16_1eb8[16] = this->puzzlesReadShort();
this->arr_i16_1eb8[21] = this->puzzlesReadShort();
+ debugC(5, kDebugLoading, "%d, %d, %04x", this->arr_i16_1eb8[15], this->arr_i16_1eb8[16], this->arr_i16_1eb8[21]);
this->var_str_384 = this->puzzlesReadString();
this->var_str_384 = g_zbasic->str(213) + this->var_str_384 + g_zbasic->str(214);
g_zbasic->menu(8, 6, 1, this->var_str_384);
@@ -65,8 +64,8 @@ void FoolGame::sub_134_004() {
// 134:015c
}
g_toolbox->ClosePoly();
- if (this->arr_i16_1eb8[16] <= i) {
- this->arr_i16_1eb8[20] |= this->arr_i16_4738[i - 1];
+ if (i <= this->arr_i16_1eb8[16]) {
+ this->arr_i16_1eb8[20] |= this->bitLUT[i - 1];
}
// 134:01ce
}
@@ -108,8 +107,8 @@ void FoolGame::sub_134_004() {
);
g_toolbox->DrawString(this->var_str_384);
// 134:04d6
- if (this->arr_i16_1eb8[19] && this->arr_i16_4738[this->arr_i16_3738[i] - 1]) {
- this->sub_134_74a();
+ if (this->arr_i16_1eb8[19] & this->bitLUT[this->arr_i16_3738[i] - 1]) {
+ this->revealSelectButton();
}
}
// 134:0538
@@ -130,7 +129,7 @@ void FoolGame::sub_134_004() {
// 134:0582
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseDown) {
- this->sub_134_67c();
+ this->revealOnClick();
}
if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
this->var_i16_d0c = 1;
@@ -142,7 +141,7 @@ void FoolGame::sub_134_004() {
}
// 134:05e2
if (this->var_i16_7c6 == 2) {
- this->sub_134_7bc();
+ this->revealReset();
}
if (this->var_i16_7c6 == 4) {
this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
@@ -151,8 +150,8 @@ void FoolGame::sub_134_004() {
// 134:061e
}
// 134:0648
- if (this->var_i16_d0c == 0) {
- this->sub_134_872();
+ if (this->var_i16_d0c != 0) {
+ this->revealSuccess();
}
this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
@@ -161,7 +160,7 @@ void FoolGame::sub_134_004() {
}
}
-void FoolGame::sub_134_67c() {
+void FoolGame::revealOnClick() {
// 134:067c
this->var_i16_7be = 0;
for (int j = 1; j <= this->arr_i16_1eb8[15]; j++) {
@@ -175,26 +174,28 @@ void FoolGame::sub_134_67c() {
return;
}
// 134:06f4
- this->sub_134_74a();
- this->arr_i16_1eb8[19] ^= this->arr_i16_4738[this->arr_i16_3738[this->var_i16_7be]-1];
+ this->revealSelectButton();
+ this->arr_i16_1eb8[19] ^= this->bitLUT[this->arr_i16_3738[this->var_i16_7be]-1];
+ debugC(5, kDebugLoading, "reveal: %d, %04x, %04x", this->var_i16_7be, this->arr_i16_1eb8[19], this->arr_i16_1eb8[20]);
this->sub_128_6186();
}
-void FoolGame::sub_134_74a() {
+void FoolGame::revealSelectButton() {
// 134:074a
+ // invert the button
g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19);
g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[21]]);
+ // fill the polygon
g_toolbox->PenMode(kPatXor);
g_toolbox->PaintPoly(this->arr_poly_192c0[this->arr_i16_3738[this->var_i16_7be]]);
g_toolbox->PenNormal();
}
-void FoolGame::sub_134_7bc() {
+void FoolGame::revealReset() {
// 134:07bc
this->fillRect(0x37, 0x13, 0xff, 0x1ee, 0);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- this->var_i16_7be = 1;
- if (this->arr_i16_1eb8[19] & this->arr_i16_4738[this->arr_i16_3738[i]-1]) {
+ if (this->arr_i16_1eb8[19] & this->bitLUT[this->arr_i16_3738[i]-1]) {
g_toolbox->InvertRoundRect(this->arr_rect_1f38[i], 0x19, 0x19);
}
}
@@ -203,7 +204,7 @@ void FoolGame::sub_134_7bc() {
this->var_i16_7c6 = 0;
}
-void FoolGame::sub_134_872() {
+void FoolGame::revealSuccess() {
// 134:0872
if (this->var_i16_c04 < 0x64) {
this->var_i16_c04 = 0x64;
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 944103bdbdb..10956b4eb46 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -5,12 +5,14 @@ MODULE_OBJS = \
fool.o \
fool_game.o \
fool_jigsaw.o \
+ fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
toolbox.o \
toolbox_fileman.o \
toolbox_menu.o \
toolbox_quickdraw.o \
+ toolbox_pict.o \
toolbox_resman.o \
toolbox_sound.o \
toolbox_text.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index e79a3880d46..98eebada1d0 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -39,9 +39,47 @@
namespace Fool {
+struct RGBColor {
+ uint16 red;
+ uint16 green;
+ uint16 blue;
+};
+
+struct ColorSpec {
+ uint16 value;
+ RGBColor rgb;
+};
+
+struct ColorTable {
+ uint32 ctSeed;
+ uint16 ctFlags;
+ uint16 ctSize;
+ Common::Array<ColorSpec> ctTable;
+};
+
struct Region {
uint16 rgnSize;
Common::Rect rgnBBox;
+ Common::Array<int16> rgnData;
+};
+
+struct PixMap {
+ uint32 baseAddr;
+ uint16 rowBytes;
+ Common::Rect bounds;
+ uint16 pmVersion;
+ uint16 packType;
+ uint32 packSize;
+ uint32 hRes;
+ uint32 vRes;
+ uint16 pixelType;
+ uint16 pixelSize;
+ uint16 cmpCount;
+ uint16 cmpSize;
+ uint32 planeBytes;
+ uint32 pmTable;
+ uint32 pmReserved;
+ bool _isBitMap = false;
};
struct Polygon {
@@ -50,9 +88,133 @@ struct Polygon {
Common::Array<Common::Point> polyPoints;
};
+enum PictureOpType : uint16 {
+ kOpNOP = 0x0000,
+ kOpClip = 0x0001,
+ kOpBkPat = 0x0002,
+ kOpTxFont = 0x0003,
+ kOpTxFace = 0x0004,
+ kOpTxMode = 0x0005,
+ kOpSpExtra = 0x0006,
+ kOpPnSize = 0x0007,
+ kOpPnMode = 0x0008,
+ kOpPnPat = 0x0009,
+ kOpFillPat = 0x000a,
+ kOpOvSize = 0x000b,
+ kOpOrigin = 0x000c,
+ kOpTxSize = 0x000d,
+ kOpFgColor = 0x000e,
+ kOpBkColor = 0x000f,
+ kOpTxRatio = 0x0010,
+ kOpVersion2 = 0x0011,
+ kOpBkPixPat = 0x0012,
+ kOpPnPixPat = 0x0013,
+ kOpFillPixPat = 0x0014,
+ kOpPnLocHFrac = 0x0015,
+ kOpChExtra = 0x0016,
+ // reserved 0x0017
+ // reserved 0x0018
+ // reserved 0x0019
+ kOpRGBFgCol = 0x001a,
+ kOpRGBBkCol = 0x001b,
+ kOpHiliteMode = 0x001c,
+ kOpHiliteColor = 0x001d,
+ kOpDefHilite = 0x001e,
+ kOpColor = 0x001f,
+ kOpLine = 0x0020,
+ kOpLineFrom = 0x0021,
+ kOpShortLine = 0x0022,
+ kOpShortLineFrom = 0x0023,
+ // reserved 0x0024
+ // reserved 0x0025
+ // reserved 0x0026
+ // reserved 0x0027
+ kOpLongText = 0x0028,
+ kOpDHText = 0x0029,
+ kOpDVText = 0x002a,
+ kOpDHDVText = 0x002b,
+ kOpFontName = 0x002c,
+ kOpLineJustify = 0x002d,
+ kOpGlyphState = 0x002e,
+ // reserved 0x002f
+ kOpFrameRect = 0x0030,
+ kOpPaintRect = 0x0031,
+ kOpEraseRect = 0x0032,
+ kOpInvertRect = 0x0033,
+ kOpFillRect = 0x0034,
+ // reserved 0x0035
+ // reserved 0x0036
+ // reserved 0x0037
+ kOpFrameSameRect = 0x0038,
+ kOpPaintSameRect = 0x0039,
+ kOpEraseSameRect = 0x003a,
+ kOpInvertSameRect = 0x003b,
+ kOpFillSameRect = 0x003c,
+ // reserved 0x003d
+ // reserved 0x003e
+ // reserved 0x003f
+ kOpFrameRRect = 0x0040,
+ kOpPaintRRect = 0x0041,
+ kOpEraseRRect = 0x0042,
+ kOpInvertRRect = 0x0043,
+ kOpFillRRect = 0x0044,
+ // reserved 0x0045
+ // reserved 0x0046
+ // reserved 0x0047
+ kOpFrameSameRRect = 0x0048,
+ kOpPaintSameRRect = 0x0049,
+ kOpEraseSameRRect = 0x004a,
+ kOpInvertSameRRect = 0x004b,
+ kOpFillSameRRect = 0x004c,
+ // reserved 0x004d
+ // reserved 0x004e
+ // reserved 0x004f
+ kOpFrameOval = 0x0050,
+ kOpPaintOval = 0x0051,
+ kOpEraseOval = 0x0052,
+ kOpInvertOval = 0x0053,
+ kOpFillOval = 0x0054,
+ // reserved 0x0055
+ // reserved 0x0056
+ // reserved 0x0057
+ kOpFrameSameOval = 0x0058,
+ kOpPaintSameOval = 0x0059,
+ kOpEraseSameOval = 0x005a,
+ kOpInvertSameOval = 0x005b,
+ kOpFillSameOval = 0x005c,
+ // reserved 0x005d
+ // reserved 0x005e
+ // reserved 0x005f
+
+ kOpBitsRect = 0x0090,
+ kOpBitsRgn = 0x0091,
+
+ kOpPackBitsRect = 0x0098,
+ kOpPackBitsRgn = 0x0099,
+
+ kOpShortComment = 0x00a0,
+ kOpLongComment = 0x00a1,
+
+ kOpEndPic = 0x00ff,
+
+ kOpHeaderOp = 0x0c00,
+ kOpVersion1 = 0x1101,
+};
+
+struct Picture {
+ uint32 picSize = 0;
+ Common::Rect picFrame;
+ Common::Array<byte> picData;
+ size_t picPtr = 0;
+ // simulate slow drawing
+ uint32 _opsPerTick = 0;
+};
+
+
+
typedef Common::SharedPtr<Common::Array<byte>> Handle;
typedef Common::SharedPtr<Region> RgnHandle;
-typedef Common::SharedPtr<Image::PICTDecoder> PicHandle;
+typedef Common::SharedPtr<Picture> PicHandle;
// BitMap is the monochrome surface format.
typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
typedef Common::SharedPtr<Polygon> PolyHandle;
@@ -137,12 +299,6 @@ typedef uint32 OSType;
typedef uint16 OSErr;
typedef uint32 ProcPtr;
-struct RGBColor {
- uint16 red;
- uint16 green;
- uint16 blue;
-};
-
enum EventCode : uint16 {
kNullEvent = 0,
kMouseDown = 1,
@@ -591,9 +747,48 @@ public:
// onâremain in effect. ItemString may be blank but should not be the empty string.
void SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String &itemString);
+ // toolbox_pict.cpp
+
+ // PROCEDURE ClosePicture;
+ // The ClosePicture procedure stops collecting drawing commands and picture
+ // comments for the currently open picture. You should perform one and only one call to
+ // ClosePicture for every call to the OpenCPicture (or OpenPicture) function.
+ void ClosePicture();
+
+ // PROCEDURE DrawPicture (myPicture: PicHandle; dstRect: Rect);
+ // Within the rectangle that you specify in the dstRect parameter, the DrawPicture
+ // procedure draws the picture that you specify in the myPicture parameter.
+ void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
+
+ // FUNCTION GetPicture (picID: INTEGER) : PicHandle;
+ // GetPicture returns a handle to the picture having the given resource ID, reading it from the
+ // resource file if necessary. It calls the Resource Manager function GetResource('PICT',picID). If
+ // the resource can't be read, GetPicture returns NIL. The PicHandle data type is defined in
+ // QuickDraw.
+ PicHandle GetPicture(uint16 picID);
+
+ // PROCEDURE KillPicture(myPicture: PicHandle);
+ // The KillPicture procedure releases the memory occupied by the picture whose
+ // handle you pass in the myPicture parameter. Use this only when youâre completely
+ // finished with a picture.
+ void KillPicture(PicHandle &myPicture);
+
+ // FUNCTION OpenPicture (picFrame: Rect): PicHandle;
+ // OpenPicture returns a handle to a new picture that has the given rectangle as its picture frame, and
+ // tells QuickDraw to start saving as the picture definition all calls to drawing routines and all picture
+ // comments (if any).
+ PicHandle OpenPicture(const Common::Rect &picFame);
// toolbox_quickdraw.cpp
+ // PROCEDURE BackPat (pat: Pattern);
+ // The BackPat procedure sets the bit pattern defined in the Pattern record, which you
+ // specify in the pat parameter, to be the background pattern. (The standard bit patterns
+ // white, black, gray, ltGray, and dkGray are predefined; the initial background
+ // pattern for the graphics port is white.) This pattern is stored in the bkPat field of a
+ // GrafPort record.
+ void BackPat(const Pattern &pat);
+
// PROCEDURE BeginUpdate (theWindow: WindowPtr);
// Call BeginUpdate when an update event occurs for theWindow. BeginUpdate replaces the
// visRgn of the window's grafPort with the intersection of the visRgn and the update region and
@@ -626,11 +821,6 @@ public:
// srcBits.bounds coordinates.
void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
- // PROCEDURE DrawPicture (myPicture: PicHandle; dstRect: Rect);
- // Within the rectangle that you specify in the dstRect parameter, the DrawPicture
- // procedure draws the picture that you specify in the myPicture parameter.
- void DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect);
-
// PROCEDURE ErasePoly (poly: PolyHandle);
// Using the patCopy pattern mode, the ErasePoly procedure draws the interior of the
// polygon whose handle you pass in the poly parameter with the background pattern for
@@ -733,13 +923,6 @@ public:
// graphics port, followed by SetPort(savePort) to restore the previous port.
void GetPort(GrafPtr &port);
- // FUNCTION GetPicture (picID: INTEGER) : PicHandle;
- // GetPicture returns a handle to the picture having the given resource ID, reading it from the
- // resource file if necessary. It calls the Resource Manager function GetResource('PICT',picID). If
- // the resource can't be read, GetPicture returns NIL. The PicHandle data type is defined in
- // QuickDraw.
- PicHandle GetPicture(uint16 picID);
-
// PROCEDURE GlobalToLocal (VAR pt: Point);
// GlobalToLocal takes a point expressed in global coordinates (with the top left corner of the bit
// image as coordinate (0,0)) and converts it into the local coordinates of the current grafPort. The
@@ -923,6 +1106,14 @@ public:
void SetCursor(const Common::SharedPtr<Cursor> &crsr);
+ // PROCEDURE SetOrigin(h, v: Integer);
+ // The SetOrigin procedure changes the coordinates of the upper-left corner of the
+ // current graphics portâs port rectangle to the values supplied by the h and v parameters.
+ // All other points in the current graphics portâs local coordinate system are calculated from
+ // this point. All subsequent drawing and calculation routines use the new coordinate
+ // system.
+ void SetOrigin(uint16 h, uint16 v);
+
// PROCEDURE SetPort (port: GrafPtr);
// SetPort makes the specified grafPort the current port.
void SetPort(GrafPtr port);
@@ -1016,6 +1207,7 @@ private:
void _drawPoly(const PolyHandle &p, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight);
+ void _drawPackBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
};
diff --git a/engines/fool/toolbox_pict.cpp b/engines/fool/toolbox_pict.cpp
new file mode 100644
index 00000000000..158e1f6869a
--- /dev/null
+++ b/engines/fool/toolbox_pict.cpp
@@ -0,0 +1,637 @@
+/* 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/debug.h"
+#include "common/memstream.h"
+#include "common/scummsys.h"
+#include "common/str-enc.h"
+#include "common/stream.h"
+#include "common/system.h"
+
+#include "fool/detection.h"
+#include "graphics/cursor.h"
+#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/managed_surface.h"
+#include "graphics/pixelformat.h"
+#include "image/pict.h"
+
+#include "fool/fool.h"
+#include "fool/toolbox.h"
+#include "fool/utils.h"
+
+namespace Fool {
+
+void Toolbox::ClosePicture() {
+ ShowPen();
+ if (_port) {
+ if (!_port->picSave) {
+ warning("Toolbox::ClosePicture: picture not open");
+ return;
+ }
+ _port->picSave = nullptr;
+ }
+}
+
+Common::Rect readRect(Common::SeekableReadStream &stream) {
+ Common::Rect result;
+ result.top = stream.readSint16BE();
+ result.left = stream.readSint16BE();
+ result.bottom = stream.readSint16BE();
+ result.right = stream.readSint16BE();
+ return result;
+}
+
+Common::Point readPoint(Common::SeekableReadStream &stream) {
+ Common::Point result;
+ result.y = stream.readSint16BE();
+ result.x = stream.readSint16BE();
+ return result;
+}
+
+Polygon readPolygon(Common::SeekableReadStream &stream) {
+ Polygon result;
+ result.polySize = stream.readUint16BE();
+ result.polyBBox = readRect(stream);
+ for (int i = 0; i < result.polySize - 10; i++) {
+ result.polyPoints.push_back(readPoint(stream));
+ }
+ return result;
+}
+
+Region readRegion(Common::SeekableReadStream &stream) {
+ Region region;
+ region.rgnSize = stream.readUint16BE();
+ if (debugChannelSet(8, kDebugGraphics)) {
+ debugC(8, kDebugGraphics, "readRegion: region data");
+ stream.hexdump(region.rgnSize - 2);
+ }
+ if (stream.size() - stream.pos() < region.rgnSize - 2) {
+ warning("readRegion: not enough data to match size");
+ }
+ region.rgnBBox = readRect(stream);
+ for (int i = 10; i < region.rgnSize; i+=2) {
+ region.rgnData.push_back(stream.readSint16BE());
+ }
+ return region;
+}
+
+Pattern readPattern(Common::SeekableReadStream &stream) {
+ Pattern result;
+ for (int i = 0; i < 8; i++) {
+ result.data[i] = stream.readByte();
+ }
+ return result;
+}
+
+PixMap readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr) {
+ PixMap pixMap;
+ if (hasBaseAddr) {
+ pixMap.baseAddr = stream.readUint32BE();
+ }
+ uint16 rowBytes = stream.readUint16BE();
+ pixMap.rowBytes = rowBytes & 0x3fff;
+ pixMap._isBitMap = !(rowBytes & 0x8000);
+ pixMap.bounds = readRect(stream);
+ if (!pixMap._isBitMap) {
+ pixMap.pmVersion = stream.readUint16BE();
+ pixMap.packType = stream.readUint16BE();
+ pixMap.packSize = stream.readUint32BE();
+ pixMap.hRes = stream.readUint32BE();
+ pixMap.vRes = stream.readUint32BE();
+ pixMap.pixelType = stream.readUint16BE();
+ pixMap.pixelSize = stream.readUint16BE();
+ pixMap.cmpCount = stream.readUint16BE();
+ pixMap.cmpSize = stream.readUint16BE();
+ pixMap.planeBytes = stream.readUint32BE();
+ pixMap.pmTable = stream.readUint32BE();
+ pixMap.pmReserved = stream.readUint32BE();
+ }
+ return pixMap;
+}
+
+BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool compressed) {
+ BitMap result(new Graphics::ManagedSurface());
+ result->create(pixMap.bounds.width(), pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
+
+ Common::Rect outputRect = result->getBounds();
+
+ if (!compressed) {
+ Common::BitStream8MSB bs(stream);
+ // rows are word-aligned
+ int overflowBits = (pixMap.bounds.width() % 16 == 0) ? 0 : (16 - (pixMap.bounds.width() % 16));
+ debugC(5, kDebugLevelGGraphics, "readBitsRectMono: width %d, overflow %d", pixMap.bounds.width(), overflowBits);
+
+ for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
+ int yPos = y - pixMap.bounds.top;
+
+ for (int x = pixMap.bounds.left; x < pixMap.bounds.right; x++) {
+ int xPos = x - pixMap.bounds.left;
+
+ uint bit = bs.getBit();
+ if (outputRect.contains(xPos, yPos)) {
+ result->setPixel(xPos, yPos, bit);
+ }
+ }
+ bs.skip(overflowBits);
+ }
+
+ return result;
+ }
+
+ for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
+ int yPos = y - pixMap.bounds.top;
+ int x = 0;
+
+ byte rowBytes = stream.readByte();
+ byte readBytes = 0;
+
+ while (readBytes < rowBytes) {
+ byte rowBuf[128];
+ byte bufLen;
+
+ byte value = stream.readByte();
+ readBytes++;
+
+ if (value >= 128) {
+ bufLen = (256 - value) + 1;
+ byte repeatValue = stream.readByte();
+ memset(rowBuf, repeatValue, bufLen);
+ readBytes++;
+ } else {
+ bufLen = value + 1;
+ stream.read(rowBuf, bufLen);
+ readBytes += bufLen;
+ }
+
+ Common::MemoryReadStream ms(rowBuf, bufLen);
+ Common::BitStream8MSB bs(ms);
+
+ for (int i = 0; i < 8 * bufLen; i++) {
+ int xPos = x;
+
+ uint bit = bs.getBit();
+
+ if (outputRect.contains(xPos, yPos)) {
+ result->setPixel(xPos, yPos, bit);
+ }
+
+ x++;
+ }
+ }
+ }
+ return result;
+}
+
+void Toolbox::_drawPackBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame) {
+ PixMap pixMap = readPixMap(stream, false);
+
+ // these rectangles are using the pixmap coordinate system
+ Common::Rect srcRect = readRect(stream);
+ Common::Rect dstRect = readRect(stream);
+
+ SourceMode mode = (SourceMode)stream.readUint16BE();
+ pixMap.bounds.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: bounds");
+ srcRect.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: srcRect");
+ dstRect.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: dstRect");
+ picFrame.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: picFrame");
+
+ if (pixMap._isBitMap) {
+ BitMap result = readBitsRectMono(stream, pixMap, true);
+
+ const BitMap intermediate(createRemappedSurface(result->surfacePtr(), nullptr, 0));
+ // source rect needs to be in bitmap coordinates
+ srcRect.translate(-pixMap.bounds.left, -pixMap.bounds.top);
+
+ // dest rect needs to be in graphics port coordinates
+ dstRect.translate(-picFrame.left, -picFrame.top);
+ byte fakePal[768];
+ Common::fill(fakePal, fakePal+3, 0xff);
+ Common::fill(fakePal+3, fakePal+768, 0x00);
+ result->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 128, fakePal);
+ CopyBits(intermediate, _port->portBits, srcRect, dstRect, mode, nullptr);
+ } else {
+ warning("Toolbox::_drawPackBitsRect: PixMaps unsupported");
+ }
+}
+
+
+void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
+ if (!_port) {
+ warning("Toolbox::DrawPicture: no graphics port");
+ return;
+ }
+
+ if (!myPicture) {
+ warning("Toolbox::DrawPicture: handle is empty");
+ return;
+ }
+
+ if ((dstRect.width() != myPicture->picFrame.width()) ||
+ (dstRect.height() != myPicture->picFrame.height())) {
+ warning("Toolbox::DrawPicture: mismatched dimensions not supported");
+ }
+
+ if (myPicture->picData.size() < 2) {
+ warning("Toolbox::DrawPicture: no image data!");
+ return;
+ }
+
+ Common::MemoryReadStream stream(myPicture->picData.data(), myPicture->picData.size(), DisposeAfterUse::NO);
+
+ if (debugChannelSet(8, kDebugGraphics)) {
+ debugC(8, kDebugGraphics, "Toolbox::DrawPicture: image contents");
+ stream.hexdump(stream.size());
+ }
+
+
+ uint16 version = stream.readUint16BE();
+ if ((version != kOpVersion1) && (version != kOpVersion2)) {
+ warning("Toolbox::DrawPicture: cannot find PICT version opcode");
+ return;
+ }
+
+ if (version == kOpVersion2) {
+ uint16 header = stream.readUint16BE();
+ if (header != kOpHeaderOp) {
+ warning("Toolbox::DrawPicture: cannot find PICT header opcode");
+ return;
+ }
+ // we don't use the header yet
+ stream.skip(24);
+ }
+
+ GrafPtr origState = _port;
+ GrafPort temp;
+ OpenPort(&temp);
+ temp.portBits = origState->portBits;
+ temp.portRect = dstRect;
+
+ Common::Point ovSize;
+ Common::Rect lastRect;
+ int count = 0;
+
+ bool endPic = false;
+
+ while (!stream.eos() && !endPic) {
+ size_t pos = stream.pos();
+ uint16 op;
+ if (version == kOpVersion2)
+ op = stream.readUint16BE();
+ else
+ op = stream.readByte();
+
+ debugC(5, kDebugGraphics, "Toolbox::DrawPicture: [%04x] opcode %04x", (uint32_t)pos, op);
+
+ switch (op) {
+ case kOpNOP:
+ break;
+ case kOpClip:
+ warning("STUB: Toolbox::DrawPicture: clip");
+ readRegion(stream);
+ break;
+ case kOpBkPat:
+ BackPat(readPattern(stream));
+ break;
+ case kOpTxFont:
+ TextFont(stream.readUint16BE());
+ break;
+ case kOpTxFace:
+ TextFont(stream.readByte());
+ break;
+ case kOpTxMode:
+ TextMode((SourceMode)stream.readUint16BE());
+ break;
+ case kOpSpExtra:
+ warning("STUB: Toolbox::DrawPicture: spExtra");
+ stream.skip(4);
+ break;
+ case kOpPnSize:
+ {
+ int16 width = stream.readSint16BE();
+ int16 height = stream.readSint16BE();
+ PenSize(width, height);
+ }
+ break;
+ case kOpPnMode:
+ PenMode((PatternMode)stream.readUint16BE());
+ break;
+ case kOpPnPat:
+ PenPat(readPattern(stream));
+ break;
+ case kOpFillPat:
+ _port->fillPat = readPattern(stream);
+ break;
+ case kOpOvSize:
+ ovSize = readPoint(stream);
+ break;
+ case kOpOrigin:
+ {
+ Common::Point loc = readPoint(stream);
+ SetOrigin(loc.x, loc.y);
+ }
+ break;
+ case kOpTxSize:
+ TextSize(stream.readUint16BE());
+ break;
+ case kOpFgColor:
+ _port->fgColor = stream.readUint32BE();
+ break;
+ case kOpBkColor:
+ _port->bkColor = stream.readUint32BE();
+ break;
+ case kOpTxRatio:
+ warning("STUB: Toolbox::DrawPicture: txRatio");
+ readPoint(stream);
+ readPoint(stream);
+ break;
+ case kOpVersion2:
+ break;
+ case kOpBkPixPat:
+ warning("STUB: Toolbox::DrawPicture: bkPixPat (struct unsupported)");
+ break;
+ case kOpPnPixPat:
+ warning("STUB: Toolbox::DrawPicture: pnPixPat (struct unsupported)");
+ break;
+ case kOpFillPixPat:
+ warning("STUB: Toolbox::DrawPicture: fillPixPat (struct unsupported)");
+ break;
+ case kOpPnLocHFrac:
+ warning("STUB: Toolbox::DrawPicture: pnLocHFrac");
+ stream.skip(2);
+ break;
+ case kOpChExtra:
+ warning("STUB: Toolbox::DrawPicture: chExtra");
+ stream.skip(2);
+ break;
+ case kOpRGBFgCol:
+ warning("STUB: Toolbox::DrawPicture: rgbFgCol");
+ stream.skip(6);
+ break;
+ case kOpRGBBkCol:
+ warning("STUB: Toolbox::DrawPicture: rgbBkCol");
+ stream.skip(6);
+ break;
+ case kOpHiliteMode:
+ warning("STUB: Toolbox::DrawPicture: hiliteMode");
+ break;
+ case kOpHiliteColor:
+ warning("STUB: Toolbox::DrawPicture: hiliteColor");
+ stream.skip(6);
+ break;
+ case kOpDefHilite:
+ warning("STUB: Toolbox::DrawPicture: defHilite");
+ break;
+ case kOpColor:
+ warning("STUB: Toolbox::DrawPicture: color");
+ stream.skip(6);
+ break;
+ case kOpLine:
+ {
+ Common::Point pnLoc = readPoint(stream);
+ Common::Point newPt = readPoint(stream);
+ MoveTo(pnLoc.x, pnLoc.y);
+ LineTo(newPt.x, newPt.y);
+ }
+ break;
+ case kOpLineFrom:
+ {
+ Common::Point newPt = readPoint(stream);
+ LineTo(newPt.x, newPt.y);
+ }
+ break;
+ case kOpShortLine:
+ {
+ Common::Point pnLoc = readPoint(stream);
+ int8 dh = stream.readSByte();
+ int8 dv = stream.readSByte();
+ MoveTo(pnLoc.x, pnLoc.y);
+ Line(dh, dv);
+ }
+ break;
+ case kOpShortLineFrom:
+ {
+ int8 dh = stream.readSByte();
+ int8 dv = stream.readSByte();
+ Line(dh, dv);
+ }
+ break;
+ case kOpLongText:
+ {
+ Common::Point txLoc = readPoint(stream);
+ Common::String text = stream.readPascalString(false);
+ MoveTo(txLoc.x, txLoc.y);
+ DrawString(text.decode(Common::kMacRoman));
+ }
+ break;
+ case kOpDHText:
+ {
+ Common::Point txLoc = _port->pnLoc;
+ txLoc.x += stream.readSByte();
+ Common::String text = stream.readPascalString(false);
+ MoveTo(txLoc.x, txLoc.y);
+ DrawString(text.decode(Common::kMacRoman));
+ }
+ break;
+ case kOpDVText:
+ {
+ Common::Point txLoc = _port->pnLoc;
+ txLoc.y += stream.readSByte();
+ Common::String text = stream.readPascalString(false);
+ MoveTo(txLoc.x, txLoc.y);
+ DrawString(text.decode(Common::kMacRoman));
+ }
+ break;
+ case kOpDHDVText:
+ {
+ Common::Point txLoc = _port->pnLoc;
+ txLoc.x += stream.readSByte();
+ txLoc.y += stream.readSByte();
+ Common::String text = stream.readPascalString(false);
+ MoveTo(txLoc.x, txLoc.y);
+ DrawString(text.decode(Common::kMacRoman));
+ }
+ break;
+ case kOpFontName:
+ warning("STUB: Toolbox::DrawPicture: fontName");
+ stream.skip(5);
+ stream.readPascalString(false);
+ break;
+
+ case kOpFrameRect:
+ lastRect = readRect(stream);
+ FrameRect(lastRect);
+ break;
+ case kOpPaintRect:
+ lastRect = readRect(stream);
+ PaintRect(lastRect);
+ break;
+ case kOpEraseRect:
+ lastRect = readRect(stream);
+ EraseRect(lastRect);
+ break;
+ case kOpInvertRect:
+ lastRect = readRect(stream);
+ InvertRect(lastRect);
+ break;
+ case kOpFillRect:
+ lastRect = readRect(stream);
+ FillRect(lastRect, _port->fillPat);
+ break;
+ case kOpFrameSameRect:
+ FrameRect(lastRect);
+ break;
+ case kOpPaintSameRect:
+ PaintRect(lastRect);
+ break;
+ case kOpEraseSameRect:
+ EraseRect(lastRect);
+ break;
+ case kOpInvertSameRect:
+ InvertRect(lastRect);
+ break;
+ case kOpFillSameRect:
+ FillRect(lastRect, _port->fillPat);
+ break;
+
+ case kOpFrameRRect:
+ lastRect = readRect(stream);
+ FrameRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpPaintRRect:
+ lastRect = readRect(stream);
+ PaintRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpEraseRRect:
+ lastRect = readRect(stream);
+ EraseRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpInvertRRect:
+ lastRect = readRect(stream);
+ InvertRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpFillRRect:
+ lastRect = readRect(stream);
+ FillRoundRect(lastRect, ovSize.x, ovSize.y, _port->fillPat);
+ break;
+ case kOpFrameSameRRect:
+ FrameRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpPaintSameRRect:
+ PaintRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpEraseSameRRect:
+ EraseRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpInvertSameRRect:
+ InvertRoundRect(lastRect, ovSize.x, ovSize.y);
+ break;
+ case kOpFillSameRRect:
+ FillRoundRect(lastRect, ovSize.x, ovSize.y, _port->fillPat);
+ break;
+
+ case kOpBitsRect:
+ warning("STUB: Toolbox::DrawPicture: bitsRect, aborting");
+ endPic = true;
+ break;
+ case kOpBitsRgn:
+ warning("STUB: Toolbox::DrawPicture: bitsRgn, aborting");
+ endPic = true;
+ break;
+
+ case kOpPackBitsRect:
+ _drawPackBitsRect(stream, myPicture->picFrame);
+ break;
+ case kOpPackBitsRgn:
+ warning("STUB: Toolbox::DrawPicture: packBitsRgn, aborting");
+ endPic = true;
+ break;
+
+
+ case kOpShortComment:
+ //warning("STUB: Toolbox::DrawPicture: shortComment");
+ stream.readUint16BE();
+ break;
+ case kOpLongComment:
+ {
+ //warning("STUB: Toolbox::DrawPicture: longComment");
+ stream.readUint16BE();
+ int size = stream.readUint16BE();
+ stream.skip(size);
+ }
+ break;
+
+ case kOpEndPic:
+ endPic = true;
+ break;
+
+ default:
+ warning("Toolbox::DrawPicture: unsupported opcode %04x", op);
+ }
+ // if version 2, align to nearest word
+ if (version == kOpVersion2)
+ stream.skip(stream.pos() % 2);
+
+ count++;
+ if (myPicture->_opsPerTick && (count % myPicture->_opsPerTick == 0)) {
+ Delay(0);
+ }
+ }
+ _port = origState;
+}
+
+PicHandle Toolbox::GetPicture(uint16 picID) {
+ Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
+ PicHandle result;
+ if (handle) {
+ Common::MemoryReadStream stream(handle->data(), handle->size(), DisposeAfterUse::NO);
+ result = PicHandle(new Picture);
+ result->picSize = stream.readUint16BE();
+ result->picFrame = readRect(stream);
+ while (!stream.eos()) {
+ result->picData.push_back(stream.readByte());
+ }
+ _resPicts[result] = handle;
+ }
+
+ return result;
+}
+
+void Toolbox::KillPicture(PicHandle &myPicture) {
+ myPicture = nullptr;
+}
+
+
+PicHandle Toolbox::OpenPicture(const Common::Rect &picFrame) {
+ PicHandle result(new Picture);
+ result->picFrame = picFrame;
+ if (_port) {
+ if (_port->picSave) {
+ warning("Toolbox::OpenPicture: last picture not closed, overwriting");
+ }
+ _port->picSave = result;
+ }
+ HidePen();
+ return result;
+}
+
+
+
+} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 70665fb89db..52aa73471bf 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -35,6 +35,12 @@
namespace Fool {
+void Toolbox::BackPat(const Pattern &pat) {
+ if (_port) {
+ _port->bkPat = pat;
+ }
+}
+
void Toolbox::BeginUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::BeginUpdate");
}
@@ -55,8 +61,8 @@ void Toolbox::ClosePoly() {
for (size_t i = 2; i < _port->polySave->polyPoints.size(); i++) {
_port->polySave->polyBBox.extend(_port->polySave->polyPoints[i]);
}
- _port->polySave->polySize = _port->polySave->polyPoints.size();
}
+ _port->polySave->polySize = _port->polySave->polyPoints.size()*2 + 10;
_port->polySave = nullptr;
}
}
@@ -90,6 +96,10 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
}
Common::Rect clipSrcRect = srcRect;
Common::Rect clipDstRect = dstRect;
+
+ // destination rectangle should be moved relative to port origin
+ clipDstRect.translate(_port->portRect.left, _port->portRect.top);
+
// the source rectangle can include areas out of bounds, crop it
clipSrcRect.clip(srcBits->getBounds());
@@ -128,16 +138,6 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
}
}
-void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
- const Graphics::Surface *surface = myPicture->getSurface();
- const Graphics::Palette &palette = myPicture->getPalette();
- //const BitMap mask(nullptr);
- const BitMap mask(new Graphics::ManagedSurface());
- mask->copyFrom(*myPicture->getMask());
- const BitMap intermediate(createRemappedSurface(surface, palette.data(), palette.size()));
- _copyBits(intermediate, mask, _port->portBits, intermediate->getBounds(), dstRect, kSrcCopy, nullptr);
-}
-
// maybe the better way of refactoring this would be to fork the Primitives
// object from MacWindowManager and make one that uses GrafPort as a state store?
// as it stands, all the operations fall back to calling DrawPoint over and over again,
@@ -285,6 +285,10 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
}
void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight) {
+ if (!r.isValidRect()) {
+ warning("Toolbox::_drawRoundRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
+ return;
+ }
if (_port && _port->pnVis == 0) {
BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
@@ -320,18 +324,21 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
void Toolbox::FillPoly(PolyHandle &poly, const Pattern &pat) {
if (_port) {
+ _port->fillPat = pat;
_drawPoly(poly, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
}
}
void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
if (_port) {
+ _port->fillPat = pat;
_drawRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
}
}
void Toolbox::FillRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight, const Pattern &pat) {
if (_port) {
+ _port->fillPat = pat;
_drawRoundRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
}
}
@@ -393,22 +400,6 @@ Handle Toolbox::GetIcon(uint16 iconID) {
return nullptr;
}
-PicHandle Toolbox::GetPicture(uint16 picID) {
- Handle handle = this->GetResource(MKTAG('P', 'I', 'C', 'T'), picID);
- if (handle) {
- Common::MemoryReadStream stream(handle->data(), handle->size());
- PicHandle decoder(new Image::PICTDecoder());
- if (decoder->loadStream(stream)) {
- _resPicts[decoder] = handle;
- return decoder;
- } else {
- warning("Toolbox::GetPicture: failed to load PICT id %d", picID);
- }
- }
-
- return nullptr;
-}
-
void Toolbox::GetPort(GrafPtr &port) {
port = _port;
}
@@ -483,7 +474,7 @@ void Toolbox::KillPoly(PolyHandle &poly) {
void Toolbox::Line(int16 dh, int16 dv) {
if (_port) {
- LineTo(_port->pnLoc.x + dh, _port->pnLoc.x + dv);
+ LineTo(_port->pnLoc.x + dh, _port->pnLoc.y + dv);
}
}
@@ -497,6 +488,10 @@ void Toolbox::LineTo(int16 h, int16 v) {
BitMap intermediate(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
BitMap mask(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
Common::Point destPos(dirVec.x < 0 ? h + dirVec.x : h - dirVec.x, dirVec.y < 0 ? v + dirVec.y : v - dirVec.y);
+ // move to port coordinate space
+ destPos.x += _port->portRect.left;
+ destPos.y += _port->portRect.top;
+
Graphics::MacPatterns macpat({_port->pnPat.data});
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
@@ -511,7 +506,7 @@ void Toolbox::LineTo(int16 h, int16 v) {
}
if (_port) {
- // update polygon if we're in ypenPoly mode
+ // update polygon if we're in openPoly mode
if (_port->polySave) {
if (_port->polySave->polyPoints.size() == 0) {
_port->polySave->polyPoints.push_back(_port->pnLoc);
@@ -636,6 +631,13 @@ void Toolbox::SetCursor(const Common::SharedPtr<Cursor> &crsr) {
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, crsr.get());
}
+void Toolbox::SetOrigin(uint16 h, uint16 v) {
+ if (_port) {
+ _port->portRect.left = h;
+ _port->portRect.top = v;
+ }
+}
+
void Toolbox::SetPort(GrafPtr port) {
_port = port;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 4d879f2fb7e..231a9e34d58 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -386,7 +386,7 @@ void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
return;
}
- Common::Rect destRect(x, y, x+src->getSurface()->w, y+src->getSurface()->h);
+ Common::Rect destRect(x, y, x+src->picFrame.width(), y+src->picFrame.height());
_toolbox->DrawPicture(src, destRect);
//Common::Rect badnews = src->getBounds();
Commit: 69631cde63f41f1560a5a59d349153620e59dea1
https://github.com/scummvm/scummvm/commit/69631cde63f41f1560a5a59d349153620e59dea1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:06+02:00
Commit Message:
FOOL: More PICT drawing pipeline
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_polyomino.cpp
engines/fool/toolbox.h
engines/fool/toolbox_pict.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_text.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 37f2fc045ae..659d3082437 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1601,7 +1601,7 @@ void FoolGame::sub_128_39a0() {
this->sub_132_004();
break;
case 6:
- this->sub_133_004();
+ this->polyominoRun();
break;
case 7:
this->revealRun();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 8cceef071a0..e1ad71b0bba 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -142,8 +142,8 @@ public:
void sub_132_1444();
// fool_polyomino.cpp
- void sub_133_004();
- void sub_133_87c();
+ void polyominoRun(); // sub_133_004
+ void polyominoOnClick(); // sub_133_87c
void sub_133_eb2();
void sub_133_f04();
void sub_133_10a0();
@@ -151,7 +151,7 @@ public:
void sub_133_12d4();
void sub_133_12f2();
void sub_133_13e2();
- void sub_133_1452();
+ void polyominoStoreState(); // sub_133_1452
// fool_reveal.cpp
void revealRun(); // sub_134_004
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 905992bb200..1d13b904239 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -32,7 +32,7 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// polyomino puzzle
-void FoolGame::sub_133_004() {
+void FoolGame::polyominoRun() {
// 133:0004
this->sub_128_271a();
this->var_i16_c00 = 1;
@@ -156,7 +156,7 @@ void FoolGame::sub_133_004() {
g_toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
for (int i = 1; i <= this->var_i16_103a; i += 3) {
g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
- this->var_str_384 = g_zbasic->str(this->arr_i16_3738[i+2]);
+ this->var_str_384 = g_zbasic->chr(this->arr_i16_3738[i+2]);
g_toolbox->DrawString(this->var_str_384);
}
}
@@ -188,9 +188,9 @@ void FoolGame::sub_133_004() {
// 133:073c
this->sub_128_bde(1, this->arr_i16_1eb8[0xf], 0, 1, 1, 1);
this->var_i16_1ab0 = 0;
- for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
- this->var_i16_68a = this->arr_i16_47d8[i*8 + 3];
- this->var_i16_68c = this->arr_i16_47d8[i*8 + 4];
+ for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
+ this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
+ this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
this->sub_133_f04();
}
this->var_i16_1ab0 = 1;
@@ -201,7 +201,7 @@ void FoolGame::sub_133_004() {
do {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
- this->sub_133_87c();
+ this->polyominoOnClick();
}
// yield to renderer
if (this->var_ev_46.what == kNullEvent) {
@@ -214,7 +214,7 @@ void FoolGame::sub_133_004() {
this->sub_133_11cc();
}
if (this->var_i16_7c6 == 4) {
- this->sub_133_1452();
+ this->polyominoStoreState();
this->sub_128_3536();
}
} while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0));
@@ -222,9 +222,10 @@ void FoolGame::sub_133_004() {
if (this->var_i16_d0c != 0) {
this->sub_133_13e2();
}
- this->sub_133_1452();
+ this->polyominoStoreState();
//133:0878: JMP - [0x1502]
+ // exiting game, delete picture handles
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
for (int i = 0; i <= 2; i++) {
g_toolbox->KillPicture(this->arr_pic_49d8[j*4 + i]);
@@ -232,7 +233,7 @@ void FoolGame::sub_133_004() {
}
}
-void FoolGame::sub_133_87c() {
+void FoolGame::polyominoOnClick() {
// 133:087c
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
@@ -296,6 +297,11 @@ void FoolGame::sub_133_87c() {
// 133:0cc8
this->var_i16_1ab6 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
this->var_i16_1ab8 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+
+ // yield to renderer
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
}
// 133:0d78
if (this->var_ev_46.what != 2) {
@@ -306,11 +312,6 @@ void FoolGame::sub_133_87c() {
}
// 133:0de0
- // yield to renderer
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
-
}
// 133:0dea
this->var_i16_106a = 0;
@@ -399,8 +400,7 @@ void FoolGame::sub_133_11cc() {
// 133:122e
this->fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_1eb8[0xf]);
this->var_i16_1ab0 = 0;
- this->var_i16_7cc = 1;
- for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
+ for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 5];
this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 6];
this->sub_133_f04();
@@ -428,19 +428,43 @@ void FoolGame::sub_133_12f2() {
// 133:12f2
this->var_i16_d0c = 1;
this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[0x16];
- this->var_i16_68a = this->arr_i16_1eb8[0x18];
- this->var_i16_484++;
-
- warning("STUB: %s", __func__);
+ for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
+ for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
+ this->var_i16_484++;
+ if (this->arr_i16_2f38[i*32 + j] != this->arr_i16_4338[this->var_i16_484]) {
+ // 133:1368
+ this->var_i16_d0c = 0;
+ j = this->arr_i16_1eb8[0x17];
+ i = this->arr_i16_1eb8[0x19];
+ }
+ // 133:1396
+ }
+ }
+ // 133:13ce
+ if (this->var_i16_d0c != 0) {
+ this->var_i16_7c6 = 1;
+ }
}
void FoolGame::sub_133_13e2() {
- warning("STUB: %s", __func__);
+ // 133:13e2
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ }
+ this->sub_128_2664();
+ this->sub_128_6186();
+ this->sub_128_d34(this->arr_i16_1eb8[0x12], this->arr_i16_1eb8[0x13], this->arr_i16_1eb8[0x14], this->arr_i16_1eb8[0x15], 0x96);
}
-void FoolGame::sub_133_1452() {
- warning("STUB: %s", __func__);
+void FoolGame::polyominoStoreState() {
+ // 133:1452
+ this->var_str_c06 = g_zbasic->str(212); // empty
+ this->var_i16_68a = 1;
+ for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
+ this->var_str_384 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 3]);
+ this->var_str_9f4 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 4]);
+ this->var_str_c06 = this->var_str_c06 + this->var_str_384 + this->var_str_9f4;
+ }
}
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 98eebada1d0..45e632dd66b 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -88,6 +88,15 @@ struct Polygon {
Common::Array<Common::Point> polyPoints;
};
+// In QuickDraw 0 means white and 1 means black
+struct Pattern {
+ uint8 data[8];
+
+ Common::String format() const {
+ return Common::String::format("%02x%02x%02x%02x%02x%02x%02x%02x", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
+ }
+};
+
enum PictureOpType : uint16 {
kOpNOP = 0x0000,
kOpClip = 0x0001,
@@ -186,6 +195,23 @@ enum PictureOpType : uint16 {
// reserved 0x005e
// reserved 0x005f
+ kOpFramePoly = 0x0070,
+ kOpPaintPoly = 0x0071,
+ kOpErasePoly = 0x0072,
+ kOpInvertPoly = 0x0073,
+ kOpFillPoly = 0x0074,
+ // reserved 0x0075
+ // reserved 0x0076
+ // reserved 0x0077
+ kOpFrameSamePoly = 0x0078,
+ kOpPaintSamePoly = 0x0079,
+ kOpEraseSamePoly = 0x007a,
+ kOpInvertSamePoly = 0x007b,
+ kOpFillSamePoly = 0x007c,
+ // reserved 0x007d
+ // reserved 0x007e
+ // reserved 0x007f
+
kOpBitsRect = 0x0090,
kOpBitsRgn = 0x0091,
@@ -201,6 +227,12 @@ enum PictureOpType : uint16 {
kOpVersion1 = 0x1101,
};
+// BitMap is the monochrome surface format.
+typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
+typedef Common::SharedPtr<Polygon> PolyHandle;
+typedef Common::SharedPtr<Common::Array<byte>> Handle;
+typedef Common::SharedPtr<Region> RgnHandle;
+
struct Picture {
uint32 picSize = 0;
Common::Rect picFrame;
@@ -208,16 +240,30 @@ struct Picture {
size_t picPtr = 0;
// simulate slow drawing
uint32 _opsPerTick = 0;
-};
+ void pushOp(PictureOpType op) {
+ picData.push_back(op >> 8);
+ picData.push_back(op & 0xff);
+ }
+
+ void pushOpU16(PictureOpType op, uint16 val) {
+ picData.push_back(op >> 8);
+ picData.push_back(op & 0xff);
+ picData.push_back(val >> 8);
+ picData.push_back(val & 0xff);
+ }
+
+ void pushHeader();
+ void pushOpPoly(PictureOpType op, const PolyHandle &poly);
+ void pushOpPat(PictureOpType op, const Pattern &pat);
+ void pushOpRect(PictureOpType op, const Common::Rect &rect);
+ void pushOpPoint(PictureOpType op, const Common::Point &point);
+ void pushOpPointStr(PictureOpType op, const Common::Point &point, const Common::String &str);
+};
-typedef Common::SharedPtr<Common::Array<byte>> Handle;
-typedef Common::SharedPtr<Region> RgnHandle;
typedef Common::SharedPtr<Picture> PicHandle;
-// BitMap is the monochrome surface format.
-typedef Common::SharedPtr<Graphics::ManagedSurface> BitMap;
-typedef Common::SharedPtr<Polygon> PolyHandle;
+
typedef uint32 ResType;
typedef size_t Size;
@@ -252,15 +298,6 @@ namespace Fool {
// TYPE Rect: top: INTEGER; left: INTEGER; bottom: INTEGER; right: INTEGER;
// TYPE Point: v: INTEGER; h: INTEGER;
-// In QuickDraw 0 means white and 1 means black
-struct Pattern {
- uint8 data[8];
-
- Common::String format() const {
- return Common::String::format("%02x%02x%02x%02x%02x%02x%02x%02x", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
- }
-};
-
class Cursor: public Graphics::Cursor {
public:
uint16 data[16];
@@ -821,11 +858,18 @@ public:
// srcBits.bounds coordinates.
void CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
+ // PROCEDURE EraseOval (r: Rect);
+ // Using the background pattern for the current graphics port and the patCopy pattern
+ // mode, the EraseOval procedure draws the interior of an oval just inside the bounding
+ // rectangle that you specify in the r parameter. This effectively erases the oval bounded by
+ // the specified rectangle.
+ void EraseOval(const Common::Rect &r);
+
// PROCEDURE ErasePoly (poly: PolyHandle);
// Using the patCopy pattern mode, the ErasePoly procedure draws the interior of the
// polygon whose handle you pass in the poly parameter with the background pattern for
// the current graphics port.
- void ErasePoly(PolyHandle &poly);
+ void ErasePoly(const PolyHandle &poly);
// PROCEDURE EraseRect (r: Rect);
// Using the patCopy pattern mode, the EraseRect procedure draws the interior of the
@@ -857,7 +901,7 @@ public:
// Using the patCopy pattern mode, the FillPoly procedure draws the interior of the
// polygon whose handle you pass in the poly parameter with the pattern defined in the
// Pattern record that you specify in the pat parameter.
- void FillPoly(PolyHandle &poly, const Pattern &pat);
+ void FillPoly(const PolyHandle &poly, const Pattern &pat);
// PROCEDURE FillRect (r: Rect; pat: Pattern);
// FillRect fills the specified rectangle with the given pattern (in patCopy mode). The grafPort's
@@ -888,7 +932,7 @@ public:
// Using the current graphics portâs pen pattern, pattern mode, and size, the FramePoly
// procedure plays back the line-drawing commands that define the polygon whose handle
// you pass in the poly parameter.
- void FramePoly(PolyHandle &poly);
+ void FramePoly(const PolyHandle &poly);
// PROCEDURE FrameRect (r: Rect);
// FrameRect draws an outline just inside the specified rectangle, using the current grafPort's pen
@@ -968,7 +1012,7 @@ public:
// The InvertPoly procedure inverts the pixels enclosed by the polygon whose handle
// you pass in the poly parameter. Every white pixel becomes black and every black pixel
// becomes white.
- void InvertPoly(PolyHandle &poly);
+ void InvertPoly(const PolyHandle &poly);
// PROCEDURE InvertRect (r: Rect);
// InvertRect inverts the pixels enclosed by the specified rectangle: Every white pixel becomes
@@ -1051,7 +1095,7 @@ public:
// PaintPoly paints the specified polygon with the current grafPort's pen pattern and pen mode. The
// polygon is filled with the pnPat, according to the pattern transfer mode specified by pnMode.
// The pen location is not changed by this procedure.
- void PaintPoly(PolyHandle &poly);
+ void PaintPoly(const PolyHandle &poly);
// PROCEDURE PaintRect (r: Rect);
// PaintRect paints the specified rectangle with the current grafPoit's pen pattern and mode. The
@@ -1112,7 +1156,7 @@ public:
// All other points in the current graphics portâs local coordinate system are calculated from
// this point. All subsequent drawing and calculation routines use the new coordinate
// system.
- void SetOrigin(uint16 h, uint16 v);
+ void SetOrigin(int16 h, int16 v);
// PROCEDURE SetPort (port: GrafPtr);
// SetPort makes the specified grafPort the current port.
@@ -1204,10 +1248,11 @@ private:
void _pumpEvents();
void _updateScreen();
+ void _drawOval(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawPoly(const PolyHandle &p, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
void _drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight);
- void _drawPackBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame);
+ void _drawBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame, bool compressed);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
};
diff --git a/engines/fool/toolbox_pict.cpp b/engines/fool/toolbox_pict.cpp
index 158e1f6869a..579843c64c1 100644
--- a/engines/fool/toolbox_pict.cpp
+++ b/engines/fool/toolbox_pict.cpp
@@ -46,6 +46,7 @@ void Toolbox::ClosePicture() {
warning("Toolbox::ClosePicture: picture not open");
return;
}
+ _port->picSave->pushOp(kOpEndPic);
_port->picSave = nullptr;
}
}
@@ -66,12 +67,12 @@ Common::Point readPoint(Common::SeekableReadStream &stream) {
return result;
}
-Polygon readPolygon(Common::SeekableReadStream &stream) {
- Polygon result;
- result.polySize = stream.readUint16BE();
- result.polyBBox = readRect(stream);
- for (int i = 0; i < result.polySize - 10; i++) {
- result.polyPoints.push_back(readPoint(stream));
+PolyHandle readPolygon(Common::SeekableReadStream &stream) {
+ PolyHandle result(new Polygon);
+ result->polySize = stream.readUint16BE();
+ result->polyBBox = readRect(stream);
+ for (int i = 10; i < result->polySize; i += 4) {
+ result->polyPoints.push_back(readPoint(stream));
}
return result;
}
@@ -200,7 +201,7 @@ BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool
return result;
}
-void Toolbox::_drawPackBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame) {
+void Toolbox::_drawBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame, bool compressed) {
PixMap pixMap = readPixMap(stream, false);
// these rectangles are using the pixmap coordinate system
@@ -214,7 +215,7 @@ void Toolbox::_drawPackBitsRect(Common::SeekableReadStream &stream, const Common
picFrame.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: picFrame");
if (pixMap._isBitMap) {
- BitMap result = readBitsRectMono(stream, pixMap, true);
+ BitMap result = readBitsRectMono(stream, pixMap, compressed);
const BitMap intermediate(createRemappedSurface(result->surfacePtr(), nullptr, 0));
// source rect needs to be in bitmap coordinates
@@ -222,13 +223,13 @@ void Toolbox::_drawPackBitsRect(Common::SeekableReadStream &stream, const Common
// dest rect needs to be in graphics port coordinates
dstRect.translate(-picFrame.left, -picFrame.top);
- byte fakePal[768];
- Common::fill(fakePal, fakePal+3, 0xff);
- Common::fill(fakePal+3, fakePal+768, 0x00);
- result->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 128, fakePal);
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //result->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 128, fakePal);
CopyBits(intermediate, _port->portBits, srcRect, dstRect, mode, nullptr);
} else {
- warning("Toolbox::_drawPackBitsRect: PixMaps unsupported");
+ warning("Toolbox::_drawBitsRect: PixMaps unsupported");
}
}
@@ -281,16 +282,18 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
GrafPtr origState = _port;
GrafPort temp;
OpenPort(&temp);
- temp.portBits = origState->portBits;
temp.portRect = dstRect;
+ // various bits of the original graphics port get copied over
+ temp.portBits = origState->portBits;
Common::Point ovSize;
Common::Rect lastRect;
+ PolyHandle lastPoly;
int count = 0;
bool endPic = false;
- while (!stream.eos() && !endPic) {
+ while (!(stream.eos() || endPic)) {
size_t pos = stream.pos();
uint16 op;
if (version == kOpVersion2)
@@ -547,9 +550,80 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
FillRoundRect(lastRect, ovSize.x, ovSize.y, _port->fillPat);
break;
+ case kOpFrameOval:
+ lastRect = readRect(stream);
+ FrameOval(lastRect);
+ break;
+ case kOpPaintOval:
+ lastRect = readRect(stream);
+ PaintOval(lastRect);
+ break;
+ case kOpEraseOval:
+ lastRect = readRect(stream);
+ EraseOval(lastRect);
+ break;
+ case kOpInvertOval:
+ lastRect = readRect(stream);
+ InvertOval(lastRect);
+ break;
+ case kOpFillOval:
+ lastRect = readRect(stream);
+ FillOval(lastRect, _port->fillPat);
+ break;
+ case kOpFrameSameOval:
+ FrameOval(lastRect);
+ break;
+ case kOpPaintSameOval:
+ PaintOval(lastRect);
+ break;
+ case kOpEraseSameOval:
+ EraseOval(lastRect);
+ break;
+ case kOpInvertSameOval:
+ InvertOval(lastRect);
+ break;
+ case kOpFillSameOval:
+ FillOval(lastRect, _port->fillPat);
+ break;
+
+ case kOpFramePoly:
+ lastPoly = readPolygon(stream);
+ FramePoly(lastPoly);
+ break;
+ case kOpPaintPoly:
+ lastPoly = readPolygon(stream);
+ PaintPoly(lastPoly);
+ break;
+ case kOpErasePoly:
+ lastPoly = readPolygon(stream);
+ ErasePoly(lastPoly);
+ break;
+ case kOpInvertPoly:
+ lastPoly = readPolygon(stream);
+ InvertPoly(lastPoly);
+ break;
+ case kOpFillPoly:
+ lastPoly = readPolygon(stream);
+ FillPoly(lastPoly, _port->fillPat);
+ break;
+ case kOpFrameSamePoly:
+ FramePoly(lastPoly);
+ break;
+ case kOpPaintSamePoly:
+ PaintPoly(lastPoly);
+ break;
+ case kOpEraseSamePoly:
+ ErasePoly(lastPoly);
+ break;
+ case kOpInvertSamePoly:
+ InvertPoly(lastPoly);
+ break;
+ case kOpFillSamePoly:
+ FillPoly(lastPoly, _port->fillPat);
+ break;
+
case kOpBitsRect:
- warning("STUB: Toolbox::DrawPicture: bitsRect, aborting");
- endPic = true;
+ _drawBitsRect(stream, myPicture->picFrame, false);
break;
case kOpBitsRgn:
warning("STUB: Toolbox::DrawPicture: bitsRgn, aborting");
@@ -557,7 +631,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
break;
case kOpPackBitsRect:
- _drawPackBitsRect(stream, myPicture->picFrame);
+ _drawBitsRect(stream, myPicture->picFrame, true);
break;
case kOpPackBitsRgn:
warning("STUB: Toolbox::DrawPicture: packBitsRgn, aborting");
@@ -619,9 +693,87 @@ void Toolbox::KillPicture(PicHandle &myPicture) {
}
+void Picture::pushHeader() {
+ pushOp(kOpVersion2);
+ pushOp(kOpHeaderOp);
+ Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::YES);
+ stream.writeSint32BE(-1);
+ stream.writeSint32BE(picFrame.top << 16);
+ stream.writeSint32BE(picFrame.left << 16);
+ stream.writeSint32BE(picFrame.bottom << 16);
+ stream.writeSint32BE(picFrame.right << 16);
+ stream.writeSint32BE(0);
+ size_t offset = picData.size();
+ picData.resize(offset + 24);
+ Common::copy(stream.getData(), stream.getData()+24, picData.data()+offset);
+}
+
+void Picture::pushOpPat(PictureOpType op, const Pattern &pat) {
+ pushOp(op);
+ size_t offset = picData.size();
+ picData.resize(offset + 8);
+ Common::copy(pat.data, pat.data+8, picData.data()+offset);
+}
+
+void Picture::pushOpPoly(PictureOpType op, const PolyHandle &poly) {
+ if (!poly)
+ return;
+ pushOp(op);
+ size_t offset = picData.size();
+ Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::YES);
+ stream.writeUint16BE(poly->polyPoints.size()*4 + 10);
+ stream.writeSint16BE(poly->polyBBox.top);
+ stream.writeSint16BE(poly->polyBBox.left);
+ stream.writeSint16BE(poly->polyBBox.bottom);
+ stream.writeSint16BE(poly->polyBBox.right);
+ for (Common::Point &p : poly->polyPoints) {
+ stream.writeSint16BE(p.y);
+ stream.writeSint16BE(p.x);
+ }
+ picData.resize(offset + stream.size());
+ Common::copy(stream.getData(), stream.getData()+stream.size(), picData.data()+offset);
+}
+
+void Picture::pushOpRect(PictureOpType op, const Common::Rect &rect) {
+ pushOp(op);
+ Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::YES);
+ stream.writeSint16BE(rect.top);
+ stream.writeSint16BE(rect.left);
+ stream.writeSint16BE(rect.bottom);
+ stream.writeSint16BE(rect.right);
+ size_t offset = picData.size();
+ picData.resize(offset + 8);
+ Common::copy(stream.getData(), stream.getData()+8, picData.data()+offset);
+}
+
+void Picture::pushOpPoint(PictureOpType op, const Common::Point &point) {
+ pushOp(op);
+ Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::YES);
+ stream.writeSint16BE(point.y);
+ stream.writeSint16BE(point.x);
+ size_t offset = picData.size();
+ picData.resize(offset + 4);
+ Common::copy(stream.getData(), stream.getData()+4, picData.data()+offset);
+}
+
+void Picture::pushOpPointStr(PictureOpType op, const Common::Point &point, const Common::String &str) {
+ pushOp(op);
+ Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::YES);
+ stream.writeSint16BE(point.y);
+ stream.writeSint16BE(point.x);
+ stream.writeByte(str.size());
+ stream.writeString(str);
+ size_t offset = picData.size();
+ picData.resize(offset + stream.size());
+ Common::copy(stream.getData(), stream.getData()+stream.size(), picData.data()+offset);
+}
+
+
PicHandle Toolbox::OpenPicture(const Common::Rect &picFrame) {
PicHandle result(new Picture);
result->picFrame = picFrame;
+ result->pushHeader();
+
if (_port) {
if (_port->picSave) {
warning("Toolbox::OpenPicture: last picture not closed, overwriting");
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 52aa73471bf..a0e0f27cf96 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -62,7 +62,7 @@ void Toolbox::ClosePoly() {
_port->polySave->polyBBox.extend(_port->polySave->polyPoints[i]);
}
}
- _port->polySave->polySize = _port->polySave->polyPoints.size()*2 + 10;
+ _port->polySave->polySize = _port->polySave->polyPoints.size()*4 + 10;
_port->polySave = nullptr;
}
}
@@ -153,21 +153,40 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
// - blit to target with blitMono
// - add to target dirty rect list
-void Toolbox::ErasePoly(PolyHandle &poly) {
+void Toolbox::EraseOval(const Common::Rect &r) {
+ if (_port) {
+ _drawOval(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpEraseOval, r);
+ }
+ }
+}
+
+void Toolbox::ErasePoly(const PolyHandle &poly) {
if (_port) {
_drawPoly(poly, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoly(kOpErasePoly, poly);
+ }
}
}
void Toolbox::EraseRect(const Common::Rect &r) {
if (_port) {
_drawRect(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpEraseRect, r);
+ }
}
}
void Toolbox::EraseRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
if (_port) {
_drawRoundRect(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoint(kOpOvSize, Common::Point(ovalWidth, ovalHeight));
+ _port->picSave->pushOpRect(kOpEraseRRect, r);
+ }
}
}
@@ -175,8 +194,36 @@ void Toolbox::EndUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::EndUpdate");
}
-void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
- warning("STUB: Toolbox::FillOval");
+void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
+ if (!r.isValidRect()) {
+ warning("Toolbox::_drawOval: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
+ return;
+ }
+ if (_port && _port->pnVis == 0) {
+
+ BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
+ BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
+ Common::Point destPos(r.left, r.top);
+ // move to port coordinate space
+ destPos.x += _port->portRect.left;
+ destPos.y += _port->portRect.top;
+ Graphics::MacPatterns macpat({pat.data});
+
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
+ Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ // For thicker outlines, the shape should be adjusted inward
+ Common::Rect destRect = intermediate->getBounds();
+ destRect.right -= _port->pnSize.x - 1;
+ destRect.bottom -= _port->pnSize.y - 1;
+
+ pm.drawEllipse(0, 0, destRect.width(), destRect.height(), fgColor, !frame, &pd);
+
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(dstRect);
+ _defaultWindow->setDirty(true);
+ }
+ }
}
void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
@@ -201,22 +248,28 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
Common::Point destPos(bbox.left, bbox.top);
Graphics::MacPatterns macpat({pat.data});
+ // move to port coordinate space
+ destPos.x += _port->portRect.left;
+ destPos.y += _port->portRect.top;
+
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Common::Point origin(bbox.left, bbox.top);
+
if (frame) {
for (int i = 0; i < (int)poly->polyPoints.size() - 1; i++) {
- Common::Point p1 = poly->polyPoints[i] - destPos;
- Common::Point p2 = poly->polyPoints[i+1] - destPos;
+ Common::Point p1 = poly->polyPoints[i] - origin;
+ Common::Point p2 = poly->polyPoints[i+1] - origin;
pm.drawLine(p1.x, p1.y, p2.x, p2.y, fgColor, &pd);
}
} else {
Common::Array<int> polyX;
Common::Array<int> polyY;
for (auto &it : poly->polyPoints) {
- polyX.push_back(it.x - destPos.x);
- polyY.push_back(it.y - destPos.y);
- debugC(5, kDebugGraphics, "Toolbox::_drawPoly: (%d, %d)", it.x - destPos.x, it.y - destPos.y);
+ polyX.push_back(it.x - origin.x);
+ polyY.push_back(it.y - origin.y);
+ debugC(5, kDebugGraphics, "Toolbox::_drawPoly: (%d, %d)", it.x - bbox.left, it.y - bbox.top);
}
pm.drawPolygonScan(polyX.data(), polyY.data(), poly->polyPoints.size(), destRect, fgColor, &pd);
}
@@ -256,6 +309,9 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
}
Common::Point destPos(r.left, r.top);
+ // move to port coordinate space
+ destPos.x += _port->portRect.left;
+ destPos.y += _port->portRect.top;
Graphics::MacPatterns macpat({pat.data});
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
@@ -294,6 +350,9 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
Common::Point destPos(r.left, r.top);
+ // move to port coordinate space
+ destPos.x += _port->portRect.left;
+ destPos.y += _port->portRect.top;
Graphics::MacPatterns macpat({pat.data});
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
@@ -322,10 +381,25 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
}
}
-void Toolbox::FillPoly(PolyHandle &poly, const Pattern &pat) {
+void Toolbox::FillOval(const Common::Rect &r, const Pattern &pat) {
+ if (_port) {
+ _port->fillPat = pat;
+ _drawOval(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpPat(kOpFillPat, pat);
+ _port->picSave->pushOpRect(kOpFillOval, r);
+ }
+ }
+}
+
+void Toolbox::FillPoly(const PolyHandle &poly, const Pattern &pat) {
if (_port) {
_port->fillPat = pat;
_drawPoly(poly, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpPat(kOpFillPat, pat);
+ _port->picSave->pushOpPoly(kOpFillPoly, poly);
+ }
}
}
@@ -333,6 +407,10 @@ void Toolbox::FillRect(const Common::Rect &r, const Pattern &pat) {
if (_port) {
_port->fillPat = pat;
_drawRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpPat(kOpFillPat, pat);
+ _port->picSave->pushOpRect(kOpFillRect, r);
+ }
}
}
@@ -340,6 +418,11 @@ void Toolbox::FillRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 oval
if (_port) {
_port->fillPat = pat;
_drawRoundRect(r, pat, kPatCopy, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ if (_port->picSave) {
+ _port->picSave->pushOpPat(kOpFillPat, pat);
+ _port->picSave->pushOpPoint(kOpOvSize, Common::Point(ovalWidth, ovalHeight));
+ _port->picSave->pushOpRect(kOpFillRRect, r);
+ }
}
}
@@ -348,40 +431,39 @@ void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle)
}
void Toolbox::FrameOval(const Common::Rect &r) {
- if (_port && _port->pnVis == 0) {
-
- BitMap intermediate(new Graphics::ManagedSurface(r.width(), r.height()));
- BitMap mask(new Graphics::ManagedSurface(r.width(), r.height()));
- Common::Point destPos(r.left, r.top);
- Graphics::MacPatterns macpat({_port->pnPat.data});
-
- Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
- pm.drawEllipse(0, 0, r.width(), r.height(), _port->fgColor, false, &pd);
-
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
+ if (_port) {
+ _drawOval(r, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpFrameOval, r);
}
}
}
-void Toolbox::FramePoly(PolyHandle &poly) {
+void Toolbox::FramePoly(const PolyHandle &poly) {
if (_port) {
_drawPoly(poly, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoly(kOpFramePoly, poly);
+ }
}
}
void Toolbox::FrameRect(const Common::Rect &r) {
if (_port) {
_drawRect(r, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpFrameRect, r);
+ }
}
}
void Toolbox::FrameRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
if (_port) {
_drawRoundRect(r, _port->pnPat, _port->pnMode, true, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoint(kOpOvSize, Common::Point(ovalWidth, ovalHeight));
+ _port->picSave->pushOpRect(kOpFrameRRect, r);
+ }
}
}
@@ -405,7 +487,10 @@ void Toolbox::GetPort(GrafPtr &port) {
}
void Toolbox::GlobalToLocal(Common::Point &pt) {
- //warning("STUB: Toolbox::GlobalToLocal");
+ if (_port) {
+ pt.x -= _port->portRect.left;
+ pt.y -= _port->portRect.top;
+ }
}
void Toolbox::HideCursor() {
@@ -438,23 +523,35 @@ void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
}
void Toolbox::InvertOval(const Common::Rect &r) {
- warning("STUB: Toolbox::InvertOval");
+ if (_port) {
+ // set pattern to full black
+ Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
+ _drawOval(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpInvertOval, r);
+ }
+ }
}
-void Toolbox::InvertPoly(PolyHandle &poly) {
+void Toolbox::InvertPoly(const PolyHandle &poly) {
if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
_drawPoly(poly, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoly(kOpInvertPoly, poly);
+ }
}
}
-
void Toolbox::InvertRect(const Common::Rect &r) {
if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
_drawRect(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpInvertRect, r);
+ }
}
}
@@ -463,6 +560,10 @@ void Toolbox::InvertRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ov
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
_drawRoundRect(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite, ovalWidth, ovalHeight);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoint(kOpOvSize, Common::Point(ovalWidth, ovalHeight));
+ _port->picSave->pushOpRect(kOpInvertRRect, r);
+ }
}
}
@@ -519,7 +620,10 @@ void Toolbox::LineTo(int16 h, int16 v) {
}
void Toolbox::LocalToGlobal(Common::Point &pt) {
- warning("STUB: Toolbox::LocalToGlobal");
+ if (_port) {
+ pt.x += _port->portRect.left;
+ pt.y += _port->portRect.top;
+ }
}
void Toolbox::Move(int16 dh, int16 dv) {
@@ -562,30 +666,48 @@ void Toolbox::OpenPort(GrafPtr port) {
}
void Toolbox::PaintOval(const Common::Rect &r) {
- warning("STUB: Toolbox::PaintOval");
+ if (_port) {
+ _drawOval(r, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpPaintOval, r);
+ }
+ }
}
-void Toolbox::PaintPoly(PolyHandle &poly) {
+void Toolbox::PaintPoly(const PolyHandle &poly) {
if (_port) {
_drawPoly(poly, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoly(kOpPaintPoly, poly);
+ }
}
}
void Toolbox::PaintRect(const Common::Rect &r) {
if (_port) {
_drawRect(r, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor);
+ if (_port->picSave) {
+ _port->picSave->pushOpRect(kOpPaintRect, r);
+ }
}
}
void Toolbox::PaintRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ovalHeight) {
if (_port) {
_drawRoundRect(r, _port->pnPat, _port->pnMode, false, _port->fgColor, _port->bkColor, ovalWidth, ovalHeight);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoint(kOpOvSize, Common::Point(ovalWidth, ovalHeight));
+ _port->picSave->pushOpRect(kOpPaintRRect, r);
+ }
}
}
void Toolbox::PenMode(PatternMode mode) {
if (_port) {
_port->pnMode = mode;
+ if (_port->picSave) {
+ _port->picSave->pushOpU16(kOpPnMode, mode);
+ }
}
}
@@ -601,12 +723,18 @@ void Toolbox::PenNormal() {
void Toolbox::PenPat(const Pattern &pat) {
if (_port) {
_port->pnPat = pat;
+ if (_port->picSave) {
+ _port->picSave->pushOpPat(kOpPnPat, pat);
+ }
}
}
void Toolbox::PenSize(uint16 width, uint16 height) {
if (_port) {
_port->pnSize = Common::Point(width, height);
+ if (_port->picSave) {
+ _port->picSave->pushOpPoint(kOpPnPat, _port->pnSize);
+ }
}
}
@@ -631,10 +759,13 @@ void Toolbox::SetCursor(const Common::SharedPtr<Cursor> &crsr) {
g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, crsr.get());
}
-void Toolbox::SetOrigin(uint16 h, uint16 v) {
+void Toolbox::SetOrigin(int16 h, int16 v) {
if (_port) {
_port->portRect.left = h;
_port->portRect.top = v;
+ if (_port->picSave) {
+ _port->picSave->pushOpPoint(kOpOrigin, Common::Point(h, v));
+ }
}
}
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index fd31c01b879..e52f96030c3 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -47,12 +47,25 @@ void Toolbox::DrawString(const Common::U32String &s) {
BitMap mask(nullptr);
- Common::Rect result = blitMono(buffer, _port->portBits, mask, Common::Point(_port->pnLoc.x, _port->pnLoc.y-font->getFontAscent()), _port->txMode);
+ Common::Point destPos(_port->pnLoc.x, _port->pnLoc.y-font->getFontAscent());
+ // move to port coordinate space
+ destPos.x += _port->portRect.left;
+ destPos.y += _port->portRect.top;
+
+ Common::Rect result = blitMono(buffer, _port->portBits, mask, destPos, _port->txMode);
_port->pnLoc.x += bbox.width();
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(result);
_defaultWindow->setDirty(true);
}
+
+ if (_port->picSave) {
+ _port->picSave->pushOpU16(kOpTxFace, _port->txFace);
+ _port->picSave->pushOpU16(kOpTxFont, _port->txFont);
+ _port->picSave->pushOpU16(kOpTxMode, _port->txMode);
+ _port->picSave->pushOpU16(kOpTxSize, _port->txSize);
+ _port->picSave->pushOpPointStr(kOpLongText, _port->pnLoc, macString);
+ }
}
}
Commit: 448b91de70375304f74adafa0e57aa73ea118aae
https://github.com/scummvm/scummvm/commit/448b91de70375304f74adafa0e57aa73ea118aae
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:06+02:00
Commit Message:
FOOL: More polyomino fixes
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_polyomino.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 659d3082437..4bec8a19e65 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -362,6 +362,7 @@ Common::U32String FoolGame::puzzlesReadString() {
}
void FoolGame::sub_128_4da(int16 unk1) {
+ // toggle the mouse cursor off or on
// 128:04da
if (unk1 == 0) {
if (this->var_i16_7a0 == 1) {
@@ -375,12 +376,12 @@ void FoolGame::sub_128_4da(int16 unk1) {
this->var_i16_7a0 = unk1;
}
-void FoolGame::sub_128_50e(int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
// 128:050e
// audio tone
- this->var_i16_34 = unk1;
- this->var_i16_32 = unk2;
- this->var_i16_30 = unk3;
+ this->var_i16_34 = wait;
+ this->var_i16_32 = duration;
+ this->var_i16_30 = freq;
if (this->var_i16_378 == 1) {
g_zbasic->sound(this->var_i16_30, this->var_i16_32, 0x96, 0);
if (this->var_i16_34 == 1) {
@@ -2130,6 +2131,7 @@ void FoolGame::sub_128_6154() {
void FoolGame::sub_128_6186() {
// 128:6186
+ // wait until mouse button is up
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(6, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index e1ad71b0bba..12bc03e6576 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -50,7 +50,7 @@ public:
int32 puzzlesReadLong(); // sub_128_462
Common::U32String puzzlesReadString(); // sub_128_49a
void sub_128_4da(int16 unk1);
- void sub_128_50e(int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_50e(int16 freq, int16 duration, int16 wait);
void sub_128_55c(Common::U32String &unk1);
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
@@ -146,9 +146,9 @@ public:
void polyominoOnClick(); // sub_133_87c
void sub_133_eb2();
void sub_133_f04();
- void sub_133_10a0();
+ void polyominoBadMove(); // sub_133_10a0
void sub_133_11cc();
- void sub_133_12d4();
+ void polyominoDrawFrame(); // sub_133_12d4
void sub_133_12f2();
void sub_133_13e2();
void polyominoStoreState(); // sub_133_1452
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 1d13b904239..915cd803786 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -89,7 +89,9 @@ void FoolGame::polyominoRun() {
g_toolbox->SetPort(this->var_i32_f24);
g_zbasic->text(0xfb, 0x18, 0, kSrcOr);
+ // for each polyomino
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
+ // read number of coordinate parts
this->var_i16_103a = this->puzzlesReadShort();
for (int i = 0; i <= 4; i++) {
this->arr_i16_47d8[j*8 + i] = this->puzzlesReadShort();
@@ -109,17 +111,22 @@ void FoolGame::polyominoRun() {
}
}
// 133:0356
+ // read coordinates. these are unsigned bytes in pixel units
for (int i = 0; i <= this->var_i16_103a; i++) {
this->arr_i16_4338[i] = this->puzzlesReadByte();
}
+
// 133:0388
+ // create polyomino polygons from coordinates
this->var_poly_1aac = g_toolbox->OpenPoly();
g_toolbox->MoveTo(this->arr_i16_4338[1], this->arr_i16_4338[0]);
for (int i = 2; i <= this->var_i16_103a; i += 2) {
g_toolbox->LineTo(this->arr_i16_4338[i+1], this->arr_i16_4338[i]);
}
g_toolbox->ClosePoly();
+
// 133:0408
+ // load in letter placement information
this->var_i16_103a = this->puzzlesReadShort();
if (this->var_i16_103a >= 3) {
for (int i = 1; i <= this->var_i16_103a; i++) {
@@ -127,10 +134,12 @@ void FoolGame::polyominoRun() {
}
}
// 133:044a
- this->arr_i16_1eb8[0x1a] = this->puzzlesReadShort();
- this->arr_i16_1eb8[0x1b] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[0x1a] = this->puzzlesReadShort(); // polygon fill pattern index
+ this->arr_i16_1eb8[0x1b] = this->puzzlesReadShort(); // text source mode
g_toolbox->PenNormal();
+
// 133:0476: JSR - "PICTURE_ON"
+ // picture handle 0: XOR text + polyomino
PicHandle handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
g_toolbox->PenMode(kPatXor);
if (this->var_i16_103a >= 3) {
@@ -146,7 +155,9 @@ void FoolGame::polyominoRun() {
g_toolbox->ClosePicture();
this->arr_pic_49d8[j*4] = handle;
g_toolbox->PenNormal();
+
// 133:0530: JSR - "PICTURE_ON"
+ // picture handle 1:
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
g_toolbox->FillPoly(this->var_poly_1aac, this->arr_pat_58f4[this->arr_i16_1eb8[0x1a]]);
g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xd]]);
@@ -166,13 +177,17 @@ void FoolGame::polyominoRun() {
// 133:0622
this->arr_pic_49d8[j*4 + 1] = handle;
g_toolbox->PenNormal();
+
// 133:0642: JSR - "PICTURE_ON"
+ // picture handle 2: draw the shape without letters
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xf]]);
g_toolbox->FramePoly(this->var_poly_1aac);
g_toolbox->PaintPoly(this->var_poly_1aac);
g_toolbox->ClosePicture();
this->arr_pic_49d8[j*4 + 2] = handle;
+
+ // clear polygon data
g_toolbox->KillPoly(this->var_poly_1aac);
// 133:0698
}
@@ -194,7 +209,7 @@ void FoolGame::polyominoRun() {
this->sub_133_f04();
}
this->var_i16_1ab0 = 1;
- this->sub_133_12d4();
+ this->polyominoDrawFrame();
this->sub_133_12f2();
this->var_i16_7c6 = 0;
do {
@@ -248,7 +263,7 @@ void FoolGame::polyominoOnClick() {
}
// 133:0950
if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] <= this->arr_i16_1eb8[0x11]) {
- this->sub_133_10a0();
+ this->polyominoBadMove();
return;
}
// 133:0990
@@ -333,7 +348,7 @@ void FoolGame::polyominoOnClick() {
this->sub_133_f04();
}
// 133:0ea2
- this->sub_133_12d4();
+ this->polyominoDrawFrame();
this->sub_133_12f2();
this->sub_128_4da(1);
}
@@ -375,18 +390,20 @@ void FoolGame::sub_133_f04() {
}
-void FoolGame::sub_133_10a0() {
+void FoolGame::polyominoBadMove() {
// 133:10a0
this->var_i16_484 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
this->var_i16_7e4 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
+ // play bass tone
this->sub_128_50e(0x14, 0x64, 0);
// why do this???
+ // best guess: flashing the shape a few times before knocking it back
// 133:1188
for (int i = 0; i <= 9; i++) {
g_zbasic->picture(this->var_i16_484, this->var_i16_7e4, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:11c2
- this->sub_133_12d4();
+ this->polyominoDrawFrame();
this->sub_128_6186();
}
@@ -407,11 +424,11 @@ void FoolGame::sub_133_11cc() {
}
// 133:12c2
this->var_i16_1ab0 = 1;
- this->sub_133_12d4();
+ this->polyominoDrawFrame();
this->var_i16_7c6 = 0;
}
-void FoolGame::sub_133_12d4() {
+void FoolGame::polyominoDrawFrame() {
// 133:12d4
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
Commit: ad6ff77b87575705cb348387498ea97fbe362b4b
https://github.com/scummvm/scummvm/commit/ad6ff77b87575705cb348387498ea97fbe362b4b
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:06+02:00
Commit Message:
FOOL: Polyominos working, add wordsearch
Changed paths:
A engines/fool/fool_wordsearch.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_polyomino.cpp
engines/fool/module.mk
engines/fool/toolbox_pict.cpp
engines/fool/toolbox_text.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 4bec8a19e65..fddeecc8168 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -281,6 +281,7 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
}
void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
+ // convert mouse coordinates to grid coordinates
this->var_i16_68c = unk1;
this->var_i16_68a = unk2;
this->var_i16_68a = (this->var_ev_46.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
@@ -1096,13 +1097,22 @@ void FoolGame::sub_128_26f6() {
}
void FoolGame::sub_128_271a() {
+ int position = this->arr_i32_19454[this->var_i16_7e2] - 1;
// record index
- this->var_i16_484 = (this->arr_i32_19454[this->var_i16_7e2] - 1) / 1000;
+ this->var_i16_484 = (int16)(position / 1000);
// offset at record
- this->var_i16_7e4 = (this->arr_i32_19454[this->var_i16_7e2] - 1) % 1000;
+ this->var_i16_7e4 = (int16)(position % 1000);
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
this->var_ptr_696 = 0;
- this->arr_bytes_109dc = g_zbasic->readFile(1, this->arr_i32_19454[this->var_i16_7e2 + 1] - this->arr_i32_19454[this->var_i16_7e2]);
+ int length = this->arr_i32_19454[this->var_i16_7e2 + 1] - this->arr_i32_19454[this->var_i16_7e2];
+ debugC(8, kDebugLoading, "sub_128_271a: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
+ this->var_i16_7e2,
+ position,
+ this->var_i16_484,
+ this->var_i16_7e4,
+ length
+ );
+ this->arr_bytes_109dc = g_zbasic->readFile(1, length);
this->var_bytes_696 = this->arr_bytes_109dc;
}
@@ -1599,7 +1609,7 @@ void FoolGame::sub_128_39a0() {
this->sub_131_004();
break;
case 5:
- this->sub_132_004();
+ this->jigsawRun();
break;
case 6:
this->polyominoRun();
@@ -1870,7 +1880,7 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[2] = 0x8;
}
if (this->arr_i16_4758[0] == 0) {
- // user clicked the puzzle button, zoom-fill with checkerboard
+ // user clicked the puzzle button, zoom-fill with pattern
sub_128_962(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
return;
}
@@ -2763,11 +2773,6 @@ void FoolGame::sub_130_004() {
warning("STUB: %s", __func__);
}
-// word search game
-void FoolGame::sub_131_004() {
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_135_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 12bc03e6576..89c5dcfc382 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -128,25 +128,32 @@ public:
void sub_129_123a();
void sub_130_004();
+
+ // fool_wordsearch.cpp
void sub_131_004();
+ void sub_131_8aa();
+ void sub_131_cbe();
+ void sub_131_d22();
+ void sub_131_d66();
+ void sub_131_f42();
// fool_jigsaw.cpp
- void sub_132_004();
- void sub_132_518();
- void sub_132_67a();
- void sub_132_962();
- void sub_132_e5a();
- void sub_132_ed8();
- void sub_132_1384();
- void sub_132_13ea();
- void sub_132_1444();
+ void jigsawRun(); // sub_132_004
+ void jigsawOnClick(); // sub_132_518
+ void jigsawDragSelect(); // sub_132_67a
+ void jigsawMoveSelected(); // sub_132_962
+ void jigsawCancelSelect(); // sub_132_e5a
+ void jigsawDropSelected(); // sub_132_ed8
+ void jigsawStoreState(); // sub_132_1384
+ void jigsawCheckIfSolved(); // sub_132_13ea
+ void jigsawSuccess(); // sub_132_1444
// fool_polyomino.cpp
void polyominoRun(); // sub_133_004
void polyominoOnClick(); // sub_133_87c
void sub_133_eb2();
void sub_133_f04();
- void polyominoBadMove(); // sub_133_10a0
+ void polyominoOnClickFixed(); // sub_133_10a0
void sub_133_11cc();
void polyominoDrawFrame(); // sub_133_12d4
void sub_133_12f2();
@@ -308,8 +315,21 @@ private:
Common::U32String var_str_1272;
int16 var_i16_1372;
+ int16 var_i16_1574;
+
+ Common::U32String var_str_188e;
+
+ int16 var_i16_198e;
+ int16 var_i16_1990;
+ int16 var_i16_1992;
+ Common::U32String var_str_1994;
+
+ int16 var_i16_19ae;
+
+ int16 var_i16_1a94;
int16 var_i16_1a96;
int16 var_i16_1a98;
+ int16 var_i16_1a9a;
uint16 var_i16_1a9c;
int16 var_i16_1a9e;
int16 var_i16_1aa0;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 1af0039cbc5..9d072bafbfa 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -32,7 +32,7 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// jigsaw puzzle game
-void FoolGame::sub_132_004() {
+void FoolGame::jigsawRun() {
// 132:0004
this->var_i16_c00 = 1;
this->sub_128_271a();
@@ -113,7 +113,7 @@ void FoolGame::sub_132_004() {
this->var_i16_7c6 = 0;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
- this->sub_132_13ea();
+ this->jigsawCheckIfSolved();
// JMP 0x4d8
// 132:04d8
@@ -125,30 +125,29 @@ void FoolGame::sub_132_004() {
// 132:0488
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseDown) {
- this->sub_132_518();
+ this->jigsawOnClick();
}
g_toolbox->Delay(0);
}
// 132:04b8
if (this->var_i16_7c6 == 2) {
- this->sub_132_e5a();
+ this->jigsawCancelSelect();
}
if (this->var_i16_7c6 == 4) {
- this->sub_132_1384();
+ this->jigsawStoreState();
this->sub_128_3536();
}
}
// 132:0500
if (this->var_i16_d0c != 0) {
- this->sub_132_1444();
+ this->jigsawSuccess();
}
- this->sub_132_1384();
+ this->jigsawStoreState();
// JMP 0x14a6
// 132:14a6
}
-void FoolGame::sub_132_518() {
- warning("call: %s", __func__);
+void FoolGame::jigsawOnClick() {
// 132:0518
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || ((this->var_i16_68a - (this->arr_i16_1eb8[0])) > 0) || (this->var_i16_68c < 1) || ((this->var_i16_68c - (this->arr_i16_1eb8[1])) > 0)) {
@@ -165,7 +164,7 @@ void FoolGame::sub_132_518() {
this->arr_i16_4758[1] = this->var_i16_68c;
// change select area while mouse button held down
- this->sub_132_67a();
+ this->jigsawDragSelect();
// leave an XOR outline on the page for the selected block
Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
g_toolbox->FrameRect(temp);
@@ -174,21 +173,21 @@ void FoolGame::sub_132_518() {
// 132:0642
// move select area to new target
- this->sub_132_962();
+ this->jigsawMoveSelected();
// remove XOR outline
temp = Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
g_toolbox->FrameRect(temp);
- this->sub_132_ed8();
- this->sub_132_13ea();
+ this->jigsawDropSelected();
+ this->jigsawCheckIfSolved();
this->sub_128_6186();
g_zbasic->menu(8, 3, 1, Common::U32String());
this->var_i16_e12 = 0;
}
-void FoolGame::sub_132_67a() {
+void FoolGame::jigsawDragSelect() {
+ // 132:067a
// change select area while mouse button held down
- warning("call: %s", __func__);
do {
this->sub_128_c6a(4);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -224,7 +223,8 @@ void FoolGame::sub_132_67a() {
} while (this->var_ev_46.what != kMouseUp);
}
-void FoolGame::sub_132_962() {
+void FoolGame::jigsawMoveSelected() {
+ // 132:0962
// move select area to new target
warning("call: %s", __func__);
do {
@@ -283,19 +283,17 @@ void FoolGame::sub_132_962() {
while (!((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y > 0x14)));
}
-void FoolGame::sub_132_e5a() {
- warning("call: %s", __func__);
+void FoolGame::jigsawCancelSelect() {
// 132:0e5a
this->var_i16_7c6 = 0;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
g_zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
- sub_132_ed8();
+ jigsawDropSelected();
}
-void FoolGame::sub_132_ed8() {
- warning("call: %s", __func__);
+void FoolGame::jigsawDropSelected() {
// 132:0ed8
// skip the tile pointer to past the end of the list
this->var_i16_1aa4 = this->var_i16_1a9e;
@@ -376,9 +374,8 @@ void FoolGame::sub_132_ed8() {
}
}
-void FoolGame::sub_132_1384() {
+void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
- warning("call: %s", __func__);
// 132:1384
this->var_str_c06 = g_zbasic->str(208);
for (int i = 1; i <= this->var_i16_1a9e; i++) {
@@ -388,9 +385,8 @@ void FoolGame::sub_132_1384() {
}
-void FoolGame::sub_132_13ea() {
+void FoolGame::jigsawCheckIfSolved() {
// check if puzzle is solved
- warning("call: %s", __func__);
// 132:13ea
this->var_i16_d0c = 1;
for (int i = 1; i <= this->var_i16_1a9e; i++) {
@@ -406,7 +402,7 @@ void FoolGame::sub_132_13ea() {
}
}
-void FoolGame::sub_132_1444() {
+void FoolGame::jigsawSuccess() {
// strobe puzzle pieces once on victory
if (this->var_i16_c04 < 0x64) {
this->var_i16_c04 = 0x64;
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 915cd803786..51e3cf03ae4 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -19,8 +19,6 @@
*
*/
-#include "graphics/managed_surface.h"
-
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
@@ -77,7 +75,9 @@ void FoolGame::polyominoRun() {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
// 133:0184
this->var_i16_484++;
+ // collision map: 2D grid where element is occupying polyomino ID
this->arr_i16_2f38[i*32 + j] = 0;
+
this->arr_i16_3b38[i*32 + j] = this->var_i16_484;
}
}
@@ -100,13 +100,29 @@ void FoolGame::polyominoRun() {
for (int i = 5; i <= 6; i++) {
this->arr_i16_47d8[j*8 + i] = this->arr_i16_47d8[j*8 + i - 2];
}
+ debug(5,"FoolGame::polyominoRun: adding polyomino %d:", j);
+ for (int i = 0; i < 4; i++) {
+ uint16 data =(this->arr_i16_47d8[j*8] >> (i*4)) & 0xf;
+ debug(5, "%s%s%s%s",
+ data & 0x1 ? "#" : " ",
+ data & 0x2 ? "#" : " ",
+ data & 0x4 ? "#" : " ",
+ data & 0x8 ? "#" : " "
+ );
+ }
+ debug(5, "%d, %d, start position %d, %d",
+ this->arr_i16_47d8[j*8 + 1],
+ this->arr_i16_47d8[j*8 + 2],
+ this->arr_i16_47d8[j*8 + 3],
+ this->arr_i16_47d8[j*8 + 4]
+ );
// 133:02de
if (this->var_str_c06 != g_zbasic->str(211)) {
- if (j != 1) {
+ if (j == 1) {
this->var_i16_1aa8 = 1;
}
for (int i = 3; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, i, 2));
+ this->arr_i16_47d8[j*8 + i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, this->var_i16_1aa8, 2));
this->var_i16_1aa8 += 2;
}
}
@@ -220,7 +236,7 @@ void FoolGame::polyominoRun() {
}
// yield to renderer
if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
+ g_toolbox->Delay(1);
}
// 133:0800
} while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0));
@@ -251,29 +267,37 @@ void FoolGame::polyominoRun() {
void FoolGame::polyominoOnClick() {
// 133:087c
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ debug(5, "FoolGame::polyominoOnClick: grid pos: (%d, %d)", this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
this->sub_128_6186();
return;
}
// 133:0904
+ // get polyomino from collision map
this->var_i16_7cc = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
+ debug(5, "FoolGame::polyominoOnClick: selected polyomino: %d", this->var_i16_7cc);
+ // if no polyomino, ignore
if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == 0) {
this->sub_128_6186();
return;
}
// 133:0950
+ // if polyomino is part of the fixed list, act as if it were an invalid move
if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] <= this->arr_i16_1eb8[0x11]) {
- this->polyominoBadMove();
+ this->polyominoOnClickFixed();
return;
}
// 133:0990
this->var_i16_106a = 0;
this->var_i16_1a96 = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
this->var_i16_1a98 = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
+ debug(5, "FoolGame::polyominoOnClick: 1a96: %d, 1a98: %d", this->var_i16_1a96, this->var_i16_1a98);
+
for (int j = this->var_i16_1a98; j <= this->var_i16_1a98 + 3; j++) {
// 133:09dc
for (int i = this->var_i16_1a96; i <= this->var_i16_1a96 + 3; i++) {
if (this->arr_i16_47d8[this->var_i16_7cc*8] & this->bitLUT[this->var_i16_106a]) {
+ // erase grabbed polyomino from collision map
this->arr_i16_2f38[i*32 + j] = 0;
}
// 133:0a36
@@ -285,15 +309,26 @@ void FoolGame::polyominoOnClick() {
this->var_i16_1ab4 = this->var_i16_1a98 - this->var_i16_68c;
this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].left;
this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].top;
+ debug(5, "FoolGame::polyominoOnClick: Draw pic 2 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 2]);
+ // 133:0b1c
+ this->polyominoDrawFrame();
+ this->sub_128_4da(0);
+ this->var_i16_1ab6 = this->var_i16_1062;
+ this->var_i16_1ab8 = this->var_i16_1064;
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+
// 133:0b5a: JMP - [0xde0]
while (this->var_ev_46.what != 2) {
+ // 133:0b5e
// 133:0d3a
while ((this->var_i16_1ab6 == this->var_i16_1062) && (this->var_i16_1ab8 == this->var_i16_1064) && (this->var_ev_46.what != 2)) {
// 133:0b62
this->sub_128_c6a(4);
- this->var_i16_68a = (this->arr_i16_1eb8[6] / (this->var_ev_46.where.x - this->arr_i16_1eb8[4])) + this->var_i16_1ab2;
- this->var_i16_68c = (this->arr_i16_1eb8[7] / (this->var_ev_46.where.y - this->arr_i16_1eb8[5])) + this->var_i16_1ab4;
+
+ this->var_i16_68a = this->var_i16_1ab2 + ((this->var_ev_46.where.x - this->arr_i16_1eb8[4]) / this->arr_i16_1eb8[6]);
+ this->var_i16_68c = this->var_i16_1ab4 + ((this->var_ev_46.where.y - this->arr_i16_1eb8[5]) / this->arr_i16_1eb8[7]);
+
if (this->var_i16_68a < 1) {
this->var_i16_68a = 1;
}
@@ -312,6 +347,7 @@ void FoolGame::polyominoOnClick() {
// 133:0cc8
this->var_i16_1ab6 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
this->var_i16_1ab8 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ //debug(5, "FoolGame::polyominoOnClick: Move to (%d, %d) -> (%d, %d)", this->var_i16_68a, this->var_i16_68c, this->var_i16_1ab6, this->var_i16_1ab8);
// yield to renderer
if (this->var_ev_46.what == kNullEvent) {
@@ -320,9 +356,14 @@ void FoolGame::polyominoOnClick() {
}
// 133:0d78
if (this->var_ev_46.what != 2) {
+ debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
+ // XOR out original position
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ // drag to cursor position
this->var_i16_1062 = this->var_i16_1ab6;
this->var_i16_1064 = this->var_i16_1ab8;
+ // XOR out new position
+ debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:0de0
@@ -331,6 +372,7 @@ void FoolGame::polyominoOnClick() {
// 133:0dea
this->var_i16_106a = 0;
this->var_i16_1a9c = 0;
+ // store polyomino as bitfield.
for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
if (this->arr_i16_2f38[i*32 + j] > 0) {
@@ -365,10 +407,11 @@ void FoolGame::sub_133_eb2() {
void FoolGame::sub_133_f04() {
// 133:0f04
this->var_i16_106a = 0;
+ // polyominos are max 4x4
+ // add the polyomino to the collision map
for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
- this->var_i16_1a96 = this->var_i16_68a;
- if ((this->arr_i16_47d8[this->var_i16_7cc*8 + 1] & this->bitLUT[this->var_i16_106a]) != 0) {
+ if ((this->arr_i16_47d8[this->var_i16_7cc*8] & this->bitLUT[this->var_i16_106a]) != 0) {
this->arr_i16_2f38[i*32 + j] = this->var_i16_7cc;
}
// 133:0f6c
@@ -376,21 +419,24 @@ void FoolGame::sub_133_f04() {
}
}
// 133:0f96
+ // set the polyomino position
this->arr_i16_47d8[this->var_i16_7cc*8 + 3] = this->var_i16_68a;
this->arr_i16_47d8[this->var_i16_7cc*8 + 4] = this->var_i16_68c;
// 133:0fce
if (this->var_i16_1ab0 != 0) {
+ debug(5, "FoolGame::sub_133_f04: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:1002
this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ debug(5, "FoolGame::sub_133_f04: Draw pic 1 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
}
-void FoolGame::polyominoBadMove() {
+void FoolGame::polyominoOnClickFixed() {
// 133:10a0
this->var_i16_484 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
this->var_i16_7e4 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
@@ -399,8 +445,10 @@ void FoolGame::polyominoBadMove() {
// why do this???
// best guess: flashing the shape a few times before knocking it back
// 133:1188
+ debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", this->var_i16_484, this->var_i16_7e4);
for (int i = 0; i <= 9; i++) {
g_zbasic->picture(this->var_i16_484, this->var_i16_7e4, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ g_toolbox->Delay(0);
}
// 133:11c2
this->polyominoDrawFrame();
@@ -409,6 +457,7 @@ void FoolGame::polyominoBadMove() {
void FoolGame::sub_133_11cc() {
// 133:11cc
+ // zero out collision grid
for (int j = 1; j <= this->arr_i16_1eb8[1] + 1; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0] + 1; i++) {
this->arr_i16_2f38[i*32 + j] = 0;
@@ -433,10 +482,10 @@ void FoolGame::polyominoDrawFrame() {
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
Common::Rect temp;
- temp.top = this->arr_i16_1eb8[12];
- temp.left = this->arr_i16_1eb8[13];
- temp.bottom = this->arr_i16_1eb8[14];
- temp.right = this->arr_i16_1eb8[15];
+ temp.top = this->arr_i16_1eb8[0x12];
+ temp.left = this->arr_i16_1eb8[0x13];
+ temp.bottom = this->arr_i16_1eb8[0x14];
+ temp.right = this->arr_i16_1eb8[0x15];
g_toolbox->FrameRect(temp);
g_toolbox->PenNormal();
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
new file mode 100644
index 00000000000..c8606c7519f
--- /dev/null
+++ b/engines/fool/fool_wordsearch.cpp
@@ -0,0 +1,395 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// word search game
+void FoolGame::sub_131_004() {
+ // 131:0004
+ this->sub_128_271a();
+ this->var_str_188e = this->puzzlesReadString();
+ for (int i = 0; i <= 0xe; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ // 131:0042
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
+ do {
+ this->var_i16_68a = this->arr_i16_1eb8[0xa];
+ do {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a,
+ this->var_i16_68c,
+ this->var_i16_68a + this->arr_i16_1eb8[0xd] - 1,
+ this->var_i16_68c + this->arr_i16_1eb8[0xc] - 1
+ );
+ // 131:00d4
+ } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
+ } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ // 131:0134
+ this->var_i16_484 = 0;
+
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_2f38[i*32 + j] = 0;
+ this->arr_i16_3b38[i*32 + j] = 0;
+ }
+ }
+
+ // 131:01b6
+ this->var_i16_198e = this->puzzlesReadShort();
+ if (this->var_str_c06 == g_zbasic->str(191)) { // blank str
+ this->var_str_c06 = g_zbasic->space(this->var_i16_198e);
+ } else {
+ // 131:01f2
+ this->arr_i16_4758[0] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, this->var_i16_198e + 1, 2));
+ for (int i = 1; i <= this->arr_i16_4758[0]; i++) {
+ this->arr_i16_4758[i] = g_zbasic->unk_310(g_zbasic->midStr(
+ this->var_str_c06,
+ this->var_i16_198e + 1 + i*2,
+ 2
+ ));
+ }
+ // 131:0282
+ this->var_i16_484 = 0;
+ this->var_i16_106a = 1;
+ this->var_i16_68c = 1;
+
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ // 131:029a
+ if ((this->arr_i16_4758[this->var_i16_106a] & this->bitLUT[this->var_i16_484]) != 0) {
+ this->arr_i16_2f38[i*32 + j] = 1;
+ }
+ // 131:02e8
+ this->var_i16_484++;
+ if (this->var_i16_484 == 0x10) {
+ this->var_i16_484 = 0;
+ }
+ // 131:0300
+ this->var_i16_106a++;
+ }
+ }
+ // 131:0336
+
+ }
+ // 131:0336
+ this->var_i16_1990 = 0;
+ this->var_i16_68a = 1;
+ for (int i = 1; i <= this->var_i16_198e; i++) {
+ this->arr_i16_3738[i] = (int16)strtol(g_zbasic->midStr(this->var_str_c06, i, 1).encode(Common::kMacRoman).c_str(), nullptr, 10);
+ if (this->arr_i16_3738[i] != 0) {
+ this->var_i16_1990++;
+ }
+ // 131:038e
+ }
+ // 131:039e
+ this->var_i16_1992 = 1;
+ do {
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
+ g_zbasic->indexSet(g_zbasic->str(192), this->var_i16_1992, 1); // blank string
+ this->var_i16_484 = 1;
+ do {
+ this->var_str_384 = g_zbasic->midStr(
+ g_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e),
+ this->var_i16_484,
+ 1
+ );
+ // 131:0418
+ if (this->var_str_384 != g_zbasic->str(193)) { // string
+ g_zbasic->indexSet(g_zbasic->index(1, this->var_i16_1992) + this->var_str_384, 1, this->var_i16_1992);
+ }
+ // 131:045c
+ this->var_i16_484++;
+ } while (g_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e).size() >= this->var_i16_484);
+
+ // 131:0480
+ this->var_i16_1992++;
+ } while (this->var_i16_198e >= this->var_i16_1992);
+
+ // 131:0492
+ g_toolbox->PenNormal();
+ this->var_str_384 = this->var_str_188e;
+ this->sub_131_d22();
+ g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenMode(kPatBic);
+ g_zbasic->unk_20();
+ // 131:04e0
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ this->var_str_1994 = this->puzzlesReadString();
+ this->var_i16_1574 = 1 + (j - 1) * this->arr_i16_1eb8[0];
+ // 131:051e
+ this->arr_rect_5b7c.top = this->arr_rect_1f38[this->var_i16_1574].top - 1;
+ this->arr_rect_5b7c.left = 0;
+ this->arr_rect_5b7c.bottom = this->arr_rect_1f38[this->var_i16_1574].bottom + 1;
+ this->arr_rect_5b7c.right = SCREEN_WIDTH;
+ g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[0]);
+ // 131:05b0
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->var_i16_1574 = i + (j - 1) * this->arr_i16_1eb8[0];
+ this->var_str_384 = g_zbasic->midStr(this->var_str_1994, i, 1);
+ this->arr_i16_3b38[i*32 + j] = g_zbasic->asc(this->var_str_384);
+
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
+ this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ );
+ g_toolbox->DrawString(this->var_str_384);
+ // 131:069e
+ if (this->arr_i16_2f38[i*32 + j] != 0) {
+ g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_1574]);
+ }
+ // 131:06dc
+ }
+ // 131:06f8
+ }
+ // 131:0714
+ g_toolbox->PenNormal();
+ if ((this->var_i16_1990 > 0) && (this->var_i16_1990 < this->var_i16_198e)) {
+ // only X to go
+ this->var_str_384 = g_zbasic->str(194) + Common::U32String::format(" %d", this->var_i16_19ae - this->var_i16_1990) + g_zbasic->str(195);
+ this->sub_131_d22();
+ }
+ // 131:077a
+ this->var_str_9f4 = Common::U32String::format("%d", this->var_i16_198e);
+ if (this->var_i16_7e2 != 0x50) {
+ // There are X words hidden below
+ this->var_str_384 = g_zbasic->str(196) + this->var_str_9f4 + g_zbasic->str(197);
+ g_zbasic->menu(8, 3, 1, this->var_str_384);
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(198));
+ } else {
+ // 131:07f8
+ this->var_str_384 = g_zbasic->str(199) + this->var_str_9f4 + g_zbasic->str(200);
+ g_zbasic->menu(8, 3, 1, this->var_str_384);
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(201));
+ }
+ // 131:084c
+ this->var_i16_7c6 = 0;
+ while ((this->var_i16_7c6 & 1) == 0) {
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_131_8aa();
+ }
+ if (this->var_i16_1990 == this->var_i16_198e) {
+ this->sub_131_f42();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_131_d66();
+ this->sub_128_3536();
+ }
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+ }
+ this->sub_131_d66();
+ // 131:08a6
+
+ // JMP 0x1116
+ // 131:1116
+}
+
+void FoolGame::sub_131_8aa() {
+ // 131:08aa
+ this->var_i16_1a94 = 0;
+ this->var_str_1070 = g_zbasic->str(202); // blank
+ this->var_i16_1a96 = -1;
+ this->var_i16_1a98 = -1;
+
+ while ((this->var_ev_46.modifiers & 0x80) == 0) {
+ // 131:08d4
+ this->sub_128_c6a(0);
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
+ if ((this->var_i16_68a == this->var_i16_1a96) && (this->var_i16_68c == this->var_i16_1a98)) {
+ // 131:0934
+ this->var_i16_1574 = this->var_i16_68a + (this->var_i16_68c - 1)*this->arr_i16_1eb8[0];
+ this->var_i16_1a96 = this->var_i16_68a;
+ this->var_i16_1a98 = this->var_i16_68c;
+ this->var_str_1070 += g_zbasic->chr(this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]);
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+ this->var_i16_1a94++;
+ // 131:09c4
+ this->arr_i16_4338[this->var_i16_1a94] = this->var_i16_1574;
+ if (this->var_i16_1a94 == 0x64) {
+ this->sub_131_cbe();
+ return;
+ }
+ }
+ // 131:09ec
+ g_toolbox->Delay(0);
+ }
+ // 131:09fc
+ this->var_i16_1a9a = 0;
+ this->var_i16_1a9c = this->arr_i16_4338[2] - this->arr_i16_4338[1];
+ this->var_i16_68a = 1;
+ for (int i = 1; i <= this->var_i16_1a94 - 1; i++) {
+ if (this->arr_i16_4338[this->var_i16_68a + 1] - this->arr_i16_4338[this->var_i16_68a] != this->var_i16_1a9c) {
+ this->var_i16_1a9a = 0x29a;
+ }
+ // 131:0a78
+ }
+ if (this->var_i16_1a9a == 0x29a) {
+ this->sub_131_cbe();
+ return;
+ }
+ this->var_i16_1a9a = 0;
+ // 131:0aa0
+ this->var_i16_68a = 1;
+ for (int i = 1; i <= this->var_i16_198e; i++) {
+ if ((this->var_str_1070 == g_zbasic->index(1, this->var_i16_68a)) && (this->arr_i16_3738[i] == 0)) {
+ // 131:0ae0
+ this->var_i16_1a9a = i;
+ this->arr_i16_3738[i] = 1;
+ }
+ // 131:0af8
+ }
+ if (this->var_i16_1a9a == 0) {
+ this->sub_131_cbe();
+ return;
+ }
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenMode(kPatBic);
+ for (int i = 1; i <= this->var_i16_1a94; i++) {
+ this->sub_128_50e(0xa + g_zbasic->rndInt(0x3e8), 0x28, 1);
+ // 131:0b54
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ g_toolbox->PaintRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ this->var_i16_484 = ((this->arr_i16_4338[i] - 1) % this->arr_i16_1eb8[0]) + 1;
+ // 131:0bce
+ this->var_i16_7e4 = ((this->arr_i16_4338[i] - 1) / this->arr_i16_1eb8[0]) + 1;
+ this->arr_i16_2f38[this->var_i16_484*32 + this->var_i16_7e4] = 1;
+ }
+ // 131:0c32
+ g_toolbox->PenNormal();
+ this->var_i16_1990++;
+ if (this->var_i16_1990 == this->var_i16_198e) {
+ this->var_str_384 = g_zbasic->str(203); // blank
+ this->sub_131_d22();
+ return;
+ }
+ // 131:0c64
+ this->var_str_384 = g_zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + g_zbasic->str(204) + Common::U32String::format("%d", this->var_i16_198e - this->var_i16_1990) + g_zbasic->str(205); // WORD... only X to go
+ this->sub_131_d22();
+ this->sub_128_6186();
+}
+
+void FoolGame::sub_131_cbe() {
+ // 131:0cbe
+ this->sub_128_50e(0x14, 0x64, 0);
+ for (int i = 1; i <= this->var_i16_1a94; i++) {
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ }
+ // 131:0d0a
+ this->var_i16_1a96 = -1;
+ this->var_i16_1a98 = -1;
+ this->var_i16_1a94 = 0;
+ this->sub_128_6186();
+}
+
+void FoolGame::sub_131_d22() {
+ // 131:0d22
+ this->fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ this->var_i16_7a2 = 0x152;
+ this->sub_128_918(this->var_str_384);
+}
+
+void FoolGame::sub_131_d66() {
+ // 131:0d66
+ this->var_str_c06 = g_zbasic->str(206); // empty
+ for (int i = 1; i <= this->var_i16_198e; i++) {
+ this->var_str_384 = Common::U32String::format("%d", this->arr_i16_3738[i]);
+ this->var_str_c06 += g_zbasic->rightStr(this->var_str_384, 1);
+ }
+ // 131:0dd6
+ this->var_i16_484 = 0;
+ this->var_i16_106a = 1;
+ this->arr_i16_4758[0] = 1;
+ this->arr_i16_4758[1] = 0;
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ if (this->arr_i16_2f38[i*32 + j] != 0) {
+ this->arr_i16_4758[this->var_i16_106a] = this->arr_i16_4758[this->var_i16_106a] | this->bitLUT[this->var_i16_484];
+ }
+ // 131:0e72
+ this->var_i16_484++;
+ if (this->var_i16_484 == 0x10) {
+ this->var_i16_484 = 0;
+ this->var_i16_106a++;
+ this->arr_i16_4758[this->var_i16_106a] = 0;
+ this->arr_i16_4758[0]++;
+ }
+ // 131:0ebe
+ }
+ }
+ // 131:0ef6
+ for (int i = 0; i <= this->arr_i16_4758[0]; i++) {
+ this->var_str_c06 += g_zbasic->unk_88(this->arr_i16_4758[i]);
+ }
+}
+
+void FoolGame::sub_131_f42() {
+ // 131:0f42
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ }
+ // 131:0f52
+ this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ g_zbasic->text(0xfb, this->arr_i16_1eb8[0xc], 0, kSrcOr);
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ if (this->arr_i16_2f38[i*32 + j] != 0) {
+ // 131:0fc8
+ this->var_i16_1574 = i + (j - 1)* this->arr_i16_1eb8[0];
+ g_toolbox->EraseRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
+ this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ );
+ // 131:107a
+ this->var_str_384 = g_zbasic->chr(this->arr_i16_3b38[i*32 + j]);
+ g_toolbox->DrawString(this->var_str_384);
+ }
+ // 131:10b0
+ }
+ }
+ // 131:10e8
+ this->fillRect(0x1eb, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
+ this->sub_128_2664();
+ this->sub_128_61c2();
+ this->var_i16_7c6 = 1;
+}
+
+
+
+};
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 10956b4eb46..f04dad5fce0 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS = \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
+ fool_wordsearch.o \
toolbox.o \
toolbox_fileman.o \
toolbox_menu.o \
diff --git a/engines/fool/toolbox_pict.cpp b/engines/fool/toolbox_pict.cpp
index 579843c64c1..519f773ab91 100644
--- a/engines/fool/toolbox_pict.cpp
+++ b/engines/fool/toolbox_pict.cpp
@@ -257,6 +257,8 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
Common::MemoryReadStream stream(myPicture->picData.data(), myPicture->picData.size(), DisposeAfterUse::NO);
+ dstRect.debugPrintC(5, kDebugGraphics, "Toolbox::DrawPicture: drawing at ");
+
if (debugChannelSet(8, kDebugGraphics)) {
debugC(8, kDebugGraphics, "Toolbox::DrawPicture: image contents");
stream.hexdump(stream.size());
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index e52f96030c3..6b8cd7b69fb 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -53,7 +53,6 @@ void Toolbox::DrawString(const Common::U32String &s) {
destPos.y += _port->portRect.top;
Common::Rect result = blitMono(buffer, _port->portBits, mask, destPos, _port->txMode);
- _port->pnLoc.x += bbox.width();
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(result);
_defaultWindow->setDirty(true);
@@ -66,6 +65,8 @@ void Toolbox::DrawString(const Common::U32String &s) {
_port->picSave->pushOpU16(kOpTxSize, _port->txSize);
_port->picSave->pushOpPointStr(kOpLongText, _port->pnLoc, macString);
}
+
+ _port->pnLoc.x += bbox.width();
}
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 231a9e34d58..86c9804a744 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -177,6 +177,12 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
+int16 ZBasic::asc(const Common::U32String &str) {
+ if (str.empty())
+ return 0;
+ return str.encode(Common::kMacRoman)[0];
+}
+
void ZBasic::blockMove(void *srcptr, void *destptr, uint16 size) {
memmove(destptr, srcptr, size);
}
@@ -516,6 +522,14 @@ void ZBasic::record(int16 fileNo, int16 recordNo, int16 location) {
_fileStreams[fileNo]->seek(_fileLineSize[fileNo]*recordNo + location);
}
+Common::U32String ZBasic::leftStr(const Common::U32String &str, int16 expression) {
+ return str.substr(0, expression);
+}
+
+Common::U32String ZBasic::rightStr(const Common::U32String &str, int16 expression) {
+ return str.substr(str.size() - 1 - expression, expression);
+}
+
int16 ZBasic::rndInt(int16 max) {
if (max == 0)
return 0;
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 1b65fe745a4..445a7e8d414 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -248,6 +248,7 @@ public:
void loadProgram(const Common::Path &path);
void loadSCOT();
+ int16 asc(const Common::U32String &str);
void bufferFlush(const Common::U32String &str);
void blockMove(void *srcptr, void *destptr, uint16 size);
Common::U32String chr(uint16 code);
@@ -261,6 +262,8 @@ public:
bool maybe();
uint32 mem(int16 index);
void menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title);
+ Common::U32String leftStr(const Common::U32String &str, int16 expression);
+ Common::U32String rightStr(const Common::U32String &str, int16 expression);
Common::U32String midStr(const Common::U32String &str, int16 expr1, int16 expr2);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
Commit: 0ff58fcc46a372ccd152b07b35fd83ff2c8c49c7
https://github.com/scummvm/scummvm/commit/0ff58fcc46a372ccd152b07b35fd83ff2c8c49c7
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:07+02:00
Commit Message:
FOOL: Fix ZBasic::rightStr implementation
Changed paths:
engines/fool/zbasic.cpp
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 86c9804a744..88fbcc1760e 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -527,7 +527,7 @@ Common::U32String ZBasic::leftStr(const Common::U32String &str, int16 expression
}
Common::U32String ZBasic::rightStr(const Common::U32String &str, int16 expression) {
- return str.substr(str.size() - 1 - expression, expression);
+ return str.substr(str.size() - expression, expression);
}
int16 ZBasic::rndInt(int16 max) {
@@ -685,7 +685,7 @@ Common::U32String ZBasic::index(int16 table, int16 index) {
warning("ZBasic::index: asked for index %d but only %d entries in table %d", index, _index[table].size(), table);
return Common::U32String();
}
- debugC(5, kDebugLoading, "ZBasic::indexSet: [%d][%d] = %s", table, index, _index[table][index].encode().c_str());
+ debugC(5, kDebugLoading, "ZBasic::index: [%d][%d] = %s", table, index, _index[table][index].encode().c_str());
return _index[table][index];
}
Commit: b22ecdaa0b7edd0d81bf152764995bb2defde56a
https://github.com/scummvm/scummvm/commit/b22ecdaa0b7edd0d81bf152764995bb2defde56a
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:07+02:00
Commit Message:
FOOL: Word search working
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_polyomino.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/toolbox.cpp
engines/fool/toolbox_menu.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index fddeecc8168..0a7c6dbcd31 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -925,6 +925,7 @@ void FoolGame::sub_128_1f76() {
void FoolGame::sub_128_2078() {
+ // clicking the story button
// 128:2078
g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
this->sub_128_6186();
@@ -943,7 +944,7 @@ void FoolGame::sub_128_20d0() {
this->storyNextPage = 1;
return;
}
- if (this->storyNextPage >= this->storyPageCount) {
+ if (this->storyNextPage > this->storyPageCount) {
this->storyNextPage = this->storyPageCount;
return;
}
@@ -1606,7 +1607,7 @@ void FoolGame::sub_128_39a0() {
this->sub_130_004();
break;
case 4:
- this->sub_131_004();
+ this->wordSearchRun();
break;
case 5:
this->jigsawRun();
@@ -1789,8 +1790,11 @@ void FoolGame::sub_128_3fb6() {
// 128:4056
if (this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2] <= this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2 + 1]) {
g_zbasic->menu(8, 2, 0, g_zbasic->str(75)); // line
+ // 128:40c6
+ this->var_i16_484 = 2;
for (int i = this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2]; i <= this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2 + 1]; i++) {
// 128:40f6
+ this->var_i16_484++;
this->var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(76);
g_zbasic->menu(8, this->var_i16_484, 1, this->var_str_384);
}
@@ -2574,7 +2578,7 @@ void FoolGame::sub_129_068() {
this->var_i16_1040++;
}
// 129:0ef4
- if (this->pageToChapter[i] < j) {
+ if (this->pageToChapter[i] > j) {
i = this->storyPageCount;
}
// 129:0f16
@@ -2584,10 +2588,11 @@ void FoolGame::sub_129_068() {
for (int i = 1; i <= this->storyPageCount; i++) {
if (this->pageToChapter[i] == j) {
this->var_i16_484++;
- this->arr_str_1a288[i] = Common::U32String::format("%s %d %s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
+ // - X of N
+ this->arr_str_1a288[i] = Common::U32String::format("%s %d%s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
}
// 129:0fb6
- if (this->pageToChapter[i] < j) {
+ if (this->pageToChapter[i] > j) {
i = this->storyPageCount;
}
// 129:0fd8
@@ -2777,6 +2782,7 @@ void FoolGame::sub_135_004() {
warning("STUB: %s", __func__);
}
+// maze game
void FoolGame::sub_136_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 89c5dcfc382..ee952453790 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -130,12 +130,12 @@ public:
void sub_130_004();
// fool_wordsearch.cpp
- void sub_131_004();
- void sub_131_8aa();
- void sub_131_cbe();
- void sub_131_d22();
- void sub_131_d66();
- void sub_131_f42();
+ void wordSearchRun(); // sub_131_004
+ void wordSearchOnClick(); // sub_131_8aa
+ void wordSearchBadSelect(); // sub_131_cbe
+ void wordSearchDrawFooter(); // sub_131_d22
+ void wordSearchStoreState(); // sub_131_d66
+ void wordSearchSuccess(); // sub_131_f42
// fool_jigsaw.cpp
void jigsawRun(); // sub_132_004
@@ -151,13 +151,13 @@ public:
// fool_polyomino.cpp
void polyominoRun(); // sub_133_004
void polyominoOnClick(); // sub_133_87c
- void sub_133_eb2();
- void sub_133_f04();
+ void polyominoCancelMove(); // sub_133_eb2
+ void polyominoMove(); // sub_133_f04
void polyominoOnClickFixed(); // sub_133_10a0
- void sub_133_11cc();
+ void polyominoReset(); // sub_133_11cc
void polyominoDrawFrame(); // sub_133_12d4
- void sub_133_12f2();
- void sub_133_13e2();
+ void polyominoCheckIfSolved(); // sub_133_12f2
+ void polyominoSuccess(); // sub_133_13e2
void polyominoStoreState(); // sub_133_1452
// fool_reveal.cpp
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 51e3cf03ae4..ef266ed77b3 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -222,11 +222,11 @@ void FoolGame::polyominoRun() {
for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
- this->sub_133_f04();
+ this->polyominoMove();
}
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
- this->sub_133_12f2();
+ this->polyominoCheckIfSolved();
this->var_i16_7c6 = 0;
do {
do {
@@ -242,7 +242,7 @@ void FoolGame::polyominoRun() {
} while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0));
// 133:081c
if (this->var_i16_7c6 == 2) {
- this->sub_133_11cc();
+ this->polyominoReset();
}
if (this->var_i16_7c6 == 4) {
this->polyominoStoreState();
@@ -251,7 +251,7 @@ void FoolGame::polyominoRun() {
} while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0));
// 133:0864
if (this->var_i16_d0c != 0) {
- this->sub_133_13e2();
+ this->polyominoSuccess();
}
this->polyominoStoreState();
@@ -385,26 +385,26 @@ void FoolGame::polyominoOnClick() {
}
// 133:0e6c
if ((this->var_i16_1a9c & this->arr_i16_47d8[this->var_i16_7cc*8]) != 0) {
- this->sub_133_eb2();
+ this->polyominoCancelMove();
} else {
- this->sub_133_f04();
+ this->polyominoMove();
}
// 133:0ea2
this->polyominoDrawFrame();
- this->sub_133_12f2();
+ this->polyominoCheckIfSolved();
this->sub_128_4da(1);
}
-void FoolGame::sub_133_eb2() {
+void FoolGame::polyominoCancelMove() {
// 133:0eb2
this->sub_128_50e(0x14, 0x64, 0);
this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
- sub_133_f04();
+ polyominoMove();
}
-void FoolGame::sub_133_f04() {
+void FoolGame::polyominoMove() {
// 133:0f04
this->var_i16_106a = 0;
// polyominos are max 4x4
@@ -425,13 +425,13 @@ void FoolGame::sub_133_f04() {
// 133:0fce
if (this->var_i16_1ab0 != 0) {
- debug(5, "FoolGame::sub_133_f04: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
+ debug(5, "FoolGame::polyominoMove: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:1002
this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
- debug(5, "FoolGame::sub_133_f04: Draw pic 1 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
+ debug(5, "FoolGame::polyominoMove: Draw pic 1 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
}
@@ -455,7 +455,7 @@ void FoolGame::polyominoOnClickFixed() {
this->sub_128_6186();
}
-void FoolGame::sub_133_11cc() {
+void FoolGame::polyominoReset() {
// 133:11cc
// zero out collision grid
for (int j = 1; j <= this->arr_i16_1eb8[1] + 1; j++) {
@@ -469,7 +469,7 @@ void FoolGame::sub_133_11cc() {
for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 5];
this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 6];
- this->sub_133_f04();
+ this->polyominoMove();
}
// 133:12c2
this->var_i16_1ab0 = 1;
@@ -490,7 +490,7 @@ void FoolGame::polyominoDrawFrame() {
g_toolbox->PenNormal();
}
-void FoolGame::sub_133_12f2() {
+void FoolGame::polyominoCheckIfSolved() {
// 133:12f2
this->var_i16_d0c = 1;
this->var_i16_484 = 0;
@@ -512,7 +512,7 @@ void FoolGame::sub_133_12f2() {
}
}
-void FoolGame::sub_133_13e2() {
+void FoolGame::polyominoSuccess() {
// 133:13e2
if (this->var_i16_c04 < 0x64) {
this->var_i16_c04 = 0x64;
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index c8606c7519f..67b54578da4 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -30,7 +30,7 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// word search game
-void FoolGame::sub_131_004() {
+void FoolGame::wordSearchRun() {
// 131:0004
this->sub_128_271a();
this->var_str_188e = this->puzzlesReadString();
@@ -43,7 +43,7 @@ void FoolGame::sub_131_004() {
do {
this->var_i16_68a = this->arr_i16_1eb8[0xa];
do {
- this->var_i16_484++;
+ this->var_i16_484++;
g_toolbox->SetRect(
this->arr_rect_1f38[this->var_i16_484],
this->var_i16_68a,
@@ -65,6 +65,7 @@ void FoolGame::sub_131_004() {
}
// 131:01b6
+ // total hidden word count
this->var_i16_198e = this->puzzlesReadShort();
if (this->var_str_c06 == g_zbasic->str(191)) { // blank str
this->var_str_c06 = g_zbasic->space(this->var_i16_198e);
@@ -93,9 +94,9 @@ void FoolGame::sub_131_004() {
this->var_i16_484++;
if (this->var_i16_484 == 0x10) {
this->var_i16_484 = 0;
+ this->var_i16_106a++;
}
// 131:0300
- this->var_i16_106a++;
}
}
// 131:0336
@@ -115,7 +116,7 @@ void FoolGame::sub_131_004() {
this->var_i16_1992 = 1;
do {
g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
- g_zbasic->indexSet(g_zbasic->str(192), this->var_i16_1992, 1); // blank string
+ g_zbasic->indexSet(g_zbasic->str(192), 1, this->var_i16_1992); // blank string
this->var_i16_484 = 1;
do {
this->var_str_384 = g_zbasic->midStr(
@@ -129,7 +130,7 @@ void FoolGame::sub_131_004() {
}
// 131:045c
this->var_i16_484++;
- } while (g_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e).size() >= this->var_i16_484);
+ } while ((int16)(g_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e).size()) >= this->var_i16_484);
// 131:0480
this->var_i16_1992++;
@@ -138,7 +139,7 @@ void FoolGame::sub_131_004() {
// 131:0492
g_toolbox->PenNormal();
this->var_str_384 = this->var_str_188e;
- this->sub_131_d22();
+ this->wordSearchDrawFooter();
g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->PenMode(kPatBic);
@@ -176,11 +177,11 @@ void FoolGame::sub_131_004() {
g_toolbox->PenNormal();
if ((this->var_i16_1990 > 0) && (this->var_i16_1990 < this->var_i16_198e)) {
// only X to go
- this->var_str_384 = g_zbasic->str(194) + Common::U32String::format(" %d", this->var_i16_19ae - this->var_i16_1990) + g_zbasic->str(195);
- this->sub_131_d22();
+ this->var_str_384 = g_zbasic->str(194) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + g_zbasic->str(195);
+ this->wordSearchDrawFooter();
}
// 131:077a
- this->var_str_9f4 = Common::U32String::format("%d", this->var_i16_198e);
+ this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_198e);
if (this->var_i16_7e2 != 0x50) {
// There are X words hidden below
this->var_str_384 = g_zbasic->str(196) + this->var_str_9f4 + g_zbasic->str(197);
@@ -197,29 +198,29 @@ void FoolGame::sub_131_004() {
while ((this->var_i16_7c6 & 1) == 0) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
- this->sub_131_8aa();
+ this->wordSearchOnClick();
}
if (this->var_i16_1990 == this->var_i16_198e) {
- this->sub_131_f42();
+ this->wordSearchSuccess();
}
if (this->var_i16_7c6 == 4) {
- this->sub_131_d66();
+ this->wordSearchStoreState();
this->sub_128_3536();
}
if (this->var_ev_46.what == kNullEvent) {
g_toolbox->Delay(0);
}
}
- this->sub_131_d66();
+ this->wordSearchStoreState();
// 131:08a6
// JMP 0x1116
// 131:1116
}
-void FoolGame::sub_131_8aa() {
+void FoolGame::wordSearchOnClick() {
// 131:08aa
- this->var_i16_1a94 = 0;
+ this->var_i16_1a94 = 0; // length of word selected
this->var_str_1070 = g_zbasic->str(202); // blank
this->var_i16_1a96 = -1;
this->var_i16_1a98 = -1;
@@ -229,7 +230,7 @@ void FoolGame::sub_131_8aa() {
this->sub_128_c6a(0);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
- if ((this->var_i16_68a == this->var_i16_1a96) && (this->var_i16_68c == this->var_i16_1a98)) {
+ if (!((this->var_i16_68a == this->var_i16_1a96) && (this->var_i16_68c == this->var_i16_1a98))) {
// 131:0934
this->var_i16_1574 = this->var_i16_68a + (this->var_i16_68c - 1)*this->arr_i16_1eb8[0];
this->var_i16_1a96 = this->var_i16_68a;
@@ -240,13 +241,14 @@ void FoolGame::sub_131_8aa() {
// 131:09c4
this->arr_i16_4338[this->var_i16_1a94] = this->var_i16_1574;
if (this->var_i16_1a94 == 0x64) {
- this->sub_131_cbe();
+ this->wordSearchBadSelect();
return;
}
}
// 131:09ec
g_toolbox->Delay(0);
}
+ debugC(5, kDebugLoading, "wordSearchOnClick: pos (%d, %d)", this->var_i16_1a96, this->var_i16_1a98);
// 131:09fc
this->var_i16_1a9a = 0;
this->var_i16_1a9c = this->arr_i16_4338[2] - this->arr_i16_4338[1];
@@ -258,14 +260,14 @@ void FoolGame::sub_131_8aa() {
// 131:0a78
}
if (this->var_i16_1a9a == 0x29a) {
- this->sub_131_cbe();
+ this->wordSearchBadSelect();
return;
}
this->var_i16_1a9a = 0;
// 131:0aa0
- this->var_i16_68a = 1;
+ // check selected string against the remaining word list
for (int i = 1; i <= this->var_i16_198e; i++) {
- if ((this->var_str_1070 == g_zbasic->index(1, this->var_i16_68a)) && (this->arr_i16_3738[i] == 0)) {
+ if ((this->var_str_1070 == g_zbasic->index(1, i)) && (this->arr_i16_3738[i] == 0)) {
// 131:0ae0
this->var_i16_1a9a = i;
this->arr_i16_3738[i] = 1;
@@ -273,20 +275,26 @@ void FoolGame::sub_131_8aa() {
// 131:0af8
}
if (this->var_i16_1a9a == 0) {
- this->sub_131_cbe();
+ this->wordSearchBadSelect();
return;
}
+ // found a word, update the screen
g_toolbox->PenNormal();
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->PenMode(kPatBic);
+ // for every letter in the word
for (int i = 1; i <= this->var_i16_1a94; i++) {
+ // play a tone
this->sub_128_50e(0xa + g_zbasic->rndInt(0x3e8), 0x28, 1);
// 131:0b54
+ // remove the inverted square
g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ // paint the square with white checkerboard
g_toolbox->PaintRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
this->var_i16_484 = ((this->arr_i16_4338[i] - 1) % this->arr_i16_1eb8[0]) + 1;
// 131:0bce
this->var_i16_7e4 = ((this->arr_i16_4338[i] - 1) / this->arr_i16_1eb8[0]) + 1;
+ // add the square to the selected list
this->arr_i16_2f38[this->var_i16_484*32 + this->var_i16_7e4] = 1;
}
// 131:0c32
@@ -294,18 +302,20 @@ void FoolGame::sub_131_8aa() {
this->var_i16_1990++;
if (this->var_i16_1990 == this->var_i16_198e) {
this->var_str_384 = g_zbasic->str(203); // blank
- this->sub_131_d22();
+ this->wordSearchDrawFooter();
return;
}
// 131:0c64
- this->var_str_384 = g_zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + g_zbasic->str(204) + Common::U32String::format("%d", this->var_i16_198e - this->var_i16_1990) + g_zbasic->str(205); // WORD... only X to go
- this->sub_131_d22();
+ this->var_str_384 = g_zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + g_zbasic->str(204) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + g_zbasic->str(205); // WORD... only X to go
+ this->wordSearchDrawFooter();
this->sub_128_6186();
}
-void FoolGame::sub_131_cbe() {
+void FoolGame::wordSearchBadSelect() {
// 131:0cbe
+ // play failure noise
this->sub_128_50e(0x14, 0x64, 0);
+ // uninvert all highlighted boxes
for (int i = 1; i <= this->var_i16_1a94; i++) {
g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
}
@@ -316,7 +326,7 @@ void FoolGame::sub_131_cbe() {
this->sub_128_6186();
}
-void FoolGame::sub_131_d22() {
+void FoolGame::wordSearchDrawFooter() {
// 131:0d22
this->fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
@@ -324,7 +334,7 @@ void FoolGame::sub_131_d22() {
this->sub_128_918(this->var_str_384);
}
-void FoolGame::sub_131_d66() {
+void FoolGame::wordSearchStoreState() {
// 131:0d66
this->var_str_c06 = g_zbasic->str(206); // empty
for (int i = 1; i <= this->var_i16_198e; i++) {
@@ -358,14 +368,14 @@ void FoolGame::sub_131_d66() {
}
}
-void FoolGame::sub_131_f42() {
+void FoolGame::wordSearchSuccess() {
// 131:0f42
if (this->var_i16_c04 < 0x64) {
this->var_i16_c04 = 0x64;
}
// 131:0f52
this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
- g_zbasic->text(0xfb, this->arr_i16_1eb8[0xc], 0, kSrcOr);
+ g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
if (this->arr_i16_2f38[i*32 + j] != 0) {
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 0de7ae7eefb..63a86c8cea3 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -48,7 +48,7 @@ void Toolbox::_pumpEvents() {
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
_mouse = event.mouse;
- _modifiers &= !0x80;
+ _modifiers &= ~kModMouseButtonUp;
newRecord.what = kMouseDown;
newRecord.where = _mouse;
newRecord.modifiers = _modifiers;
@@ -57,7 +57,7 @@ void Toolbox::_pumpEvents() {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
_mouse = event.mouse;
- _modifiers |= 0x80;
+ _modifiers |= kModMouseButtonUp;
newRecord.what = kMouseUp;
newRecord.where = _mouse;
newRecord.modifiers = _modifiers;
@@ -106,7 +106,7 @@ uint32 Toolbox::Delay(uint32 numTicks) {
void Toolbox::FlushEvents(uint32 eventMask, uint32 stopMask) {
if ((eventMask == 0xffffffff) && (stopMask == 0)) {
_events.clear();
- _modifiers = kModMouseButtonUp;
+ //_modifiers = kModMouseButtonUp;
return;
}
for (auto it = _events.begin(); it != _events.end(); ) {
@@ -118,9 +118,9 @@ void Toolbox::FlushEvents(uint32 eventMask, uint32 stopMask) {
++it;
}
}
- if (eventMask & 0x6) {
- _modifiers = kModMouseButtonUp;
- }
+ //if (eventMask & 0x6) {
+ // _modifiers = kModMouseButtonUp;
+ //}
}
bool Toolbox::GetNextEvent(uint32 eventMask, EventRecord &theEvent) {
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index db475acc759..0a13ba8d1b6 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -172,6 +172,8 @@ uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
}
_updateScreen();
}
+ // must have released the mouse button to exit the menu
+ _modifiers |= kModMouseButtonUp;
int menuItem = _defaultMenu->getLastSelectedMenuItem();
int menuSubItem = _defaultMenu->getLastSelectedSubmenuItem();
if ((menuItem != -1) && (menuSubItem != -1)) {
Commit: 66fad4b7fe2c25f74e7c4a9df2086a98542f1404
https://github.com/scummvm/scummvm/commit/66fad4b7fe2c25f74e7c4a9df2086a98542f1404
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:07+02:00
Commit Message:
FOOL: Fix About and Quit menu options
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox.h
engines/fool/toolbox_pict.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/utils.cpp
engines/fool/utils.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 0a7c6dbcd31..cdde50297ea 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -466,7 +466,7 @@ void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16
g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[patternID]);
}
-void FoolGame::sub_128_918(Common::U32String &unk1) {
+void FoolGame::sub_128_918(const Common::U32String &unk1) {
// 128:0918
g_zbasic->stringCopy(this->var_str_172, unk1);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
@@ -602,7 +602,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_7b4 = this->var_i16_7ae*0x46;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
- for (int i = 0; i < this->var_i16_7ac; i++) {
+ for (int i = 0; i <= this->var_i16_7ac; i++) {
// 128:0e86
this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[this->var_i16_7ba]);
if (this->var_i16_7ba > this->var_i16_7b4) {
@@ -638,9 +638,8 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->PenNormal();
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
// 128:1056
- for (int i = 0; i < this->var_i16_7ac; i++) {
- this->var_i16_7b8 = 0;
- this->var_str_384 = this->arr_str_1a8d8[this->var_i16_7b8];
+ for (int i = 0; i <= this->var_i16_7ac; i++) {
+ this->var_str_384 = this->arr_str_1a8d8[i];
this->sub_128_918(this->var_str_384);
// 128:1086
// 128:1086: CLR.W - -0x772(A5)
@@ -1223,7 +1222,15 @@ void FoolGame::sub_128_2a92() {
// quit
void FoolGame::sub_128_2ab6() {
- warning("STUB: %s", __func__);
+ this->sub_128_32fa();
+ if (this->var_i16_7be == 3) {
+ return;
+ }
+ if ((this->var_i16_7ce & 1) != 0) {
+ this->sub_128_1c2c(0x21);
+ } else {
+ this->sub_128_1c2c(0x20);
+ }
}
// print story
@@ -1981,7 +1988,159 @@ void FoolGame::sub_128_4472() {
// about screen
void FoolGame::sub_128_4a92() {
- warning("STUB: %s", __func__);
+ // 128:4a92
+ if (this->var_str_8ec == g_zbasic->str(77)) {
+ // untitled game in progress
+ this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + g_zbasic->str(78) + g_zbasic->chr(0x22) + g_zbasic->str(79);
+ } else {
+ // 128:4aee
+ this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + this->var_str_8ec + g_zbasic->chr(0x22) + g_zbasic->str(80);
+ }
+ // 128:4b28
+ this->arr_str_1a8d8[1] = g_zbasic->str(81);
+ if (this->var_i16_7d2 == 0) {
+
+ this->var_i16_68c = 0x51;
+ this->var_i16_68a = 1;
+ for (int i = 1; i <= 0x51; i++) {
+ if ((this->arr_i16_1d24[i] & 3) != 0) {
+ this->var_i16_68c--;
+ }
+ }
+ // 128:4b88
+ if (this->var_i16_68c >= 0) {
+ // sun's map is incomplete
+ this->arr_str_1a8d8[2] = g_zbasic->str(82);
+ if (this->var_i16_68c == 1) {
+ // there is 1 missing piece
+ this->arr_str_1a8d8[3] = g_zbasic->str(83);
+ } else {
+ // 128:4bde
+ // there are N missing pieces
+ this->arr_str_1a8d8[3] = Common::U32String::format("%s %d%s", g_zbasic->str(84).encode().c_str(), this->var_i16_68c, g_zbasic->str(85).encode().c_str());
+ }
+ // 128:4c1a
+ this->var_i16_68c = 0;
+ for (int i = 2; i <= 0x50; i++) {
+ this->var_i16_68a = 2;
+ if ((this->arr_i16_1c5a[i] < 0x63) && (this->arr_i16_18b2[i] > 0)) {
+ this->var_i16_68c++;
+ }
+ }
+ // 128:4c74
+ // blank
+ this->arr_str_1a8d8[4] = g_zbasic->str(86);
+ if (this->var_i16_68c == 1) {
+ // There is 1 unsolved puzzle.
+ this->arr_str_1a8d8[5] = g_zbasic->str(87);
+ } else {
+ // 128:4cc0
+ // There are X unsolved puzzles.
+ this->arr_str_1a8d8[5] = Common::U32String::format("%s %d%s", g_zbasic->str(88).encode().c_str(), this->var_i16_68c, g_zbasic->str(89).encode().c_str());
+ }
+ // 128:4cfc
+ this->var_i16_d06 = 5;
+
+ } else {
+ // 128:4d06
+ // You have all the map pieces, but they are not arranged in the correct order.
+ this->arr_str_1a8d8[2] = g_zbasic->str(90);
+ this->arr_str_1a8d8[3] = g_zbasic->str(91);
+ this->arr_str_1a8d8[4] = g_zbasic->str(92);
+ this->arr_str_1a8d8[5] = g_zbasic->str(93);
+ // Only the Book of Thoth remains unsolved.
+ this->arr_str_1a8d8[6] = g_zbasic->str(94);
+ this->arr_str_1a8d8[7] = g_zbasic->str(95);
+ this->var_i16_d06 = 7;
+ }
+ // 128:4dc0
+ } else {
+ // 128:4dc4
+ // The sun's map is restored.
+ this->arr_str_1a8d8[2] = g_zbasic->str(96);
+ this->arr_str_1a8d8[3] = g_zbasic->str(97);
+ // Only the Book of Thoth remains unsolved.
+ this->arr_str_1a8d8[4] = g_zbasic->str(98);
+ this->arr_str_1a8d8[5] = g_zbasic->str(99);
+ this->var_i16_d06 = 5;
+ }
+ // 128:4e42
+ g_toolbox->SetPort(this->var_i32_4);
+ this->var_i16_7b2 = 0xa;
+ g_toolbox->InitCursor();
+ this->sub_128_4da(1);
+ this->sub_128_0a2(0, 0x6d60);
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ this->var_i16_7b4 = 0;
+ this->var_i16_7b6 = 0;
+ this->var_i16_7b8 = 0;
+ for (int i = 0; i <= this->var_i16_d06 ; i++) {
+ this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[i]);
+ if (this->var_i16_7ba > this->var_i16_7b4) {
+ this->var_i16_7b4 = this->var_i16_7ba;
+ }
+ // 128:4ec4
+ this->var_i16_7b6 += 0x11;
+ }
+ // 128:4eda
+ this->var_i16_7b6 += 0xd;
+ this->var_i16_7b4 = (this->var_i16_7b4/2) + 0xf;
+ this->var_i16_7b6 = (this->var_i16_7b6/2);
+ g_toolbox->SetRect(
+ this->arr_rect_5b7c,
+ 0xf5 - this->var_i16_7b4,
+ 0x6e - this->var_i16_7b6,
+ 0x10b + this->var_i16_7b4,
+ 0xcf + this->var_i16_7b6
+ );
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[0]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ // 128:4f6a
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 1, 1);
+ g_toolbox->PenSize(5, 5);
+ g_toolbox->PenPat(this->arr_pat_58f4[2]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
+ g_toolbox->PenSize(5, 5);
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->FrameRect(this->arr_rect_5b7c);
+ // 128:4fe2
+ g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
+ g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[0]);
+ g_toolbox->PenNormal();
+ // 128:5014
+ g_toolbox->SetRect(
+ this->arr_rect_5b7c,
+ 0xb5,
+ 0x82 - this->var_i16_7b6,
+ 0xd5,
+ 0x82 - this->var_i16_7b6 + 0x20
+ );
+ g_toolbox->PlotIcon(this->arr_rect_5b7c, this->var_i32_c);
+ // the fool's errand
+ g_toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
+ g_toolbox->DrawString(g_zbasic->str(100));
+ // by Cliff Johnson
+ g_toolbox->MoveTo(0xee, 0x9b - this->var_i16_7b6);
+ g_toolbox->DrawString(g_zbasic->str(101));
+
+ // 128:509a
+ this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
+ for (int i = 0; i <= this->var_i16_d06; i++) {
+ this->var_str_384 = this->arr_str_1a8d8[i];
+ this->sub_128_918(this->var_str_384);
+ this->var_i16_7a2 += 0x11;
+ }
+ // 128:50f4
+ g_zbasic->text(0xfc, 0x9, 0, kSrcOr);
+ this->var_i16_7a2 += 0xe;
+ this->sub_128_918(g_zbasic->str(102)); // version string
+ this->sub_128_2664();
+ this->sub_128_61c2();
+ g_toolbox->DrawMenuBar();
+ this->sub_128_0a2(0x1, 0x6d60);
+ g_toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_128_5140() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index ee952453790..32738d0e8cf 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -57,7 +57,7 @@ public:
void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_712(int16 unk3, int16 unk2, int16 unk1);
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
- void sub_128_918(Common::U32String &unk1);
+ void sub_128_918(const Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_c6a(int16 unk1);
@@ -274,6 +274,7 @@ private:
int16 var_i16_c04;
Common::U32String var_str_c06;
+ int16 var_i16_d06;
int16 var_i16_d0c;
int16 var_i16_e12;
int16 var_i16_e14;
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 45e632dd66b..515c66543a4 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -1132,6 +1132,12 @@ public:
// new pen dimensions.
void PenSize(uint16 width, uint16 height);
+ // PROCEDURE PlotIcon (theRect: Rect; theIcon: Handle);
+ // Plotlcon draws the icon whose handle is thelcon in the rectangle theRect, which is in the local
+ // coordinates of the current grafPort. It calls the QuickDraw procedure CopyBits and uses the
+ // srcCopy transfer mode.
+ void PlotIcon(const Common::Rect &theRect, const Handle &theIcon);
+
// PROCEDURE PortSize (width,height: INTEGER);
// PortSize changes the size of the current grafPort's portRect. This does not affect the screen; it
// merely changes the size of the "active area" of the grafPort.
diff --git a/engines/fool/toolbox_pict.cpp b/engines/fool/toolbox_pict.cpp
index 519f773ab91..9d1c2036fbd 100644
--- a/engines/fool/toolbox_pict.cpp
+++ b/engines/fool/toolbox_pict.cpp
@@ -51,156 +51,6 @@ void Toolbox::ClosePicture() {
}
}
-Common::Rect readRect(Common::SeekableReadStream &stream) {
- Common::Rect result;
- result.top = stream.readSint16BE();
- result.left = stream.readSint16BE();
- result.bottom = stream.readSint16BE();
- result.right = stream.readSint16BE();
- return result;
-}
-
-Common::Point readPoint(Common::SeekableReadStream &stream) {
- Common::Point result;
- result.y = stream.readSint16BE();
- result.x = stream.readSint16BE();
- return result;
-}
-
-PolyHandle readPolygon(Common::SeekableReadStream &stream) {
- PolyHandle result(new Polygon);
- result->polySize = stream.readUint16BE();
- result->polyBBox = readRect(stream);
- for (int i = 10; i < result->polySize; i += 4) {
- result->polyPoints.push_back(readPoint(stream));
- }
- return result;
-}
-
-Region readRegion(Common::SeekableReadStream &stream) {
- Region region;
- region.rgnSize = stream.readUint16BE();
- if (debugChannelSet(8, kDebugGraphics)) {
- debugC(8, kDebugGraphics, "readRegion: region data");
- stream.hexdump(region.rgnSize - 2);
- }
- if (stream.size() - stream.pos() < region.rgnSize - 2) {
- warning("readRegion: not enough data to match size");
- }
- region.rgnBBox = readRect(stream);
- for (int i = 10; i < region.rgnSize; i+=2) {
- region.rgnData.push_back(stream.readSint16BE());
- }
- return region;
-}
-
-Pattern readPattern(Common::SeekableReadStream &stream) {
- Pattern result;
- for (int i = 0; i < 8; i++) {
- result.data[i] = stream.readByte();
- }
- return result;
-}
-
-PixMap readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr) {
- PixMap pixMap;
- if (hasBaseAddr) {
- pixMap.baseAddr = stream.readUint32BE();
- }
- uint16 rowBytes = stream.readUint16BE();
- pixMap.rowBytes = rowBytes & 0x3fff;
- pixMap._isBitMap = !(rowBytes & 0x8000);
- pixMap.bounds = readRect(stream);
- if (!pixMap._isBitMap) {
- pixMap.pmVersion = stream.readUint16BE();
- pixMap.packType = stream.readUint16BE();
- pixMap.packSize = stream.readUint32BE();
- pixMap.hRes = stream.readUint32BE();
- pixMap.vRes = stream.readUint32BE();
- pixMap.pixelType = stream.readUint16BE();
- pixMap.pixelSize = stream.readUint16BE();
- pixMap.cmpCount = stream.readUint16BE();
- pixMap.cmpSize = stream.readUint16BE();
- pixMap.planeBytes = stream.readUint32BE();
- pixMap.pmTable = stream.readUint32BE();
- pixMap.pmReserved = stream.readUint32BE();
- }
- return pixMap;
-}
-
-BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool compressed) {
- BitMap result(new Graphics::ManagedSurface());
- result->create(pixMap.bounds.width(), pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
-
- Common::Rect outputRect = result->getBounds();
-
- if (!compressed) {
- Common::BitStream8MSB bs(stream);
- // rows are word-aligned
- int overflowBits = (pixMap.bounds.width() % 16 == 0) ? 0 : (16 - (pixMap.bounds.width() % 16));
- debugC(5, kDebugLevelGGraphics, "readBitsRectMono: width %d, overflow %d", pixMap.bounds.width(), overflowBits);
-
- for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
- int yPos = y - pixMap.bounds.top;
-
- for (int x = pixMap.bounds.left; x < pixMap.bounds.right; x++) {
- int xPos = x - pixMap.bounds.left;
-
- uint bit = bs.getBit();
- if (outputRect.contains(xPos, yPos)) {
- result->setPixel(xPos, yPos, bit);
- }
- }
- bs.skip(overflowBits);
- }
-
- return result;
- }
-
- for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
- int yPos = y - pixMap.bounds.top;
- int x = 0;
-
- byte rowBytes = stream.readByte();
- byte readBytes = 0;
-
- while (readBytes < rowBytes) {
- byte rowBuf[128];
- byte bufLen;
-
- byte value = stream.readByte();
- readBytes++;
-
- if (value >= 128) {
- bufLen = (256 - value) + 1;
- byte repeatValue = stream.readByte();
- memset(rowBuf, repeatValue, bufLen);
- readBytes++;
- } else {
- bufLen = value + 1;
- stream.read(rowBuf, bufLen);
- readBytes += bufLen;
- }
-
- Common::MemoryReadStream ms(rowBuf, bufLen);
- Common::BitStream8MSB bs(ms);
-
- for (int i = 0; i < 8 * bufLen; i++) {
- int xPos = x;
-
- uint bit = bs.getBit();
-
- if (outputRect.contains(xPos, yPos)) {
- result->setPixel(xPos, yPos, bit);
- }
-
- x++;
- }
- }
- }
- return result;
-}
-
void Toolbox::_drawBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame, bool compressed) {
PixMap pixMap = readPixMap(stream, false);
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index a0e0f27cf96..7478734cb2f 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -738,6 +738,23 @@ void Toolbox::PenSize(uint16 width, uint16 height) {
}
}
+void Toolbox::PlotIcon(const Common::Rect &theRect, const Handle &theIcon) {
+ if (!theIcon) {
+ warning("Toolbox::PlotIcon: empty handle");
+ return;
+ }
+ if (_port) {
+ PixMap pm;
+ pm.bounds = Common::Rect(0, 0, 32, 32);
+ pm.rowBytes = 4;
+ pm._isBitMap = true;
+ Common::MemoryReadStream stream(theIcon->data(), theIcon->size());
+ BitMap result = readBitsRectMono(stream, pm, false);
+ const BitMap intermediate(createRemappedSurface(result->surfacePtr(), nullptr, 0));
+ CopyBits(intermediate, _port->portBits, result->getBounds(), theRect, kSrcCopy, nullptr);
+ }
+}
+
void Toolbox::PortSize(uint16 width, uint16 height) {
if (_port) {
_port->portRect.setWidth(width);
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index 22120cfd8cd..b348f247049 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -19,12 +19,162 @@
*
*/
+#include "common/memstream.h"
#include "fool/fool.h"
#include "fool/toolbox.h"
#include "fool/utils.h"
namespace Fool {
+Common::Rect readRect(Common::SeekableReadStream &stream) {
+ Common::Rect result;
+ result.top = stream.readSint16BE();
+ result.left = stream.readSint16BE();
+ result.bottom = stream.readSint16BE();
+ result.right = stream.readSint16BE();
+ return result;
+}
+
+Common::Point readPoint(Common::SeekableReadStream &stream) {
+ Common::Point result;
+ result.y = stream.readSint16BE();
+ result.x = stream.readSint16BE();
+ return result;
+}
+
+PolyHandle readPolygon(Common::SeekableReadStream &stream) {
+ PolyHandle result(new Polygon);
+ result->polySize = stream.readUint16BE();
+ result->polyBBox = readRect(stream);
+ for (int i = 10; i < result->polySize; i += 4) {
+ result->polyPoints.push_back(readPoint(stream));
+ }
+ return result;
+}
+
+Region readRegion(Common::SeekableReadStream &stream) {
+ Region region;
+ region.rgnSize = stream.readUint16BE();
+ if (debugChannelSet(8, kDebugGraphics)) {
+ debugC(8, kDebugGraphics, "readRegion: region data");
+ stream.hexdump(region.rgnSize - 2);
+ }
+ if (stream.size() - stream.pos() < region.rgnSize - 2) {
+ warning("readRegion: not enough data to match size");
+ }
+ region.rgnBBox = readRect(stream);
+ for (int i = 10; i < region.rgnSize; i+=2) {
+ region.rgnData.push_back(stream.readSint16BE());
+ }
+ return region;
+}
+
+Pattern readPattern(Common::SeekableReadStream &stream) {
+ Pattern result;
+ for (int i = 0; i < 8; i++) {
+ result.data[i] = stream.readByte();
+ }
+ return result;
+}
+
+PixMap readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr) {
+ PixMap pixMap;
+ if (hasBaseAddr) {
+ pixMap.baseAddr = stream.readUint32BE();
+ }
+ uint16 rowBytes = stream.readUint16BE();
+ pixMap.rowBytes = rowBytes & 0x3fff;
+ pixMap._isBitMap = !(rowBytes & 0x8000);
+ pixMap.bounds = readRect(stream);
+ if (!pixMap._isBitMap) {
+ pixMap.pmVersion = stream.readUint16BE();
+ pixMap.packType = stream.readUint16BE();
+ pixMap.packSize = stream.readUint32BE();
+ pixMap.hRes = stream.readUint32BE();
+ pixMap.vRes = stream.readUint32BE();
+ pixMap.pixelType = stream.readUint16BE();
+ pixMap.pixelSize = stream.readUint16BE();
+ pixMap.cmpCount = stream.readUint16BE();
+ pixMap.cmpSize = stream.readUint16BE();
+ pixMap.planeBytes = stream.readUint32BE();
+ pixMap.pmTable = stream.readUint32BE();
+ pixMap.pmReserved = stream.readUint32BE();
+ }
+ return pixMap;
+}
+
+BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool compressed) {
+ BitMap result(new Graphics::ManagedSurface());
+ result->create(pixMap.bounds.width(), pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
+
+ Common::Rect outputRect = result->getBounds();
+
+ if (!compressed) {
+ Common::BitStream8MSB bs(stream);
+ // rows are word-aligned
+ int overflowBits = (pixMap.bounds.width() % 16 == 0) ? 0 : (16 - (pixMap.bounds.width() % 16));
+ debugC(5, kDebugLevelGGraphics, "readBitsRectMono: width %d, overflow %d", pixMap.bounds.width(), overflowBits);
+
+ for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
+ int yPos = y - pixMap.bounds.top;
+
+ for (int x = pixMap.bounds.left; x < pixMap.bounds.right; x++) {
+ int xPos = x - pixMap.bounds.left;
+
+ uint bit = bs.getBit();
+ if (outputRect.contains(xPos, yPos)) {
+ result->setPixel(xPos, yPos, bit);
+ }
+ }
+ bs.skip(overflowBits);
+ }
+
+ return result;
+ }
+
+ for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
+ int yPos = y - pixMap.bounds.top;
+ int x = 0;
+
+ byte rowBytes = stream.readByte();
+ byte readBytes = 0;
+
+ while (readBytes < rowBytes) {
+ byte rowBuf[128];
+ byte bufLen;
+
+ byte value = stream.readByte();
+ readBytes++;
+
+ if (value >= 128) {
+ bufLen = (256 - value) + 1;
+ byte repeatValue = stream.readByte();
+ memset(rowBuf, repeatValue, bufLen);
+ readBytes++;
+ } else {
+ bufLen = value + 1;
+ stream.read(rowBuf, bufLen);
+ readBytes += bufLen;
+ }
+
+ Common::MemoryReadStream ms(rowBuf, bufLen);
+ Common::BitStream8MSB bs(ms);
+
+ for (int i = 0; i < 8 * bufLen; i++) {
+ int xPos = x;
+
+ uint bit = bs.getBit();
+
+ if (outputRect.contains(xPos, yPos)) {
+ result->setPixel(xPos, yPos, bit);
+ }
+
+ x++;
+ }
+ }
+ }
+ return result;
+}
Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode) {
Common::Rect dstRect = src->getBounds();
dstRect.moveTo(dstPos);
diff --git a/engines/fool/utils.h b/engines/fool/utils.h
index 5d5095af7f4..3672071d112 100644
--- a/engines/fool/utils.h
+++ b/engines/fool/utils.h
@@ -29,6 +29,14 @@
namespace Fool {
+Common::Rect readRect(Common::SeekableReadStream &stream);
+Common::Point readPoint(Common::SeekableReadStream &stream);
+PolyHandle readPolygon(Common::SeekableReadStream &stream);
+Region readRegion(Common::SeekableReadStream &stream);
+Pattern readPattern(Common::SeekableReadStream &stream);
+PixMap readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr);
+BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool compressed);
+
Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode);
Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode);
Commit: 48ce975c5103a5367c49ec72e8cd91944be6bbe1
https://github.com/scummvm/scummvm/commit/48ce975c5103a5367c49ec72e8cd91944be6bbe1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:08+02:00
Commit Message:
FOOL: Tidy font face references
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/toolbox.h
engines/fool/toolbox_text.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index cdde50297ea..25f6d8b4692 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -400,7 +400,7 @@ void FoolGame::sub_128_55c(Common::U32String &unk1) {
g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
g_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133);
g_toolbox->DrawString(this->var_str_172);
@@ -598,7 +598,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
// 128:0e46
this->sub_128_0a2(0, 0x6060);
- g_zbasic->text(this->var_i16_7aa, 0xc, 0, kSrcBic);
+ g_zbasic->text(this->var_i16_7aa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7b4 = this->var_i16_7ae*0x46;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
@@ -648,7 +648,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:10a0
if (this->var_i16_7ae != 0) {
g_toolbox->PenNormal();
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// 128:10c0
// loop to zero out three rectangles??
@@ -797,7 +797,7 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
// 128:188a
this->sub_128_4da(0);
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
- g_zbasic->text(0xfa, 0x18, 0x18, kSrcBic);
+ g_zbasic->text(0xfa, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
for (int j = 0; j <= 1; j++) {
// 128:18c4
for (int i = 0; i <= 0x64; i += 4) {
@@ -1022,24 +1022,24 @@ void FoolGame::storyRenderPage() {
this->sub_128_55c(this->var_str_384);
// 128:23f0: CLR.W - -0x772(A5)
this->var_i16_7d6 = 1;
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x8a, 0x133);
g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x70, 0x133);
g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
}
// 128:2468
if (this->arr_str_1a288[this->storyNextPage] != g_zbasic->str(13)) { // blank
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->DrawString(this->arr_str_1a288[this->storyNextPage]);
}
// 128:24be
if (this->storyNextPage != this->storyCurrentPage) {
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
if (this->var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
@@ -1081,7 +1081,7 @@ void FoolGame::sub_128_2664() {
// hide menu and replace with "click mouse to continue" message
g_toolbox->SetPort(this->var_i32_8);
this->fillRect(0, 7, 0x13, this->var_i16_5a-7, 0);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_str_172 = g_zbasic->str(15); // click mouse to continue
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xf);
@@ -1395,7 +1395,7 @@ void FoolGame::sub_128_3032() {
// 128:318e
this->fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0x3c;
this->var_i16_7de = 0x2d;
// draw the first page of text
@@ -2070,7 +2070,7 @@ void FoolGame::sub_128_4a92() {
g_toolbox->InitCursor();
this->sub_128_4da(1);
this->sub_128_0a2(0, 0x6d60);
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7b4 = 0;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
@@ -2133,7 +2133,7 @@ void FoolGame::sub_128_4a92() {
this->var_i16_7a2 += 0x11;
}
// 128:50f4
- g_zbasic->text(0xfc, 0x9, 0, kSrcOr);
+ g_zbasic->text(0xfc, 0x9, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 += 0xe;
this->sub_128_918(g_zbasic->str(102)); // version string
this->sub_128_2664();
@@ -2524,7 +2524,7 @@ void FoolGame::sub_129_068() {
// 129:0636
if (this->var_str_e22 == g_zbasic->str(135)) {
do {
- g_zbasic->text(0, 0xc, 0, kSrcBic);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->fillRect(0x17, 0x92, 0x31, 0x16e, 2);
this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
@@ -2703,18 +2703,18 @@ void FoolGame::sub_129_068() {
// 0x4 == newline
// 0x1 == normal formatting
if ((this->var_i16_103e == 1) || (this->var_i16_103e == 4)) {
- this->pageLineFace[i] = 0;
+ this->pageLineFace[i] = Graphics::kMacFontRegular;
}
// 129:0dea
// 0x2 = bold formatting
if ((this->var_i16_103e == 2) || (this->var_i16_103e == 5)) {
- this->pageLineFace[i] = 1;
+ this->pageLineFace[i] = Graphics::kMacFontBold;
}
// 129:0e1e
// 0x3 = outlined
if ((this->var_i16_103e == 3) || (this->var_i16_103e == 6)) {
- this->pageLineFace[i] = 0x19;
+ this->pageLineFace[i] = Graphics::kMacFontBold | Graphics::kMacFontOutline | Graphics::kMacFontShadow;
}
// 129:0e52
if (this->var_i16_103e > 3) {
@@ -2815,7 +2815,7 @@ void FoolGame::sub_129_068() {
void FoolGame::sub_129_123a() {
g_toolbox->SetPort(this->var_i32_8);
this->fillRect(0, 7, 0x13, this->var_i16_5a - 7, 0);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
this->var_str_172 = Common::U32String::format("%s %d%s", g_zbasic->str(158).encode().c_str(), this->var_i16_68a, g_zbasic->str(159).encode().c_str());
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index ef266ed77b3..0c383372da5 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -87,7 +87,7 @@ void FoolGame::polyominoRun() {
}
// 133:0228
g_toolbox->SetPort(this->var_i32_f24);
- g_zbasic->text(0xfb, 0x18, 0, kSrcOr);
+ g_zbasic->text(0xfb, 0x18, Graphics::kMacFontRegular, kSrcOr);
// for each polyomino
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 126b55c827a..6038726892d 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -388,14 +388,14 @@ void FoolPrologue::shuffleScanlines() {
void FoolPrologue::sub_128_de2() {
// 128:0de2
- g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
+ g_zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
this->var_str_76 = g_zbasic->str(3);
this->drawText(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
- g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcXor);
+ g_zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
this->var_str_76 = g_zbasic->str(4);
this->drawTextRightAlign(0x154, 0x1fb);
}
@@ -570,7 +570,7 @@ void FoolPrologue::sub_129_004() {
// 129:0386
this->fillRect(2, 0x50, 0x6e, 0xd2, 0x192);
- g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "not enough memory" message
this->var_str_76 = g_zbasic->str(6);
this->drawTextCenterAlign(0x64, 0x100);
@@ -641,7 +641,7 @@ void FoolPrologue::sub_129_004() {
this->fillRect(1, 0x69, 0x87, 0xd7, 0x179);
this->fillRect(2, 0x6e, 0x8c, 0xd2, 0x174);
// 129:0662
- g_zbasic->text(0, 0xc, kFacePlain, kSrcBic);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "set your monitor to black and white" message"
this->var_str_76 = g_zbasic->str(13);
this->drawTextCenterAlign(0x82, 0x100);
@@ -710,7 +710,7 @@ void FoolPrologue::prologueRun() {
g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
- g_zbasic->text(0xfb, 0x9, kFacePlain, kSrcBic);
+ g_zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = g_zbasic->str(18);
this->drawTextCenterAlign(0x10d, 0x103);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1113,7 +1113,7 @@ void FoolPrologue::prologueBufferNextPicture() {
void FoolPrologue::prologueDrawLoadingMsg() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, kFacePlain, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// "loading prologue" message
this->var_str_76 = g_zbasic->str(19);
this->var_str_76 += Common::U32String::format(" %d", this->var_i16_3ce);
@@ -1176,7 +1176,7 @@ void FoolPrologue::prologueRenderNextText() {
}
}
// 130:0fc8
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->drawText(this->var_i16_180, this->var_i16_176);
}
}
@@ -1298,7 +1298,7 @@ void FoolPrologue::sub_131_004() {
// 131:03c0
this->delay(0x1e);
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(22));
g_zbasic->bufferFlush(this->var_str_76);
@@ -1494,7 +1494,7 @@ void FoolPrologue::sub_131_004() {
this->delay(0x3c);
// 131:0e08
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(23));
g_zbasic->bufferFlush(this->var_str_76);
this->drawText(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
@@ -1571,7 +1571,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24).encode().c_str());
g_zbasic->bufferFlush(this->var_str_76);
this->drawTextRightAlign(0x1f4, 0xd2);
@@ -1680,7 +1680,7 @@ void FoolPrologue::sub_131_004() {
}
this->delayFromMarker(0x3c);
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcBic);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
g_zbasic->bufferFlush(this->var_str_76);
this->drawTextRightAlign(0x181, 0x3c);
@@ -1692,7 +1692,7 @@ void FoolPrologue::sub_131_004() {
void FoolPrologue::sub_131_4dc0() {
// 131:4dc0
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, kFacePlain, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Finale
this->var_str_76 += g_zbasic->str(78);
this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
@@ -1706,7 +1706,7 @@ void FoolPrologue::sub_131_4dc0() {
void FoolPrologue::sub_131_4e48() {
// 131:4e48
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcOr);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Uh oh . . .
this->var_str_76 += Common::U32String::format("\"%s\"", g_zbasic->str(80).c_str());
@@ -1717,7 +1717,7 @@ void FoolPrologue::sub_131_4e48() {
void FoolPrologue::sub_131_4e98() {
// 131:4e98
- g_zbasic->text(0xfa, 0xc, kFacePlain, kSrcXor);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcXor);
this->var_i16_3fc = 0xa0;
// "And so the fool heeded the advice of the magician..."
this->var_str_76 += g_zbasic->str(81);
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 1399dacaf24..7eb9361ffd2 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -80,7 +80,7 @@ void FoolGame::revealRun() {
// 134:02f0
this->arr_i16_1eb8[19] = g_zbasic->unk_310(this->var_str_c06);
this->var_i16_1aba = this->arr_i16_1eb8[18];
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
// play a random tone and draw each of the letter buttons in sequence
this->sub_128_50e(
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 67b54578da4..7ad11de051f 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -140,7 +140,7 @@ void FoolGame::wordSearchRun() {
g_toolbox->PenNormal();
this->var_str_384 = this->var_str_188e;
this->wordSearchDrawFooter();
- g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
+ g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->PenMode(kPatBic);
g_zbasic->unk_20();
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 515c66543a4..38600ae1e0c 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -32,6 +32,7 @@
#include "graphics/cursor.h"
#include "image/pict.h"
#include "graphics/framelimiter.h"
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindow.h"
#include "graphics/macgui/macwindowmanager.h"
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index 6b8cd7b69fb..7b176321506 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -40,11 +40,16 @@ void Toolbox::DrawString(const Common::U32String &s) {
debugN(5, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
const Graphics::Font *font = fontRun.getFont();
- Common::Rect bbox = font->getBoundingBox(s);
+ Common::Rect bbox = font->getBoundingBox(macString);
BitMap buffer(new Graphics::ManagedSurface(bbox.width(), bbox.height(), Graphics::PixelFormat::createFormatCLUT8()));
buffer->fillRect(buffer->getBounds(), _port->bkColor);
font->drawString(buffer->surfacePtr(), macString, 0, 0, bbox.width(), _port->fgColor);
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //buffer->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
+
BitMap mask(nullptr);
Common::Point destPos(_port->pnLoc.x, _port->pnLoc.y-font->getFontAscent());
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 445a7e8d414..f89c392c0c5 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -122,17 +122,6 @@ enum ZBasicTextFont {
kFontLosAngeles = 12
};
-enum ZBasicTextFace {
- kFacePlain = 0,
- kFaceBold = 1,
- kFaceItalic = 2,
- kFaceUnderlined = 4,
- kFaceOutlined = 8,
- kFaceShadow = 16,
- kFaceCondensed = 32,
- kFaceExtended = 64
-};
-
enum ZBasicDatumType {
kDatumNULL = 0,
kDatumINT = 1,
Commit: a1226ada32bc5721e603785a5cc5fd7e628d12e6
https://github.com/scummvm/scummvm/commit/a1226ada32bc5721e603785a5cc5fd7e628d12e6
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:08+02:00
Commit Message:
GRAPHICS: Fix Mac font rendering for shadow | outline
The size of the bitmap offset wasn't calculated correctly for
the shadow face, leading to overlapping glyphs.
In addition, this improves the accuracy of shadow | outline
text rendering.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 834133df221..9fe240d969c 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -567,8 +567,12 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
bitmapOffset += 2;
if (slant & kMacFontItalic)
bitmapOffset += (data._fRectHeight - 1) / SLANTDEEP;
- if (slant & kMacFontShadow)
- bitmapOffset++;
+ if (slant & kMacFontShadow) {
+ if (slant & kMacFontOutline)
+ bitmapOffset += 2;
+ else
+ bitmapOffset += 3;
+ }
for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) {
MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &data._defaultChar : &data._glyphs[i];
@@ -640,11 +644,17 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize, int sla
if (slant & kMacFontOutline) {
tmpSurf.fillRect(Common::Rect(tmpSurf.w, tmpSurf.h), 0);
makeOutline(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
+ if (slant & kMacFontShadow) {
+ // An approximation of how QuickDraw renders outline | shadow text.
+ // FIXME: Real QuickDraw goes to greater lengths in filling the gaps
+ // (e.g. gap at the base of A, center of hollow letters like O)
+ makeShadow(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
+ makeShadow(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
+ }
srcSurf.copyFrom(tmpSurf);
- }
-
- if (slant & kMacFontShadow) {
+ } else if (slant & kMacFontShadow) {
tmpSurf.fillRect(Common::Rect(tmpSurf.w, tmpSurf.h), 0);
+ makeOutline(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
makeShadow(&srcSurf, &tmpSurf, glyph, data._fRectHeight);
srcSurf.copyFrom(tmpSurf);
}
@@ -797,7 +807,6 @@ static void makeUnderLine(Surface *src, MacGlyph *glyph, int ascent) {
static void makeShadow(Surface *src, Surface *dst, MacGlyph *glyph, int height) {
// makeShadow looks like just the outLine font with one more shadow at right-most edge and lowest edge
- makeOutline(src, dst, glyph, height);
glyph->bitmapWidth++;
glyph->width++;
Commit: d5408dca0fc8e2577c2734c1b881585bfe601660
https://github.com/scummvm/scummvm/commit/d5408dca0fc8e2577c2734c1b881585bfe601660
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:08+02:00
Commit Message:
FOOL: Fix inf symbol appearing on wrong chapters
Changed paths:
engines/fool/fool_game.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 25f6d8b4692..ae8f538885c 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1048,7 +1048,7 @@ void FoolGame::storyRenderPage() {
// 128:252a
// y-position where the story text should start
this->var_i16_7a2 = 0x11d - (this->arr_i16_1dee[this->storyNextPage] * 0xf);
- if (this->arr_i16_1dee[this->storyPageCount] < 0xf) {
+ if (this->arr_i16_1dee[this->storyNextPage] < 0xf) {
g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
g_toolbox->DrawString(g_zbasic->str(14)); // infinity symbol
this->var_i16_7de = this->var_i16_7a2 - 0x1e;
Commit: 5680733a998a4f441cab49fd5b6609e250229d1a
https://github.com/scummvm/scummvm/commit/5680733a998a4f441cab49fd5b6609e250229d1a
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:08+02:00
Commit Message:
FOOL: First pass of card game
Changed paths:
A engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
new file mode 100644
index 00000000000..6816f22ee65
--- /dev/null
+++ b/engines/fool/fool_cards.cpp
@@ -0,0 +1,676 @@
+/* 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/scummsys.h"
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+#include "graphics/macgui/macfontmanager.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// wheel of fortune card game
+void FoolGame::cardsRun() {
+ // 139:0004
+ this->sub_128_271a();
+ this->var_i16_c00 = 1;
+ g_toolbox->SetRect(this->arr_rect_1f38[1], 0x78, 0x19, 0xd1, 0xae);
+ g_toolbox->SetRect(this->arr_rect_1f38[2], 0xd3, 0x19, 0x12c, 0xae);
+ g_toolbox->SetRect(this->arr_rect_1f38[3], 0x12e, 0x19, 0x187, 0xae);
+ g_toolbox->SetRect(this->arr_rect_1f38[4],1, 0x2a, 0x5a, 0xbf);
+ g_toolbox->SetRect(this->arr_rect_1f38[5],0x1a6, 0x2a, 0x1ff, 0xbf);
+ g_toolbox->SetRect(this->arr_rect_1f38[6], 0x1, 0xc0, 0x5a, 0x155);
+ g_toolbox->SetRect(this->arr_rect_1f38[7],0x1a6, 0xc0, 0x1ff, 0x155);
+ g_toolbox->SetRect(this->arr_rect_1f38[8],0x5b, 0xc0, 0xb4, 0x155);
+ g_toolbox->SetRect(this->arr_rect_1f38[9],0x14c, 0xc0, 0x1a5, 0x155);
+
+ // 139:011c
+ for (int i = 0; i <= 0x25; i++) {
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_68a);
+ }
+
+ this->var_i16_484 = 0x5e;
+ for (int i = 0x17; i >= 0; i--) {
+ this->var_i16_484++;
+ this->arr_i32_192c0[i] = g_toolbox->GetPicture(this->var_i16_484);
+ }
+ // 139:0184
+ this->sub_128_bde(1, 1, 0, 1, 1, 1);
+ this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
+ g_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
+ if (this->var_str_c06 == g_zbasic->str(278)) { // blank
+ // 139:01fa
+ this->var_str_c06 = g_zbasic->unk_88(0) + g_zbasic->unk_88(0) + g_zbasic->unk_88(0);
+ // card IDs
+ for (int16 i = 0; i <= 0x15; i++) {
+ this->arr_i16_5cbc[i] = i;
+ }
+ // 139:0244
+ for (int i = 0; i <= 0x15; i++) {
+ this->var_i16_484 = g_zbasic->rndInt(0x16) - 1;
+ this->var_i16_7e4 = g_zbasic->rndInt(0x16) - 1;
+ g_zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[this->var_i16_484]);
+ }
+ // 139:029c
+ for (int i = 0; i <= 0x15; i++) {
+ this->var_str_c06 += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
+ }
+ }
+ // 139:02d8
+ // player scores
+ this->arr_i16_1eb8[5] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 1, 2));
+ this->arr_i16_1eb8[6] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 3, 2));
+ // 139:0320
+ this->var_i16_2010 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 5, 2));
+ if ((this->arr_i16_1eb8[5] > 0x2bc) || (this->arr_i16_1eb8[6] > 0x2bc)) {
+ this->arr_i16_1eb8[5] = 0;
+ this->arr_i16_1eb8[6] = 0;
+ this->var_i16_2010 = 0;
+ }
+ // 139:039e
+
+ for (int i = 0; i <= 0x15; i++) {
+ this->arr_i16_5cbc[i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, i*2 + 7, 2));
+ }
+ // 139:03ea
+ this->arr_i16_5cbc[0x16] = 0x16;
+ this->arr_rect_4338.top = 0xdb;
+ this->arr_rect_4338.left = 0xe2;
+ this->arr_rect_4338.bottom = 0xee;
+ this->arr_rect_4338.right = 0x11e;
+ this->var_i16_2012 = 0;
+ this->var_i16_7c6 = 0;
+ this->sub_139_1b12();
+ if (this->var_i16_2010 == 0) {
+ this->sub_139_51e();
+ }
+ // 139:0456
+ this->sub_139_582();
+ while ((this->var_i16_7c6 & 1) == 0) {
+ // 139:045e
+ this->var_i16_2014 = 0;
+ this->var_i16_7c6 = 0;
+ while (this->var_i16_7c6 == 0) {
+ // 139:046e
+ this->sub_128_c6a(-1);
+ if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ this->sub_139_6b0();
+ }
+ if (this->var_i16_2014 != 0) {
+ this->sub_139_50e();
+ }
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+ }
+ // 139:04a4
+ if (this->var_i16_7c6 == 2) {
+ this->sub_139_4de();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_139_1cba();
+ this->sub_128_3536();
+ }
+ // 139:04c4
+ }
+ // 139:04d6
+ this->sub_139_1cba();
+ // JMP 1d7e
+ // 139:1d7e
+ for (int i = 0; i <= 0x17; i++) {
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[i]);
+ }
+}
+
+void FoolGame::sub_139_4de() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_139_50e() {
+ this->var_i16_2014 = 0;
+ this->sub_139_51e();
+ this->sub_139_582();
+}
+
+void FoolGame::sub_139_51e() {
+ g_zbasic->unk_20();
+ for (int j = 0; j <= 2; j++) {
+ for (int i = 0; i <= 0x15; i++) {
+ this->var_i16_484 = g_zbasic->rndInt(0x16)-1;
+ g_zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[i]);
+ }
+ }
+}
+
+void FoolGame::sub_139_582() {
+ this->sub_139_17fc();
+ this->sub_128_712(5, 0, 0);
+ this->sub_128_712(4, 1, 0);
+ this->sub_128_712(7, 2, 0);
+ this->sub_128_712(6, 0x16, 0);
+ this->sub_128_712(1, 4, 0);
+ this->sub_128_712(2, 5, 0);
+ this->sub_128_712(3, 6, 0);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_i16_7a2 = 0xc3;
+ // 139:061a
+ this->sub_128_918(g_zbasic->str(279)); // Select a card above
+ this->var_i16_7a2 = 0xd4;
+ this->sub_128_918(g_zbasic->str(280)); // or
+ g_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ this->var_i16_7a2 = 0xe9;
+ this->sub_128_918(g_zbasic->str(281)); // Yield
+ this->var_i16_2016 = 1;
+ this->var_i16_2010 = 1;
+ this->sub_128_6186();
+}
+
+void FoolGame::sub_139_6b0() {
+ this->var_i16_1e00 = 0;
+ if (!((this->var_ev_46.where.x >= 0x78) && (this->var_ev_46.where.y >= 0x19) && (this->var_ev_46.where.x <= 0x187) && (this->var_ev_46.where.y <= 0xae))) {
+ // 139:06fc
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_4338)) {
+ g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ if (!g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_4338))
+ return;
+ // 139:0778
+ this->sub_128_50e(0x19, 0x64, 0x0);
+ this->var_i16_2012 = -0x1b;
+ this->sub_139_1b12();
+ this->var_i16_2014 = 1;
+ } else {
+ // 139:079e
+ this->sub_128_50e(0xf, 0x64, 0x1);
+ for (int j = 0; j <= 1; j++) {
+ for (int16 i = 0; i <= 0x3; i++) {
+ this->sub_128_712(i, 0, 3);
+ }
+ }
+
+ }
+ // 139:07e6
+ } else {
+ // 139:07ea
+ this->fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
+ if (this->var_ev_46.where.y < 0xd2) {
+ // 139:0818
+ this->var_i16_1e00 = 4;
+ this->sub_128_712(1, 0, 1);
+ }
+ // 139:082e
+ if ((this->var_ev_46.where.y >= 0xd2) && (this->var_ev_46.where.y <= 0x12d)) {
+ this->var_i16_1e00 = 5;
+ this->sub_128_712(2, 0, 1);
+ }
+ // 139:0868
+ if (this->var_ev_46.where.y > 0x12d) {
+ this->var_i16_1e00 = 6;
+ this->sub_128_712(3, 0, 1);
+ }
+ // 139:088a
+ this->sub_128_712(9, this->var_i16_1e00, 0);
+ g_zbasic->indexSet(
+ g_zbasic->chr(this->arr_i16_5cbc[0]+0x41) + g_zbasic->chr(this->arr_i16_5cbc[2]+0x41) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00]+0x41),
+ 1,
+ 0x26
+ );
+ this->sub_139_19da();
+ this->sub_139_191c();
+ this->sub_139_a22();
+ if (this->var_i16_2018 == 0) {
+ // 139:0920
+ this->sub_139_dee();
+ this->var_i16_7a2 = 0xc3;
+
+ } else {
+ // 139:092e
+ this->sub_139_da8();
+ this->var_i16_7a2 = 0xd7;
+ }
+ // 139:0938
+ this->var_i16_2010 = 0;
+ if (this->arr_i16_1eb8[5] > 0x2bc) {
+ this->sub_139_1d3e();
+ return;
+ }
+ // 139:095e
+ this->sub_128_61ec();
+ g_zbasic->text(1, 9, Graphics::kMacFontRegular, kSrcBic);
+ this->sub_128_918(g_zbasic->str(282)); // (click mouse to continue)
+ this->var_i16_2014 = 0;
+ this->var_i16_7c6 = 0;
+ while ((this->var_i16_7c6 == 0) && (this->var_i16_2014 == 0)) {
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == kMouseUp) {
+ this->var_i16_2014 = 1;
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_139_1cba();
+ this->sub_128_3536();
+ }
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+ }
+ // 139:09d8
+ if (((this->var_i16_7c6 & 1) == 0) && (this->arr_i16_1eb8[6] > 0x2bc)) {
+ this->var_i16_7c6 = 2;
+ this->var_i16_2014 = 0;
+ }
+ }
+ // 139:0a20
+ return;
+}
+
+void FoolGame::sub_139_a22() {
+ // 139:0a22
+ this->var_str_201a = g_zbasic->chr(this->arr_i16_5cbc[0] + 0x41) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41);
+ this->var_i16_211a = this->var_i16_1e00;
+ g_zbasic->indexSet(g_zbasic->chr(this->arr_i16_5cbc[1] + 0x41) + g_zbasic->chr(this->arr_i16_5cbc[3] + 0x41), 1, 0x27);
+ this->var_str_211c = g_zbasic->index(1, 0x27);
+ this->var_i16_2016 = 0x2;
+ this->var_i16_221c = 0;
+ this->var_i16_221e = 0;
+ for (int16 i = 4; i <= 6; i++) {
+ // 139:0ae8
+ if (i != this->var_i16_211a) {
+ g_zbasic->indexSet(this->var_str_211c + g_zbasic->chr(this->arr_i16_5cbc[i] + 0x41), 1, 0x27);
+ this->sub_139_19da();
+ if (this->arr_i16_1eb8[2] >= this->var_i16_221c) {
+ // 139:0b52
+ this->var_i16_221c = this->arr_i16_1eb8[2];
+ this->var_i16_1e00 = i;
+ } else {
+ // 139:0b70
+ if (this->arr_i16_1eb8[2] == this->var_i16_221c) {
+ this->sub_139_191c();
+ if (this->arr_i16_1eb8[4] > this->var_i16_221e) {
+ this->var_i16_221e = this->arr_i16_1eb8[4];
+ this->var_i16_1e00 = i;
+ }
+ }
+ }
+ }
+ // 139:0bc4
+ }
+ g_zbasic->indexSet(this->var_str_211c + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
+ // 139:0c0a
+ this->arr_i16_1eb8[2] = this->var_i16_221c;
+ this->sub_139_191c();
+ this->var_i16_221c = 0;
+ for (int16 j = 8; j >= 1; j--) {
+ this->var_i16_7a8 = 0;
+ for (int16 i = 1; i <= (int16)g_zbasic->index(1, j + 0x15).size(); i++) {
+ if (g_zbasic->instr(1, this->var_str_201a, g_zbasic->midStr(g_zbasic->index(1, j + 0x15), i, 1))) {
+ this->var_i16_7a8++;
+ }
+ // 139:0c72
+ }
+ // 139:0c90
+ if (this->var_i16_7a8 == 2) {
+ this->var_i16_221c = j;
+ j = 1;
+ }
+ // 139:0ca6
+ }
+ // 139:0cb6
+ this->var_i16_2018 = 0;
+ if (this->var_i16_221c > this->arr_i16_1eb8[2]) {
+ this->var_i16_2018 = 1;
+ }
+ // 139:0ce2
+ if (this->var_i16_221c == this->arr_i16_1eb8[2]) {
+ for (int16 i = 1; i <= (int16)this->var_str_201a.size(); i++) {
+ this->var_i16_484 = 0x15 - (g_zbasic->asc(g_zbasic->midStr(this->var_str_201a, i, 1)) - 0x41);
+ if (this->var_i16_484 > this->arr_i16_1eb8[4]) {
+ this->var_i16_2018 = 1;
+ }
+ // 139:0d5c
+ }
+ }
+ // 139:0d6e
+ if ((this->var_i16_2018 == 1) && ((this->var_i16_221c + 1)*9 <= 0x1b)) {
+ this->var_i16_2018 = 0;
+ }
+
+ // 139:0da6
+}
+
+void FoolGame::sub_139_da8() {
+ // 139:0da8
+ this->sub_128_50e(0x19, 0x64, 0x1);
+ this->var_i16_2012 = -0x1b;
+ this->sub_139_1b12();
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_i16_7a2 = 0xc4;
+ this->sub_128_918(g_zbasic->str(283)); // The Old Man yields
+}
+
+void FoolGame::sub_139_dee() {
+ // 139:0dee
+ // remove the three cards from the top row
+ this->sub_128_712(1, 0, 1);
+ this->sub_128_712(2, 0, 1);
+ this->sub_128_712(3, 0, 1);
+
+ // draw ol' mate's pick from the pile
+ this->sub_128_712(8, this->var_i16_1e00, 0);
+
+ g_zbasic->indexSet(g_zbasic->index(1, 0x27) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
+ // 139:0e70
+ for (int16 i = 1; i <= 2; i++) {
+ g_zbasic->indexSet(g_zbasic->str(284), 1, i + 0x27);
+ if ((this->arr_i16_1eb8[i] > 0) && (this->arr_i16_1eb8[i] < 9)) {
+ // 139:0ed6
+ g_zbasic->indexSet(
+ g_zbasic->index(1, 0x1d + this->arr_i16_1eb8[i]) + g_zbasic->str(285), // X pair
+ 1,
+ i + 0x27
+ );
+ }
+ // 139:0f1e
+ if (this->arr_i16_1eb8[i] > 8) {
+ g_zbasic->indexSet(
+ g_zbasic->index(1, 0x1d + this->arr_i16_1eb8[i] - 8) + g_zbasic->str(286), // X triplet
+ 1,
+ 0x27 + i
+ );
+ }
+ // 139:0f84
+ g_zbasic->indexSet(
+ g_zbasic->index(1,0x15 - this->arr_i16_1eb8[i + 2]),
+ i + 0x29,
+ 1
+ );
+ // 139:0fca
+ if (g_zbasic->index(1, i + 0x27) == g_zbasic->str(287)) { // blank
+ // 139:0ff0
+ g_zbasic->indexSet(
+ g_zbasic->index(1, 0x29 + i),
+ 1,
+ i + 0x27
+ );
+
+ }
+ // 139:101a
+ }
+ // 139:1028
+ // determine winner
+ this->var_i16_2016 = 0;
+ if (this->arr_i16_1eb8[1] > this->arr_i16_1eb8[2]) {
+ this->var_i16_2016 = 1; // fool wins
+ }
+ // 139:105e
+ if (this->arr_i16_1eb8[1] < this->arr_i16_1eb8[2]) {
+ this->var_i16_2016 = 2; // ol' mate wins
+ }
+ if (this->var_i16_2016 == 0) {
+ if (this->arr_i16_1eb8[3] > this->arr_i16_1eb8[4]) {
+ this->var_i16_2016 = 1; // fool wins
+ }
+ // 139:10c8
+ if (this->arr_i16_1eb8[3] < this->arr_i16_1eb8[4]) {
+ this->var_i16_2016 = 2; // ol' mate wins
+ }
+ // 139:10f8
+ if (this->arr_i16_1eb8[1] != 0) {
+ for (int i = 1; i <= 2; i++) {
+ g_zbasic->indexSet(
+ g_zbasic->index(1, 0x27 + i) + g_zbasic->str(288) + g_zbasic->index(1, 0x29 + i) + g_zbasic->str(289),
+ 1,
+ 0x27 + i
+ );
+ }
+ }
+ }
+ // 139:1174
+ this->sub_128_712(6, 3, 0);
+ // calculate number of points gained by the winner
+ this->var_i16_2012 = 9*(this->arr_i16_1eb8[this->var_i16_2016] + 1);
+
+ this->sub_139_1b12();
+ if (this->var_i16_2016 == 1) {
+ this->var_str_384 = g_zbasic->str(290); // The fool
+ } else {
+ // 139:11ce
+ this->var_str_384 = g_zbasic->str(291); // The Old Man
+ }
+ // 139:11e2
+ if ((this->arr_i16_1eb8[5] > 0x2bc) || (this->arr_i16_1eb8[6] > 0x2bc)) {
+ this->var_str_9f4 = g_zbasic->str(292); // the game!
+ } else {
+ // 139:123e
+ this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_2012) + g_zbasic->str(293); // X points
+ }
+ // 139:1264
+ this->var_str_384 += g_zbasic->str(294) + this->var_str_9f4; // X wins Y
+ this->var_str_167c = g_zbasic->index(1, 0x28);
+ this->var_str_2222 = g_zbasic->index(1, 0x29);
+ if (this->var_i16_2016 == 2) {
+ g_zbasic->swapStr(this->var_str_167c, this->var_str_2222);
+ }
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_167c);
+ this->var_i16_9f2 = g_toolbox->StringWidth(this->var_str_2222);
+ this->var_i16_2322 = 0;
+ if (this->var_i16_484 > this->var_i16_2322) {
+ this->var_i16_2322 = this->var_i16_484;
+ }
+ // 139:1318
+ if (this->var_i16_7e4 > this->var_i16_2322) {
+ this->var_i16_2322 = this->var_i16_7e4;
+ }
+ if (this->var_i16_9f2 > this->var_i16_2322) {
+ this->var_i16_2322 = this->var_i16_9f2;
+ }
+ // 139:1344
+ this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
+ this->fillRect(0x23, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_i16_7a2 = 0x46;
+ this->sub_128_918(this->var_str_384);
+ this->var_i16_7a2 = 0x64;
+ this->sub_128_918(this->var_str_167c);
+ this->var_i16_7a2 = 0x78;
+ this->sub_128_918(g_zbasic->str(295));
+ this->var_i16_7a2 = 0x8c;
+ this->sub_128_918(this->var_str_2222);
+ if (this->arr_i16_1eb8[1] != 0) {
+ this->var_i16_68a = this->arr_i16_1eb8[1];
+ if (this->var_i16_68a > 8) {
+ this->var_i16_68a -= 8;
+ }
+ // 139:1420
+ if (g_zbasic->instr(
+ 1,
+ g_zbasic->index(1, 0x15 + this->var_i16_68a),
+ g_zbasic->midStr(g_zbasic->index(1, 0x26), 1, 1)
+ ) == 0) {
+ this->sub_128_712(5, 0, 2);
+ }
+ // 139:1470
+ if (g_zbasic->instr(
+ 1,
+ g_zbasic->index(1, 0x15 + this->var_i16_68a),
+ g_zbasic->midStr(g_zbasic->index(1, 0x26), 2, 1)
+ ) == 0) {
+ this->sub_128_712(7, 0, 2);
+ }
+ // 139:14c0
+ if (g_zbasic->instr(
+ 1,
+ g_zbasic->index(1, 0x15 + this->var_i16_68a),
+ g_zbasic->midStr(g_zbasic->index(1, 0x26), 3, 1)
+ ) == 0) {
+ this->sub_128_712(9, 0, 2);
+ }
+ } else {
+ // 139:1514
+ this->var_str_384 = g_zbasic->chr((0x15 - this->arr_i16_1eb8[3]) + 0x41);
+ if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 1, 1) != this->var_str_384) {
+ this->sub_128_712(5, 0, 2);
+ }
+ // 139:157e
+ if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 2, 1) != this->var_str_384) {
+ this->sub_128_712(7, 0, 2);
+ }
+ if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 3, 1) != this->var_str_384) {
+ this->sub_128_712(9, 0, 2);
+ }
+ }
+ // 139:15f2
+ if (this->arr_i16_1eb8[2] != 0) {
+ this->var_i16_68a = this->arr_i16_1eb8[2];
+ if (this->var_i16_68a > 8) {
+ this->var_i16_68a -= 8;
+ }
+ if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 1, 1)) == 0) {
+ this->sub_128_712(4, 0, 2);
+ }
+ // 139:1678
+ if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 2, 1)) == 0) {
+ this->sub_128_712(6, 0, 2);
+ }
+ // 139:16c8
+ if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 3, 1)) == 0) {
+ this->sub_128_712(8, 0, 2);
+ }
+ } else {
+ // 139:171c
+ this->var_str_384 = g_zbasic->chr((0x15 - this->arr_i16_1eb8[4]) + 0x41);
+ if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 1, 1)) {
+ this->sub_128_712(4, 0, 2);
+ }
+ // 139:1786
+ if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 2, 1)) {
+ this->sub_128_712(6, 0, 2);
+ }
+ if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 3, 1)) {
+ this->sub_128_712(8, 0, 2);
+ }
+ }
+ // 139:17fa
+}
+
+void FoolGame::sub_139_17fc() {
+ // 139:17fc
+ this->fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
+ this->fillRect(0x14, 0x5f, 0xaf, 0x1a4, 1);
+ this->fillRect(0x2a, 0, 0x156, 0xb4, 1);
+ this->fillRect(0x2a, 0x14c, 0x156, 0x200, 1);
+ // 139:1878
+ for (int i = 1; i <= 2; i++) {
+ this->arr_i16_1eb8[i + 2] = 0;
+ this->arr_i16_1eb8[i] = 0;
+ g_zbasic->indexSet(g_zbasic->str(296), 1, 0x25 + i); // blank
+ g_zbasic->indexSet(g_zbasic->str(297), 1, 0x27 + i); // blank
+ g_zbasic->indexSet(g_zbasic->str(298), 1, 0x29 + i); // blank
+ }
+}
+
+void FoolGame::sub_139_191c() {
+ // 139:191c
+ this->arr_i16_1eb8[this->var_i16_2016 + 2] = 0;
+ for (int i = 1; i <= (int)g_zbasic->index(1, this->var_i16_2016 + 0x25).size(); i++) {
+ this->var_i16_484 = 0x15 - (g_zbasic->asc(g_zbasic->midStr(g_zbasic->index(1, 0x25 + this->var_i16_2016), i, 1)) - 0x41);
+ // 139:1974
+ if (this->var_i16_484 > this->arr_i16_1eb8[2 + this->var_i16_2016]) {
+ this->arr_i16_1eb8[2 + this->var_i16_2016] = this->var_i16_484;
+ }
+ // 139:19b8
+ }
+}
+
+void FoolGame::sub_139_19da() {
+ // 139:19da
+ this->arr_i16_1eb8[this->var_i16_2016] = 0;
+ for (int k = 1; k <= 2; k++) {
+ for (int j = 8; j >= 1; j--) {
+ this->var_i16_7a8 = 0;
+ for (int i = 1; i <= (int)g_zbasic->index(1, j + 0x15).size(); i++) {
+ if (g_zbasic->instr(
+ 1,
+ g_zbasic->index(1, this->var_i16_2016 + 0x25),
+ g_zbasic->midStr(g_zbasic->index(1, 0x15 + j), i, 1)
+ ) != 0) {
+ this->var_i16_7a8++;
+ }
+ // 139:1a4c
+ }
+ // 139:1a6a
+ if ((k == 2) && (this->var_i16_7a8 == 2)) {
+ this->sub_139_1ad6();
+ }
+ if ((k == 1) && (this->var_i16_7a8 == 3)) {
+ this->sub_139_1ad6();
+ }
+ }
+ // 139:1ac6
+ }
+}
+
+void FoolGame::sub_139_1ad6() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_139_1b12() {
+ // 139:1b12
+ g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->arr_i16_1eb8[this->var_i16_2016 + 4] += this->var_i16_2012;
+ if (this->arr_i16_1eb8[5] < -999) {
+ this->arr_i16_1eb8[5] = -999;
+ }
+ // 139:1b88
+ if (this->arr_i16_1eb8[6] < -999) {
+ this->arr_i16_1eb8[6] = -999;
+ }
+ // 139:1bb2
+ this->fillRect(0x14, 0, 0x29, 0x5a, 2);
+ // Old Man
+ this->var_str_384 = g_zbasic->str(299) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ g_toolbox->MoveTo(0x2d - (this->var_i16_484 / 2), 0x23);
+ g_toolbox->DrawString(this->var_str_384);
+
+ // 139:1c30
+ this->fillRect(0x14, 0x1a6, 0x29, 0x200, 2);
+ this->var_str_384 = g_zbasic->str(300) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ g_toolbox->MoveTo(0x1d3 - (this->var_i16_484 / 2), 0x23);
+ g_toolbox->DrawString(this->var_str_384);
+}
+
+void FoolGame::sub_139_1cba() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_139_1d3e() {
+ warning("STUB: %s", __func__);
+}
+
+
+};
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index ae8f538885c..a4395f8a015 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -431,31 +431,31 @@ void FoolGame::sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3,
g_toolbox->PenNormal();
}
-void FoolGame::sub_128_712(int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::sub_128_712(int16 rectID, int16 deckPos, int16 unk1) {
// 128:0712
g_toolbox->PenNormal();
if (unk1 == 0) {
g_toolbox->PenSize(0x3, 0x3);
g_toolbox->PenPat(this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[unk3], 0xf, 0xf);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[rectID], 0xf, 0xf);
g_toolbox->PenSize(1, 1);
g_toolbox->PenPat(this->arr_pat_58f4[2]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[unk3], 0xf, 0xf);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[rectID], 0xf, 0xf);
// 128:079e
- g_zbasic->picture(this->arr_rect_1f38[unk3].left + 3, this->arr_rect_1f38[unk3].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[unk2/2]]);
+ g_zbasic->picture(this->arr_rect_1f38[rectID].left + 3, this->arr_rect_1f38[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
}
// 128:0806
if (unk1 == 1) {
g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->PaintRoundRect(this->arr_rect_1f38[unk3], 0xc, 0xc);
+ g_toolbox->PaintRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
}
if (unk1 == 2) {
g_toolbox->PenMode(kPatOr);
g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->PaintRoundRect(this->arr_rect_1f38[unk3], 0xc, 0xc);
+ g_toolbox->PaintRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
}
if (unk1 == 3) {
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[unk3], 0xc, 0xc);
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
}
g_toolbox->PenNormal();
}
@@ -601,10 +601,9 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_zbasic->text(this->var_i16_7aa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7b4 = this->var_i16_7ae*0x46;
this->var_i16_7b6 = 0;
- this->var_i16_7b8 = 0;
for (int i = 0; i <= this->var_i16_7ac; i++) {
// 128:0e86
- this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[this->var_i16_7ba]);
+ this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
}
@@ -721,15 +720,15 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:154a
this->var_i16_7be = 0;
Common::Rect target;
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b7c) != 0) {
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b7c)) {
this->var_i16_7be = 1;
target = this->arr_rect_5b7c;
}
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b84) != 0) {
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b84)) {
this->var_i16_7be = 2;
target = this->arr_rect_5b84;
}
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b8c) != 0) {
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b8c)) {
this->var_i16_7be = 3;
target = this->arr_rect_5b8c;
}
@@ -741,22 +740,28 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1624
- while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target) != 0)) {
+ while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
}
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
- while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
+ while ((this->var_ev_46.what != kMouseUp) && (!g_toolbox->PtInRect(this->var_ev_46.where, target))) {
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
}
// 128:16ea
} while (this->var_ev_46.what != kMouseUp);
- if (g_toolbox->PtInRect(this->var_ev_46.where, target) == 0) {
+ if (!g_toolbox->PtInRect(this->var_ev_46.where, target)) {
this->var_i16_7be = 0;
}
this->sub_128_61ec();
@@ -1638,7 +1643,7 @@ void FoolGame::sub_128_39a0() {
this->sub_137_004();
break;
case 12:
- this->sub_139_004();
+ this->cardsRun();
break;
case 13:
this->sub_140_004();
@@ -2955,11 +2960,6 @@ void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
-// wheel of fortune game
-void FoolGame::sub_139_004() {
- warning("STUB: %s", __func__);
-}
-
// high priestess challenge
void FoolGame::sub_140_004() {
warning("STUB: %s", __func__);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 32738d0e8cf..b71b7a22bcc 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -55,7 +55,7 @@ public:
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
- void sub_128_712(int16 unk3, int16 unk2, int16 unk1);
+ void sub_128_712(int16 rectID, int16 deckPos, int16 unk1);
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
void sub_128_918(const Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
@@ -171,7 +171,25 @@ public:
void sub_136_004();
void sub_137_004();
void sub_138_004();
- void sub_139_004();
+
+ // fool_cards.cpp
+ void cardsRun(); // sub_139_004
+ void sub_139_4de();
+ void sub_139_50e();
+ void sub_139_51e();
+ void sub_139_582();
+ void sub_139_6b0();
+ void sub_139_a22();
+ void sub_139_da8();
+ void sub_139_dee();
+ void sub_139_17fc();
+ void sub_139_191c();
+ void sub_139_19da();
+ void sub_139_1ad6();
+ void sub_139_1b12();
+ void sub_139_1cba();
+ void sub_139_1d3e();
+
void sub_140_004();
void sub_141_004();
@@ -318,6 +336,8 @@ private:
int16 var_i16_1574;
+ Common::U32String var_str_167c;
+
Common::U32String var_str_188e;
int16 var_i16_198e;
@@ -346,6 +366,22 @@ private:
int16 var_i16_1ab8;
int16 var_i16_1aba;
+ int16 var_i16_1e00;
+
+ int16 var_i16_2010;
+ int16 var_i16_2012;
+ int16 var_i16_2014;
+ int16 var_i16_2016;
+ int16 var_i16_2018;
+ Common::U32String var_str_201a;
+ int16 var_i16_211a;
+ Common::U32String var_str_211c;
+
+
+ int16 var_i16_221c;
+ int16 var_i16_221e;
+ Common::U32String var_str_2222;
+ int16 var_i16_2322;
// FIXME: bounds on the following are guessed! need to trace index range
int16 pageLineRanges[202]; // arr_i16_0
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index f04dad5fce0..486b0a42d47 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/fool
MODULE_OBJS = \
siphash/halfsip.o \
fool.o \
+ fool_cards.o \
fool_game.o \
fool_jigsaw.o \
fool_polyomino.o \
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 7478734cb2f..3cef7f8728a 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -195,7 +195,7 @@ void Toolbox::EndUpdate(WindowRecord &theWindow) {
}
void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
- if (!r.isValidRect()) {
+ if ((!r.isValidRect()) || r.isEmpty()) {
warning("Toolbox::_drawOval: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
return;
}
@@ -296,7 +296,7 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
- if (!r.isValidRect()) {
+ if ((!r.isValidRect()) || r.isEmpty()) {
warning("Toolbox::_drawRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
return;
}
@@ -341,7 +341,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
}
void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight) {
- if (!r.isValidRect()) {
+ if ((!r.isValidRect()) || r.isEmpty()) {
warning("Toolbox::_drawRoundRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
return;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 88fbcc1760e..115931bf151 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -556,6 +556,13 @@ void ZBasic::swapInt(int16 &a, int16 &b) {
b = tmp;
}
+void ZBasic::swapStr(Common::U32String &a, Common::U32String &b) {
+ Common::U32String tmp = a;
+ a = b;
+ b = tmp;
+}
+
+
void ZBasic::text(uint16 font, uint16 size, uint16 face, SourceMode mode) {
_toolbox->TextFont(font);
_toolbox->TextSize(size);
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index f89c392c0c5..046b71c4d80 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -272,6 +272,7 @@ public:
int16 rndInt(int16 max);
Common::U32String space(int16 count);
void swapInt(int16 &a, int16 &b);
+ void swapStr(Common::U32String &a, Common::U32String &b);
void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
void writeFileStr(int16 fileNo, const Common::U32String &str);
Commit: 83e0a56906a46d81cb3e6f9011eda836e8d48bf7
https://github.com/scummvm/scummvm/commit/83e0a56906a46d81cb3e6f9011eda836e8d48bf7
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:09+02:00
Commit Message:
FOOL: Cards working
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 6816f22ee65..a05f0c6f0e2 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -19,23 +19,26 @@
*
*/
-#include "common/scummsys.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
-#include "graphics/macgui/macfontmanager.h"
namespace Fool {
extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
+#define CARDS_MAX_SCORE 700
+#define CARDS_MIN_SCORE (-999)
+#define CARDS_YIELD_PENALTY 27
+
// wheel of fortune card game
void FoolGame::cardsRun() {
// 139:0004
this->sub_128_271a();
this->var_i16_c00 = 1;
+ // set up card bounding boxes
g_toolbox->SetRect(this->arr_rect_1f38[1], 0x78, 0x19, 0xd1, 0xae);
g_toolbox->SetRect(this->arr_rect_1f38[2], 0xd3, 0x19, 0x12c, 0xae);
g_toolbox->SetRect(this->arr_rect_1f38[3], 0x12e, 0x19, 0x187, 0xae);
@@ -48,7 +51,7 @@ void FoolGame::cardsRun() {
// 139:011c
for (int i = 0; i <= 0x25; i++) {
- g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_68a);
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
}
this->var_i16_484 = 0x5e;
@@ -59,6 +62,7 @@ void FoolGame::cardsRun() {
// 139:0184
this->sub_128_bde(1, 1, 0, 1, 1, 1);
this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
+ // illustration of the card game
g_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
if (this->var_str_c06 == g_zbasic->str(278)) { // blank
// 139:01fa
@@ -84,7 +88,7 @@ void FoolGame::cardsRun() {
this->arr_i16_1eb8[6] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 3, 2));
// 139:0320
this->var_i16_2010 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 5, 2));
- if ((this->arr_i16_1eb8[5] > 0x2bc) || (this->arr_i16_1eb8[6] > 0x2bc)) {
+ if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->arr_i16_1eb8[5] = 0;
this->arr_i16_1eb8[6] = 0;
this->var_i16_2010 = 0;
@@ -102,9 +106,9 @@ void FoolGame::cardsRun() {
this->arr_rect_4338.right = 0x11e;
this->var_i16_2012 = 0;
this->var_i16_7c6 = 0;
- this->sub_139_1b12();
+ this->cardsDrawScores();
if (this->var_i16_2010 == 0) {
- this->sub_139_51e();
+ this->cardsShuffleDeck();
}
// 139:0456
this->sub_139_582();
@@ -116,7 +120,7 @@ void FoolGame::cardsRun() {
// 139:046e
this->sub_128_c6a(-1);
if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
- this->sub_139_6b0();
+ this->cardsOnClick();
}
if (this->var_i16_2014 != 0) {
this->sub_139_50e();
@@ -130,13 +134,13 @@ void FoolGame::cardsRun() {
this->sub_139_4de();
}
if (this->var_i16_7c6 == 4) {
- this->sub_139_1cba();
+ this->cardsStoreState();
this->sub_128_3536();
}
// 139:04c4
}
// 139:04d6
- this->sub_139_1cba();
+ this->cardsStoreState();
// JMP 1d7e
// 139:1d7e
for (int i = 0; i <= 0x17; i++) {
@@ -145,16 +149,22 @@ void FoolGame::cardsRun() {
}
void FoolGame::sub_139_4de() {
- warning("STUB: %s", __func__);
+ this->arr_i16_1eb8[5] = 0;
+ this->arr_i16_1eb8[6] = 0;
+ this->var_i16_2012 = 0;
+ this->cardsDrawScores();
+ this->cardsShuffleDeck();
+ this->sub_139_582();
}
void FoolGame::sub_139_50e() {
this->var_i16_2014 = 0;
- this->sub_139_51e();
+ this->cardsShuffleDeck();
this->sub_139_582();
}
-void FoolGame::sub_139_51e() {
+void FoolGame::cardsShuffleDeck() {
+ // 139:051e
g_zbasic->unk_20();
for (int j = 0; j <= 2; j++) {
for (int i = 0; i <= 0x15; i++) {
@@ -166,13 +176,13 @@ void FoolGame::sub_139_51e() {
void FoolGame::sub_139_582() {
this->sub_139_17fc();
- this->sub_128_712(5, 0, 0);
- this->sub_128_712(4, 1, 0);
- this->sub_128_712(7, 2, 0);
- this->sub_128_712(6, 0x16, 0);
- this->sub_128_712(1, 4, 0);
- this->sub_128_712(2, 5, 0);
- this->sub_128_712(3, 6, 0);
+ this->drawTarotCard(5, 0, 0);
+ this->drawTarotCard(4, 1, 0);
+ this->drawTarotCard(7, 2, 0);
+ this->drawTarotCard(6, 0x16, 0);
+ this->drawTarotCard(1, 4, 0);
+ this->drawTarotCard(2, 5, 0);
+ this->drawTarotCard(3, 6, 0);
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0xc3;
// 139:061a
@@ -189,25 +199,30 @@ void FoolGame::sub_139_582() {
this->sub_128_6186();
}
-void FoolGame::sub_139_6b0() {
+void FoolGame::cardsOnClick() {
+ // 139:06b0
this->var_i16_1e00 = 0;
if (!((this->var_ev_46.where.x >= 0x78) && (this->var_ev_46.where.y >= 0x19) && (this->var_ev_46.where.x <= 0x187) && (this->var_ev_46.where.y <= 0xae))) {
// 139:06fc
+ // didn't click in the three cards area
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_4338)) {
+ g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ this->sub_128_6186();
g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
if (!g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_4338))
return;
// 139:0778
+ // player clicked the yield button (bad choice)
this->sub_128_50e(0x19, 0x64, 0x0);
- this->var_i16_2012 = -0x1b;
- this->sub_139_1b12();
+ this->var_i16_2012 = -CARDS_YIELD_PENALTY;
+ this->cardsDrawScores();
this->var_i16_2014 = 1;
} else {
// 139:079e
this->sub_128_50e(0xf, 0x64, 0x1);
for (int j = 0; j <= 1; j++) {
for (int16 i = 0; i <= 0x3; i++) {
- this->sub_128_712(i, 0, 3);
+ this->drawTarotCard(i, 0, 3);
}
}
@@ -215,24 +230,25 @@ void FoolGame::sub_139_6b0() {
// 139:07e6
} else {
// 139:07ea
+ // player picked a card
this->fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
- if (this->var_ev_46.where.y < 0xd2) {
+ if (this->var_ev_46.where.x < 0xd2) {
// 139:0818
this->var_i16_1e00 = 4;
- this->sub_128_712(1, 0, 1);
+ this->drawTarotCard(1, 0, 1);
}
// 139:082e
- if ((this->var_ev_46.where.y >= 0xd2) && (this->var_ev_46.where.y <= 0x12d)) {
+ if ((this->var_ev_46.where.x >= 0xd2) && (this->var_ev_46.where.x <= 0x12d)) {
this->var_i16_1e00 = 5;
- this->sub_128_712(2, 0, 1);
+ this->drawTarotCard(2, 0, 1);
}
// 139:0868
- if (this->var_ev_46.where.y > 0x12d) {
+ if (this->var_ev_46.where.x > 0x12d) {
this->var_i16_1e00 = 6;
- this->sub_128_712(3, 0, 1);
+ this->drawTarotCard(3, 0, 1);
}
// 139:088a
- this->sub_128_712(9, this->var_i16_1e00, 0);
+ this->drawTarotCard(9, this->var_i16_1e00, 0);
g_zbasic->indexSet(
g_zbasic->chr(this->arr_i16_5cbc[0]+0x41) + g_zbasic->chr(this->arr_i16_5cbc[2]+0x41) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00]+0x41),
1,
@@ -243,23 +259,25 @@ void FoolGame::sub_139_6b0() {
this->sub_139_a22();
if (this->var_i16_2018 == 0) {
// 139:0920
- this->sub_139_dee();
+ this->cardsRevealHands();
this->var_i16_7a2 = 0xc3;
} else {
// 139:092e
- this->sub_139_da8();
+ this->cardsOpponentYields();
this->var_i16_7a2 = 0xd7;
}
// 139:0938
this->var_i16_2010 = 0;
- if (this->arr_i16_1eb8[5] > 0x2bc) {
+ if (this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) {
this->sub_139_1d3e();
return;
}
// 139:095e
this->sub_128_61ec();
- g_zbasic->text(1, 9, Graphics::kMacFontRegular, kSrcBic);
+ // original code has the font ID as 1... maybe there's a fallback?
+ // this was intended to be Small
+ g_zbasic->text(0xfc, 9, Graphics::kMacFontRegular, kSrcBic);
this->sub_128_918(g_zbasic->str(282)); // (click mouse to continue)
this->var_i16_2014 = 0;
this->var_i16_7c6 = 0;
@@ -269,7 +287,7 @@ void FoolGame::sub_139_6b0() {
this->var_i16_2014 = 1;
}
if (this->var_i16_7c6 == 4) {
- this->sub_139_1cba();
+ this->cardsStoreState();
this->sub_128_3536();
}
if (this->var_ev_46.what == kNullEvent) {
@@ -277,7 +295,7 @@ void FoolGame::sub_139_6b0() {
}
}
// 139:09d8
- if (((this->var_i16_7c6 & 1) == 0) && (this->arr_i16_1eb8[6] > 0x2bc)) {
+ if (((this->var_i16_7c6 & 1) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->var_i16_7c6 = 2;
this->var_i16_2014 = 0;
}
@@ -322,10 +340,16 @@ void FoolGame::sub_139_a22() {
this->arr_i16_1eb8[2] = this->var_i16_221c;
this->sub_139_191c();
this->var_i16_221c = 0;
+ // cycle backwards through the scoring combinations
for (int16 j = 8; j >= 1; j--) {
this->var_i16_7a8 = 0;
+ // count the number of combination cards in the hand
for (int16 i = 1; i <= (int16)g_zbasic->index(1, j + 0x15).size(); i++) {
- if (g_zbasic->instr(1, this->var_str_201a, g_zbasic->midStr(g_zbasic->index(1, j + 0x15), i, 1))) {
+ if (g_zbasic->instr(
+ 1,
+ this->var_str_201a,
+ g_zbasic->midStr(g_zbasic->index(1, j + 0x15), i, 1))
+ ) {
this->var_i16_7a8++;
}
// 139:0c72
@@ -353,32 +377,33 @@ void FoolGame::sub_139_a22() {
}
}
// 139:0d6e
- if ((this->var_i16_2018 == 1) && ((this->var_i16_221c + 1)*9 <= 0x1b)) {
+ if ((this->var_i16_2018 == 1) && ((this->var_i16_221c + 1)*9 <= CARDS_YIELD_PENALTY)) {
this->var_i16_2018 = 0;
}
// 139:0da6
}
-void FoolGame::sub_139_da8() {
+void FoolGame::cardsOpponentYields() {
// 139:0da8
+ // ol' mate gives up
this->sub_128_50e(0x19, 0x64, 0x1);
- this->var_i16_2012 = -0x1b;
- this->sub_139_1b12();
+ this->var_i16_2012 = -CARDS_YIELD_PENALTY;
+ this->cardsDrawScores();
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0xc4;
this->sub_128_918(g_zbasic->str(283)); // The Old Man yields
}
-void FoolGame::sub_139_dee() {
+void FoolGame::cardsRevealHands() {
// 139:0dee
// remove the three cards from the top row
- this->sub_128_712(1, 0, 1);
- this->sub_128_712(2, 0, 1);
- this->sub_128_712(3, 0, 1);
+ this->drawTarotCard(1, 0, 1);
+ this->drawTarotCard(2, 0, 1);
+ this->drawTarotCard(3, 0, 1);
- // draw ol' mate's pick from the pile
- this->sub_128_712(8, this->var_i16_1e00, 0);
+ // show ol' mate's draw from the pile
+ this->drawTarotCard(8, this->var_i16_1e00, 0);
g_zbasic->indexSet(g_zbasic->index(1, 0x27) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
// 139:0e70
@@ -403,8 +428,8 @@ void FoolGame::sub_139_dee() {
// 139:0f84
g_zbasic->indexSet(
g_zbasic->index(1,0x15 - this->arr_i16_1eb8[i + 2]),
- i + 0x29,
- 1
+ 1,
+ i + 0x29
);
// 139:0fca
if (g_zbasic->index(1, i + 0x27) == g_zbasic->str(287)) { // blank
@@ -448,11 +473,11 @@ void FoolGame::sub_139_dee() {
}
}
// 139:1174
- this->sub_128_712(6, 3, 0);
+ this->drawTarotCard(6, 3, 0);
// calculate number of points gained by the winner
this->var_i16_2012 = 9*(this->arr_i16_1eb8[this->var_i16_2016] + 1);
- this->sub_139_1b12();
+ this->cardsDrawScores();
if (this->var_i16_2016 == 1) {
this->var_str_384 = g_zbasic->str(290); // The fool
} else {
@@ -460,7 +485,7 @@ void FoolGame::sub_139_dee() {
this->var_str_384 = g_zbasic->str(291); // The Old Man
}
// 139:11e2
- if ((this->arr_i16_1eb8[5] > 0x2bc) || (this->arr_i16_1eb8[6] > 0x2bc)) {
+ if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->var_str_9f4 = g_zbasic->str(292); // the game!
} else {
// 139:123e
@@ -468,7 +493,9 @@ void FoolGame::sub_139_dee() {
}
// 139:1264
this->var_str_384 += g_zbasic->str(294) + this->var_str_9f4; // X wins Y
+ // winning hand
this->var_str_167c = g_zbasic->index(1, 0x28);
+ // losing hand
this->var_str_2222 = g_zbasic->index(1, 0x29);
if (this->var_i16_2016 == 2) {
g_zbasic->swapStr(this->var_str_167c, this->var_str_2222);
@@ -489,14 +516,14 @@ void FoolGame::sub_139_dee() {
}
// 139:1344
this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
- this->fillRect(0x23, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
+ this->fillRect(0x2e, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0x46;
this->sub_128_918(this->var_str_384);
this->var_i16_7a2 = 0x64;
this->sub_128_918(this->var_str_167c);
this->var_i16_7a2 = 0x78;
- this->sub_128_918(g_zbasic->str(295));
+ this->sub_128_918(g_zbasic->str(295)); // beats
this->var_i16_7a2 = 0x8c;
this->sub_128_918(this->var_str_2222);
if (this->arr_i16_1eb8[1] != 0) {
@@ -510,7 +537,7 @@ void FoolGame::sub_139_dee() {
g_zbasic->index(1, 0x15 + this->var_i16_68a),
g_zbasic->midStr(g_zbasic->index(1, 0x26), 1, 1)
) == 0) {
- this->sub_128_712(5, 0, 2);
+ this->drawTarotCard(5, 0, 2);
}
// 139:1470
if (g_zbasic->instr(
@@ -518,7 +545,7 @@ void FoolGame::sub_139_dee() {
g_zbasic->index(1, 0x15 + this->var_i16_68a),
g_zbasic->midStr(g_zbasic->index(1, 0x26), 2, 1)
) == 0) {
- this->sub_128_712(7, 0, 2);
+ this->drawTarotCard(7, 0, 2);
}
// 139:14c0
if (g_zbasic->instr(
@@ -526,20 +553,20 @@ void FoolGame::sub_139_dee() {
g_zbasic->index(1, 0x15 + this->var_i16_68a),
g_zbasic->midStr(g_zbasic->index(1, 0x26), 3, 1)
) == 0) {
- this->sub_128_712(9, 0, 2);
+ this->drawTarotCard(9, 0, 2);
}
} else {
// 139:1514
this->var_str_384 = g_zbasic->chr((0x15 - this->arr_i16_1eb8[3]) + 0x41);
if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 1, 1) != this->var_str_384) {
- this->sub_128_712(5, 0, 2);
+ this->drawTarotCard(5, 0, 2);
}
// 139:157e
if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 2, 1) != this->var_str_384) {
- this->sub_128_712(7, 0, 2);
+ this->drawTarotCard(7, 0, 2);
}
if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 3, 1) != this->var_str_384) {
- this->sub_128_712(9, 0, 2);
+ this->drawTarotCard(9, 0, 2);
}
}
// 139:15f2
@@ -549,28 +576,28 @@ void FoolGame::sub_139_dee() {
this->var_i16_68a -= 8;
}
if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 1, 1)) == 0) {
- this->sub_128_712(4, 0, 2);
+ this->drawTarotCard(4, 0, 2);
}
// 139:1678
if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 2, 1)) == 0) {
- this->sub_128_712(6, 0, 2);
+ this->drawTarotCard(6, 0, 2);
}
// 139:16c8
if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 3, 1)) == 0) {
- this->sub_128_712(8, 0, 2);
+ this->drawTarotCard(8, 0, 2);
}
} else {
// 139:171c
this->var_str_384 = g_zbasic->chr((0x15 - this->arr_i16_1eb8[4]) + 0x41);
if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 1, 1)) {
- this->sub_128_712(4, 0, 2);
+ this->drawTarotCard(4, 0, 2);
}
// 139:1786
if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 2, 1)) {
- this->sub_128_712(6, 0, 2);
+ this->drawTarotCard(6, 0, 2);
}
if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 3, 1)) {
- this->sub_128_712(8, 0, 2);
+ this->drawTarotCard(8, 0, 2);
}
}
// 139:17fa
@@ -609,6 +636,7 @@ void FoolGame::sub_139_19da() {
// 139:19da
this->arr_i16_1eb8[this->var_i16_2016] = 0;
for (int k = 1; k <= 2; k++) {
+ // cycle backward through the scoring combinations
for (int j = 8; j >= 1; j--) {
this->var_i16_7a8 = 0;
for (int i = 1; i <= (int)g_zbasic->index(1, j + 0x15).size(); i++) {
@@ -622,31 +650,28 @@ void FoolGame::sub_139_19da() {
// 139:1a4c
}
// 139:1a6a
- if ((k == 2) && (this->var_i16_7a8 == 2)) {
- this->sub_139_1ad6();
- }
- if ((k == 1) && (this->var_i16_7a8 == 3)) {
- this->sub_139_1ad6();
+ if (((k == 2) && (this->var_i16_7a8 == 2)) ||
+ ((k == 1) && (this->var_i16_7a8 == 3))) {
+ // 139:1ad6
+ this->arr_i16_1eb8[this->var_i16_2016] = (this->var_i16_7a8 - 2)*8 + j;
+ j = 1;
+ k = 2;
}
}
// 139:1ac6
}
}
-void FoolGame::sub_139_1ad6() {
- warning("STUB: %s", __func__);
-}
-
-void FoolGame::sub_139_1b12() {
+void FoolGame::cardsDrawScores() {
// 139:1b12
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->arr_i16_1eb8[this->var_i16_2016 + 4] += this->var_i16_2012;
- if (this->arr_i16_1eb8[5] < -999) {
- this->arr_i16_1eb8[5] = -999;
+ if (this->arr_i16_1eb8[5] < CARDS_MIN_SCORE) {
+ this->arr_i16_1eb8[5] = CARDS_MIN_SCORE;
}
// 139:1b88
- if (this->arr_i16_1eb8[6] < -999) {
- this->arr_i16_1eb8[6] = -999;
+ if (this->arr_i16_1eb8[6] < CARDS_MIN_SCORE) {
+ this->arr_i16_1eb8[6] = CARDS_MIN_SCORE;
}
// 139:1bb2
this->fillRect(0x14, 0, 0x29, 0x5a, 2);
@@ -664,12 +689,26 @@ void FoolGame::sub_139_1b12() {
g_toolbox->DrawString(this->var_str_384);
}
-void FoolGame::sub_139_1cba() {
- warning("STUB: %s", __func__);
+void FoolGame::cardsStoreState() {
+ // 139:1cba
+ this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[5]) +
+ g_zbasic->unk_88(this->arr_i16_1eb8[6]) +
+ g_zbasic->unk_88(this->var_i16_2010);
+ // 139:1d00
+ for (int i = 0; i <= 0x15; i++) {
+ this->var_str_c06 += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
+ }
}
void FoolGame::sub_139_1d3e() {
- warning("STUB: %s", __func__);
+ // 139:1d3e
+ this->var_i16_7c6 = 1;
+ if (this->var_i16_c04 >= 0x64) {
+ this->var_i16_c04 = 0x64;
+ }
+ this->sub_128_6186();
+ this->sub_128_2664();
+ this->sub_128_d34(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index a4395f8a015..bc5e875492b 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -431,10 +431,10 @@ void FoolGame::sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3,
g_toolbox->PenNormal();
}
-void FoolGame::sub_128_712(int16 rectID, int16 deckPos, int16 unk1) {
+void FoolGame::drawTarotCard(int16 rectID, int16 deckPos, int16 type) {
// 128:0712
g_toolbox->PenNormal();
- if (unk1 == 0) {
+ if (type == 0) {
g_toolbox->PenSize(0x3, 0x3);
g_toolbox->PenPat(this->arr_pat_58f4[0]);
g_toolbox->FrameRoundRect(this->arr_rect_1f38[rectID], 0xf, 0xf);
@@ -445,16 +445,16 @@ void FoolGame::sub_128_712(int16 rectID, int16 deckPos, int16 unk1) {
g_zbasic->picture(this->arr_rect_1f38[rectID].left + 3, this->arr_rect_1f38[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
}
// 128:0806
- if (unk1 == 1) {
+ if (type == 1) {
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->PaintRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
}
- if (unk1 == 2) {
+ if (type == 2) {
g_toolbox->PenMode(kPatOr);
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->PaintRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
}
- if (unk1 == 3) {
+ if (type == 3) {
g_toolbox->InvertRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
}
g_toolbox->PenNormal();
@@ -2313,7 +2313,8 @@ void FoolGame::sub_128_6186() {
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(6, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
- g_toolbox->Delay(0);
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
}
@@ -2323,7 +2324,8 @@ void FoolGame::sub_128_61c2() {
this->sub_128_6186();
this->var_i16_7a8 = g_toolbox->GetNextEvent(2, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
- g_toolbox->Delay(0);
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
} while ((this->var_ev_46.what != 1));
this->sub_128_6186();
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index b71b7a22bcc..012f75d5b1d 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -55,7 +55,7 @@ public:
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
- void sub_128_712(int16 rectID, int16 deckPos, int16 unk1);
+ void drawTarotCard(int16 rectID, int16 deckPos, int16 type); // sub_128_712
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
void sub_128_918(const Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
@@ -176,18 +176,17 @@ public:
void cardsRun(); // sub_139_004
void sub_139_4de();
void sub_139_50e();
- void sub_139_51e();
+ void cardsShuffleDeck(); // sub_139_51e
void sub_139_582();
- void sub_139_6b0();
+ void cardsOnClick(); // sub_139_6b0
void sub_139_a22();
- void sub_139_da8();
- void sub_139_dee();
+ void cardsOpponentYields(); // sub_139_da8
+ void cardsRevealHands(); // sub_139_dee
void sub_139_17fc();
void sub_139_191c();
void sub_139_19da();
- void sub_139_1ad6();
- void sub_139_1b12();
- void sub_139_1cba();
+ void cardsDrawScores(); // sub_139_1b12
+ void cardsStoreState(); // sub_139_1cba
void sub_139_1d3e();
void sub_140_004();
Commit: fb0247f8f5d7491d84c973c4f3e98f822d4de3ba
https://github.com/scummvm/scummvm/commit/fb0247f8f5d7491d84c973c4f3e98f822d4de3ba
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:09+02:00
Commit Message:
MACGUI: Shift large submenus left to fit on the screen
Changed paths:
graphics/macgui/macmenu.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 9e8d11ffc17..dec4c193f40 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -951,7 +951,7 @@ int MacMenu::calcSubMenuWidth(MacMenuSubMenu *submenu) {
}
}
}
- return maxWidth > 225 ? 225 : maxWidth;
+ return MIN(maxWidth, _bbox.width() - _menuLeftDropdownPadding - _menuRightDropdownPadding);
}
void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
@@ -966,6 +966,12 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
int y2 = y1 + submenu->items.size() * _menuDropdownItemHeight + 2;
y2 = MIN(y2, y1 + ((_screen.h - y1) / _menuDropdownItemHeight) * _menuDropdownItemHeight + 2);
+ if (x2 > (_bbox.width()-_menuRightDropdownPadding)) {
+ int dx = x2 - (_bbox.width()-_menuRightDropdownPadding);
+ x1 -= dx;
+ x2 -= dx;
+ }
+
submenu->bbox.left = x1;
submenu->bbox.top = y1;
submenu->bbox.right = x2;
Commit: 80f1b8598d07455654f53b4059c0c445e2f11ae1
https://github.com/scummvm/scummvm/commit/80f1b8598d07455654f53b4059c0c445e2f11ae1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:09+02:00
Commit Message:
FOOL: First pass of death
Changed paths:
A engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
new file mode 100644
index 00000000000..bc2f817b3b1
--- /dev/null
+++ b/engines/fool/fool_death.cpp
@@ -0,0 +1,207 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+void FoolGame::sub_141_004() {
+ // 141:0004
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
+ this->sub_128_55c(g_zbasic->str(334));
+ g_toolbox->InvertRect(this->arr_rect_1910c);
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kPutCopy);
+ this->sub_141_934();
+ this->fillRect(0x14f, 0, 0x156, 0x7, 0x2);
+ this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
+ this->arr_rect_1eb8.top = 0x1e;
+ this->arr_rect_1eb8.left = 0x190;
+ this->arr_rect_1eb8.bottom = 0x2e;
+ this->arr_rect_1eb8.right = 0x1a8;
+ // 141:0122
+ g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ this->var_ev_46.where.y = 0x14;
+ // JMP 0x3c2
+ while (true) {
+ // 141:01c8
+ // JMP 0x232
+ while (this->var_ev_46.where.y >= 0x14) {
+ // 141:01cc
+ this->sub_128_c6a(-1);
+ this->sub_141_3ca();
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1eb8)) {
+ this->sub_141_8b8();
+ this->sub_141_9f6();
+ }
+ // 141:0200
+ if (this->var_i16_7c6 == 2) {
+ this->var_i16_7c6 = 0;
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_128_3536();
+ }
+ if ((this->var_i16_7c6 & 1)) {
+ // 141:09f6
+ this->sub_141_882();
+ return;
+ }
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+ }
+ // 141:023a
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
+ this->sub_128_55c(g_zbasic->str(335)); // "~"
+ this->var_i16_233a = 1;
+ // JMP 0x2be
+ while (this->var_ev_46.where.y < 0x14) {
+ // 141:0282
+ this->sub_141_3ca();
+ this->sub_128_c6a(-1);
+ if (this->var_i16_7c6 == 2) {
+ this->var_i16_7c6 = 0;
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_128_3536();
+ }
+
+ }
+ // 141:02c6
+ this->sub_128_c6a(0);
+ if (!g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ this->sub_141_35a();
+ }
+ this->var_i32_692 = g_toolbox->TickCount();
+ // 141:02fa
+ do {
+ this->sub_128_c6a(0);
+ if (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) &&
+ g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ // JMP 0x9a2
+ // 141:09a2
+ this->sub_141_882();
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
+ this->sub_141_934();
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ }
+ this->sub_141_882();
+ return;
+ }
+ // 141:0342
+ } while (g_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
+ // 141:035a
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(kNotPatXor);
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenSize(0x17, 0x10);
+ for (int i = 0; i <= 5; i++) {
+ g_toolbox->MoveTo(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top);
+ g_toolbox->LineTo(0x6c, 0x127);
+ }
+ // 141:03bc
+ this->sub_141_882();
+ g_toolbox->PenNormal();
+ }
+ // 141:03c2
+ this->sub_141_3ca();
+}
+
+void FoolGame::sub_141_3ca() {
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.left, this->arr_bmp_b3ec, kPutCopy);
+ this->var_i16_68a = this->var_ev_46.where.x - 0xc - this->arr_rect_1eb8.left;
+ this->var_i16_68c = this->var_ev_46.where.y - 8 - this->arr_rect_1eb8.top;
+ // 141:0452
+ if (this->var_i16_68c < -4) {
+ this->var_i16_68c = -4;
+ }
+ if (this->var_i16_68c > 4) {
+ this->var_i16_68c = 4;
+ }
+ if (this->var_i16_68a < -6) {
+ this->var_i16_68a = -6;
+ }
+ if (this->var_i16_68a > 6) {
+ this->var_i16_68a = 6;
+ }
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ // 141:04ce
+ this->arr_rect_1ec0.top = this->arr_rect_1eb8.top + this->var_i16_68c;
+ this->arr_rect_1ec0.left = this->arr_rect_1eb8.left + this->var_i16_68a;
+ this->arr_rect_1ec0.bottom = this->arr_rect_1eb8.bottom + this->var_i16_68c;
+ this->arr_rect_1ec0.right = this->arr_rect_1eb8.right + this->var_i16_68a;
+
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ // 141:05a2
+ if (this->arr_rect_1ec0.top < 0x14) {
+ this->arr_rect_1ec0.top = 0x14;
+ this->arr_rect_1ec0.bottom = 0x24;
+ }
+ // 141:05dc
+ if (this->arr_rect_1ec0.left < 0) {
+ this->arr_rect_1ec0.left = 0;
+ this->arr_rect_1ec0.right = 0x18;
+ }
+ // 141:060c
+ if (this->arr_rect_1ec0.bottom > SCREEN_HEIGHT) {
+ this->arr_rect_1ec0.top = 0x146;
+ this->arr_rect_1ec0.bottom = 0x156;
+ }
+ if (this->arr_rect_1ec0.right > SCREEN_WIDTH) {
+ this->arr_rect_1ec0.left = 0x1e8;
+ this->arr_rect_1ec0.right = 0x200;
+ }
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ // 141:06bc
+ if (!((this->arr_rect_1eb8.top == this->arr_rect_1ec0.top) &&
+ ((this->arr_rect_1eb8.left == this->arr_rect_1ec0.left)))) {
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
+ this->arr_rect_1eb8 = this->arr_rect_1ec0;
+
+ }
+ // 141:0880
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_141_882() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_141_8b8() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_141_934() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_141_9f6() {
+ warning("STUB: %s", __func__);
+}
+
+}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index bc5e875492b..7ad41aee23a 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -393,7 +393,7 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
}
}
-void FoolGame::sub_128_55c(Common::U32String &unk1) {
+void FoolGame::sub_128_55c(const Common::U32String &unk1) {
// 128:055c
g_zbasic->stringCopy(this->var_str_172, unk1);
g_toolbox->PenNormal();
@@ -2445,6 +2445,14 @@ void FoolGame::sub_129_068() {
this->var_i32_8 = &this->arr_grafport_19042;
g_toolbox->OpenPort(this->var_i32_8);
+ // this grafport is used for drawing on the menu bar area;
+ // on normal hardware this isn't a problem, as the changes are
+ // made directly to the screen framebuffer.
+ // in ScummVM, the window and the menu bar are widgets, with surfaces
+ // that are composed to the screen framebuffer.
+ // as such, to avoid a clash, we need to draw onto the menu bar widget.
+ this->var_i32_8->portBits = g_toolbox->_defaultMenuBits;
+ this->var_i32_8->portRect = g_toolbox->_defaultMenuBits->getBounds();
this->var_i32_4 = &this->arr_grafport_18f78;
g_toolbox->OpenPort(this->var_i32_4);
@@ -2820,6 +2828,7 @@ void FoolGame::sub_129_068() {
}
void FoolGame::sub_129_123a() {
+ // draw the loading text on the menu bar
g_toolbox->SetPort(this->var_i32_8);
this->fillRect(0, 7, 0x13, this->var_i16_5a - 7, 0);
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
@@ -2829,6 +2838,7 @@ void FoolGame::sub_129_123a() {
g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xe);
g_toolbox->DrawString(this->var_str_172);
g_toolbox->SetPort(this->var_i32_0);
+ g_toolbox->Delay(0);
}
// word jumble/substitute puzzle
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 012f75d5b1d..04449060be9 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -51,7 +51,7 @@ public:
Common::U32String puzzlesReadString(); // sub_128_49a
void sub_128_4da(int16 unk1);
void sub_128_50e(int16 freq, int16 duration, int16 wait);
- void sub_128_55c(Common::U32String &unk1);
+ void sub_128_55c(const Common::U32String &unk1);
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
@@ -190,7 +190,15 @@ public:
void sub_139_1d3e();
void sub_140_004();
+
+ // fool_death.cpp
void sub_141_004();
+ void sub_141_35a();
+ void sub_141_3ca();
+ void sub_141_882();
+ void sub_141_8b8();
+ void sub_141_934();
+ void sub_141_9f6();
void sub_142_004();
void sub_142_852();
@@ -382,6 +390,8 @@ private:
Common::U32String var_str_2222;
int16 var_i16_2322;
+ int16 var_i16_233a;
+
// FIXME: bounds on the following are guessed! need to trace index range
int16 pageLineRanges[202]; // arr_i16_0
int16 pageLineFace[1301]; // arr_i16_194
@@ -401,6 +411,9 @@ private:
int16 arr_i16_1d24[202];
int16 arr_i16_1dee[202];
int16 arr_i16_1eb8[0x29];
+ // used just for death?
+ Common::Rect arr_rect_1eb8;
+ Common::Rect arr_rect_1ec0;
Common::Rect arr_rect_1f38[0x200];
int16 arr_i16_2f38[0xc00]; // 96x32?
int16 arr_i16_3738[0x400];
@@ -428,6 +441,8 @@ private:
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap arr_jigsaw_5dfc[128];
BitMap arr_bmp_b3ec;
+ BitMap arr_bmp_bbbc;
+ BitMap arr_bmp_c38c;
Handle arr_bytes_109dc; // used for data buffering
BitMap arr_bmp_109dc;
BitMap arr_bmp_15fcc;
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 486b0a42d47..fb0448b4824 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
siphash/halfsip.o \
fool.o \
fool_cards.o \
+ fool_death.o \
fool_game.o \
fool_jigsaw.o \
fool_polyomino.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 38600ae1e0c..9fbafd82591 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -529,6 +529,7 @@ public:
Graphics::MacWindow *_defaultWindow;
Graphics::MacMenu *_defaultMenu;
BitMap _defaultBits;
+ BitMap _defaultMenuBits;
// toolbox.cpp
@@ -1261,6 +1262,7 @@ private:
void _drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight);
void _drawBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame, bool compressed);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
+ void _addDirtyRect(const Common::Rect &rect);
};
} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 3cef7f8728a..87deccd94a8 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -132,10 +132,7 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
}
}
Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(clipDstRect.left, clipDstRect.top), mode);
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(result);
- _defaultWindow->setDirty(true);
- }
+ _addDirtyRect(result);
}
// maybe the better way of refactoring this would be to fork the Primitives
@@ -194,6 +191,17 @@ void Toolbox::EndUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::EndUpdate");
}
+void Toolbox::_addDirtyRect(const Common::Rect &rect) {
+ if (_port->portBits == _defaultBits) {
+ _defaultWindow->addDirtyRect(rect);
+ _defaultWindow->setDirty(true);
+ }
+ if (_port->portBits == _defaultMenuBits) {
+ // _defaultMenu->addDirtyRect(dstRect);
+ _defaultMenu->setDirty(true);
+ }
+}
+
void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
if ((!r.isValidRect()) || r.isEmpty()) {
warning("Toolbox::_drawOval: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
@@ -219,10 +227,7 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
pm.drawEllipse(0, 0, destRect.width(), destRect.height(), fgColor, !frame, &pd);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ _addDirtyRect(dstRect);
}
}
@@ -286,11 +291,7 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
debugC(5, kDebugGraphics, "Toolbox::_drawPoly: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
- // Dirty rects check
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ _addDirtyRect(dstRect);
}
}
@@ -332,11 +333,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
debugC(5, kDebugGraphics, "Toolbox::_drawRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
- // Dirty rects check
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ _addDirtyRect(dstRect);
}
}
@@ -373,11 +370,7 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
debugC(5, kDebugGraphics, "Toolbox::_drawRoundRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x, ovalWidth %d, ovalHeight %d", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor, ovalWidth, ovalHeight);
}
- // Dirty rects check
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ _addDirtyRect(dstRect);
}
}
@@ -600,10 +593,7 @@ void Toolbox::LineTo(int16 h, int16 v) {
pm.drawLine(startPos.x, startPos.y, endPos.x, endPos.y, _port->fgColor, &pd);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
- if (_port->portBits == _defaultBits) {
- _defaultWindow->addDirtyRect(dstRect);
- _defaultWindow->setDirty(true);
- }
+ _addDirtyRect(dstRect);
}
if (_port) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 115931bf151..b825da9cfaa 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -54,6 +54,9 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
_window->setSurface(_toolbox->_defaultBits.get(), DisposeAfterUse::NO);
+ _toolbox->_defaultMenuBits = BitMap(new Graphics::ManagedSurface());
+ _toolbox->_defaultMenuBits->copyFrom(*_menu->getWindowSurface());
+ _menu->setSurface(_toolbox->_defaultMenuBits.get(), DisposeAfterUse::NO);
GrafPtr port(new GrafPort);
_toolbox->OpenPort(port);
_toolbox->SetPort(port);
Commit: c26619f5893cd0cd37af4f20b9b65d9e01a52b64
https://github.com/scummvm/scummvm/commit/c26619f5893cd0cd37af4f20b9b65d9e01a52b64
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:10+02:00
Commit Message:
FOOL: Death game working
Changed paths:
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index bc2f817b3b1..ae4c3903d1e 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -29,14 +29,15 @@ namespace Fool {
extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
-void FoolGame::sub_141_004() {
+// Death challenge
+void FoolGame::deathRun() {
// 141:0004
g_zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
this->sub_128_55c(g_zbasic->str(334));
g_toolbox->InvertRect(this->arr_rect_1910c);
g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kPutCopy);
- this->sub_141_934();
+ this->deathDrawZoom();
this->fillRect(0x14f, 0, 0x156, 0x7, 0x2);
this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
this->arr_rect_1eb8.top = 0x1e;
@@ -54,10 +55,12 @@ void FoolGame::sub_141_004() {
while (this->var_ev_46.where.y >= 0x14) {
// 141:01cc
this->sub_128_c6a(-1);
- this->sub_141_3ca();
+ this->deathMoveBlackEye();
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1eb8)) {
- this->sub_141_8b8();
- this->sub_141_9f6();
+ this->deathCaught();
+ // 141:09f6
+ this->deathDrawWhiteEye();
+ return;
}
// 141:0200
if (this->var_i16_7c6 == 2) {
@@ -68,7 +71,7 @@ void FoolGame::sub_141_004() {
}
if ((this->var_i16_7c6 & 1)) {
// 141:09f6
- this->sub_141_882();
+ this->deathDrawWhiteEye();
return;
}
if (this->var_ev_46.what == kNullEvent)
@@ -80,8 +83,9 @@ void FoolGame::sub_141_004() {
this->var_i16_233a = 1;
// JMP 0x2be
while (this->var_ev_46.where.y < 0x14) {
+ // cursor is over the top menu, safe
// 141:0282
- this->sub_141_3ca();
+ this->deathMoveBlackEye();
this->sub_128_c6a(-1);
if (this->var_i16_7c6 == 2) {
this->var_i16_7c6 = 0;
@@ -89,33 +93,37 @@ void FoolGame::sub_141_004() {
if (this->var_i16_7c6 == 4) {
this->sub_128_3536();
}
-
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
}
// 141:02c6
this->sub_128_c6a(0);
- if (!g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
- this->sub_141_35a();
- }
- this->var_i32_692 = g_toolbox->TickCount();
- // 141:02fa
- do {
- this->sub_128_c6a(0);
- if (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) &&
- g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
- // JMP 0x9a2
- // 141:09a2
- this->sub_141_882();
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
- this->sub_141_934();
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ this->var_i32_692 = g_toolbox->TickCount();
+ // 141:02fa
+ do {
+ this->sub_128_c6a(0);
+ if (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) &&
+ g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ // JMP 0x9a2
+ // 141:09a2
+ this->deathDrawWhiteEye();
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
+ this->deathDrawZoom();
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ }
+ this->deathDrawWhiteEye();
+ return;
}
- this->sub_141_882();
- return;
- }
- // 141:0342
- } while (g_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(0);
+ }
+ // 141:0342
+ } while (g_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
+ }
// 141:035a
+ // mouse moved out from menu, zap the white eye
g_toolbox->PenNormal();
g_toolbox->PenMode(kNotPatXor);
g_toolbox->PenPat(this->arr_pat_58f4[1]);
@@ -123,17 +131,19 @@ void FoolGame::sub_141_004() {
for (int i = 0; i <= 5; i++) {
g_toolbox->MoveTo(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top);
g_toolbox->LineTo(0x6c, 0x127);
+ g_toolbox->Delay(0);
}
// 141:03bc
- this->sub_141_882();
+ this->deathDrawWhiteEye();
g_toolbox->PenNormal();
}
// 141:03c2
- this->sub_141_3ca();
+ this->deathMoveBlackEye();
}
-void FoolGame::sub_141_3ca() {
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.left, this->arr_bmp_b3ec, kPutCopy);
+void FoolGame::deathMoveBlackEye() {
+ // 141:03ca
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
this->var_i16_68a = this->var_ev_46.where.x - 0xc - this->arr_rect_1eb8.left;
this->var_i16_68c = this->var_ev_46.where.y - 8 - this->arr_rect_1eb8.top;
// 141:0452
@@ -180,28 +190,40 @@ void FoolGame::sub_141_3ca() {
// 141:06bc
if (!((this->arr_rect_1eb8.top == this->arr_rect_1ec0.top) &&
((this->arr_rect_1eb8.left == this->arr_rect_1ec0.left)))) {
+ // 141:0722
g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
this->arr_rect_1eb8 = this->arr_rect_1ec0;
-
+ g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ this->sub_128_3da(1);
}
// 141:0880
- warning("STUB: %s", __func__);
}
-void FoolGame::sub_141_882() {
- warning("STUB: %s", __func__);
+void FoolGame::deathDrawWhiteEye() {
+ // 141:0882
+ if (this->var_i16_233a != 0) {
+ g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kPutCopy);
+ }
+ // 141:08b0
+ this->var_i16_233a = 0;
}
-void FoolGame::sub_141_8b8() {
- warning("STUB: %s", __func__);
+void FoolGame::deathCaught() {
+ // 141:08b8
+ this->deathDrawWhiteEye();
+ this->sub_128_4da(0);
+ this->sub_128_962(this->arr_rect_1eb8.top, this->arr_rect_1eb8.left, this->arr_rect_1eb8.bottom, this->arr_rect_1eb8.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ this->sub_128_4da(1);
}
-void FoolGame::sub_141_934() {
- warning("STUB: %s", __func__);
+void FoolGame::deathDrawZoom() {
+ // 141:0934
+ for (int i = 1; i <= 2; i++) {
+ this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ }
+ this->sub_128_69c(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
}
-void FoolGame::sub_141_9f6() {
- warning("STUB: %s", __func__);
-}
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 7ad41aee23a..fe0bcb85228 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -42,6 +42,8 @@ void FoolGame::sub_128_004() {
// Define the bitmap surfaces (normally pointers to raw memory)
this->arr_bmp_5dfc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_bbbc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_c38c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_109dc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_15fcc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
@@ -1649,7 +1651,7 @@ void FoolGame::sub_128_39a0() {
this->sub_140_004();
break;
case 14:
- this->sub_141_004();
+ this->deathRun();
break;
case 15:
this->sub_128_5140();
@@ -2977,11 +2979,6 @@ void FoolGame::sub_140_004() {
warning("STUB: %s", __func__);
}
-// death
-void FoolGame::sub_141_004() {
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_142_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 04449060be9..14fa54badd6 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -192,13 +192,11 @@ public:
void sub_140_004();
// fool_death.cpp
- void sub_141_004();
- void sub_141_35a();
- void sub_141_3ca();
- void sub_141_882();
- void sub_141_8b8();
- void sub_141_934();
- void sub_141_9f6();
+ void deathRun(); // sub_141_004
+ void deathMoveBlackEye(); // sub_141_3ca
+ void deathDrawWhiteEye(); // sub_141_882
+ void deathCaught(); // sub_141_8b8
+ void deathDrawZoom(); // sub_141_934
void sub_142_004();
void sub_142_852();
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 87deccd94a8..1fa07bf1c89 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -581,7 +581,10 @@ void Toolbox::LineTo(int16 h, int16 v) {
BitMap intermediate(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
BitMap mask(new Graphics::ManagedSurface(interRect.width(), interRect.height()));
- Common::Point destPos(dirVec.x < 0 ? h + dirVec.x : h - dirVec.x, dirVec.y < 0 ? v + dirVec.y : v - dirVec.y);
+ Common::Point destPos(
+ dirVec.x < 0 ? (_port->pnLoc.x + dirVec.x) : _port->pnLoc.x,
+ dirVec.y < 0 ? (_port->pnLoc.y + dirVec.y) : _port->pnLoc.y
+ );
// move to port coordinate space
destPos.x += _port->portRect.left;
destPos.y += _port->portRect.top;
Commit: 6eeecdcae50ebfeb8836343a31f05bb5976cc7f9
https://github.com/scummvm/scummvm/commit/6eeecdcae50ebfeb8836343a31f05bb5976cc7f9
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:10+02:00
Commit Message:
FOOL: Add first pass of Sun's map
Changed paths:
A engines/fool/fool_sun.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index fe0bcb85228..fe029d5e1f8 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1126,7 +1126,15 @@ void FoolGame::sub_128_271a() {
// new game
void FoolGame::sub_128_27d6() {
- warning("STUB: %s", __func__);
+ // 128:27d6
+ this->sub_128_32fa();
+ if (this->var_i16_7be == 3)
+ return;
+ if (this->var_i16_7ce & 1) {
+ this->sub_128_1c2c(9);
+ } else {
+ this->sub_128_1c2c(8);
+ }
}
@@ -1229,6 +1237,7 @@ void FoolGame::sub_128_2a92() {
// quit
void FoolGame::sub_128_2ab6() {
+ // 128:2ab6
this->sub_128_32fa();
if (this->var_i16_7be == 3) {
return;
@@ -1242,7 +1251,12 @@ void FoolGame::sub_128_2ab6() {
// print story
void FoolGame::sub_128_2ae8() {
- warning("STUB: %s", __func__);
+ // 128:2ae8
+ if (this->var_i16_7ce & 1) {
+ this->var_i16_7c6 = 0x401;
+ } else {
+ this->var_i16_7c6 = 0x400;
+ }
}
@@ -2965,11 +2979,6 @@ void FoolGame::sub_136_004() {
warning("STUB: %s", __func__);
}
-// the sun's map
-void FoolGame::sub_137_004() {
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 14fa54badd6..b876f89b126 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -169,7 +169,17 @@ public:
void sub_135_004();
void sub_136_004();
+
+ // fool_sun.cpp
void sub_137_004();
+ void sub_137_3e2();
+ void sub_137_598();
+ void sub_137_880();
+ void sub_137_d60();
+ void sub_137_dde();
+ void sub_137_124e();
+ void sub_137_131a();
+
void sub_138_004();
// fool_cards.cpp
@@ -450,8 +460,8 @@ private:
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
PicHandle arr_i32_1912c[0x54];
- PicHandle arr_i32_192c0[0x18];
- PolyHandle arr_poly_192c0[0x18];
+ PicHandle arr_i32_192c0[101];
+ PolyHandle arr_poly_192c0[101];
int32 arr_i32_19454[0x65];
Common::U32String arr_str_195e8[101]; // 0x20 each
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
new file mode 100644
index 00000000000..1b1ec0aca6c
--- /dev/null
+++ b/engines/fool/fool_sun.cpp
@@ -0,0 +1,377 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// The Sun's map
+void FoolGame::sub_137_004() {
+ // 137:0004
+ this->var_i16_c00 = 1;
+ this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->arr_i16_1eb8[0] = 9;
+ this->arr_i16_1eb8[1] = 9;
+ this->arr_i16_1eb8[4] = 0x4b;
+ this->arr_i16_1eb8[5] = -9;
+ this->arr_i16_1eb8[6] = 0x23;
+ this->arr_i16_1eb8[7] = 0x23;
+ this->var_i16_484 = 0;
+ for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
+ for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
+ this->var_i16_484++;
+ g_toolbox->SetRect(this->arr_rect_1f38[this->var_i16_484], i, j, i+0x24, j+0x24);
+ }
+ }
+ // 137:00fa
+ this->var_i16_484 = 0;
+ for (int16 j = 1; j <= 9; j++) {
+ for (int16 i = 1; i <= 9; i++) {
+ this->var_i16_484++;
+ this->arr_i16_2f38[i*32 + j] = this->var_i16_484;
+ }
+ }
+ // 137:0148
+ for (int i = 1; i <= 0x51; i++) {
+ this->var_i16_484 = this->arr_i16_4c7c[i];
+ if ((this->arr_i16_1d24[this->var_i16_484] & 3) != 0) {
+ this->arr_i32_192c0[i] = this->arr_i32_1912c[i];
+ } else {
+ // 137:01b2
+ this->arr_i32_192c0[i] = this->arr_i32_1912c[0x52];
+ }
+ // 137:01d8
+ if ((this->arr_i16_1d24[this->var_i16_484] & 4) != 0) {
+ this->arr_i16_1d24[this->var_i16_484] ^= 4;
+ this->arr_i16_1d24[i] |= 8;
+ }
+ // 137:0252
+ if ((this->arr_i16_1d24[i] & 8) != 0) {
+ this->arr_i32_192c0[i] = this->arr_i32_1912c[0x53];
+ }
+ // 137:0294
+ }
+ // 137:02a2
+ this->fillRect(0x14, 0x67, 0x156, 0x1b1, 2);
+ for (int i = 1; i <= 0x51; i++) {
+ g_zbasic->picture(this->arr_rect_1f38[i].left, this->arr_rect_1f38[i].top, this->arr_i32_192c0[this->arr_i16_4bd8[i]]);
+ }
+ // 137:0336
+ this->var_i16_7c6 = 0;
+ g_zbasic->menu(8, 3, 0, Common::U32String());
+ g_toolbox->InitCursor();
+ this->sub_137_124e();
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
+ while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_137_3e2();
+ }
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+ }
+ // 137:038a
+ if (this->var_i16_7c6 == 2) {
+ this->sub_137_d60();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_128_3536();
+ }
+ }
+ // 137:03ce
+ if (this->var_i16_d0c == 0) {
+ return;
+ }
+ // JMP 0x1618
+ this->var_i16_68c = 0;
+ for (int j = 0; j <= 5; j++) {
+ for (int i = 1; i <= 0x51; i++) {
+ g_toolbox->InvertRect(this->arr_rect_1f38[i]);
+ }
+ }
+ // 137:1654
+ this->var_i16_7e2 = 0;
+ this->var_i16_c04 = 0x64;
+ this->var_i16_7d2 = 1;
+ g_zbasic->menu(2, 7, 1, Common::U32String());
+ for (int i = 1; i <= 0x50; i++) {
+ this->arr_i16_1d24[i] = 1;
+ }
+ for (int j = 3; j <= 7; j++) {
+ for (int i = 1; i <= 0x10; i++) {
+ g_zbasic->menu(j, i, 1, Common::U32String());
+ }
+ }
+}
+
+void FoolGame::sub_137_3e2() {
+ // 137:03e2
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) ||
+ (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
+ return;
+ }
+ // 137:0466
+ this->var_i16_e12 = 1;
+ g_zbasic->menu(8, 3, 0, Common::U32String());
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(3, 3);
+ g_toolbox->PenMode(kPatXor);
+ this->arr_i16_4758[0] = this->var_i16_68a;
+ this->arr_i16_4758[1] = this->var_i16_68c;
+ if (this->arr_i16_1d24[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & 8) {
+ this->sub_137_131a();
+ return;
+ }
+ this->sub_137_598();
+ // 137:0506
+ g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ this->arr_i16_4758[0] -= this->var_i16_68a;
+ this->arr_i16_4758[1] -= this->var_i16_68c;
+ this->sub_137_880();
+ g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ this->sub_137_dde();
+ this->sub_137_124e();
+ this->sub_128_6186();
+ g_zbasic->menu(8, 3, 1, Common::U32String());
+ this->var_i16_e12 = 0;
+}
+
+void FoolGame::sub_137_598() {
+ // 137:0598
+ do {
+ this->sub_128_c6a(4);
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
+ if (this->var_i16_68a >= this->arr_i16_4758[0]) {
+ this->arr_i16_4758[2] = this->arr_i16_4758[0];
+ this->arr_i16_4758[3] = this->var_i16_68a;
+ } else {
+ // 137:061a
+ this->arr_i16_4758[2] = this->var_i16_68a;
+ this->arr_i16_4758[3] = this->arr_i16_4758[0];
+ }
+ // 137:064a
+ if (this->var_i16_68c >= this->arr_i16_4758[1]) {
+ this->arr_i16_4758[6] = this->arr_i16_4758[1];
+ this->arr_i16_4758[7] = this->var_i16_68c;
+ } else {
+ // 137:069e
+ this->arr_i16_4758[6] = this->var_i16_68c;
+ this->arr_i16_4758[7] = this->arr_i16_4758[1];
+ }
+ // 137:06ce
+ this->arr_i16_4758[11] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
+ this->arr_i16_4758[12] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
+ this->arr_i16_4758[13] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].bottom;
+ this->arr_i16_4758[14] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].right;
+ // 137:084c
+ g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ this->sub_128_3da(2);
+ g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ this->sub_128_3da(1);
+ } while (this->var_ev_46.what != 2);
+ // 137:087e
+}
+
+void FoolGame::sub_137_880() {
+ // 137:0880
+ do {
+ this->sub_128_c6a(2);
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
+ if (this->arr_i16_4758[0] >= 0) {
+ this->arr_i16_4758[4] = this->var_i16_68a;
+ this->arr_i16_4758[5] = this->var_i16_68a + this->arr_i16_4758[0];
+ } else {
+ // 137:0900
+ this->arr_i16_4758[4] = this->var_i16_68a + this->arr_i16_4758[0];
+ this->arr_i16_4758[5] = this->var_i16_68a;
+ }
+ // 137:093c
+ if (this->arr_i16_4758[1] >= 0) {
+ this->arr_i16_4758[8] = this->var_i16_68c;
+ this->arr_i16_4758[9] = this->var_i16_68c + this->arr_i16_4758[1];
+ } else {
+ // 137:098e
+ this->arr_i16_4758[8] = this->var_i16_68c + this->arr_i16_4758[1];
+ this->arr_i16_4758[9] = this->var_i16_68c;
+ }
+ // 137:09ca
+ if (this->arr_i16_4758[4] < 1) {
+ this->arr_i16_4758[4] = 1;
+ this->arr_i16_4758[5] = 1 + ABS(this->arr_i16_4758[0]);
+ }
+ // 137:0a2e
+ if (this->arr_i16_4758[8] < 1) {
+ this->arr_i16_4758[8] = 1;
+ this->arr_i16_4758[9] = 1 + ABS(this->arr_i16_4758[1]);
+ }
+ // 137:0a92
+ if (this->arr_i16_4758[5] > this->arr_i16_1eb8[0]) {
+ this->arr_i16_4758[4] = this->arr_i16_1eb8[0] - ABS(this->arr_i16_4758[0]);
+ this->arr_i16_4758[5] = this->arr_i16_1eb8[0];
+ }
+ // 137:0b20
+ if (this->arr_i16_4758[9] > this->arr_i16_1eb8[1]) {
+ this->arr_i16_4758[8] = this->arr_i16_1eb8[1] - ABS(this->arr_i16_4758[1]);
+ this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
+ }
+ // 137:0bae
+ this->arr_rect_4776 = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]];
+ g_toolbox->FrameRect(this->arr_rect_4776);
+ this->sub_128_3da(2);
+ g_toolbox->FrameRect(this->arr_rect_4776);
+ this->sub_128_3da(1);
+ } while (this->var_ev_46.what != 1);
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_137_d60() {
+ // 137:0d60
+ this->var_i16_7c6 = 0;
+ g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
+ g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
+ g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
+ g_zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
+ this->var_i16_1aa4 = 0x51;
+ this->sub_137_dde();
+}
+
+void FoolGame::sub_137_dde() {
+ // 137:0dde
+ for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
+ for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
+ this->var_i16_1aa4++;
+ this->arr_i16_3738[this->var_i16_1aa4] = this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]];
+ // 137:0e5a
+ this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] = 0;
+ }
+ }
+
+ // 137:0ec2
+ this->var_i16_1aa6 = this->var_i16_1aa4;
+ this->var_i16_1aa4 = 0x51;
+ for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
+ for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
+ this->var_i16_1aa4++;
+ if (this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] > 0) {
+ this->var_i16_1aa6++;
+ this->arr_i16_3738[this->var_i16_1aa6] = this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]];
+ }
+ // 137:0f7c
+ this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
+ g_zbasic->picture(
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
+ this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]]]
+ );
+ }
+ }
+ this->var_i16_1aa6 = this->var_i16_1aa4;
+ for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
+ for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
+ if (this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] == 0) {
+ // 137:1114
+ this->var_i16_1aa6++;
+ this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
+ g_zbasic->picture(
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
+ this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
+ this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]]]
+ );
+ }
+ // 137:1214
+ }
+ }
+
+ // 137:124c
+}
+
+void FoolGame::sub_137_124e() {
+ // 137:124e
+ this->var_i16_d0c = 1;
+ for (int i = 1; i < 0x51; i++) {
+ if (this->arr_i16_4bd8[i] != i) {
+ this->var_i16_d0c = 0;
+ i = 0x51;
+ }
+ }
+ // 137:128e
+ if (this->var_i16_d0c == 1) {
+ for (int i = 1; i <= 0x51; i++) {
+ this->var_i16_484 = this->arr_i16_4c7c[i];
+ if ((this->arr_i16_1d24[this->var_i16_484] & 8) || (this->arr_i16_1d24[this->var_i16_484] == 0)) {
+ this->var_i16_d0c = 0;
+ i = 0x51;
+ }
+ // 137:12fa
+ }
+ }
+ // 137:1306
+ if (this->var_i16_d0c != 0) {
+ this->var_i16_7c6 = 1;
+ }
+}
+
+void FoolGame::sub_137_131a() {
+ // 137:131a
+ this->arr_i16_1d24[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= 8;
+ this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = this->arr_i32_1912c[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
+ // 137:142c
+ // unrolled loop
+ this->arr_i16_4758[0] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ this->arr_i16_4758[1] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left;
+ this->arr_i16_4758[2] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].bottom;
+ this->arr_i16_4758[3] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].right;
+ // 137:1490
+ for (int16 i = 0; i <= 0xf; i++) {
+ this->arr_i16_4758[0] += i;
+ this->arr_i16_4758[1] += i;
+ this->arr_i16_4758[2] -= i;
+ this->arr_i16_4758[3] -= i;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FrameRect(temp);
+ this->sub_128_3da(1);
+ }
+ // 137:1550
+ g_zbasic->picture(
+ this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left,
+ this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
+ this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
+ );
+ this->sub_128_6186();
+ this->sub_137_124e();
+ this->var_i16_e12 = 0;
+}
+
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index fb0448b4824..78cb2e694c0 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
+ fool_sun.o \
fool_wordsearch.o \
toolbox.o \
toolbox_fileman.o \
Commit: 43cd712be06e20395e6089e3a10557ab8dd538ea
https://github.com/scummvm/scummvm/commit/43cd712be06e20395e6089e3a10557ab8dd538ea
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:10+02:00
Commit Message:
FOOL: Sun's map mostly working
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_sun.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index fe029d5e1f8..dcba7725949 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1656,7 +1656,7 @@ void FoolGame::sub_128_39a0() {
this->sub_130_004();
break;
case 11:
- this->sub_137_004();
+ this->sunMapRun();
break;
case 12:
this->cardsRun();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index b876f89b126..259fed693fe 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -171,14 +171,14 @@ public:
void sub_136_004();
// fool_sun.cpp
- void sub_137_004();
- void sub_137_3e2();
- void sub_137_598();
- void sub_137_880();
- void sub_137_d60();
- void sub_137_dde();
- void sub_137_124e();
- void sub_137_131a();
+ void sunMapRun(); // sub_137_004
+ void sunMapOnClick(); // sub_137_3e2
+ void sunMapDragSelect(); // sub_137_598
+ void sunMapMoveSelected(); // sub_137_880
+ void sunMapUndoMove(); // sub_137_d60
+ void sunMapDropSelected(); // sub_137_dde
+ void sunMapCheckIfSolved(); // sub_137_124e
+ void sunMapRevealPiece(); // sub_137_131a
void sub_138_004();
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 1b1ec0aca6c..578a4e9d9e3 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -30,7 +30,7 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// The Sun's map
-void FoolGame::sub_137_004() {
+void FoolGame::sunMapRun() {
// 137:0004
this->var_i16_c00 = 1;
this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
@@ -84,19 +84,19 @@ void FoolGame::sub_137_004() {
this->var_i16_7c6 = 0;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
- this->sub_137_124e();
+ this->sunMapCheckIfSolved();
while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
this->sub_128_c6a(-1);
- if (this->var_ev_46.what == 1) {
- this->sub_137_3e2();
+ if (this->var_ev_46.what == kMouseDown) {
+ this->sunMapOnClick();
}
if (this->var_ev_46.what == kNullEvent)
g_toolbox->Delay(0);
}
// 137:038a
if (this->var_i16_7c6 == 2) {
- this->sub_137_d60();
+ this->sunMapUndoMove();
}
if (this->var_i16_7c6 == 4) {
this->sub_128_3536();
@@ -128,7 +128,7 @@ void FoolGame::sub_137_004() {
}
}
-void FoolGame::sub_137_3e2() {
+void FoolGame::sunMapOnClick() {
// 137:03e2
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) ||
@@ -144,24 +144,24 @@ void FoolGame::sub_137_3e2() {
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
if (this->arr_i16_1d24[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & 8) {
- this->sub_137_131a();
+ this->sunMapRevealPiece();
return;
}
- this->sub_137_598();
+ this->sunMapDragSelect();
// 137:0506
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->arr_i16_4758[0] -= this->var_i16_68a;
this->arr_i16_4758[1] -= this->var_i16_68c;
- this->sub_137_880();
+ this->sunMapMoveSelected();
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->sub_137_dde();
- this->sub_137_124e();
+ this->sunMapDropSelected();
+ this->sunMapCheckIfSolved();
this->sub_128_6186();
g_zbasic->menu(8, 3, 1, Common::U32String());
this->var_i16_e12 = 0;
}
-void FoolGame::sub_137_598() {
+void FoolGame::sunMapDragSelect() {
// 137:0598
do {
this->sub_128_c6a(4);
@@ -187,18 +187,18 @@ void FoolGame::sub_137_598() {
// 137:06ce
this->arr_i16_4758[11] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
this->arr_i16_4758[12] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
- this->arr_i16_4758[13] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].bottom;
- this->arr_i16_4758[14] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].right;
+ this->arr_i16_4758[13] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
+ this->arr_i16_4758[14] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
// 137:084c
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->sub_128_3da(2);
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->sub_128_3da(1);
- } while (this->var_ev_46.what != 2);
+ } while (this->var_ev_46.what != kMouseUp);
// 137:087e
}
-void FoolGame::sub_137_880() {
+void FoolGame::sunMapMoveSelected() {
// 137:0880
do {
this->sub_128_c6a(2);
@@ -242,28 +242,30 @@ void FoolGame::sub_137_880() {
this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
}
// 137:0bae
- this->arr_rect_4776 = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]];
+ this->arr_rect_4776.top = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
+ this->arr_rect_4776.left = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
+ this->arr_rect_4776.bottom = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
+ this->arr_rect_4776.right = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(2);
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(1);
- } while (this->var_ev_46.what != 1);
- warning("STUB: %s", __func__);
+ } while (this->var_ev_46.what != kMouseDown);
}
-void FoolGame::sub_137_d60() {
+void FoolGame::sunMapUndoMove() {
// 137:0d60
this->var_i16_7c6 = 0;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
g_zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
- this->var_i16_1aa4 = 0x51;
- this->sub_137_dde();
+ this->sunMapDropSelected();
}
-void FoolGame::sub_137_dde() {
+void FoolGame::sunMapDropSelected() {
// 137:0dde
+ this->var_i16_1aa4 = 0x51;
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
this->var_i16_1aa4++;
@@ -312,10 +314,10 @@ void FoolGame::sub_137_dde() {
// 137:124c
}
-void FoolGame::sub_137_124e() {
+void FoolGame::sunMapCheckIfSolved() {
// 137:124e
this->var_i16_d0c = 1;
- for (int i = 1; i < 0x51; i++) {
+ for (int i = 1; i <= 0x51; i++) {
if (this->arr_i16_4bd8[i] != i) {
this->var_i16_d0c = 0;
i = 0x51;
@@ -338,7 +340,7 @@ void FoolGame::sub_137_124e() {
}
}
-void FoolGame::sub_137_131a() {
+void FoolGame::sunMapRevealPiece() {
// 137:131a
this->arr_i16_1d24[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= 8;
this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = this->arr_i32_1912c[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
@@ -369,7 +371,7 @@ void FoolGame::sub_137_131a() {
this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
);
this->sub_128_6186();
- this->sub_137_124e();
+ this->sunMapCheckIfSolved();
this->var_i16_e12 = 0;
}
Commit: 52148a21302c9dfccd0ebc65b4a964999214de03
https://github.com/scummvm/scummvm/commit/52148a21302c9dfccd0ebc65b4a964999214de03
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:11+02:00
Commit Message:
FOOL: First half of jumble
Changed paths:
A engines/fool/fool_jumble.cpp
engines/fool/detection_tables.h
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_fileman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/detection_tables.h b/engines/fool/detection_tables.h
index f604baeecf8..6e41f3db76f 100644
--- a/engines/fool/detection_tables.h
+++ b/engines/fool/detection_tables.h
@@ -25,8 +25,8 @@ namespace Fool {
const PlainGameDescriptor foolGames[] = {
{ "foolserrand", "The Fool's Errand" },
- { "atc", "At The Carnival" },
- { "3inthree", "3 in Three" },
+ //{ "atc", "At The Carnival" },
+ //{ "3inthree", "3 in Three" },
{ 0, 0 }
};
@@ -35,7 +35,7 @@ const ADGameDescription gameDescriptions[] = {
{
"foolserrand",
"v1.1",
- AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
+ AD_ENTRY1s("xn--The Fool's Errand-306j", "rt:44749119459beb47f37a02bd629ed9e9", 175275),
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
@@ -57,7 +57,7 @@ const ADGameDescription gameDescriptions[] = {
{
"foolserrand",
"v3.0",
- AD_ENTRY1s("The Fool's Errand", "rt:00000000000000000000000000000000", 0),
+ AD_ENTRY1s("The Fool's Errand", "rt:b36443d20490fa45c6a58fd2d7be5ffb", 186482),
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index dcba7725949..b4c1ac8fe04 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -32,7 +32,14 @@ Toolbox *g_toolbox;
void FoolGame::run() {
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
- g_zbasic->loadProgram(Common::Path("The Fool's Errand"));
+ Common::MacFinderInfo finfo;
+ if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
+ g_zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
+ } else if (g_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
+ g_zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
+ } else {
+ error("FoolGame::run: Fool's Errand program not found");
+ }
this->sub_128_004();
delete g_zbasic;
delete g_toolbox;
@@ -2857,119 +2864,6 @@ void FoolGame::sub_129_123a() {
g_toolbox->Delay(0);
}
-// word jumble/substitute puzzle
-void FoolGame::sub_130_004() {
- // 130:0004
- this->var_i16_d0c = 0;
- this->sub_128_271a();
- this->var_i16_1056 = this->puzzlesReadShort();
- this->var_i16_1058 = 1;
- this->var_i16_105a = this->puzzlesReadShort();
- if ((this->var_i16_105a & 0x1) == 1) {
- for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
- }
- }
- // 130:0066
- this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[8];
- do {
- this->var_i16_68a = this->arr_i16_1eb8[10];
- do {
- this->var_i16_484++;
- g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
- this->var_i16_68a,
- this->var_i16_68c,
- this->var_i16_68a + this->arr_i16_1eb8[13],
- this->var_i16_68c + this->arr_i16_1eb8[12]
- );
- // 130:00f6
- } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[11], this->arr_i16_1eb8[6]));
- // 130:0126
- } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
- // 130:0156
- if ((this->var_i16_105a & 0x2) == this->var_i16_105a) {
- this->var_i16_105c = this->puzzlesReadShort();
- this->var_i16_105e = this->puzzlesReadShort();
- this->var_i16_1060 = this->puzzlesReadShort();
- this->var_i16_1062 = this->puzzlesReadShort();
- this->var_i16_1064 = this->puzzlesReadShort();
- this->var_i16_1066 = this->puzzlesReadShort();
- if (this->var_i16_1066 > 0) {
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
- g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
- }
- }
- // 130:01f0
- this->var_i16_1068 = this->puzzlesReadShort();
- if (this->var_i16_1068 == 6) {
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_2f38[i*32 + j] = this->puzzlesReadByte();
- this->arr_i16_3b38[i*32 + j] = 0;
- }
- }
- } else {
- // 130:028a
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_2f38[i*32 + j] = 0;
- this->arr_i16_3b38[i*32 + j] = 0;
- }
- }
- }
- // 130:0306
- this->var_i16_103a = this->puzzlesReadShort();
- if (this->var_i16_103a > 0) {
- g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_1060]);
- this->var_i16_484 = 0;
- for (int j = 1; j <= this->var_i16_103a; j++) {
- this->var_i16_106a = this->puzzlesReadShort();
- if (this->var_i16_106a == 0) {
- this->var_i16_484 += 10;
- } else {
- // 130:035a
- for (int i = 0; i <= 0xc; i++) {
- this->var_i16_484++;
- if (this->var_i16_106a & this->bitLUT[i]) {
- g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_484]);
- }
- }
- // 130:039e
-
- }
- // 103:03aa
- }
- }
- // 130:03ba
- if (this->var_i16_105e == 2) {
- this->var_i16_106c = 3;
- } else {
- this->var_i16_106c = 1;
- }
- // 130:03d4
- if (this->var_i16_1068 == 4) {
- this->fillRect(0x63, 0xae, 0x108, 0x153, 2);
- }
- // 130:03fe
- //if (this->var_i16_c04 <= this->var_i16_1058)
- this->var_i16_106e = 0;
- this->var_str_1070 = g_zbasic->str(168); // empty
- this->var_str_1170 = g_zbasic->str(169); // empty
- this->var_i16_1270 = this->puzzlesReadShort();
- this->var_i16_103a = 1;
- this->var_str_1272 = this->puzzlesReadString();
- this->var_i16_1372 = this->var_str_1272.size();
- this->var_str_1170 = this->var_str_1170 + this->var_str_1272;
- // 130:047e
-
- // 130:0c64
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_135_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 259fed693fe..542ed69823e 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -127,7 +127,32 @@ public:
void sub_129_068();
void sub_129_123a();
+ // fool_jumble.cpp:
void sub_130_004();
+ void sub_130_c56();
+ void sub_130_c66();
+ void sub_130_d2e();
+ void sub_130_d90();
+ void sub_130_1004();
+ void sub_130_10a6();
+ void sub_130_1282();
+ void sub_130_1426();
+ void sub_130_1476();
+ void sub_130_15da();
+ void sub_130_1c1a();
+ void sub_130_1c52();
+ void sub_130_1c6c();
+ void sub_130_1dcc();
+ void sub_130_1e5c();
+ void sub_130_1e76();
+ void sub_130_2078();
+ void sub_130_2094();
+ void sub_130_201a();
+ void sub_130_20d2();
+ void sub_130_20fe();
+ void sub_130_2226();
+ void sub_130_25d8();
+ void sub_130_2790();
// fool_wordsearch.cpp
void wordSearchRun(); // sub_131_004
@@ -299,6 +324,7 @@ private:
Common::U32String var_str_af4;
+ int16 var_i16_bfc;
// Used as both a pointer and a bitstore
uint32 var_i32_bf8;
MenuHandle var_menu_bf8;
@@ -309,6 +335,7 @@ private:
int16 var_i16_d06;
int16 var_i16_d0c;
+ Common::U32String var_str_d12;
int16 var_i16_e12;
int16 var_i16_e14;
int16 selectedMenuID; // var_i16_e16
@@ -341,7 +368,7 @@ private:
int16 var_i16_1066;
int16 var_i16_1068;
int16 var_i16_106a;
- int16 var_i16_106c;
+ SourceMode var_i16_106c;
int16 var_i16_106e;
Common::U32String var_str_1070;
Common::U32String var_str_1170;
@@ -349,9 +376,22 @@ private:
Common::U32String var_str_1272;
int16 var_i16_1372;
+ Common::U32String var_str_1374;
+ Common::U32String var_str_1474;
int16 var_i16_1574;
+ int16 var_i16_1576;
+ Common::U32String var_str_1578;
+
+ int16 var_i16_1678;
+ int16 var_i16_167a;
Common::U32String var_str_167c;
+ Common::U32String var_str_177c;
+
+ int16 var_i16_187c;
+ int16 var_i16_187e;
+ int16 var_i16_1880;
+ int16 var_i16_1882;
Common::U32String var_str_188e;
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
new file mode 100644
index 00000000000..ae8f14d5ee6
--- /dev/null
+++ b/engines/fool/fool_jumble.cpp
@@ -0,0 +1,764 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// word jumble/substitute puzzle
+void FoolGame::sub_130_004() {
+ // 130:0004
+ this->var_i16_d0c = 0;
+ this->sub_128_271a();
+ this->var_i16_1056 = this->puzzlesReadShort();
+
+ for (this->var_i16_1058 = 1; this->var_i16_1058 <= this->var_i16_1056; this->var_i16_1058++) {
+ this->var_i16_105a = this->puzzlesReadShort();
+ if ((this->var_i16_105a & 0x1) == 1) {
+ for (int i = 0; i <= 0xe; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ }
+ // 130:0066
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
+ do {
+ this->var_i16_68a = this->arr_i16_1eb8[10];
+ do {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a,
+ this->var_i16_68c,
+ this->var_i16_68a + this->arr_i16_1eb8[13],
+ this->var_i16_68c + this->arr_i16_1eb8[12]
+ );
+ // 130:00f6
+ } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[11], this->arr_i16_1eb8[6]));
+ // 130:0126
+ } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ // 130:0156
+ if ((this->var_i16_105a & 0x2) == this->var_i16_105a) {
+ this->var_i16_105c = this->puzzlesReadShort();
+ this->var_i16_105e = this->puzzlesReadShort();
+ this->var_i16_1060 = this->puzzlesReadShort();
+ this->var_i16_1062 = this->puzzlesReadShort();
+ this->var_i16_1064 = this->puzzlesReadShort();
+ this->var_i16_1066 = this->puzzlesReadShort();
+ if (this->var_i16_1066 > 0) {
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
+ g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ }
+ }
+ // 130:01f0
+ this->var_i16_1068 = this->puzzlesReadShort();
+ if (this->var_i16_1068 == 6) {
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_2f38[i*32 + j] = this->puzzlesReadByte();
+ this->arr_i16_3b38[i*32 + j] = 0;
+ }
+ }
+ } else {
+ // 130:028a
+ for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_2f38[i*32 + j] = 0;
+ this->arr_i16_3b38[i*32 + j] = 0;
+ }
+ }
+ }
+ // 130:0306
+ this->var_i16_103a = this->puzzlesReadShort();
+ if (this->var_i16_103a > 0) {
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_1060]);
+ this->var_i16_484 = 0;
+ for (int j = 1; j <= this->var_i16_103a; j++) {
+ this->var_i16_106a = this->puzzlesReadShort();
+ if (this->var_i16_106a == 0) {
+ this->var_i16_484 += 10;
+ } else {
+ // 130:035a
+ for (int i = 0; i <= 0xc; i++) {
+ this->var_i16_484++;
+ if (this->var_i16_106a & this->bitLUT[i]) {
+ g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_484]);
+ }
+ }
+ // 130:039e
+
+ }
+ // 103:03aa
+ }
+ }
+ // 130:03ba
+ if (this->var_i16_105e == 2) {
+ this->var_i16_106c = kSrcBic;
+ } else {
+ this->var_i16_106c = kSrcOr;
+ }
+ // 130:03d4
+ if (this->var_i16_1068 == 4) {
+ this->fillRect(0x63, 0xae, 0x108, 0x153, 2);
+ }
+ // 130:03fe
+ //if (this->var_i16_c04 <= this->var_i16_1058)
+ this->var_i16_106e = 0;
+ this->var_str_1070 = g_zbasic->str(168); // empty
+ this->var_str_1170 = g_zbasic->str(169); // empty
+ this->var_i16_1270 = this->puzzlesReadShort();
+ for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
+ this->var_str_1272 = this->puzzlesReadString();
+ this->var_i16_1372 = this->var_str_1272.size();
+ this->var_str_1170 = this->var_str_1170 + this->var_str_1272;
+ // 130:047e
+ if (this->var_i16_c04 > this->var_i16_1058) {
+ this->var_str_1070 += this->var_str_1272;
+ } else {
+ // 130:04ac
+ if ((this->var_i16_c04 == this->var_i16_1058) && (this->var_str_c06 != g_zbasic->str(170))) {
+ // 130:04dc
+ this->var_str_1070 = this->var_str_c06;
+ } else {
+ // 130:04f0
+ if ((this->var_i16_1068 == 1) || (this->var_i16_1068 == 5)) {
+ // 130:0514
+ this->var_str_384 = this->var_str_1272;
+ this->sub_130_25d8();
+ }
+ // 130:0528
+ if (this->var_i16_1068 == 2) {
+ this->var_str_384 = this->var_str_1272;
+ this->sub_130_2790();
+ }
+ // 130:0548
+ if ((this->var_i16_1068 == 3) || (this->var_i16_1068 == 6)) {
+ this->var_str_9f4 = g_zbasic->space(this->var_i16_1372);
+ }
+ // 130:0580
+ if (this->var_i16_1068 == 4) {
+ this->var_str_384 = g_zbasic->leftStr(this->var_str_1272, 4);
+ this->sub_130_25d8();
+ this->var_str_1374 = this->var_str_9f4;
+ this->var_str_384 = g_zbasic->rightStr(this->var_str_1272, 4);
+ this->sub_130_25d8();
+ this->var_str_9f4 = this->var_str_9f4 + this->var_str_1474 + this->var_str_1374 + g_zbasic->midStr(this->var_str_1272, 5, 1) + this->var_str_1474;
+ }
+ // 130:0610
+ this->var_str_1070 += this->var_str_9f4;
+ }
+ }
+ // 130:0628
+ for (this->var_i16_484 = 1; this->var_i16_484 <= this->var_i16_1372; this->var_i16_484++) {
+ this->var_i16_106e++;
+ this->arr_i16_3738[this->var_i16_106e] = this->puzzlesReadShort();
+ this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
+ this->sub_130_20fe();
+ this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_103a;
+ this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_106e;
+ this->sub_130_1c6c();
+ this->var_str_d12 = g_zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
+ // 130:06d4
+ if ((this->var_i16_7e2 <= 0x50) || (this->var_i16_7e2 == 0x55)) {
+ this->sub_130_1dcc();
+ } else {
+ // 130:0700
+ this->sub_130_1e76();
+ }
+ }
+ // 130:0716
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_103a);
+ }
+ // 130:073e
+ this->var_i16_1576 = this->var_str_1170.size();
+ if ((this->var_i16_7e2 == 0x51) || (this->var_i16_7e2 == 0x54)) {
+ // 130:076e
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenSize(3, 3);
+ if (this->var_i16_7e2 == 0x51) {
+ // 130:0794
+ g_toolbox->MoveTo(0xf3, 0x6f);
+ g_toolbox->LineTo(0xf3, 0xe4);
+ g_toolbox->MoveTo(0x9b, 0xa9);
+ g_toolbox->LineTo(0x14c, 0xa9);
+ }
+ // 130:07bc
+ if (this->var_i16_7e2 == 0x54) {
+ g_toolbox->MoveTo(0xe9, 0x81);
+ g_toolbox->LineTo(0x17d, 0x81);
+ g_toolbox->MoveTo(0x124, 0x47);
+ g_toolbox->LineTo(0x124, 0xda);
+ }
+ // 130:07f0
+ g_toolbox->PenNormal();
+ }
+ // 130:07f2
+ this->var_i16_103a = this->puzzlesReadShort();
+ if (this->var_i16_103a > 0) {
+ for (this->var_i16_68a = 1; this->var_i16_68a <= this->var_i16_103a; this->var_i16_68a++) {
+ this->var_i16_484 = this->puzzlesReadShort();
+ this->var_i16_7e4 = this->puzzlesReadShort();
+ this->var_str_1578 = this->puzzlesReadString();
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ if (this->var_i16_7e4 > 0) {
+ g_toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
+ g_toolbox->DrawString(this->var_str_1578);
+ } else {
+ this->sub_130_2226();
+ }
+ }
+ }
+ // 130:086a
+ this->var_i16_1678 = 0;
+ this->var_str_1578 = g_zbasic->str(171);
+ if (this->var_i16_1058 == this->var_i16_1056) {
+ this->arr_i16_4338[0] = this->puzzlesReadShort();
+ if (this->arr_i16_4338[0] > 0) {
+ // 130:08be
+ for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
+ this->arr_i16_4338[this->var_i16_68a] = this->puzzlesReadShort();
+ }
+ }
+ }
+ // 130:08fa
+ if (this->var_i16_c04 <= this->var_i16_1058) {
+ switch (this->var_i16_1068-1) {
+ case 0:
+ this->sub_130_d2e();
+ break;
+ case 1:
+ this->sub_130_d90();
+ break;
+ case 2:
+ this->sub_130_1004();
+ break;
+ case 3:
+ case 4:
+ this->sub_130_10a6();
+ break;
+ case 5:
+ this->sub_130_1282();
+ break;
+ default:
+ break;
+ }
+ if ((this->var_i16_7c6 & 1) != 0) {
+ this->sub_130_c66();
+ this->var_i16_1058 = this->var_i16_1056;
+ } else {
+ // 130:0956
+ if (this->var_i16_7e2 <= 0x50) {
+ if ((this->var_i16_1678 > 0) && (this->var_str_1578 != g_zbasic->str(172))) {
+ // 130:098c
+ this->var_str_1578 = g_zbasic->str(173);
+ this->sub_130_2226();
+ }
+ // 130:09a4
+ for (int i = 1; i <= 3; i++) {
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
+ }
+ for (int j = 0; j <= 1; j++) {
+ for (int i = 1; i <= this->var_i16_1576; i++) {
+ g_toolbox->Delay(0xc - (this->var_i16_1576 / 0xa));
+ g_toolbox->InvertRect(this->arr_rect_1f38[ABS(this->arr_i16_3738[i])]);
+ }
+ }
+ if (this->var_i16_1058 == this->var_i16_1056) {
+ this->var_i16_d0c = 1;
+ }
+ }
+ }
+ }
+ // 130:0a5c
+ }
+ if ((this->var_i16_7c6 & 1) != 0) {
+ // JMP 0x2962
+ return;
+ }
+ g_toolbox->PenNormal();
+ this->sub_128_2664();
+ this->sub_128_6186();
+ this->sub_128_61ec();
+ // 130:0a90
+ if (this->var_i16_7e2 == 0x55) {
+ // 130:0b68
+ while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0) {
+ // 130:0aa0
+ if (this->arr_i16_4338[0] > 0) {
+ if (this->arr_i16_4338[0] == 1) {
+ this->var_i16_7e4 = 0x64;
+ } else {
+ this->var_i16_7e4 = 0xd;
+ }
+ this->var_i16_68a = 0;
+ do {
+ g_toolbox->Delay(this->var_i16_7e4);
+ this->var_i16_68a++;
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
+ this->sub_128_c6a(0);
+ } while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
+ } else {
+ // 130:0b62
+ this->sub_128_c6a(0);
+ g_toolbox->Delay(0);
+ }
+ }
+ // 130:0b7a
+ } else {
+ // 130:0b7e
+ this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
+ this->var_i16_d0c = 0;
+ this->var_i16_bfc = 0;
+ do {
+ for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
+ g_toolbox->Delay(0xd);
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
+ this->sub_128_c6a(0);
+ g_toolbox->Delay(0);
+ if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ this->var_i16_d0c = 1;
+ }
+ }
+ // 130:0c14
+ if (this->var_i16_bfc == 0) {
+ this->var_i16_bfc = 1;
+ } else {
+ this->var_i16_bfc = 0;
+ }
+ } while (!((this->var_i16_d0c == 1) && (this->var_i16_bfc == 1)));
+ }
+ // 130:0c4e
+ this->sub_130_c66();
+}
+
+void FoolGame::sub_130_c56() {
+ // 130:0c56
+ this->sub_130_c66();
+ this->sub_128_3536();
+ this->var_i16_7c6 = 0;
+}
+
+void FoolGame::sub_130_c66() {
+ // 130:0c66
+ if (this->var_i16_d0c != 0) {
+ this->var_i16_c04 = 0x64;
+ this->var_str_c06 = g_zbasic->str(174);
+ this->var_i16_d0c = 0;
+ } else {
+ // 130:0c98
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = this->var_i16_1058;
+ if ((this->var_i16_1068 == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
+ this->var_str_c06 = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
+ } else {
+ // 130:0cfe
+ this->var_str_c06 = this->var_str_1070;
+ }
+ // 130:0d0e
+ } else {
+ // 130:0d12
+ this->var_i16_c04 = 0x65;
+ this->var_str_c06 = g_zbasic->str(176);
+ }
+ }
+ // 130:0d2c
+ return;
+}
+
+void FoolGame::sub_130_d2e() {
+ // 130:0d2e
+ this->sub_130_1426();
+ this->sub_128_61ec();
+ this->var_i16_7c6 = 0;
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_130_1476();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_130_c56();
+ }
+ }
+}
+
+void FoolGame::sub_130_d90() {
+ // 130:0d90
+ if (g_zbasic->index(1, 1) != g_zbasic->str(177)) {
+ if (this->var_str_1070.size() == this->var_str_1170.size()) {
+ this->var_i16_1372 = g_zbasic->index(1, 1).size();
+ this->var_str_1578 = g_zbasic->space(this->var_i16_1372);
+ for (int i = 1; i<= this->var_i16_1372; i++) {
+ this->var_str_167c = g_zbasic->midStr(g_zbasic->index(1, 1), i, 1);
+ this->var_i16_7e4 = g_zbasic->asc(g_zbasic->ucase(this->var_str_167c)) - 0x40;
+ if ((this->var_i16_7e4 >= 1) && (this->var_i16_7e4 <= 0x1a)) {
+ this->var_str_d12 = g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4] + 0x40);
+ } else {
+ // 130:0e88
+ this->var_str_d12 = this->var_str_167c;
+ }
+ // 130:0e98
+ g_zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
+ }
+
+ } else {
+ // 130:0ece
+ this->var_i16_484 = this->var_str_1070.size();
+ this->var_i16_7e4 = this->var_str_1170.size();
+ this->var_str_1578 = g_zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_7e4);
+ this->var_str_1070 = g_zbasic->leftStr(this->var_str_1070, this->var_i16_7e4);
+
+ }
+ // 130:0f24
+ this->var_str_1578 += g_zbasic->str(178) + g_zbasic->index(1, 1); // ABC = XYZ
+ this->var_i16_167a = g_zbasic->instr(1, this->var_str_1578, g_zbasic->str(179));
+ this->sub_130_2226();
+ } else {
+ // 130:0f72
+ this->var_str_1578 = g_zbasic->str(180);
+ }
+ // 130:0f86
+ this->var_i16_106e = 1;
+ this->sub_130_1c1a();
+ this->sub_128_61ec();
+ this->var_i16_7c6 = 0;
+ this->var_i16_7c0 = 0;
+ // 130:0fa0
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ // 130:0fa4
+ this->sub_128_c6a(-1);
+ if (this->var_i16_7c0 != 0) {
+ this->sub_130_15da();
+ }
+ if (this->var_ev_46.what == 1) {
+ this->sub_130_1476();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_130_c56();
+ }
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+ }
+ // 130:0ffe
+ this->sub_130_1c52();
+}
+
+void FoolGame::sub_130_1004() {
+ // 130:1004
+ this->var_i16_106e = g_zbasic->instr(1, this->var_str_1070, g_zbasic->str(181));
+ if (this->var_i16_106e == 0) {
+ this->var_i16_106e = 1;
+ }
+ this->sub_130_20d2();
+ this->sub_128_61ec();
+ this->var_i16_7c6 = 0;
+ this->var_i16_7c0 = 0;
+ // 130:1042
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ this->sub_128_c6a(-1);
+ if (this->var_i16_7c0 != 0) {
+ this->sub_130_15da();
+ }
+ if (this->var_ev_46.what == 1) {
+ this->sub_130_1476();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_130_c56();
+ }
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+ }
+ this->sub_130_1c52();
+}
+
+void FoolGame::sub_130_10a6() {
+ // 130:10a6
+ this->sub_130_1426();
+ if (this->var_i16_1068 != 5) {
+ this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 1, 1) + g_zbasic->midStr(this->var_str_1170, 4, 1) + g_zbasic->midStr(this->var_str_1170, 7, 1);
+ this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 2, 1) + g_zbasic->midStr(this->var_str_1170, 5, 1) + g_zbasic->midStr(this->var_str_1170, 8, 1);
+ this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 3, 1) + g_zbasic->midStr(this->var_str_1170, 6, 1) + g_zbasic->midStr(this->var_str_1170, 9, 1);
+ } else {
+ // 130:1196
+ this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 3, 2) + g_zbasic->midStr(this->var_str_1170, 1, 2) + g_zbasic->midStr(this->var_str_1170, 5, 1);
+ this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 8, 2) + g_zbasic->midStr(this->var_str_1170, 6, 2);
+ }
+ // 130:1212
+ this->sub_128_61ec();
+ this->var_i16_7c6 = 0;
+ // 130:121c
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
+ this->sub_128_c6a(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_130_1476();
+ }
+ if (this->var_i16_7c6 == 4) {
+ this->sub_130_c56();
+ }
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+ }
+}
+
+void FoolGame::sub_130_1282() {
+ // 130:1282
+ this->var_i16_106e = g_zbasic->instr(1, this->var_str_1070, g_zbasic->str(182));
+ if (this->var_i16_106e == 0) {
+ this->var_i16_106e = 1;
+ }
+ this->sub_130_20d2();
+ this->sub_128_61ec();
+ this->var_i16_7b2 = 0;
+ this->var_i16_7c6 = 0;
+ this->var_i16_7c0 = 0;
+ g_toolbox->InitCursor();
+ while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ // 130:12cc
+ this->sub_128_c6a(-1);
+ if (this->var_i16_7c0 != 0) {
+ this->sub_130_15da();
+ }
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ if (this->var_ev_46.what == 1) {
+ this->sub_130_1476();
+ }
+ if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
+ this->var_i16_187c = 0;
+ } else {
+ this->var_i16_187c = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
+ }
+ // 130:139e
+ if (this->var_i16_187c != this->var_i16_7b2) {
+ if (this->var_i16_187c < 0x11) {
+ g_toolbox->InitCursor();
+ } else {
+ g_toolbox->SetCursor(this->arr_curs_4d88[this->var_i16_187c]);
+ }
+ // 130:13dc
+ this->var_i16_7b2 = this->var_i16_187c;
+ }
+ // 130:13e2
+ this->var_i16_7b2 = this->var_i16_187c;
+ if (this->var_i16_7c6 == 4) {
+ this->sub_130_c56();
+ }
+ }
+ // 130:141e
+ this->sub_130_1c52();
+ g_toolbox->InitCursor();
+}
+
+void FoolGame::sub_130_1426() {
+ // 130:1426
+ this->var_i16_187e = 0;
+ this->var_i16_1880 = 0;
+ if (g_zbasic->index(1, 1) != g_zbasic->str(183)) {
+ this->var_i16_1678 = 1;
+ this->var_str_1578 = g_zbasic->index(1, 1);
+ this->sub_130_2226();
+ }
+ // 130:1474
+}
+
+void FoolGame::sub_130_1476() {
+ // 130:1476
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
+ // 130:14fa
+ if (this->var_ev_46.where.x > 0x14) {
+ this->sub_128_50e(0xf, 0x42, 0x1);
+ }
+ return;
+ }
+ // 130:1518
+ if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] < 1) {
+ this->sub_128_50e(0xf, 0x42, 0x1);
+ return;
+ }
+ // 130:1558
+
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_15da() {
+ // 130:15da
+ if ((this->var_i16_7c0 == 3) || (this->var_i16_7c0 == 0xd)) {
+ this->sub_130_1c52();
+ this->sub_130_2078();
+ this->sub_130_20d2();
+ this->var_i16_7c0 = 0;
+ return;
+ }
+ if (this->var_i16_7c0 == 8) {
+ this->sub_130_1c52();
+ this->sub_130_2094();
+ this->sub_130_20d2();
+ this->var_i16_7c0 = 0;
+ return;
+ }
+ // 130:1632
+ if ((this->var_i16_7c0 >= 0x61) && (this->var_i16_7c0 <= 0x7a)) {
+ this->var_i16_7c0 -= 0x20;
+ }
+ if (this->var_i16_1068 != 3) {
+ if ((this->var_i16_7c0 < 0x41) || (this->var_i16_7c0 > 0x5a)) {
+ return;
+ }
+ } else {
+ // 130:1690
+ this->var_i16_1882 = 0;
+ if ((this->var_i16_7c0 < 0x41) || (this->var_i16_7c0 > 0x5a)) {
+ this->var_i16_1882 = 1;
+ }
+ if (this->var_i16_7c0 == 0x20) {
+ this->var_i16_1882 = 0;
+ }
+ if (this->var_i16_1882 != 0)
+ return;
+ }
+ // 130:16dc
+ this->var_str_d12 = g_zbasic->chr(this->var_i16_7c0);
+ if (this->var_i16_7c0 != 2) {
+ if (!((this->var_i16_1068 == 3) || (this->var_i16_1068 == 6))) {
+
+ } else {
+ this->sub_130_201a();
+ return;
+ }
+ }
+ // 130:1a16
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_1c1a() {
+ // 130:1c1a
+ this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+}
+
+void FoolGame::sub_130_1c52() {
+ // 130:1c52
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+}
+
+void FoolGame::sub_130_1c6c() {
+ g_toolbox->PenNormal();
+ g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_1574], this->arr_pat_58f4[this->var_i16_105e]);
+ g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_105c]);
+ g_toolbox->FrameRect(this->arr_rect_1f38[this->var_i16_1574]);
+ if (this->arr_i16_3738[this->var_i16_106e] >= 0) {
+ return;
+ }
+ // 130:1ce2
+ if ((this->var_i16_7e2 > 0x50) && (this->var_i16_7e2 < 0x55)) {
+ return;
+ }
+ this->arr_i16_4758[0] = this->arr_rect_1f38[this->var_i16_1574].top + 2;
+ this->arr_i16_4758[1] = this->arr_rect_1f38[this->var_i16_1574].left + 2;
+ this->arr_i16_4758[2] = this->arr_rect_1f38[this->var_i16_1574].bottom - 2;
+ this->arr_i16_4758[3] = this->arr_rect_1f38[this->var_i16_1574].right - 2;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FrameRect(temp);
+}
+
+void FoolGame::sub_130_1dcc() {
+ // 130:1dcc
+ g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2],
+ this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ );
+ g_toolbox->DrawString(this->var_str_d12);
+}
+
+void FoolGame::sub_130_1e5c() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_1e76() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_201a() {
+ // 130:201a
+ g_zbasic->midStrSet(this->var_str_1070, this->var_i16_106e, 1, this->var_str_d12);
+ if ((this->var_i16_7e2 > 0x50) && (this->var_i16_7e2 < 0x55)) {
+ this->sub_130_1e5c();
+ } else {
+ // 130:2066
+ this->sub_130_1c6c();
+ this->sub_130_1dcc();
+ }
+ // 130:206e
+ this->sub_130_2078();
+ this->sub_130_20d2();
+}
+
+void FoolGame::sub_130_2078() {
+ // 130:2078
+ this->var_i16_106e++;
+ if (this->var_i16_106e > this->var_i16_1576) {
+ this->var_i16_106e = 1;
+ }
+}
+
+void FoolGame::sub_130_2094() {
+ // 130:2094
+ this->var_i16_106e--;
+ if (this->var_i16_106e < 1) {
+ this->var_i16_106e = this->var_i16_1576;
+ }
+}
+
+void FoolGame::sub_130_20d2() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_20fe() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_2226() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_25d8() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_130_2790() {
+ warning("STUB: %s", __func__);
+}
+
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 78cb2e694c0..19c7b905217 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS = \
fool_death.o \
fool_game.o \
fool_jigsaw.o \
+ fool_jumble.o \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 9fbafd82591..6f8d446c33f 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -334,9 +334,43 @@ private:
}; // 0x44
typedef uint32 OSType;
-typedef uint16 OSErr;
+typedef int16 OSErr;
typedef uint32 ProcPtr;
+// source: Inside Macintosh II-138
+enum OSErrCode : int16 {
+ kNoErr = 0,
+ kBadMDBErr = -60,
+ kBdNamErr = -37,
+ kDirFulErr = -33,
+ kDskFulErr = -34,
+ kDupFNErr = -48,
+ kEOFErr = -39,
+ kExtFSErr = -58,
+ kFBsyErr = -47,
+ kFLckdErr = -45,
+ kFnfErr = -43,
+ kFnOpnErr = -38,
+ kFsRnErr = -59,
+ kGfpErr = -52,
+ kIoErr = -36,
+ kMemFullErr = -108,
+ kNoMacDskErr = -57,
+ kNsDrvErr = -56,
+ kNsvErr = -35,
+ kOpWrErr = -49,
+ kParamErr = -50,
+ kPermErr = -54,
+ kPosErr = -40,
+ kRfNumErr = -51,
+ kTmfoErr = -42,
+ kVolOffLinErr = -53,
+ kVolOnLinErr = -55,
+ kVLckdErr = -46,
+ kWrPermErr = -61,
+ kWPrErr = -44,
+};
+
enum EventCode : uint16 {
kNullEvent = 0,
kMouseDown = 1,
@@ -561,6 +595,8 @@ public:
uint32 TickCount();
// toolbox_fileman.cpp
+ OSErr GetFInfo(const Common::U32String &fileName, int16 vRefNum, Common::MacFinderInfo &fndrInfo);
+
OSErr PBGetVol(ParamBlockRec ¶mBlock);
OSErr PBSetVol(ParamBlockRec ¶mBlock);
diff --git a/engines/fool/toolbox_fileman.cpp b/engines/fool/toolbox_fileman.cpp
index 0d8ae80a83c..5d6c59f8188 100644
--- a/engines/fool/toolbox_fileman.cpp
+++ b/engines/fool/toolbox_fileman.cpp
@@ -42,6 +42,15 @@ Common::String getFileNameFromModal(bool save, const Common::String &suggested,
return result;
}
+OSErr Toolbox::GetFInfo(const Common::U32String &fileName, int16 vRefNum, Common::MacFinderInfo &fndrInfo) {
+ Common::MacResManager resMan;
+ Common::Path path(fileName, ':');
+ // testing resource fork, load from the filesystem
+ if (!resMan.getFileFinderInfo(path, fndrInfo))
+ return kFnfErr;
+ return kNoErr;
+}
+
OSErr Toolbox::PBGetVol(ParamBlockRec ¶mBlock) {
warning("STUB: Toolbox::PBGetVol");
return 0;
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index b825da9cfaa..7ed0d429d34 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -353,6 +353,14 @@ Common::U32String ZBasic::midStr(const Common::U32String &str, int16 expr1, int1
return result;
}
+void ZBasic::midStrSet(Common::U32String &target, int16 expr1, int16 expr2, const Common::U32String &src) {
+ for (int i = 0; i < expr2; i++) {
+ if (((expr1 + i) >= target.size()) || (i >= src.size()))
+ break;
+ target[expr1 + i] = src[i];
+ }
+}
+
void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
if (_fileStreams.contains(fileNo)) {
@@ -573,6 +581,12 @@ void ZBasic::text(uint16 font, uint16 size, uint16 face, SourceMode mode) {
_toolbox->TextMode(mode);
}
+Common::U32String ZBasic::ucase(const Common::U32String &str) {
+ Common::U32String result = str;
+ result.toUppercase();
+ return result;
+}
+
void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type) {
warning("STUB: ZBasic::window");
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 046b71c4d80..6cb101bf358 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -254,6 +254,7 @@ public:
Common::U32String leftStr(const Common::U32String &str, int16 expression);
Common::U32String rightStr(const Common::U32String &str, int16 expression);
Common::U32String midStr(const Common::U32String &str, int16 expr1, int16 expr2);
+ void midStrSet(Common::U32String &target, int16 expr1, int16 expr2, const Common::U32String &src);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
@@ -278,6 +279,7 @@ public:
void writeFileStr(int16 fileNo, const Common::U32String &str);
void writeFileInt(int16 fileNo, int16 data);
void writeFileDblInt(int16 fileNo, int32 data);
+ Common::U32String ucase(const Common::U32String &str);
const Common::U32String &str(size_t index);
Commit: 23a479049bc74bcb1748d6a9444a946003908634
https://github.com/scummvm/scummvm/commit/23a479049bc74bcb1748d6a9444a946003908634
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:11+02:00
Commit Message:
FOOL: Jumble mostly working
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/utils.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index b4c1ac8fe04..d77ada36b7c 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -162,10 +162,9 @@ void FoolGame::sub_128_004() {
this->sub_128_1c2c(0x80);
}
// 128:1de0
- if (this->var_i16_7d2 && (this->var_i16_7c0 == 0x20)) {
+ if (this->var_i16_7d2 && (this->keyLastPressed == 0x20)) {
this->sub_128_1c2c(0x100);
}
- g_toolbox->Delay(0);
// 128:1e06
} while (this->var_i16_7c6 == 0);
@@ -541,6 +540,12 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16
void FoolGame::sub_128_c6a(int16 unk1) {
// 128:0c6a
+
+ // This function is usually called at the start of an event processing loop,
+ // so yield to the event pump/display update when necessary.
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
+
this->var_i16_78a = g_toolbox->GetNextEvent(unk1, this->var_ev_46);
if ((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y < 0x14)) {
this->sub_128_5b30();
@@ -585,8 +590,6 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
do {
this->sub_128_c6a(0);
this->var_i16_3a += 1;
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
} while (!((unk1 == this->var_i16_3a) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0);
}
@@ -778,8 +781,8 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
// 128:172c
if (this->var_ev_46.what == kKeyDown) {
- this->var_i16_7c0 = this->var_ev_46.message & 0xff;
- if (this->var_i16_7c0 == 0xd) {
+ this->keyLastPressed = this->var_ev_46.message & 0xff;
+ if (this->keyLastPressed == 0xd) {
this->var_i16_7be = 1;
}
}
@@ -1368,7 +1371,7 @@ void FoolGame::sub_128_2e3e() {
this->arr_i16_1b90[i] = g_zbasic->readFileInt(2);
this->var_i16_484 = g_zbasic->readFileInt(2);
this->var_str_384 = g_zbasic->readFileStr(2, this->var_i16_484);
- g_zbasic->indexSet(this->var_str_384, i, 2);
+ g_zbasic->indexSet(this->var_str_384, 2, i);
}
// 128:2f54
for (int i = 1; i <= 0x51; i++) {
@@ -1634,12 +1637,13 @@ void FoolGame::sub_128_39a0() {
this->sub_128_4168();
// 128:3a22
// 128:3a38: JSR - "ZBASIC_115"
+ debugC(5, kDebugLoading, "sub_128_39a0: chapter 0x%x, puzzle module %d", this->var_i16_7d0, this->arr_i16_18b2[this->var_i16_7d0]-1);
switch (this->arr_i16_18b2[this->var_i16_7d0]-1) {
case 0:
case 1:
case 2:
case 3:
- this->sub_130_004();
+ this->jumbleRun();
break;
case 4:
this->wordSearchRun();
@@ -1660,7 +1664,7 @@ void FoolGame::sub_128_39a0() {
this->sub_136_004();
break;
case 10:
- this->sub_130_004();
+ this->jumbleRun();
break;
case 11:
this->sunMapRun();
@@ -2199,6 +2203,8 @@ void FoolGame::sub_128_5b30() {
}
void FoolGame::sub_128_5baa() {
+ if (this->var_i16_e12 != 0)
+ return;
warning("STUB: %s", __func__);
}
@@ -2286,19 +2292,41 @@ void FoolGame::sub_128_5c20() {
}
void FoolGame::sub_128_5ef0() {
- warning("STUB: %s", __func__);
+ // 128:5ef0
+ this->sub_128_0a2(0, 0x2af8);
+ g_zbasic->picture(0, 0x14, this->var_pic_7c2);
}
void FoolGame::sub_128_5f16() {
- warning("STUB: %s", __func__);
+ // 128:5f16
+ if (this->var_i16_7c6 == 4) {
+ if (this->arr_i16_1eb8[0] < 1) {
+ this->arr_i16_1eb8[0] = 1;
+ }
+ // 128:5f4c
+ this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
+ }
+ // 128:5f70
+ if ((this->var_i16_7c6 & 1) != 0) {
+ this->sub_128_6186();
+ this->sub_128_0a2(1, 0x2af8);
+ }
}
void FoolGame::sub_128_5f9e() {
- warning("STUB: %s", __func__);
+ // 128:5f9e
+ this->keyLastPressed = this->var_ev_46.message & 0xff;
}
void FoolGame::sub_128_5fb4() {
- warning("STUB: %s", __func__);
+ // 128:5fb4
+ g_toolbox->BeginUpdate(*this->var_ev_46.windowPtr);
+ g_toolbox->EndUpdate(*this->var_ev_46.windowPtr);
+ if ((this->var_i16_7ce & 1) != 0) {
+ this->sub_128_1c2c(0x201);
+ } else {
+ this->sub_128_1c2c(0x200);
+ }
}
void FoolGame::sub_128_5fea() {
@@ -2367,7 +2395,7 @@ void FoolGame::sub_128_61ec() {
if (this->var_ev_46.what == kNullEvent)
g_toolbox->Delay(1);
} while (!((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp)));
- this->var_i16_7c0 = 0;
+ this->keyLastPressed = 0;
}
void FoolGame::sub_128_6244() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 542ed69823e..974f9da9dc1 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -128,7 +128,7 @@ public:
void sub_129_123a();
// fool_jumble.cpp:
- void sub_130_004();
+ void jumbleRun();
void sub_130_c56();
void sub_130_c66();
void sub_130_d2e();
@@ -139,18 +139,28 @@ public:
void sub_130_1426();
void sub_130_1476();
void sub_130_15da();
+ void sub_130_172c();
+ void sub_130_19ac();
+ void sub_130_19da();
+ void sub_130_1a16();
void sub_130_1c1a();
void sub_130_1c52();
void sub_130_1c6c();
void sub_130_1dcc();
void sub_130_1e5c();
void sub_130_1e76();
+ void sub_130_201a();
void sub_130_2078();
void sub_130_2094();
- void sub_130_201a();
+ void sub_130_20aa();
void sub_130_20d2();
void sub_130_20fe();
+ void sub_130_2178();
void sub_130_2226();
+ void sub_130_22ee();
+ void sub_130_23cc();
+ void sub_130_24aa();
+ void sub_130_2548();
void sub_130_25d8();
void sub_130_2790();
@@ -297,7 +307,7 @@ private:
int16 var_i16_7ba;
int16 var_i16_7bc;
int16 var_i16_7be;
- int16 var_i16_7c0;
+ int16 keyLastPressed; // var_i16_7c0
PicHandle var_pic_7c2;
int16 var_i16_7c6;
uint32 var_i32_7c8;
@@ -357,8 +367,8 @@ private:
int16 var_i16_103c;
int16 var_i16_103e;
int16 var_i16_1040;
- int16 var_i16_1056;
- int16 var_i16_1058;
+ int16 jumbleSubPuzzleCount; // var_i16_1056
+ int16 jumbleCurrentSubPuzzle; // var_i16_1058
int16 var_i16_105a;
int16 var_i16_105c;
int16 var_i16_105e;
@@ -366,7 +376,7 @@ private:
int16 var_i16_1062;
int16 var_i16_1064;
int16 var_i16_1066;
- int16 var_i16_1068;
+ int16 jumbleGameType; // var_i16_1068
int16 var_i16_106a;
SourceMode var_i16_106c;
int16 var_i16_106e;
@@ -392,6 +402,11 @@ private:
int16 var_i16_187e;
int16 var_i16_1880;
int16 var_i16_1882;
+ int16 var_i16_1884;
+ int16 var_i16_1886;
+ int16 var_i16_1888;
+ int16 var_i16_188a;
+ int16 var_i16_188c;
Common::U32String var_str_188e;
@@ -483,6 +498,7 @@ private:
Common::Rect arr_rect_5b84;
Common::Rect arr_rect_5b8c;
Common::Rect arr_rect_5b92;
+ int16 arr_i16_5bbc[0x1b];
int16 arr_i16_5cbc[26];
float arr_bcd_5dbc[8];
Handle arr_bytes_5dfc; // used for data buffering
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 9d072bafbfa..821d75366f5 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -127,7 +127,6 @@ void FoolGame::jigsawRun() {
if (this->var_ev_46.what == kMouseDown) {
this->jigsawOnClick();
}
- g_toolbox->Delay(0);
}
// 132:04b8
if (this->var_i16_7c6 == 2) {
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index ae8f14d5ee6..53ec97c4ac6 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -23,6 +23,7 @@
#include "fool/fool_game.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
+#include <climits>
namespace Fool {
@@ -30,14 +31,31 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// word jumble/substitute puzzle
-void FoolGame::sub_130_004() {
+void FoolGame::jumbleRun() {
// 130:0004
this->var_i16_d0c = 0;
this->sub_128_271a();
- this->var_i16_1056 = this->puzzlesReadShort();
+ this->jumbleSubPuzzleCount = this->puzzlesReadShort();
+ debugC(5, kDebugLoading, "FoolGame::jumbleRun: racking %d subpuzzles", this->jumbleSubPuzzleCount);
- for (this->var_i16_1058 = 1; this->var_i16_1058 <= this->var_i16_1056; this->var_i16_1058++) {
+ for (this->jumbleCurrentSubPuzzle = 1; this->jumbleCurrentSubPuzzle <= this->jumbleSubPuzzleCount; this->jumbleCurrentSubPuzzle++) {
this->var_i16_105a = this->puzzlesReadShort();
+ debugC(5, kDebugLoading, "FoolGame::jumbleRun: subpuzzle %d", this->jumbleCurrentSubPuzzle);
+ // load grid information block
+ // 0x0: grid width (squares)
+ // 0x1: grid height (squares)
+ // 0x2:
+ // 0x3:
+ // 0x4:
+ // 0x5:
+ // 0x6: grid square outer width (px)
+ // 0x7: grid square outer height (px)
+ // 0x8: grid top bound (px)
+ // 0x9: grid bottom bound (px)
+ // 0xa: grid left bound (px)
+ // 0xb: grid right bound (px)
+ // 0xc: grid square inner height (px)
+ // 0xd: grid square inner width (px)
if ((this->var_i16_105a & 0x1) == 1) {
for (int i = 0; i <= 0xe; i++) {
this->arr_i16_1eb8[i] = this->puzzlesReadShort();
@@ -62,7 +80,7 @@ void FoolGame::sub_130_004() {
// 130:0126
} while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
// 130:0156
- if ((this->var_i16_105a & 0x2) == this->var_i16_105a) {
+ if ((this->var_i16_105a & 0x2) == 2) {
this->var_i16_105c = this->puzzlesReadShort();
this->var_i16_105e = this->puzzlesReadShort();
this->var_i16_1060 = this->puzzlesReadShort();
@@ -76,8 +94,8 @@ void FoolGame::sub_130_004() {
}
}
// 130:01f0
- this->var_i16_1068 = this->puzzlesReadShort();
- if (this->var_i16_1068 == 6) {
+ this->jumbleGameType = this->puzzlesReadShort();
+ if (this->jumbleGameType == 6) {
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->arr_i16_2f38[i*32 + j] = this->puzzlesReadByte();
@@ -102,10 +120,10 @@ void FoolGame::sub_130_004() {
for (int j = 1; j <= this->var_i16_103a; j++) {
this->var_i16_106a = this->puzzlesReadShort();
if (this->var_i16_106a == 0) {
- this->var_i16_484 += 10;
+ this->var_i16_484 += 0x10;
} else {
// 130:035a
- for (int i = 0; i <= 0xc; i++) {
+ for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
if (this->var_i16_106a & this->bitLUT[i]) {
g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_484]);
@@ -124,11 +142,11 @@ void FoolGame::sub_130_004() {
this->var_i16_106c = kSrcOr;
}
// 130:03d4
- if (this->var_i16_1068 == 4) {
+ if (this->jumbleGameType == 4) {
this->fillRect(0x63, 0xae, 0x108, 0x153, 2);
}
// 130:03fe
- //if (this->var_i16_c04 <= this->var_i16_1058)
+ //if (this->var_i16_c04 <= this->jumbleCurrentSubPuzzle)
this->var_i16_106e = 0;
this->var_str_1070 = g_zbasic->str(168); // empty
this->var_str_1170 = g_zbasic->str(169); // empty
@@ -136,33 +154,33 @@ void FoolGame::sub_130_004() {
for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
this->var_str_1272 = this->puzzlesReadString();
this->var_i16_1372 = this->var_str_1272.size();
- this->var_str_1170 = this->var_str_1170 + this->var_str_1272;
+ this->var_str_1170 += this->var_str_1272;
// 130:047e
- if (this->var_i16_c04 > this->var_i16_1058) {
+ if (this->var_i16_c04 > this->jumbleCurrentSubPuzzle) {
this->var_str_1070 += this->var_str_1272;
} else {
// 130:04ac
- if ((this->var_i16_c04 == this->var_i16_1058) && (this->var_str_c06 != g_zbasic->str(170))) {
+ if ((this->var_i16_c04 == this->jumbleCurrentSubPuzzle) && (this->var_str_c06 != g_zbasic->str(170))) {
// 130:04dc
this->var_str_1070 = this->var_str_c06;
} else {
// 130:04f0
- if ((this->var_i16_1068 == 1) || (this->var_i16_1068 == 5)) {
+ if ((this->jumbleGameType == 1) || (this->jumbleGameType == 5)) {
// 130:0514
this->var_str_384 = this->var_str_1272;
this->sub_130_25d8();
}
// 130:0528
- if (this->var_i16_1068 == 2) {
+ if (this->jumbleGameType == 2) {
this->var_str_384 = this->var_str_1272;
this->sub_130_2790();
}
// 130:0548
- if ((this->var_i16_1068 == 3) || (this->var_i16_1068 == 6)) {
+ if ((this->jumbleGameType == 3) || (this->jumbleGameType == 6)) {
this->var_str_9f4 = g_zbasic->space(this->var_i16_1372);
}
// 130:0580
- if (this->var_i16_1068 == 4) {
+ if (this->jumbleGameType == 4) {
this->var_str_384 = g_zbasic->leftStr(this->var_str_1272, 4);
this->sub_130_25d8();
this->var_str_1374 = this->var_str_9f4;
@@ -238,18 +256,19 @@ void FoolGame::sub_130_004() {
// 130:086a
this->var_i16_1678 = 0;
this->var_str_1578 = g_zbasic->str(171);
- if (this->var_i16_1058 == this->var_i16_1056) {
+ if (this->jumbleCurrentSubPuzzle == this->jumbleSubPuzzleCount) {
+ // all puzzles done, load the success animation list
this->arr_i16_4338[0] = this->puzzlesReadShort();
if (this->arr_i16_4338[0] > 0) {
// 130:08be
for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
- this->arr_i16_4338[this->var_i16_68a] = this->puzzlesReadShort();
+ this->arr_i16_4338[i] = this->puzzlesReadShort();
}
}
}
// 130:08fa
- if (this->var_i16_c04 <= this->var_i16_1058) {
- switch (this->var_i16_1068-1) {
+ if (this->var_i16_c04 <= this->jumbleCurrentSubPuzzle) {
+ switch (this->jumbleGameType-1) {
case 0:
this->sub_130_d2e();
break;
@@ -271,7 +290,7 @@ void FoolGame::sub_130_004() {
}
if ((this->var_i16_7c6 & 1) != 0) {
this->sub_130_c66();
- this->var_i16_1058 = this->var_i16_1056;
+ this->jumbleCurrentSubPuzzle = this->jumbleSubPuzzleCount;
} else {
// 130:0956
if (this->var_i16_7e2 <= 0x50) {
@@ -286,11 +305,11 @@ void FoolGame::sub_130_004() {
}
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->var_i16_1576; i++) {
- g_toolbox->Delay(0xc - (this->var_i16_1576 / 0xa));
+ g_toolbox->Delay((0xc - (this->var_i16_1576 / 0xa))*60/1000);
g_toolbox->InvertRect(this->arr_rect_1f38[ABS(this->arr_i16_3738[i])]);
}
}
- if (this->var_i16_1058 == this->var_i16_1056) {
+ if (this->jumbleCurrentSubPuzzle == this->jumbleSubPuzzleCount) {
this->var_i16_d0c = 1;
}
}
@@ -302,12 +321,13 @@ void FoolGame::sub_130_004() {
// JMP 0x2962
return;
}
+ // if we're here, the puzzle is solved
g_toolbox->PenNormal();
this->sub_128_2664();
this->sub_128_6186();
this->sub_128_61ec();
// 130:0a90
- if (this->var_i16_7e2 == 0x55) {
+ if (this->var_i16_7e2 != 0x55) {
// 130:0b68
while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0) {
// 130:0aa0
@@ -319,7 +339,7 @@ void FoolGame::sub_130_004() {
}
this->var_i16_68a = 0;
do {
- g_toolbox->Delay(this->var_i16_7e4);
+ g_toolbox->Delay(this->var_i16_7e4*60/1000);
this->var_i16_68a++;
g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
this->sub_128_c6a(0);
@@ -327,7 +347,6 @@ void FoolGame::sub_130_004() {
} else {
// 130:0b62
this->sub_128_c6a(0);
- g_toolbox->Delay(0);
}
}
// 130:0b7a
@@ -338,10 +357,9 @@ void FoolGame::sub_130_004() {
this->var_i16_bfc = 0;
do {
for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
- g_toolbox->Delay(0xd);
- g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
+ g_toolbox->Delay(0xd*60/1000);
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
this->sub_128_c6a(0);
- g_toolbox->Delay(0);
if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
this->var_i16_d0c = 1;
}
@@ -374,8 +392,8 @@ void FoolGame::sub_130_c66() {
} else {
// 130:0c98
if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = this->var_i16_1058;
- if ((this->var_i16_1068 == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
+ this->var_i16_c04 = this->jumbleCurrentSubPuzzle;
+ if ((this->jumbleGameType == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
this->var_str_c06 = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
} else {
// 130:0cfe
@@ -410,6 +428,7 @@ void FoolGame::sub_130_d2e() {
void FoolGame::sub_130_d90() {
// 130:0d90
+ // substitution cipher
if (g_zbasic->index(1, 1) != g_zbasic->str(177)) {
if (this->var_str_1070.size() == this->var_str_1170.size()) {
this->var_i16_1372 = g_zbasic->index(1, 1).size();
@@ -448,12 +467,12 @@ void FoolGame::sub_130_d90() {
this->sub_130_1c1a();
this->sub_128_61ec();
this->var_i16_7c6 = 0;
- this->var_i16_7c0 = 0;
+ this->keyLastPressed = 0;
// 130:0fa0
while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:0fa4
this->sub_128_c6a(-1);
- if (this->var_i16_7c0 != 0) {
+ if (this->keyLastPressed != 0) {
this->sub_130_15da();
}
if (this->var_ev_46.what == 1) {
@@ -462,8 +481,6 @@ void FoolGame::sub_130_d90() {
if (this->var_i16_7c6 == 4) {
this->sub_130_c56();
}
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
}
// 130:0ffe
this->sub_130_1c52();
@@ -478,11 +495,11 @@ void FoolGame::sub_130_1004() {
this->sub_130_20d2();
this->sub_128_61ec();
this->var_i16_7c6 = 0;
- this->var_i16_7c0 = 0;
+ this->keyLastPressed = 0;
// 130:1042
while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->sub_128_c6a(-1);
- if (this->var_i16_7c0 != 0) {
+ if (this->keyLastPressed != 0) {
this->sub_130_15da();
}
if (this->var_ev_46.what == 1) {
@@ -491,8 +508,6 @@ void FoolGame::sub_130_1004() {
if (this->var_i16_7c6 == 4) {
this->sub_130_c56();
}
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
}
this->sub_130_1c52();
}
@@ -500,7 +515,7 @@ void FoolGame::sub_130_1004() {
void FoolGame::sub_130_10a6() {
// 130:10a6
this->sub_130_1426();
- if (this->var_i16_1068 != 5) {
+ if (this->jumbleGameType != 5) {
this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 1, 1) + g_zbasic->midStr(this->var_str_1170, 4, 1) + g_zbasic->midStr(this->var_str_1170, 7, 1);
this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 2, 1) + g_zbasic->midStr(this->var_str_1170, 5, 1) + g_zbasic->midStr(this->var_str_1170, 8, 1);
this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 3, 1) + g_zbasic->midStr(this->var_str_1170, 6, 1) + g_zbasic->midStr(this->var_str_1170, 9, 1);
@@ -521,8 +536,6 @@ void FoolGame::sub_130_10a6() {
if (this->var_i16_7c6 == 4) {
this->sub_130_c56();
}
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
}
}
@@ -536,12 +549,12 @@ void FoolGame::sub_130_1282() {
this->sub_128_61ec();
this->var_i16_7b2 = 0;
this->var_i16_7c6 = 0;
- this->var_i16_7c0 = 0;
+ this->keyLastPressed = 0;
g_toolbox->InitCursor();
while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:12cc
this->sub_128_c6a(-1);
- if (this->var_i16_7c0 != 0) {
+ if (this->keyLastPressed != 0) {
this->sub_130_15da();
}
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -602,58 +615,190 @@ void FoolGame::sub_130_1476() {
return;
}
// 130:1558
-
- warning("STUB: %s", __func__);
+ if ((this->jumbleGameType == 6) && (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] >= 0x11)) {
+ this->sub_128_50e(0xf, 0x42, 0x1);
+ return;
+ }
+ // 130:15b0
+ switch (this->jumbleGameType - 1) {
+ case 0:
+ this->sub_130_172c();
+ break;
+ case 1:
+ case 2:
+ case 6:
+ this->sub_130_20aa();
+ break;
+ case 3:
+ case 4:
+ this->sub_130_172c();
+ break;
+ default:
+ warning("sub_130_1476: unhandled case %d", this->jumbleGameType-1);
+ break;
+ }
}
void FoolGame::sub_130_15da() {
// 130:15da
- if ((this->var_i16_7c0 == 3) || (this->var_i16_7c0 == 0xd)) {
+ if ((this->keyLastPressed == 3) || (this->keyLastPressed == 0xd)) {
this->sub_130_1c52();
this->sub_130_2078();
this->sub_130_20d2();
- this->var_i16_7c0 = 0;
+ this->keyLastPressed = 0;
return;
}
- if (this->var_i16_7c0 == 8) {
+ if (this->keyLastPressed == 8) {
this->sub_130_1c52();
this->sub_130_2094();
this->sub_130_20d2();
- this->var_i16_7c0 = 0;
+ this->keyLastPressed = 0;
return;
}
// 130:1632
- if ((this->var_i16_7c0 >= 0x61) && (this->var_i16_7c0 <= 0x7a)) {
- this->var_i16_7c0 -= 0x20;
+ if ((this->keyLastPressed >= 0x61) && (this->keyLastPressed <= 0x7a)) {
+ this->keyLastPressed -= 0x20;
}
- if (this->var_i16_1068 != 3) {
- if ((this->var_i16_7c0 < 0x41) || (this->var_i16_7c0 > 0x5a)) {
+ if (this->jumbleGameType != 3) {
+ if ((this->keyLastPressed < 0x41) || (this->keyLastPressed > 0x5a)) {
return;
}
} else {
// 130:1690
this->var_i16_1882 = 0;
- if ((this->var_i16_7c0 < 0x41) || (this->var_i16_7c0 > 0x5a)) {
+ if ((this->keyLastPressed < 0x41) || (this->keyLastPressed > 0x5a)) {
this->var_i16_1882 = 1;
}
- if (this->var_i16_7c0 == 0x20) {
+ if (this->keyLastPressed == 0x20) {
this->var_i16_1882 = 0;
}
if (this->var_i16_1882 != 0)
return;
}
// 130:16dc
- this->var_str_d12 = g_zbasic->chr(this->var_i16_7c0);
- if (this->var_i16_7c0 != 2) {
- if (!((this->var_i16_1068 == 3) || (this->var_i16_1068 == 6))) {
-
+ this->var_str_d12 = g_zbasic->chr(this->keyLastPressed);
+ // 130:16f2
+ this->keyLastPressed = 0;
+ if (this->jumbleGameType != 2) {
+ // 130:1706
+ if (!((this->jumbleGameType == 3) || (this->jumbleGameType == 6))) {
+ this->sub_130_172c();
} else {
this->sub_130_201a();
- return;
}
+ } else {
+ this->sub_130_1a16();
+ }
+}
+
+void FoolGame::sub_130_172c() {
+ // 130:172c
+ if ((this->jumbleGameType == 4) && (this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] == 5)) {
+ this->sub_130_19da();
+ return;
+ }
+ // 130:1776
+ if (!((this->var_i16_1678 == this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]) && (this->var_i16_187e > 0))) {
+ // 130:17c4
+ this->sub_130_19ac();
+ this->var_i16_187e = ABS(this->arr_i16_3738[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]]);
+ this->var_i16_1884 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_187e]);
+ this->sub_130_2178();
+ return;
+ }
+ // 130:1844
+ this->var_i16_1880 = ABS(this->arr_i16_3738[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]]);
+ if (this->var_i16_187e == this->var_i16_1880) {
+ this->sub_130_19ac();
+ return;
+ }
+ // 130:189a
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1880]);
+ this->var_i16_1886 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
+ this->var_str_1374 = g_zbasic->midStr(this->var_str_1070, this->var_i16_1884, 1);
+ this->var_str_1474 = g_zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
+ g_zbasic->midStrSet(this->var_str_1070, this->var_i16_1884, 1, this->var_str_1474);
+ g_zbasic->midStrSet(this->var_str_1070, this->var_i16_1886, 1, this->var_str_1374);
+ this->var_i16_1574 = this->var_i16_187e;
+ this->var_i16_106e = this->var_i16_1884;
+ this->var_str_d12 = this->var_str_1474;
+ this->sub_130_1c6c();
+ this->sub_130_1dcc();
+ this->var_i16_1574 = this->var_i16_1880;
+ this->var_i16_106e = this->var_i16_1886;
+ this->var_str_d12 = this->var_str_1374;
+ this->sub_130_1c6c();
+ this->sub_130_1dcc();
+ this->var_i16_187e = 0;
+ this->var_i16_1880 = 0;
+}
+
+void FoolGame::sub_130_19ac() {
+ if (this->var_i16_187e > 0) {
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_187e]);
}
+ this->var_i16_187e = 0;
+ this->var_i16_1880 = 0;
+}
+
+void FoolGame::sub_130_19da() {
+ this->sub_130_19ac();
+ this->sub_128_50e(0x19, 0x64, 0);
+ for (int i = 0; i <= 0x19; i++) {
+ g_toolbox->InvertRect(this->arr_rect_1f38[9]);
+ this->sub_128_3da(1);
+ }
+}
+
+void FoolGame::sub_130_1a16() {
// 130:1a16
- warning("STUB: %s", __func__);
+ this->var_str_1374 = this->var_str_d12;
+ this->var_str_1474 = g_zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
+ if (this->var_str_1374 == this->var_str_1474)
+ return;
+ // 130:1a5c
+ this->sub_130_1c52();
+ for (int16 i = 1; i <= this->var_i16_1576; i++) {
+ // 130:1a66
+ this->var_str_384 = g_zbasic->midStr(this->var_str_1070, i, 1);
+ if ((this->var_str_384 == this->var_str_1374) || (this->var_str_384 == this->var_str_1474)) {
+ if (this->var_str_384 == this->var_str_1374) {
+ this->var_str_d12 = this->var_str_1474;
+ } else {
+ // 130:1ad8
+ this->var_str_d12 = this->var_str_1374;
+ }
+ // 130:1ae8
+ g_zbasic->midStrSet(this->var_str_1070, i, 1, this->var_str_d12);
+ this->var_i16_1574 = ABS(this->arr_i16_3738[i]);
+ this->sub_130_1c6c();
+ this->sub_130_1dcc();
+ }
+ // 130:1b2e
+ }
+ // 130:1b40
+ if (this->var_str_1578 != g_zbasic->str(184)) { // blank
+ this->var_i16_68a = 1;
+ for (int i = 1; i <= this->var_i16_167a - 2; i++) {
+ this->var_str_d12 = g_zbasic->midStr(this->var_str_1578, this->var_i16_68a, 1);
+ if ((this->var_str_d12 == this->var_str_1374) || (this->var_str_d12 == this->var_str_1474)) {
+ // 130:1ba8
+ if (this->var_str_d12 == this->var_str_1374) {
+ this->var_str_d12 = this->var_str_1474;
+ } else {
+ // 130:1bd2
+ this->var_str_d12 = this->var_str_1374;
+ }
+ // 130:1be2
+ g_zbasic->midStrSet(this->var_str_1578, this->var_i16_68a, 1, this->var_str_d12);
+ }
+ // 130:1c02
+ }
+ sub_130_2226();
+ }
+ // 130:1c1a
+ this->sub_130_1c1a();
}
void FoolGame::sub_130_1c1a() {
@@ -702,11 +847,38 @@ void FoolGame::sub_130_1dcc() {
}
void FoolGame::sub_130_1e5c() {
- warning("STUB: %s", __func__);
+ // 130:1e5c
+ g_toolbox->PenNormal();
+ g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+ this->sub_130_1e76();
}
void FoolGame::sub_130_1e76() {
- warning("STUB: %s", __func__);
+ // 130:1e76
+ this->arr_i16_4758[0] = this->arr_rect_1f38[this->var_i16_1574].top + 3;
+ this->arr_i16_4758[1] = this->arr_rect_1f38[this->var_i16_1574].left + 3;
+ this->arr_i16_4758[2] = this->arr_rect_1f38[this->var_i16_1574].bottom - 3;
+ this->arr_i16_4758[3] = this->arr_rect_1f38[this->var_i16_1574].right - 3;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[this->var_i16_105e]);
+ g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ // 130:1f70
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2],
+ this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ );
+ g_toolbox->DrawString(this->var_str_d12);
+ if (this->arr_i16_3738[this->var_i16_106e] < 0)
+ return;
+ // 130:1ff4
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenMode(kPatBic);
+ g_toolbox->PaintRect(temp);
}
void FoolGame::sub_130_201a() {
@@ -740,24 +912,195 @@ void FoolGame::sub_130_2094() {
}
}
+void FoolGame::sub_130_20aa() {
+ // 130:20aa
+ this->sub_130_1c52();
+ this->var_i16_106e = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
+ this->sub_130_20d2();
+}
+
+
void FoolGame::sub_130_20d2() {
- warning("STUB: %s", __func__);
+ // 130:20d2
+ this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
+ this->sub_130_1c52();
+ this->sub_130_20fe();
+ this->sub_130_2178();
}
void FoolGame::sub_130_20fe() {
- warning("STUB: %s", __func__);
+ // 130:20fe
+ this->var_i16_1888 = ABS(this->arr_i16_3738[this->var_i16_106e]) - 1;
+ this->var_i16_68a = (this->var_i16_1888 % this->arr_i16_1eb8[0]) + 1;
+ this->var_i16_68c = (this->var_i16_1888 / this->arr_i16_1eb8[0]) + 1;
+}
+
+void FoolGame::sub_130_2178() {
+ // 130:2178
+ if ((this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == this->var_i16_1678) || (this->jumbleGameType == 2))
+ return;
+
+ this->var_i16_1678 = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
+ if (g_zbasic->index(1, this->var_i16_1678) != g_zbasic->str(185)) { // empty
+ this->var_str_1578 = g_zbasic->index(1, this->var_i16_1678);
+ this->sub_130_2226();
+ }
+ // 130:2224
}
void FoolGame::sub_130_2226() {
- warning("STUB: %s", __func__);
+ // 130:2226
+ if (this->var_i16_7e2 == 0x14) {
+ this->sub_130_23cc();
+ return;
+ }
+ if (this->var_i16_7e2 == 0x3c) {
+ this->sub_130_22ee();
+ return;
+ }
+ if (this->var_i16_7e2 == 0x35) {
+ this->sub_130_24aa();
+ return;
+ }
+ if (this->var_i16_7e2 == 0x55) {
+ this->sub_130_2548();
+ return;
+ }
+ // 130:2266
+ this->fillRect(0x124, 0x64, 0x139, 0x1ef, 0);
+ if (this->var_str_1578 == g_zbasic->str(186)) // blank
+ return;
+ // 130:22a0
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1578);
+ g_toolbox->MoveTo(0x127 - (this->var_i16_484 / 2), 0x133);
+ g_toolbox->DrawString(this->var_str_1578);
+}
+
+void FoolGame::sub_130_22ee() {
+ // 130:22ee
+ this->fillRect(0x131, 0x84, 0x156, 0x17e, this->var_i16_1060);
+ if (this->var_str_1578 == g_zbasic->str(187)) // blank
+ return;
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ this->fillRect(0x13c, 0xf6 - (this->var_i16_7ba / 2), 0x150, 0x10a + (this->var_i16_7ba / 2), 2);
+ g_toolbox->MoveTo(0x100 - (this->var_i16_7ba / 2), 0x14a);
+ g_toolbox->DrawString(this->var_str_1578);
+}
+
+void FoolGame::sub_130_23cc() {
+ // 130:23cc
+ this->fillRect(0x12c, 0x8c, 0x156, 0x186, this->var_i16_1060);
+ if (this->var_str_1578 == g_zbasic->str(188))
+ return;
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ this->fillRect(0x130, 0x100 - (this->var_i16_7ba / 2), 0x144, 0x114 + (this->var_i16_7ba / 2), 2);
+ g_toolbox->MoveTo(0x10a - (this->var_i16_7ba / 2), 0x13e);
+ g_toolbox->DrawString(this->var_str_1578);
+}
+
+void FoolGame::sub_130_24aa() {
+ // 130:24aa
+ this->fillRect(0x125, 0x20, 0x136, 0x15e, 2);
+ if (this->var_str_1578 == g_zbasic->str(189)) // blank
+ return;
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ g_toolbox->MoveTo(0xc4 - (this->var_i16_7ba / 2), 0x131);
+ g_toolbox->DrawString(this->var_str_1578);
+}
+
+void FoolGame::sub_130_2548() {
+ // 130:2548
+ g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
+ if (this->var_str_1578 == g_zbasic->str(190)) // blank
+ return;
+
+ this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ this->fillRect(0x13e, 0xc, 0x14e, 0x16 + this->var_i16_7ba, 0);
+ g_toolbox->MoveTo(0x16, 0x14a);
+ g_toolbox->DrawString(this->var_str_1578);
}
void FoolGame::sub_130_25d8() {
- warning("STUB: %s", __func__);
+ // 130:25d8
+ g_zbasic->unk_20();
+ this->var_i16_188a = this->var_str_384.size();
+ this->var_str_9f4 = g_zbasic->space(this->var_i16_188a);
+ for (int16 i = 1; i <= this->var_i16_188a; i++) {
+ this->arr_i16_5bbc[i] = i;
+ }
+ this->var_i16_188c = 0;
+ for (int16 i = this->var_i16_188a; i >= 1; i--) {
+ do {
+ this->var_i16_7e4 = g_zbasic->rndInt(i);
+ // 130:2640
+ if (i == 1) {
+ // 130:266e
+ if (this->arr_i16_5bbc[this->var_i16_7e4] == i) {
+ this->var_i16_188c = 1;
+ }
+ break;
+ }
+ // 130:264c
+ } while (this->arr_i16_5bbc[this->var_i16_7e4] == i);
+ // 130:2690
+ this->arr_i16_5cbc[i] = this->arr_i16_5bbc[this->var_i16_7e4];
+ for (int16 j = this->var_i16_7e4; j <= i; j++) {
+ this->arr_i16_5bbc[j] = this->arr_i16_5bbc[j+1];
+ }
+ // 130:26f2
+ }
+ // 130:2712
+ if (this->var_i16_188c != 0) {
+ g_zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
+ }
+ // 130:273c
+ for (int16 i = 1; i <= this->var_i16_188a; i++) {
+ g_zbasic->midStrSet(this->var_str_9f4, i, 1, g_zbasic->midStr(this->var_str_384, this->arr_i16_5cbc[i], 1));
+ }
}
void FoolGame::sub_130_2790() {
- warning("STUB: %s", __func__);
+ g_zbasic->unk_20();
+ for (int16 i = 1; i <= 0x1a; i++) {
+ this->arr_i16_5bbc[i] = i;
+ }
+ this->var_i16_188c = 0;
+ for (int16 i = 0x1a; i > 0; i--) {
+ // 130:27c4
+ do {
+ this->var_i16_7e4 = g_zbasic->rndInt(i);
+ // 130:27d2
+ if (i == 1) {
+ // 130:2800
+ if (this->arr_i16_5bbc[this->var_i16_7e4] == i) {
+ // 130:281c
+ this->var_i16_188c = 1;
+ }
+ break;
+ }
+ // 130:27de
+ } while (this->arr_i16_5bbc[this->var_i16_7e4] == i);
+ // 130:2822
+ this->arr_i16_5cbc[i] = this->arr_i16_5bbc[this->var_i16_7e4];
+ for (int16 j = this->var_i16_7e4; j <= i; j++) {
+ this->arr_i16_5bbc[j] = this->arr_i16_5bbc[j+1];
+ }
+ }
+ // 130:28a4
+ if (this->var_i16_188c != 0) {
+ g_zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
+ }
+ this->var_i16_188a = this->var_str_384.size();
+ this->var_str_9f4 = g_zbasic->space(this->var_i16_188a);
+ for (int16 i = 1; i <= this->var_i16_188a; i++) {
+ this->var_i16_7e4 = g_zbasic->asc(g_zbasic->midStr(this->var_str_384, i, 1)) - 0x40;
+ g_zbasic->midStrSet(this->var_str_9f4, i, 1, g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4]+0x40));
+ }
}
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 63a86c8cea3..d4c16b3dc20 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -27,8 +27,140 @@
namespace Fool {
+static const struct MacKeyCodeMapping {
+ Common::KeyCode scummvm;
+ int mac;
+} MackeyCodeMappings[] = {
+ { Common::KEYCODE_ESCAPE, 53 },
+ { Common::KEYCODE_F1, 122 },
+ { Common::KEYCODE_F2, 120 },
+ { Common::KEYCODE_F3, 99 },
+ { Common::KEYCODE_F4, 118 },
+ { Common::KEYCODE_F5, 96 },
+ { Common::KEYCODE_F6, 97 },
+ { Common::KEYCODE_F7, 98 },
+ { Common::KEYCODE_F8, 100 },
+ { Common::KEYCODE_F9, 101 },
+ { Common::KEYCODE_F10, 109 },
+ { Common::KEYCODE_F11, 103 },
+ { Common::KEYCODE_F12, 111 },
+ { Common::KEYCODE_F13, 105 }, // mirrored by print
+ { Common::KEYCODE_F14, 107 }, // mirrored by scroll lock
+ { Common::KEYCODE_F15, 113 }, // mirrored by pause
+
+ { Common::KEYCODE_BACKQUOTE, 10 },
+ { Common::KEYCODE_1, 18 },
+ { Common::KEYCODE_2, 19 },
+ { Common::KEYCODE_3, 20 },
+ { Common::KEYCODE_4, 21 },
+ { Common::KEYCODE_5, 23 },
+ { Common::KEYCODE_6, 22 },
+ { Common::KEYCODE_7, 26 },
+ { Common::KEYCODE_8, 28 },
+ { Common::KEYCODE_9, 25 },
+ { Common::KEYCODE_0, 29 },
+ { Common::KEYCODE_MINUS, 27 },
+ { Common::KEYCODE_EQUALS, 24 },
+ { Common::KEYCODE_BACKSPACE, 51 },
+
+ { Common::KEYCODE_TAB, 48 },
+ { Common::KEYCODE_q, 12 },
+ { Common::KEYCODE_w, 13 },
+ { Common::KEYCODE_e, 14 },
+ { Common::KEYCODE_r, 15 },
+ { Common::KEYCODE_t, 17 },
+ { Common::KEYCODE_y, 16 },
+ { Common::KEYCODE_u, 32 },
+ { Common::KEYCODE_i, 34 },
+ { Common::KEYCODE_o, 31 },
+ { Common::KEYCODE_p, 35 },
+ { Common::KEYCODE_LEFTBRACKET, 33 },
+ { Common::KEYCODE_RIGHTBRACKET, 30 },
+ { Common::KEYCODE_BACKSLASH, 42 },
+
+ { Common::KEYCODE_CAPSLOCK, 57 },
+ { Common::KEYCODE_a, 0 },
+ { Common::KEYCODE_s, 1 },
+ { Common::KEYCODE_d, 2 },
+ { Common::KEYCODE_f, 3 },
+ { Common::KEYCODE_g, 5 },
+ { Common::KEYCODE_h, 4 },
+ { Common::KEYCODE_j, 38 },
+ { Common::KEYCODE_k, 40 },
+ { Common::KEYCODE_l, 37 },
+ { Common::KEYCODE_SEMICOLON, 41 },
+ { Common::KEYCODE_QUOTE, 39 },
+ { Common::KEYCODE_RETURN, 36 },
+
+ { Common::KEYCODE_LSHIFT, 56 },
+ { Common::KEYCODE_z, 6 },
+ { Common::KEYCODE_x, 7 },
+ { Common::KEYCODE_c, 8 },
+ { Common::KEYCODE_v, 9 },
+ { Common::KEYCODE_b, 11 },
+ { Common::KEYCODE_n, 45 },
+ { Common::KEYCODE_m, 46 },
+ { Common::KEYCODE_COMMA, 43 },
+ { Common::KEYCODE_PERIOD, 47 },
+ { Common::KEYCODE_SLASH, 44 },
+ { Common::KEYCODE_RSHIFT, 56 },
+
+ { Common::KEYCODE_LCTRL, 54 }, // control
+ { Common::KEYCODE_LALT, 58 }, // option
+ { Common::KEYCODE_LSUPER, 55 }, // command
+ { Common::KEYCODE_SPACE, 49 },
+ { Common::KEYCODE_RSUPER, 55 }, // command
+ { Common::KEYCODE_RALT, 58 }, // option
+ { Common::KEYCODE_RCTRL, 54 }, // control
+
+ { Common::KEYCODE_LEFT, 123 },
+ { Common::KEYCODE_RIGHT, 124 },
+ { Common::KEYCODE_DOWN, 125 },
+ { Common::KEYCODE_UP, 126 },
+
+ { Common::KEYCODE_NUMLOCK, 71 },
+ { Common::KEYCODE_KP_EQUALS, 81 },
+ { Common::KEYCODE_KP_DIVIDE, 75 },
+ { Common::KEYCODE_KP_MULTIPLY, 67 },
+
+ { Common::KEYCODE_KP7, 89 },
+ { Common::KEYCODE_KP8, 91 },
+ { Common::KEYCODE_KP9, 92 },
+ { Common::KEYCODE_KP_MINUS, 78 },
+
+ { Common::KEYCODE_KP4, 86 },
+ { Common::KEYCODE_KP5, 87 },
+ { Common::KEYCODE_KP6, 88 },
+ { Common::KEYCODE_KP_PLUS, 69 },
+
+ { Common::KEYCODE_KP1, 83 },
+ { Common::KEYCODE_KP2, 84 },
+ { Common::KEYCODE_KP3, 85 },
+
+ { Common::KEYCODE_KP0, 82 },
+ { Common::KEYCODE_KP_PERIOD, 65 },
+ { Common::KEYCODE_KP_ENTER, 76 },
+
+ { Common::KEYCODE_MENU, 50 }, // international
+ { Common::KEYCODE_PRINT, 105 }, // mirrored by F13
+ { Common::KEYCODE_SCROLLOCK, 107 }, // mirrored by F14
+ { Common::KEYCODE_PAUSE, 113 }, // mirrored by F15
+ { Common::KEYCODE_INSERT, 114 },
+ { Common::KEYCODE_HOME, 115 },
+ { Common::KEYCODE_PAGEUP, 116 },
+ { Common::KEYCODE_DELETE, 117 },
+ { Common::KEYCODE_END, 119 },
+ { Common::KEYCODE_PAGEDOWN, 121 },
+
+ { Common::KEYCODE_INVALID, 0 }
+};
+
+
+
Toolbox::Toolbox() {
_frameLimiter = new Graphics::FrameLimiter(g_system, 60);
+ for (const MacKeyCodeMapping *k = MackeyCodeMappings; k->scummvm != Common::KEYCODE_INVALID; k++)
+ _keyMap[k->scummvm] = k->mac;
}
Toolbox::~Toolbox() {
@@ -63,6 +195,52 @@ void Toolbox::_pumpEvents() {
newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
break;
+ case Common::EVENT_KEYDOWN:
+ newRecord.what = kKeyDown;
+ newRecord.where = _mouse;
+ newRecord.message = (_keyMap.getValOrDefault(event.kbd.keycode, 0) << 8);
+ newRecord.message |= event.kbd.ascii;
+ if (event.kbd.flags & Common::KBD_META) {
+ _modifiers |= kModCommandKeyDown;
+ } else {
+ _modifiers &= ~kModCommandKeyDown;
+ }
+ if (event.kbd.flags & Common::KBD_ALT) {
+ _modifiers |= kModLOptionKeyDown;
+ } else {
+ _modifiers &= ~kModLOptionKeyDown;
+ }
+ if (event.kbd.flags & Common::KBD_CTRL) {
+ _modifiers |= kModLControlKeyDown;
+ } else {
+ _modifiers &= ~kModLControlKeyDown;
+ }
+ newRecord.modifiers = _modifiers;
+ _events.push_back(newRecord);
+ break;
+ case Common::EVENT_KEYUP:
+ newRecord.what = kKeyUp;
+ newRecord.where = _mouse;
+ newRecord.message = (_keyMap.getValOrDefault(event.kbd.keycode, 0) << 8);
+ newRecord.message |= event.kbd.ascii;
+ if (event.kbd.flags & Common::KBD_META) {
+ _modifiers |= kModCommandKeyDown;
+ } else {
+ _modifiers &= ~kModCommandKeyDown;
+ }
+ if (event.kbd.flags & Common::KBD_ALT) {
+ _modifiers |= kModLOptionKeyDown;
+ } else {
+ _modifiers &= ~kModLOptionKeyDown;
+ }
+ if (event.kbd.flags & Common::KBD_CTRL) {
+ _modifiers |= kModLControlKeyDown;
+ } else {
+ _modifiers &= ~kModLControlKeyDown;
+ }
+ newRecord.modifiers = _modifiers;
+ _events.push_back(newRecord);
+ break;
case Common::EVENT_QUIT:
manager->resetQuit();
newRecord.what = kScummVMQuitEvt;
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 6f8d446c33f..647581f7afe 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -1280,6 +1280,7 @@ private:
Common::HashMap<Handle, ToolboxResInfo> _resInfo;
Common::HashMap<PicHandle, Handle> _resPicts;
Graphics::FrameLimiter *_frameLimiter = nullptr;
+ Common::HashMap<int, int> _keyMap;
Common::SharedPtr<Cursor> _cursor;
int _cursorLevel = 0;
Common::Point _mouse;
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index b348f247049..3ceefbd2a0e 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -186,7 +186,7 @@ Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const
uint32 white = g_engine->_wm._colorWhite;
if (mode == kSrcCopy && !mask) {
// fast blit
- dst->blitFrom(*src, srcRect, dstPos);
+ dst->blitFrom(*src, srcRect, Common::Point(srcRect.left + dstPos.x, srcRect.top + dstPos.y));
} else {
// per-pixel blit
for (int y = srcRect.top; y < srcRect.bottom; y++) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 7ed0d429d34..8476f3f579c 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -355,9 +355,9 @@ Common::U32String ZBasic::midStr(const Common::U32String &str, int16 expr1, int1
void ZBasic::midStrSet(Common::U32String &target, int16 expr1, int16 expr2, const Common::U32String &src) {
for (int i = 0; i < expr2; i++) {
- if (((expr1 + i) >= target.size()) || (i >= src.size()))
+ if (((expr1 + i - 1) >= (int)target.size()) || (i >= (int)src.size()))
break;
- target[expr1 + i] = src[i];
+ target[expr1 + i - 1] = src[i];
}
}
Commit: 6e51d948a6ebdcd2a32f34a1ead3c20cfb74ecbe
https://github.com/scummvm/scummvm/commit/6e51d948a6ebdcd2a32f34a1ead3c20cfb74ecbe
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:12+02:00
Commit Message:
MACGUI: Adjust MacMenu to use _composeSurface from the base class
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
graphics/macgui/macpopupmenu.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index dec4c193f40..d7db3b644b2 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -91,11 +91,11 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_type = MacWindowConstants::kWindowMenu;
- _screen.create(bounds.width(), bounds.height(), _wm->_pixelformat);
+ _composeSurface->create(bounds.width(), bounds.height(), _wm->_pixelformat);
_bbox.left = 0;
_bbox.top = 0;
- _bbox.right = _screen.w;
+ _bbox.right = _composeSurface->w;
_bbox.bottom = kMenuHeight;
_dimensionsDirty = true;
@@ -130,7 +130,7 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_isModal = false;
- _tempSurface.create(_screen.w, _font->getFontHeight(), _wm->_pixelformat);
+ _tempSurface.create(_composeSurface->w, _font->getFontHeight(), _wm->_pixelformat);
}
MacMenu::~MacMenu() {
@@ -964,7 +964,7 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
int y1 = y;
int x2 = x1 + maxWidth + _menuLeftDropdownPadding + _menuRightDropdownPadding - 4;
int y2 = y1 + submenu->items.size() * _menuDropdownItemHeight + 2;
- y2 = MIN(y2, y1 + ((_screen.h - y1) / _menuDropdownItemHeight) * _menuDropdownItemHeight + 2);
+ y2 = MIN(y2, y1 + ((_composeSurface->h - y1) / _menuDropdownItemHeight) * _menuDropdownItemHeight + 2);
if (x2 > (_bbox.width()-_menuRightDropdownPadding)) {
int dx = x2 - (_bbox.width()-_menuRightDropdownPadding);
@@ -1049,21 +1049,21 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
_contentIsDirty = false;
- _screen.clear(_wm->_colorGreen);
+ _composeSurface->clear(_wm->_colorGreen);
bool shouldUseDesktopArc = !(_wm->_mode & kWMModeWin95) || (_wm->_mode & kWMModeForceMacBorder);
// Fill in the corners with black
- _screen.fillRect(r, _wm->_colorBlack);
- _screen.drawRoundRect(r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite, true);
+ _composeSurface->fillRect(r, _wm->_colorBlack);
+ _composeSurface->drawRoundRect(r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite, true);
r.top = 7;
- _screen.fillRect(r, _wm->_colorWhite);
+ _composeSurface->fillRect(r, _wm->_colorWhite);
r.top = kMenuHeight - 1;
r.bottom++;
- _screen.fillRect(r, _wm->_colorGreen);
+ _composeSurface->fillRect(r, _wm->_colorGreen);
r.bottom--;
- _screen.fillRect(r, _wm->_colorBlack);
+ _composeSurface->fillRect(r, _wm->_colorBlack);
for (uint i = 0; i < _items.size(); i++) {
int color = _wm->_colorBlack;
@@ -1081,7 +1081,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
hbox.right -= 2;
}
- _screen.fillRect(hbox, _wm->_colorBlack);
+ _composeSurface->fillRect(hbox, _wm->_colorBlack);
color = _wm->_colorWhite;
}
@@ -1089,7 +1089,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
int x = _align == kTextAlignRight ? -kMenuLeftMargin : kMenuLeftMargin;
x += it->bbox.left;
- ManagedSurface *s = &_screen;
+ ManagedSurface *s = _composeSurface;
int tx = x, ty = y;
if (!it->enabled) {
@@ -1124,18 +1124,18 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
if (!it->enabled) {
if (_wm->_pixelformat.bytesPerPixel == 1) {
- drawMenuPattern<byte>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ drawMenuPattern<byte>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
} else if (_wm->_pixelformat.bytesPerPixel == 2) {
- drawMenuPattern<uint16>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ drawMenuPattern<uint16>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
} else {
- drawMenuPattern<uint32>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ drawMenuPattern<uint32>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
}
}
}
if (!(_wm->_mode & kWMModeNoSystemRedraw)) {
if ((_wm->_mode & kWMModalMenuMode) || !_wm->_screen)
- g_system->copyRectToScreen(_screen.getBasePtr(_bbox.left, _bbox.top), _screen.pitch, _bbox.left, _bbox.top, _bbox.width(), _bbox.height());
+ g_system->copyRectToScreen(_composeSurface->getBasePtr(_bbox.left, _bbox.top), _composeSurface->pitch, _bbox.left, _bbox.top, _bbox.width(), _bbox.height());
}
for (uint i = 0; i < _menustack.size(); i++) {
@@ -1143,7 +1143,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
}
if (g)
- g->transBlitFrom(_screen, _wm->_colorGreen);
+ g->transBlitFrom(*_composeSurface, _wm->_colorGreen);
if (!(_wm->_mode & kWMModeNoSystemRedraw) && !(_wm->_mode & kWMModalMenuMode) && g)
g_system->copyRectToScreen(g->getPixels(), g->pitch, 0, 0, g->w, g->h);
@@ -1159,12 +1159,12 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
bool topMenuEnabled = _activeItem == -1 || _items[_activeItem]->enabled;
- _screen.fillRect(*r, _wm->_colorWhite);
- _screen.frameRect(*r, _wm->_colorBlack);
- _screen.vLine(r->right, r->top + 3, r->bottom + 1, _wm->_colorBlack);
- _screen.vLine(r->right + 1, r->top + 3, r->bottom + 1, _wm->_colorBlack);
- _screen.hLine(r->left + 3, r->bottom, r->right + 1, _wm->_colorBlack);
- _screen.hLine(r->left + 3, r->bottom + 1, r->right + 1, _wm->_colorBlack);
+ _composeSurface->fillRect(*r, _wm->_colorWhite);
+ _composeSurface->frameRect(*r, _wm->_colorBlack);
+ _composeSurface->vLine(r->right, r->top + 3, r->bottom + 1, _wm->_colorBlack);
+ _composeSurface->vLine(r->right + 1, r->top + 3, r->bottom + 1, _wm->_colorBlack);
+ _composeSurface->hLine(r->left + 3, r->bottom, r->right + 1, _wm->_colorBlack);
+ _composeSurface->hLine(r->left + 3, r->bottom + 1, r->right + 1, _wm->_colorBlack);
int y = r->top + 1;
int x = _align == kTextAlignRight ? -_menuRightDropdownPadding: _menuLeftDropdownPadding;
@@ -1213,7 +1213,7 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
color = _wm->_colorWhite;
Common::Rect trect(r->left, y - (_wm->_fontMan->hasBuiltInFonts() ? 1 : 0), r->right, y + _font->getFontHeight());
- _screen.fillRect(trect, _wm->_colorBlack);
+ _composeSurface->fillRect(trect, _wm->_colorBlack);
if (_selectedItem != i) {
if (menu->items[i]->unicode) {
@@ -1225,7 +1225,7 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
}
if (!text.empty() || !unicodeText.empty()) {
- ManagedSurface *s = &_screen;
+ ManagedSurface *s = _composeSurface;
int tx = x, ty = y;
if (!topMenuEnabled || !menu->items[i]->enabled) {
@@ -1267,21 +1267,21 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
if (!topMenuEnabled || !menu->items[i]->enabled) {
if (_wm->_pixelformat.bytesPerPixel == 1) {
- drawMenuPattern<byte>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
+ drawMenuPattern<byte>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
} else if (_wm->_pixelformat.bytesPerPixel == 2) {
- drawMenuPattern<uint16>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
+ drawMenuPattern<uint16>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
} else {
- drawMenuPattern<uint32>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
+ drawMenuPattern<uint32>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
}
}
} else { // Delimiter
if (_wm->_pixelformat.bytesPerPixel == 1) {
- drawMenuDelimiter<byte>(_screen, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
+ drawMenuDelimiter<byte>(*_composeSurface, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
} else if (_wm->_pixelformat.bytesPerPixel == 2) {
- drawMenuDelimiter<uint16>(_screen, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
+ drawMenuDelimiter<uint16>(*_composeSurface, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
} else {
- drawMenuDelimiter<uint32>(_screen, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
+ drawMenuDelimiter<uint32>(*_composeSurface, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
}
}
@@ -1296,16 +1296,16 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
if (_wm->_mode & kWMModalMenuMode) {
// TODO: Instead of cropping, reposition the submenu
int w = r->width() + 2;
- if (r->left + w >= _screen.w)
- w = _screen.w - 1 - r->left;
+ if (r->left + w >= _composeSurface->w)
+ w = _composeSurface->w - 1 - r->left;
int h = r->height() + 2;
- if (r->top + h >= _screen.h)
- h = _screen.h - 1 - r->top;
+ if (r->top + h >= _composeSurface->h)
+ h = _composeSurface->h - 1 - r->top;
Graphics::ManagedSurface g;
g.copyFrom(*_wm->_screenCopy);
- g.transBlitFrom(_screen, _wm->_colorGreen);
+ g.transBlitFrom(*_composeSurface, _wm->_colorGreen);
g_system->copyRectToScreen(g.getBasePtr(r->left, r->top), g.pitch, r->left, r->top, w, h);
}
}
@@ -1564,7 +1564,7 @@ void MacMenu::drawScrollArrow(int arrowX, int arrowY, int direction) {
int arrowHeight = getMenuFont()->getFontHeight() / 2;
for (int j = 0; j <= arrowHeight / 2; j++)
- _screen.hLine(arrowX - j, arrowY + j * direction, arrowX + j, _wm->_colorBlack);
+ _composeSurface->hLine(arrowX - j, arrowY + j * direction, arrowX + j, _wm->_colorBlack);
}
bool MacMenu::mouseMove(int x, int y) {
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 72b2e925281..d3d9532c569 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -184,7 +184,6 @@ public:
protected:
Common::Rect _bbox;
- ManagedSurface _screen;
ItemArray _items;
bool _isVisible;
bool _dimensionsDirty;
diff --git a/graphics/macgui/macpopupmenu.cpp b/graphics/macgui/macpopupmenu.cpp
index 0d95697a8b6..da886ea10cd 100644
--- a/graphics/macgui/macpopupmenu.cpp
+++ b/graphics/macgui/macpopupmenu.cpp
@@ -43,11 +43,11 @@ bool MacPopUp::draw(ManagedSurface *g, bool forceRedraw) {
return false;
_contentIsDirty = false;
- _screen.clear(_wm->_colorGreen);
+ _composeSurface->clear(_wm->_colorGreen);
renderSubmenu(_items[0]->submenu, false);
if (g)
- g->transBlitFrom(_screen, _wm->_colorGreen);
+ g->transBlitFrom(*_composeSurface, _wm->_colorGreen);
if (!(_wm->_mode & kWMModeNoSystemRedraw) && !(_wm->_mode & kWMModalMenuMode) && g)
g_system->copyRectToScreen(g->getPixels(), g->pitch, 0, 0, g->w, g->h);
@@ -133,7 +133,7 @@ uint32 MacPopUp::drawAndSelectMenu(int x, int y, int item) {
}
int itemsLeft = _items[0]->submenu->items.size() - _items[0]->submenu->visStart;
- int spaceLeft = _screen.h - MIN(_mouseY + _offsetY, _mouseY);
+ int spaceLeft = _composeSurface->h - MIN(_mouseY + _offsetY, _mouseY);
_items[0]->submenu->visEnd = MAX(0, itemsLeft - spaceLeft / _menuDropdownItemHeight);
}
Commit: 7cef1a07251cbabcf916558eee5af54872033413
https://github.com/scummvm/scummvm/commit/7cef1a07251cbabcf916558eee5af54872033413
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:12+02:00
Commit Message:
MACGUI: Allow MacMenu surface to be blitted without changes
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index d7db3b644b2..b4e309fd567 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -99,6 +99,7 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_bbox.bottom = kMenuHeight;
_dimensionsDirty = true;
+ _overlayDirty = false;
if (_wm->_mode & kWMModeWin95 && !(_wm->_mode & kWMModeForceMacFontsInWin95)) {
_menuDropdownItemHeight = kMenuWin95DropdownItemHeight;
@@ -1049,86 +1050,92 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
_contentIsDirty = false;
- _composeSurface->clear(_wm->_colorGreen);
+ if (_overlayDirty) {
+ // Signal that the menu surface has been drawn on by another process;
+ // update the screen without redrawing the menu content.
+ _overlayDirty = false;
+ } else {
+ _composeSurface->clear(_wm->_colorGreen);
- bool shouldUseDesktopArc = !(_wm->_mode & kWMModeWin95) || (_wm->_mode & kWMModeForceMacBorder);
+ bool shouldUseDesktopArc = !(_wm->_mode & kWMModeWin95) || (_wm->_mode & kWMModeForceMacBorder);
- // Fill in the corners with black
- _composeSurface->fillRect(r, _wm->_colorBlack);
- _composeSurface->drawRoundRect(r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite, true);
+ // Fill in the corners with black
+ _composeSurface->fillRect(r, _wm->_colorBlack);
+ _composeSurface->drawRoundRect(r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite, true);
- r.top = 7;
- _composeSurface->fillRect(r, _wm->_colorWhite);
- r.top = kMenuHeight - 1;
- r.bottom++;
- _composeSurface->fillRect(r, _wm->_colorGreen);
- r.bottom--;
- _composeSurface->fillRect(r, _wm->_colorBlack);
+ r.top = 7;
+ _composeSurface->fillRect(r, _wm->_colorWhite);
+ r.top = kMenuHeight - 1;
+ r.bottom++;
+ _composeSurface->fillRect(r, _wm->_colorGreen);
+ r.bottom--;
+ _composeSurface->fillRect(r, _wm->_colorBlack);
- for (uint i = 0; i < _items.size(); i++) {
- int color = _wm->_colorBlack;
- MacMenuItem *it = _items[i];
+ for (uint i = 0; i < _items.size(); i++) {
+ int color = _wm->_colorBlack;
+ MacMenuItem *it = _items[i];
- if ((uint)_activeItem == i) {
- Common::Rect hbox = it->bbox;
+ if ((uint)_activeItem == i) {
+ Common::Rect hbox = it->bbox;
- hbox.left -= 1;
- hbox.right += 3;
- hbox.bottom += 1;
+ hbox.left -= 1;
+ hbox.right += 3;
+ hbox.bottom += 1;
- if (_align == kTextAlignRight) {
- hbox.left -= 2;
- hbox.right -= 2;
- }
+ if (_align == kTextAlignRight) {
+ hbox.left -= 2;
+ hbox.right -= 2;
+ }
- _composeSurface->fillRect(hbox, _wm->_colorBlack);
- color = _wm->_colorWhite;
- }
+ _composeSurface->fillRect(hbox, _wm->_colorBlack);
+ color = _wm->_colorWhite;
+ }
- int y = it->bbox.top + (_wm->_fontMan->hasBuiltInFonts() ? 2 : 1);
- int x = _align == kTextAlignRight ? -kMenuLeftMargin : kMenuLeftMargin;
- x += it->bbox.left;
+ int y = it->bbox.top + (_wm->_fontMan->hasBuiltInFonts() ? 2 : 1);
+ int x = _align == kTextAlignRight ? -kMenuLeftMargin : kMenuLeftMargin;
+ x += it->bbox.left;
- ManagedSurface *s = _composeSurface;
- int tx = x, ty = y;
+ ManagedSurface *s = _composeSurface;
+ int tx = x, ty = y;
- if (!it->enabled) {
- s = &_tempSurface;
- tx = 0;
- ty = 0;
- _tempSurface.clear(_wm->_colorGreen);
- }
+ if (!it->enabled) {
+ s = &_tempSurface;
+ tx = 0;
+ ty = 0;
+ _tempSurface.clear(_wm->_colorGreen);
+ }
- if (it->unicode) {
- int accOff = _align == kTextAlignRight ? it->bbox.width() - _font->getStringWidth(it->unicodeText) : 0;
- Common::UnicodeBiDiText utxt(it->unicodeText);
+ if (it->unicode) {
+ int accOff = _align == kTextAlignRight ? it->bbox.width() - _font->getStringWidth(it->unicodeText) : 0;
+ Common::UnicodeBiDiText utxt(it->unicodeText);
- _font->drawString(s, utxt.visual, tx, ty, it->bbox.width(), color, _align, 0, true);
- underlineAccelerator(s, _font, utxt, tx + accOff, ty, it->shortcutPos, color);
- } else {
- const Font *font = nullptr;
- Common::String text = it->text;
+ _font->drawString(s, utxt.visual, tx, ty, it->bbox.width(), color, _align, 0, true);
+ underlineAccelerator(s, _font, utxt, tx + accOff, ty, it->shortcutPos, color);
+ } else {
+ const Font *font = nullptr;
+ Common::String text = it->text;
- if (text == "\xf0") {
- font = _wm->_fontMan->getFont(Graphics::MacFont(kMacFontSymbol, 12, 0));
+ if (text == "\xf0") {
+ font = _wm->_fontMan->getFont(Graphics::MacFont(kMacFontSymbol, 12, 0));
- if (_wm->_fontMan->hasBuiltInFonts()) // Replace with (c) symbol if we have built-in fonts
- text = "\xa9";
+ if (_wm->_fontMan->hasBuiltInFonts()) // Replace with (c) symbol if we have built-in fonts
+ text = "\xa9";
- } else {
- font = getMenuFont(it->style);
- }
+ } else {
+ font = getMenuFont(it->style);
+ }
- font->drawString(s, text, tx, ty, it->bbox.width(), color, Graphics::kTextAlignLeft, 0, true);
- }
+ font->drawString(s, text, tx, ty, it->bbox.width(), color, Graphics::kTextAlignLeft, 0, true);
+ }
- if (!it->enabled) {
- if (_wm->_pixelformat.bytesPerPixel == 1) {
- drawMenuPattern<byte>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
- } else if (_wm->_pixelformat.bytesPerPixel == 2) {
- drawMenuPattern<uint16>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
- } else {
- drawMenuPattern<uint32>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ if (!it->enabled) {
+ if (_wm->_pixelformat.bytesPerPixel == 1) {
+ drawMenuPattern<byte>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ } else if (_wm->_pixelformat.bytesPerPixel == 2) {
+ drawMenuPattern<uint16>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ } else {
+ drawMenuPattern<uint32>(_tempSurface, *_composeSurface, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, it->bbox.width(), _wm->_colorGreen);
+ }
}
}
}
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index d3d9532c569..c2c75080f9c 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -180,6 +180,8 @@ public:
int getDropdownItemHeight() { return _menuDropdownItemHeight; }
+ void setOverlayDirty(bool dirty) { _overlayDirty = dirty; _contentIsDirty |= dirty; }
+
Common::Array<MacMenuSubMenu *> _menustack;
protected:
@@ -187,6 +189,7 @@ protected:
ItemArray _items;
bool _isVisible;
bool _dimensionsDirty;
+ bool _overlayDirty;
int _menuDropdownItemHeight;
int _activeItem;
Commit: 851843aef6a2e2af02d8c222459049e33ed9f100
https://github.com/scummvm/scummvm/commit/851843aef6a2e2af02d8c222459049e33ed9f100
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:12+02:00
Commit Message:
FOOL: Enable menu bar prompt messages
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_prologue.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index d77ada36b7c..0831bd1496b 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -206,6 +206,7 @@ void FoolGame::sub_128_004() {
g_zbasic->unk_4();
g_toolbox->SetPort(this->var_i32_8);
this->fillRect(0, 0, 0x14, this->var_i16_5a, 2);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -1103,6 +1104,7 @@ void FoolGame::sub_128_2664() {
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xf);
g_toolbox->DrawString(this->var_str_172);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -2343,6 +2345,7 @@ void FoolGame::sub_128_5fea() {
g_toolbox->SetRect(this->arr_rect_5b7c, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
g_toolbox->PenPat(this->arr_pat_58f4[2]);
g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
}
// 128:6152
@@ -2888,6 +2891,7 @@ void FoolGame::sub_129_123a() {
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xe);
g_toolbox->DrawString(this->var_str_172);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
g_toolbox->Delay(0);
}
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 6038726892d..629c368adab 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -511,8 +511,12 @@ void FoolPrologue::sub_129_004() {
}
// 129:00ee
+ // used for drawing on the menu bar
this->var_i32_c = &this->arr_grafport_a8a;
g_toolbox->OpenPort(this->var_i32_c);
+ this->var_i32_c->portBits = g_toolbox->_defaultMenuBits;
+ this->var_i32_c->portRect = g_toolbox->_defaultMenuBits->getBounds();
+
this->var_i32_8 = &this->arr_grafport_9c0;
g_toolbox->OpenPort(this->var_i32_8);
@@ -804,6 +808,7 @@ void FoolPrologue::prologueRun() {
} else {
g_toolbox->SetPort(this->var_i32_c);
this->fillRect(2, 0, 0, 0x14, this->var_i16_10);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
}
@@ -1123,6 +1128,7 @@ void FoolPrologue::prologueDrawLoadingMsg() {
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
this->fillRect(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
this->drawTextCenterAlign(0xe, this->var_i16_10/2);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
g_toolbox->Delay(0);
}
@@ -1261,6 +1267,7 @@ void FoolPrologue::sub_131_004() {
} else {
g_toolbox->SetPort(this->var_i32_c);
this->fillRect(0x2, 0, 0, 0x14, this->var_i16_10);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
}
// 131:02ec
@@ -1701,6 +1708,7 @@ void FoolPrologue::sub_131_4dc0() {
this->fillRect(0, 0, 7, 0x13, this->var_i16_10 - 7);
this->drawTextCenterAlign(this->var_i16_10 / 2, 0xe);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
}
Commit: 02b011d576e1dbb50c510513d575d6476e621eb3
https://github.com/scummvm/scummvm/commit/02b011d576e1dbb50c510513d575d6476e621eb3
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:13+02:00
Commit Message:
FOOL: Fix serialization bug
Changed paths:
engines/fool/zbasic.cpp
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 8476f3f579c..d29f7628336 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -648,10 +648,14 @@ void ZBasic::writeFileDblInt(int16 fileNo, int32 data) {
}
Common::U32String ZBasic::unk_88(uint16 unk1) {
- Common::U32String result;
- result.push_back(unk1 >> 8);
- result.push_back(unk1 & 0xff);
- return result;
+ // convert uint16 data into string bytes.
+ // all of the toolbox APIs use U32String and convert when
+ // necessary to MacRoman, and unfortunately that's what
+ // we have to do there too.
+ Common::String inter;
+ inter.push_back((char)(unk1 >> 8));
+ inter.push_back((char)(unk1 & 0xff));
+ return inter.decode(Common::kMacRoman);
}
void ZBasic::unk_130(int16 unk1) {
@@ -663,13 +667,14 @@ void ZBasic::unk_158() {
}
uint16 ZBasic::unk_310(const Common::U32String &unk1) {
+ Common::String inter = unk1.encode(Common::kMacRoman);
uint16 result = 0;
- if (unk1.size() == 0)
+ if (inter.size() == 0)
return result;
- result |= unk1[0] << 8;
- if (unk1.size() == 1)
+ result |= (byte)(inter[0]) << 8;
+ if (inter.size() == 1)
return result;
- result |= unk1[1];
+ result |= (byte)(inter[1]);
return result;
}
Commit: fcfe7303dc397548b97c4e414b2f2a2bd04e697f
https://github.com/scummvm/scummvm/commit/fcfe7303dc397548b97c4e414b2f2a2bd04e697f
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:13+02:00
Commit Message:
FOOL: Refactoring
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/toolbox_text.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index a05f0c6f0e2..5caa18fef6f 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -105,18 +105,18 @@ void FoolGame::cardsRun() {
this->arr_rect_4338.bottom = 0xee;
this->arr_rect_4338.right = 0x11e;
this->var_i16_2012 = 0;
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
this->cardsDrawScores();
if (this->var_i16_2010 == 0) {
this->cardsShuffleDeck();
}
// 139:0456
this->sub_139_582();
- while ((this->var_i16_7c6 & 1) == 0) {
+ while ((this->stateFlags & 1) == 0) {
// 139:045e
this->var_i16_2014 = 0;
- this->var_i16_7c6 = 0;
- while (this->var_i16_7c6 == 0) {
+ this->stateFlags = 0;
+ while (this->stateFlags == 0) {
// 139:046e
this->sub_128_c6a(-1);
if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
@@ -130,10 +130,10 @@ void FoolGame::cardsRun() {
}
}
// 139:04a4
- if (this->var_i16_7c6 == 2) {
+ if (this->stateFlags == 2) {
this->sub_139_4de();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->cardsStoreState();
this->sub_128_3536();
}
@@ -280,13 +280,13 @@ void FoolGame::cardsOnClick() {
g_zbasic->text(0xfc, 9, Graphics::kMacFontRegular, kSrcBic);
this->sub_128_918(g_zbasic->str(282)); // (click mouse to continue)
this->var_i16_2014 = 0;
- this->var_i16_7c6 = 0;
- while ((this->var_i16_7c6 == 0) && (this->var_i16_2014 == 0)) {
+ this->stateFlags = 0;
+ while ((this->stateFlags == 0) && (this->var_i16_2014 == 0)) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseUp) {
this->var_i16_2014 = 1;
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->cardsStoreState();
this->sub_128_3536();
}
@@ -295,8 +295,8 @@ void FoolGame::cardsOnClick() {
}
}
// 139:09d8
- if (((this->var_i16_7c6 & 1) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->var_i16_7c6 = 2;
+ if (((this->stateFlags & 1) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
+ this->stateFlags = 2;
this->var_i16_2014 = 0;
}
}
@@ -702,7 +702,7 @@ void FoolGame::cardsStoreState() {
void FoolGame::sub_139_1d3e() {
// 139:1d3e
- this->var_i16_7c6 = 1;
+ this->stateFlags = 1;
if (this->var_i16_c04 >= 0x64) {
this->var_i16_c04 = 0x64;
}
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index ae4c3903d1e..1cd07b9d02a 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -63,13 +63,13 @@ void FoolGame::deathRun() {
return;
}
// 141:0200
- if (this->var_i16_7c6 == 2) {
- this->var_i16_7c6 = 0;
+ if (this->stateFlags == 2) {
+ this->stateFlags = 0;
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_128_3536();
}
- if ((this->var_i16_7c6 & 1)) {
+ if ((this->stateFlags & 1)) {
// 141:09f6
this->deathDrawWhiteEye();
return;
@@ -87,10 +87,10 @@ void FoolGame::deathRun() {
// 141:0282
this->deathMoveBlackEye();
this->sub_128_c6a(-1);
- if (this->var_i16_7c6 == 2) {
- this->var_i16_7c6 = 0;
+ if (this->stateFlags == 2) {
+ this->stateFlags = 0;
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_128_3536();
}
if (this->var_ev_46.what == kNullEvent)
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 0831bd1496b..b5f9e4a2702 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -111,7 +111,7 @@ void FoolGame::sub_128_004() {
this->sub_129_068();
this->var_i32_7c8 = g_zbasic->mem(-1);
// 128:1c88: JMP - [0x1ee2]
- while (this->var_i16_7c6 != 0x20) {
+ while (this->stateFlags != kStateQuit) {
do {
this->sub_128_c6a(-1);
if (_quit)
@@ -166,36 +166,36 @@ void FoolGame::sub_128_004() {
this->sub_128_1c2c(0x100);
}
// 128:1e06
- } while (this->var_i16_7c6 == 0);
+ } while (this->stateFlags == 0);
- if (this->var_i16_7c6 & 0x1) {
+ if (this->stateFlags & kStateReturn) {
this->sub_128_1c4a(1);
}
- if (this->var_i16_7c6 & 0x4) {
+ if (this->stateFlags & 0x4) {
this->sub_128_3536();
}
- if (this->var_i16_7c6 & 0x8) {
+ if (this->stateFlags & 0x8) {
this->sub_128_2bc6();
}
- if (this->var_i16_7c6 & 0x10) {
+ if (this->stateFlags & 0x10) {
this->sub_128_2e3e();
}
- if (this->var_i16_7c6 & 0x40) {
+ if (this->stateFlags & 0x40) {
this->menuChapterSelect();
}
- if (this->var_i16_7c6 & 0x200) {
+ if (this->stateFlags & 0x200) {
this->sub_128_1f44();
}
- if (this->var_i16_7c6 & 0x80) {
+ if (this->stateFlags & 0x80) {
this->sub_128_39a0();
}
- if (this->var_i16_7c6 & 0x100) {
+ if (this->stateFlags & 0x100) {
this->sub_138_004();
}
- if (this->var_i16_7c6 & 0x400) {
+ if (this->stateFlags & 0x400) {
this->sub_128_2b0a();
}
- if (this->var_i16_7c6 & 0x800) {
+ if (this->stateFlags & 0x800) {
this->sub_144_004();
}
// 128:1ee2
@@ -539,7 +539,7 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16
this->sub_128_4472();
}
-void FoolGame::sub_128_c6a(int16 unk1) {
+void FoolGame::sub_128_c6a(uint16 unk1) {
// 128:0c6a
// This function is usually called at the start of an event processing loop,
@@ -554,14 +554,16 @@ void FoolGame::sub_128_c6a(int16 unk1) {
// 128:0caa
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kKeyDown) {
- if ((this->var_ev_46.modifiers & kModCommandKeyDown) == 0) {
+ // the original just checked the command key,
+ // non-mac PCs expect the control key to work
+ if ((this->var_ev_46.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0) {
this->sub_128_5f9e();
} else {
this->sub_128_5baa();
}
}
// 128:0ce0
- if ((this->var_ev_46.what == kAutoKey) && ((this->var_ev_46.modifiers & kModCommandKeyDown) == 0)) {
+ if ((this->var_ev_46.what == kAutoKey) && ((this->var_ev_46.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0)) {
this->sub_128_5f9e();
}
if (this->var_ev_46.what == kUpdateEvt) {
@@ -589,9 +591,17 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
g_toolbox->InvertRect(this->arr_rect_5b7c);
this->var_i16_3a = 0;
do {
- this->sub_128_c6a(0);
- this->var_i16_3a += 1;
- } while (!((unk1 == this->var_i16_3a) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
+ // originally this used sub_128_c6a, but we avoid that here
+ // so that menu events don't get intercepted.
+ // originally this mask was 0, but we change it here to
+ // intercept all events, and fall back to NullEvent +
+ // wait for vsync if no events were received.
+ this->var_i16_78a = g_toolbox->GetNextEvent(-1, this->var_ev_46);
+ if (this->var_ev_46.what == kNullEvent) {
+ g_toolbox->Delay(1);
+ this->var_i16_3a += 1;
+ }
+ } while (!((this->var_i16_3a >= (unk1*60/1000)) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0);
}
}
@@ -880,14 +890,14 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
void FoolGame::sub_128_1c2c(int16 unk1) {
this->var_i16_30 = unk1;
- this->var_i16_7c6 |= this->var_i16_30;
+ this->stateFlags |= this->var_i16_30;
}
void FoolGame::sub_128_1c4a(int16 unk1) {
// 128:1c4a
this->var_i16_30 = unk1;
- if (this->var_i16_7c6 & this->var_i16_30) {
- this->var_i16_7c6 ^= this->var_i16_30;
+ if (this->stateFlags & this->var_i16_30) {
+ this->stateFlags ^= this->var_i16_30;
}
// 128:1c78
}
@@ -1143,7 +1153,7 @@ void FoolGame::sub_128_27d6() {
if (this->var_i16_7be == 3)
return;
if (this->var_i16_7ce & 1) {
- this->sub_128_1c2c(9);
+ this->sub_128_1c2c(8 | kStateReturn);
} else {
this->sub_128_1c2c(8);
}
@@ -1255,9 +1265,9 @@ void FoolGame::sub_128_2ab6() {
return;
}
if ((this->var_i16_7ce & 1) != 0) {
- this->sub_128_1c2c(0x21);
+ this->sub_128_1c2c(kStateQuit | kStateReturn);
} else {
- this->sub_128_1c2c(0x20);
+ this->sub_128_1c2c(kStateQuit);
}
}
@@ -1265,15 +1275,18 @@ void FoolGame::sub_128_2ab6() {
void FoolGame::sub_128_2ae8() {
// 128:2ae8
if (this->var_i16_7ce & 1) {
- this->var_i16_7c6 = 0x401;
+ this->stateFlags = 0x401;
} else {
- this->var_i16_7c6 = 0x400;
+ this->stateFlags = 0x400;
}
}
void FoolGame::sub_128_2b0a() {
+ // 128:2b0a
+ this->stateFlags = 0;
+ // printing the story
warning("STUB: %s", __func__);
}
@@ -1399,7 +1412,7 @@ void FoolGame::sub_128_2e3e() {
void FoolGame::sub_128_3032() {
this->var_i16_7d0 = 0;
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
this->var_i16_484 = 0;
this->var_i16_68c = 3;
// render chapter menu headings
@@ -1559,7 +1572,7 @@ void FoolGame::sub_128_3536() {
// 128:372a
// 128:372a: LEA - [0x3818],A0
// 128:372e: MOVE.L - A0,-0x8ee(A5)
- if (this->var_i16_7c6 == 0) {
+ if (this->stateFlags == 0) {
this->sub_128_37ce();
g_toolbox->InitCursor();
}
@@ -1620,7 +1633,7 @@ void FoolGame::sub_128_388a() {
void FoolGame::sub_128_39a0() {
// 128:39a0
this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
this->var_i16_c00 = 0;
this->var_i16_7d6 = 0;
this->var_i16_7b2 = 0xa;
@@ -1704,7 +1717,7 @@ void FoolGame::sub_128_39a0() {
}
// 128:3aa4
this->sub_128_41aa();
- if ((this->var_i16_7c6 & 0x20) == 0) {
+ if ((this->stateFlags & kStateQuit) == 0) {
g_toolbox->PenNormal();
this->sub_128_0a2(1, 0);
this->var_menu_bf8 = g_toolbox->GetMHandle(8);
@@ -1767,11 +1780,11 @@ void FoolGame::sub_128_39a0() {
this->var_i16_c02 = 0;
this->var_i16_c00 = 0;
g_toolbox->SetPort(this->var_i32_0);
- if ((this->var_i16_7c6 & 0x38) == 0) {
+ if ((this->stateFlags & 0x38) == 0) {
if ((this->var_i16_7ce & 1) == 0) {
this->var_i16_7ce ^= 1;
}
- if ((this->var_i16_7c6 & 0x40) == 0) {
+ if ((this->stateFlags & 0x40) == 0) {
this->storyRenderPage();
}
}
@@ -1850,12 +1863,22 @@ void FoolGame::sub_128_4168() {
this->var_i16_c04 = 0x65;
}
this->var_str_c06 = g_zbasic->index(2, this->var_i16_7e2);
+ if (debugChannelSet(5, kDebugLoading)) {
+ Common::String inter = this->var_str_c06.encode(Common::kMacRoman);
+ debugC(5, kDebugLoading, "sub_128_4168: loading puzzle %d context, state %d", this->var_i16_7e2, this->var_i16_c04);
+ Common::hexdump((const byte *)inter.c_str(), inter.size());
+ }
}
void FoolGame::sub_128_41aa() {
// 128:41aa
this->arr_i16_1c5a[this->var_i16_7e2] = this->var_i16_c04;
g_zbasic->indexSet(this->var_str_c06, 2, this->var_i16_7e2);
+ if (debugChannelSet(5, kDebugLoading)) {
+ Common::String inter = this->var_str_c06.encode(Common::kMacRoman);
+ debugC(5, kDebugLoading, "sub_128_41aa: saving puzzle %d context, state %d", this->var_i16_7e2, this->var_i16_c04);
+ Common::hexdump((const byte *)inter.c_str(), inter.size());
+ }
}
void FoolGame::sub_128_41d8() {
@@ -2211,7 +2234,7 @@ void FoolGame::sub_128_5baa() {
}
void FoolGame::sub_128_5c20() {
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
if (this->selectedMenuID == 1) { // Eye menu
this->sub_128_4a92();
}
@@ -2272,18 +2295,18 @@ void FoolGame::sub_128_5c20() {
}
// 128:5e38
if (((this->var_i16_7ce & 1) != 0) && (this->var_i16_e1a == 0)) {
- this->sub_128_1c2c(0x41);
+ this->sub_128_1c2c(0x40 | kStateReturn);
}
// 128:5e5e
if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
- this->sub_128_1c2c(0x41);
+ this->sub_128_1c2c(0x40 | kStateReturn);
this->var_i16_7ce |= 0x4;
}
}
// 128:5eaa
if (this->selectedMenuID == 8) { // Puzzle menu
if (this->selectedMenuItem == 1) {
- this->sub_128_1c2c(1);
+ this->sub_128_1c2c(kStateReturn);
}
// 128:5ec6
if ((this->selectedMenuItem == 3) && (this->var_i16_c00 == 1)) {
@@ -2301,7 +2324,7 @@ void FoolGame::sub_128_5ef0() {
void FoolGame::sub_128_5f16() {
// 128:5f16
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
@@ -2309,7 +2332,7 @@ void FoolGame::sub_128_5f16() {
this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
}
// 128:5f70
- if ((this->var_i16_7c6 & 1) != 0) {
+ if ((this->stateFlags & 1) != 0) {
this->sub_128_6186();
this->sub_128_0a2(1, 0x2af8);
}
@@ -2365,22 +2388,24 @@ void FoolGame::sub_128_6186() {
// 128:6186
// wait until mouse button is up
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(6, this->var_ev_46);
+ // was originally a mask of 6
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
+ g_toolbox->Delay(1);
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
}
void FoolGame::sub_128_61c2() {
// 128:61c2
+ this->sub_128_6186();
do {
- this->sub_128_6186();
- this->var_i16_7a8 = g_toolbox->GetNextEvent(2, this->var_ev_46);
+ // was originally a mask of 2
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
- } while ((this->var_ev_46.what != 1));
+ g_toolbox->Delay(1);
+ } while ((this->var_ev_46.what != kMouseDown));
this->sub_128_6186();
}
@@ -2869,10 +2894,10 @@ void FoolGame::sub_129_068() {
// 129:11f6
if (g_zbasic->str(157) == this->var_str_8ec) { // empty
// cold start
- this->var_i16_7c6 = 8;
+ this->stateFlags = 8;
} else {
// loading a save game
- this->var_i16_7c6 = 0x10;
+ this->stateFlags = 0x10;
this->var_str_588 = this->var_str_8ec;
this->var_i16_688 = this->var_i16_9ec;
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 974f9da9dc1..310af52da9a 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -30,6 +30,13 @@
namespace Fool {
+enum FoolStateFlag : uint16 {
+ kStateNull = 0x00,
+ kStateReturn = 0x01,
+ kStateUndo = 0x02,
+ kStateQuit = 0x20,
+};
+
class FoolGame {
public:
FoolGame() {}
@@ -60,7 +67,7 @@ public:
void sub_128_918(const Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
- void sub_128_c6a(int16 unk1);
+ void sub_128_c6a(uint16 unk1);
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
@@ -309,7 +316,7 @@ private:
int16 var_i16_7be;
int16 keyLastPressed; // var_i16_7c0
PicHandle var_pic_7c2;
- int16 var_i16_7c6;
+ uint16 stateFlags; // var_i16_7c6
uint32 var_i32_7c8;
int16 var_i16_7cc;
int16 var_i16_7ce;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 821d75366f5..433eedcc211 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -110,7 +110,7 @@ void FoolGame::jigsawRun() {
}
}
// 132:0464
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->jigsawCheckIfSolved();
@@ -118,10 +118,10 @@ void FoolGame::jigsawRun() {
// 132:04d8
// input loop
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
+ while (((this->stateFlags & 1) == 0) && (this->var_i16_d0c == 0)) {
// 132:0484
// 132:049c
- while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
+ while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
// 132:0488
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseDown) {
@@ -129,10 +129,10 @@ void FoolGame::jigsawRun() {
}
}
// 132:04b8
- if (this->var_i16_7c6 == 2) {
+ if (this->stateFlags == 2) {
this->jigsawCancelSelect();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->jigsawStoreState();
this->sub_128_3536();
}
@@ -284,7 +284,7 @@ void FoolGame::jigsawMoveSelected() {
void FoolGame::jigsawCancelSelect() {
// 132:0e5a
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
@@ -397,7 +397,7 @@ void FoolGame::jigsawCheckIfSolved() {
}
// 132:1430
if (this->var_i16_d0c != 0) {
- this->var_i16_7c6 = 1;
+ this->stateFlags = 1;
}
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 53ec97c4ac6..53c0d42ad36 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -288,7 +288,7 @@ void FoolGame::jumbleRun() {
default:
break;
}
- if ((this->var_i16_7c6 & 1) != 0) {
+ if ((this->stateFlags & 1) != 0) {
this->sub_130_c66();
this->jumbleCurrentSubPuzzle = this->jumbleSubPuzzleCount;
} else {
@@ -317,7 +317,7 @@ void FoolGame::jumbleRun() {
}
// 130:0a5c
}
- if ((this->var_i16_7c6 & 1) != 0) {
+ if ((this->stateFlags & 1) != 0) {
// JMP 0x2962
return;
}
@@ -332,21 +332,28 @@ void FoolGame::jumbleRun() {
while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0) {
// 130:0aa0
if (this->arr_i16_4338[0] > 0) {
+ // strobe the squares in the victory list
if (this->arr_i16_4338[0] == 1) {
- this->var_i16_7e4 = 0x64;
+ // originally was 0x64, lock to 200ms
+ this->var_i16_7e4 = 0xc8;
} else {
- this->var_i16_7e4 = 0xd;
+ // originally was 0xd, lock to 2 frames
+ this->var_i16_7e4 = 0x22;
}
this->var_i16_68a = 0;
do {
- g_toolbox->Delay(this->var_i16_7e4*60/1000);
+ int ticks = (int)g_toolbox->TickCount();
this->var_i16_68a++;
g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
- this->sub_128_c6a(0);
+ // mask was originally 0
+ this->sub_128_c6a(-1);
+ int delta = MAX(0, this->var_i16_7e4*60/1000 - ((int)g_toolbox->TickCount() - ticks));
+ g_toolbox->Delay(delta);
} while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
} else {
// 130:0b62
- this->sub_128_c6a(0);
+ // mask was originally 0
+ this->sub_128_c6a(-1);
}
}
// 130:0b7a
@@ -380,7 +387,7 @@ void FoolGame::sub_130_c56() {
// 130:0c56
this->sub_130_c66();
this->sub_128_3536();
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
}
void FoolGame::sub_130_c66() {
@@ -414,13 +421,13 @@ void FoolGame::sub_130_d2e() {
// 130:0d2e
this->sub_130_1426();
this->sub_128_61ec();
- this->var_i16_7c6 = 0;
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ this->stateFlags = 0;
+ while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_130_c56();
}
}
@@ -466,10 +473,10 @@ void FoolGame::sub_130_d90() {
this->var_i16_106e = 1;
this->sub_130_1c1a();
this->sub_128_61ec();
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
this->keyLastPressed = 0;
// 130:0fa0
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:0fa4
this->sub_128_c6a(-1);
if (this->keyLastPressed != 0) {
@@ -478,7 +485,7 @@ void FoolGame::sub_130_d90() {
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_130_c56();
}
}
@@ -494,10 +501,10 @@ void FoolGame::sub_130_1004() {
}
this->sub_130_20d2();
this->sub_128_61ec();
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
this->keyLastPressed = 0;
// 130:1042
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->sub_128_c6a(-1);
if (this->keyLastPressed != 0) {
this->sub_130_15da();
@@ -505,7 +512,7 @@ void FoolGame::sub_130_1004() {
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_130_c56();
}
}
@@ -526,14 +533,14 @@ void FoolGame::sub_130_10a6() {
}
// 130:1212
this->sub_128_61ec();
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
// 130:121c
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
+ while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_130_c56();
}
}
@@ -548,10 +555,10 @@ void FoolGame::sub_130_1282() {
this->sub_130_20d2();
this->sub_128_61ec();
this->var_i16_7b2 = 0;
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
this->keyLastPressed = 0;
g_toolbox->InitCursor();
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:12cc
this->sub_128_c6a(-1);
if (this->keyLastPressed != 0) {
@@ -578,7 +585,7 @@ void FoolGame::sub_130_1282() {
}
// 130:13e2
this->var_i16_7b2 = this->var_i16_187c;
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_130_c56();
}
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 0c383372da5..146cc4e961e 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -176,7 +176,7 @@ void FoolGame::polyominoRun() {
// picture handle 1:
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
g_toolbox->FillPoly(this->var_poly_1aac, this->arr_pat_58f4[this->arr_i16_1eb8[0x1a]]);
- g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xd]]);
+ g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xf]]);
g_toolbox->FramePoly(this->var_poly_1aac);
// 133:0582
if (this->var_i16_103a >= 3) {
@@ -227,7 +227,7 @@ void FoolGame::polyominoRun() {
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
this->polyominoCheckIfSolved();
- this->var_i16_7c6 = 0;
+ this->stateFlags = kStateNull;
do {
do {
this->sub_128_c6a(-1);
@@ -239,16 +239,16 @@ void FoolGame::polyominoRun() {
g_toolbox->Delay(1);
}
// 133:0800
- } while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0));
+ } while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0));
// 133:081c
- if (this->var_i16_7c6 == 2) {
+ if (this->stateFlags == kStateUndo) {
this->polyominoReset();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->polyominoStoreState();
this->sub_128_3536();
}
- } while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0));
+ } while (((this->stateFlags & 1) == 0) && (this->var_i16_d0c == 0));
// 133:0864
if (this->var_i16_d0c != 0) {
this->polyominoSuccess();
@@ -474,7 +474,7 @@ void FoolGame::polyominoReset() {
// 133:12c2
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
}
void FoolGame::polyominoDrawFrame() {
@@ -508,7 +508,7 @@ void FoolGame::polyominoCheckIfSolved() {
}
// 133:13ce
if (this->var_i16_d0c != 0) {
- this->var_i16_7c6 = 1;
+ this->stateFlags = kStateReturn;
}
}
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 7eb9361ffd2..d909ce96fdd 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -81,7 +81,7 @@ void FoolGame::revealRun() {
this->arr_i16_1eb8[19] = g_zbasic->unk_310(this->var_str_c06);
this->var_i16_1aba = this->arr_i16_1eb8[18];
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
- for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
this->sub_128_50e(
g_zbasic->rndInt(0x3e8) + 0x19,
@@ -89,30 +89,30 @@ void FoolGame::revealRun() {
1
);
// 134:0352
- this->arr_rect_1f38[i].top = 0x10f;
- this->arr_rect_1f38[i].left = this->var_i16_1aba;
- this->arr_rect_1f38[i].bottom = 0x137;
- this->arr_rect_1f38[i].right = this->var_i16_1aba + this->arr_i16_1eb8[17];
+ this->arr_rect_1f38[this->var_i16_7be].top = 0x10f;
+ this->arr_rect_1f38[this->var_i16_7be].left = this->var_i16_1aba;
+ this->arr_rect_1f38[this->var_i16_7be].bottom = 0x137;
+ this->arr_rect_1f38[this->var_i16_7be].right = this->var_i16_1aba + this->arr_i16_1eb8[17];
this->var_i16_1aba += this->arr_i16_1eb8[17];
// 134:03fc
- g_toolbox->FillRoundRect(this->arr_rect_1f38[i], 0x19, 0x19, this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[i], 0x19, 0x19);
+ g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19, this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19);
// 134:0448
- this->var_str_384 = g_zbasic->midStr(this->var_str_1272, i, 1);
+ this->var_str_384 = g_zbasic->midStr(this->var_str_1272, this->var_i16_7be, 1);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(
- this->arr_rect_1f38[i].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
+ this->arr_rect_1f38[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
0x127
);
g_toolbox->DrawString(this->var_str_384);
// 134:04d6
- if (this->arr_i16_1eb8[19] & this->bitLUT[this->arr_i16_3738[i] - 1]) {
+ if (this->arr_i16_1eb8[19] & this->bitLUT[this->arr_i16_3738[this->var_i16_7be] - 1]) {
this->revealSelectButton();
}
}
// 134:0538
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
this->var_i16_d0c = 1;
} else {
@@ -123,9 +123,9 @@ void FoolGame::revealRun() {
// 134:057a
// 134:057a: JMP - [0x61e]
// main event loop
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
+ while (((this->stateFlags & 1) == 0) && (this->var_i16_d0c == 0)) {
// 134:057e
- while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
+ while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
// 134:0582
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseDown) {
@@ -140,10 +140,10 @@ void FoolGame::revealRun() {
}
}
// 134:05e2
- if (this->var_i16_7c6 == 2) {
+ if (this->stateFlags == 2) {
this->revealReset();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
this->sub_128_3536();
}
@@ -201,7 +201,7 @@ void FoolGame::revealReset() {
}
// 134:085c
this->arr_i16_1eb8[19] = 0;
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
}
void FoolGame::revealSuccess() {
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 578a4e9d9e3..07452a78b6e 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -81,12 +81,12 @@ void FoolGame::sunMapRun() {
g_zbasic->picture(this->arr_rect_1f38[i].left, this->arr_rect_1f38[i].top, this->arr_i32_192c0[this->arr_i16_4bd8[i]]);
}
// 137:0336
- this->var_i16_7c6 = 0;
+ this->stateFlags = kStateNull;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->sunMapCheckIfSolved();
- while (((this->var_i16_7c6 & 1) == 0) && (this->var_i16_d0c == 0)) {
- while ((this->var_i16_7c6 == 0) && (this->var_i16_d0c == 0)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0)) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseDown) {
this->sunMapOnClick();
@@ -95,10 +95,10 @@ void FoolGame::sunMapRun() {
g_toolbox->Delay(0);
}
// 137:038a
- if (this->var_i16_7c6 == 2) {
+ if (this->stateFlags == 2) {
this->sunMapUndoMove();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->sub_128_3536();
}
}
@@ -255,7 +255,7 @@ void FoolGame::sunMapMoveSelected() {
void FoolGame::sunMapUndoMove() {
// 137:0d60
- this->var_i16_7c6 = 0;
+ this->stateFlags = 0;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
@@ -336,7 +336,7 @@ void FoolGame::sunMapCheckIfSolved() {
}
// 137:1306
if (this->var_i16_d0c != 0) {
- this->var_i16_7c6 = 1;
+ this->stateFlags = kStateReturn;
}
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 7ad11de051f..ca90c56167d 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -194,8 +194,8 @@ void FoolGame::wordSearchRun() {
g_zbasic->menu(8, 4, 1, g_zbasic->str(201));
}
// 131:084c
- this->var_i16_7c6 = 0;
- while ((this->var_i16_7c6 & 1) == 0) {
+ this->stateFlags = kStateNull;
+ while ((this->stateFlags & kStateReturn) == 0) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
this->wordSearchOnClick();
@@ -203,7 +203,7 @@ void FoolGame::wordSearchRun() {
if (this->var_i16_1990 == this->var_i16_198e) {
this->wordSearchSuccess();
}
- if (this->var_i16_7c6 == 4) {
+ if (this->stateFlags == 4) {
this->wordSearchStoreState();
this->sub_128_3536();
}
@@ -397,7 +397,7 @@ void FoolGame::wordSearchSuccess() {
this->fillRect(0x1eb, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
this->sub_128_2664();
this->sub_128_61c2();
- this->var_i16_7c6 = 1;
+ this->stateFlags = kStateReturn;
}
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index 7b176321506..aec09ad2f08 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -37,7 +37,7 @@ void Toolbox::DrawChar(Common::u32char_type_t ch) {
void Toolbox::DrawString(const Common::U32String &s) {
if (_port) {
Common::String macString = s.encode(Common::kMacRoman);
- debugN(5, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
+ debugC(5, kDebugGraphics, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
const Graphics::Font *font = fontRun.getFont();
Common::Rect bbox = font->getBoundingBox(macString);
@@ -80,7 +80,7 @@ uint16 Toolbox::StringWidth(const Common::U32String &s) {
Common::String macString = s.encode(Common::kMacRoman);
Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
uint16 result = fontRun.getFont()->getStringWidth(macString);
- debug(5, "Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
+ debugC(5, kDebugGraphics, "Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
return result;
}
return 0;
Commit: cb083c21dcf32ceaeb910f1923b2e1b52a0c5d60
https://github.com/scummvm/scummvm/commit/cb083c21dcf32ceaeb910f1923b2e1b52a0c5d60
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:13+02:00
Commit Message:
MACGUI: Add MacMenu::getMenuShortCut
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index b4e309fd567..1c2015f8be8 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1666,25 +1666,37 @@ bool MacMenu::mouseRelease(int x, int y) {
return true;
}
-bool MacMenu::processMenuShortCut(uint16 ascii) {
- ascii = tolower(ascii);
-
+void MacMenu::getMenuShortCut(uint16 key, int &menuItem, int &submenuItem) {
+ menuItem = -1;
+ submenuItem = -1;
+ uint16 ascii = tolower(key);
for (uint i = 0; i < _items.size(); i++) {
if (_items[i]->enabled && _items[i]->submenu != nullptr) {
for (uint j = 0; j < _items[i]->submenu->items.size(); j++) {
if (_items[i]->submenu->items[j]->enabled && tolower(_items[i]->submenu->items[j]->shortcut) == ascii) {
- if (_items[i]->submenu->items[j]->unicode) {
- if (checkCallback(true))
- (*_unicodeccallback)(_items[i]->submenu->items[j]->action, _items[i]->submenu->items[j]->unicodeText, _cdata);
- } else {
- if (checkCallback())
- (*_ccallback)(_items[i]->submenu->items[j]->action, _items[i]->submenu->items[j]->text, _cdata);
- }
- return true;
+ menuItem = (int)i;
+ submenuItem = (int)j;
}
}
}
}
+}
+
+bool MacMenu::processMenuShortCut(uint16 ascii) {
+ int menuItem;
+ int submenuItem;
+ getMenuShortCut(ascii, menuItem, submenuItem);
+
+ if ((menuItem >= 0) && (submenuItem >= 0)) {
+ if (_items[menuItem]->submenu->items[submenuItem]->unicode) {
+ if (checkCallback(true))
+ (*_unicodeccallback)(_items[menuItem]->submenu->items[submenuItem]->action, _items[menuItem]->submenu->items[submenuItem]->unicodeText, _cdata);
+ } else {
+ if (checkCallback())
+ (*_ccallback)(_items[menuItem]->submenu->items[submenuItem]->action, _items[menuItem]->submenu->items[submenuItem]->text, _cdata);
+ }
+ return true;
+ }
return false;
}
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index c2c75080f9c..07b0a58fd1e 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -173,6 +173,7 @@ public:
int getLastSelectedMenuItem() { return _lastActiveItem; };
int getLastSelectedSubmenuItem() { return _lastActiveSubItem; };
+ void getMenuShortCut(uint16 key, int &menuItem, int &submenuItem);
void renderSubmenu(MacMenuSubMenu *menu, bool recursive = true);
Commit: 31fe5b77d366371bf467db4b1f2888ee8359a9c2
https://github.com/scummvm/scummvm/commit/31fe5b77d366371bf467db4b1f2888ee8359a9c2
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:14+02:00
Commit Message:
FOOL: Add Toolbox::MenuKey
Changed paths:
engines/fool/toolbox.h
engines/fool/toolbox_menu.cpp
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 647581f7afe..c9710ee8280 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -794,6 +794,8 @@ public:
// simply unhighlights whichever menu title is highlighted (if any).
void HiliteMenu(uint16 menuID);
+ uint32 MenuKey(char ch);
+
// FUNCTION MenuSelect(startPt: Point): LONGINT;
// When there's a mouse-down event in the menu bar, the application should call MenuSelect with
// startPt equal to the point (in global coordinates) where the mouse button was pressed.
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 0a13ba8d1b6..2cd9a0575c5 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -161,6 +161,21 @@ void Toolbox::HiliteMenu(uint16 menuID) {
warning("STUB: Toolbox::HiliteMenu");
}
+uint32 Toolbox::MenuKey(char ch) {
+ uint32 result = 0;
+ if (_defaultMenu) {
+ int menuItem;
+ int menuSubItem;
+ _defaultMenu->getMenuShortCut((uint8)ch, menuItem, menuSubItem);
+ if ((menuItem >= 0) && (menuSubItem >= 0)) {
+ result |= ((menuItem + 1) & 0xffff) << 16;
+ result |= ((menuSubItem + 1) & 0xffff);
+ HiliteMenu(menuItem + 1);
+ }
+ }
+ return result;
+}
+
uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
uint32 result = 0;
if (_defaultMenu) {
Commit: a5d2f8449731c9ca8e243e20eebf3c31c3c16514
https://github.com/scummvm/scummvm/commit/a5d2f8449731c9ca8e243e20eebf3c31c3c16514
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:14+02:00
Commit Message:
FOOL: Fix uninitialised memory in page arrays
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index b5f9e4a2702..d98bf4d664e 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1076,6 +1076,7 @@ void FoolGame::storyRenderPage() {
// 128:252a
// y-position where the story text should start
this->var_i16_7a2 = 0x11d - (this->arr_i16_1dee[this->storyNextPage] * 0xf);
+ debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", this->storyNextPage, this->arr_i16_1dee[this->storyNextPage]);
if (this->arr_i16_1dee[this->storyNextPage] < 0xf) {
g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
g_toolbox->DrawString(g_zbasic->str(14)); // infinity symbol
@@ -2781,6 +2782,8 @@ void FoolGame::sub_129_068() {
// story text
this->var_i16_103c = this->puzzlesReadShort();
this->var_i16_68a = 1;
+ Common::fill(this->pageLineFace, this->pageLineFace + 1301, 0);
+ Common::fill(this->pageLineBreak, this->pageLineBreak + 1301, 0);
for (int i = 1; i <= this->var_i16_103c; i++) {
this->var_i16_103e = this->puzzlesReadByte();
// indent at start of story paragraph
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 310af52da9a..5aa9ca613e2 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -478,7 +478,7 @@ private:
int16 arr_i16_1cc2;
int16 arr_i16_1cd8;
int16 arr_i16_1cea;
- int16 arr_i16_1d24[202];
+ int16 arr_i16_1d24[101];
int16 arr_i16_1dee[202];
int16 arr_i16_1eb8[0x29];
// used just for death?
Commit: 5051bba49616e1b0a6d704d86e3ece22aa3bcd91
https://github.com/scummvm/scummvm/commit/5051bba49616e1b0a6d704d86e3ece22aa3bcd91
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:14+02:00
Commit Message:
FOOL: Fix cross-encoding losses in save games
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/toolbox_menu.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
graphics/macgui/macmenu.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 5caa18fef6f..066858cefbd 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -64,9 +64,9 @@ void FoolGame::cardsRun() {
this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
// illustration of the card game
g_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
- if (this->var_str_c06 == g_zbasic->str(278)) { // blank
+ if (this->activePuzzleBuffer.empty()) { // was: str(278)
// 139:01fa
- this->var_str_c06 = g_zbasic->unk_88(0) + g_zbasic->unk_88(0) + g_zbasic->unk_88(0);
+ this->activePuzzleBuffer = g_zbasic->unk_88(0) + g_zbasic->unk_88(0) + g_zbasic->unk_88(0);
// card IDs
for (int16 i = 0; i <= 0x15; i++) {
this->arr_i16_5cbc[i] = i;
@@ -79,15 +79,15 @@ void FoolGame::cardsRun() {
}
// 139:029c
for (int i = 0; i <= 0x15; i++) {
- this->var_str_c06 += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
+ this->activePuzzleBuffer += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
}
}
// 139:02d8
// player scores
- this->arr_i16_1eb8[5] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 1, 2));
- this->arr_i16_1eb8[6] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 3, 2));
+ this->arr_i16_1eb8[5] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, 1, 2));
+ this->arr_i16_1eb8[6] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, 3, 2));
// 139:0320
- this->var_i16_2010 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, 5, 2));
+ this->var_i16_2010 = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, 5, 2));
if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->arr_i16_1eb8[5] = 0;
this->arr_i16_1eb8[6] = 0;
@@ -96,7 +96,7 @@ void FoolGame::cardsRun() {
// 139:039e
for (int i = 0; i <= 0x15; i++) {
- this->arr_i16_5cbc[i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, i*2 + 7, 2));
+ this->arr_i16_5cbc[i] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, i*2 + 7, 2));
}
// 139:03ea
this->arr_i16_5cbc[0x16] = 0x16;
@@ -691,12 +691,12 @@ void FoolGame::cardsDrawScores() {
void FoolGame::cardsStoreState() {
// 139:1cba
- this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[5]) +
+ this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[5]) +
g_zbasic->unk_88(this->arr_i16_1eb8[6]) +
g_zbasic->unk_88(this->var_i16_2010);
// 139:1d00
for (int i = 0; i <= 0x15; i++) {
- this->var_str_c06 += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
+ this->activePuzzleBuffer += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
}
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index d98bf4d664e..0c99f0a1919 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/util.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
@@ -539,7 +540,7 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16
this->sub_128_4472();
}
-void FoolGame::sub_128_c6a(uint16 unk1) {
+void FoolGame::sub_128_c6a(uint32 unk1) {
// 128:0c6a
// This function is usually called at the start of an event processing loop,
@@ -573,7 +574,7 @@ void FoolGame::sub_128_c6a(uint16 unk1) {
this->sub_128_6154();
}
if ((this->var_ev_46.what == kScummVMQuitEvt) || (this->var_ev_46.what == kScummVMReturnToLauncherEvt)) {
- _quit = true;
+ this->sub_128_2ab6();
}
}
@@ -1127,16 +1128,16 @@ void FoolGame::sub_128_26f6() {
}
void FoolGame::sub_128_271a() {
- int position = this->arr_i32_19454[this->var_i16_7e2] - 1;
+ int position = this->arr_i32_19454[this->activePuzzle] - 1;
// record index
this->var_i16_484 = (int16)(position / 1000);
// offset at record
this->var_i16_7e4 = (int16)(position % 1000);
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
this->var_ptr_696 = 0;
- int length = this->arr_i32_19454[this->var_i16_7e2 + 1] - this->arr_i32_19454[this->var_i16_7e2];
+ int length = this->arr_i32_19454[this->activePuzzle + 1] - this->arr_i32_19454[this->activePuzzle];
debugC(8, kDebugLoading, "sub_128_271a: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
- this->var_i16_7e2,
+ this->activePuzzle,
position,
this->var_i16_484,
this->var_i16_7e4,
@@ -1168,7 +1169,7 @@ void FoolGame::sub_128_2808() {
// 128:2812: MOVE.L - A0,-0x8ee(A5)
g_zbasic->openR(2, this->var_str_588, 0x400, this->var_i16_688);
this->var_str_7e8 = g_zbasic->readFileStr(2, 0x11);
- if (this->var_str_7e8 == g_zbasic->str(16)) {
+ if (this->var_str_7e8 == g_zbasic->str(16)) { // The Fool's Errand
this->var_i16_8e8 = g_zbasic->readFileInt(2);
this->var_i16_8e8 = g_zbasic->readFileInt(2);
this->var_i16_8e8 = g_zbasic->readFileInt(2);
@@ -1320,14 +1321,14 @@ void FoolGame::sub_128_2bc6() {
}
// 128:2cce
for (int16 i = 1; i <= 0x51; i++) {
- this->arr_i16_4bd8[i] = i;
+ this->sunMapTileID[i] = i;
}
g_zbasic->unk_20();
// 128:2cf6
for (int i = 1; i <= 0x64; i++) {
this->var_i16_484 = g_zbasic->rndInt(0x51);
this->var_i16_7e4 = g_zbasic->rndInt(0x51);
- g_zbasic->swapInt(this->arr_i16_4bd8[this->var_i16_484], this->arr_i16_4bd8[this->var_i16_7e4]);
+ g_zbasic->swapInt(this->sunMapTileID[this->var_i16_484], this->sunMapTileID[this->var_i16_7e4]);
this->arr_i16_1c5a[i] = 0;
this->arr_i16_1d24[i] = 0;
}
@@ -1354,7 +1355,7 @@ void FoolGame::sub_128_2bc6() {
g_zbasic->unk_333(0x2);
this->storyNextPage = 1;
this->var_i16_7ce = 0;
- this->var_i16_7e2 = 0;
+ this->activePuzzle = 0;
this->var_i16_7d2 = 0;
this->var_i16_7b2 = 0;
this->sub_128_3032();
@@ -1378,7 +1379,7 @@ void FoolGame::sub_128_2e3e() {
this->var_str_384 = g_zbasic->readFileStr(2, 0x11);
this->storyNextPage = g_zbasic->readFileInt(2);
- this->var_i16_7e2 = g_zbasic->readFileInt(2);
+ this->activePuzzle = g_zbasic->readFileInt(2);
this->var_i16_7ce = g_zbasic->readFileInt(2);
this->var_i16_7d2 = g_zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
@@ -1386,13 +1387,20 @@ void FoolGame::sub_128_2e3e() {
this->arr_i16_1c5a[i] = g_zbasic->readFileInt(2);
this->arr_i16_1b90[i] = g_zbasic->readFileInt(2);
this->var_i16_484 = g_zbasic->readFileInt(2);
- this->var_str_384 = g_zbasic->readFileStr(2, this->var_i16_484);
- g_zbasic->indexSet(this->var_str_384, 2, i);
+ debugC(5, kDebugLoading, "sub_128_2e3e: puzzle %d:, arr_i16_1d24: %d, arr_i16_1c5a: %d, arr_i16_1b90: %d, payload size: %d", i, this->arr_i16_1d24[i], this->arr_i16_1c5a[i], this->arr_i16_1b90[i], this->var_i16_484);
+ Common::String state = g_zbasic->readFileStr(2, this->var_i16_484);
+ if (debugChannelSet(5, kDebugLoading)) {
+ Common::hexdump((const byte *)state.c_str(), this->var_i16_484);
+ }
+ g_zbasic->indexRawSet(state, 2, i);
}
// 128:2f54
+ debugCN(5, kDebugLoading, "sub_128_2e3e: sun map tile IDs: ");
for (int i = 1; i <= 0x51; i++) {
- this->arr_i16_4bd8[i] = g_zbasic->readFileInt(2);
+ this->sunMapTileID[i] = g_zbasic->readFileInt(2);
+ debugCN(5, kDebugLoading, "%d, ", this->sunMapTileID[i]);
}
+ debugC(5, kDebugLoading, "");
// 128:2f84
g_zbasic->close(2);
if (this->var_i16_7e6 != 0) {
@@ -1460,7 +1468,7 @@ void FoolGame::sub_128_3032() {
if ((this->var_i16_7ce & 1) == 0) {
this->sub_128_378a();
} else {
- if ((this->var_i16_7e2 > 0) && (this->var_i16_7e2 <= 0x50)) {
+ if ((this->activePuzzle > 0) && (this->activePuzzle <= 0x50)) {
this->sub_128_1c2c(0x80);
} else {
this->sub_128_1c2c(0x100);
@@ -1540,20 +1548,20 @@ void FoolGame::sub_128_3536() {
this->var_str_af4 = g_zbasic->str(60); // The Fool's Errand
g_zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
g_zbasic->writeFileInt(2, this->storyNextPage);
- g_zbasic->writeFileInt(2, this->var_i16_7e2);
+ g_zbasic->writeFileInt(2, this->activePuzzle);
g_zbasic->writeFileInt(2, this->var_i16_7ce);
g_zbasic->writeFileInt(2, this->var_i16_7d2);
for (int i = 1; i <= 0x64; i++) {
g_zbasic->writeFileInt(2, this->arr_i16_1d24[i]);
g_zbasic->writeFileInt(2, this->arr_i16_1c5a[i]);
g_zbasic->writeFileInt(2, this->arr_i16_1b90[i]);
- this->var_str_af4 = g_zbasic->index(2, i);
- g_zbasic->writeFileInt(2, (int16)this->var_str_af4.size());
- g_zbasic->writeFileStr(2, this->var_str_af4);
+ Common::String state = g_zbasic->indexRaw(2, i);
+ g_zbasic->writeFileInt(2, (int16)state.size());
+ g_zbasic->writeFileStr(2, state);
}
// 128:36ba
for (int i = 1; i <= 0x51; i++) {
- g_zbasic->writeFileInt(2, this->arr_i16_4bd8[i]);
+ g_zbasic->writeFileInt(2, this->sunMapTileID[i]);
}
g_zbasic->close(2);
}
@@ -1638,7 +1646,7 @@ void FoolGame::sub_128_39a0() {
this->var_i16_c00 = 0;
this->var_i16_7d6 = 0;
this->var_i16_7b2 = 0xa;
- this->var_i16_7e2 = this->var_i16_7d0;
+ this->activePuzzle = this->var_i16_7d0;
this->var_i16_7ce |= 1;
g_toolbox->InitCursor();
this->sub_128_0a2(0, 0);
@@ -1832,22 +1840,22 @@ void FoolGame::sub_128_3de6() {
void FoolGame::sub_128_3fb6() {
// 128:3fb6
- g_zbasic->menu(8, 0, 1, this->arr_str_195e8[this->var_i16_7e2]);
+ g_zbasic->menu(8, 0, 1, this->arr_str_195e8[this->activePuzzle]);
this->var_str_384 = g_zbasic->str(72); // return to scroll
- if ((this->var_i16_7e2 == 0x34) || (this->var_i16_7e2 == 0x35)) {
+ if ((this->activePuzzle == 0x34) || (this->activePuzzle == 0x35)) {
this->var_str_384 = g_zbasic->str(73); // run for your life
}
// 128:4024
- if (this->var_i16_7e2 > 0x50) {
+ if (this->activePuzzle > 0x50) {
this->var_str_384 = g_zbasic->str(74); // return to map
}
g_zbasic->menu(8, 1, 1, this->var_str_384);
// 128:4056
- if (this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2] <= this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2 + 1]) {
+ if (this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2] <= this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2 + 1]) {
g_zbasic->menu(8, 2, 0, g_zbasic->str(75)); // line
// 128:40c6
this->var_i16_484 = 2;
- for (int i = this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2]; i <= this->arr_i16_1b10[this->arr_i16_18b2[this->var_i16_7e2]*2 + 1]; i++) {
+ for (int i = this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2]; i <= this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2 + 1]; i++) {
// 128:40f6
this->var_i16_484++;
this->var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(76);
@@ -1859,25 +1867,25 @@ void FoolGame::sub_128_3fb6() {
void FoolGame::sub_128_4168() {
// 128:4168
- this->var_i16_c04 = this->arr_i16_1c5a[this->var_i16_7e2];
+ this->var_i16_c04 = this->arr_i16_1c5a[this->activePuzzle];
if (this->var_i16_c04 == 0x64) {
this->var_i16_c04 = 0x65;
}
- this->var_str_c06 = g_zbasic->index(2, this->var_i16_7e2);
+ this->activePuzzleBuffer = g_zbasic->indexRaw(2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
- Common::String inter = this->var_str_c06.encode(Common::kMacRoman);
- debugC(5, kDebugLoading, "sub_128_4168: loading puzzle %d context, state %d", this->var_i16_7e2, this->var_i16_c04);
+ Common::String inter = this->activePuzzleBuffer;
+ debugC(5, kDebugLoading, "sub_128_4168: loading puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
void FoolGame::sub_128_41aa() {
// 128:41aa
- this->arr_i16_1c5a[this->var_i16_7e2] = this->var_i16_c04;
- g_zbasic->indexSet(this->var_str_c06, 2, this->var_i16_7e2);
+ this->arr_i16_1c5a[this->activePuzzle] = this->var_i16_c04;
+ g_zbasic->indexRawSet(this->activePuzzleBuffer, 2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
- Common::String inter = this->var_str_c06.encode(Common::kMacRoman);
- debugC(5, kDebugLoading, "sub_128_41aa: saving puzzle %d context, state %d", this->var_i16_7e2, this->var_i16_c04);
+ Common::String inter = this->activePuzzleBuffer;
+ debugC(5, kDebugLoading, "sub_128_41aa: saving puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
@@ -1885,10 +1893,10 @@ void FoolGame::sub_128_41aa() {
void FoolGame::sub_128_41d8() {
// 128:41d8
for (int i = 0; i <= 5; i++) {
- this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[this->var_i16_7e2]*8)];
+ this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[this->activePuzzle]*8)];
}
// 128:422e
- if ((this->var_i16_7e2 == 0x34) && (this->arr_i16_1cc2 > 1)) {
+ if ((this->activePuzzle == 0x34) && (this->arr_i16_1cc2 > 1)) {
// 128:4262
if (this->arr_i16_1cc2 == 2) {
this->arr_i16_4758[0] = 0;
@@ -1915,19 +1923,19 @@ void FoolGame::sub_128_41d8() {
// 128:4348
}
// 128:4348
- if ((this->var_i16_7e2 == 0x17) && (this->arr_i16_1c7a[15] == 0x63)) {
+ if ((this->activePuzzle == 0x17) && (this->arr_i16_1c7a[15] == 0x63)) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 2;
this->arr_i16_4758[1] = 0xa;
}
// 128:43aa
- if ((this->var_i16_7e2 == 0x3f) && (this->arr_i16_1cd8 == 0x63)) {
+ if ((this->activePuzzle == 0x3f) && (this->arr_i16_1cd8 == 0x63)) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 3;
this->arr_i16_4758[2] = 0;
}
// 128:440a
- if (this->var_i16_7e2 == 0x48) {
+ if (this->activePuzzle == 0x48) {
if (this->arr_i16_1cea == 0x63) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 0x47;
@@ -1943,7 +1951,7 @@ void FoolGame::sub_128_41d8() {
void FoolGame::sub_128_4472() {
// 128:4472
if (this->arr_i16_4758[1] == 0) {
- this->arr_i16_4758[1] = this->var_i16_7e2;
+ this->arr_i16_4758[1] = this->activePuzzle;
}
if (this->arr_i16_4758[2] == 0) {
this->arr_i16_4758[2] = 0x8;
@@ -2004,7 +2012,7 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[11] = 0x207;
}
// 128:4850
- if ((this->arr_i16_15e8[this->var_i16_7e2] == 0xd) || (this->arr_i16_15e8[this->var_i16_7e2] == 0xe)) {
+ if ((this->arr_i16_15e8[this->activePuzzle] == 0xd) || (this->arr_i16_15e8[this->activePuzzle] == 0xe)) {
this->fillRect(0x14f, 0, 0x156, 0x7, 1);
this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 1);
}
@@ -2231,7 +2239,22 @@ void FoolGame::sub_128_5b30() {
void FoolGame::sub_128_5baa() {
if (this->var_i16_e12 != 0)
return;
- warning("STUB: %s", __func__);
+ this->var_i32_bf8 = g_toolbox->MenuKey((char)(this->var_ev_46.message & 0xff));
+ g_toolbox->Delay(0);
+ this->selectedMenuID = this->var_i32_bf8 >> 16;
+ this->selectedMenuItem = this->var_i32_bf8 & 0xffff;
+ if (this->selectedMenuID > 0) {
+ if (this->var_i16_e14 != 0) {
+ this->sub_128_5ef0();
+ }
+ this->sub_128_5c20();
+ if (this->var_i16_e14 != 0) {
+ this->sub_128_5f16();
+ }
+ g_toolbox->HiliteMenu(0);
+ }
+ // 128:5c1a
+ this->sub_128_61ec();
}
void FoolGame::sub_128_5c20() {
@@ -2330,7 +2353,7 @@ void FoolGame::sub_128_5f16() {
this->arr_i16_1eb8[0] = 1;
}
// 128:5f4c
- this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
+ this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
}
// 128:5f70
if ((this->stateFlags & 1) != 0) {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 5aa9ca613e2..8c386000f2c 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -67,7 +67,7 @@ public:
void sub_128_918(const Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
- void sub_128_c6a(uint16 unk1);
+ void sub_128_c6a(uint32 unk1);
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
@@ -329,7 +329,7 @@ private:
int16 selectedMenuChapter; // var_i16_7dc
int16 var_i16_7de;
int16 var_i16_7e0;
- int16 var_i16_7e2;
+ int16 activePuzzle; // var_i16_7e2
int16 var_i16_7e4;
int16 var_i16_7e6;
Common::U32String var_str_7e8;
@@ -348,7 +348,7 @@ private:
int16 var_i16_c00;
int16 var_i16_c02;
int16 var_i16_c04;
- Common::U32String var_str_c06;
+ Common::String activePuzzleBuffer; // var_str_c06
int16 var_i16_d06;
int16 var_i16_d0c;
@@ -496,7 +496,7 @@ private:
Common::Rect arr_rect_4776;
int16 arr_i16_47d8[0x100];
PicHandle arr_pic_49d8[0x80];
- int16 arr_i16_4bd8[0x52];
+ int16 sunMapTileID[0x52]; // arr_i16_4bd8
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[48];
Common::SharedPtr<Cursor> arr_curs_4d88[0x2b]; // 0x44
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 433eedcc211..fe7c71f69bc 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -97,9 +97,9 @@ void FoolGame::jigsawRun() {
}
// 132:0376
// rearrange picture tiles to match state
- if (this->var_str_c06 != g_zbasic->str(207)) { // empty
+ if (!this->activePuzzleBuffer.empty()) { // was: str(207)
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- this->arr_i16_3738[i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, i*2 - 1, 2));
+ this->arr_i16_3738[i] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, i*2 - 1, 2));
g_zbasic->put(
this->arr_rect_1f38[i].left,
this->arr_rect_1f38[i].top,
@@ -376,10 +376,10 @@ void FoolGame::jigsawDropSelected() {
void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
- this->var_str_c06 = g_zbasic->str(208);
+ this->activePuzzleBuffer = g_zbasic->str(208);
for (int i = 1; i <= this->var_i16_1a9e; i++) {
this->var_str_384 = g_zbasic->unk_88(this->arr_i16_3738[i]);
- this->var_str_c06 += this->var_str_384;
+ this->activePuzzleBuffer += this->var_str_384;
}
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 53c0d42ad36..201918f085a 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -160,9 +160,9 @@ void FoolGame::jumbleRun() {
this->var_str_1070 += this->var_str_1272;
} else {
// 130:04ac
- if ((this->var_i16_c04 == this->jumbleCurrentSubPuzzle) && (this->var_str_c06 != g_zbasic->str(170))) {
+ if ((this->var_i16_c04 == this->jumbleCurrentSubPuzzle) && !this->activePuzzleBuffer.empty()) { // was: str(170)
// 130:04dc
- this->var_str_1070 = this->var_str_c06;
+ this->var_str_1070 = this->activePuzzleBuffer;
} else {
// 130:04f0
if ((this->jumbleGameType == 1) || (this->jumbleGameType == 5)) {
@@ -203,7 +203,7 @@ void FoolGame::jumbleRun() {
this->sub_130_1c6c();
this->var_str_d12 = g_zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
// 130:06d4
- if ((this->var_i16_7e2 <= 0x50) || (this->var_i16_7e2 == 0x55)) {
+ if ((this->activePuzzle <= 0x50) || (this->activePuzzle == 0x55)) {
this->sub_130_1dcc();
} else {
// 130:0700
@@ -215,12 +215,12 @@ void FoolGame::jumbleRun() {
}
// 130:073e
this->var_i16_1576 = this->var_str_1170.size();
- if ((this->var_i16_7e2 == 0x51) || (this->var_i16_7e2 == 0x54)) {
+ if ((this->activePuzzle == 0x51) || (this->activePuzzle == 0x54)) {
// 130:076e
g_toolbox->PenNormal();
g_toolbox->PenPat(this->arr_pat_58f4[1]);
g_toolbox->PenSize(3, 3);
- if (this->var_i16_7e2 == 0x51) {
+ if (this->activePuzzle == 0x51) {
// 130:0794
g_toolbox->MoveTo(0xf3, 0x6f);
g_toolbox->LineTo(0xf3, 0xe4);
@@ -228,7 +228,7 @@ void FoolGame::jumbleRun() {
g_toolbox->LineTo(0x14c, 0xa9);
}
// 130:07bc
- if (this->var_i16_7e2 == 0x54) {
+ if (this->activePuzzle == 0x54) {
g_toolbox->MoveTo(0xe9, 0x81);
g_toolbox->LineTo(0x17d, 0x81);
g_toolbox->MoveTo(0x124, 0x47);
@@ -293,7 +293,7 @@ void FoolGame::jumbleRun() {
this->jumbleCurrentSubPuzzle = this->jumbleSubPuzzleCount;
} else {
// 130:0956
- if (this->var_i16_7e2 <= 0x50) {
+ if (this->activePuzzle <= 0x50) {
if ((this->var_i16_1678 > 0) && (this->var_str_1578 != g_zbasic->str(172))) {
// 130:098c
this->var_str_1578 = g_zbasic->str(173);
@@ -327,7 +327,7 @@ void FoolGame::jumbleRun() {
this->sub_128_6186();
this->sub_128_61ec();
// 130:0a90
- if (this->var_i16_7e2 != 0x55) {
+ if (this->activePuzzle != 0x55) {
// 130:0b68
while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0) {
// 130:0aa0
@@ -394,23 +394,23 @@ void FoolGame::sub_130_c66() {
// 130:0c66
if (this->var_i16_d0c != 0) {
this->var_i16_c04 = 0x64;
- this->var_str_c06 = g_zbasic->str(174);
+ this->activePuzzleBuffer.clear(); // was: str(174)
this->var_i16_d0c = 0;
} else {
// 130:0c98
if (this->var_i16_c04 < 0x64) {
this->var_i16_c04 = this->jumbleCurrentSubPuzzle;
if ((this->jumbleGameType == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
- this->var_str_c06 = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
+ this->activePuzzleBuffer = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
} else {
// 130:0cfe
- this->var_str_c06 = this->var_str_1070;
+ this->activePuzzleBuffer = this->var_str_1070;
}
// 130:0d0e
} else {
// 130:0d12
this->var_i16_c04 = 0x65;
- this->var_str_c06 = g_zbasic->str(176);
+ this->activePuzzleBuffer.clear(); // was: str(176)
}
}
// 130:0d2c
@@ -828,7 +828,7 @@ void FoolGame::sub_130_1c6c() {
return;
}
// 130:1ce2
- if ((this->var_i16_7e2 > 0x50) && (this->var_i16_7e2 < 0x55)) {
+ if ((this->activePuzzle > 0x50) && (this->activePuzzle < 0x55)) {
return;
}
this->arr_i16_4758[0] = this->arr_rect_1f38[this->var_i16_1574].top + 2;
@@ -891,7 +891,7 @@ void FoolGame::sub_130_1e76() {
void FoolGame::sub_130_201a() {
// 130:201a
g_zbasic->midStrSet(this->var_str_1070, this->var_i16_106e, 1, this->var_str_d12);
- if ((this->var_i16_7e2 > 0x50) && (this->var_i16_7e2 < 0x55)) {
+ if ((this->activePuzzle > 0x50) && (this->activePuzzle < 0x55)) {
this->sub_130_1e5c();
} else {
// 130:2066
@@ -957,19 +957,19 @@ void FoolGame::sub_130_2178() {
void FoolGame::sub_130_2226() {
// 130:2226
- if (this->var_i16_7e2 == 0x14) {
+ if (this->activePuzzle == 0x14) {
this->sub_130_23cc();
return;
}
- if (this->var_i16_7e2 == 0x3c) {
+ if (this->activePuzzle == 0x3c) {
this->sub_130_22ee();
return;
}
- if (this->var_i16_7e2 == 0x35) {
+ if (this->activePuzzle == 0x35) {
this->sub_130_24aa();
return;
}
- if (this->var_i16_7e2 == 0x55) {
+ if (this->activePuzzle == 0x55) {
this->sub_130_2548();
return;
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 146cc4e961e..5c30f3d5f0f 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -117,12 +117,12 @@ void FoolGame::polyominoRun() {
this->arr_i16_47d8[j*8 + 4]
);
// 133:02de
- if (this->var_str_c06 != g_zbasic->str(211)) {
+ if (!this->activePuzzleBuffer.empty()) { // was: str(211)
if (j == 1) {
this->var_i16_1aa8 = 1;
}
for (int i = 3; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, this->var_i16_1aa8, 2));
+ this->arr_i16_47d8[j*8 + i] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_1aa8, 2));
this->var_i16_1aa8 += 2;
}
}
@@ -524,12 +524,12 @@ void FoolGame::polyominoSuccess() {
void FoolGame::polyominoStoreState() {
// 133:1452
- this->var_str_c06 = g_zbasic->str(212); // empty
+ this->activePuzzleBuffer = g_zbasic->str(212); // empty
this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
- this->var_str_384 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 3]);
- this->var_str_9f4 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 4]);
- this->var_str_c06 = this->var_str_c06 + this->var_str_384 + this->var_str_9f4;
+ Common::String val1 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 3]);
+ Common::String val2 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 4]);
+ this->activePuzzleBuffer += val1 + val2;
}
}
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index d909ce96fdd..586a2dd0f9b 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -78,7 +78,7 @@ void FoolGame::revealRun() {
this->sub_128_962(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
this->sub_128_962(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
// 134:02f0
- this->arr_i16_1eb8[19] = g_zbasic->unk_310(this->var_str_c06);
+ this->arr_i16_1eb8[19] = g_zbasic->unk_310(this->activePuzzleBuffer);
this->var_i16_1aba = this->arr_i16_1eb8[18];
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
@@ -144,7 +144,7 @@ void FoolGame::revealRun() {
this->revealReset();
}
if (this->stateFlags == 4) {
- this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
+ this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
this->sub_128_3536();
}
// 134:061e
@@ -153,7 +153,7 @@ void FoolGame::revealRun() {
if (this->var_i16_d0c != 0) {
this->revealSuccess();
}
- this->var_str_c06 = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
+ this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
g_toolbox->KillPoly(this->arr_poly_192c0[i]);
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 07452a78b6e..b11a39acd12 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -78,7 +78,7 @@ void FoolGame::sunMapRun() {
// 137:02a2
this->fillRect(0x14, 0x67, 0x156, 0x1b1, 2);
for (int i = 1; i <= 0x51; i++) {
- g_zbasic->picture(this->arr_rect_1f38[i].left, this->arr_rect_1f38[i].top, this->arr_i32_192c0[this->arr_i16_4bd8[i]]);
+ g_zbasic->picture(this->arr_rect_1f38[i].left, this->arr_rect_1f38[i].top, this->arr_i32_192c0[this->sunMapTileID[i]]);
}
// 137:0336
this->stateFlags = kStateNull;
@@ -114,7 +114,7 @@ void FoolGame::sunMapRun() {
}
}
// 137:1654
- this->var_i16_7e2 = 0;
+ this->activePuzzle = 0;
this->var_i16_c04 = 0x64;
this->var_i16_7d2 = 1;
g_zbasic->menu(2, 7, 1, Common::U32String());
@@ -143,7 +143,7 @@ void FoolGame::sunMapOnClick() {
g_toolbox->PenMode(kPatXor);
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
- if (this->arr_i16_1d24[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & 8) {
+ if (this->arr_i16_1d24[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & 8) {
this->sunMapRevealPiece();
return;
}
@@ -269,9 +269,9 @@ void FoolGame::sunMapDropSelected() {
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
this->var_i16_1aa4++;
- this->arr_i16_3738[this->var_i16_1aa4] = this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]];
+ this->arr_i16_3738[this->var_i16_1aa4] = this->sunMapTileID[this->arr_i16_2f38[i*32 + j]];
// 137:0e5a
- this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] = 0;
+ this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] = 0;
}
}
@@ -281,30 +281,30 @@ void FoolGame::sunMapDropSelected() {
for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
this->var_i16_1aa4++;
- if (this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] > 0) {
+ if (this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] > 0) {
this->var_i16_1aa6++;
- this->arr_i16_3738[this->var_i16_1aa6] = this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]];
+ this->arr_i16_3738[this->var_i16_1aa6] = this->sunMapTileID[this->arr_i16_2f38[i*32 + j]];
}
// 137:0f7c
- this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
+ this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
g_zbasic->picture(
this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]]]
+ this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
);
}
}
this->var_i16_1aa6 = this->var_i16_1aa4;
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
- if (this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] == 0) {
+ if (this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] == 0) {
// 137:1114
this->var_i16_1aa6++;
- this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
+ this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
g_zbasic->picture(
this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[i*32 + j]]]
+ this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
);
}
// 137:1214
@@ -318,7 +318,7 @@ void FoolGame::sunMapCheckIfSolved() {
// 137:124e
this->var_i16_d0c = 1;
for (int i = 1; i <= 0x51; i++) {
- if (this->arr_i16_4bd8[i] != i) {
+ if (this->sunMapTileID[i] != i) {
this->var_i16_d0c = 0;
i = 0x51;
}
@@ -342,8 +342,8 @@ void FoolGame::sunMapCheckIfSolved() {
void FoolGame::sunMapRevealPiece() {
// 137:131a
- this->arr_i16_1d24[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= 8;
- this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = this->arr_i32_1912c[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
+ this->arr_i16_1d24[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= 8;
+ this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = this->arr_i32_1912c[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
// 137:142c
// unrolled loop
this->arr_i16_4758[0] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top;
@@ -368,7 +368,7 @@ void FoolGame::sunMapRevealPiece() {
g_zbasic->picture(
this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left,
this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
- this->arr_i32_192c0[this->arr_i16_4bd8[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
+ this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
);
this->sub_128_6186();
this->sunMapCheckIfSolved();
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index ca90c56167d..fad797d3426 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "fool/detection.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
@@ -67,14 +68,14 @@ void FoolGame::wordSearchRun() {
// 131:01b6
// total hidden word count
this->var_i16_198e = this->puzzlesReadShort();
- if (this->var_str_c06 == g_zbasic->str(191)) { // blank str
- this->var_str_c06 = g_zbasic->space(this->var_i16_198e);
+ if (this->activePuzzleBuffer.empty()) { // was: str(191)
+ this->activePuzzleBuffer = g_zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
} else {
// 131:01f2
- this->arr_i16_4758[0] = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_c06, this->var_i16_198e + 1, 2));
+ this->arr_i16_4758[0] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_198e + 1, 2));
for (int i = 1; i <= this->arr_i16_4758[0]; i++) {
this->arr_i16_4758[i] = g_zbasic->unk_310(g_zbasic->midStr(
- this->var_str_c06,
+ this->activePuzzleBuffer,
this->var_i16_198e + 1 + i*2,
2
));
@@ -106,7 +107,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_1990 = 0;
this->var_i16_68a = 1;
for (int i = 1; i <= this->var_i16_198e; i++) {
- this->arr_i16_3738[i] = (int16)strtol(g_zbasic->midStr(this->var_str_c06, i, 1).encode(Common::kMacRoman).c_str(), nullptr, 10);
+ this->arr_i16_3738[i] = (int16)strtol(g_zbasic->midStr(this->activePuzzleBuffer, i, 1).c_str(), nullptr, 10);
if (this->arr_i16_3738[i] != 0) {
this->var_i16_1990++;
}
@@ -182,7 +183,7 @@ void FoolGame::wordSearchRun() {
}
// 131:077a
this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_198e);
- if (this->var_i16_7e2 != 0x50) {
+ if (this->activePuzzle != 0x50) {
// There are X words hidden below
this->var_str_384 = g_zbasic->str(196) + this->var_str_9f4 + g_zbasic->str(197);
g_zbasic->menu(8, 3, 1, this->var_str_384);
@@ -336,10 +337,10 @@ void FoolGame::wordSearchDrawFooter() {
void FoolGame::wordSearchStoreState() {
// 131:0d66
- this->var_str_c06 = g_zbasic->str(206); // empty
+ this->activePuzzleBuffer = g_zbasic->str(206); // empty
for (int i = 1; i <= this->var_i16_198e; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_3738[i]);
- this->var_str_c06 += g_zbasic->rightStr(this->var_str_384, 1);
+ this->activePuzzleBuffer += g_zbasic->rightStr(this->var_str_384, 1);
}
// 131:0dd6
this->var_i16_484 = 0;
@@ -349,7 +350,7 @@ void FoolGame::wordSearchStoreState() {
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
if (this->arr_i16_2f38[i*32 + j] != 0) {
- this->arr_i16_4758[this->var_i16_106a] = this->arr_i16_4758[this->var_i16_106a] | this->bitLUT[this->var_i16_484];
+ this->arr_i16_4758[this->var_i16_106a] |= this->bitLUT[this->var_i16_484];
}
// 131:0e72
this->var_i16_484++;
@@ -363,8 +364,10 @@ void FoolGame::wordSearchStoreState() {
}
}
// 131:0ef6
+ debugC(5, kDebugLoading, "wordSearchStoreState:");
for (int i = 0; i <= this->arr_i16_4758[0]; i++) {
- this->var_str_c06 += g_zbasic->unk_88(this->arr_i16_4758[i]);
+ debugCN(5, kDebugLoading, "%04x ", this->arr_i16_4758[i]);
+ this->activePuzzleBuffer += g_zbasic->unk_88(this->arr_i16_4758[i]);
}
}
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 2cd9a0575c5..2c6f8b521da 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -158,7 +158,23 @@ MenuHandle Toolbox::GetMHandle(uint16 menuID) {
void Toolbox::HiliteMenu(uint16 menuID) {
// FIXME: this is coupled to the mouse click code
- warning("STUB: Toolbox::HiliteMenu");
+ if (_defaultMenu) {
+ if (menuID == 0) {
+ for (int i = 0; i < _defaultMenu->numberOfMenus(); i++) {
+ Graphics::MacMenuSubMenu *item = _defaultMenu->getSubmenu(nullptr, i);
+ if (item) {
+ item->highlight = false;
+ }
+ }
+ } else {
+ Graphics::MacMenuSubMenu *item = _defaultMenu->getSubmenu(nullptr, menuID - 1);
+ if (item) {
+ item->highlight = true;
+ }
+ }
+ _defaultMenu->setDirty(true);
+ }
+ warning("STUB: Toolbox::HiliteMenu %d", menuID);
}
uint32 Toolbox::MenuKey(char ch) {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index d29f7628336..ccf405929c0 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -361,6 +361,20 @@ void ZBasic::midStrSet(Common::U32String &target, int16 expr1, int16 expr2, cons
}
}
+Common::String ZBasic::midStr(const Common::String &str, int16 expr1, int16 expr2) {
+ Common::String result = str.substr(expr1-1, expr2);
+ return result;
+}
+
+void ZBasic::midStrSet(Common::String &target, int16 expr1, int16 expr2, const Common::String &src) {
+ for (int i = 0; i < expr2; i++) {
+ if (((expr1 + i - 1) >= (int)target.size()) || (i >= (int)src.size()))
+ break;
+ target[expr1 + i - 1] = src[i];
+ }
+}
+
+
void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
if (_fileStreams.contains(fileNo)) {
@@ -519,11 +533,16 @@ int16 ZBasic::readFileInt(int16 fileNo) {
return _fileStreams[fileNo]->readSint16BE();
}
-Common::U32String ZBasic::readFileStr(int16 fileNo, int16 length) {
+Common::String ZBasic::readFileStr(int16 fileNo, int16 length) {
if (!_fileStreams.contains(fileNo)) {
error("ZBasic::readFileStr: unknown fileNo %d", fileNo);
}
- return _fileStreams[fileNo]->readString(0, length).decode(Common::kMacRoman);
+ Common::String intermediate;
+ while ((length > 0) && !_fileStreams[fileNo]->eos()) {
+ intermediate.push_back((char)_fileStreams[fileNo]->readByte());
+ length--;
+ }
+ return intermediate;
}
void ZBasic::record(int16 fileNo, int16 recordNo, int16 location) {
@@ -626,11 +645,21 @@ void ZBasic::stringCopy(Common::U32String &target, const Common::U32String &src)
target = src;
}
-void ZBasic::writeFileStr(int16 fileNo, const Common::U32String &str) {
+void ZBasic::writeFileStr(int16 fileNo, const Common::String &str) {
if (!_fileWriteStreams.contains(fileNo)) {
error("ZBasic::writeFileStr: unknown fileNo %d", fileNo);
}
- _fileWriteStreams[fileNo]->writeString(str.encode(Common::kMacRoman));
+
+ if (str.empty())
+ return;
+
+ if (debugChannelSet(5, kDebugLoading)) {
+ debugC(5, kDebugLoading, "ZBasic::writeFileStr:");
+ Common::hexdump((const byte *)str.c_str(), (int)str.size());
+ }
+ for (uint i = 0; i < str.size(); i++) {
+ _fileWriteStreams[fileNo]->writeByte(str[i]);
+ }
}
void ZBasic::writeFileInt(int16 fileNo, int16 data) {
@@ -647,7 +676,7 @@ void ZBasic::writeFileDblInt(int16 fileNo, int32 data) {
_fileWriteStreams[fileNo]->writeSint32BE(data);
}
-Common::U32String ZBasic::unk_88(uint16 unk1) {
+Common::String ZBasic::unk_88(uint16 unk1) {
// convert uint16 data into string bytes.
// all of the toolbox APIs use U32String and convert when
// necessary to MacRoman, and unfortunately that's what
@@ -655,7 +684,7 @@ Common::U32String ZBasic::unk_88(uint16 unk1) {
Common::String inter;
inter.push_back((char)(unk1 >> 8));
inter.push_back((char)(unk1 & 0xff));
- return inter.decode(Common::kMacRoman);
+ return inter;
}
void ZBasic::unk_130(int16 unk1) {
@@ -666,15 +695,14 @@ void ZBasic::unk_158() {
warning("STUB: ZBasic::unk_158");
}
-uint16 ZBasic::unk_310(const Common::U32String &unk1) {
- Common::String inter = unk1.encode(Common::kMacRoman);
+uint16 ZBasic::unk_310(const Common::String &unk1) {
uint16 result = 0;
- if (inter.size() == 0)
+ if (unk1.size() == 0)
return result;
- result |= (byte)(inter[0]) << 8;
- if (inter.size() == 1)
+ result |= (byte)(unk1[0]) << 8;
+ if (unk1.size() == 1)
return result;
- result |= (byte)(inter[1]);
+ result |= (byte)(unk1[1]);
return result;
}
@@ -692,12 +720,27 @@ void ZBasic::indexSet(const Common::U32String &value, int16 table, int16 index)
return;
}
if (!_index.contains(table)) {
- _index[table] = Common::Array<Common::U32String>();
+ _index[table] = Common::Array<Common::String>();
}
if (_index[table].size() <= (uint)index) {
_index[table].resize(index+1);
}
- debugC(5, kDebugLoading, "ZBasic::indexSet: [%d][%d] = %s", table, index, value.encode().c_str());
+ debugC(5, kDebugLoading, "ZBasic::indexSet: [%d][%d] = %s", table, index, value.encode(Common::kMacRoman).c_str());
+ _index[table][index] = value.encode(Common::kMacRoman);
+}
+
+void ZBasic::indexRawSet(const Common::String &value, int16 table, int16 index) {
+ if (index < 0) {
+ warning("ZBasic::indexRawSet: index must be positive, not %d", index);
+ return;
+ }
+ if (!_index.contains(table)) {
+ _index[table] = Common::Array<Common::String>();
+ }
+ if (_index[table].size() <= (uint)index) {
+ _index[table].resize(index+1);
+ }
+ debugC(5, kDebugLoading, "ZBasic::indexRawSet: [%d][%d] = %s", table, index, value.c_str());
_index[table][index] = value;
}
@@ -714,7 +757,24 @@ Common::U32String ZBasic::index(int16 table, int16 index) {
warning("ZBasic::index: asked for index %d but only %d entries in table %d", index, _index[table].size(), table);
return Common::U32String();
}
- debugC(5, kDebugLoading, "ZBasic::index: [%d][%d] = %s", table, index, _index[table][index].encode().c_str());
+ debugC(5, kDebugLoading, "ZBasic::index: [%d][%d] = %s", table, index, _index[table][index].c_str());
+ return _index[table][index].decode(Common::kMacRoman);
+}
+
+Common::String ZBasic::indexRaw(int16 table, int16 index) {
+ if (index < 0) {
+ warning("ZBasic::indexRaw: index must be positive, not %d", index);
+ return Common::String();
+ }
+ if (!_index.contains(table)) {
+ warning("ZBasic::indexRaw: table %d not found", table);
+ return Common::String();
+ }
+ if (_index[table].size() <= (uint)index) {
+ warning("ZBasic::indexRaw: asked for index %d but only %d entries in table %d", index, _index[table].size(), table);
+ return Common::String();
+ }
+ debugC(5, kDebugLoading, "ZBasic::indexRaw: [%d][%d] = %s", table, index, _index[table][index].c_str());
return _index[table][index];
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 6cb101bf358..a82e1c1e524 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -224,7 +224,7 @@ private:
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableWriteStream>> _fileWriteStreams;
Common::HashMap<int16, uint32> _fileLineSize;
- Common::HashMap<int16, Common::Array<Common::U32String>> _index;
+ Common::HashMap<int16, Common::Array<Common::String>> _index;
Common::String _fileType;
Common::String _fileCreator;
@@ -255,6 +255,8 @@ public:
Common::U32String rightStr(const Common::U32String &str, int16 expression);
Common::U32String midStr(const Common::U32String &str, int16 expr1, int16 expr2);
void midStrSet(Common::U32String &target, int16 expr1, int16 expr2, const Common::U32String &src);
+ Common::String midStr(const Common::String &str, int16 expr1, int16 expr2);
+ void midStrSet(Common::String &target, int16 expr1, int16 expr2, const Common::String &src);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
@@ -268,7 +270,7 @@ public:
uint32 readFile(int16 fileNo, byte *dest, uint32 length);
int32 readFileDblInt(int16 fileNo);
int16 readFileInt(int16 fileNo);
- Common::U32String readFileStr(int16 fileNo, int16 length);
+ Common::String readFileStr(int16 fileNo, int16 length);
void record(int16 fileNo, int16 recordNo, int16 location);
int16 rndInt(int16 max);
Common::U32String space(int16 count);
@@ -276,7 +278,7 @@ public:
void swapStr(Common::U32String &a, Common::U32String &b);
void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
- void writeFileStr(int16 fileNo, const Common::U32String &str);
+ void writeFileStr(int16 fileNo, const Common::String &str);
void writeFileInt(int16 fileNo, int16 data);
void writeFileDblInt(int16 fileNo, int32 data);
Common::U32String ucase(const Common::U32String &str);
@@ -292,15 +294,17 @@ public:
void unk_20();
bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
void unk_44(int16 unk1);
- Common::U32String unk_88(uint16 unk1);
+ Common::String unk_88(uint16 unk1);
void stringCopy(Common::U32String &dest, const Common::U32String &src);
void unk_130(int16 unk1);
void unk_158();
- uint16 unk_310(const Common::U32String &unk1);
+ uint16 unk_310(const Common::String &unk1);
void unk_331(uint16 unk1, int16 unk2);
void unk_333(uint16 unk1);
void indexSet(const Common::U32String &value, int16 table, int16 index);
+ void indexRawSet(const Common::String &value, int16 table, int16 index);
Common::U32String index(int16 table, int16 index);
+ Common::String indexRaw(int16 table, int16 index);
};
} // namespace Fool
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 1c2015f8be8..c528269a3e0 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -1669,6 +1669,8 @@ bool MacMenu::mouseRelease(int x, int y) {
void MacMenu::getMenuShortCut(uint16 key, int &menuItem, int &submenuItem) {
menuItem = -1;
submenuItem = -1;
+ if (!key)
+ return;
uint16 ascii = tolower(key);
for (uint i = 0; i < _items.size(); i++) {
if (_items[i]->enabled && _items[i]->submenu != nullptr) {
@@ -1676,6 +1678,7 @@ void MacMenu::getMenuShortCut(uint16 key, int &menuItem, int &submenuItem) {
if (_items[i]->submenu->items[j]->enabled && tolower(_items[i]->submenu->items[j]->shortcut) == ascii) {
menuItem = (int)i;
submenuItem = (int)j;
+ return;
}
}
}
Commit: d1c4b064e56af613131b04649e23a450c72fba32
https://github.com/scummvm/scummvm/commit/d1c4b064e56af613131b04649e23a450c72fba32
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:15+02:00
Commit Message:
FOOL: Always use software framelimiter
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/toolbox.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 0c99f0a1919..70a7189461a 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -323,14 +323,14 @@ void FoolGame::sub_128_3da(int16 unk1) {
this->var_i32_68e = g_toolbox->TickCount();
do {
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
} while (g_toolbox->TickCount() < (this->var_i32_68e + unk1));
}
void FoolGame::sub_128_406(int16 unk1) {
// 128:0402
do {
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
} while (g_toolbox->TickCount() < (this->var_i32_692 + unk1));
}
@@ -397,7 +397,7 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
g_zbasic->sound(this->var_i16_30, this->var_i16_32, 0x96, 0);
if (this->var_i16_34 == 1) {
while (g_zbasic->unk_5()) {
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
}
}
}
@@ -599,7 +599,7 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
// wait for vsync if no events were received.
this->var_i16_78a = g_toolbox->GetNextEvent(-1, this->var_ev_46);
if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
this->var_i16_3a += 1;
}
} while (!((this->var_i16_3a >= (unk1*60/1000)) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
@@ -738,7 +738,6 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:1522
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, this->var_ev_46);
- g_toolbox->Delay(0);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kMouseDown) {
// 128:154a
@@ -798,6 +797,8 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_7be = 1;
}
}
+ if (this->var_ev_46.what == kNullEvent)
+ g_toolbox->Delay(0);
// 128:175c
} while (this->var_i16_7be == 0);
@@ -1400,7 +1401,7 @@ void FoolGame::sub_128_2e3e() {
this->sunMapTileID[i] = g_zbasic->readFileInt(2);
debugCN(5, kDebugLoading, "%d, ", this->sunMapTileID[i]);
}
- debugC(5, kDebugLoading, "");
+ debugCN(5, kDebugLoading, "\n");
// 128:2f84
g_zbasic->close(2);
if (this->var_i16_7e6 != 0) {
@@ -2416,7 +2417,7 @@ void FoolGame::sub_128_6186() {
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
}
@@ -2428,7 +2429,7 @@ void FoolGame::sub_128_61c2() {
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
} while ((this->var_ev_46.what != kMouseDown));
this->sub_128_6186();
}
@@ -2445,7 +2446,7 @@ void FoolGame::sub_128_61ec() {
this->sub_128_6154();
}
if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
} while (!((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp)));
this->keyLastPressed = 0;
}
@@ -2461,7 +2462,7 @@ void FoolGame::sub_128_6244() {
if (this->var_ev_46.what == kDiskEvt) {
this->sub_128_6154();
}
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
} while ((this->var_ev_46.what == kNullEvent) && ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0));
// SEGMENT_RETURN
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 5c30f3d5f0f..309d09a8593 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -236,7 +236,7 @@ void FoolGame::polyominoRun() {
}
// yield to renderer
if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(1);
+ g_toolbox->Delay(0);
}
// 133:0800
} while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0));
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 629c368adab..f0b00aff0ee 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -413,7 +413,8 @@ void FoolPrologue::sub_128_e58() {
return;
}
// wait until next redraw
- g_toolbox->Delay(1);
+ if (this->var_ev_22.what == kNullEvent)
+ g_toolbox->Delay(0);
}
this->sub_128_e80();
}
@@ -438,7 +439,8 @@ void FoolPrologue::sub_128_e80() {
break;
}
// wait until next redraw
- g_toolbox->Delay(1);
+ if (this->var_ev_22.what == kNullEvent)
+ g_toolbox->Delay(0);
}
}
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index d4c16b3dc20..46952484329 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -158,7 +158,7 @@ static const struct MacKeyCodeMapping {
Toolbox::Toolbox() {
- _frameLimiter = new Graphics::FrameLimiter(g_system, 60);
+ _frameLimiter = new Graphics::FrameLimiter(g_system, 60, false);
for (const MacKeyCodeMapping *k = MackeyCodeMappings; k->scummvm != Common::KEYCODE_INVALID; k++)
_keyMap[k->scummvm] = k->mac;
}
@@ -274,10 +274,13 @@ void Toolbox::_updateScreen() {
uint32 Toolbox::Delay(uint32 numTicks) {
uint32 target = g_system->getMillis() + (numTicks * 1000 / 60);
+ int updateCount = 0;
do {
_pumpEvents();
_updateScreen();
+ updateCount++;
} while (g_system->getMillis() < target);
+ //debugC(8, kDebugGraphics, "Toolbox::Delay: %d screen updates in %d ticks", updateCount, numTicks);
return (uint32)(g_system->getMillis() * 60 / 1000);
}
Commit: 5b42890f337b7cd5b5c18fbe44d125dbe48464a9
https://github.com/scummvm/scummvm/commit/5b42890f337b7cd5b5c18fbe44d125dbe48464a9
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:15+02:00
Commit Message:
FOOL: Fix memory overflow for puzzle completion status data
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 70a7189461a..816a26950ea 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -157,7 +157,7 @@ void FoolGame::sub_128_004() {
this->sub_128_1f76();
}
if ((this->var_i16_7d0 == 0x10) &&
- (this->arr_i16_1c7a[0] < 0x64) &&
+ (this->puzzleCompletionStatus[0x10] < 0x64) &&
(this->var_ev_46.where.y > 0x113) &&
(this->var_ev_46.where.x < 0x8c)) {
this->sub_128_1c2c(0x80);
@@ -939,7 +939,7 @@ void FoolGame::sub_128_1f76() {
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
} else {
// 128:1fee
- if ((this->var_i16_7d0 == 0x10) && (this->arr_i16_1c7a[0] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
+ if ((this->var_i16_7d0 == 0x10) && (this->puzzleCompletionStatus[0x10] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
return;
}
// 128:2042
@@ -1041,11 +1041,11 @@ void FoolGame::storyRenderPage() {
// 128:235e
if (this->arr_i16_18b2[this->var_i16_7d0] > 0) {
this->var_str_384 = g_zbasic->str(10); // ?
- if (this->arr_i16_1c5a[this->var_i16_7d0] == 0x63) {
+ if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x63) {
this->var_str_384 = g_zbasic->str(11); // ~
}
// 128:23b8
- if (this->arr_i16_1c5a[this->var_i16_7d0] >= 0x64) {
+ if (this->puzzleCompletionStatus[this->var_i16_7d0] >= 0x64) {
this->var_str_384 = g_zbasic->str(12); // *
}
// 128:23e8
@@ -1330,7 +1330,7 @@ void FoolGame::sub_128_2bc6() {
this->var_i16_484 = g_zbasic->rndInt(0x51);
this->var_i16_7e4 = g_zbasic->rndInt(0x51);
g_zbasic->swapInt(this->sunMapTileID[this->var_i16_484], this->sunMapTileID[this->var_i16_7e4]);
- this->arr_i16_1c5a[i] = 0;
+ this->puzzleCompletionStatus[i] = 0;
this->arr_i16_1d24[i] = 0;
}
// 128:2d6a
@@ -1385,10 +1385,10 @@ void FoolGame::sub_128_2e3e() {
this->var_i16_7d2 = g_zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
this->arr_i16_1d24[i] = g_zbasic->readFileInt(2);
- this->arr_i16_1c5a[i] = g_zbasic->readFileInt(2);
+ this->puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
this->arr_i16_1b90[i] = g_zbasic->readFileInt(2);
this->var_i16_484 = g_zbasic->readFileInt(2);
- debugC(5, kDebugLoading, "sub_128_2e3e: puzzle %d:, arr_i16_1d24: %d, arr_i16_1c5a: %d, arr_i16_1b90: %d, payload size: %d", i, this->arr_i16_1d24[i], this->arr_i16_1c5a[i], this->arr_i16_1b90[i], this->var_i16_484);
+ debugC(5, kDebugLoading, "sub_128_2e3e: puzzle %d:, arr_i16_1d24: %d, puzzleCompletionStatus: %d, arr_i16_1b90: %d, payload size: %d", i, this->arr_i16_1d24[i], this->puzzleCompletionStatus[i], this->arr_i16_1b90[i], this->var_i16_484);
Common::String state = g_zbasic->readFileStr(2, this->var_i16_484);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)state.c_str(), this->var_i16_484);
@@ -1432,7 +1432,7 @@ void FoolGame::sub_128_3032() {
for (int i = 1; i <= 0x10; i++) {
this->var_i16_484++;
this->var_i16_9f2 = this->arr_i16_1d24[this->var_i16_484] & 3;
- if (this->arr_i16_1c5a[this->var_i16_484] == 0x63) {
+ if (this->puzzleCompletionStatus[this->var_i16_484] == 0x63) {
this->var_str_384 = g_zbasic->str(39);
} else {
// 128:30e4
@@ -1554,7 +1554,7 @@ void FoolGame::sub_128_3536() {
g_zbasic->writeFileInt(2, this->var_i16_7d2);
for (int i = 1; i <= 0x64; i++) {
g_zbasic->writeFileInt(2, this->arr_i16_1d24[i]);
- g_zbasic->writeFileInt(2, this->arr_i16_1c5a[i]);
+ g_zbasic->writeFileInt(2, this->puzzleCompletionStatus[i]);
g_zbasic->writeFileInt(2, this->arr_i16_1b90[i]);
Common::String state = g_zbasic->indexRaw(2, i);
g_zbasic->writeFileInt(2, (int16)state.size());
@@ -1737,10 +1737,10 @@ void FoolGame::sub_128_39a0() {
}
// 128:3aea
g_zbasic->unk_333(1);
- if (this->arr_i16_1c5a[this->var_i16_7d0] == 0x63) {
+ if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x63) {
this->sub_128_3de6();
}
- if (this->arr_i16_1c5a[this->var_i16_7d0] == 0x64) {
+ if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x64) {
if (this->var_i16_7d0 == 0x41) {
if ((this->arr_i16_1d24[0x41] & 2) != 0) {
this->arr_i16_1d24[0x41] ^= 2;
@@ -1828,7 +1828,7 @@ void FoolGame::sub_128_3de6() {
this->var_i16_7e4 = 1 + ((this->var_i16_7d0 - 1) % 0x10);
if (this->arr_i16_197c[this->var_i16_7d0] == 0) {
this->var_i16_9f2 = 1;
- this->arr_i16_1c5a[this->var_i16_7d0] = 0x64;
+ this->puzzleCompletionStatus[this->var_i16_7d0] = 0x64;
} else {
// 128:3f66
this->var_i16_9f2 = 2;
@@ -1868,7 +1868,7 @@ void FoolGame::sub_128_3fb6() {
void FoolGame::sub_128_4168() {
// 128:4168
- this->var_i16_c04 = this->arr_i16_1c5a[this->activePuzzle];
+ this->var_i16_c04 = this->puzzleCompletionStatus[this->activePuzzle];
if (this->var_i16_c04 == 0x64) {
this->var_i16_c04 = 0x65;
}
@@ -1882,7 +1882,7 @@ void FoolGame::sub_128_4168() {
void FoolGame::sub_128_41aa() {
// 128:41aa
- this->arr_i16_1c5a[this->activePuzzle] = this->var_i16_c04;
+ this->puzzleCompletionStatus[this->activePuzzle] = this->var_i16_c04;
g_zbasic->indexRawSet(this->activePuzzleBuffer, 2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = this->activePuzzleBuffer;
@@ -1897,21 +1897,21 @@ void FoolGame::sub_128_41d8() {
this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[this->activePuzzle]*8)];
}
// 128:422e
- if ((this->activePuzzle == 0x34) && (this->arr_i16_1cc2 > 1)) {
+ if ((this->activePuzzle == 0x34) && (this->puzzleCompletionStatus[0x34] > 1)) {
// 128:4262
- if (this->arr_i16_1cc2 == 2) {
+ if (this->puzzleCompletionStatus[0x34] == 2) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 2;
this->arr_i16_4758[2] = 0xa;
}
// 128:42aa
- if (this->arr_i16_1cc2 == 3) {
+ if (this->puzzleCompletionStatus[0x34] == 3) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 3;
this->arr_i16_4758[2] = 0;
}
// 128:42f0
- if (this->arr_i16_1cc2 >= 4) {
+ if (this->puzzleCompletionStatus[0x34] >= 4) {
if (this->var_i16_7d2 == 0) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 0x47;
@@ -1924,20 +1924,20 @@ void FoolGame::sub_128_41d8() {
// 128:4348
}
// 128:4348
- if ((this->activePuzzle == 0x17) && (this->arr_i16_1c7a[15] == 0x63)) {
+ if ((this->activePuzzle == 0x17) && (this->puzzleCompletionStatus[0x17] == 0x63)) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 2;
this->arr_i16_4758[1] = 0xa;
}
// 128:43aa
- if ((this->activePuzzle == 0x3f) && (this->arr_i16_1cd8 == 0x63)) {
+ if ((this->activePuzzle == 0x3f) && (this->puzzleCompletionStatus[0x3f] == 0x63)) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 3;
this->arr_i16_4758[2] = 0;
}
// 128:440a
if (this->activePuzzle == 0x48) {
- if (this->arr_i16_1cea == 0x63) {
+ if (this->puzzleCompletionStatus[0x48] == 0x63) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 0x47;
this->arr_i16_4758[2] = 0;
@@ -2090,7 +2090,7 @@ void FoolGame::sub_128_4a92() {
this->var_i16_68c = 0;
for (int i = 2; i <= 0x50; i++) {
this->var_i16_68a = 2;
- if ((this->arr_i16_1c5a[i] < 0x63) && (this->arr_i16_18b2[i] > 0)) {
+ if ((this->puzzleCompletionStatus[i] < 0x63) && (this->arr_i16_18b2[i] > 0)) {
this->var_i16_68c++;
}
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 8c386000f2c..1c8766868ed 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -473,11 +473,7 @@ private:
int16 pageToChapter[101]; // arr_i16_1a46
int16 arr_i16_1b10[6969];
int16 arr_i16_1b90[101];
- int16 arr_i16_1c5a[16];
- int16 arr_i16_1c7a[16];
- int16 arr_i16_1cc2;
- int16 arr_i16_1cd8;
- int16 arr_i16_1cea;
+ int16 puzzleCompletionStatus[101]; // arr_i16_1c5a
int16 arr_i16_1d24[101];
int16 arr_i16_1dee[202];
int16 arr_i16_1eb8[0x29];
Commit: 3b7d2ad4ca66072f73f573cc634c703376299035
https://github.com/scummvm/scummvm/commit/3b7d2ad4ca66072f73f573cc634c703376299035
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:15+02:00
Commit Message:
FOOL: Fix King Of ... page visibility
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 816a26950ea..7c280d4bf93 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -977,7 +977,7 @@ void FoolGame::sub_128_20d0() {
this->storyNextPage = this->storyPageCount;
return;
}
- } while (this->arr_i16_1b90[this->storyNextPage] == 0);
+ } while (this->pageVisible[this->storyNextPage] == 0);
this->storyRenderPage();
}
@@ -1300,6 +1300,7 @@ void FoolGame::sub_128_2bc6() {
this->var_str_8ec = g_zbasic->str(33);
this->var_i16_9ec = 0;
+ // set up the initially visible story chapters
this->arr_i16_4758[0] = 0x103;
this->arr_i16_4758[1] = 0;
this->arr_i16_4758[2] = 0x1e;
@@ -1312,10 +1313,10 @@ void FoolGame::sub_128_2bc6() {
for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
if (this->arr_i16_4758[j] & this->bitLUT[i]) {
- this->arr_i16_1b90[this->var_i16_484] = 1;
+ this->pageVisible[this->var_i16_484] = 1;
} else {
// 128:2ca6
- this->arr_i16_1b90[this->var_i16_484] = 0;
+ this->pageVisible[this->var_i16_484] = 0;
}
// 128:2cb6
}
@@ -1326,6 +1327,7 @@ void FoolGame::sub_128_2bc6() {
}
g_zbasic->unk_20();
// 128:2cf6
+ // shuffle around the pieces of the sun's map
for (int i = 1; i <= 0x64; i++) {
this->var_i16_484 = g_zbasic->rndInt(0x51);
this->var_i16_7e4 = g_zbasic->rndInt(0x51);
@@ -1339,7 +1341,7 @@ void FoolGame::sub_128_2bc6() {
if (this->pageToChapter[i] == this->var_i16_484+1) {
// 128:2d9c
this->var_i16_484++;
- if (this->arr_i16_1b90[i] == 1) {
+ if (this->pageVisible[i] == 1) {
if (this->arr_i16_197c[this->var_i16_484] != 0) {
this->var_i16_9f2 = 2;
} else {
@@ -1386,9 +1388,9 @@ void FoolGame::sub_128_2e3e() {
for (int i = 1; i <= 0x64; i++) {
this->arr_i16_1d24[i] = g_zbasic->readFileInt(2);
this->puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
- this->arr_i16_1b90[i] = g_zbasic->readFileInt(2);
+ this->pageVisible[i] = g_zbasic->readFileInt(2);
this->var_i16_484 = g_zbasic->readFileInt(2);
- debugC(5, kDebugLoading, "sub_128_2e3e: puzzle %d:, arr_i16_1d24: %d, puzzleCompletionStatus: %d, arr_i16_1b90: %d, payload size: %d", i, this->arr_i16_1d24[i], this->puzzleCompletionStatus[i], this->arr_i16_1b90[i], this->var_i16_484);
+ debugC(5, kDebugLoading, "sub_128_2e3e: puzzle %d:, arr_i16_1d24: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, this->arr_i16_1d24[i], this->puzzleCompletionStatus[i], this->pageVisible[i], this->var_i16_484);
Common::String state = g_zbasic->readFileStr(2, this->var_i16_484);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)state.c_str(), this->var_i16_484);
@@ -1555,7 +1557,7 @@ void FoolGame::sub_128_3536() {
for (int i = 1; i <= 0x64; i++) {
g_zbasic->writeFileInt(2, this->arr_i16_1d24[i]);
g_zbasic->writeFileInt(2, this->puzzleCompletionStatus[i]);
- g_zbasic->writeFileInt(2, this->arr_i16_1b90[i]);
+ g_zbasic->writeFileInt(2, this->pageVisible[i]);
Common::String state = g_zbasic->indexRaw(2, i);
g_zbasic->writeFileInt(2, (int16)state.size());
g_zbasic->writeFileStr(2, state);
@@ -1741,6 +1743,7 @@ void FoolGame::sub_128_39a0() {
this->sub_128_3de6();
}
if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x64) {
+ // bodge for completing The Chariot
if (this->var_i16_7d0 == 0x41) {
if ((this->arr_i16_1d24[0x41] & 2) != 0) {
this->arr_i16_1d24[0x41] ^= 2;
@@ -1755,17 +1758,17 @@ void FoolGame::sub_128_39a0() {
}
// 128:3c04
this->storyNextPage = 0;
- this->var_i16_68c = 0x42;
+ // enable the four King Of ... chapters
for (int i = 0x42; i <= 0x45; i++) {
for (int j = 1; j <= this->storyPageCount; j++) {
if (this->pageToChapter[j] == i) {
- this->arr_i16_1b90[j] = 1;
+ this->pageVisible[j] = 1;
if ((i == 0x42) && (this->storyNextPage == 0)) {
this->storyNextPage = j;
}
}
// 128:3c6c
- if (this->pageToChapter[j] < i) {
+ if (this->pageToChapter[j] > i) {
j = this->storyPageCount;
}
// 128:3c8e
@@ -1811,7 +1814,7 @@ void FoolGame::sub_128_3de6() {
for (int i = 1; i <= this->storyPageCount; i++ ) {
// 128:3e56
if (this->pageToChapter[i] == this->arr_i16_197c[this->var_i16_7d0]) {
- this->arr_i16_1b90[i] = 1;
+ this->pageVisible[i] = 1;
if (this->storyNextPage == 0) {
this->storyNextPage = i;
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 1c8766868ed..3d9053441d9 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -472,7 +472,7 @@ private:
int16 arr_i16_197c[101];
int16 pageToChapter[101]; // arr_i16_1a46
int16 arr_i16_1b10[6969];
- int16 arr_i16_1b90[101];
+ int16 pageVisible[101]; // arr_i16_1b90
int16 puzzleCompletionStatus[101]; // arr_i16_1c5a
int16 arr_i16_1d24[101];
int16 arr_i16_1dee[202];
Commit: dc4004278a392a78b16dfe891c9d360f39b73422
https://github.com/scummvm/scummvm/commit/dc4004278a392a78b16dfe891c9d360f39b73422
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:16+02:00
Commit Message:
FOOL: Name more state flags
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 066858cefbd..db50bbd962f 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -135,7 +135,7 @@ void FoolGame::cardsRun() {
}
if (this->stateFlags == 4) {
this->cardsStoreState();
- this->sub_128_3536();
+ this->saveGame();
}
// 139:04c4
}
@@ -288,7 +288,7 @@ void FoolGame::cardsOnClick() {
}
if (this->stateFlags == 4) {
this->cardsStoreState();
- this->sub_128_3536();
+ this->saveGame();
}
if (this->var_ev_46.what == kNullEvent) {
g_toolbox->Delay(0);
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 1cd07b9d02a..5dae2e4d5de 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -66,10 +66,10 @@ void FoolGame::deathRun() {
if (this->stateFlags == 2) {
this->stateFlags = 0;
}
- if (this->stateFlags == 4) {
- this->sub_128_3536();
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
}
- if ((this->stateFlags & 1)) {
+ if ((this->stateFlags & kStateReturn)) {
// 141:09f6
this->deathDrawWhiteEye();
return;
@@ -90,8 +90,8 @@ void FoolGame::deathRun() {
if (this->stateFlags == 2) {
this->stateFlags = 0;
}
- if (this->stateFlags == 4) {
- this->sub_128_3536();
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
}
if (this->var_ev_46.what == kNullEvent)
g_toolbox->Delay(0);
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 7c280d4bf93..1127fb6a2f8 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -160,28 +160,28 @@ void FoolGame::sub_128_004() {
(this->puzzleCompletionStatus[0x10] < 0x64) &&
(this->var_ev_46.where.y > 0x113) &&
(this->var_ev_46.where.x < 0x8c)) {
- this->sub_128_1c2c(0x80);
+ this->setStateBits(0x80);
}
// 128:1de0
if (this->var_i16_7d2 && (this->keyLastPressed == 0x20)) {
- this->sub_128_1c2c(0x100);
+ this->setStateBits(0x100);
}
// 128:1e06
} while (this->stateFlags == 0);
if (this->stateFlags & kStateReturn) {
- this->sub_128_1c4a(1);
+ this->clearStateBits(kStateReturn);
}
- if (this->stateFlags & 0x4) {
- this->sub_128_3536();
+ if (this->stateFlags & kStateSaveGame) {
+ this->saveGame();
}
- if (this->stateFlags & 0x8) {
- this->sub_128_2bc6();
+ if (this->stateFlags & kStateNewGame) {
+ this->newGame();
}
- if (this->stateFlags & 0x10) {
- this->sub_128_2e3e();
+ if (this->stateFlags & kStateOpenGame) {
+ this->openGame();
}
- if (this->stateFlags & 0x40) {
+ if (this->stateFlags & kStateChapterSelect) {
this->menuChapterSelect();
}
if (this->stateFlags & 0x200) {
@@ -212,6 +212,7 @@ void FoolGame::sub_128_004() {
}
void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
+ warning("sub_128_0a2: unk2 %d, unk1 0x%04x", unk2, unk1);
// 128:00a2
this->var_i16_32 = unk1;
this->var_i16_30 = unk2;
@@ -574,7 +575,7 @@ void FoolGame::sub_128_c6a(uint32 unk1) {
this->sub_128_6154();
}
if ((this->var_ev_46.what == kScummVMQuitEvt) || (this->var_ev_46.what == kScummVMReturnToLauncherEvt)) {
- this->sub_128_2ab6();
+ this->menuQuit();
}
}
@@ -890,12 +891,12 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
g_toolbox->PenNormal();
}
-void FoolGame::sub_128_1c2c(int16 unk1) {
+void FoolGame::setStateBits(int16 unk1) {
this->var_i16_30 = unk1;
this->stateFlags |= this->var_i16_30;
}
-void FoolGame::sub_128_1c4a(int16 unk1) {
+void FoolGame::clearStateBits(int16 unk1) {
// 128:1c4a
this->var_i16_30 = unk1;
if (this->stateFlags & this->var_i16_30) {
@@ -917,7 +918,7 @@ void FoolGame::sub_128_1f44() {
// 128:1f44
this->sub_128_61ec();
this->storyCurrentPage = 0;
- this->sub_128_1c4a(0x200);
+ this->clearStateBits(0x200);
this->sub_128_5fea();
this->sub_128_0a2(1, 0);
this->storyRenderPage();
@@ -982,7 +983,7 @@ void FoolGame::sub_128_20d0() {
}
void FoolGame::menuChapterSelect() {
- this->sub_128_1c4a(0x40);
+ this->clearStateBits(kStateChapterSelect);
// 128:2132
for (int i = this->selectedMenuChapter; i <= this->storyPageCount; i++) {
if (this->selectedMenuChapter == this->pageToChapter[i]) {
@@ -1008,9 +1009,9 @@ void FoolGame::menuChapterSelect() {
void FoolGame::sub_128_21c8() {
// 128:21c8
if ((this->var_i16_7d0 == 1) && (this->var_i16_7d2 > 0)) {
- this->sub_128_1c2c(0x100);
+ this->setStateBits(0x100);
} else {
- this->sub_128_1c2c(0x80);
+ this->setStateBits(0x80);
}
}
@@ -1150,15 +1151,15 @@ void FoolGame::sub_128_271a() {
}
// new game
-void FoolGame::sub_128_27d6() {
+void FoolGame::menuNewGame() {
// 128:27d6
this->sub_128_32fa();
if (this->var_i16_7be == 3)
return;
if (this->var_i16_7ce & 1) {
- this->sub_128_1c2c(8 | kStateReturn);
+ this->setStateBits(kStateNewGame | kStateReturn);
} else {
- this->sub_128_1c2c(8);
+ this->setStateBits(kStateNewGame);
}
}
@@ -1203,7 +1204,7 @@ void FoolGame::sub_128_2808() {
}
}
-void FoolGame::sub_128_2988() {
+void FoolGame::menuOpenGame() {
// 128:2988
// File -> Open
this->sub_128_1e4(g_zbasic->str(21)); // FOOL
@@ -1218,19 +1219,19 @@ void FoolGame::sub_128_2988() {
// 128:29d4
if (this->var_i16_7be != 3) {
if ((this->var_i16_7ce & 1) != 0) {
- this->sub_128_1c2c(0x11);
+ this->setStateBits(kStateOpenGame | kStateReturn);
} else {
// 128:29fa
- this->sub_128_1c2c(0x10);
+ this->setStateBits(kStateOpenGame);
}
this->sub_128_3774();
}
}
-void FoolGame::sub_128_2a06() {
+void FoolGame::menuSaveGame() {
// 128:2a06
// File -> Save
- this->sub_128_1c2c(4);
+ this->setStateBits(kStateSaveGame);
}
void FoolGame::sub_128_2a0e() {
@@ -1250,32 +1251,32 @@ void FoolGame::sub_128_2a0e() {
}
}
-void FoolGame::sub_128_2a92() {
+void FoolGame::menuSaveGameAs() {
// 128:2a92
// File -> Save As
this->sub_128_2a0e();
if (this->var_str_486 != g_zbasic->str(29)) { // empty
- this->sub_128_1c2c(4);
+ this->setStateBits(kStateSaveGame);
}
}
// quit
-void FoolGame::sub_128_2ab6() {
+void FoolGame::menuQuit() {
// 128:2ab6
this->sub_128_32fa();
if (this->var_i16_7be == 3) {
return;
}
if ((this->var_i16_7ce & 1) != 0) {
- this->sub_128_1c2c(kStateQuit | kStateReturn);
+ this->setStateBits(kStateQuit | kStateReturn);
} else {
- this->sub_128_1c2c(kStateQuit);
+ this->setStateBits(kStateQuit);
}
}
// print story
-void FoolGame::sub_128_2ae8() {
+void FoolGame::menuPrintStory() {
// 128:2ae8
if (this->var_i16_7ce & 1) {
this->stateFlags = 0x401;
@@ -1293,8 +1294,8 @@ void FoolGame::sub_128_2b0a() {
warning("STUB: %s", __func__);
}
-void FoolGame::sub_128_2bc6() {
- this->sub_128_1c4a(8);
+void FoolGame::newGame() {
+ this->clearStateBits(kStateNewGame);
this->sub_128_3774();
this->sub_128_3744();
this->var_str_8ec = g_zbasic->str(33);
@@ -1365,10 +1366,10 @@ void FoolGame::sub_128_2bc6() {
// 128:2e3c
}
-void FoolGame::sub_128_2e3e() {
+void FoolGame::openGame() {
// 128:2e3e
// save game loading code?
- this->sub_128_1c4a(0x10);
+ this->clearStateBits(kStateOpenGame);
this->sub_128_3774();
this->sub_128_3744();
this->var_str_8ec = this->var_str_588;
@@ -1390,7 +1391,7 @@ void FoolGame::sub_128_2e3e() {
this->puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
this->pageVisible[i] = g_zbasic->readFileInt(2);
this->var_i16_484 = g_zbasic->readFileInt(2);
- debugC(5, kDebugLoading, "sub_128_2e3e: puzzle %d:, arr_i16_1d24: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, this->arr_i16_1d24[i], this->puzzleCompletionStatus[i], this->pageVisible[i], this->var_i16_484);
+ debugC(5, kDebugLoading, "openGame: puzzle %d:, arr_i16_1d24: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, this->arr_i16_1d24[i], this->puzzleCompletionStatus[i], this->pageVisible[i], this->var_i16_484);
Common::String state = g_zbasic->readFileStr(2, this->var_i16_484);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)state.c_str(), this->var_i16_484);
@@ -1398,7 +1399,7 @@ void FoolGame::sub_128_2e3e() {
g_zbasic->indexRawSet(state, 2, i);
}
// 128:2f54
- debugCN(5, kDebugLoading, "sub_128_2e3e: sun map tile IDs: ");
+ debugCN(5, kDebugLoading, "openGame: sun map tile IDs: ");
for (int i = 1; i <= 0x51; i++) {
this->sunMapTileID[i] = g_zbasic->readFileInt(2);
debugCN(5, kDebugLoading, "%d, ", this->sunMapTileID[i]);
@@ -1411,9 +1412,9 @@ void FoolGame::sub_128_2e3e() {
this->arr_str_1a8d8[1] = g_zbasic->str(36);
this->var_i16_7e6 = 0;
if ((this->var_i16_7ce & 1) == 0) {
- this->sub_128_1c2c(9);
+ this->setStateBits(kStateNewGame | kStateReturn);
} else {
- this->sub_128_1c2c(8);
+ this->setStateBits(kStateNewGame);
}
} else {
// 128:302c
@@ -1472,9 +1473,9 @@ void FoolGame::sub_128_3032() {
this->sub_128_378a();
} else {
if ((this->activePuzzle > 0) && (this->activePuzzle <= 0x50)) {
- this->sub_128_1c2c(0x80);
+ this->setStateBits(0x80);
} else {
- this->sub_128_1c2c(0x100);
+ this->setStateBits(0x100);
}
}
// 128:3294
@@ -1517,13 +1518,13 @@ void FoolGame::sub_128_32fa() {
}
}
// 128:33e2
- this->sub_128_1c2c(4);
+ this->setStateBits(kStateSaveGame);
}
-void FoolGame::sub_128_3536() {
+void FoolGame::saveGame() {
// write save file
- this->sub_128_1c4a(4);
+ this->clearStateBits(kStateSaveGame);
if (this->var_i16_7ce == 0x29a)
return;
// 128:3548
@@ -1724,7 +1725,7 @@ void FoolGame::sub_128_39a0() {
// 128:3a8a
this->sub_128_5fea();
if (this->var_i16_7d2 == 1) {
- this->sub_128_1c2c(0x100);
+ this->setStateBits(0x100);
return;
}
// 128:3aa4
@@ -1797,7 +1798,7 @@ void FoolGame::sub_128_39a0() {
if ((this->var_i16_7ce & 1) == 0) {
this->var_i16_7ce ^= 1;
}
- if ((this->stateFlags & 0x40) == 0) {
+ if ((this->stateFlags & kStateChapterSelect) == 0) {
this->storyRenderPage();
}
}
@@ -2268,15 +2269,15 @@ void FoolGame::sub_128_5c20() {
}
if (this->selectedMenuID == 2) { // File menu
if (this->selectedMenuItem == 1) {
- this->sub_128_27d6();
+ this->menuNewGame();
} else if (this->selectedMenuItem == 2) {
// 128:5c5c
- this->sub_128_2988();
+ this->menuOpenGame();
} else if (this->selectedMenuItem == 3) {
// 128:5c6c
- this->sub_128_2a06();
+ this->menuSaveGame();
} else if (this->selectedMenuItem == 4) {
- this->sub_128_2a92();
+ this->menuSaveGameAs();
} else if (this->selectedMenuItem == 6) {
if (this->var_i16_378 == 0) {
this->var_i16_378 = 1;
@@ -2287,9 +2288,9 @@ void FoolGame::sub_128_5c20() {
this->sub_128_32c8();
// 128:5cc4
} else if (this->selectedMenuItem == 7) {
- this->sub_128_2ae8();
+ this->menuPrintStory();
} else if (this->selectedMenuItem == 9) {
- this->sub_128_2ab6();
+ this->menuQuit();
}
}
// 128:5cea
@@ -2314,31 +2315,32 @@ void FoolGame::sub_128_5c20() {
}
// 128:5dae
if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
- this->sub_128_1c2c(0x40);
+ this->setStateBits(kStateChapterSelect);
}
// 128:5df6
if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1)) {
- this->sub_128_1c2c(0x40);
+ this->setStateBits(kStateChapterSelect);
}
// 128:5e38
if (((this->var_i16_7ce & 1) != 0) && (this->var_i16_e1a == 0)) {
- this->sub_128_1c2c(0x40 | kStateReturn);
+ this->setStateBits(kStateChapterSelect | kStateReturn);
}
// 128:5e5e
if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
- this->sub_128_1c2c(0x40 | kStateReturn);
+ this->setStateBits(kStateChapterSelect | kStateReturn);
this->var_i16_7ce |= 0x4;
}
}
// 128:5eaa
if (this->selectedMenuID == 8) { // Puzzle menu
if (this->selectedMenuItem == 1) {
- this->sub_128_1c2c(kStateReturn);
+ // return to scroll / run for your life
+ this->setStateBits(kStateReturn);
}
// 128:5ec6
if ((this->selectedMenuItem == 3) && (this->var_i16_c00 == 1)) {
- this->sub_128_1c2c(2);
+ this->setStateBits(kStateUndo);
}
}
// 128:5eee
@@ -2376,9 +2378,9 @@ void FoolGame::sub_128_5fb4() {
g_toolbox->BeginUpdate(*this->var_ev_46.windowPtr);
g_toolbox->EndUpdate(*this->var_ev_46.windowPtr);
if ((this->var_i16_7ce & 1) != 0) {
- this->sub_128_1c2c(0x201);
+ this->setStateBits(0x200 | kStateReturn);
} else {
- this->sub_128_1c2c(0x200);
+ this->setStateBits(0x200);
}
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 3d9053441d9..3a1cb03e9f5 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -30,11 +30,15 @@
namespace Fool {
-enum FoolStateFlag : uint16 {
+enum FoolStateBits : uint16 {
kStateNull = 0x00,
kStateReturn = 0x01,
kStateUndo = 0x02,
+ kStateSaveGame = 0x04,
+ kStateNewGame = 0x08,
+ kStateOpenGame = 0x10,
kStateQuit = 0x20,
+ kStateChapterSelect = 0x40,
};
class FoolGame {
@@ -72,8 +76,8 @@ public:
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_178a(int16 unk2, int16 unk1);
- void sub_128_1c2c(int16 unk1);
- void sub_128_1c4a(int16 unk1);
+ void setStateBits(int16 unk1); // sub_128_1c2c
+ void clearStateBits(int16 unk1); // sub_128_1c4a
void sub_128_1f1e();
void sub_128_1f44();
void sub_128_1f76();
@@ -85,22 +89,22 @@ public:
void sub_128_2664();
void sub_128_26f6();
void sub_128_271a();
- void sub_128_27d6();
+ void menuNewGame(); // sub_128_27d6
void sub_128_2808();
- void sub_128_2988();
- void sub_128_2a06();
+ void menuOpenGame(); // sub_128_2988
+ void menuSaveGame(); // sub_128_2a06
void sub_128_2a0e();
- void sub_128_2a92();
- void sub_128_2ab6();
- void sub_128_2ae8();
+ void menuSaveGameAs(); // sub_128_2a92
+ void menuQuit(); // sub_128_2ab6
+ void menuPrintStory(); // sub_128_2ae8
void sub_128_2b0a();
- void sub_128_2bc6();
- void sub_128_2e3e();
+ void newGame(); // sub_128_2bc6
+ void openGame(); // sub_128_2e3e
void sub_128_3032();
void sub_128_32c8();
void sub_128_32fa();
- void sub_128_3536();
+ void saveGame(); // sub_128_3536
void sub_128_3744();
void sub_128_3774();
void sub_128_378a();
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index fe7c71f69bc..f707477982c 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -110,7 +110,7 @@ void FoolGame::jigsawRun() {
}
}
// 132:0464
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->jigsawCheckIfSolved();
@@ -118,10 +118,10 @@ void FoolGame::jigsawRun() {
// 132:04d8
// input loop
- while (((this->stateFlags & 1) == 0) && (this->var_i16_d0c == 0)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
// 132:0484
// 132:049c
- while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
+ while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0)) {
// 132:0488
this->sub_128_c6a(-1);
if (this->var_ev_46.what == kMouseDown) {
@@ -129,12 +129,12 @@ void FoolGame::jigsawRun() {
}
}
// 132:04b8
- if (this->stateFlags == 2) {
+ if (this->stateFlags == kStateUndo) {
this->jigsawCancelSelect();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->jigsawStoreState();
- this->sub_128_3536();
+ this->saveGame();
}
}
// 132:0500
@@ -284,7 +284,7 @@ void FoolGame::jigsawMoveSelected() {
void FoolGame::jigsawCancelSelect() {
// 132:0e5a
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
@@ -397,7 +397,7 @@ void FoolGame::jigsawCheckIfSolved() {
}
// 132:1430
if (this->var_i16_d0c != 0) {
- this->stateFlags = 1;
+ this->stateFlags = kStateReturn;
}
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 201918f085a..4b7cb3eb87d 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -288,7 +288,7 @@ void FoolGame::jumbleRun() {
default:
break;
}
- if ((this->stateFlags & 1) != 0) {
+ if ((this->stateFlags & kStateReturn) != 0) {
this->sub_130_c66();
this->jumbleCurrentSubPuzzle = this->jumbleSubPuzzleCount;
} else {
@@ -317,7 +317,7 @@ void FoolGame::jumbleRun() {
}
// 130:0a5c
}
- if ((this->stateFlags & 1) != 0) {
+ if ((this->stateFlags & kStateReturn) != 0) {
// JMP 0x2962
return;
}
@@ -386,8 +386,8 @@ void FoolGame::jumbleRun() {
void FoolGame::sub_130_c56() {
// 130:0c56
this->sub_130_c66();
- this->sub_128_3536();
- this->stateFlags = 0;
+ this->saveGame();
+ this->stateFlags = kStateNull;
}
void FoolGame::sub_130_c66() {
@@ -421,13 +421,13 @@ void FoolGame::sub_130_d2e() {
// 130:0d2e
this->sub_130_1426();
this->sub_128_61ec();
- this->stateFlags = 0;
- while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ this->stateFlags = kStateNull;
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -473,10 +473,10 @@ void FoolGame::sub_130_d90() {
this->var_i16_106e = 1;
this->sub_130_1c1a();
this->sub_128_61ec();
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
this->keyLastPressed = 0;
// 130:0fa0
- while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:0fa4
this->sub_128_c6a(-1);
if (this->keyLastPressed != 0) {
@@ -485,7 +485,7 @@ void FoolGame::sub_130_d90() {
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -501,10 +501,10 @@ void FoolGame::sub_130_1004() {
}
this->sub_130_20d2();
this->sub_128_61ec();
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
this->keyLastPressed = 0;
// 130:1042
- while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->sub_128_c6a(-1);
if (this->keyLastPressed != 0) {
this->sub_130_15da();
@@ -512,7 +512,7 @@ void FoolGame::sub_130_1004() {
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -533,14 +533,14 @@ void FoolGame::sub_130_10a6() {
}
// 130:1212
this->sub_128_61ec();
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
// 130:121c
- while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
this->sub_128_c6a(-1);
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -555,10 +555,10 @@ void FoolGame::sub_130_1282() {
this->sub_130_20d2();
this->sub_128_61ec();
this->var_i16_7b2 = 0;
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
this->keyLastPressed = 0;
g_toolbox->InitCursor();
- while (((this->stateFlags & 1) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:12cc
this->sub_128_c6a(-1);
if (this->keyLastPressed != 0) {
@@ -585,7 +585,7 @@ void FoolGame::sub_130_1282() {
}
// 130:13e2
this->var_i16_7b2 = this->var_i16_187c;
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 309d09a8593..7481ad679bd 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -244,11 +244,11 @@ void FoolGame::polyominoRun() {
if (this->stateFlags == kStateUndo) {
this->polyominoReset();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->polyominoStoreState();
- this->sub_128_3536();
+ this->saveGame();
}
- } while (((this->stateFlags & 1) == 0) && (this->var_i16_d0c == 0));
+ } while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0));
// 133:0864
if (this->var_i16_d0c != 0) {
this->polyominoSuccess();
@@ -474,7 +474,7 @@ void FoolGame::polyominoReset() {
// 133:12c2
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
}
void FoolGame::polyominoDrawFrame() {
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 586a2dd0f9b..e8e71617738 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -112,7 +112,7 @@ void FoolGame::revealRun() {
}
}
// 134:0538
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
this->var_i16_d0c = 1;
} else {
@@ -123,7 +123,7 @@ void FoolGame::revealRun() {
// 134:057a
// 134:057a: JMP - [0x61e]
// main event loop
- while (((this->stateFlags & 1) == 0) && (this->var_i16_d0c == 0)) {
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
// 134:057e
while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
// 134:0582
@@ -140,12 +140,12 @@ void FoolGame::revealRun() {
}
}
// 134:05e2
- if (this->stateFlags == 2) {
+ if (this->stateFlags == kStateUndo) {
this->revealReset();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
- this->sub_128_3536();
+ this->saveGame();
}
// 134:061e
}
@@ -201,7 +201,7 @@ void FoolGame::revealReset() {
}
// 134:085c
this->arr_i16_1eb8[19] = 0;
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
}
void FoolGame::revealSuccess() {
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index b11a39acd12..1cd53d5e82c 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -95,11 +95,11 @@ void FoolGame::sunMapRun() {
g_toolbox->Delay(0);
}
// 137:038a
- if (this->stateFlags == 2) {
+ if (this->stateFlags == kStateUndo) {
this->sunMapUndoMove();
}
- if (this->stateFlags == 4) {
- this->sub_128_3536();
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
}
}
// 137:03ce
@@ -255,7 +255,7 @@ void FoolGame::sunMapMoveSelected() {
void FoolGame::sunMapUndoMove() {
// 137:0d60
- this->stateFlags = 0;
+ this->stateFlags = kStateNull;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index fad797d3426..717f0455e4e 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -204,9 +204,9 @@ void FoolGame::wordSearchRun() {
if (this->var_i16_1990 == this->var_i16_198e) {
this->wordSearchSuccess();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->wordSearchStoreState();
- this->sub_128_3536();
+ this->saveGame();
}
if (this->var_ev_46.what == kNullEvent) {
g_toolbox->Delay(0);
Commit: c5df8951da61ea100a9321cc0e0412a18968d46d
https://github.com/scummvm/scummvm/commit/c5df8951da61ea100a9321cc0e0412a18968d46d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:16+02:00
Commit Message:
FOOL: Fix missing screen buffer copies
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 1127fb6a2f8..af24ae9b706 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -53,7 +53,7 @@ void FoolGame::sub_128_004() {
this->arr_bmp_bbbc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_c38c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_109dc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_15fcc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_138bc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
// 128:0004
g_zbasic->unk_331(0xdac0, 0);
@@ -211,20 +211,20 @@ void FoolGame::sub_128_004() {
g_toolbox->SetPort(this->var_i32_0);
}
-void FoolGame::sub_128_0a2(int16 unk2, int16 unk1) {
- warning("sub_128_0a2: unk2 %d, unk1 0x%04x", unk2, unk1);
+void FoolGame::copyScreen(int16 put, BitMap &bmp) {
// 128:00a2
- this->var_i16_32 = unk1;
- this->var_i16_30 = unk2;
- if (this->var_i16_30 == 0) {
+ // the original code would use the memory at 5dfc + 2*arg2.
+ // to make this less bad, our version passes a BitMap pointer
+ warning("copyScreen: put %d, bmp %p", put, (void *)&bmp);
+ if (put == 0) {
// FIXME: use var_i16_32 to choose start offset??
- g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_5dfc);
+ g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bmp);
}
// 128:00e6
- if (this->var_i16_30 == 1) {
+ if (put == 1) {
// FIXME: use var_i16_32 to choose start offset??
- g_zbasic->put(0, 0, this->arr_bmp_5dfc, kPutCopy);
+ g_zbasic->put(0, 0, bmp, kPutCopy);
}
}
@@ -237,7 +237,7 @@ void FoolGame::sub_128_11c(const Common::U32String &unk2, const Common::U32Strin
this->var_i16_586 = 0;
- this->sub_128_0a2(0, 0x6260);
+ this->copyScreen(0, this->arr_bmp_138bc);
// 128:015a
this->var_ev_46.where.y = this->var_i16_58 + 0x3d;
@@ -249,7 +249,7 @@ void FoolGame::sub_128_11c(const Common::U32String &unk2, const Common::U32Strin
g_toolbox->SFPutFile(this->var_ev_46.where, this->var_str_172, this->var_str_272, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
- this->sub_128_0a2(1, 0x6d60);
+ this->copyScreen(1, this->arr_bmp_138bc);
// 128:01b0
if (this->var_sfr_5e.good == 1) {
@@ -265,7 +265,7 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
this->var_str_588 = g_zbasic->str(4);
this->var_i16_688 = 0;
- this->sub_128_0a2(0, 0x6260);
+ this->copyScreen(0, this->arr_bmp_138bc);
// 128:0218
this->var_ev_46.where.y = this->var_i16_58 + 0x3d;
this->var_ev_46.where.x = this->var_i16_56 + 0x53;
@@ -282,7 +282,7 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
g_toolbox->SFGetFile(this->var_ev_46.where, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
- this->sub_128_0a2(1, 0x6d60);
+ this->copyScreen(1, this->arr_bmp_138bc);
if (this->var_sfr_5e.good == 1) {
// 128:02a2
@@ -622,7 +622,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->sub_128_50e(0x19, 0x64, 0);
}
// 128:0e46
- this->sub_128_0a2(0, 0x6060);
+ this->copyScreen(0, this->arr_bmp_138bc);
g_zbasic->text(this->var_i16_7aa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7b4 = this->var_i16_7ae*0x46;
this->var_i16_7b6 = 0;
@@ -804,7 +804,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
} while (this->var_i16_7be == 0);
this->sub_128_61ec();
- this->sub_128_0a2(1, 0x6d60);
+ this->copyScreen(1, this->arr_bmp_138bc);
g_toolbox->SetPort(this->var_i32_0);
}
// 128:1784
@@ -920,7 +920,7 @@ void FoolGame::sub_128_1f44() {
this->storyCurrentPage = 0;
this->clearStateBits(0x200);
this->sub_128_5fea();
- this->sub_128_0a2(1, 0);
+ this->copyScreen(1, this->arr_bmp_5dfc);
this->storyRenderPage();
g_toolbox->SetPort(this->var_i32_0);
}
@@ -1466,7 +1466,7 @@ void FoolGame::sub_128_3032() {
this->var_i16_7a2 += 0xf;
}
// 128:3228
- this->sub_128_0a2(0, 0);
+ this->copyScreen(0, this->arr_bmp_5dfc);
this->storyCurrentPage = 1;
this->storyRenderPage();
if ((this->var_i16_7ce & 1) == 0) {
@@ -1653,7 +1653,7 @@ void FoolGame::sub_128_39a0() {
this->activePuzzle = this->var_i16_7d0;
this->var_i16_7ce |= 1;
g_toolbox->InitCursor();
- this->sub_128_0a2(0, 0);
+ this->copyScreen(0, this->arr_bmp_5dfc);
// 128:39fa
if (this->arr_i16_15e8[this->var_i16_7d0] > 0) {
this->sub_128_41d8();
@@ -1732,7 +1732,7 @@ void FoolGame::sub_128_39a0() {
this->sub_128_41aa();
if ((this->stateFlags & kStateQuit) == 0) {
g_toolbox->PenNormal();
- this->sub_128_0a2(1, 0);
+ this->copyScreen(1, this->arr_bmp_5dfc);
this->var_menu_bf8 = g_toolbox->GetMHandle(8);
g_toolbox->DeleteMenu(8);
g_toolbox->DisposeMenu(this->var_menu_bf8);
@@ -2140,7 +2140,7 @@ void FoolGame::sub_128_4a92() {
this->var_i16_7b2 = 0xa;
g_toolbox->InitCursor();
this->sub_128_4da(1);
- this->sub_128_0a2(0, 0x6d60);
+ this->copyScreen(0, this->arr_bmp_138bc);
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7b4 = 0;
this->var_i16_7b6 = 0;
@@ -2210,7 +2210,7 @@ void FoolGame::sub_128_4a92() {
this->sub_128_2664();
this->sub_128_61c2();
g_toolbox->DrawMenuBar();
- this->sub_128_0a2(0x1, 0x6d60);
+ this->copyScreen(0x1, this->arr_bmp_138bc);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -2348,7 +2348,7 @@ void FoolGame::sub_128_5c20() {
void FoolGame::sub_128_5ef0() {
// 128:5ef0
- this->sub_128_0a2(0, 0x2af8);
+ this->copyScreen(0, this->arr_bmp_b3ec);
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
}
@@ -2364,7 +2364,7 @@ void FoolGame::sub_128_5f16() {
// 128:5f70
if ((this->stateFlags & 1) != 0) {
this->sub_128_6186();
- this->sub_128_0a2(1, 0x2af8);
+ this->copyScreen(1, this->arr_bmp_b3ec);
}
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 3a1cb03e9f5..8d3b5f63fa5 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -49,7 +49,7 @@ public:
void run();
void sub_128_004();
- void sub_128_0a2(int16 unk2, int16 unk1);
+ void copyScreen(int16 put, BitMap &bmp); // sub_128_0a2
void sub_128_11c(const Common::U32String &unk2, const Common::U32String &unk1);
void sub_128_1e4(const Common::U32String &unk1);
void sub_128_2be(int16 unk2, int16 unk1);
@@ -512,11 +512,11 @@ private:
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap arr_jigsaw_5dfc[128];
BitMap arr_bmp_b3ec;
- BitMap arr_bmp_bbbc;
- BitMap arr_bmp_c38c;
+ BitMap arr_bmp_bbbc; // used by death
+ BitMap arr_bmp_c38c; // used by death
Handle arr_bytes_109dc; // used for data buffering
BitMap arr_bmp_109dc;
- BitMap arr_bmp_15fcc;
+ BitMap arr_bmp_138bc;
GrafPort arr_grafport_18eae;
GrafPort arr_grafport_18f78;
GrafPort arr_grafport_19042;
Commit: e01bdd20d8783a9b9239a7480bc6b37852c5b316
https://github.com/scummvm/scummvm/commit/e01bdd20d8783a9b9239a7480bc6b37852c5b316
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:16+02:00
Commit Message:
FOOL: Remove extra screen redraws
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index db50bbd962f..a6ecc7540cc 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -118,16 +118,13 @@ void FoolGame::cardsRun() {
this->stateFlags = 0;
while (this->stateFlags == 0) {
// 139:046e
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
this->cardsOnClick();
}
if (this->var_i16_2014 != 0) {
this->sub_139_50e();
}
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
}
// 139:04a4
if (this->stateFlags == 2) {
@@ -282,7 +279,7 @@ void FoolGame::cardsOnClick() {
this->var_i16_2014 = 0;
this->stateFlags = 0;
while ((this->stateFlags == 0) && (this->var_i16_2014 == 0)) {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == kMouseUp) {
this->var_i16_2014 = 1;
}
@@ -290,9 +287,6 @@ void FoolGame::cardsOnClick() {
this->cardsStoreState();
this->saveGame();
}
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
}
// 139:09d8
if (((this->stateFlags & 1) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 5dae2e4d5de..12877a4568f 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -54,7 +54,7 @@ void FoolGame::deathRun() {
// JMP 0x232
while (this->var_ev_46.where.y >= 0x14) {
// 141:01cc
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
this->deathMoveBlackEye();
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1eb8)) {
this->deathCaught();
@@ -74,8 +74,6 @@ void FoolGame::deathRun() {
this->deathDrawWhiteEye();
return;
}
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
}
// 141:023a
g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
@@ -86,23 +84,21 @@ void FoolGame::deathRun() {
// cursor is over the top menu, safe
// 141:0282
this->deathMoveBlackEye();
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->stateFlags == 2) {
this->stateFlags = 0;
}
if (this->stateFlags == kStateSaveGame) {
this->saveGame();
}
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
}
// 141:02c6
- this->sub_128_c6a(0);
+ this->getNextEvent(0);
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
this->var_i32_692 = g_toolbox->TickCount();
// 141:02fa
do {
- this->sub_128_c6a(0);
+ this->getNextEvent(0);
if (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) &&
g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
// JMP 0x9a2
@@ -116,9 +112,6 @@ void FoolGame::deathRun() {
this->deathDrawWhiteEye();
return;
}
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
// 141:0342
} while (g_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index af24ae9b706..f176c2a6df4 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -114,7 +114,7 @@ void FoolGame::sub_128_004() {
// 128:1c88: JMP - [0x1ee2]
while (this->stateFlags != kStateQuit) {
do {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (_quit)
return;
@@ -541,7 +541,7 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16
this->sub_128_4472();
}
-void FoolGame::sub_128_c6a(uint32 unk1) {
+void FoolGame::getNextEvent(uint32 unk1) {
// 128:0c6a
// This function is usually called at the start of an event processing loop,
@@ -593,7 +593,7 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
g_toolbox->InvertRect(this->arr_rect_5b7c);
this->var_i16_3a = 0;
do {
- // originally this used sub_128_c6a, but we avoid that here
+ // originally this used getNextEvent, but we avoid that here
// so that menu events don't get intercepted.
// originally this mask was 0, but we change it here to
// intercept all events, and fall back to NullEvent +
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 8d3b5f63fa5..a06374c6f93 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -71,7 +71,7 @@ public:
void sub_128_918(const Common::U32String &unk1);
void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
- void sub_128_c6a(uint32 unk1);
+ void getNextEvent(uint32 mask); // sub_128_c6a
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index f707477982c..1b5208a5ecd 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -123,7 +123,7 @@ void FoolGame::jigsawRun() {
// 132:049c
while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0)) {
// 132:0488
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == kMouseDown) {
this->jigsawOnClick();
}
@@ -188,7 +188,7 @@ void FoolGame::jigsawDragSelect() {
// 132:067a
// change select area while mouse button held down
do {
- this->sub_128_c6a(4);
+ this->getNextEvent(4);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->var_i16_68a >= this->arr_i16_4758[0]) {
@@ -227,7 +227,7 @@ void FoolGame::jigsawMoveSelected() {
// move select area to new target
warning("call: %s", __func__);
do {
- this->sub_128_c6a(2);
+ this->getNextEvent(2);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->arr_i16_4758[0] >= 0) {
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 4b7cb3eb87d..5c5cbede4d2 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -346,14 +346,14 @@ void FoolGame::jumbleRun() {
this->var_i16_68a++;
g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
// mask was originally 0
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
int delta = MAX(0, this->var_i16_7e4*60/1000 - ((int)g_toolbox->TickCount() - ticks));
g_toolbox->Delay(delta);
} while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
} else {
// 130:0b62
// mask was originally 0
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
}
}
// 130:0b7a
@@ -366,7 +366,7 @@ void FoolGame::jumbleRun() {
for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
g_toolbox->Delay(0xd*60/1000);
g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
- this->sub_128_c6a(0);
+ this->getNextEvent(0);
if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
this->var_i16_d0c = 1;
}
@@ -423,7 +423,7 @@ void FoolGame::sub_130_d2e() {
this->sub_128_61ec();
this->stateFlags = kStateNull;
while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
@@ -478,7 +478,7 @@ void FoolGame::sub_130_d90() {
// 130:0fa0
while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:0fa4
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->keyLastPressed != 0) {
this->sub_130_15da();
}
@@ -505,7 +505,7 @@ void FoolGame::sub_130_1004() {
this->keyLastPressed = 0;
// 130:1042
while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->keyLastPressed != 0) {
this->sub_130_15da();
}
@@ -536,7 +536,7 @@ void FoolGame::sub_130_10a6() {
this->stateFlags = kStateNull;
// 130:121c
while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == 1) {
this->sub_130_1476();
}
@@ -560,7 +560,7 @@ void FoolGame::sub_130_1282() {
g_toolbox->InitCursor();
while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:12cc
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->keyLastPressed != 0) {
this->sub_130_15da();
}
@@ -631,7 +631,7 @@ void FoolGame::sub_130_1476() {
case 0:
this->sub_130_172c();
break;
- case 1:
+ case 1: // the knight of wands
case 2:
case 6:
this->sub_130_20aa();
@@ -786,9 +786,8 @@ void FoolGame::sub_130_1a16() {
}
// 130:1b40
if (this->var_str_1578 != g_zbasic->str(184)) { // blank
- this->var_i16_68a = 1;
- for (int i = 1; i <= this->var_i16_167a - 2; i++) {
- this->var_str_d12 = g_zbasic->midStr(this->var_str_1578, this->var_i16_68a, 1);
+ for (int16 i = 1; i <= this->var_i16_167a - 2; i++) {
+ this->var_str_d12 = g_zbasic->midStr(this->var_str_1578, i, 1);
if ((this->var_str_d12 == this->var_str_1374) || (this->var_str_d12 == this->var_str_1474)) {
// 130:1ba8
if (this->var_str_d12 == this->var_str_1374) {
@@ -798,11 +797,11 @@ void FoolGame::sub_130_1a16() {
this->var_str_d12 = this->var_str_1374;
}
// 130:1be2
- g_zbasic->midStrSet(this->var_str_1578, this->var_i16_68a, 1, this->var_str_d12);
+ g_zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
}
// 130:1c02
}
- sub_130_2226();
+ this->sub_130_2226();
}
// 130:1c1a
this->sub_130_1c1a();
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 7481ad679bd..ed01c1274a8 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -230,14 +230,10 @@ void FoolGame::polyominoRun() {
this->stateFlags = kStateNull;
do {
do {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == 1) {
this->polyominoOnClick();
}
- // yield to renderer
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
// 133:0800
} while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0));
// 133:081c
@@ -324,7 +320,7 @@ void FoolGame::polyominoOnClick() {
// 133:0d3a
while ((this->var_i16_1ab6 == this->var_i16_1062) && (this->var_i16_1ab8 == this->var_i16_1064) && (this->var_ev_46.what != 2)) {
// 133:0b62
- this->sub_128_c6a(4);
+ this->getNextEvent(4);
this->var_i16_68a = this->var_i16_1ab2 + ((this->var_ev_46.where.x - this->arr_i16_1eb8[4]) / this->arr_i16_1eb8[6]);
this->var_i16_68c = this->var_i16_1ab4 + ((this->var_ev_46.where.y - this->arr_i16_1eb8[5]) / this->arr_i16_1eb8[7]);
@@ -349,10 +345,6 @@ void FoolGame::polyominoOnClick() {
this->var_i16_1ab8 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
//debug(5, "FoolGame::polyominoOnClick: Move to (%d, %d) -> (%d, %d)", this->var_i16_68a, this->var_i16_68c, this->var_i16_1ab6, this->var_i16_1ab8);
- // yield to renderer
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
}
// 133:0d78
if (this->var_ev_46.what != 2) {
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index e8e71617738..57430048852 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -127,17 +127,13 @@ void FoolGame::revealRun() {
// 134:057e
while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
// 134:0582
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == kMouseDown) {
this->revealOnClick();
}
if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
this->var_i16_d0c = 1;
}
- // render screen
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
}
// 134:05e2
if (this->stateFlags == kStateUndo) {
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 1cd53d5e82c..35446fb3c51 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -87,12 +87,10 @@ void FoolGame::sunMapRun() {
this->sunMapCheckIfSolved();
while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0)) {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == kMouseDown) {
this->sunMapOnClick();
}
- if (this->var_ev_46.what == kNullEvent)
- g_toolbox->Delay(0);
}
// 137:038a
if (this->stateFlags == kStateUndo) {
@@ -164,7 +162,7 @@ void FoolGame::sunMapOnClick() {
void FoolGame::sunMapDragSelect() {
// 137:0598
do {
- this->sub_128_c6a(4);
+ this->getNextEvent(4);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->var_i16_68a >= this->arr_i16_4758[0]) {
@@ -201,7 +199,7 @@ void FoolGame::sunMapDragSelect() {
void FoolGame::sunMapMoveSelected() {
// 137:0880
do {
- this->sub_128_c6a(2);
+ this->getNextEvent(2);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->arr_i16_4758[0] >= 0) {
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 717f0455e4e..54bd4cc2cf4 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -197,7 +197,7 @@ void FoolGame::wordSearchRun() {
// 131:084c
this->stateFlags = kStateNull;
while ((this->stateFlags & kStateReturn) == 0) {
- this->sub_128_c6a(-1);
+ this->getNextEvent(-1);
if (this->var_ev_46.what == 1) {
this->wordSearchOnClick();
}
@@ -208,9 +208,6 @@ void FoolGame::wordSearchRun() {
this->wordSearchStoreState();
this->saveGame();
}
- if (this->var_ev_46.what == kNullEvent) {
- g_toolbox->Delay(0);
- }
}
this->wordSearchStoreState();
// 131:08a6
@@ -228,7 +225,7 @@ void FoolGame::wordSearchOnClick() {
while ((this->var_ev_46.modifiers & 0x80) == 0) {
// 131:08d4
- this->sub_128_c6a(0);
+ this->getNextEvent(0);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (!((this->var_i16_68a == this->var_i16_1a96) && (this->var_i16_68c == this->var_i16_1a98))) {
Commit: fa8e71fba1d29f9bbd585eebec8e1158943fa864
https://github.com/scummvm/scummvm/commit/fa8e71fba1d29f9bbd585eebec8e1158943fa864
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:17+02:00
Commit Message:
FOOL: Fix ever-growing save game names
Changed paths:
engines/fool/fool_game.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index f176c2a6df4..000ec4a9936 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -253,7 +253,7 @@ void FoolGame::sub_128_11c(const Common::U32String &unk2, const Common::U32Strin
// 128:01b0
if (this->var_sfr_5e.good == 1) {
- this->var_str_486 += this->var_sfr_5e.fName;
+ this->var_str_486 = this->var_sfr_5e.fName;
this->var_i16_586 = this->var_sfr_5e.vRefNum;
}
Commit: 627962046e3a297924d493960d0a9434b488dbdc
https://github.com/scummvm/scummvm/commit/627962046e3a297924d493960d0a9434b488dbdc
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:17+02:00
Commit Message:
FOOL: Fix word square being unsolvable
Changed paths:
engines/fool/fool_jumble.cpp
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 5c5cbede4d2..df33e7ad4c5 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -180,13 +180,15 @@ void FoolGame::jumbleRun() {
this->var_str_9f4 = g_zbasic->space(this->var_i16_1372);
}
// 130:0580
+ // word square
if (this->jumbleGameType == 4) {
this->var_str_384 = g_zbasic->leftStr(this->var_str_1272, 4);
this->sub_130_25d8();
this->var_str_1374 = this->var_str_9f4;
this->var_str_384 = g_zbasic->rightStr(this->var_str_1272, 4);
this->sub_130_25d8();
- this->var_str_9f4 = this->var_str_9f4 + this->var_str_1474 + this->var_str_1374 + g_zbasic->midStr(this->var_str_1272, 5, 1) + this->var_str_1474;
+ this->var_str_1474 = this->var_str_9f4;
+ this->var_str_9f4 = this->var_str_1374 + g_zbasic->midStr(this->var_str_1272, 5, 1) + this->var_str_1474;
}
// 130:0610
this->var_str_1070 += this->var_str_9f4;
@@ -279,7 +281,7 @@ void FoolGame::jumbleRun() {
this->sub_130_1004();
break;
case 3:
- case 4:
+ case 4: // word square
this->sub_130_10a6();
break;
case 5:
@@ -521,6 +523,7 @@ void FoolGame::sub_130_1004() {
void FoolGame::sub_130_10a6() {
// 130:10a6
+ // word square
this->sub_130_1426();
if (this->jumbleGameType != 5) {
this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 1, 1) + g_zbasic->midStr(this->var_str_1170, 4, 1) + g_zbasic->midStr(this->var_str_1170, 7, 1);
@@ -637,7 +640,7 @@ void FoolGame::sub_130_1476() {
this->sub_130_20aa();
break;
case 3:
- case 4:
+ case 4: // word square
this->sub_130_172c();
break;
default:
@@ -700,6 +703,7 @@ void FoolGame::sub_130_15da() {
void FoolGame::sub_130_172c() {
// 130:172c
+ // word square, disallow clicking the centre tile
if ((this->jumbleGameType == 4) && (this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] == 5)) {
this->sub_130_19da();
return;
@@ -742,6 +746,7 @@ void FoolGame::sub_130_172c() {
}
void FoolGame::sub_130_19ac() {
+ // 130:19ac
if (this->var_i16_187e > 0) {
g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_187e]);
}
@@ -750,10 +755,12 @@ void FoolGame::sub_130_19ac() {
}
void FoolGame::sub_130_19da() {
+ // 130:19da
+ // fixed tile
this->sub_130_19ac();
this->sub_128_50e(0x19, 0x64, 0);
for (int i = 0; i <= 0x19; i++) {
- g_toolbox->InvertRect(this->arr_rect_1f38[9]);
+ g_toolbox->InvertRect(this->arr_rect_1f38[13]);
this->sub_128_3da(1);
}
}
Commit: 26ad7f8ac561cd433da7973ad9233d660fd05234
https://github.com/scummvm/scummvm/commit/26ad7f8ac561cd433da7973ad9233d660fd05234
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:17+02:00
Commit Message:
FOOL: Add sentence game
Changed paths:
A engines/fool/fool_sentence.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jumble.cpp
engines/fool/module.mk
engines/fool/toolbox.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 000ec4a9936..ffdd7990432 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1686,7 +1686,7 @@ void FoolGame::sub_128_39a0() {
this->revealRun();
break;
case 8:
- this->sub_135_004();
+ this->sentenceRun();
break;
case 9:
this->sub_136_004();
@@ -2953,9 +2953,7 @@ void FoolGame::sub_129_123a() {
g_toolbox->Delay(0);
}
-void FoolGame::sub_135_004() {
- warning("STUB: %s", __func__);
-}
+
// maze game
void FoolGame::sub_136_004() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index a06374c6f93..9e459361b1d 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -213,7 +213,20 @@ public:
void revealReset(); // sub_134_7bc
void revealSuccess(); // sub_134_872
- void sub_135_004();
+ // fool_sentence.cpp
+ void sentenceRun(); // sub_135_004
+ void sub_135_5b6();
+ void sentenceAddLeft(); // sub_135_7d6
+ void sentenceAddRight(); // sub_135_7fa
+ void sub_135_81e();
+ void sub_135_86a();
+ void sub_135_94c();
+ void sub_135_9ba();
+ void sub_135_a34();
+ void sub_135_b16();
+ void sub_135_c1c();
+ void sub_135_cee();
+
void sub_136_004();
// fool_sun.cpp
@@ -446,6 +459,8 @@ private:
int16 var_i16_1ab6;
int16 var_i16_1ab8;
int16 var_i16_1aba;
+ int16 var_i16_1abc;
+ int16 var_i16_1abe;
int16 var_i16_1e00;
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index df33e7ad4c5..d168022481f 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -284,7 +284,7 @@ void FoolGame::jumbleRun() {
case 4: // word square
this->sub_130_10a6();
break;
- case 5:
+ case 5: // hidden message
this->sub_130_1282();
break;
default:
@@ -551,6 +551,7 @@ void FoolGame::sub_130_10a6() {
void FoolGame::sub_130_1282() {
// 130:1282
+ // hidden message, change the mouse cursor
this->var_i16_106e = g_zbasic->instr(1, this->var_str_1070, g_zbasic->str(182));
if (this->var_i16_106e == 0) {
this->var_i16_106e = 1;
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
new file mode 100644
index 00000000000..23ebc02f0e6
--- /dev/null
+++ b/engines/fool/fool_sentence.cpp
@@ -0,0 +1,338 @@
+/* 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 "fool/detection.h"
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// sentence join game
+void FoolGame::sentenceRun() {
+ // 135:0004
+ this->sub_128_271a();
+ this->var_i16_c00 = 1;
+ this->arr_i16_3738[0] = 0xbf;
+ this->arr_i16_3738[2] = 0xe1;
+ this->arr_i16_3738[4] = 0xbf;
+ this->arr_i16_3738[5] = 0;
+ this->arr_i16_3738[6] = 0xe1;
+ this->arr_i16_3738[7] = 0x200;
+ this->arr_i16_3738[8] = 0xf2;
+ this->arr_i16_3738[0xa] = 0x156;
+ this->arr_i16_3738[0xc] = 0x14;
+ this->arr_i16_3738[0xd] = 0;
+ this->arr_i16_3738[0xe] = 0x156;
+ this->arr_i16_3738[0xf] = 0x200;
+
+ // 135:00ce
+ this->var_i16_1066 = this->puzzlesReadShort();
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
+ this->arr_i16_1eb8[0] = this->puzzlesReadShort();
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, 0);
+ this->var_str_1272 = this->puzzlesReadString();
+ this->var_str_384 = this->puzzlesReadString();
+ this->var_str_384 = g_zbasic->str(215) + this->var_str_384 + g_zbasic->str(216); // to reveal XXXXX
+ // 135:0152
+ g_zbasic->menu(8, 7, 1, this->var_str_384);
+ this->arr_i16_1eb8[1] = 0x1c2 / this->arr_i16_1eb8[0];
+ this->arr_i16_1eb8[2] = 0x100 - ((this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1]) / 2);
+
+ // 135:01e2
+ this->var_i16_7e4 = this->arr_i16_1eb8[2];
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_4338[i] = 0;
+ this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = this->puzzlesReadByte();
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
+ // 135:0254
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
+ this->arr_rect_1f38[i].top = 0xf2;
+ this->arr_rect_1f38[i].left = this->var_i16_7e4;
+ this->arr_rect_1f38[i].bottom = 0x156;
+ this->arr_rect_1f38[i].right = this->var_i16_7e4 + this->arr_i16_1eb8[1];
+ // 135:030c
+ this->var_i16_7e4 += this->arr_i16_1eb8[1];
+ }
+ // 135:0348
+ g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ this->arr_i16_1eb8[4] = 0;
+ for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
+ // 135:03a4
+ if (this->activePuzzleBuffer.empty()) { // was: str(217)
+ this->arr_i16_4338[this->var_i16_68a] = 1;
+ } else {
+ // 135:03d4
+ this->arr_i16_4338[this->var_i16_68a] = (int16)strtol(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_68a, 1).c_str(), nullptr, 10);
+
+ }
+ // 135:0408
+ if (this->arr_i16_4338[this->var_i16_68a] == 1) {
+ this->sub_128_50e(g_zbasic->rndInt(1000) + 0x19, 0x28, 1);
+ this->sub_135_a34();
+ }
+ // 135:044a
+ }
+ // 135:0466
+ if (this->activePuzzleBuffer.empty()) { // was: str(218)
+ this->var_str_1070 = g_zbasic->index(1, 0);
+ } else {
+ // 135:049a
+ this->var_i16_1372 = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
+ this->var_str_1070 = g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
+ }
+ // 135:04f2
+ this->sub_135_b16();
+ this->stateFlags = kStateNull;
+ if (this->var_str_1070 == this->var_str_1272) {
+ this->var_i16_d0c = 1;
+ } else {
+ this->var_i16_d0c = 0;
+ }
+ // 135:0520
+ do {
+ this->getNextEvent(-1);
+ if (this->var_ev_46.what == kMouseDown) {
+ this->sub_135_5b6();
+ }
+ // 135:0538
+ if (this->var_str_1070 == this->var_str_1272) {
+ this->var_i16_d0c = 1;
+ }
+ // 135:0552
+ if (this->stateFlags == kStateUndo) {
+ this->sub_135_9ba();
+ this->stateFlags = kStateNull;
+ }
+ // 135:0566
+ if (this->stateFlags == kStateSaveGame) {
+ this->sub_135_c1c();
+ this->saveGame();
+ }
+ // 135:0578
+ } while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0));
+ // 135:05a0
+ if (this->var_i16_d0c == 1) {
+ this->sub_135_cee();
+ }
+ this->sub_135_c1c();
+ // JMP 0xd9c
+}
+
+void FoolGame::sub_135_5b6() {
+ // 135:05b6
+ this->var_i16_1abc = 0;
+ if ((this->var_ev_46.where.x < this->arr_i16_1eb8[2]) || (this->var_ev_46.where.y < 0xf2))
+ return;
+ // determine which button was clicked on
+ this->var_i16_103a = ((this->var_ev_46.where.x - this->arr_i16_1eb8[2]) / this->arr_i16_1eb8[1]) + 1;
+ // 135:0632
+ if ((this->var_i16_103a > this->arr_i16_1eb8[0]) || (this->arr_i16_4338[this->var_i16_103a] == 0))
+ return;
+ // 135:0676
+ this->arr_i16_4338[this->var_i16_103a] = 0;
+ g_toolbox->FillOval(this->arr_rect_1f38[this->var_i16_103a], this->arr_pat_58f4[2]);
+ // 135:06aa
+ switch (this->arr_i16_4338[this->var_i16_103a + this->arr_i16_1eb8[0]]-1) {
+ case 0:
+ this->sentenceAddLeft();
+ break;
+ case 1:
+ this->sentenceAddRight();
+ break;
+ case 2:
+ this->sub_135_81e();
+ break;
+ case 3:
+ this->sub_135_86a();
+ break;
+ case 4:
+ this->sub_135_94c();
+ break;
+ default:
+ warning("sub_135_5b6: breaking out of switch");
+ break;
+ }
+ this->sub_135_b16();
+ this->sub_128_6186();
+ if (this->var_str_1070 == this->var_str_1272) {
+ return;
+ }
+ // 135:0714
+ this->var_i16_484 = 0;
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ if (this->arr_i16_4338[i] != 0) {
+ this->var_i16_484 = 1;
+ }
+ }
+ // 135:0758
+ if (this->var_i16_484 != 0) {
+ return;
+ }
+ g_zbasic->text(0, 0xc, 0, kSrcBic);
+ this->var_i16_7a2 = 0x124;
+ this->sub_128_918(g_zbasic->str(219)); // click mouse to reset puzzle
+
+ this->sub_128_6186();
+ this->var_i16_1abc = 1;
+ this->stateFlags = kNullEvent;
+ // 135:07a0
+ while ((this->var_ev_46.modifiers & kModMouseButtonUp) && (this->stateFlags == kNullEvent)) {
+ this->getNextEvent(-1);
+ }
+ // 135:07c8
+ if (this->stateFlags == kNullEvent) {
+ this->sub_135_9ba();
+ }
+}
+
+void FoolGame::sentenceAddLeft() {
+ // 135:07d6
+ this->var_str_1070 = g_zbasic->index(1, this->var_i16_103a) + this->var_str_1070;
+}
+
+void FoolGame::sentenceAddRight() {
+ // 135:07fa
+ this->var_str_1070 += g_zbasic->index(1, this->var_i16_103a);
+}
+
+void FoolGame::sub_135_81e() {
+ // 135:0813
+ this->var_str_1070 = g_zbasic->index(1, this->var_i16_103a)
+ + this->var_str_1070
+ + g_zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0]);
+}
+
+void FoolGame::sub_135_86a() {
+ // 135:086a
+ this->var_i16_9f2 = g_zbasic->index(1, this->var_i16_103a).size();
+ while (true) {
+ // 135:0884
+ this->var_i16_484 = this->var_str_1070.size();
+ this->var_i16_1abe = g_zbasic->instr(1, this->var_str_1070, g_zbasic->index(1, this->var_i16_103a));
+ if (this->var_i16_1abe == 0)
+ return;
+ // 135:08bc
+ if ((this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2) < 0)
+ return;
+ this->var_str_1070 = g_zbasic->leftStr(this->var_str_1070, this->var_i16_1abe - 1)
+ + g_zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0])
+ + g_zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2);
+ }
+ // should never reach here
+ this->sub_135_94c();
+}
+
+void FoolGame::sub_135_94c() {
+ // 135:094c
+ this->var_i16_484 = this->var_str_1070.size();
+ this->var_str_384.clear(); // was: str(220)
+ for (int16 i = this->var_i16_484; i >= 1; i--) {
+ this->var_str_384 += g_zbasic->midStr(this->var_str_1070, i, 1);
+ }
+ this->var_str_1070 = this->var_str_384;
+}
+
+void FoolGame::sub_135_9ba() {
+ // 135:09ba
+ this->arr_i16_1eb8[4] = 0;
+ Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
+ this->arr_i16_4338[this->var_i16_68a] = 1;
+ this->sub_135_a34();
+ }
+ this->var_str_1070 = g_zbasic->index(1, 0);
+ this->sub_135_b16();
+}
+
+void FoolGame::sub_135_a34() {
+ // 135:0a34
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + g_zbasic->str(221);
+ this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ g_toolbox->FillOval(this->arr_rect_1f38[this->var_i16_68a], this->arr_pat_58f4[0]);
+ g_toolbox->FrameOval(this->arr_rect_1f38[this->var_i16_68a]);
+ g_toolbox->MoveTo(this->arr_rect_1f38[this->var_i16_68a].left + (this->arr_i16_1eb8[1] / 2) - (this->var_i16_7e4 / 2), 0x129);
+ g_toolbox->DrawString(this->var_str_384);
+}
+
+void FoolGame::sub_135_b16() {
+ // 135:0b16
+ g_zbasic->text(0xfe, 0x18, 0, kSrcOr);
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1070);
+ if (this->var_i16_484 < this->arr_i16_1eb8[4]) {
+ this->var_i16_484 = this->arr_i16_1eb8[4];
+ } else {
+ this->arr_i16_1eb8[4] = this->var_i16_484;
+ }
+ // 135:0b80
+ this->arr_i16_3738[1] = 0xf6 - (this->var_i16_484 / 2);
+ this->arr_i16_3738[3] = 0x109 + (this->var_i16_484 / 2);
+ Common::Rect temp(this->arr_i16_3738[1], this->arr_i16_3738[0], this->arr_i16_3738[3], this->arr_i16_3738[2]);
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[0]);
+ g_toolbox->MoveTo(0x100 - (this->var_i16_484 / 2), 0xd9);
+ g_toolbox->DrawString(this->var_str_1070);
+}
+
+void FoolGame::sub_135_c1c() {
+ // 135:0c1c
+ this->activePuzzleBuffer.clear(); // was: str(222)
+ if (this->var_i16_1abc != 0) {
+ this->var_i16_1abc = 0;
+ return;
+ }
+ // 135:0c44
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->var_str_384 = Common::U32String::format("%d", this->arr_i16_4338[i]);
+ this->var_str_384 = g_zbasic->rightStr(this->var_str_384, 1);
+ this->activePuzzleBuffer += this->var_str_384;
+ }
+ // 135:0cba
+ Common::String temp = this->var_str_1070.encode(Common::kMacRoman);
+ this->var_i16_1372 = (int16)temp.size();
+ this->activePuzzleBuffer += g_zbasic->unk_88(this->var_i16_1372) + temp;
+}
+
+void FoolGame::sub_135_cee() {
+ // 135:0cee
+ if (this->var_i16_c04 < 0x64) {
+ this->var_i16_c04 = 0x64;
+ this->var_i16_68a = 1;
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->sub_128_50e(g_zbasic->rndInt(1000) + 0x19, 0x28, 0);
+ }
+ }
+ // 135:0d40
+ this->sub_128_2664();
+ this->sub_128_6186();
+ this->sub_128_d34(this->arr_i16_3738[0], this->arr_i16_3738[1], this->arr_i16_3738[2], this->arr_i16_3738[3], 0x64);
+}
+
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 19c7b905217..717da7a1a0a 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
+ fool_sentence.o \
fool_sun.o \
fool_wordsearch.o \
toolbox.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index c9710ee8280..69a352cbb5b 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -308,8 +308,8 @@ public:
void render() {
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
- this->_surface[y*16+x] = (this->data[y] & (1 << x)) ? 1 : 0;
- this->_mask[y*16+x] = (this->mask[y] & (1 << x)) ? kCursorMaskOpaque : kCursorMaskTransparent;
+ this->_surface[y*16+x] = (this->data[y] & (1 << (15 - x))) ? 1 : 0;
+ this->_mask[y*16+x] = (this->mask[y] & (1 << (15 - x))) ? kCursorMaskOpaque : kCursorMaskTransparent;
}
}
}
Commit: 633f0e2a169042327cf18f9e722afbed06f98884
https://github.com/scummvm/scummvm/commit/633f0e2a169042327cf18f9e722afbed06f98884
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:18+02:00
Commit Message:
FOOL: Add big chunk of Book of Thoth
Changed paths:
A engines/fool/fool_thoth.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index ffdd7990432..a6d88f2dadb 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -30,12 +30,19 @@ namespace Fool {
ZBasic *g_zbasic;
Toolbox *g_toolbox;
+// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
+
+// v1.0 - original release, single-density disks
+// v2.0 - fixes full-screen rendering on higher-resolution displays
+// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
+
void FoolGame::run() {
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
Common::MacFinderInfo finfo;
if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
g_zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
+ // v1.0 filename ends with "tm"
} else if (g_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
g_zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
} else {
@@ -52,6 +59,7 @@ void FoolGame::sub_128_004() {
this->arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_bbbc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_c38c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ this->arr_bmp_fa3c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_109dc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_138bc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
@@ -217,15 +225,12 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
// to make this less bad, our version passes a BitMap pointer
warning("copyScreen: put %d, bmp %p", put, (void *)&bmp);
if (put == 0) {
- // FIXME: use var_i16_32 to choose start offset??
g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bmp);
}
// 128:00e6
if (put == 1) {
- // FIXME: use var_i16_32 to choose start offset??
g_zbasic->put(0, 0, bmp, kPutCopy);
-
}
}
@@ -812,6 +817,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
+ // behold the first key of thoth animation
this->var_i16_32 = unk1;
this->var_i16_30 = unk2;
if (this->var_i16_30 > 0) {
@@ -835,10 +841,10 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
this->var_i32_692 = g_toolbox->TickCount();
g_toolbox->SetRect(
this->arr_rect_4338,
- ((int)(i*2.2f) - 0x105),
+ (0x105 - (int)(i*2.2f)),
i + 0xa5,
- ((int)(i*2.2f) + 0x105),
- ((int)(i*1.6f) + 0xa6)
+ (0x105 + (int)(i*2.2f)),
+ (0xa6 + (int)(i*1.6f))
);
// 128:1982
g_toolbox->InvertRect(this->arr_rect_4338);
@@ -856,18 +862,20 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
// 128:19ec
g_toolbox->MoveTo(0x105 - (this->var_i16_484/2), 0x12e);
g_toolbox->DrawString(this->var_str_384);
- for (int i = 0; i <= 0x4d; i++) {
+ // loop count was 0x4d
+ for (int i = 0; i <= 0x24; i++) {
this->var_i32_692 = g_toolbox->TickCount();
g_toolbox->InvertRect(this->arr_rect_4338);
- this->sub_128_406(0x1);
+ // this was 1, however the flashing was far too intense
+ this->sub_128_406(8);
}
for (int i = 1; i <= 0x24; i++) {
// 128:1a4c
this->var_i32_692 = g_toolbox->TickCount();
- this->arr_rect_4338.top -= (int)(this->var_i16_68a*0.4f);
- this->arr_rect_4338.left -= (int)(this->var_i16_68a*0.1f);
- this->arr_rect_4338.bottom += (int)(this->var_i16_68a*0.05f);
- this->arr_rect_4338.right += (int)(this->var_i16_68a*0.1f);
+ this->arr_rect_4338.top -= (int)(i*0.4f);
+ this->arr_rect_4338.left -= (int)(i*0.1f);
+ this->arr_rect_4338.bottom += (int)(i*0.05f);
+ this->arr_rect_4338.right += (int)(i*0.1f);
// 128:1b82
if (this->arr_rect_4338.top < 0x14) {
this->arr_rect_4338.top = 0x14;
@@ -885,13 +893,15 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_58f4[0x47]);
}
// 128:1c0a
- this->sub_128_406(1);
+ // was 1
+ this->sub_128_406(2);
}
this->sub_128_4da(1);
g_toolbox->PenNormal();
}
void FoolGame::setStateBits(int16 unk1) {
+ // 128:1c2c
this->var_i16_30 = unk1;
this->stateFlags |= this->var_i16_30;
}
@@ -905,7 +915,12 @@ void FoolGame::clearStateBits(int16 unk1) {
// 128:1c78
}
-
+void FoolGame::sub_128_1ef8() {
+ // 128:1ef8
+ g_toolbox->SetPort(this->var_i32_8);
+ this->fillRect(0, 0, 0x14, this->var_i16_5a, 2);
+ g_toolbox->SetPort(this->var_i32_0);
+}
void FoolGame::sub_128_1f1e() {
// 128:1f1e
@@ -1130,14 +1145,14 @@ void FoolGame::sub_128_26f6() {
}
void FoolGame::sub_128_271a() {
- int position = this->arr_i32_19454[this->activePuzzle] - 1;
+ int position = this->puzzleDataOffsets[this->activePuzzle] - 1;
// record index
this->var_i16_484 = (int16)(position / 1000);
// offset at record
this->var_i16_7e4 = (int16)(position % 1000);
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
this->var_ptr_696 = 0;
- int length = this->arr_i32_19454[this->activePuzzle + 1] - this->arr_i32_19454[this->activePuzzle];
+ int length = this->puzzleDataOffsets[this->activePuzzle + 1] - this->puzzleDataOffsets[this->activePuzzle];
debugC(8, kDebugLoading, "sub_128_271a: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
this->activePuzzle,
position,
@@ -1707,7 +1722,7 @@ void FoolGame::sub_128_39a0() {
this->deathRun();
break;
case 15:
- this->sub_128_5140();
+ this->shipsRun();
break;
case 16:
this->sub_142_004();
@@ -2214,8 +2229,223 @@ void FoolGame::sub_128_4a92() {
g_toolbox->SetPort(this->var_i32_0);
}
-void FoolGame::sub_128_5140() {
- warning("STUB: %s", __func__);
+// three freakin' ships
+void FoolGame::shipsRun() {
+ // 128:5140
+ this->fillRect(0x127, 0x6c, 0x137, 0x84, 0);
+ this->sub_128_6186();
+ this->sub_128_55c(g_zbasic->str(103)); // "?"
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ //warning("sub_128_5140: b3ec surface");
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //this->arr_bmp_b3ec->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 160, fakePal);
+
+ this->fillRect(0x127, 0x6c, 0x137, 0x84, 0);
+
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
+ //warning("sub_128_5140: bbbc surface");
+ //this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 160, fakePal);
+ // 138:51f0
+ this->var_i16_d08 = g_zbasic->rndInt(5) + 5;
+ this->var_i16_d0a = g_zbasic->rndInt(5) - 0xa;
+ for (int16 i = 0; i <= 5; i++) {
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ this->sub_128_5a6c();
+ }
+ // 128:5274
+ this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
+ this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
+ this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
+ this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+ // 128:530c
+ this->var_i16_d0c = 0;
+ this->keyLastPressed = 0;
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ this->getNextEvent(-1);
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_19114) != 0) {
+ this->sub_128_55ac();
+ }
+ // 128:5348
+ this->var_i16_d0e = this->var_ev_46.where.y;
+ this->var_i16_d10 = this->var_ev_46.where.x;
+ if (this->keyLastPressed > 0) {
+ this->sub_128_57a2();
+ }
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+ }
+ // 128:5396
+ if (this->var_i16_d0c != 0) {
+ this->sub_128_6186();
+ this->sub_128_50e(0x14, 0x64, 0);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ this->var_ev_46.where.x += 5;
+ this->var_ev_46.where.y -= 5;
+ if (this->var_i16_c04 < 0x64) {
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ }
+ for (int16 i = 1; i <= 1; i++) {
+ // 128:541c
+ this->arr_i16_4758[0] = this->var_ev_46.where.y;
+ this->arr_i16_4758[1] = this->var_ev_46.where.x;
+ this->arr_i16_4758[2] = this->var_ev_46.where.y;
+ this->arr_i16_4758[3] = this->var_ev_46.where.x;
+ for (int16 j = 1; j <= 0x19; j++) {
+ // 128:5462
+ this->arr_i16_4758[0]--;
+ this->arr_i16_4758[1]--;
+ this->arr_i16_4758[2]++;
+ this->arr_i16_4758[3]++;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertOval(temp);
+ }
+ }
+ // 128:5514
+ this->sub_128_3da(0x3c);
+ if (this->var_i16_c04 < 0x64) {
+ // 128:5526
+ this->sub_128_6186();
+ this->var_i16_c04 = 0x64;
+ this->var_i16_7ce |= 2;
+ this->sub_128_962(
+ this->var_ev_46.where.y - 5,
+ this->var_ev_46.where.x - 5,
+ this->var_ev_46.where.y + 5,
+ this->var_ev_46.where.x + 5,
+ 0x14,
+ 0,
+ SCREEN_HEIGHT,
+ SCREEN_WIDTH,
+ 2,
+ kPatCopy,
+ 0x42
+ );
+ this->var_str_384 = g_zbasic->str(104); // behold the 1st key of thoth
+ this->sub_128_178a(0, 0);
+ }
+ // 128:55aa
+ }
+ // 128:55aa
+ return;
+}
+
+void FoolGame::sub_128_55ac() {
+ // 128:55ac
+ if ((this->var_i16_d10 == this->var_ev_46.where.x) && (this->var_i16_d0e == this->var_ev_46.where.y)) {
+ return;
+ }
+ this->var_i16_d08 = g_zbasic->rndInt(5) + 5;
+ this->var_i16_d0a = g_zbasic->rndInt(5) + 5;
+ if (g_zbasic->maybe()) {
+ this->var_i16_d08 *= -1;
+ }
+ // 128:560a
+ if (g_zbasic->maybe()) {
+ this->var_i16_d0a *= -1;
+ }
+ // 128:5620
+ if (this->arr_rect_1910c.top < 0x50) {
+ this->var_i16_d0a = 0xa;
+ }
+ // 128:5640
+ if (this->arr_rect_1910c.left < 0x3c) {
+ this->var_i16_d08 = 0xa;
+ }
+ if (this->arr_rect_1910c.bottom > 0x104) {
+ this->var_i16_d0a = -0xa;
+ }
+ if (this->arr_rect_1910c.right > 0x1a4) {
+ this->var_i16_d08 = -0xa;
+ }
+ // 128:56a0
+ for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ this->sub_128_5a6c();
+ }
+ // 128:5708
+ this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
+ this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
+ this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
+ this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+
+}
+
+void FoolGame::sub_128_57a2() {
+ // 128:57a2
+ this->var_str_d12 = g_zbasic->ucase(g_zbasic->chr(this->keyLastPressed));
+ if (g_zbasic->instr(1, g_zbasic->str(105), this->var_str_d12) > 0) { // NESW
+ // 128:57e0
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ this->var_i16_d08 = 0;
+ this->var_i16_d0a = 0;
+ if (this->var_str_d12 == g_zbasic->str(106)) { // N
+ this->var_i16_d0a = -0x10;
+ }
+ if (this->var_str_d12 == g_zbasic->str(107)) { // S
+ this->var_i16_d0a = 0x10;
+ }
+ if (this->var_str_d12 == g_zbasic->str(108)) { // W
+ this->var_i16_d08 = -0x18;
+ }
+ if (this->var_str_d12 == g_zbasic->str(109)) { // E
+ this->var_i16_d08 = 0x18;
+ }
+ g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ this->var_i16_d08 = 0;
+ this->var_i16_d0a = 0;
+ // 128:58c2
+ if (this->arr_rect_1910c.top < 0x14) {
+ this->arr_rect_1910c.top = 0x146;
+ this->arr_rect_1910c.bottom = SCREEN_HEIGHT;
+ }
+ if (this->arr_rect_1910c.left < 0) {
+ this->arr_rect_1910c.left = 0x1e8;
+ this->arr_rect_1910c.right = SCREEN_WIDTH;
+ }
+ // 128:592e
+ if (this->arr_rect_1910c.bottom > SCREEN_HEIGHT) {
+ this->arr_rect_1910c.top = 0x14;
+ this->arr_rect_1910c.bottom = 0x24;
+ }
+ if (this->arr_rect_1910c.right > SCREEN_WIDTH) {
+ this->arr_rect_1910c.left = 0;
+ this->arr_rect_1910c.right = 0x18;
+ }
+ this->sub_128_5a6c();
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ this->var_i16_d0c = 1;
+ }
+ }
+ // 128:59cc
+ this->keyLastPressed = 0;
+ this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
+ this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
+ this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
+ this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+
+}
+
+void FoolGame::sub_128_5a6c() {
+ // 128:5a6c
+ this->var_i32_692 = g_toolbox->TickCount();
+ g_zbasic->get(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_rect_1910c.right, this->arr_rect_1910c.bottom, this->arr_bmp_bbbc);
+ //warning("sub_128_5a6c: bbbc surface");
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
+ g_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kPutXOR);
+ this->sub_128_406(0);
}
void FoolGame::sub_128_5b30() {
@@ -2737,7 +2967,7 @@ void FoolGame::sub_129_068() {
this->var_i16_68a = 0x50;
this->sub_129_123a();
for (int i = 1; i <= 0x64; i++) {
- this->arr_i32_19454[i] = this->puzzlesReadLong();
+ this->puzzleDataOffsets[i] = this->puzzlesReadLong();
}
// 129:0a4e
// quickdraw patterns
@@ -2964,23 +3194,65 @@ void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
-// high priestess challenge
-void FoolGame::sub_140_004() {
- warning("STUB: %s", __func__);
-}
-
+// the humbug
void FoolGame::sub_142_004() {
warning("STUB: %s", __func__);
}
-// lights on
+// justice - lights on
void FoolGame::sub_142_852() {
warning("STUB: %s", __func__);
}
// hermit key trace
void FoolGame::sub_142_12ac() {
- warning("STUB: %s", __func__);
+ // 142:12ac
+ if (this->puzzleCompletionStatus[0x34] < 5) {
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(362)); // to find a hidden secret
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(363));
+ } else {
+ // 142:12fc
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(364)); // to find the straight path
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(365));
+ }
+ // 142:132c
+ if (this->var_i16_c04 == 0) {
+ this->var_i16_2324 = 1;
+ }
+ if ((this->var_i16_c04 > 0) && (this->var_i16_c04 < 0x63)) {
+ this->var_i16_2324 = this->var_i16_c04;
+ }
+ // 142:1360
+ if (this->var_i16_c04 == 0x63) {
+ this->var_i16_2324 = 6;
+ }
+ if (this->var_i16_c04 == 0x64) {
+ this->var_i16_2324 = 1;
+ }
+ if (this->var_i16_c04 > 0x64) {
+ this->var_i16_2324 = this->var_i16_c04 - 0x64;
+ }
+ this->sub_140_206a();
+ if (this->var_i16_2324 == 6) {
+ this->var_i16_c04 = 0x63;
+ } else {
+ if (this->var_i16_c04 < 0x63) {
+ // 142:13be
+ this->var_i16_c04 = this->var_i16_2324;
+ if (this->var_i16_d0c != 0) {
+ this->var_i16_c04 = 0x64;
+ }
+ } else {
+ // 142:13da
+ if (this->var_i16_c04 >= 0x64) {
+ this->var_i16_c04 = this->var_i16_2324 + 0x64;
+ if (this->var_i16_d0c != 0) {
+ this->var_i16_c04 = 0x65;
+ }
+ }
+ }
+ }
+ // 142:1404
}
void FoolGame::sub_144_004() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 9e459361b1d..a14ce2f35c9 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -78,6 +78,7 @@ public:
void sub_128_178a(int16 unk2, int16 unk1);
void setStateBits(int16 unk1); // sub_128_1c2c
void clearStateBits(int16 unk1); // sub_128_1c4a
+ void sub_128_1ef8();
void sub_128_1f1e();
void sub_128_1f44();
void sub_128_1f76();
@@ -119,7 +120,12 @@ public:
void sub_128_41d8();
void sub_128_4472();
void sub_128_4a92();
- void sub_128_5140();
+
+ void shipsRun(); // sub_128_5140
+ void sub_128_55ac();
+ void sub_128_57a2();
+ void sub_128_5a6c();
+
void sub_128_5b30();
void sub_128_5baa();
void sub_128_5c20();
@@ -258,7 +264,33 @@ public:
void cardsStoreState(); // sub_139_1cba
void sub_139_1d3e();
+ // fool_thoth.cpp
void sub_140_004();
+ void sub_140_458();
+ void sub_140_12fc();
+ void sub_140_1486();
+ void sub_140_18fa();
+ void sub_140_1bc4();
+ void sub_140_206a();
+ void sub_140_22b8();
+ void sub_140_24ae();
+ void sub_140_25e4();
+ void sub_140_2662();
+ void sub_140_26ca();
+ void sub_140_28bc();
+ void sub_140_2968();
+ void sub_140_2978();
+ void sub_140_2998();
+ void sub_140_2f92();
+ void sub_140_3050();
+ void sub_140_30da();
+ void sub_140_3148();
+ void sub_140_325a();
+ void sub_140_326e();
+ void sub_140_3282();
+ void sub_140_32ac();
+ void sub_140_3372();
+ void sub_140_3412();
// fool_death.cpp
void deathRun(); // sub_141_004
@@ -368,7 +400,11 @@ private:
Common::String activePuzzleBuffer; // var_str_c06
int16 var_i16_d06;
+ int16 var_i16_d08;
+ int16 var_i16_d0a;
int16 var_i16_d0c;
+ int16 var_i16_d0e;
+ int16 var_i16_d10;
Common::U32String var_str_d12;
int16 var_i16_e12;
int16 var_i16_e14;
@@ -462,6 +498,8 @@ private:
int16 var_i16_1abc;
int16 var_i16_1abe;
+ int16 var_i16_1de6;
+
int16 var_i16_1e00;
int16 var_i16_2010;
@@ -478,7 +516,15 @@ private:
int16 var_i16_221e;
Common::U32String var_str_2222;
int16 var_i16_2322;
-
+ int16 var_i16_2324;
+ uint32 var_ptr_232a;
+ Handle var_bytes_232a;
+ int16 var_i16_232e;
+
+ int16 var_i16_2332;
+ int16 var_i16_2334;
+ int16 var_i16_2336;
+ int16 var_i16_2338;
int16 var_i16_233a;
// FIXME: bounds on the following are guessed! need to trace index range
@@ -529,6 +575,7 @@ private:
BitMap arr_bmp_b3ec;
BitMap arr_bmp_bbbc; // used by death
BitMap arr_bmp_c38c; // used by death
+ BitMap arr_bmp_fa3c;
Handle arr_bytes_109dc; // used for data buffering
BitMap arr_bmp_109dc;
BitMap arr_bmp_138bc;
@@ -537,10 +584,11 @@ private:
GrafPort arr_grafport_19042;
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
+ Common::Rect arr_rect_19114;
PicHandle arr_i32_1912c[0x54];
PicHandle arr_i32_192c0[101];
PolyHandle arr_poly_192c0[101];
- int32 arr_i32_19454[0x65];
+ int32 puzzleDataOffsets[101]; // arr_i32_19454
Common::U32String arr_str_195e8[101]; // 0x20 each
Common::U32String arr_str_1a288[101]; // 0x10 each
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index f0b00aff0ee..09b61e02b8a 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -34,9 +34,11 @@ namespace Fool {
ZBasic *g_zbasic;
Toolbox *g_toolbox;
-// Based on disassembly of Fool's Errand v2.0.
-// v3.0 had several features removed to improve compatibility with later versions of Mac OS,
-// and was built with a different ZBASIC compiler.
+// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
+
+// v1.0 - original release, single-density disks
+// v2.0 - fixes full-screen rendering on higher-resolution displays
+// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
void FoolPrologue::run() {
g_toolbox = new Toolbox();
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
new file mode 100644
index 00000000000..3e49f62095e
--- /dev/null
+++ b/engines/fool/fool_thoth.cpp
@@ -0,0 +1,769 @@
+/* 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 "graphics/managed_surface.h"
+
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// high priestess challenge
+void FoolGame::sub_140_004() {
+ // 140:0004
+ if (this->var_i16_c04 < 4) {
+ this->sub_140_3372();
+ }
+ if ((this->var_i16_7ce & 2) != 0) {
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ }
+ if (this->var_i16_c04 == 0) {
+ this->var_i16_e14 = 1;
+ this->sub_140_458();
+ this->var_i16_e14 = 0;
+ if (this->var_i16_d0c == 0) {
+ this->sub_140_3412();
+ return;
+ }
+ // 140:0056
+ this->var_i16_c04 = 1;
+ }
+ // 140:005c
+ if (this->var_i16_c04 == 1) {
+ this->sub_140_12fc();
+ if (this->var_i16_d0c == 0) {
+ this->sub_140_3412();
+ return;
+ }
+ this->var_i16_c04 = 2;
+ }
+ // 140:007e
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ this->sub_140_2f92();
+ if (this->var_i16_c04 == 2) {
+ this->sub_140_1486();
+ if (this->var_i16_d0c == 0) {
+ this->sub_140_3412();
+ return;
+ }
+ this->var_i16_c04 = 3;
+ if (this->puzzleCompletionStatus[0x17] == 0x63) {
+ // 140:00ce
+ this->puzzleCompletionStatus[0x17] = 0x64;
+ this->var_str_384 = this->arr_str_195e8[0x17] + g_zbasic->str(301); // ' '
+ g_zbasic->menu(0x4, 0x7, 0x1, this->var_str_384);
+ }
+ }
+ // 140:0116
+ if (this->var_i16_c04 == 3) {
+ this->sub_140_18fa();
+ if (this->puzzleCompletionStatus[0x3f] == 0x63) {
+ this->puzzleCompletionStatus[0x3f] = 0x64;
+ this->var_str_384 = this->arr_str_195e8[0x3f] + g_zbasic->str(302); // ' '
+ g_zbasic->menu(6, 0xf, 1, this->var_str_384);
+ }
+ }
+ // 140:019c
+ if (this->var_i16_c04 == 4) {
+ this->var_i16_2324 = 6;
+ this->sub_140_206a();
+ if (this->var_i16_d0c == 0) {
+ this->sub_140_3412();
+ return;
+ }
+ this->arr_i16_1d24[0x51] |= 0x5;
+ if (this->puzzleCompletionStatus[0x48] == 0x63) {
+ this->puzzleCompletionStatus[0x48] = 0x64;
+ this->var_str_384 = this->arr_str_195e8[0x48] + g_zbasic->str(303);
+ g_zbasic->menu(7, 8, 1, this->var_str_384);
+ }
+ }
+ // 140:024c
+ if (this->var_i16_7d2 == 0) {
+ g_toolbox->PenNormal();
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
+ g_zbasic->picture(0, 0, this->arr_i32_192c0[0]);
+ g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ this->sub_128_61c2();
+ }
+ // 140:02a2
+ if (this->var_i16_37a == 0) {
+ g_toolbox->SetPort(this->var_i32_8);
+ } else {
+ this->sub_128_1ef8();
+ }
+ // 140:02b4
+ this->var_i16_68a = 1;
+ for (int16 i = 1; i <= 0x155; i++) {
+ g_zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
+ g_zbasic->put(g_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kPutCopy);
+ }
+ // 140:0328
+ if (this->var_i16_7d2 == 0) {
+ g_toolbox->PenNormal();
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 0;
+ this->arr_i16_4758[2] = SCREEN_HEIGHT;
+ this->arr_i16_4758[3] = SCREEN_WIDTH;
+
+ for (int16 i = 0; i <= 0x22; i++) {
+ this->var_i32_692 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(Common::Rect(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]));
+ this->sub_128_406(1);
+ }
+ // 140:037e
+ this->var_i16_484 = 0x96;
+
+ for (int16 i = 0x37; i <= 0x122; i++) {
+ if (i < 0x69) {
+ this->var_i16_484 -= 3;
+ }
+ if (i > 0xf0) {
+ this->var_i16_484 += 3;
+ }
+ g_toolbox->MoveTo(this->var_i16_484 + 0x5f - g_zbasic->rndInt(0x32), i);
+ g_toolbox->LineTo(0x1a1 - this->var_i16_484 + g_zbasic->rndInt(0x32), i);
+ }
+ // 140:03f0
+ g_zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
+ this->var_i16_7a2 = 0x96;
+ this->sub_128_918(g_zbasic->str(304)); // you cannot claim
+ this->var_i16_7a2 = 0xb9;
+ this->sub_128_918(g_zbasic->str(305)); // the book of thoth
+ this->var_i16_7a2 = 0xdc;
+ this->sub_128_918(g_zbasic->str(306)); // so easily
+ g_toolbox->SetPort(this->var_i32_0);
+ this->sub_128_61c2();
+ }
+ // 140:0450
+ this->sub_140_32ac();
+ this->sub_140_3412();
+ return;
+}
+
+void FoolGame::sub_140_458() {
+ // 140:0458
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_140_12fc() {
+ // 140:12fc
+ this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
+ g_zbasic->picture(0, 0x14, this->var_pic_7c2);
+ if ((this->var_i16_7ce & 2) != 0) {
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x22]);
+ }
+ // 140:1346
+ g_toolbox->PenSize(5, 5);
+ g_toolbox->PenMode(kPatXor);
+ this->var_ev_46.where = Common::Point(0, 0);
+ // 140:139a
+ while (!((this->var_ev_46.where.x >= 0xff) && (this->var_ev_46.where.y >= 0xa2) && (this->var_ev_46.where.x <= 0x10e) && (this->var_ev_46.where.y <= 0xac))) {
+ // 140:1366
+ this->getNextEvent(-1); // was: 0
+ g_toolbox->MoveTo(0x105, 0xa2);
+ g_toolbox->LineTo(this->var_ev_46.where.x, this->var_ev_46.where.y);
+ this->sub_128_3da(2);
+ g_toolbox->MoveTo(0x105, 0xa2);
+ g_toolbox->LineTo(this->var_ev_46.where.x, this->var_ev_46.where.y);
+ }
+ // 140:13dc
+ g_toolbox->PenNormal();
+ if ((this->var_i16_7ce & 2) == 0) {
+ this->stateFlags = kStateReturn;
+ this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
+ this->sub_128_3da(0x3c);
+ this->var_i16_d0c = 0;
+ } else {
+ // 140:1446
+ this->var_str_384 = g_zbasic->str(322); // behold ye the book of thoth
+ this->sub_128_178a(0, 0);
+ this->sub_140_2f92();
+ this->var_i16_7ce ^= 2;
+ this->var_i16_7b2 = 0xa;
+ this->var_i16_d0c = 1;
+ }
+ // 140:1484
+}
+
+void FoolGame::sub_140_1486() {
+ // 140:1486
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_140_18fa() {
+ // 140:18fa
+ if (this->activePuzzle != 0x34) {
+ this->sub_140_3372();
+ }
+ // STUB: rig the data pointer
+ // 140:1908: MOVE.L - var_i32_232a,D0
+ // 140:190c: ADDI.L - 0x000001c4,D0
+ // 140:1912: MOVE.L - D0,var_i32_696
+ for (int16 i = 0; i <= 3; i++) {
+ for (int16 j = 0; j <= 3; j++) {
+ this->arr_i16_2f38[i*32 + j] = puzzlesReadShort();
+ }
+ }
+ // 140:195e
+ for (int16 i = 0; i <= 3; i++) {
+ this->arr_rect_1f38[i].top = 0x14;
+ this->arr_rect_1f38[i].left = 0;
+ this->arr_rect_1f38[i].bottom = SCREEN_HEIGHT;
+ this->arr_rect_1f38[i].right = SCREEN_WIDTH;
+ }
+ // 140:19dc
+ this->arr_rect_1f38[0].right = 0xf;
+ this->arr_rect_1f38[1].left = 0x1f1;
+ this->arr_rect_1f38[2].bottom = 0x23;
+ this->arr_rect_1f38[3].top = 0x147;
+ this->arr_i16_4338[1] = 0;
+ this->arr_i16_4338[9] = 2;
+ for (int16 i = 0x14; i <= 0x1a; i++) {
+ this->arr_i16_4338[i - 0x12] = i;
+ this->arr_i16_4338[0x1a - i + 0xa] = i;
+ }
+ // 140:1a9c
+ this->var_i16_103a = 0;
+ this->var_i16_232e = 0;
+ this->stateFlags = kStateNull;
+ this->var_i16_d0c = 0;
+ // 140:1b98
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 140:1ab8
+ if (this->activePuzzle == 0x34) {
+ this->var_i16_232e++;
+ if (this->var_i16_232e < 1) {
+ this->var_i16_232e = 1;
+ }
+ if (this->var_i16_232e > 3) {
+ this->var_i16_232e = 1;
+ }
+ switch (this->var_i16_232e-1) {
+ case 0:
+ this->sub_140_325a();
+ break;
+ case 1:
+ this->sub_140_326e();
+ break;
+ case 2:
+ this->sub_140_3282();
+ break;
+ default:
+ warning("sub_140_18fa: broke out of switch");
+ break;
+ }
+ } else {
+ // 140:1b08
+ this->var_i16_232e++;
+ if (this->var_i16_232e < 1) {
+ this->var_i16_232e = 1;
+ }
+ if (this->var_i16_232e > 0x10) {
+ this->var_i16_232e = 1;
+ }
+ g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_103a], this->arr_pat_58f4[this->arr_i16_4338[this->var_i16_232e]]);
+ }
+ // 140:1b66
+ this->getNextEvent(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_140_1bc4();
+ }
+ // 140:1b7a
+ if (this->var_i16_103a == 4) {
+ this->var_i16_d0c = 1;
+ }
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+ }
+ // 140:1bc2
+}
+
+void FoolGame::sub_140_1bc4() {
+ // 140:1bc4
+ this->var_i16_2332 = 1;
+ if (this->activePuzzle == 0x34) {
+ if ((this->var_ev_46.where.x >= 0xf) && (this->var_ev_46.where.y >= 0x2d) && (this->var_ev_46.where.x <= 0x1f1) && (this->var_ev_46.where.x <= 0x147)) {
+ this->var_i16_2332 = 0;
+ }
+ } else {
+ // 140:1c22
+
+ }
+ // 140:1c58
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_140_206a() {
+ // 140:206a
+ this->var_i16_d0c = 0;
+ this->stateFlags = kStateNull;
+ this->sub_140_2998();
+ this->sub_140_2978();
+ this->copyScreen(1, this->arr_bmp_b3ec);
+ this->arr_i16_1eb8[1] = -1;
+ this->var_i16_2324 = 0;
+ this->var_i16_1de6 = this->arr_i16_3b38[this->var_i16_2324];
+ // JMP 0x228c
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 140:20c2
+ do {
+ if (this->activePuzzle == 0x34) {
+ this->var_i16_2334 = this->arr_i16_3b38[this->var_i16_2324];
+ this->var_i16_2336 = this->arr_i16_3b38[this->var_i16_2324 + 0x20];
+ do {
+ this->getNextEvent(-1);
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[this->var_i16_2334]], this->arr_pat_58f4[this->var_i16_2338]);
+ this->var_i16_2334++;
+ if (this->var_i16_2324 != 5) {
+ g_toolbox->Delay(4);
+ } else {
+ g_toolbox->Delay(2);
+ }
+ // 140:2168
+ } while ((this->var_ev_46.what == 1) || (this->var_i16_2334 > this->var_i16_2336) || ((this->stateFlags & kStateReturn) != 0));
+ // 140:219e
+ if ((this->var_ev_46.what == 0) && ((this->stateFlags & kStateReturn) == 0)) {
+ if (this->var_i16_2324 != 5) {
+ g_toolbox->Delay(0x7d);
+ } else {
+ g_toolbox->Delay(0xfa);
+ }
+ }
+ // 140:21e8
+ this->copyScreen(1, this->arr_bmp_b3ec);
+ }
+ // 140:21fe
+ this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
+ this->var_i16_68a = g_zbasic->rndInt(0x14) - 1;
+ this->var_i16_68c = g_zbasic->rndInt(0xe) - 1;
+ // 140:2222
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], this->arr_pat_58f4[this->var_i16_484]);
+ this->getNextEvent(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_140_22b8();
+ }
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+ // 140:228c
+ } while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0));
+ }
+}
+
+void FoolGame::sub_140_22b8() {
+ // 140:22b8
+ while (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->var_i16_2324] + 1))) {
+ // 140:22bc
+ this->getNextEvent(-1); // was: 0
+ this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ if ((this->var_i16_68a >= 0) && (this->var_i16_68c >= 0) && (this->var_i16_68a <= 0x13) && (this->var_i16_68c <= 0xd)) {
+ // 140:2316
+ this->arr_i16_1eb8[0] = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
+ if (this->arr_i16_1eb8[0] != this->arr_i16_1eb8[1]) {
+ // 140:2372
+ if (this->arr_i16_1eb8[0] != this->arr_i16_3738[this->var_i16_1de6]) {
+ this->sub_140_24ae();
+ return;
+ }
+ // 140:23aa
+ this->arr_i16_1eb8[1] = this->arr_i16_1eb8[0];
+ this->sub_128_50e(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_1eb8[0]], this->arr_pat_58f4[2]);
+ this->var_i16_1de6++;
+ }
+ }
+ // 140:2422
+ }
+ // 140:2472
+ if (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->var_i16_2324] + 1)) {
+ this->sub_140_24ae();
+ } else {
+ this->sub_140_25e4();
+ }
+}
+
+void FoolGame::sub_140_24ae() {
+ // 140:24ae
+ this->sub_128_50e(0x14, 0x64, 0x0);
+ while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ // 140:24c4
+ this->getNextEvent(-1);
+ this->var_i16_484 = g_zbasic->rndInt(0x50);
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_1eb8[0]], this->arr_pat_58f4[this->var_i16_484]);
+ }
+ // 140:2520
+ if (this->activePuzzle != 0x34) {
+ this->copyScreen(1, this->arr_bmp_b3ec);
+ } else {
+ for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[this->var_i16_2324]; i--) {
+ this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[i]], this->arr_pat_58f4[this->var_i16_484]);
+ }
+ }
+ // 140:25b4
+ this->arr_i16_1eb8[1] = -1;
+ this->var_i16_1de6 = this->arr_i16_3b38[this->var_i16_2324];
+}
+
+void FoolGame::sub_140_25e4() {
+ // 140:25e4
+ if (this->activePuzzle == 0x34) {
+ this->var_i16_d0c = 1;
+ return;
+ }
+ // 140:25f6
+ if (this->var_i16_2324 < 5) {
+ this->sub_140_2662();
+ }
+ if (this->var_i16_2324 == 4) {
+ this->sub_140_26ca();
+ }
+ if (this->var_i16_2324 == 5) {
+ this->sub_140_28bc();
+ }
+ if (this->var_i16_2324 == 6) {
+ this->sub_140_2968();
+ }
+ if (this->var_i16_d0c == 0) {
+ this->var_i16_2324++;
+ if (this->var_i16_2324 == 6) {
+ this->sub_140_2998();
+ }
+ this->sub_140_2978();
+ this->copyScreen(1, this->arr_bmp_b3ec);
+ }
+ // 140:2660
+}
+
+void FoolGame::sub_140_2662() {
+ // 140:2662
+ this->arr_i16_4758[0] = 0x29;
+ this->arr_i16_4758[1] = 0x37;
+ this->arr_i16_4758[2] = 0x142;
+ this->arr_i16_4758[3] = 0x1c9;
+ Common::Rect temp(0x37, 0x29, 0x1c9, 0x142);
+ for (int16 i = 0; i <= 0x10; i++) {
+ g_toolbox->InvertRect(temp);
+ this->sub_128_3da(1);
+ }
+}
+
+void FoolGame::sub_140_26ca() {
+ // 140:26ca
+ this->sub_128_4da(0);
+ g_toolbox->PenSize(0xa, 0x7);
+
+ for (int16 j = 0; j <= 2; j++) {
+ // 140:26e0
+ this->arr_i16_4758[1] = 0x2d;
+ this->arr_i16_4758[0] = 0x22;
+ this->arr_i16_4758[3] = 0x1d3;
+ this->arr_i16_4758[2] = 0x149;
+ for (int16 i = 0; i <= 0x14; i++) {
+ this->arr_i16_4758[0] += 7;
+ this->arr_i16_4758[1] += 0xa;
+ this->arr_i16_4758[2] -= 7;
+ this->arr_i16_4758[3] -= 0xa;
+ Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ g_toolbox->InvertRect(temp);
+ this->sub_128_3da(1);
+ }
+ for (int16 i = 0; i <= 0x13; i++) {
+ this->arr_i16_4758[0] -= 7;
+ this->arr_i16_4758[1] -= 0xa;
+ this->arr_i16_4758[2] += 7;
+ this->arr_i16_4758[3] += 0xa;
+ Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ g_toolbox->InvertRect(temp);
+ this->sub_128_3da(1);
+ }
+ }
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ this->sub_128_4da(1);
+}
+
+void FoolGame::sub_140_28bc() {
+ // 140:28bc
+ if (this->puzzleCompletionStatus[0x68] > 4) {
+ this->sub_128_6186();
+ this->sub_128_2664();
+ this->sub_128_d34(0x29, 0x37, 0x142, 0x1c9, 0x96);
+ this->var_i16_d0c = 1;
+ } else {
+ // 140:290c
+ this->sub_128_962(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
+ this->var_str_384 = g_zbasic->str(323); // behold the last key of thoth
+ this->sub_128_178a(0x48, 2);
+ }
+ // 140:2966
+}
+
+void FoolGame::sub_140_2968() {
+ // 140:2968
+ this->sub_128_2664();
+ this->sub_128_61c2();
+ this->var_i16_d0c = 1;
+}
+
+void FoolGame::sub_140_2978() {
+ // 140:2978
+ this->sub_128_6186();
+ if (this->var_i16_2324 < 6) {
+ this->var_i16_2338 = 1;
+ } else {
+ this->var_i16_2338 = 2;
+ }
+}
+
+void FoolGame::sub_140_2998() {
+ // 140:2998
+ if (this->var_i16_2324 != 6) {
+ this->sub_128_271a();
+ this->arr_i16_1eb8[4] = 0x37;
+ this->arr_i16_1eb8[5] = 0x29;
+ this->arr_i16_1eb8[6] = 0x14;
+ this->arr_i16_1eb8[7] = 0x14;
+ this->arr_i16_1eb8[8] = 0x29;
+ this->arr_i16_1eb8[9] = 0x12d;
+ this->arr_i16_1eb8[10] = 0x37;
+ this->arr_i16_1eb8[11] = 0x1bd;
+ this->arr_i16_1eb8[12] = 0x15;
+ this->arr_i16_1eb8[13] = 0x15;
+ for (int16 i = 0; i <= 0x13; i++) {
+ this->arr_i16_5bbc[i] = this->puzzlesReadShort();
+ }
+ for (int16 i = 0; i <= 0xd; i++) {
+ this->arr_i16_5cbc[i] = this->puzzlesReadShort();
+ }
+ // 140:2aa4
+ for (int16 i = 0; i <= 0xcd; i++) {
+ this->arr_i16_3738[i] = this->puzzlesReadShort();
+ this->arr_i16_3738[i] = (this->arr_i16_3738[i]/4) + 1;
+ }
+ // 140:2b06
+ for (int16 i = 1; i <= 6; i++) {
+ this->arr_i16_3b38[i] = this->puzzlesReadShort();
+ this->arr_i16_3b38[0x20 + i] = this->puzzlesReadShort();
+ }
+ // 140:2b54
+
+ } else {
+ // 140:2b58
+ if (this->activePuzzle != 0x34) {
+ this->sub_140_3372();
+ }
+ // FIXME: some kind of manual bodge for the puzzle data loader,
+ // this looks lethal
+ // 140:2b66: MOVE.L - var_i32_232a,D0
+ // 140:2b6a: ADDI.L - 0x000001e4,D0
+ // 140:2b70: MOVE.L - D0,var_i32_696
+ this->var_bytes_696 = this->var_bytes_232a;
+ this->var_ptr_696 = this->var_ptr_232a + 0x1e4;
+ for (int16 i = 0; i <= 0xe; i++) {
+ this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ }
+ for (int16 i = 0; i <= 0x13; i++) {
+ this->arr_i16_5bbc[i] = this->puzzlesReadShort();
+ }
+ for (int16 i = 0; i <= 0xd; i++) {
+ this->arr_i16_5cbc[i] = this->puzzlesReadShort();
+ }
+ // 140:2bfe
+ for (int16 i = 0x9c; i <= 0xcd; i++) {
+ this->arr_i16_3738[i] = this->puzzlesReadShort();
+ }
+ this->arr_i16_3b38[6] = 0x9c;
+ this->arr_i16_3b38[6+0x20] = 0xcd;
+ }
+ // 140:2c58
+ this->var_i16_484 = 0;
+ this->var_i16_68c = this->arr_i16_1eb8[8];
+ do {
+ this->var_i16_68a = this->arr_i16_1eb8[0xa];
+ do {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ this->var_i16_68a,
+ this->var_i16_68c,
+ this->var_i16_68a + this->arr_i16_1eb8[0xd],
+ this->var_i16_68c + this->arr_i16_1eb8[0xc]
+ );
+ // 140:2ce4
+ } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
+ } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ // 140:2d46
+
+ this->var_i16_484 = 0;
+ for (int16 j = 0; j <= 0xd; j++) {
+ for (int16 i = 0; i <= 0x13; i++) {
+ this->var_i16_484++;
+ this->arr_i16_2f38[i*32 + j] = this->var_i16_484;
+ }
+ }
+ // 140:2d94
+ if (this->var_i16_2324 != 6) {
+ g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ for (int16 j = 0; j <= 0x13; j++) {
+ for (int16 i = 0; i <= 0xd; i++) {
+ g_toolbox->EraseRect(this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ g_toolbox->FrameRect(this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ }
+ }
+ } else {
+ // 140:2e7a
+ for (int16 k = 0; k <= 0x13; k++) {
+ this->var_i16_68a = k;
+ for (int16 j = 0; j <= 0xd; j++) {
+ // 140:2e8c
+ this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
+ g_toolbox->FillRect(
+ this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
+ this->arr_pat_58f4[this->var_i16_484]
+ );
+ this->var_i16_68a++;
+ if (this->var_i16_68a > 0x13) {
+ this->var_i16_68a = 0;
+ }
+ // 140:2f12
+ }
+ }
+ }
+ // 140:2f2e
+ if ((this->var_i16_2324 == 6) && (this->activePuzzle != 0x34)) {
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(324)); // the last key of thoth
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(325)); // return to scroll
+ }
+ this->copyScreen(0, this->arr_bmp_b3ec);
+}
+
+void FoolGame::sub_140_2f92() {
+ // 140:2f92
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(326)); // the book of thoth
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(327)); // return to scroll
+ g_zbasic->menu(8, 2, 0, g_zbasic->str(328)); // -
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(329)); // be forewarned
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(330)); // the high priestess has corrupted
+ g_zbasic->menu(8, 5, 1, g_zbasic->str(331)); // the book of thoth. you may need
+ g_zbasic->menu(8, 6, 1, g_zbasic->str(332)); // the help of others to unlock its
+ g_zbasic->menu(8, 7, 1, g_zbasic->str(333)); // secrets.
+}
+
+void FoolGame::sub_140_3050() {
+ // 140:3050
+ this->arr_i16_4758[0] = 0x14 + g_zbasic->rndInt(0xde);
+ this->arr_i16_4758[1] = g_zbasic->rndInt(0x19c);
+ this->arr_i16_4758[2] = this->arr_i16_4758[0] + 0x64;
+ this->arr_i16_4758[3] = this->arr_i16_4758[1] + 0x64;
+}
+
+void FoolGame::sub_140_30da() {
+ // 140:30da
+ this->arr_i16_4758[0] = 0x14 + g_zbasic->rndInt(0xde);
+ this->arr_i16_4758[1] = 0;
+ this->arr_i16_4758[2] = this->arr_i16_4758[0] + g_zbasic->rndInt(0x64);
+ this->arr_i16_4758[3] = SCREEN_WIDTH;
+}
+
+void FoolGame::sub_140_3148() {
+ // 140:3148
+ this->arr_i16_4758[0] = 0x14;
+ this->arr_i16_4758[1] = g_zbasic->rndInt(0x19c);
+ this->arr_i16_4758[2] = SCREEN_HEIGHT;
+ this->arr_i16_4758[3] = this->arr_i16_4758[1] + g_zbasic->rndInt(0x64);
+}
+
+void FoolGame::sub_140_325a() {
+ // 140:325a
+ this->sub_140_3050();
+ Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_140_326e() {
+ // 140:326e
+ this->sub_140_30da();
+ Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_140_3282() {
+ // 140:3282
+ this->sub_140_3148();
+ Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_140_32ac() {
+ // 140:33ac
+ this->sub_128_4da(0);
+ g_toolbox->PenNormal();
+ for (int16 j = 0; j <= 0x22; j++) {
+ for (int16 i = -5; i <= 0x159; i += 0xa) {
+ g_toolbox->MoveTo(0, g_zbasic->rndInt(0xa) + i);
+ g_toolbox->LineTo(SCREEN_WIDTH, g_zbasic->rndInt(0xa) + i);
+ }
+ }
+ // 140:3300
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 0;
+ this->arr_i16_4758[2] = SCREEN_HEIGHT;
+ this->arr_i16_4758[3] = SCREEN_WIDTH;
+ Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ for (int16 i = 1; i <= 0xd; i++) {
+ this->var_i32_692 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(temp);
+ this->sub_128_406(1);
+ }
+ // 140:334a
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ this->sub_128_4da(1);
+ g_toolbox->SetPort(this->var_i32_0);
+}
+
+void FoolGame::sub_140_3372() {
+ this->var_i16_484 = (this->puzzleDataOffsets[0x34] - 1) / 1000;
+ this->var_i16_7e4 = (this->puzzleDataOffsets[0x34] - 1) % 1000;
+ g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
+ this->var_bytes_696 = this->arr_bytes_109dc;
+ this->var_bytes_232a = this->var_bytes_696;
+ this->var_ptr_232a = this->var_ptr_696;
+ this->var_bytes_696 = g_zbasic->readFile(1, this->puzzleDataOffsets[0x35] - this->puzzleDataOffsets[0x34]);
+ this->var_ptr_696 = 0;
+}
+
+void FoolGame::sub_140_3412() {
+ // 140:3412
+ g_toolbox->PenNormal();
+ if ((this->var_i16_7ce & 2) == 0) {
+ g_toolbox->InitCursor();
+ }
+}
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 717da7a1a0a..77b1b4239be 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -13,6 +13,7 @@ MODULE_OBJS = \
fool_reveal.o \
fool_sentence.o \
fool_sun.o \
+ fool_thoth.o \
fool_wordsearch.o \
toolbox.o \
toolbox_fileman.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 69a352cbb5b..8c418b28807 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -1108,6 +1108,8 @@ public:
// drawing is performed.
void MoveTo(int16 h, int16 v);
+ void OffsetRect(Common::Rect &r, int16 dh, int16 dv);
+
// FUNCTION OpenPoly : PolyHandle;
// OpenPoly returns a handle to a new polygon and tells QuickDraw to start saving the polygon
// definition as specified by calls to line-drawing routines. While a polygon is open, all calls to Line
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 1fa07bf1c89..01e861aa5be 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -638,6 +638,14 @@ void Toolbox::MoveTo(int16 h, int16 v) {
}
}
+void Toolbox::OffsetRect(Common::Rect &r, int16 dh, int16 dv) {
+ r.left += dh;
+ r.right += dh;
+ r.top += dv;
+ r.bottom += dv;
+}
+
+
PolyHandle Toolbox::OpenPoly() {
HidePen();
PolyHandle handle(new Polygon());
Commit: c7670644612ebdbcc31f60e0b518ab2e8012b41e
https://github.com/scummvm/scummvm/commit/c7670644612ebdbcc31f60e0b518ab2e8012b41e
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:18+02:00
Commit Message:
FOOL: Book of Thoth mostly working
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_thoth.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index a6d88f2dadb..5363a8835b9 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -2453,7 +2453,7 @@ void FoolGame::sub_128_5b30() {
if (this->var_i16_e12 == 0) {
this->var_ev_46.what = kNullEvent;
if (this->var_i16_e14 != 0) {
- this->sub_128_5ef0();
+ this->thothHidePlayfield();
}
this->var_i32_bf8 = g_toolbox->MenuSelect(this->var_ev_46.where);
this->selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
@@ -2465,7 +2465,7 @@ void FoolGame::sub_128_5b30() {
}
// 128:5b94
if (this->var_i16_e14 != 0) {
- this->sub_128_5f16();
+ this->thothShowPlayfield();
}
this->sub_128_61ec();
}
@@ -2480,11 +2480,11 @@ void FoolGame::sub_128_5baa() {
this->selectedMenuItem = this->var_i32_bf8 & 0xffff;
if (this->selectedMenuID > 0) {
if (this->var_i16_e14 != 0) {
- this->sub_128_5ef0();
+ this->thothHidePlayfield();
}
this->sub_128_5c20();
if (this->var_i16_e14 != 0) {
- this->sub_128_5f16();
+ this->thothShowPlayfield();
}
g_toolbox->HiliteMenu(0);
}
@@ -2576,23 +2576,24 @@ void FoolGame::sub_128_5c20() {
// 128:5eee
}
-void FoolGame::sub_128_5ef0() {
+void FoolGame::thothHidePlayfield() {
// 128:5ef0
this->copyScreen(0, this->arr_bmp_b3ec);
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
}
-void FoolGame::sub_128_5f16() {
+void FoolGame::thothShowPlayfield() {
// 128:5f16
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
// 128:5f4c
this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
+ this->saveGame();
}
// 128:5f70
- if ((this->stateFlags & 1) != 0) {
+ if ((this->stateFlags & 1) == 0) {
this->sub_128_6186();
this->copyScreen(1, this->arr_bmp_b3ec);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index a14ce2f35c9..241d29a9141 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -129,8 +129,8 @@ public:
void sub_128_5b30();
void sub_128_5baa();
void sub_128_5c20();
- void sub_128_5ef0();
- void sub_128_5f16();
+ void thothHidePlayfield(); // sub_128_5ef0
+ void thothShowPlayfield(); // sub_128_5f16
void sub_128_5f9e();
void sub_128_5fb4();
void sub_128_5fea();
@@ -266,11 +266,20 @@ public:
// fool_thoth.cpp
void sub_140_004();
- void sub_140_458();
+ void thothHighPriestess(); // sub_140_458
+ void thothMoveEnchantment(); // sub_140_9f0
+ void thothDrawEnchantment(); // sub_140_b2c
+ void sub_140_c4c();
+ void thothScrambleScreen(); // sub_140_dd4
+ void sub_140_e3c();
+ void sub_140_f84();
void sub_140_12fc();
- void sub_140_1486();
+ void sub_140_15fc();
+ void thothBook(); // sub_140_1486
void sub_140_18fa();
void sub_140_1bc4();
+ void sub_140_1f68();
+ void sub_140_205e();
void sub_140_206a();
void sub_140_22b8();
void sub_140_24ae();
@@ -285,11 +294,18 @@ public:
void sub_140_3050();
void sub_140_30da();
void sub_140_3148();
+ void sub_140_31b0();
+ void sub_140_31c4();
+ void sub_140_31d8();
+ void sub_140_31fa();
+ void sub_140_321a();
+ void sub_140_323a();
void sub_140_325a();
void sub_140_326e();
void sub_140_3282();
+ void sub_140_3296();
void sub_140_32ac();
- void sub_140_3372();
+ void thothAdjustPuzzleData(); // sub_140_3372
void sub_140_3412();
// fool_death.cpp
@@ -500,6 +516,8 @@ private:
int16 var_i16_1de6;
+ PatternMode var_i16_1dee;
+
int16 var_i16_1e00;
int16 var_i16_2010;
@@ -517,10 +535,13 @@ private:
Common::U32String var_str_2222;
int16 var_i16_2322;
int16 var_i16_2324;
+ int16 var_i16_2326;
+ int16 var_i16_2328;
uint32 var_ptr_232a;
Handle var_bytes_232a;
int16 var_i16_232e;
+ int16 var_i16_2330;
int16 var_i16_2332;
int16 var_i16_2334;
int16 var_i16_2336;
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 3e49f62095e..9f0220325c6 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -34,15 +34,15 @@ extern Toolbox *g_toolbox;
// high priestess challenge
void FoolGame::sub_140_004() {
// 140:0004
- if (this->var_i16_c04 < 4) {
- this->sub_140_3372();
+ if (this->var_i16_c04 < 0x64) {
+ this->thothAdjustPuzzleData();
}
if ((this->var_i16_7ce & 2) != 0) {
g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
}
if (this->var_i16_c04 == 0) {
this->var_i16_e14 = 1;
- this->sub_140_458();
+ this->thothHighPriestess();
this->var_i16_e14 = 0;
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
@@ -64,7 +64,7 @@ void FoolGame::sub_140_004() {
g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
this->sub_140_2f92();
if (this->var_i16_c04 == 2) {
- this->sub_140_1486();
+ this->thothBook();
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
return;
@@ -164,9 +164,307 @@ void FoolGame::sub_140_004() {
return;
}
-void FoolGame::sub_140_458() {
+void FoolGame::thothHighPriestess() {
// 140:0458
- warning("STUB: %s", __func__);
+ this->sub_128_4da(0);
+ if (this->activePuzzleBuffer.empty()) { // was: str(307)
+ this->arr_i16_1eb8[0] = 0x63;
+ } else {
+ this->arr_i16_1eb8[0] = g_zbasic->unk_310(this->activePuzzleBuffer);
+ }
+ // 140:04a2
+ if (this->arr_i16_1eb8[0] < 1) {
+ this->arr_i16_1eb8[0] = 1;
+ }
+ if (this->arr_i16_1eb8[0] == 0x63) {
+ g_zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
+ this->var_i16_7a2 = 0xaf;
+ this->sub_128_918(g_zbasic->str(308)); // you dare to challenge
+ this->var_i16_7a2 = 0xd2;
+ this->sub_128_918(g_zbasic->str(309)); // the high priestess
+ this->sub_128_3da(0xb4);
+ }
+ // 140:0532
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_rect_1f38[i].top = puzzlesReadShort();
+ this->arr_rect_1f38[i].left = puzzlesReadShort();
+ this->arr_rect_1f38[i].bottom = this->arr_rect_1f38[i].top + 0x28;
+ this->arr_rect_1f38[i].right = this->arr_rect_1f38[i].left + 0x28;
+ }
+ // 140:060c
+ g_zbasic->picture(0, 0x14, this->var_pic_7c2);
+ this->copyScreen(0, this->arr_bmp_b3ec);
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ g_toolbox->PenSize(5, 5);
+ g_toolbox->PenMode(kPatXor);
+ for (int16 j = 0; j <= 1; j++) {
+ g_toolbox->MoveTo(0x104, 0xa2);
+ g_toolbox->LineTo(this->arr_rect_1f38[i].left + 0x14, this->arr_rect_1f38[i].top + 0x14);
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[i], 0x14, 0x14);
+ g_toolbox->Delay(0);
+ }
+ g_toolbox->PenNormal();
+ // 140:06cc
+ this->arr_i16_1eb8[2] = i;
+ this->thothDrawEnchantment();
+ }
+ // 140:06fc
+ g_toolbox->PenNormal();
+ this->sub_140_e3c();
+ this->arr_i16_4758[4] = 0x14;
+ this->arr_i16_4758[5] = 0;
+ this->arr_i16_4758[6] = SCREEN_HEIGHT;
+ this->arr_i16_4758[7] = SCREEN_WIDTH;
+ this->arr_i16_1eb8[1] = 0;
+ g_zbasic->unk_20();
+ this->sub_128_4da(1);
+ this->stateFlags = kStateNull;
+ this->var_i16_d0c = 0;
+ this->var_i16_2326 = 0;
+ this->var_i16_2328 = 0;
+
+ // new value: number of updates before a screen flash
+ this->arr_i16_1eb8[3] = 0;
+
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 140:0752
+ this->var_i32_692 = g_toolbox->TickCount();
+ this->arr_i16_1eb8[1]++;
+ this->arr_i16_1eb8[3]++;
+ if (this->arr_i16_1eb8[1] >= this->arr_i16_1eb8[0]) {
+ this->arr_i16_1eb8[1] = 0;
+ }
+ // flash the screen. normally this happens after running through all the
+ // remaining enchantments, so it increases in intensity as you clear them.
+ // limit the amount of continuous full-screen flashing to WCAG
+ // recommendation of 3/second
+ if (this->arr_i16_1eb8[3] >= MAX(this->arr_i16_1eb8[0], (int16)10)) {
+ this->arr_i16_1eb8[3] = 0;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[4];
+ temp.left = this->arr_i16_4758[5];
+ temp.bottom = this->arr_i16_4758[6];
+ temp.right = this->arr_i16_4758[7];
+ g_toolbox->InvertRect(temp);
+ }
+ // 140:07c4
+ // Phase 1: enchantments 99 to 34 are inverting and don't move
+ if (this->arr_i16_1eb8[0] >= 0x21) {
+ if ((this->arr_i16_1eb8[1] % 0xa) == 0) {
+ this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0];
+ } else {
+ // 140:0826
+ this->arr_i16_1eb8[2] = g_zbasic->rndInt(this->arr_i16_1eb8[0]);
+ }
+ // 140:084a
+ this->thothDrawEnchantment();
+ // Phase 2: enchantments 33 to 2 erase themselves and move around
+ } else {
+ // 140:0852
+ this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0] - this->arr_i16_1eb8[1];
+ if (this->arr_i16_1eb8[2] == this->arr_i16_1eb8[0]) {
+ if ((this->var_i16_2328 == 1) && (g_toolbox->TickCount() > (this->var_i32_68e + 0x28))) {
+ this->var_i16_2328 = 0;
+ }
+ if (this->var_i16_2328 == 0) {
+ this->var_i32_68e = g_toolbox->TickCount();
+ this->var_i16_2328 = 1;
+ this->thothMoveEnchantment();
+ }
+ // 140:090c
+ } else {
+ // 140:0910
+ this->thothMoveEnchantment();
+ }
+ }
+ do {
+ this->getNextEvent(-1);
+ if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ this->sub_140_c4c();
+ }
+ // 140:0934
+ if (this->var_i16_2326 != 0) {
+ this->thothScrambleScreen();
+ }
+ } while (this->var_ev_46.what != 0);
+ // 140:094a
+ this->sub_128_406(1);
+ }
+ // 140:097a
+ if (this->var_i16_d0c != 0) {
+ this->sub_140_f84();
+ this->activePuzzleBuffer.clear(); // was: 310
+ } else {
+ // 140:09a4
+ if (this->arr_i16_1eb8[0] < 1) {
+ this->arr_i16_1eb8[0] = 1;
+ }
+ this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
+ }
+ // 140:09ee
+}
+
+void FoolGame::thothMoveEnchantment() {
+ // 140:09f0
+ g_toolbox->FillRoundRect(this->arr_rect_1f38[this->arr_i16_1eb8[2]], 0x14, 0x14, this->arr_pat_58f4[2]);
+ this->arr_rect_1f38[this->arr_i16_1eb8[2]].top = g_zbasic->rndInt(0x11a) + 0x14;
+ this->arr_rect_1f38[this->arr_i16_1eb8[2]].left = g_zbasic->rndInt(0x1da);
+ this->arr_rect_1f38[this->arr_i16_1eb8[2]].bottom = this->arr_rect_1f38[this->arr_i16_1eb8[2]].top + 0x28;
+ this->arr_rect_1f38[this->arr_i16_1eb8[2]].right = this->arr_rect_1f38[this->arr_i16_1eb8[2]].left + 0x28;
+ this->thothDrawEnchantment();
+}
+
+void FoolGame::thothDrawEnchantment() {
+ // 140:0b2c
+ g_toolbox->PenNormal();
+ g_toolbox->EraseRoundRect(this->arr_rect_1f38[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(311)
+ this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ // 140:0bd2
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->arr_i16_1eb8[2]].left + 0x14 - (this->var_i16_484 / 2),
+ this->arr_rect_1f38[this->arr_i16_1eb8[2]].top + 0x18
+ );
+ g_toolbox->DrawString(this->var_str_384);
+}
+
+void FoolGame::sub_140_c4c() {
+ // 140:0c4c
+ if (this->var_i16_d0c != 0)
+ return;
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1f38[this->arr_i16_1eb8[0]])) {
+ this->arr_i16_1eb8[0]--;
+ if (this->arr_i16_1eb8[0] <= 0) {
+ this->var_i16_d0c = 1;
+ return;
+ }
+ this->var_i16_484 = this->arr_i16_1eb8[0] + 1;
+ g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x14, 0x14, this->arr_pat_58f4[2]);
+ this->sub_128_962(
+ this->arr_rect_1f38[this->var_i16_484].top,
+ this->arr_rect_1f38[this->var_i16_484].left,
+ this->arr_rect_1f38[this->var_i16_484].bottom,
+ this->arr_rect_1f38[this->var_i16_484].right,
+ 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatXor, 0xd
+ );
+ this->arr_i16_1eb8[1] = 0;
+ this->sub_140_e3c();
+ this->var_i16_2326 = 0;
+ this->var_i16_2328 = 0;
+ } else {
+ // 140:0dcc
+ this->var_i16_2326 = 1;
+ }
+}
+
+void FoolGame::thothScrambleScreen() {
+ // 140:0dd4
+ if (this->var_i16_2326 < 0) {
+ this->var_i16_2326 = 0;
+ }
+ this->sub_140_3050();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ this->sub_140_30da();
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ this->sub_140_3148();
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ temp.top = this->arr_i16_4758[4];
+ temp.left = this->arr_i16_4758[5];
+ temp.bottom = this->arr_i16_4758[6];
+ temp.right = this->arr_i16_4758[7];
+ g_toolbox->InvertRect(temp);
+ this->var_i16_2326++;
+ if (this->var_i16_2326 >= 4)
+ this->var_i16_2326 = 0;
+}
+
+void FoolGame::sub_140_e3c() {
+ // 140:0e3c
+ if (this->arr_i16_1eb8[0] == 1) {
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(312)); // the last enchantment
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(313)); // run for your life
+ } else {
+ // 140:0e8a
+ this->var_str_384 = Common::U32String::format(" %d", this->arr_i16_1eb8[0]);
+ this->var_str_9f4 = g_zbasic->str(314) + this->var_str_384 + g_zbasic->str(315); // the X enchantments
+ g_zbasic->menu(8, 0, 1, this->var_str_9f4);
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(316)); // run for your life
+ g_zbasic->menu(8, 2, 1, g_zbasic->str(317)); // -
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(318)); // or press each button
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(319)); // in descending order
+ this->var_str_9f4 = g_zbasic->str(320) + this->var_str_384 + g_zbasic->str(321); // from X to 1
+ g_zbasic->menu(8, 5, 1, this->var_str_9f4);
+ }
+ // 140:0f82
+ return;
+}
+
+void FoolGame::sub_140_f84() {
+ // 140:0f84
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(5, 5);
+ this->arr_i16_4758[4] = (this->arr_rect_1f38[1].top / 0x19) + 1;
+ this->arr_i16_4758[5] = (this->arr_rect_1f38[1].left / 0x19) + 1;
+ // 140:0fea
+ this->arr_i16_4758[6] = ((SCREEN_HEIGHT - this->arr_rect_1f38[1].bottom) / 0x19) + 1;
+ this->arr_i16_4758[7] = ((SCREEN_WIDTH - this->arr_rect_1f38[1].right) / 0x19) + 1;
+ // 140:1066
+ // unrolled loop
+ this->arr_i16_4758[0] = this->arr_rect_1f38[1].top;
+ this->arr_i16_4758[1] = this->arr_rect_1f38[1].left;
+ this->arr_i16_4758[2] = this->arr_rect_1f38[1].bottom;
+ this->arr_i16_4758[3] = this->arr_rect_1f38[1].right;
+ // 140:10aa
+ for (int16 i = 0; i <= 0x1a; i++) {
+ this->arr_i16_4758[0] -= this->arr_i16_4758[4];
+ this->arr_i16_4758[1] -= this->arr_i16_4758[5];
+ this->arr_i16_4758[2] += this->arr_i16_4758[6];
+ this->arr_i16_4758[3] += this->arr_i16_4758[7];
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FrameRect(temp);
+ this->sub_128_3da(1);
+ }
+ // 140:11ae
+ // unrolled loop
+ this->arr_i16_4758[0] = this->arr_rect_1f38[1].top;
+ this->arr_i16_4758[1] = this->arr_rect_1f38[1].left;
+ this->arr_i16_4758[2] = this->arr_rect_1f38[1].bottom;
+ this->arr_i16_4758[3] = this->arr_rect_1f38[1].right;
+ // 140:11f2
+ for (int16 i = 0; i <= 0x1a; i++) {
+ this->arr_i16_4758[0] -= this->arr_i16_4758[4];
+ this->arr_i16_4758[1] -= this->arr_i16_4758[5];
+ this->arr_i16_4758[2] += this->arr_i16_4758[6];
+ this->arr_i16_4758[3] += this->arr_i16_4758[7];
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ this->sub_128_3da(1);
+ }
+ // 140:12f6
+ this->sub_140_3296();
}
void FoolGame::sub_140_12fc() {
@@ -174,14 +472,19 @@ void FoolGame::sub_140_12fc() {
this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
if ((this->var_i16_7ce & 2) != 0) {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x22]);
+ g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
}
// 140:1346
g_toolbox->PenSize(5, 5);
g_toolbox->PenMode(kPatXor);
this->var_ev_46.where = Common::Point(0, 0);
// 140:139a
- while (!((this->var_ev_46.where.x >= 0xff) && (this->var_ev_46.where.y >= 0xa2) && (this->var_ev_46.where.x <= 0x10e) && (this->var_ev_46.where.y <= 0xac))) {
+ while (!(
+ (this->var_ev_46.where.x >= 0xff) &&
+ (this->var_ev_46.where.y >= 0xa2) &&
+ (this->var_ev_46.where.x <= 0x10e) &&
+ (this->var_ev_46.where.y <= 0xac)
+ )) {
// 140:1366
this->getNextEvent(-1); // was: 0
g_toolbox->MoveTo(0x105, 0xa2);
@@ -209,20 +512,202 @@ void FoolGame::sub_140_12fc() {
// 140:1484
}
-void FoolGame::sub_140_1486() {
+void FoolGame::thothBook() {
// 140:1486
- warning("STUB: %s", __func__);
+ if (this->activePuzzle != 0x34) {
+ this->thothAdjustPuzzleData();
+ }
+ // FIXME: this looks lethal
+ // 140:1494: MOVE.L - var_i32_232a,D0
+ // 140:1498: ADDI.L - 0x0000018c,D0
+ // 140:149e: MOVE.L - D0,var_i32_696
+ this->var_bytes_696 = this->var_bytes_232a;
+ this->var_ptr_696 = this->var_ptr_232a + 0x18c;
+ for (int16 j = 1; j <= 7; j++) {
+ for (int16 i = 0; i <= 3; i++) {
+ this->arr_i16_2f38[j*32+i] = this->puzzlesReadShort();
+ }
+ }
+
+ this->var_i16_d0c = 0;
+ this->var_i16_103a = 0;
+ this->stateFlags = kStateNull;
+ this->var_i16_232e = 0;
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 140:1506
+ // was: SetRect
+ this->arr_i16_4758[4] = 0x14;
+ this->arr_i16_4758[5] = 0;
+ this->arr_i16_4758[6] = SCREEN_HEIGHT;
+ this->arr_i16_4758[7] = SCREEN_WIDTH;
+ this->var_i16_232e++;
+ if (this->var_i16_232e < 1) {
+ this->var_i16_232e = 1;
+ }
+ if (this->var_i16_232e > 6) {
+ this->var_i16_232e = 1;
+ }
+ // 140:1546
+ switch (this->var_i16_232e-1) {
+ case 0:
+ this->sub_140_31b0();
+ break;
+ case 1:
+ this->sub_140_31c4();
+ break;
+ case 2:
+ this->sub_140_31d8();
+ break;
+ case 3:
+ this->sub_140_31fa();
+ break;
+ case 4:
+ this->sub_140_321a();
+ break;
+ case 5:
+ this->sub_140_323a();
+ break;
+ default:
+ warning("thothBook: breaking out of switch statement");
+ break;
+ }
+ if (this->activePuzzle != 0x34) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[(this->var_i16_103a + 1)*32];
+ temp.left = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+1];
+ temp.bottom = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+2];
+ temp.right = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[1]);
+ }
+ // 140:159e
+ this->getNextEvent(-1);
+ if (this->var_ev_46.what == 1) {
+ this->sub_140_15fc();
+ }
+ if (this->var_i16_103a == 4) {
+ this->var_i16_d0c = 1;
+ }
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+
+ // 140:15d0
+ }
+ // 140:15fa
+}
+
+void FoolGame::sub_140_15fc() {
+ // 140:15fc
+ this->var_i16_7e4 = 0;
+ for (int16 i = 1; i <= 7; i++) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[i*32];
+ temp.left = this->arr_i16_2f38[i*32+1];
+ temp.bottom = this->arr_i16_2f38[i*32+2];
+ temp.right = this->arr_i16_2f38[i*32+3];
+
+ if (g_toolbox->PtInRect(this->var_ev_46.where, temp)) {
+ this->var_i16_7e4 = i;
+ }
+ }
+ this->var_i16_103a++;
+ if (this->var_i16_7e4 != this->var_i16_103a) {
+ this->var_i16_103a = 0;
+ this->sub_128_50e(0xf, 0x64, 0x1);
+ for (int16 i = 0; i <= 9; i++) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[4];
+ temp.left = this->arr_i16_4758[5];
+ temp.bottom = this->arr_i16_4758[6];
+ temp.right = this->arr_i16_4758[7];
+ g_toolbox->InvertRect(temp);
+ }
+ } else {
+ // 140:1698
+ if (this->activePuzzle == 0x34) {
+ for (int16 i = 0; i <= 7; i++) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[32*i];
+ temp.left = this->arr_i16_2f38[32*i+1];
+ temp.bottom = this->arr_i16_2f38[32*i+2];
+ temp.right = this->arr_i16_2f38[32*i+3];
+ g_toolbox->EraseRect(temp);
+ }
+ // 140:16ce
+ for (int16 i = 1; i <= 0xc; i++) {
+ for (int16 j = 1; j <= 7; j++) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[32*j];
+ temp.left = this->arr_i16_2f38[32*j+1];
+ temp.bottom = this->arr_i16_2f38[32*j+2];
+ temp.right = this->arr_i16_2f38[32*j+3];
+ g_toolbox->InvertRect(temp);
+ }
+ this->sub_128_3da(2);
+ }
+ // 140:1710
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[32*this->var_i16_7e4];
+ temp.left = this->arr_i16_2f38[32*this->var_i16_7e4+1];
+ temp.bottom = this->arr_i16_2f38[32*this->var_i16_7e4+2];
+ temp.right = this->arr_i16_2f38[32*this->var_i16_7e4+3];
+ for (int16 i = 1; i <= 0x19; i++) {
+ g_toolbox->InvertRect(temp);
+
+ }
+ // 140:173a
+ if (this->var_i16_103a < 4) {
+ this->var_i16_2330 = 2;
+ this->var_i16_1dee = kPatXor;
+ } else {
+ // 140:1756
+ this->var_i16_2330 = 3;
+ this->var_i16_1dee = kPatCopy;
+ }
+ // 140:1762
+ this->sub_128_962(
+ this->arr_i16_2f38[32*this->var_i16_7e4],
+ this->arr_i16_2f38[32*this->var_i16_7e4+1],
+ this->arr_i16_2f38[32*this->var_i16_7e4+2],
+ this->arr_i16_2f38[32*this->var_i16_7e4+3],
+ 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH,
+ this->var_i16_2330, this->var_i16_1dee, 0x19
+ );
+ } else {
+ // 140:1804
+ for (int16 i = 0; i <= 3; i++) {
+ this->arr_i16_4758[i] = this->arr_i16_2f38[32*this->var_i16_103a + i];
+ }
+ // 140:184e
+ for (int16 i = 0; i <= 0x24; i++) {
+ this->arr_i16_4758[0]++;
+ this->arr_i16_4758[1]++;
+ this->arr_i16_4758[2]--;
+ this->arr_i16_4758[3]--;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ }
+ }
+ }
+ // 140:18f8
+
}
void FoolGame::sub_140_18fa() {
// 140:18fa
if (this->activePuzzle != 0x34) {
- this->sub_140_3372();
+ this->thothAdjustPuzzleData();
}
- // STUB: rig the data pointer
+ // FIXME: this looks lethal
// 140:1908: MOVE.L - var_i32_232a,D0
// 140:190c: ADDI.L - 0x000001c4,D0
// 140:1912: MOVE.L - D0,var_i32_696
+ this->var_bytes_696 = this->var_bytes_232a;
+ this->var_ptr_696 = this->var_ptr_232a + 0x1c4;
for (int16 i = 0; i <= 3; i++) {
for (int16 j = 0; j <= 3; j++) {
this->arr_i16_2f38[i*32 + j] = puzzlesReadShort();
@@ -312,10 +797,116 @@ void FoolGame::sub_140_1bc4() {
}
} else {
// 140:1c22
-
+ if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1f38[this->var_i16_103a]) == 0) {
+ this->var_i16_2332 = 0;
+ }
}
// 140:1c58
- warning("STUB: %s", __func__);
+ if (this->var_i16_2332 == 0) {
+ this->sub_140_1f68();
+ return;
+ }
+ // 140:1c66
+ this->arr_i16_4758[0] = 0x14;
+ this->arr_i16_4758[1] = -1;
+ this->arr_i16_4758[2] = 0x157;
+ this->arr_i16_4758[3] = 0x201;
+ if (this->var_ev_46.where.x < 0xf) {
+ this->arr_i16_4758[3] = 0xf;
+ this->var_i16_1de6 = 0;
+ }
+ // 140:1cc6
+ if (this->var_ev_46.where.x > 0x1f1) {
+ this->arr_i16_4758[1] = 0x1f1;
+ this->var_i16_1de6 = 1;
+ }
+ // 140:1ce6
+ if (this->var_ev_46.where.y < 0x2d) {
+ this->arr_i16_4758[2] = 0x2d;
+ this->var_i16_1de6 = 2;
+ }
+ // 140:1d06
+ if (this->var_ev_46.where.y > 0x147) {
+ this->arr_i16_4758[0] = 0x147;
+ this->var_i16_1de6 = 3;
+ }
+ // 140:1d26
+ while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ // 140:1d2a
+ // was: 0
+ this->getNextEvent(-1);
+ if (this->var_i16_1de6 == 0) {
+ this->arr_i16_4758[3] = this->var_ev_46.where.x + 0xa;
+ }
+ if (this->var_i16_1de6 == 1) {
+ this->arr_i16_4758[1] = this->var_ev_46.where.x - 0xa;
+ }
+ if (this->var_i16_1de6 == 2) {
+ this->arr_i16_4758[2] = this->var_ev_46.where.y + 0xa;
+ }
+ if (this->var_i16_1de6 == 3) {
+ this->arr_i16_4758[0] = this->var_ev_46.where.y - 0xa;
+ }
+ // 140:1dc6
+ if (this->arr_i16_4758[0] < 0x14) {
+ this->arr_i16_4758[0] = 0x14;
+ }
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
+ // 140:1e2e
+ if ((this->arr_i16_4758[1] <= 0) && (this->arr_i16_4758[0] <= 0x14) && (this->arr_i16_4758[3] >= SCREEN_WIDTH) && (this->arr_i16_4758[2] >= SCREEN_HEIGHT)) {
+ this->var_ev_46.modifiers = kModMouseButtonUp;
+ }
+ // 140:1eae
+ }
+ // 140:1ec4
+ if ((this->arr_i16_4758[1] <= 0) && (this->arr_i16_4758[0] <= 0x14) && (this->arr_i16_4758[3] >= SCREEN_WIDTH) && (this->arr_i16_4758[2] >= SCREEN_HEIGHT)) {
+ if (this->var_i16_1de6 == this->var_i16_103a) {
+ this->sub_140_205e();
+ return;
+ }
+ }
+ // 140:1f62
+ this->sub_140_1f68();
+}
+
+void FoolGame::sub_140_1f68() {
+ // 140:1f68
+ this->sub_128_50e(0xf, 0x64, 1);
+ this->var_i16_103a = 0;
+ g_toolbox->PenSize(0x14, 0x14);
+ g_toolbox->PenPat(this->arr_pat_58f4[3]);
+ this->arr_i16_4758[0] = 0;
+ this->arr_i16_4758[1] = 0;
+ this->arr_i16_4758[2] = SCREEN_HEIGHT;
+ this->arr_i16_4758[3] = SCREEN_WIDTH;
+ for (int16 i = 0; i <= 0x104; i += 0x14) {
+ this->arr_i16_4758[0] = 0x14 + i;
+ this->arr_i16_4758[1] = i;
+ this->arr_i16_4758[2] = SCREEN_HEIGHT - i;
+ this->arr_i16_4758[3] = SCREEN_WIDTH - i;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+
+ g_toolbox->FrameRect(temp);
+ }
+ // 140:2056
+ g_toolbox->PenNormal();
+ this->sub_128_6186();
+}
+
+void FoolGame::sub_140_205e() {
+ // 140:205e
+ this->var_i16_103a++;
+ this->sub_128_6186();
+ g_toolbox->PenNormal();
}
void FoolGame::sub_140_206a() {
@@ -576,7 +1167,7 @@ void FoolGame::sub_140_2998() {
} else {
// 140:2b58
if (this->activePuzzle != 0x34) {
- this->sub_140_3372();
+ this->thothAdjustPuzzleData();
}
// FIXME: some kind of manual bodge for the puzzle data loader,
// this looks lethal
@@ -699,6 +1290,77 @@ void FoolGame::sub_140_3148() {
this->arr_i16_4758[3] = this->arr_i16_4758[1] + g_zbasic->rndInt(0x64);
}
+void FoolGame::sub_140_31b0() {
+ // 140:31b0
+ this->sub_140_3050();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_140_31c4() {
+ // 140:31b0
+ this->sub_140_30da();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_140_31d8() {
+ // 140:31b0
+ this->sub_140_3148();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ temp.top = this->arr_i16_4758[4];
+ temp.left = this->arr_i16_4758[5];
+ temp.bottom = this->arr_i16_4758[6];
+ temp.right = this->arr_i16_4758[7];
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_140_31fa() {
+ // 140:31fa
+ this->sub_140_3050();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+}
+
+void FoolGame::sub_140_321a() {
+ // 140:321a
+ this->sub_140_30da();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+}
+
+void FoolGame::sub_140_323a() {
+ // 140:323a
+ this->sub_140_3148();
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+}
+
void FoolGame::sub_140_325a() {
// 140:325a
this->sub_140_3050();
@@ -720,6 +1382,16 @@ void FoolGame::sub_140_3282() {
g_toolbox->InvertRect(temp);
}
+void FoolGame::sub_140_3296() {
+ // 140:3296
+ if (this->var_i16_37a == 0) {
+ g_toolbox->SetPort(this->var_i32_8);
+ } else {
+ this->sub_128_1ef8();
+ }
+ this->sub_140_32ac();
+}
+
void FoolGame::sub_140_32ac() {
// 140:33ac
this->sub_128_4da(0);
@@ -747,15 +1419,17 @@ void FoolGame::sub_140_32ac() {
g_toolbox->SetPort(this->var_i32_0);
}
-void FoolGame::sub_140_3372() {
+void FoolGame::thothAdjustPuzzleData() {
+ // 140:3372
+ // change puzzle data pointer to use high priestess data
this->var_i16_484 = (this->puzzleDataOffsets[0x34] - 1) / 1000;
this->var_i16_7e4 = (this->puzzleDataOffsets[0x34] - 1) % 1000;
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
- this->var_bytes_696 = this->arr_bytes_109dc;
- this->var_bytes_232a = this->var_bytes_696;
- this->var_ptr_232a = this->var_ptr_696;
+ //this->var_bytes_696 = this->arr_bytes_109dc;
this->var_bytes_696 = g_zbasic->readFile(1, this->puzzleDataOffsets[0x35] - this->puzzleDataOffsets[0x34]);
this->var_ptr_696 = 0;
+ this->var_bytes_232a = this->var_bytes_696;
+ this->var_ptr_232a = this->var_ptr_696;
}
void FoolGame::sub_140_3412() {
Commit: 4b876e850c38aa8d13753fa82d99194f38501547
https://github.com/scummvm/scummvm/commit/4b876e850c38aa8d13753fa82d99194f38501547
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:18+02:00
Commit Message:
FOOL: Clean up Thoth a bit
Changed paths:
engines/fool/fool_game.h
engines/fool/fool_thoth.cpp
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 241d29a9141..3850a076e2e 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -291,18 +291,9 @@ public:
void sub_140_2978();
void sub_140_2998();
void sub_140_2f92();
- void sub_140_3050();
- void sub_140_30da();
- void sub_140_3148();
- void sub_140_31b0();
- void sub_140_31c4();
- void sub_140_31d8();
- void sub_140_31fa();
- void sub_140_321a();
- void sub_140_323a();
- void sub_140_325a();
- void sub_140_326e();
- void sub_140_3282();
+ Common::Rect thothRandomSquare(); // sub_140_3050
+ Common::Rect thothRandomHRect(); // sub_140_30da
+ Common::Rect thothRandomVRect(); // sub_140_3148
void sub_140_3296();
void sub_140_32ac();
void thothAdjustPuzzleData(); // sub_140_3372
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 9f0220325c6..a1b0cd43ec0 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -124,14 +124,11 @@ void FoolGame::sub_140_004() {
// 140:0328
if (this->var_i16_7d2 == 0) {
g_toolbox->PenNormal();
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 0;
- this->arr_i16_4758[2] = SCREEN_HEIGHT;
- this->arr_i16_4758[3] = SCREEN_WIDTH;
+ Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x22; i++) {
this->var_i32_692 = g_toolbox->TickCount();
- g_toolbox->InvertRect(Common::Rect(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]));
+ g_toolbox->InvertRect(area);
this->sub_128_406(1);
}
// 140:037e
@@ -364,25 +361,10 @@ void FoolGame::thothScrambleScreen() {
if (this->var_i16_2326 < 0) {
this->var_i16_2326 = 0;
}
- this->sub_140_3050();
+ g_toolbox->InvertRect(this->thothRandomSquare());
+ g_toolbox->InvertRect(this->thothRandomHRect());
+ g_toolbox->InvertRect(this->thothRandomVRect());
Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
- this->sub_140_30da();
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
- this->sub_140_3148();
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
temp.top = this->arr_i16_4758[4];
temp.left = this->arr_i16_4758[5];
temp.bottom = this->arr_i16_4758[6];
@@ -425,42 +407,26 @@ void FoolGame::sub_140_f84() {
this->arr_i16_4758[7] = ((SCREEN_WIDTH - this->arr_rect_1f38[1].right) / 0x19) + 1;
// 140:1066
// unrolled loop
- this->arr_i16_4758[0] = this->arr_rect_1f38[1].top;
- this->arr_i16_4758[1] = this->arr_rect_1f38[1].left;
- this->arr_i16_4758[2] = this->arr_rect_1f38[1].bottom;
- this->arr_i16_4758[3] = this->arr_rect_1f38[1].right;
+ Common::Rect area = this->arr_rect_1f38[1];
// 140:10aa
for (int16 i = 0; i <= 0x1a; i++) {
- this->arr_i16_4758[0] -= this->arr_i16_4758[4];
- this->arr_i16_4758[1] -= this->arr_i16_4758[5];
- this->arr_i16_4758[2] += this->arr_i16_4758[6];
- this->arr_i16_4758[3] += this->arr_i16_4758[7];
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->FrameRect(temp);
+ area.top -= this->arr_i16_4758[4];
+ area.left -= this->arr_i16_4758[5];
+ area.bottom += this->arr_i16_4758[6];
+ area.right += this->arr_i16_4758[7];
+ g_toolbox->FrameRect(area);
this->sub_128_3da(1);
}
// 140:11ae
// unrolled loop
- this->arr_i16_4758[0] = this->arr_rect_1f38[1].top;
- this->arr_i16_4758[1] = this->arr_rect_1f38[1].left;
- this->arr_i16_4758[2] = this->arr_rect_1f38[1].bottom;
- this->arr_i16_4758[3] = this->arr_rect_1f38[1].right;
+ area = this->arr_rect_1f38[1];
// 140:11f2
for (int16 i = 0; i <= 0x1a; i++) {
- this->arr_i16_4758[0] -= this->arr_i16_4758[4];
- this->arr_i16_4758[1] -= this->arr_i16_4758[5];
- this->arr_i16_4758[2] += this->arr_i16_4758[6];
- this->arr_i16_4758[3] += this->arr_i16_4758[7];
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
+ area.top -= this->arr_i16_4758[4];
+ area.left -= this->arr_i16_4758[5];
+ area.bottom += this->arr_i16_4758[6];
+ area.right += this->arr_i16_4758[7];
+ g_toolbox->InvertRect(area);
this->sub_128_3da(1);
}
// 140:12f6
@@ -540,6 +506,7 @@ void FoolGame::thothBook() {
this->arr_i16_4758[5] = 0;
this->arr_i16_4758[6] = SCREEN_HEIGHT;
this->arr_i16_4758[7] = SCREEN_WIDTH;
+ Common::Rect playArea(0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
this->var_i16_232e++;
if (this->var_i16_232e < 1) {
this->var_i16_232e = 1;
@@ -550,22 +517,29 @@ void FoolGame::thothBook() {
// 140:1546
switch (this->var_i16_232e-1) {
case 0:
- this->sub_140_31b0();
+ // 140:31b0
+ g_toolbox->InvertRect(this->thothRandomSquare());
break;
case 1:
- this->sub_140_31c4();
+ // 140:31c4
+ g_toolbox->InvertRect(this->thothRandomHRect());
break;
case 2:
- this->sub_140_31d8();
+ // 140:31d8
+ g_toolbox->InvertRect(this->thothRandomVRect());
+ g_toolbox->InvertRect(playArea);
break;
case 3:
- this->sub_140_31fa();
+ // 140:31fa
+ g_toolbox->FillRect(this->thothRandomSquare(), this->arr_pat_58f4[2]);
break;
case 4:
- this->sub_140_321a();
+ // 140:321a
+ g_toolbox->FillRect(this->thothRandomHRect(), this->arr_pat_58f4[2]);
break;
case 5:
- this->sub_140_323a();
+ // 140:323a
+ g_toolbox->FillRect(this->thothRandomVRect(), this->arr_pat_58f4[2]);
break;
default:
warning("thothBook: breaking out of switch statement");
@@ -749,13 +723,16 @@ void FoolGame::sub_140_18fa() {
}
switch (this->var_i16_232e-1) {
case 0:
- this->sub_140_325a();
+ // 140:325a
+ g_toolbox->InvertRect(this->thothRandomSquare());
break;
case 1:
- this->sub_140_326e();
+ // 140:326e
+ g_toolbox->InvertRect(this->thothRandomHRect());
break;
case 2:
- this->sub_140_3282();
+ // 140:3282
+ g_toolbox->InvertRect(this->thothRandomVRect());
break;
default:
warning("sub_140_18fa: broke out of switch");
@@ -807,27 +784,24 @@ void FoolGame::sub_140_1bc4() {
return;
}
// 140:1c66
- this->arr_i16_4758[0] = 0x14;
- this->arr_i16_4758[1] = -1;
- this->arr_i16_4758[2] = 0x157;
- this->arr_i16_4758[3] = 0x201;
+ Common::Rect area(-1, 0x14, SCREEN_WIDTH + 1, SCREEN_HEIGHT + 1);
if (this->var_ev_46.where.x < 0xf) {
- this->arr_i16_4758[3] = 0xf;
+ area.right = 0xf;
this->var_i16_1de6 = 0;
}
// 140:1cc6
if (this->var_ev_46.where.x > 0x1f1) {
- this->arr_i16_4758[1] = 0x1f1;
+ area.left = 0x1f1;
this->var_i16_1de6 = 1;
}
// 140:1ce6
if (this->var_ev_46.where.y < 0x2d) {
- this->arr_i16_4758[2] = 0x2d;
+ area.bottom = 0x2d;
this->var_i16_1de6 = 2;
}
// 140:1d06
if (this->var_ev_46.where.y > 0x147) {
- this->arr_i16_4758[0] = 0x147;
+ area.top = 0x147;
this->var_i16_1de6 = 3;
}
// 140:1d26
@@ -836,35 +810,30 @@ void FoolGame::sub_140_1bc4() {
// was: 0
this->getNextEvent(-1);
if (this->var_i16_1de6 == 0) {
- this->arr_i16_4758[3] = this->var_ev_46.where.x + 0xa;
+ area.right = this->var_ev_46.where.x + 0xa;
}
if (this->var_i16_1de6 == 1) {
- this->arr_i16_4758[1] = this->var_ev_46.where.x - 0xa;
+ area.left = this->var_ev_46.where.x - 0xa;
}
if (this->var_i16_1de6 == 2) {
- this->arr_i16_4758[2] = this->var_ev_46.where.y + 0xa;
+ area.bottom = this->var_ev_46.where.y + 0xa;
}
if (this->var_i16_1de6 == 3) {
- this->arr_i16_4758[0] = this->var_ev_46.where.y - 0xa;
+ area.top = this->var_ev_46.where.y - 0xa;
}
// 140:1dc6
- if (this->arr_i16_4758[0] < 0x14) {
- this->arr_i16_4758[0] = 0x14;
+ if (area.top < 0x14) {
+ area.top = 0x14;
}
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
+ g_toolbox->FillRect(area, this->arr_pat_58f4[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
// 140:1e2e
- if ((this->arr_i16_4758[1] <= 0) && (this->arr_i16_4758[0] <= 0x14) && (this->arr_i16_4758[3] >= SCREEN_WIDTH) && (this->arr_i16_4758[2] >= SCREEN_HEIGHT)) {
+ if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
this->var_ev_46.modifiers = kModMouseButtonUp;
}
// 140:1eae
}
// 140:1ec4
- if ((this->arr_i16_4758[1] <= 0) && (this->arr_i16_4758[0] <= 0x14) && (this->arr_i16_4758[3] >= SCREEN_WIDTH) && (this->arr_i16_4758[2] >= SCREEN_HEIGHT)) {
+ if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
if (this->var_i16_1de6 == this->var_i16_103a) {
this->sub_140_205e();
return;
@@ -880,22 +849,13 @@ void FoolGame::sub_140_1f68() {
this->var_i16_103a = 0;
g_toolbox->PenSize(0x14, 0x14);
g_toolbox->PenPat(this->arr_pat_58f4[3]);
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 0;
- this->arr_i16_4758[2] = SCREEN_HEIGHT;
- this->arr_i16_4758[3] = SCREEN_WIDTH;
+ Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x104; i += 0x14) {
- this->arr_i16_4758[0] = 0x14 + i;
- this->arr_i16_4758[1] = i;
- this->arr_i16_4758[2] = SCREEN_HEIGHT - i;
- this->arr_i16_4758[3] = SCREEN_WIDTH - i;
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
-
- g_toolbox->FrameRect(temp);
+ area.top = 0x14 + i;
+ area.left = i;
+ area.bottom = SCREEN_HEIGHT - i;
+ area.right = SCREEN_WIDTH - i;
+ g_toolbox->FrameRect(area);
}
// 140:2056
g_toolbox->PenNormal();
@@ -1053,13 +1013,9 @@ void FoolGame::sub_140_25e4() {
void FoolGame::sub_140_2662() {
// 140:2662
- this->arr_i16_4758[0] = 0x29;
- this->arr_i16_4758[1] = 0x37;
- this->arr_i16_4758[2] = 0x142;
- this->arr_i16_4758[3] = 0x1c9;
- Common::Rect temp(0x37, 0x29, 0x1c9, 0x142);
+ Common::Rect area(0x37, 0x29, 0x1c9, 0x142);
for (int16 i = 0; i <= 0x10; i++) {
- g_toolbox->InvertRect(temp);
+ g_toolbox->InvertRect(area);
this->sub_128_3da(1);
}
}
@@ -1071,26 +1027,21 @@ void FoolGame::sub_140_26ca() {
for (int16 j = 0; j <= 2; j++) {
// 140:26e0
- this->arr_i16_4758[1] = 0x2d;
- this->arr_i16_4758[0] = 0x22;
- this->arr_i16_4758[3] = 0x1d3;
- this->arr_i16_4758[2] = 0x149;
+ Common::Rect area(0x2d, 0x22, 0x1d3, 0x149);
for (int16 i = 0; i <= 0x14; i++) {
- this->arr_i16_4758[0] += 7;
- this->arr_i16_4758[1] += 0xa;
- this->arr_i16_4758[2] -= 7;
- this->arr_i16_4758[3] -= 0xa;
- Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
- g_toolbox->InvertRect(temp);
+ area.top += 7;
+ area.left += 0xa;
+ area.bottom -= 7;
+ area.right -= 0xa;
+ g_toolbox->InvertRect(area);
this->sub_128_3da(1);
}
for (int16 i = 0; i <= 0x13; i++) {
- this->arr_i16_4758[0] -= 7;
- this->arr_i16_4758[1] -= 0xa;
- this->arr_i16_4758[2] += 7;
- this->arr_i16_4758[3] += 0xa;
- Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
- g_toolbox->InvertRect(temp);
+ area.top -= 7;
+ area.left -= 0xa;
+ area.bottom += 7;
+ area.right += 0xa;
+ g_toolbox->InvertRect(area);
this->sub_128_3da(1);
}
}
@@ -1266,120 +1217,38 @@ void FoolGame::sub_140_2f92() {
g_zbasic->menu(8, 7, 1, g_zbasic->str(333)); // secrets.
}
-void FoolGame::sub_140_3050() {
+Common::Rect FoolGame::thothRandomSquare() {
// 140:3050
- this->arr_i16_4758[0] = 0x14 + g_zbasic->rndInt(0xde);
- this->arr_i16_4758[1] = g_zbasic->rndInt(0x19c);
- this->arr_i16_4758[2] = this->arr_i16_4758[0] + 0x64;
- this->arr_i16_4758[3] = this->arr_i16_4758[1] + 0x64;
+ int16 x = g_zbasic->rndInt(0x19c);
+ int16 y = 0x14 + g_zbasic->rndInt(0xde);
+ return Common::Rect(
+ x,
+ y,
+ x + 0x64,
+ y + 0x64
+ );
}
-void FoolGame::sub_140_30da() {
+Common::Rect FoolGame::thothRandomHRect() {
// 140:30da
- this->arr_i16_4758[0] = 0x14 + g_zbasic->rndInt(0xde);
- this->arr_i16_4758[1] = 0;
- this->arr_i16_4758[2] = this->arr_i16_4758[0] + g_zbasic->rndInt(0x64);
- this->arr_i16_4758[3] = SCREEN_WIDTH;
+ int16 y = 0x14 + g_zbasic->rndInt(0xde);
+ return Common::Rect(
+ 0,
+ y,
+ SCREEN_WIDTH,
+ y + g_zbasic->rndInt(0x64)
+ );
}
-void FoolGame::sub_140_3148() {
+Common::Rect FoolGame::thothRandomVRect() {
// 140:3148
- this->arr_i16_4758[0] = 0x14;
- this->arr_i16_4758[1] = g_zbasic->rndInt(0x19c);
- this->arr_i16_4758[2] = SCREEN_HEIGHT;
- this->arr_i16_4758[3] = this->arr_i16_4758[1] + g_zbasic->rndInt(0x64);
-}
-
-void FoolGame::sub_140_31b0() {
- // 140:31b0
- this->sub_140_3050();
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
-}
-
-void FoolGame::sub_140_31c4() {
- // 140:31b0
- this->sub_140_30da();
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
-}
-
-void FoolGame::sub_140_31d8() {
- // 140:31b0
- this->sub_140_3148();
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
- temp.top = this->arr_i16_4758[4];
- temp.left = this->arr_i16_4758[5];
- temp.bottom = this->arr_i16_4758[6];
- temp.right = this->arr_i16_4758[7];
- g_toolbox->InvertRect(temp);
-}
-
-void FoolGame::sub_140_31fa() {
- // 140:31fa
- this->sub_140_3050();
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
-}
-
-void FoolGame::sub_140_321a() {
- // 140:321a
- this->sub_140_30da();
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
-}
-
-void FoolGame::sub_140_323a() {
- // 140:323a
- this->sub_140_3148();
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
-}
-
-void FoolGame::sub_140_325a() {
- // 140:325a
- this->sub_140_3050();
- Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
- g_toolbox->InvertRect(temp);
-}
-
-void FoolGame::sub_140_326e() {
- // 140:326e
- this->sub_140_30da();
- Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
- g_toolbox->InvertRect(temp);
-}
-
-void FoolGame::sub_140_3282() {
- // 140:3282
- this->sub_140_3148();
- Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
- g_toolbox->InvertRect(temp);
+ int16 x = g_zbasic->rndInt(0x19c);
+ return Common::Rect(
+ x,
+ 0x14,
+ x + g_zbasic->rndInt(0x64),
+ SCREEN_HEIGHT
+ );
}
void FoolGame::sub_140_3296() {
@@ -1403,18 +1272,14 @@ void FoolGame::sub_140_32ac() {
}
}
// 140:3300
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 0;
- this->arr_i16_4758[2] = SCREEN_HEIGHT;
- this->arr_i16_4758[3] = SCREEN_WIDTH;
- Common::Rect temp(this->arr_i16_4758[1], this->arr_i16_4758[0], this->arr_i16_4758[3], this->arr_i16_4758[2]);
+ Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 1; i <= 0xd; i++) {
this->var_i32_692 = g_toolbox->TickCount();
- g_toolbox->InvertRect(temp);
+ g_toolbox->InvertRect(area);
this->sub_128_406(1);
}
// 140:334a
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(area, this->arr_pat_58f4[2]);
this->sub_128_4da(1);
g_toolbox->SetPort(this->var_i32_0);
}
Commit: 7fe4f61739e39af7d5dde369a9bd5eec2313c8ba
https://github.com/scummvm/scummvm/commit/7fe4f61739e39af7d5dde369a9bd5eec2313c8ba
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:19+02:00
Commit Message:
FOOL: Humbug working
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_sentence.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5363a8835b9..d4d1cb07be5 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1725,10 +1725,10 @@ void FoolGame::sub_128_39a0() {
this->shipsRun();
break;
case 16:
- this->sub_142_004();
+ this->humbugRun();
break;
case 17:
- this->sub_142_852();
+ this->justiceRun();
break;
case 18:
this->sub_142_12ac();
@@ -3196,12 +3196,352 @@ void FoolGame::sub_138_004() {
}
// the humbug
-void FoolGame::sub_142_004() {
- warning("STUB: %s", __func__);
+void FoolGame::humbugRun() {
+ // 142:0004
+ if (this->var_i16_c04 < 0x63) {
+ this->humbugTrail();
+ if (this->var_i16_d0c == 0) {
+ return;
+ }
+ this->sub_142_5f2();
+ if (this->puzzleCompletionStatus[0x34] > 2) {
+ this->var_i16_c04 = 0x64;
+ return;
+ }
+ // 142:004e
+ this->var_i16_c04 = 0x63;
+ this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ this->var_str_384 = g_zbasic->str(336); // behold the 2nd key of thoth
+ this->sub_128_178a(0x17, 0);
+ }
+ // 142:00b2
+ if (this->var_i16_c04 == 0x63) {
+ this->sub_142_630();
+ }
+ if (this->var_i16_c04 >= 0x64) {
+ this->humbugTrail();
+ if (this->var_i16_d0c != 0) {
+ this->sub_142_5f2();
+ }
+ }
+ // 142:00e2
+ return;
+}
+
+void FoolGame::humbugTrail() {
+ // 142:00e6
+ if (this->puzzleCompletionStatus[0x34] < 3) {
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(337)); // A secret is undone
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(338)); // if the two become one.
+ } else {
+ // 142:0136
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(339)); // A puzzle is undone
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(340)); // if the two become one.
+ }
+ // 142:0166
+ this->sub_128_271a();
+ this->sub_128_4da(0);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->sub_128_55c(g_zbasic->str(341)); // ~
+ // eye button
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ for (int16 i = 1; i <= 0xa42; i++) {
+ this->arr_i16_9894[i] = this->puzzlesReadShort();
+ this->arr_i16_ac1c[i] = this->puzzlesReadShort();
+ g_zbasic->put(
+ this->arr_i16_9894[i],
+ this->arr_i16_ac1c[i],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ // Simulate slow draw speed
+ if ((i % 42) == 0)
+ g_toolbox->Delay(0);
+ }
+ // 142:026e
+ this->sub_128_4da(1);
+ g_zbasic->put(
+ this->arr_i16_9894[this->var_i16_233c],
+ this->arr_i16_ac1c[this->var_i16_233c],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ this->var_i16_233c = 1;
+ this->stateFlags = kStateNull;
+ this->var_i16_d0c = 0;
+ this->var_i16_1ab6 = 0;
+ this->var_i16_1ab8 = 0;
+
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 142:02ee
+ this->getNextEvent(-1);
+ if (!((this->var_i16_1ab6 == this->var_ev_46.where.x) && (this->var_i16_1ab8 == this->var_ev_46.where.y))) {
+ this->sub_142_370();
+ }
+ if (this->var_i16_233c >= 0xa42) {
+ this->var_i16_d0c = 1;
+ }
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+ // 142:0346
+ }
+}
+
+void FoolGame::sub_142_370() {
+ // 142:0370
+ this->var_i16_7e4 = this->var_i16_233c + 0x19;
+ if (this->var_i16_7e4 > 0xa42) {
+ this->var_i16_7e4 = 0xa42;
+ }
+ this->var_i16_9f2 = this->var_i16_233c - 0x19;
+ if (this->var_i16_9f2 < 1) {
+ this->var_i16_9f2 = 1;
+ }
+ this->var_i16_1a9c = 0;
+ for (int16 i = this->var_i16_7e4; i >= this->var_i16_9f2; i--) {
+ this->var_i16_1a96 = this->var_ev_46.where.x - this->arr_i16_9894[i];
+ this->var_i16_1a98 = this->var_ev_46.where.y - this->arr_i16_ac1c[i];
+ if ((this->var_i16_1a96 >= -5) && (this->var_i16_1a96 <= 0x1e) && (this->var_i16_1a98 >= -5) && (this->var_i16_1a98 <= 0x19)) {
+ this->var_i16_1a9c = i + 0xa;
+ }
+ // 142:0470
+ }
+ // 142:0484
+ if (this->var_i16_1a9c >= 0xa42) {
+ this->var_i16_1a9c = 0xa42;
+ }
+ if (this->var_i16_1a9c != 0) {
+ if (this->var_i16_233c < this->var_i16_1a9c) {
+ this->var_i16_484 = 1;
+ } else {
+ this->var_i16_484 = -1;
+ }
+ this->var_i16_7a8 = this->var_i16_233c;
+ do {
+ g_zbasic->put(
+ this->arr_i16_9894[this->var_i16_7a8],
+ this->arr_i16_ac1c[this->var_i16_7a8],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ // 142:051c
+ } while (g_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
+ this->var_i16_233c = this->var_i16_1a9c;
+ this->var_i16_1ab6 = this->var_ev_46.where.x;
+ this->var_i16_1ab8 = this->var_ev_46.where.y;
+ } else {
+ // 142:054a
+ this->var_i16_7e4 = this->var_i16_233c - 0xa;
+ if (this->var_i16_7e4 < 1) {
+ this->var_i16_7e4 = 1;
+ }
+ for (int16 i = this->var_i16_233c; i >= this->var_i16_7e4; i--) {
+ g_zbasic->put(
+ this->arr_i16_9894[i],
+ this->arr_i16_ac1c[i],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ // 142:05c8
+ }
+ this->var_i16_233c -= 0xa;
+ if (this->var_i16_233c < 1) {
+ this->var_i16_233c = 1;
+ }
+ }
+ // 142:05f0
+}
+
+void FoolGame::sub_142_5f2() {
+ // 142:05f2
+ this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+}
+
+void FoolGame::sub_142_630() {
+ // 142:0630
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(342)); // the 2nd key of thoth
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(343)); // return to scroll
+ this->thothBook();
+ if (this->var_i16_d0c == 1) {
+ // 142:066e
+ g_toolbox->PenNormal();
+ g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ this->var_i16_484 = 1;
+ for (int16 i = 1; i <= 4; i++) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[i*32];
+ temp.left = this->arr_i16_2f38[i*32+1];
+ temp.bottom = this->arr_i16_2f38[i*32+2];
+ temp.right = this->arr_i16_2f38[i*32+3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ g_toolbox->FrameRect(temp);
+ this->var_str_384 = Common::U32String::format(" %d ", i);
+ this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_9f2 = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
+ // 142:0756
+ g_toolbox->MoveTo(
+ this->arr_i16_2f38[i*32+1] + this->var_i16_9f2 - (this->var_i16_7e4 / 2),
+ this->arr_i16_2f38[i*32 + 2] - 0x1e
+ );
+ g_toolbox->DrawString(this->var_str_384);
+ }
+ // 142:07ca
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->sub_128_6186();
+ this->sub_128_2664();
+ this->var_i16_484 = 0;
+ this->var_i16_7e4 = 0;
+ this->var_i16_9f2 = 0;
+ while (this->var_ev_46.modifiers & kModMouseButtonUp) {
+ // 142:07f8
+ this->getNextEvent(-1); // was: 0
+ this->var_i16_7e4++;
+ if (this->var_i16_7e4 == 0x64) {
+ this->var_i16_7e4 = 0;
+ this->var_i16_9f2++;
+ if (this->var_i16_9f2 > 4) {
+ this->var_i16_9f2 = 1;
+ }
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[this->var_i16_9f2*32];
+ temp.left = this->arr_i16_2f38[this->var_i16_9f2*32+1];
+ temp.bottom = this->arr_i16_2f38[this->var_i16_9f2*32+2];
+ temp.right = this->arr_i16_2f38[this->var_i16_9f2*32+3];
+ g_toolbox->InvertRect(temp);
+ }
+ }
+ }
+ // 142:0850
}
// justice - lights on
-void FoolGame::sub_142_852() {
+void FoolGame::justiceRun() {
+ // 142:0852
+ if (this->var_i16_c04 >= 0x63) {
+ this->sub_142_9be();
+ if (this->var_i16_d0c == 0) {
+ this->sub_142_111e();
+ return;
+ }
+ // 142:0874
+ this->sub_142_11fe();
+ if (this->puzzleCompletionStatus[0x34] > 3) {
+ this->var_i16_c04 = 0x64;
+ return;
+ } else {
+ // 142:08a2
+ this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
+ this->var_i16_c04 = 0x63;
+ this->var_str_384 = g_zbasic->str(345); // behold the 3rd key of thoth
+ this->sub_128_178a(0x3f, 1);
+ }
+ }
+ // 142:0906
+ if (this->var_i16_c04 == 0x63) {
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(346)); // the 3rd key of thoth
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(347)); // return to scroll
+ this->sub_140_18fa();
+ if (this->var_i16_d0c == 1) {
+ this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
+ }
+ }
+ // 142:098a
+ if (this->var_i16_c04 >= 0x64) {
+ this->sub_142_9be();
+ if (this->var_i16_d0c == 0) {
+ this->sub_142_111e();
+ return;
+ }
+ // 142:09b0
+ this->sub_142_11fe();
+ this->var_i16_c04 = 0x65;
+ }
+ // 142:09ba
+ return;
+}
+
+void FoolGame::sub_142_9be() {
+ // 142:09be
+ this->sub_128_271a();
+ for (int16 i = 1; i <= 0x19; i++) {
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
+ }
+ // 142:09ea
+ if (this->puzzleCompletionStatus[0x34] < 4) {
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(348)); // a secret hides here
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(349)); // if twenty-five appear
+ } else {
+ // 142:0a3a
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(350)); // you will remain here
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(351)); // unless twenty-five appear
+ }
+ // 142:0a6a
+ this->sub_142_f58();
+ this->var_i16_484 = 0;
+ for (int16 i = 0x24; i <= 0x185; i += 0x32) {
+ for (int16 j = 0x8c; j <= 0x11d; j += 0x32) {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ j,
+ i,
+ j + 0x32,
+ i + 0x32
+ );
+ }
+ }
+ // 142:0adc
+ this->sub_142_f58();
+ this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
+ if (this->activePuzzleBuffer.empty()) { // was: str(352)
+ this->activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
+ this->var_i16_233e = 1;
+ } else {
+ // 142:0b4c
+ this->var_i16_233e = g_zbasic->castInt(g_zbasic->leftStr(this->activePuzzleBuffer, 1));
+ this->activePuzzleBuffer = g_zbasic->rightStr(this->activePuzzleBuffer, 0x19);
+ }
+ // 142:0b7c
+ this->var_i16_484 = 1;
+ this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_484, 1));
+ if ((this->var_i16_103a & 2) == 0) {
+ g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
+ } else {
+ // 142:0be0
+ g_zbasic->indexSet(g_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
+ }
+ // 142:0c06
+ if ((this->var_i16_103a & 1) != 0) {
+ this->sub_142_f96();
+ } else {
+ this->sub_142_10bc();
+ }
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_f58() {
+ // 142:0f58
+ this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
+}
+
+void FoolGame::sub_142_f96() {
+ // 142:0f96
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_10bc() {
+ // 142:10bc
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_111e() {
+ // 142:111e
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_142_11fe() {
+ // 142:11fe
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 3850a076e2e..9e1939d6449 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -306,8 +306,18 @@ public:
void deathCaught(); // sub_141_8b8
void deathDrawZoom(); // sub_141_934
- void sub_142_004();
- void sub_142_852();
+ void humbugRun(); // sub_142_004
+ void humbugTrail(); // sub_142_0e6
+ void sub_142_370();
+ void sub_142_5f2();
+ void sub_142_630();
+ void justiceRun(); // sub_142_852
+ void sub_142_9be();
+ void sub_142_f58();
+ void sub_142_f96();
+ void sub_142_10bc();
+ void sub_142_111e();
+ void sub_142_11fe();
void sub_142_12ac();
void sub_144_004();
@@ -538,6 +548,8 @@ private:
int16 var_i16_2336;
int16 var_i16_2338;
int16 var_i16_233a;
+ int16 var_i16_233e;
+ int16 var_i16_233c;
// FIXME: bounds on the following are guessed! need to trace index range
int16 pageLineRanges[202]; // arr_i16_0
@@ -584,6 +596,8 @@ private:
Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap arr_jigsaw_5dfc[128];
+ int16 arr_i16_9894[0xa43]; // inside 5dfc, used for humbug
+ int16 arr_i16_ac1c[0xa43]; // inside 5dfc, used for humbug
BitMap arr_bmp_b3ec;
BitMap arr_bmp_bbbc; // used by death
BitMap arr_bmp_c38c; // used by death
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 23ebc02f0e6..fa16f024d2a 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -88,7 +88,7 @@ void FoolGame::sentenceRun() {
this->arr_i16_4338[this->var_i16_68a] = 1;
} else {
// 135:03d4
- this->arr_i16_4338[this->var_i16_68a] = (int16)strtol(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_68a, 1).c_str(), nullptr, 10);
+ this->arr_i16_4338[this->var_i16_68a] = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_68a, 1));
}
// 135:0408
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 54bd4cc2cf4..bae8f81a491 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -107,7 +107,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_1990 = 0;
this->var_i16_68a = 1;
for (int i = 1; i <= this->var_i16_198e; i++) {
- this->arr_i16_3738[i] = (int16)strtol(g_zbasic->midStr(this->activePuzzleBuffer, i, 1).c_str(), nullptr, 10);
+ this->arr_i16_3738[i] = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, i, 1));
if (this->arr_i16_3738[i] != 0) {
this->var_i16_1990++;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index ccf405929c0..eb715d59d3a 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -190,6 +190,10 @@ void ZBasic::blockMove(void *srcptr, void *destptr, uint16 size) {
memmove(destptr, srcptr, size);
}
+int16 ZBasic::castInt(const Common::String &str) {
+ return (int16)strtol(str.c_str(), nullptr, 10);
+}
+
Common::U32String ZBasic::chr(uint16 code) {
char buf[2] = { 0x00, 0x00 };
buf[0] = (char)(code & 0xff);
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index a82e1c1e524..dd35895e4b8 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -239,7 +239,9 @@ public:
int16 asc(const Common::U32String &str);
void bufferFlush(const Common::U32String &str);
- void blockMove(void *srcptr, void *destptr, uint16 size);
+ void blockMove(void *srcptr, void *destptr, uint16 size)
+;
+ int16 castInt(const Common::String &str);
Common::U32String chr(uint16 code);
void close(int16 fileNo);
void coordinateWindow();
Commit: e519df4a45ab9078aee12951606e840184f8e7fc
https://github.com/scummvm/scummvm/commit/e519df4a45ab9078aee12951606e840184f8e7fc
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:19+02:00
Commit Message:
FOOL: Justice entered in mostly
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index d4d1cb07be5..1214d319c07 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1731,7 +1731,7 @@ void FoolGame::sub_128_39a0() {
this->justiceRun();
break;
case 18:
- this->sub_142_12ac();
+ this->hermitRun();
break;
default:
warning("%s: broke out of switch", __func__);
@@ -3418,14 +3418,14 @@ void FoolGame::sub_142_630() {
// justice - lights on
void FoolGame::justiceRun() {
// 142:0852
- if (this->var_i16_c04 >= 0x63) {
+ if (this->var_i16_c04 < 0x63) {
this->sub_142_9be();
if (this->var_i16_d0c == 0) {
- this->sub_142_111e();
+ this->justiceStoreState();
return;
}
// 142:0874
- this->sub_142_11fe();
+ this->justiceResetGrid();
if (this->puzzleCompletionStatus[0x34] > 3) {
this->var_i16_c04 = 0x64;
return;
@@ -3450,11 +3450,11 @@ void FoolGame::justiceRun() {
if (this->var_i16_c04 >= 0x64) {
this->sub_142_9be();
if (this->var_i16_d0c == 0) {
- this->sub_142_111e();
+ this->justiceStoreState();
return;
}
// 142:09b0
- this->sub_142_11fe();
+ this->justiceResetGrid();
this->var_i16_c04 = 0x65;
}
// 142:09ba
@@ -3477,10 +3477,10 @@ void FoolGame::sub_142_9be() {
g_zbasic->menu(8, 4, 1, g_zbasic->str(351)); // unless twenty-five appear
}
// 142:0a6a
- this->sub_142_f58();
+ this->justiceZoom();
this->var_i16_484 = 0;
- for (int16 i = 0x24; i <= 0x185; i += 0x32) {
- for (int16 j = 0x8c; j <= 0x11d; j += 0x32) {
+ for (int16 i = 0x24; i <= 0x11d; i += 0x32) {
+ for (int16 j = 0x8c; j <= 0x185; j += 0x32) {
this->var_i16_484++;
g_toolbox->SetRect(
this->arr_rect_1f38[this->var_i16_484],
@@ -3492,7 +3492,7 @@ void FoolGame::sub_142_9be() {
}
}
// 142:0adc
- this->sub_142_f58();
+ this->justiceZoom();
this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
if (this->activePuzzleBuffer.empty()) { // was: str(352)
this->activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
@@ -3503,50 +3503,165 @@ void FoolGame::sub_142_9be() {
this->activePuzzleBuffer = g_zbasic->rightStr(this->activePuzzleBuffer, 0x19);
}
// 142:0b7c
- this->var_i16_484 = 1;
- this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_484, 1));
- if ((this->var_i16_103a & 2) == 0) {
- g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
- } else {
- // 142:0be0
- g_zbasic->indexSet(g_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
+ for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
+ this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_484, 1));
+ if ((this->var_i16_103a & 2) == 0) {
+ g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
+ } else {
+ // 142:0be0
+ g_zbasic->indexSet(g_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
+ }
+ // 142:0c06
+ if ((this->var_i16_103a & 1) != 0) {
+ this->justiceDrawBlock();
+ } else {
+ this->justiceRemoveBlock();
+ }
+ }
+ // 142:0c32
+ this->var_i16_d0c = 0;
+ this->stateFlags = 0;
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 142:0c42
+ while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
+ this->getNextEvent(-1);
+ if (this->var_ev_46.what == 1) {
+ this->justiceOnClick();
+ }
+ }
+ // 142:0c76
+ if (this->stateFlags == kStateSaveGame) {
+ this->justiceStoreState();
+ this->saveGame();
+ }
+ // 142:0c88
+ }
+}
+
+void FoolGame::justiceOnClick() {
+ // 142:0cb2
+ this->var_i16_68a = (this->var_ev_46.where.x - 0x5a) / 0x32;
+ this->var_i16_68c = (this->var_ev_46.where.y + 0xe) / 0x32;
+ if ((this->var_i16_68a < 0) || (this->var_i16_68c < 0) || (this->var_i16_68a > 5) || (this->var_i16_68c > 5)) {
+ return;
+ }
+ // 142:0d26
+ this->var_i16_103a = (this->var_i16_68c - 1)*5 + this->var_i16_68a;
+ if (this->arr_i16_3738[this->var_i16_103a] == 0) {
+ return;
+ }
+ // 142:0d56
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_103a], 0x1e, 0x1e);
+ if (g_zbasic->index(1, this->var_i16_103a + 0x19) == g_zbasic->str(356)) { // \xa5
+ g_zbasic->indexSet(g_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
+ }
+ // 142:0dc6
+ if (this->var_i16_103a == 0xd) { // center button
+ if (this->var_i16_233e == 0) {
+ for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
+ g_zbasic->indexSet(g_zbasic->str(358), 1, this->var_i16_484 + 0x19); // \xa5
+ this->arr_i16_3738[this->var_i16_484] = 0;
+ this->justiceRemoveBlock();
+ }
+ this->var_i16_233e = 1;
+ // redraw center tile
+ this->var_i16_484 = 0xd;
+ this->justiceDrawBlock();
+ return;
+ }
+ // 142:0e3e
+ this->var_i16_233e = 0;
}
- // 142:0c06
- if ((this->var_i16_103a & 1) != 0) {
- this->sub_142_f96();
+ // 142:0e44
+ this->var_str_1272 = g_zbasic->indexRaw(1, this->var_i16_103a);
+ if (g_zbasic->leftStr(this->var_str_1272, 1) == g_zbasic->str(359)) { // M
+ this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, 2, 2));
+ this->justiceDrawBlock();
+ this->var_i16_2340 = 5;
} else {
- this->sub_142_10bc();
+ // 142:0ea8
+ this->var_i16_2340 = 2;
+ }
+ // 142:0eae
+ this->var_i16_2342 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
+ for (int16 i = 1; i <= this->var_i16_2342; i++) {
+ this->var_i16_2340 += 2;
+ this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
+ // 142:0ef0
+ if (this->arr_i16_3738[this->var_i16_484] == 0) {
+ this->justiceDrawBlock();
+ } else {
+ this->justiceRemoveBlock();
+ }
}
- warning("STUB: %s", __func__);
+ // 142:0f20
+ for (int16 i = 1; i <= 0x19; i++) {
+ if (this->arr_i16_3738[i] == 0) {
+ this->var_i16_d0c = 0;
+ }
+ }
+ this->sub_128_6186();
}
-void FoolGame::sub_142_f58() {
+void FoolGame::justiceZoom() {
// 142:0f58
this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
}
-void FoolGame::sub_142_f96() {
+void FoolGame::justiceDrawBlock() {
// 142:0f96
- warning("STUB: %s", __func__);
+ this->arr_i16_3738[this->var_i16_484] = 1;
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->PenNormal();
+ g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e, this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_384 = g_zbasic->index(1, this->var_i16_484 + 0x19);
+ this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ // 142:1056
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
+ this->arr_rect_1f38[this->var_i16_484].top + 0x1e
+ );
+ g_toolbox->DrawString(this->var_str_384);
}
-void FoolGame::sub_142_10bc() {
+void FoolGame::justiceRemoveBlock() {
// 142:10bc
- warning("STUB: %s", __func__);
+ this->arr_i16_3738[this->var_i16_484] = 0;
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_484], this->arr_pat_58f4[g_zbasic->rndInt(0x4d)+3]);
}
-void FoolGame::sub_142_111e() {
+void FoolGame::justiceStoreState() {
// 142:111e
- warning("STUB: %s", __func__);
+ this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
+ this->activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
+ for (int16 i = 1; i <= 0x19; i++) {
+ this->arr_i16_3738[i] = this->var_i16_484;
+ if (g_zbasic->index(1, i + 0x19) == g_zbasic->str(360)) { // ~
+ this->var_i16_484 |= 2;
+ this->var_str_384 = g_zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
+ this->activePuzzleBuffer += this->var_str_384;
+ }
+ }
+ // 142:11fc
}
-void FoolGame::sub_142_11fe() {
+void FoolGame::justiceResetGrid() {
// 142:11fe
- warning("STUB: %s", __func__);
+ this->sub_128_3da(0x28);
+ this->activePuzzleBuffer.clear();
+ for (int16 i = 1; i <= 0x19; i++) {
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->FillRect(this->arr_rect_1f38[i], this->arr_pat_58f4[2]);
+ }
+ // 142:126e
+ this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
// hermit key trace
-void FoolGame::sub_142_12ac() {
+void FoolGame::hermitRun() {
// 142:12ac
if (this->puzzleCompletionStatus[0x34] < 5) {
g_zbasic->menu(8, 3, 1, g_zbasic->str(362)); // to find a hidden secret
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 9e1939d6449..49b02808b9e 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -313,12 +313,14 @@ public:
void sub_142_630();
void justiceRun(); // sub_142_852
void sub_142_9be();
- void sub_142_f58();
- void sub_142_f96();
- void sub_142_10bc();
- void sub_142_111e();
- void sub_142_11fe();
- void sub_142_12ac();
+ void justiceOnClick(); // sub_142_cb2
+ void justiceZoom(); // sub_142_f58
+ void justiceDrawBlock(); // sub_142_f96
+ void justiceRemoveBlock(); // sub_142_10bc
+ void justiceStoreState(); // sub_142_111e
+ void justiceResetGrid(); // sub_142_11fe
+ void hermitRun(); // sub_142_12ac
+
void sub_144_004();
private:
@@ -551,6 +553,9 @@ private:
int16 var_i16_233e;
int16 var_i16_233c;
+ int16 var_i16_2340;
+ int16 var_i16_2342;
+
// FIXME: bounds on the following are guessed! need to trace index range
int16 pageLineRanges[202]; // arr_i16_0
int16 pageLineFace[1301]; // arr_i16_194
Commit: 7df7f3fb4a71109a93af8b6e375fba9718c27a13
https://github.com/scummvm/scummvm/commit/7df7f3fb4a71109a93af8b6e375fba9718c27a13
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:19+02:00
Commit Message:
FOOL: Break justice and humbug into files
Changed paths:
A engines/fool/fool_humbug.cpp
A engines/fool/fool_justice.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/module.mk
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 1214d319c07..065528841e8 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -3195,470 +3195,6 @@ void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
-// the humbug
-void FoolGame::humbugRun() {
- // 142:0004
- if (this->var_i16_c04 < 0x63) {
- this->humbugTrail();
- if (this->var_i16_d0c == 0) {
- return;
- }
- this->sub_142_5f2();
- if (this->puzzleCompletionStatus[0x34] > 2) {
- this->var_i16_c04 = 0x64;
- return;
- }
- // 142:004e
- this->var_i16_c04 = 0x63;
- this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- this->var_str_384 = g_zbasic->str(336); // behold the 2nd key of thoth
- this->sub_128_178a(0x17, 0);
- }
- // 142:00b2
- if (this->var_i16_c04 == 0x63) {
- this->sub_142_630();
- }
- if (this->var_i16_c04 >= 0x64) {
- this->humbugTrail();
- if (this->var_i16_d0c != 0) {
- this->sub_142_5f2();
- }
- }
- // 142:00e2
- return;
-}
-
-void FoolGame::humbugTrail() {
- // 142:00e6
- if (this->puzzleCompletionStatus[0x34] < 3) {
- g_zbasic->menu(8, 3, 1, g_zbasic->str(337)); // A secret is undone
- g_zbasic->menu(8, 4, 1, g_zbasic->str(338)); // if the two become one.
- } else {
- // 142:0136
- g_zbasic->menu(8, 3, 1, g_zbasic->str(339)); // A puzzle is undone
- g_zbasic->menu(8, 4, 1, g_zbasic->str(340)); // if the two become one.
- }
- // 142:0166
- this->sub_128_271a();
- this->sub_128_4da(0);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
- this->sub_128_55c(g_zbasic->str(341)); // ~
- // eye button
- g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
- for (int16 i = 1; i <= 0xa42; i++) {
- this->arr_i16_9894[i] = this->puzzlesReadShort();
- this->arr_i16_ac1c[i] = this->puzzlesReadShort();
- g_zbasic->put(
- this->arr_i16_9894[i],
- this->arr_i16_ac1c[i],
- this->arr_bmp_b3ec,
- kPutCopy
- );
- // Simulate slow draw speed
- if ((i % 42) == 0)
- g_toolbox->Delay(0);
- }
- // 142:026e
- this->sub_128_4da(1);
- g_zbasic->put(
- this->arr_i16_9894[this->var_i16_233c],
- this->arr_i16_ac1c[this->var_i16_233c],
- this->arr_bmp_b3ec,
- kPutCopy
- );
- this->var_i16_233c = 1;
- this->stateFlags = kStateNull;
- this->var_i16_d0c = 0;
- this->var_i16_1ab6 = 0;
- this->var_i16_1ab8 = 0;
-
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
- // 142:02ee
- this->getNextEvent(-1);
- if (!((this->var_i16_1ab6 == this->var_ev_46.where.x) && (this->var_i16_1ab8 == this->var_ev_46.where.y))) {
- this->sub_142_370();
- }
- if (this->var_i16_233c >= 0xa42) {
- this->var_i16_d0c = 1;
- }
- if (this->stateFlags == kStateSaveGame) {
- this->saveGame();
- }
- // 142:0346
- }
-}
-
-void FoolGame::sub_142_370() {
- // 142:0370
- this->var_i16_7e4 = this->var_i16_233c + 0x19;
- if (this->var_i16_7e4 > 0xa42) {
- this->var_i16_7e4 = 0xa42;
- }
- this->var_i16_9f2 = this->var_i16_233c - 0x19;
- if (this->var_i16_9f2 < 1) {
- this->var_i16_9f2 = 1;
- }
- this->var_i16_1a9c = 0;
- for (int16 i = this->var_i16_7e4; i >= this->var_i16_9f2; i--) {
- this->var_i16_1a96 = this->var_ev_46.where.x - this->arr_i16_9894[i];
- this->var_i16_1a98 = this->var_ev_46.where.y - this->arr_i16_ac1c[i];
- if ((this->var_i16_1a96 >= -5) && (this->var_i16_1a96 <= 0x1e) && (this->var_i16_1a98 >= -5) && (this->var_i16_1a98 <= 0x19)) {
- this->var_i16_1a9c = i + 0xa;
- }
- // 142:0470
- }
- // 142:0484
- if (this->var_i16_1a9c >= 0xa42) {
- this->var_i16_1a9c = 0xa42;
- }
- if (this->var_i16_1a9c != 0) {
- if (this->var_i16_233c < this->var_i16_1a9c) {
- this->var_i16_484 = 1;
- } else {
- this->var_i16_484 = -1;
- }
- this->var_i16_7a8 = this->var_i16_233c;
- do {
- g_zbasic->put(
- this->arr_i16_9894[this->var_i16_7a8],
- this->arr_i16_ac1c[this->var_i16_7a8],
- this->arr_bmp_b3ec,
- kPutCopy
- );
- // 142:051c
- } while (g_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
- this->var_i16_233c = this->var_i16_1a9c;
- this->var_i16_1ab6 = this->var_ev_46.where.x;
- this->var_i16_1ab8 = this->var_ev_46.where.y;
- } else {
- // 142:054a
- this->var_i16_7e4 = this->var_i16_233c - 0xa;
- if (this->var_i16_7e4 < 1) {
- this->var_i16_7e4 = 1;
- }
- for (int16 i = this->var_i16_233c; i >= this->var_i16_7e4; i--) {
- g_zbasic->put(
- this->arr_i16_9894[i],
- this->arr_i16_ac1c[i],
- this->arr_bmp_b3ec,
- kPutCopy
- );
- // 142:05c8
- }
- this->var_i16_233c -= 0xa;
- if (this->var_i16_233c < 1) {
- this->var_i16_233c = 1;
- }
- }
- // 142:05f0
-}
-
-void FoolGame::sub_142_5f2() {
- // 142:05f2
- this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
-}
-
-void FoolGame::sub_142_630() {
- // 142:0630
- g_zbasic->menu(8, 0, 1, g_zbasic->str(342)); // the 2nd key of thoth
- g_zbasic->menu(8, 1, 1, g_zbasic->str(343)); // return to scroll
- this->thothBook();
- if (this->var_i16_d0c == 1) {
- // 142:066e
- g_toolbox->PenNormal();
- g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
- this->var_i16_484 = 1;
- for (int16 i = 1; i <= 4; i++) {
- Common::Rect temp;
- temp.top = this->arr_i16_2f38[i*32];
- temp.left = this->arr_i16_2f38[i*32+1];
- temp.bottom = this->arr_i16_2f38[i*32+2];
- temp.right = this->arr_i16_2f38[i*32+3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
- g_toolbox->FrameRect(temp);
- this->var_str_384 = Common::U32String::format(" %d ", i);
- this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
- this->var_i16_9f2 = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
- // 142:0756
- g_toolbox->MoveTo(
- this->arr_i16_2f38[i*32+1] + this->var_i16_9f2 - (this->var_i16_7e4 / 2),
- this->arr_i16_2f38[i*32 + 2] - 0x1e
- );
- g_toolbox->DrawString(this->var_str_384);
- }
- // 142:07ca
- g_zbasic->text(0, 0xc, 0, kSrcOr);
- this->sub_128_6186();
- this->sub_128_2664();
- this->var_i16_484 = 0;
- this->var_i16_7e4 = 0;
- this->var_i16_9f2 = 0;
- while (this->var_ev_46.modifiers & kModMouseButtonUp) {
- // 142:07f8
- this->getNextEvent(-1); // was: 0
- this->var_i16_7e4++;
- if (this->var_i16_7e4 == 0x64) {
- this->var_i16_7e4 = 0;
- this->var_i16_9f2++;
- if (this->var_i16_9f2 > 4) {
- this->var_i16_9f2 = 1;
- }
- Common::Rect temp;
- temp.top = this->arr_i16_2f38[this->var_i16_9f2*32];
- temp.left = this->arr_i16_2f38[this->var_i16_9f2*32+1];
- temp.bottom = this->arr_i16_2f38[this->var_i16_9f2*32+2];
- temp.right = this->arr_i16_2f38[this->var_i16_9f2*32+3];
- g_toolbox->InvertRect(temp);
- }
- }
- }
- // 142:0850
-}
-
-// justice - lights on
-void FoolGame::justiceRun() {
- // 142:0852
- if (this->var_i16_c04 < 0x63) {
- this->sub_142_9be();
- if (this->var_i16_d0c == 0) {
- this->justiceStoreState();
- return;
- }
- // 142:0874
- this->justiceResetGrid();
- if (this->puzzleCompletionStatus[0x34] > 3) {
- this->var_i16_c04 = 0x64;
- return;
- } else {
- // 142:08a2
- this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
- this->var_i16_c04 = 0x63;
- this->var_str_384 = g_zbasic->str(345); // behold the 3rd key of thoth
- this->sub_128_178a(0x3f, 1);
- }
- }
- // 142:0906
- if (this->var_i16_c04 == 0x63) {
- g_zbasic->menu(8, 0, 1, g_zbasic->str(346)); // the 3rd key of thoth
- g_zbasic->menu(8, 1, 1, g_zbasic->str(347)); // return to scroll
- this->sub_140_18fa();
- if (this->var_i16_d0c == 1) {
- this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
- }
- }
- // 142:098a
- if (this->var_i16_c04 >= 0x64) {
- this->sub_142_9be();
- if (this->var_i16_d0c == 0) {
- this->justiceStoreState();
- return;
- }
- // 142:09b0
- this->justiceResetGrid();
- this->var_i16_c04 = 0x65;
- }
- // 142:09ba
- return;
-}
-
-void FoolGame::sub_142_9be() {
- // 142:09be
- this->sub_128_271a();
- for (int16 i = 1; i <= 0x19; i++) {
- g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
- }
- // 142:09ea
- if (this->puzzleCompletionStatus[0x34] < 4) {
- g_zbasic->menu(8, 3, 1, g_zbasic->str(348)); // a secret hides here
- g_zbasic->menu(8, 4, 1, g_zbasic->str(349)); // if twenty-five appear
- } else {
- // 142:0a3a
- g_zbasic->menu(8, 3, 1, g_zbasic->str(350)); // you will remain here
- g_zbasic->menu(8, 4, 1, g_zbasic->str(351)); // unless twenty-five appear
- }
- // 142:0a6a
- this->justiceZoom();
- this->var_i16_484 = 0;
- for (int16 i = 0x24; i <= 0x11d; i += 0x32) {
- for (int16 j = 0x8c; j <= 0x185; j += 0x32) {
- this->var_i16_484++;
- g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
- j,
- i,
- j + 0x32,
- i + 0x32
- );
- }
- }
- // 142:0adc
- this->justiceZoom();
- this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
- if (this->activePuzzleBuffer.empty()) { // was: str(352)
- this->activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
- this->var_i16_233e = 1;
- } else {
- // 142:0b4c
- this->var_i16_233e = g_zbasic->castInt(g_zbasic->leftStr(this->activePuzzleBuffer, 1));
- this->activePuzzleBuffer = g_zbasic->rightStr(this->activePuzzleBuffer, 0x19);
- }
- // 142:0b7c
- for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_484, 1));
- if ((this->var_i16_103a & 2) == 0) {
- g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
- } else {
- // 142:0be0
- g_zbasic->indexSet(g_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
- }
- // 142:0c06
- if ((this->var_i16_103a & 1) != 0) {
- this->justiceDrawBlock();
- } else {
- this->justiceRemoveBlock();
- }
- }
- // 142:0c32
- this->var_i16_d0c = 0;
- this->stateFlags = 0;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
- // 142:0c42
- while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
- this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
- this->justiceOnClick();
- }
- }
- // 142:0c76
- if (this->stateFlags == kStateSaveGame) {
- this->justiceStoreState();
- this->saveGame();
- }
- // 142:0c88
- }
-}
-
-void FoolGame::justiceOnClick() {
- // 142:0cb2
- this->var_i16_68a = (this->var_ev_46.where.x - 0x5a) / 0x32;
- this->var_i16_68c = (this->var_ev_46.where.y + 0xe) / 0x32;
- if ((this->var_i16_68a < 0) || (this->var_i16_68c < 0) || (this->var_i16_68a > 5) || (this->var_i16_68c > 5)) {
- return;
- }
- // 142:0d26
- this->var_i16_103a = (this->var_i16_68c - 1)*5 + this->var_i16_68a;
- if (this->arr_i16_3738[this->var_i16_103a] == 0) {
- return;
- }
- // 142:0d56
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_103a], 0x1e, 0x1e);
- if (g_zbasic->index(1, this->var_i16_103a + 0x19) == g_zbasic->str(356)) { // \xa5
- g_zbasic->indexSet(g_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
- }
- // 142:0dc6
- if (this->var_i16_103a == 0xd) { // center button
- if (this->var_i16_233e == 0) {
- for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- g_zbasic->indexSet(g_zbasic->str(358), 1, this->var_i16_484 + 0x19); // \xa5
- this->arr_i16_3738[this->var_i16_484] = 0;
- this->justiceRemoveBlock();
- }
- this->var_i16_233e = 1;
- // redraw center tile
- this->var_i16_484 = 0xd;
- this->justiceDrawBlock();
- return;
- }
- // 142:0e3e
- this->var_i16_233e = 0;
- }
- // 142:0e44
- this->var_str_1272 = g_zbasic->indexRaw(1, this->var_i16_103a);
- if (g_zbasic->leftStr(this->var_str_1272, 1) == g_zbasic->str(359)) { // M
- this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, 2, 2));
- this->justiceDrawBlock();
- this->var_i16_2340 = 5;
- } else {
- // 142:0ea8
- this->var_i16_2340 = 2;
- }
- // 142:0eae
- this->var_i16_2342 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
- for (int16 i = 1; i <= this->var_i16_2342; i++) {
- this->var_i16_2340 += 2;
- this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
- // 142:0ef0
- if (this->arr_i16_3738[this->var_i16_484] == 0) {
- this->justiceDrawBlock();
- } else {
- this->justiceRemoveBlock();
- }
- }
- // 142:0f20
- for (int16 i = 1; i <= 0x19; i++) {
- if (this->arr_i16_3738[i] == 0) {
- this->var_i16_d0c = 0;
- }
- }
- this->sub_128_6186();
-}
-
-void FoolGame::justiceZoom() {
- // 142:0f58
- this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
-}
-
-void FoolGame::justiceDrawBlock() {
- // 142:0f96
- this->arr_i16_3738[this->var_i16_484] = 1;
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->PenNormal();
- g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e, this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
- this->var_str_384 = g_zbasic->index(1, this->var_i16_484 + 0x19);
- this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
- // 142:1056
- g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
- this->arr_rect_1f38[this->var_i16_484].top + 0x1e
- );
- g_toolbox->DrawString(this->var_str_384);
-}
-
-void FoolGame::justiceRemoveBlock() {
- // 142:10bc
- this->arr_i16_3738[this->var_i16_484] = 0;
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_484], this->arr_pat_58f4[g_zbasic->rndInt(0x4d)+3]);
-}
-
-void FoolGame::justiceStoreState() {
- // 142:111e
- this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
- this->activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
- for (int16 i = 1; i <= 0x19; i++) {
- this->arr_i16_3738[i] = this->var_i16_484;
- if (g_zbasic->index(1, i + 0x19) == g_zbasic->str(360)) { // ~
- this->var_i16_484 |= 2;
- this->var_str_384 = g_zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
- this->activePuzzleBuffer += this->var_str_384;
- }
- }
- // 142:11fc
-}
-
-void FoolGame::justiceResetGrid() {
- // 142:11fe
- this->sub_128_3da(0x28);
- this->activePuzzleBuffer.clear();
- for (int16 i = 1; i <= 0x19; i++) {
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(this->arr_rect_1f38[i], this->arr_pat_58f4[2]);
- }
- // 142:126e
- this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
-}
// hermit key trace
void FoolGame::hermitRun() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 49b02808b9e..de82ff6dd4c 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -311,6 +311,8 @@ public:
void sub_142_370();
void sub_142_5f2();
void sub_142_630();
+
+ // fool_justice.cpp
void justiceRun(); // sub_142_852
void sub_142_9be();
void justiceOnClick(); // sub_142_cb2
@@ -319,6 +321,7 @@ public:
void justiceRemoveBlock(); // sub_142_10bc
void justiceStoreState(); // sub_142_111e
void justiceResetGrid(); // sub_142_11fe
+
void hermitRun(); // sub_142_12ac
void sub_144_004();
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
new file mode 100644
index 00000000000..1de2595f02b
--- /dev/null
+++ b/engines/fool/fool_humbug.cpp
@@ -0,0 +1,251 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// the humbug - "irritating stick" style challenge
+void FoolGame::humbugRun() {
+ // 142:0004
+ if (this->var_i16_c04 < 0x63) {
+ this->humbugTrail();
+ if (this->var_i16_d0c == 0) {
+ return;
+ }
+ this->sub_142_5f2();
+ if (this->puzzleCompletionStatus[0x34] > 2) {
+ this->var_i16_c04 = 0x64;
+ return;
+ }
+ // 142:004e
+ this->var_i16_c04 = 0x63;
+ this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ this->var_str_384 = g_zbasic->str(336); // behold the 2nd key of thoth
+ this->sub_128_178a(0x17, 0);
+ }
+ // 142:00b2
+ if (this->var_i16_c04 == 0x63) {
+ this->sub_142_630();
+ }
+ if (this->var_i16_c04 >= 0x64) {
+ this->humbugTrail();
+ if (this->var_i16_d0c != 0) {
+ this->sub_142_5f2();
+ }
+ }
+ // 142:00e2
+ return;
+}
+
+void FoolGame::humbugTrail() {
+ // 142:00e6
+ if (this->puzzleCompletionStatus[0x34] < 3) {
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(337)); // A secret is undone
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(338)); // if the two become one.
+ } else {
+ // 142:0136
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(339)); // A puzzle is undone
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(340)); // if the two become one.
+ }
+ // 142:0166
+ this->sub_128_271a();
+ this->sub_128_4da(0);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->sub_128_55c(g_zbasic->str(341)); // ~
+ // eye button
+ g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ for (int16 i = 1; i <= 0xa42; i++) {
+ this->arr_i16_9894[i] = this->puzzlesReadShort();
+ this->arr_i16_ac1c[i] = this->puzzlesReadShort();
+ g_zbasic->put(
+ this->arr_i16_9894[i],
+ this->arr_i16_ac1c[i],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ // Simulate slow draw speed
+ if ((i % 42) == 0)
+ g_toolbox->Delay(0);
+ }
+ // 142:026e
+ this->sub_128_4da(1);
+ g_zbasic->put(
+ this->arr_i16_9894[this->var_i16_233c],
+ this->arr_i16_ac1c[this->var_i16_233c],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ this->var_i16_233c = 1;
+ this->stateFlags = kStateNull;
+ this->var_i16_d0c = 0;
+ this->var_i16_1ab6 = 0;
+ this->var_i16_1ab8 = 0;
+
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 142:02ee
+ this->getNextEvent(-1);
+ if (!((this->var_i16_1ab6 == this->var_ev_46.where.x) && (this->var_i16_1ab8 == this->var_ev_46.where.y))) {
+ this->sub_142_370();
+ }
+ if (this->var_i16_233c >= 0xa42) {
+ this->var_i16_d0c = 1;
+ }
+ if (this->stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+ // 142:0346
+ }
+}
+
+void FoolGame::sub_142_370() {
+ // 142:0370
+ this->var_i16_7e4 = this->var_i16_233c + 0x19;
+ if (this->var_i16_7e4 > 0xa42) {
+ this->var_i16_7e4 = 0xa42;
+ }
+ this->var_i16_9f2 = this->var_i16_233c - 0x19;
+ if (this->var_i16_9f2 < 1) {
+ this->var_i16_9f2 = 1;
+ }
+ this->var_i16_1a9c = 0;
+ for (int16 i = this->var_i16_7e4; i >= this->var_i16_9f2; i--) {
+ this->var_i16_1a96 = this->var_ev_46.where.x - this->arr_i16_9894[i];
+ this->var_i16_1a98 = this->var_ev_46.where.y - this->arr_i16_ac1c[i];
+ if ((this->var_i16_1a96 >= -5) && (this->var_i16_1a96 <= 0x1e) && (this->var_i16_1a98 >= -5) && (this->var_i16_1a98 <= 0x19)) {
+ this->var_i16_1a9c = i + 0xa;
+ }
+ // 142:0470
+ }
+ // 142:0484
+ if (this->var_i16_1a9c >= 0xa42) {
+ this->var_i16_1a9c = 0xa42;
+ }
+ if (this->var_i16_1a9c != 0) {
+ if (this->var_i16_233c < this->var_i16_1a9c) {
+ this->var_i16_484 = 1;
+ } else {
+ this->var_i16_484 = -1;
+ }
+ this->var_i16_7a8 = this->var_i16_233c;
+ do {
+ g_zbasic->put(
+ this->arr_i16_9894[this->var_i16_7a8],
+ this->arr_i16_ac1c[this->var_i16_7a8],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ // 142:051c
+ } while (g_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
+ this->var_i16_233c = this->var_i16_1a9c;
+ this->var_i16_1ab6 = this->var_ev_46.where.x;
+ this->var_i16_1ab8 = this->var_ev_46.where.y;
+ } else {
+ // 142:054a
+ this->var_i16_7e4 = this->var_i16_233c - 0xa;
+ if (this->var_i16_7e4 < 1) {
+ this->var_i16_7e4 = 1;
+ }
+ for (int16 i = this->var_i16_233c; i >= this->var_i16_7e4; i--) {
+ g_zbasic->put(
+ this->arr_i16_9894[i],
+ this->arr_i16_ac1c[i],
+ this->arr_bmp_b3ec,
+ kPutCopy
+ );
+ // 142:05c8
+ }
+ this->var_i16_233c -= 0xa;
+ if (this->var_i16_233c < 1) {
+ this->var_i16_233c = 1;
+ }
+ }
+ // 142:05f0
+}
+
+void FoolGame::sub_142_5f2() {
+ // 142:05f2
+ this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+}
+
+void FoolGame::sub_142_630() {
+ // 142:0630
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(342)); // the 2nd key of thoth
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(343)); // return to scroll
+ this->thothBook();
+ if (this->var_i16_d0c == 1) {
+ // 142:066e
+ g_toolbox->PenNormal();
+ g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ for (int16 i = 1; i <= 4; i++) {
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[i*32];
+ temp.left = this->arr_i16_2f38[i*32+1];
+ temp.bottom = this->arr_i16_2f38[i*32+2];
+ temp.right = this->arr_i16_2f38[i*32+3];
+ g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ g_toolbox->FrameRect(temp);
+ this->var_str_384 = Common::U32String::format(" %d ", i);
+ this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_9f2 = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
+ // 142:0756
+ g_toolbox->MoveTo(
+ this->arr_i16_2f38[i*32+1] + this->var_i16_9f2 - (this->var_i16_7e4 / 2),
+ this->arr_i16_2f38[i*32 + 2] - 0x1e
+ );
+ g_toolbox->DrawString(this->var_str_384);
+ }
+ // 142:07ca
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->sub_128_6186();
+ this->sub_128_2664();
+ this->var_i16_484 = 0;
+ this->var_i16_7e4 = 0;
+ this->var_i16_9f2 = 0;
+ while (this->var_ev_46.modifiers & kModMouseButtonUp) {
+ // 142:07f8
+ this->getNextEvent(-1); // was: 0
+ this->var_i16_7e4++;
+ if (this->var_i16_7e4 == 0x64) {
+ this->var_i16_7e4 = 0;
+ this->var_i16_9f2++;
+ if (this->var_i16_9f2 > 4) {
+ this->var_i16_9f2 = 1;
+ }
+ Common::Rect temp;
+ temp.top = this->arr_i16_2f38[this->var_i16_9f2*32];
+ temp.left = this->arr_i16_2f38[this->var_i16_9f2*32+1];
+ temp.bottom = this->arr_i16_2f38[this->var_i16_9f2*32+2];
+ temp.right = this->arr_i16_2f38[this->var_i16_9f2*32+3];
+ g_toolbox->InvertRect(temp);
+ }
+ }
+ }
+ // 142:0850
+}
+
+}
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
new file mode 100644
index 00000000000..2a6c776d97b
--- /dev/null
+++ b/engines/fool/fool_justice.cpp
@@ -0,0 +1,277 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// justice - lights on
+void FoolGame::justiceRun() {
+ // 142:0852
+ if (this->var_i16_c04 < 0x63) {
+ this->sub_142_9be();
+ if (this->var_i16_d0c == 0) {
+ this->justiceStoreState();
+ return;
+ }
+ // 142:0874
+ this->justiceResetGrid();
+ if (this->puzzleCompletionStatus[0x34] > 3) {
+ this->var_i16_c04 = 0x64;
+ return;
+ } else {
+ // 142:08a2
+ this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
+ this->var_i16_c04 = 0x63;
+ this->var_str_384 = g_zbasic->str(345); // behold the 3rd key of thoth
+ this->sub_128_178a(0x3f, 1);
+ }
+ }
+ // 142:0906
+ if (this->var_i16_c04 == 0x63) {
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(346)); // the 3rd key of thoth
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(347)); // return to scroll
+ this->sub_140_18fa();
+ if (this->var_i16_d0c == 1) {
+ this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
+ }
+ }
+ // 142:098a
+ if (this->var_i16_c04 >= 0x64) {
+ this->sub_142_9be();
+ if (this->var_i16_d0c == 0) {
+ this->justiceStoreState();
+ return;
+ }
+ // 142:09b0
+ this->justiceResetGrid();
+ this->var_i16_c04 = 0x65;
+ }
+ // 142:09ba
+ return;
+}
+
+void FoolGame::sub_142_9be() {
+ // 142:09be
+ this->sub_128_271a();
+ for (int16 i = 1; i <= 0x19; i++) {
+ g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
+ }
+ // 142:09ea
+ if (this->puzzleCompletionStatus[0x34] < 4) {
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(348)); // a secret hides here
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(349)); // if twenty-five appear
+ } else {
+ // 142:0a3a
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(350)); // you will remain here
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(351)); // unless twenty-five appear
+ }
+ // 142:0a6a
+ this->justiceZoom();
+ this->var_i16_484 = 0;
+ for (int16 i = 0x24; i <= 0x11d; i += 0x32) {
+ for (int16 j = 0x8c; j <= 0x185; j += 0x32) {
+ this->var_i16_484++;
+ g_toolbox->SetRect(
+ this->arr_rect_1f38[this->var_i16_484],
+ j,
+ i,
+ j + 0x32,
+ i + 0x32
+ );
+ }
+ }
+ // 142:0adc
+ this->justiceZoom();
+ this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
+ if (this->activePuzzleBuffer.empty()) { // was: str(352)
+ this->activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
+ this->var_i16_233e = 1;
+ } else {
+ // 142:0b4c
+ this->var_i16_233e = g_zbasic->castInt(g_zbasic->leftStr(this->activePuzzleBuffer, 1));
+ this->activePuzzleBuffer = g_zbasic->rightStr(this->activePuzzleBuffer, 0x19);
+ }
+ // 142:0b7c
+ for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
+ this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_484, 1));
+ if ((this->var_i16_103a & 2) == 0) {
+ g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
+ } else {
+ // 142:0be0
+ g_zbasic->indexSet(g_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
+ }
+ // 142:0c06
+ if ((this->var_i16_103a & 1) != 0) {
+ this->justiceDrawBlock();
+ } else {
+ this->justiceRemoveBlock();
+ }
+ }
+ // 142:0c32
+ this->var_i16_d0c = 0;
+ this->stateFlags = 0;
+ while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ // 142:0c42
+ while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
+ this->getNextEvent(-1);
+ if (this->var_ev_46.what == 1) {
+ this->justiceOnClick();
+ }
+ }
+ // 142:0c76
+ if (this->stateFlags == kStateSaveGame) {
+ this->justiceStoreState();
+ this->saveGame();
+ }
+ // 142:0c88
+ }
+}
+
+void FoolGame::justiceOnClick() {
+ // 142:0cb2
+ this->var_i16_68a = (this->var_ev_46.where.x - 0x5a) / 0x32;
+ this->var_i16_68c = (this->var_ev_46.where.y + 0xe) / 0x32;
+ if ((this->var_i16_68a < 0) || (this->var_i16_68c < 0) || (this->var_i16_68a > 5) || (this->var_i16_68c > 5)) {
+ return;
+ }
+ // 142:0d26
+ this->var_i16_103a = (this->var_i16_68c - 1)*5 + this->var_i16_68a;
+ if (this->arr_i16_3738[this->var_i16_103a] == 0) {
+ return;
+ }
+ // 142:0d56
+ g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_103a], 0x1e, 0x1e);
+ if (g_zbasic->index(1, this->var_i16_103a + 0x19) == g_zbasic->str(356)) { // \xa5
+ g_zbasic->indexSet(g_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
+ }
+ // 142:0dc6
+ if (this->var_i16_103a == 0xd) { // center button
+ if (this->var_i16_233e == 0) {
+ for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
+ g_zbasic->indexSet(g_zbasic->str(358), 1, this->var_i16_484 + 0x19); // \xa5
+ this->arr_i16_3738[this->var_i16_484] = 0;
+ this->justiceRemoveBlock();
+ }
+ this->var_i16_233e = 1;
+ // redraw center tile
+ this->var_i16_484 = 0xd;
+ this->justiceDrawBlock();
+ return;
+ }
+ // 142:0e3e
+ this->var_i16_233e = 0;
+ }
+ // 142:0e44
+ this->var_str_1272 = g_zbasic->indexRaw(1, this->var_i16_103a);
+ if (g_zbasic->leftStr(this->var_str_1272, 1) == g_zbasic->str(359)) { // M
+ this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, 2, 2));
+ this->justiceDrawBlock();
+ this->var_i16_2340 = 5;
+ } else {
+ // 142:0ea8
+ this->var_i16_2340 = 2;
+ }
+ // 142:0eae
+ this->var_i16_2342 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
+ for (int16 i = 1; i <= this->var_i16_2342; i++) {
+ this->var_i16_2340 += 2;
+ this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
+ // 142:0ef0
+ if (this->arr_i16_3738[this->var_i16_484] == 0) {
+ this->justiceDrawBlock();
+ } else {
+ this->justiceRemoveBlock();
+ }
+ }
+ // 142:0f20
+ for (int16 i = 1; i <= 0x19; i++) {
+ if (this->arr_i16_3738[i] == 0) {
+ this->var_i16_d0c = 0;
+ }
+ }
+ this->sub_128_6186();
+}
+
+void FoolGame::justiceZoom() {
+ // 142:0f58
+ this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
+}
+
+void FoolGame::justiceDrawBlock() {
+ // 142:0f96
+ this->arr_i16_3738[this->var_i16_484] = 1;
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->PenNormal();
+ g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e, this->arr_pat_58f4[0]);
+ g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e);
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_384 = g_zbasic->index(1, this->var_i16_484 + 0x19);
+ this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ // 142:1056
+ g_toolbox->MoveTo(
+ this->arr_rect_1f38[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
+ this->arr_rect_1f38[this->var_i16_484].top + 0x1e
+ );
+ g_toolbox->DrawString(this->var_str_384);
+}
+
+void FoolGame::justiceRemoveBlock() {
+ // 142:10bc
+ this->arr_i16_3738[this->var_i16_484] = 0;
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_484], this->arr_pat_58f4[g_zbasic->rndInt(0x4d)+3]);
+}
+
+void FoolGame::justiceStoreState() {
+ // 142:111e
+ this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
+ this->activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
+ for (int16 i = 1; i <= 0x19; i++) {
+ this->arr_i16_3738[i] = this->var_i16_484;
+ if (g_zbasic->index(1, i + 0x19) == g_zbasic->str(360)) { // ~
+ this->var_i16_484 |= 2;
+ this->var_str_384 = g_zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
+ this->activePuzzleBuffer += this->var_str_384;
+ }
+ }
+ // 142:11fc
+}
+
+void FoolGame::justiceResetGrid() {
+ // 142:11fe
+ this->sub_128_3da(0x28);
+ this->activePuzzleBuffer.clear();
+ for (int16 i = 1; i <= 0x19; i++) {
+ this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->FillRect(this->arr_rect_1f38[i], this->arr_pat_58f4[2]);
+ }
+ // 142:126e
+ this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+}
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 77b1b4239be..e18f4a853fa 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -6,8 +6,10 @@ MODULE_OBJS = \
fool_cards.o \
fool_death.o \
fool_game.o \
+ fool_humbug.o \
fool_jigsaw.o \
fool_jumble.o \
+ fool_justice.o \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
Commit: ae9c51d7108bf52a3829e260df7cce2de1680468
https://github.com/scummvm/scummvm/commit/ae9c51d7108bf52a3829e260df7cce2de1680468
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:20+02:00
Commit Message:
FOOL: Use raw strings for puzzle data
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 065528841e8..71e14c750c4 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -368,12 +368,12 @@ int32 FoolGame::puzzlesReadLong() {
return this->var_i32_68e;
}
-Common::U32String FoolGame::puzzlesReadString() {
+Common::String FoolGame::puzzlesReadString() {
// 128:049a
// read a pascal string
this->var_i16_79e = *(byte *)(&var_bytes_696->data()[this->var_ptr_696]);
- this->var_str_69a = Common::U32String((const char *)&var_bytes_696->data()[this->var_ptr_696+1], this->var_i16_79e, Common::kMacRoman);
- debugC(8, kDebugLoading, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.encode().c_str());
+ this->var_str_69a = Common::String((const char *)&var_bytes_696->data()[this->var_ptr_696+1], this->var_i16_79e);
+ debugC(8, kDebugLoading, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.c_str());
this->var_ptr_696 += this->var_i16_79e + 1;
return this->var_str_69a;
}
@@ -3013,7 +3013,7 @@ void FoolGame::sub_129_068() {
this->arr_i16_18b2[i] = this->puzzlesReadShort();
this->arr_i16_15e8[i] = this->puzzlesReadShort();
this->arr_i16_197c[i] = this->puzzlesReadShort();
- this->arr_str_195e8[i] = this->puzzlesReadString();
+ this->arr_str_195e8[i] = this->puzzlesReadString().decode(Common::kMacRoman);
}
// 129:0c0a
this->var_i16_103a = this->puzzlesReadShort();
@@ -3049,12 +3049,11 @@ void FoolGame::sub_129_068() {
// indent at start of story paragraph
if (this->var_i16_103e & 0x8) {
this->var_i16_103e ^= 0x8;
- this->var_str_384 = this->puzzlesReadString();
// 129:0d7e
- g_zbasic->indexSet(g_zbasic->space(4) + this->var_str_384, 0, i);
+ g_zbasic->indexRawSet(g_zbasic->space(4).encode(Common::kMacRoman) + this->puzzlesReadString(), 0, i);
} else {
// 129:0da4
- g_zbasic->indexSet(this->puzzlesReadString(), 0, i);
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 0, i);
}
// 129:0db8
// 0x4 == newline
@@ -3084,7 +3083,7 @@ void FoolGame::sub_129_068() {
this->sub_129_123a();
this->var_i16_103a = this->puzzlesReadShort();
for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
- g_zbasic->indexSet(this->puzzlesReadString(), 0, i);
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 0, i);
}
// 129:0ec2
for (int j = 1; j <= 0x50; j++) {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index de82ff6dd4c..3c36ed83fb1 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -59,7 +59,7 @@ public:
int16 puzzlesReadByte(); // sub_128_428
int16 puzzlesReadShort(); // sub_128_446
int32 puzzlesReadLong(); // sub_128_462
- Common::U32String puzzlesReadString(); // sub_128_49a
+ Common::String puzzlesReadString(); // sub_128_49a
void sub_128_4da(int16 unk1);
void sub_128_50e(int16 freq, int16 duration, int16 wait);
void sub_128_55c(const Common::U32String &unk1);
@@ -368,7 +368,7 @@ private:
// instead we track it as a handle + offset
uint32 var_ptr_696;
Handle var_bytes_696;
- Common::U32String var_str_69a;
+ Common::String var_str_69a;
int16 var_i16_78a;
int16 var_i16_79e;
int16 var_i16_7a0;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 1b5208a5ecd..593501a6e0d 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -99,7 +99,8 @@ void FoolGame::jigsawRun() {
// rearrange picture tiles to match state
if (!this->activePuzzleBuffer.empty()) { // was: str(207)
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- this->arr_i16_3738[i] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, i*2 - 1, 2));
+ Common::String tileData = g_zbasic->midStr(this->activePuzzleBuffer, i*2 - 1, 2);
+ this->arr_i16_3738[i] = g_zbasic->unk_310(tileData);
g_zbasic->put(
this->arr_rect_1f38[i].left,
this->arr_rect_1f38[i].top,
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index d168022481f..b30c8de75e7 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -152,7 +152,7 @@ void FoolGame::jumbleRun() {
this->var_str_1170 = g_zbasic->str(169); // empty
this->var_i16_1270 = this->puzzlesReadShort();
for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
- this->var_str_1272 = this->puzzlesReadString();
+ this->var_str_1272 = this->puzzlesReadString().decode(Common::kMacRoman);
this->var_i16_1372 = this->var_str_1272.size();
this->var_str_1170 += this->var_str_1272;
// 130:047e
@@ -213,7 +213,7 @@ void FoolGame::jumbleRun() {
}
}
// 130:0716
- g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_103a);
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 1, this->var_i16_103a);
}
// 130:073e
this->var_i16_1576 = this->var_str_1170.size();
@@ -245,7 +245,7 @@ void FoolGame::jumbleRun() {
for (this->var_i16_68a = 1; this->var_i16_68a <= this->var_i16_103a; this->var_i16_68a++) {
this->var_i16_484 = this->puzzlesReadShort();
this->var_i16_7e4 = this->puzzlesReadShort();
- this->var_str_1578 = this->puzzlesReadString();
+ this->var_str_1578 = this->puzzlesReadString().decode(Common::kMacRoman);
g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
if (this->var_i16_7e4 > 0) {
g_toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index 2a6c776d97b..5f00d2e9de7 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -79,7 +79,7 @@ void FoolGame::sub_142_9be() {
// 142:09be
this->sub_128_271a();
for (int16 i = 1; i <= 0x19; i++) {
- g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 1, i);
}
// 142:09ea
if (this->puzzleCompletionStatus[0x34] < 4) {
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index ed01c1274a8..cb3ff64e69d 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -38,7 +38,7 @@ void FoolGame::polyominoRun() {
this->arr_i16_1eb8[i] = this->puzzlesReadShort();
}
// 133:003c
- this->var_str_384 = this->puzzlesReadString();
+ this->var_str_384 = this->puzzlesReadString().decode(Common::kMacRoman);
// "the completed puzzle will reveal..."
this->var_str_384 = g_zbasic->str(209) + this->var_str_384 + g_zbasic->str(210);
g_zbasic->menu(8, 0xf, 1, this->var_str_384);
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index fa16f024d2a..7d000047e2e 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -52,9 +52,9 @@ void FoolGame::sentenceRun() {
this->var_i16_1066 = this->puzzlesReadShort();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
this->arr_i16_1eb8[0] = this->puzzlesReadShort();
- g_zbasic->indexSet(this->puzzlesReadString(), 1, 0);
- this->var_str_1272 = this->puzzlesReadString();
- this->var_str_384 = this->puzzlesReadString();
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 1, 0);
+ this->var_str_1272 = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->var_str_384 = this->puzzlesReadString().decode(Common::kMacRoman);
this->var_str_384 = g_zbasic->str(215) + this->var_str_384 + g_zbasic->str(216); // to reveal XXXXX
// 135:0152
g_zbasic->menu(8, 7, 1, this->var_str_384);
@@ -66,9 +66,9 @@ void FoolGame::sentenceRun() {
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->arr_i16_4338[i] = 0;
this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = this->puzzlesReadByte();
- g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 1, i);
// 135:0254
- g_zbasic->indexSet(this->puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
+ g_zbasic->indexRawSet(this->puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
this->arr_rect_1f38[i].top = 0xf2;
this->arr_rect_1f38[i].left = this->var_i16_7e4;
this->arr_rect_1f38[i].bottom = 0x156;
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index bae8f81a491..369c8a90b2c 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -34,7 +34,7 @@ extern Toolbox *g_toolbox;
void FoolGame::wordSearchRun() {
// 131:0004
this->sub_128_271a();
- this->var_str_188e = this->puzzlesReadString();
+ this->var_str_188e = this->puzzlesReadString().decode(Common::kMacRoman);
for (int i = 0; i <= 0xe; i++) {
this->arr_i16_1eb8[i] = this->puzzlesReadShort();
}
@@ -147,7 +147,7 @@ void FoolGame::wordSearchRun() {
g_zbasic->unk_20();
// 131:04e0
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- this->var_str_1994 = this->puzzlesReadString();
+ this->var_str_1994 = this->puzzlesReadString().decode(Common::kMacRoman);
this->var_i16_1574 = 1 + (j - 1) * this->arr_i16_1eb8[0];
// 131:051e
this->arr_rect_5b7c.top = this->arr_rect_1f38[this->var_i16_1574].top - 1;
Commit: 5a03144ffc99dc0a124d028eb79c7d4969954ab7
https://github.com/scummvm/scummvm/commit/5a03144ffc99dc0a124d028eb79c7d4969954ab7
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:20+02:00
Commit Message:
FOOL: Book of Thoth working
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index a6ecc7540cc..df0c4dab92b 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -66,7 +66,7 @@ void FoolGame::cardsRun() {
g_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
if (this->activePuzzleBuffer.empty()) { // was: str(278)
// 139:01fa
- this->activePuzzleBuffer = g_zbasic->unk_88(0) + g_zbasic->unk_88(0) + g_zbasic->unk_88(0);
+ this->activePuzzleBuffer = g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0);
// card IDs
for (int16 i = 0; i <= 0x15; i++) {
this->arr_i16_5cbc[i] = i;
@@ -79,15 +79,15 @@ void FoolGame::cardsRun() {
}
// 139:029c
for (int i = 0; i <= 0x15; i++) {
- this->activePuzzleBuffer += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
+ this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
}
}
// 139:02d8
// player scores
- this->arr_i16_1eb8[5] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, 1, 2));
- this->arr_i16_1eb8[6] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, 3, 2));
+ this->arr_i16_1eb8[5] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, 1, 2));
+ this->arr_i16_1eb8[6] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, 3, 2));
// 139:0320
- this->var_i16_2010 = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, 5, 2));
+ this->var_i16_2010 = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, 5, 2));
if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->arr_i16_1eb8[5] = 0;
this->arr_i16_1eb8[6] = 0;
@@ -96,7 +96,7 @@ void FoolGame::cardsRun() {
// 139:039e
for (int i = 0; i <= 0x15; i++) {
- this->arr_i16_5cbc[i] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, i*2 + 7, 2));
+ this->arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, i*2 + 7, 2));
}
// 139:03ea
this->arr_i16_5cbc[0x16] = 0x16;
@@ -111,7 +111,7 @@ void FoolGame::cardsRun() {
this->cardsShuffleDeck();
}
// 139:0456
- this->sub_139_582();
+ this->cardsDrawTable();
while ((this->stateFlags & 1) == 0) {
// 139:045e
this->var_i16_2014 = 0;
@@ -151,13 +151,13 @@ void FoolGame::sub_139_4de() {
this->var_i16_2012 = 0;
this->cardsDrawScores();
this->cardsShuffleDeck();
- this->sub_139_582();
+ this->cardsDrawTable();
}
void FoolGame::sub_139_50e() {
this->var_i16_2014 = 0;
this->cardsShuffleDeck();
- this->sub_139_582();
+ this->cardsDrawTable();
}
void FoolGame::cardsShuffleDeck() {
@@ -171,7 +171,7 @@ void FoolGame::cardsShuffleDeck() {
}
}
-void FoolGame::sub_139_582() {
+void FoolGame::cardsDrawTable() {
this->sub_139_17fc();
this->drawTarotCard(5, 0, 0);
this->drawTarotCard(4, 1, 0);
@@ -685,12 +685,12 @@ void FoolGame::cardsDrawScores() {
void FoolGame::cardsStoreState() {
// 139:1cba
- this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[5]) +
- g_zbasic->unk_88(this->arr_i16_1eb8[6]) +
- g_zbasic->unk_88(this->var_i16_2010);
+ this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[5]) +
+ g_zbasic->encodeInt(this->arr_i16_1eb8[6]) +
+ g_zbasic->encodeInt(this->var_i16_2010);
// 139:1d00
for (int i = 0; i <= 0x15; i++) {
- this->activePuzzleBuffer += g_zbasic->unk_88(this->arr_i16_5cbc[i]);
+ this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
}
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 71e14c750c4..dd3fa4328d1 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1716,7 +1716,7 @@ void FoolGame::sub_128_39a0() {
this->cardsRun();
break;
case 13:
- this->sub_140_004();
+ this->highPriestessRun();
break;
case 14:
this->deathRun();
@@ -2589,7 +2589,7 @@ void FoolGame::thothShowPlayfield() {
this->arr_i16_1eb8[0] = 1;
}
// 128:5f4c
- this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
+ this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
this->saveGame();
}
// 128:5f70
@@ -2794,6 +2794,13 @@ void FoolGame::sub_129_068() {
this->var_i32_8->portBits = g_toolbox->_defaultMenuBits;
this->var_i32_8->portRect = g_toolbox->_defaultMenuBits->getBounds();
+ // Thoth, on the other hand, expects to be able to draw to the screen.
+ this->var_i32_8_thoth = &this->arr_grafport_19042_thoth;
+ g_toolbox->OpenPort(this->var_i32_8_thoth);
+ g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ g_toolbox->ClipRect(this->arr_rect_1ae06);
+
this->var_i32_4 = &this->arr_grafport_18f78;
g_toolbox->OpenPort(this->var_i32_4);
g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -3208,35 +3215,35 @@ void FoolGame::hermitRun() {
}
// 142:132c
if (this->var_i16_c04 == 0) {
- this->var_i16_2324 = 1;
+ this->hermitPathStage = 1;
}
if ((this->var_i16_c04 > 0) && (this->var_i16_c04 < 0x63)) {
- this->var_i16_2324 = this->var_i16_c04;
+ this->hermitPathStage = this->var_i16_c04;
}
// 142:1360
if (this->var_i16_c04 == 0x63) {
- this->var_i16_2324 = 6;
+ this->hermitPathStage = 6;
}
if (this->var_i16_c04 == 0x64) {
- this->var_i16_2324 = 1;
+ this->hermitPathStage = 1;
}
if (this->var_i16_c04 > 0x64) {
- this->var_i16_2324 = this->var_i16_c04 - 0x64;
+ this->hermitPathStage = this->var_i16_c04 - 0x64;
}
- this->sub_140_206a();
- if (this->var_i16_2324 == 6) {
+ this->thothKeyLast();
+ if (this->hermitPathStage == 6) {
this->var_i16_c04 = 0x63;
} else {
if (this->var_i16_c04 < 0x63) {
// 142:13be
- this->var_i16_c04 = this->var_i16_2324;
+ this->var_i16_c04 = this->hermitPathStage;
if (this->var_i16_d0c != 0) {
this->var_i16_c04 = 0x64;
}
} else {
// 142:13da
if (this->var_i16_c04 >= 0x64) {
- this->var_i16_c04 = this->var_i16_2324 + 0x64;
+ this->var_i16_c04 = this->hermitPathStage + 0x64;
if (this->var_i16_d0c != 0) {
this->var_i16_c04 = 0x65;
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 3c36ed83fb1..71535bdff70 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -252,7 +252,7 @@ public:
void sub_139_4de();
void sub_139_50e();
void cardsShuffleDeck(); // sub_139_51e
- void sub_139_582();
+ void cardsDrawTable(); // sub_139_582
void cardsOnClick(); // sub_139_6b0
void sub_139_a22();
void cardsOpponentYields(); // sub_139_da8
@@ -265,31 +265,31 @@ public:
void sub_139_1d3e();
// fool_thoth.cpp
- void sub_140_004();
- void thothHighPriestess(); // sub_140_458
+ void highPriestessRun(); // sub_140_004
+ void thoth99Enchantments(); // sub_140_458
void thothMoveEnchantment(); // sub_140_9f0
void thothDrawEnchantment(); // sub_140_b2c
void sub_140_c4c();
void thothScrambleScreen(); // sub_140_dd4
void sub_140_e3c();
void sub_140_f84();
- void sub_140_12fc();
+ void thothKey1st(); // sub_140_12fc
void sub_140_15fc();
- void thothBook(); // sub_140_1486
- void sub_140_18fa();
- void sub_140_1bc4();
+ void thothKey2nd(); // sub_140_1486
+ void thothKey3rd(); // sub_140_18fa
+ void thothKey3rdOnClick(); // sub_140_1bc4
void sub_140_1f68();
void sub_140_205e();
- void sub_140_206a();
- void sub_140_22b8();
- void sub_140_24ae();
- void sub_140_25e4();
- void sub_140_2662();
- void sub_140_26ca();
- void sub_140_28bc();
+ void thothKeyLast(); // sub_140_206a
+ void thothKeyLastOnClick(); // sub_140_22b8
+ void thothBadSelect(); // sub_140_24ae
+ void hermitNextStage(); // sub_140_25e4
+ void hermitScreenFlash(); // sub_140_2662
+ void hermitScreenZoom(); // sub_140_26ca
+ void hermitScreenBehold(); // sub_140_28bc
void sub_140_2968();
void sub_140_2978();
- void sub_140_2998();
+ void thothKeyLastSetup(); // sub_140_2998
void sub_140_2f92();
Common::Rect thothRandomSquare(); // sub_140_3050
Common::Rect thothRandomHRect(); // sub_140_30da
@@ -332,6 +332,7 @@ private:
GrafPtr var_i32_0;
GrafPtr var_i32_4;
GrafPtr var_i32_8;
+ GrafPtr var_i32_8_thoth;
Handle var_i32_c;
int16 var_i16_30;
int16 var_i16_32;
@@ -540,7 +541,7 @@ private:
int16 var_i16_221e;
Common::U32String var_str_2222;
int16 var_i16_2322;
- int16 var_i16_2324;
+ int16 hermitPathStage; // var_i16_2324
int16 var_i16_2326;
int16 var_i16_2328;
uint32 var_ptr_232a;
@@ -549,8 +550,8 @@ private:
int16 var_i16_2330;
int16 var_i16_2332;
- int16 var_i16_2334;
- int16 var_i16_2336;
+ int16 hermitPathStartIndex; // var_i16_2334
+ int16 hermitPathEndIndex; // var_i16_2336
int16 var_i16_2338;
int16 var_i16_233a;
int16 var_i16_233e;
@@ -616,6 +617,7 @@ private:
GrafPort arr_grafport_18eae;
GrafPort arr_grafport_18f78;
GrafPort arr_grafport_19042;
+ GrafPort arr_grafport_19042_thoth;
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
Common::Rect arr_rect_19114;
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 1de2595f02b..374ac60b2d0 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -196,7 +196,7 @@ void FoolGame::sub_142_630() {
// 142:0630
g_zbasic->menu(8, 0, 1, g_zbasic->str(342)); // the 2nd key of thoth
g_zbasic->menu(8, 1, 1, g_zbasic->str(343)); // return to scroll
- this->thothBook();
+ this->thothKey2nd();
if (this->var_i16_d0c == 1) {
// 142:066e
g_toolbox->PenNormal();
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 593501a6e0d..4080a2f3071 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -100,7 +100,7 @@ void FoolGame::jigsawRun() {
if (!this->activePuzzleBuffer.empty()) { // was: str(207)
for (int i = 1; i <= this->var_i16_1a9e; i++) {
Common::String tileData = g_zbasic->midStr(this->activePuzzleBuffer, i*2 - 1, 2);
- this->arr_i16_3738[i] = g_zbasic->unk_310(tileData);
+ this->arr_i16_3738[i] = g_zbasic->decodeInt(tileData);
g_zbasic->put(
this->arr_rect_1f38[i].left,
this->arr_rect_1f38[i].top,
@@ -379,8 +379,7 @@ void FoolGame::jigsawStoreState() {
// 132:1384
this->activePuzzleBuffer = g_zbasic->str(208);
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- this->var_str_384 = g_zbasic->unk_88(this->arr_i16_3738[i]);
- this->activePuzzleBuffer += this->var_str_384;
+ this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_3738[i]);
}
}
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index 5f00d2e9de7..e796fc7f333 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -55,7 +55,7 @@ void FoolGame::justiceRun() {
if (this->var_i16_c04 == 0x63) {
g_zbasic->menu(8, 0, 1, g_zbasic->str(346)); // the 3rd key of thoth
g_zbasic->menu(8, 1, 1, g_zbasic->str(347)); // return to scroll
- this->sub_140_18fa();
+ this->thothKey3rd();
if (this->var_i16_d0c == 1) {
this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
}
@@ -187,9 +187,9 @@ void FoolGame::justiceOnClick() {
this->var_i16_233e = 0;
}
// 142:0e44
- this->var_str_1272 = g_zbasic->indexRaw(1, this->var_i16_103a);
- if (g_zbasic->leftStr(this->var_str_1272, 1) == g_zbasic->str(359)) { // M
- this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, 2, 2));
+ Common::String buffer = g_zbasic->indexRaw(1, this->var_i16_103a);
+ if (g_zbasic->leftStr(buffer, 1) == g_zbasic->str(359).encode(Common::kMacRoman)) { // M
+ this->var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(buffer, 2, 2));
this->justiceDrawBlock();
this->var_i16_2340 = 5;
} else {
@@ -197,10 +197,10 @@ void FoolGame::justiceOnClick() {
this->var_i16_2340 = 2;
}
// 142:0eae
- this->var_i16_2342 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
+ this->var_i16_2342 = g_zbasic->decodeInt(g_zbasic->midStr(buffer, this->var_i16_2340, 2));
for (int16 i = 1; i <= this->var_i16_2342; i++) {
this->var_i16_2340 += 2;
- this->var_i16_484 = g_zbasic->unk_310(g_zbasic->midStr(this->var_str_1272, this->var_i16_2340, 2));
+ this->var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(buffer, this->var_i16_2340, 2));
// 142:0ef0
if (this->arr_i16_3738[this->var_i16_484] == 0) {
this->justiceDrawBlock();
@@ -209,6 +209,7 @@ void FoolGame::justiceOnClick() {
}
}
// 142:0f20
+ this->var_i16_d0c = 1;
for (int16 i = 1; i <= 0x19; i++) {
if (this->arr_i16_3738[i] == 0) {
this->var_i16_d0c = 0;
@@ -252,7 +253,7 @@ void FoolGame::justiceStoreState() {
this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
this->activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
for (int16 i = 1; i <= 0x19; i++) {
- this->arr_i16_3738[i] = this->var_i16_484;
+ this->var_i16_484 = this->arr_i16_3738[i];
if (g_zbasic->index(1, i + 0x19) == g_zbasic->str(360)) { // ~
this->var_i16_484 |= 2;
this->var_str_384 = g_zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index cb3ff64e69d..62a6b3480ca 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -122,7 +122,7 @@ void FoolGame::polyominoRun() {
this->var_i16_1aa8 = 1;
}
for (int i = 3; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_1aa8, 2));
+ this->arr_i16_47d8[j*8 + i] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_1aa8, 2));
this->var_i16_1aa8 += 2;
}
}
@@ -519,8 +519,8 @@ void FoolGame::polyominoStoreState() {
this->activePuzzleBuffer = g_zbasic->str(212); // empty
this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
- Common::String val1 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 3]);
- Common::String val2 = g_zbasic->unk_88(this->arr_i16_47d8[i*8 + 4]);
+ Common::String val1 = g_zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
+ Common::String val2 = g_zbasic->encodeInt(this->arr_i16_47d8[i*8 + 4]);
this->activePuzzleBuffer += val1 + val2;
}
}
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 57430048852..325d0ba0331 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -78,7 +78,7 @@ void FoolGame::revealRun() {
this->sub_128_962(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
this->sub_128_962(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
// 134:02f0
- this->arr_i16_1eb8[19] = g_zbasic->unk_310(this->activePuzzleBuffer);
+ this->arr_i16_1eb8[19] = g_zbasic->decodeInt(this->activePuzzleBuffer);
this->var_i16_1aba = this->arr_i16_1eb8[18];
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
@@ -140,7 +140,7 @@ void FoolGame::revealRun() {
this->revealReset();
}
if (this->stateFlags == kStateSaveGame) {
- this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
+ this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
this->saveGame();
}
// 134:061e
@@ -149,7 +149,7 @@ void FoolGame::revealRun() {
if (this->var_i16_d0c != 0) {
this->revealSuccess();
}
- this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[19]);
+ this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
g_toolbox->KillPoly(this->arr_poly_192c0[i]);
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 7d000047e2e..35d7640be36 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -103,7 +103,7 @@ void FoolGame::sentenceRun() {
this->var_str_1070 = g_zbasic->index(1, 0);
} else {
// 135:049a
- this->var_i16_1372 = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
+ this->var_i16_1372 = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
this->var_str_1070 = g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
}
// 135:04f2
@@ -316,7 +316,7 @@ void FoolGame::sub_135_c1c() {
// 135:0cba
Common::String temp = this->var_str_1070.encode(Common::kMacRoman);
this->var_i16_1372 = (int16)temp.size();
- this->activePuzzleBuffer += g_zbasic->unk_88(this->var_i16_1372) + temp;
+ this->activePuzzleBuffer += g_zbasic->encodeInt(this->var_i16_1372) + temp;
}
void FoolGame::sub_135_cee() {
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index a1b0cd43ec0..1005203bb8a 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -32,7 +32,7 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// high priestess challenge
-void FoolGame::sub_140_004() {
+void FoolGame::highPriestessRun() {
// 140:0004
if (this->var_i16_c04 < 0x64) {
this->thothAdjustPuzzleData();
@@ -42,7 +42,7 @@ void FoolGame::sub_140_004() {
}
if (this->var_i16_c04 == 0) {
this->var_i16_e14 = 1;
- this->thothHighPriestess();
+ this->thoth99Enchantments();
this->var_i16_e14 = 0;
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
@@ -53,7 +53,7 @@ void FoolGame::sub_140_004() {
}
// 140:005c
if (this->var_i16_c04 == 1) {
- this->sub_140_12fc();
+ this->thothKey1st();
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
return;
@@ -64,13 +64,14 @@ void FoolGame::sub_140_004() {
g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
this->sub_140_2f92();
if (this->var_i16_c04 == 2) {
- this->thothBook();
+ this->thothKey2nd();
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
return;
}
this->var_i16_c04 = 3;
if (this->puzzleCompletionStatus[0x17] == 0x63) {
+ // is the humbug marked with the wadjet eye? if so, unmark
// 140:00ce
this->puzzleCompletionStatus[0x17] = 0x64;
this->var_str_384 = this->arr_str_195e8[0x17] + g_zbasic->str(301); // ' '
@@ -79,8 +80,13 @@ void FoolGame::sub_140_004() {
}
// 140:0116
if (this->var_i16_c04 == 3) {
- this->sub_140_18fa();
+ this->thothKey3rd();
+ if (this->var_i16_d0c == 0) {
+ return;
+ }
+ this->var_i16_c04 = 4;
if (this->puzzleCompletionStatus[0x3f] == 0x63) {
+ // is justice marked with the wadjet eye? if so, unmark
this->puzzleCompletionStatus[0x3f] = 0x64;
this->var_str_384 = this->arr_str_195e8[0x3f] + g_zbasic->str(302); // ' '
g_zbasic->menu(6, 0xf, 1, this->var_str_384);
@@ -88,14 +94,15 @@ void FoolGame::sub_140_004() {
}
// 140:019c
if (this->var_i16_c04 == 4) {
- this->var_i16_2324 = 6;
- this->sub_140_206a();
+ this->hermitPathStage = 6;
+ this->thothKeyLast();
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
return;
}
this->arr_i16_1d24[0x51] |= 0x5;
if (this->puzzleCompletionStatus[0x48] == 0x63) {
+ // is the hermit marked with the wadjet eye? if so, unmark
this->puzzleCompletionStatus[0x48] = 0x64;
this->var_str_384 = this->arr_str_195e8[0x48] + g_zbasic->str(303);
g_zbasic->menu(7, 8, 1, this->var_str_384);
@@ -103,6 +110,7 @@ void FoolGame::sub_140_004() {
}
// 140:024c
if (this->var_i16_7d2 == 0) {
+ // show the fake puzzle picture
g_toolbox->PenNormal();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
g_zbasic->picture(0, 0, this->arr_i32_192c0[0]);
@@ -111,7 +119,7 @@ void FoolGame::sub_140_004() {
}
// 140:02a2
if (this->var_i16_37a == 0) {
- g_toolbox->SetPort(this->var_i32_8);
+ g_toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
}
@@ -120,6 +128,7 @@ void FoolGame::sub_140_004() {
for (int16 i = 1; i <= 0x155; i++) {
g_zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
g_zbasic->put(g_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kPutCopy);
+ g_toolbox->Delay(0);
}
// 140:0328
if (this->var_i16_7d2 == 0) {
@@ -143,6 +152,9 @@ void FoolGame::sub_140_004() {
}
g_toolbox->MoveTo(this->var_i16_484 + 0x5f - g_zbasic->rndInt(0x32), i);
g_toolbox->LineTo(0x1a1 - this->var_i16_484 + g_zbasic->rndInt(0x32), i);
+ if (i % 2 == 0) {
+ g_toolbox->Delay(0);
+ }
}
// 140:03f0
g_zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
@@ -161,13 +173,13 @@ void FoolGame::sub_140_004() {
return;
}
-void FoolGame::thothHighPriestess() {
+void FoolGame::thoth99Enchantments() {
// 140:0458
this->sub_128_4da(0);
if (this->activePuzzleBuffer.empty()) { // was: str(307)
this->arr_i16_1eb8[0] = 0x63;
} else {
- this->arr_i16_1eb8[0] = g_zbasic->unk_310(this->activePuzzleBuffer);
+ this->arr_i16_1eb8[0] = g_zbasic->decodeInt(this->activePuzzleBuffer);
}
// 140:04a2
if (this->arr_i16_1eb8[0] < 1) {
@@ -296,7 +308,7 @@ void FoolGame::thothHighPriestess() {
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
- this->activePuzzleBuffer = g_zbasic->unk_88(this->arr_i16_1eb8[0]);
+ this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
}
// 140:09ee
}
@@ -433,7 +445,7 @@ void FoolGame::sub_140_f84() {
this->sub_140_3296();
}
-void FoolGame::sub_140_12fc() {
+void FoolGame::thothKey1st() {
// 140:12fc
this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
@@ -478,7 +490,7 @@ void FoolGame::sub_140_12fc() {
// 140:1484
}
-void FoolGame::thothBook() {
+void FoolGame::thothKey2nd() {
// 140:1486
if (this->activePuzzle != 0x34) {
this->thothAdjustPuzzleData();
@@ -542,7 +554,7 @@ void FoolGame::thothBook() {
g_toolbox->FillRect(this->thothRandomVRect(), this->arr_pat_58f4[2]);
break;
default:
- warning("thothBook: breaking out of switch statement");
+ warning("thothKey2nd: breaking out of switch statement");
break;
}
if (this->activePuzzle != 0x34) {
@@ -671,7 +683,7 @@ void FoolGame::sub_140_15fc() {
}
-void FoolGame::sub_140_18fa() {
+void FoolGame::thothKey3rd() {
// 140:18fa
if (this->activePuzzle != 0x34) {
this->thothAdjustPuzzleData();
@@ -713,7 +725,7 @@ void FoolGame::sub_140_18fa() {
// 140:1b98
while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
// 140:1ab8
- if (this->activePuzzle == 0x34) {
+ if (this->activePuzzle == 0x34) { // in high priestess, no hints
this->var_i16_232e++;
if (this->var_i16_232e < 1) {
this->var_i16_232e = 1;
@@ -735,10 +747,10 @@ void FoolGame::sub_140_18fa() {
g_toolbox->InvertRect(this->thothRandomVRect());
break;
default:
- warning("sub_140_18fa: broke out of switch");
+ warning("thothKey3rd: broke out of switch");
break;
}
- } else {
+ } else { // in justice, animate the grab bar
// 140:1b08
this->var_i16_232e++;
if (this->var_i16_232e < 1) {
@@ -752,7 +764,7 @@ void FoolGame::sub_140_18fa() {
// 140:1b66
this->getNextEvent(-1);
if (this->var_ev_46.what == 1) {
- this->sub_140_1bc4();
+ this->thothKey3rdOnClick();
}
// 140:1b7a
if (this->var_i16_103a == 4) {
@@ -765,11 +777,11 @@ void FoolGame::sub_140_18fa() {
// 140:1bc2
}
-void FoolGame::sub_140_1bc4() {
+void FoolGame::thothKey3rdOnClick() {
// 140:1bc4
this->var_i16_2332 = 1;
if (this->activePuzzle == 0x34) {
- if ((this->var_ev_46.where.x >= 0xf) && (this->var_ev_46.where.y >= 0x2d) && (this->var_ev_46.where.x <= 0x1f1) && (this->var_ev_46.where.x <= 0x147)) {
+ if ((this->var_ev_46.where.x >= 0xf) && (this->var_ev_46.where.y >= 0x2d) && (this->var_ev_46.where.x <= 0x1f1) && (this->var_ev_46.where.y <= 0x147)) {
this->var_i16_2332 = 0;
}
} else {
@@ -856,6 +868,7 @@ void FoolGame::sub_140_1f68() {
area.bottom = SCREEN_HEIGHT - i;
area.right = SCREEN_WIDTH - i;
g_toolbox->FrameRect(area);
+ g_toolbox->Delay(0);
}
// 140:2056
g_toolbox->PenNormal();
@@ -869,54 +882,58 @@ void FoolGame::sub_140_205e() {
g_toolbox->PenNormal();
}
-void FoolGame::sub_140_206a() {
+void FoolGame::thothKeyLast() {
// 140:206a
this->var_i16_d0c = 0;
this->stateFlags = kStateNull;
- this->sub_140_2998();
+ this->thothKeyLastSetup();
this->sub_140_2978();
this->copyScreen(1, this->arr_bmp_b3ec);
this->arr_i16_1eb8[1] = -1;
- this->var_i16_2324 = 0;
- this->var_i16_1de6 = this->arr_i16_3b38[this->var_i16_2324];
+ this->var_i16_1de6 = this->arr_i16_3b38[this->hermitPathStage];
+ warning("thothKeyLast: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1));
// JMP 0x228c
while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
// 140:20c2
do {
- if (this->activePuzzle == 0x34) {
- this->var_i16_2334 = this->arr_i16_3b38[this->var_i16_2324];
- this->var_i16_2336 = this->arr_i16_3b38[this->var_i16_2324 + 0x20];
+ if (this->activePuzzle != 0x34) { // we're in the hermit, print the shape
+ this->hermitPathStartIndex = this->arr_i16_3b38[this->hermitPathStage];
+ this->hermitPathEndIndex = this->arr_i16_3b38[this->hermitPathStage + 0x20];
do {
this->getNextEvent(-1);
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[this->var_i16_2334]], this->arr_pat_58f4[this->var_i16_2338]);
- this->var_i16_2334++;
- if (this->var_i16_2324 != 5) {
- g_toolbox->Delay(4);
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[this->hermitPathStartIndex]], this->arr_pat_58f4[this->var_i16_2338]);
+ this->hermitPathStartIndex++;
+ // we're updating the screen in the event handler, this has no effect
+ /*if (this->hermitPathStage == 5) {
+ if (this->hermitPathStartIndex % 4 == 0)
+ g_toolbox->Delay(0);
} else {
- g_toolbox->Delay(2);
- }
+ if (this->hermitPathStartIndex % 8 == 0)
+ g_toolbox->Delay(0);
+ }*/
// 140:2168
- } while ((this->var_ev_46.what == 1) || (this->var_i16_2334 > this->var_i16_2336) || ((this->stateFlags & kStateReturn) != 0));
+ } while (!((this->var_ev_46.what == 1) || (this->hermitPathStartIndex > this->hermitPathEndIndex) || ((this->stateFlags & kStateReturn) != 0)));
// 140:219e
if ((this->var_ev_46.what == 0) && ((this->stateFlags & kStateReturn) == 0)) {
- if (this->var_i16_2324 != 5) {
- g_toolbox->Delay(0x7d);
+ if (this->hermitPathStage != 5) {
+ g_toolbox->Delay(0x7d*60/1000);
} else {
- g_toolbox->Delay(0xfa);
+ g_toolbox->Delay(0xfa*60/1000);
}
}
// 140:21e8
this->copyScreen(1, this->arr_bmp_b3ec);
+ } else { // we're in the high priestess, show nothing but random filled squares
+ // 140:21fe
+ this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
+ this->var_i16_68a = g_zbasic->rndInt(0x14) - 1;
+ this->var_i16_68c = g_zbasic->rndInt(0xe) - 1;
+ // 140:2222
+ g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], this->arr_pat_58f4[this->var_i16_484]);
+ this->getNextEvent(-1);
}
- // 140:21fe
- this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
- this->var_i16_68a = g_zbasic->rndInt(0x14) - 1;
- this->var_i16_68c = g_zbasic->rndInt(0xe) - 1;
- // 140:2222
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], this->arr_pat_58f4[this->var_i16_484]);
- this->getNextEvent(-1);
if (this->var_ev_46.what == 1) {
- this->sub_140_22b8();
+ this->thothKeyLastOnClick();
}
if (this->stateFlags == kStateSaveGame) {
this->saveGame();
@@ -926,9 +943,9 @@ void FoolGame::sub_140_206a() {
}
}
-void FoolGame::sub_140_22b8() {
+void FoolGame::thothKeyLastOnClick() {
// 140:22b8
- while (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->var_i16_2324] + 1))) {
+ while (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1))) {
// 140:22bc
this->getNextEvent(-1); // was: 0
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -938,7 +955,7 @@ void FoolGame::sub_140_22b8() {
if (this->arr_i16_1eb8[0] != this->arr_i16_1eb8[1]) {
// 140:2372
if (this->arr_i16_1eb8[0] != this->arr_i16_3738[this->var_i16_1de6]) {
- this->sub_140_24ae();
+ this->thothBadSelect();
return;
}
// 140:23aa
@@ -946,19 +963,20 @@ void FoolGame::sub_140_22b8() {
this->sub_128_50e(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_1eb8[0]], this->arr_pat_58f4[2]);
this->var_i16_1de6++;
+ warning("thothKeyLastOnClick: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1));
}
}
// 140:2422
}
// 140:2472
- if (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->var_i16_2324] + 1)) {
- this->sub_140_24ae();
+ if (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1)) {
+ this->thothBadSelect();
} else {
- this->sub_140_25e4();
+ this->hermitNextStage();
}
}
-void FoolGame::sub_140_24ae() {
+void FoolGame::thothBadSelect() {
// 140:24ae
this->sub_128_50e(0x14, 0x64, 0x0);
while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
@@ -971,39 +989,39 @@ void FoolGame::sub_140_24ae() {
if (this->activePuzzle != 0x34) {
this->copyScreen(1, this->arr_bmp_b3ec);
} else {
- for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[this->var_i16_2324]; i--) {
+ for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[this->hermitPathStage]; i--) {
this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[i]], this->arr_pat_58f4[this->var_i16_484]);
}
}
// 140:25b4
this->arr_i16_1eb8[1] = -1;
- this->var_i16_1de6 = this->arr_i16_3b38[this->var_i16_2324];
+ this->var_i16_1de6 = this->arr_i16_3b38[this->hermitPathStage];
}
-void FoolGame::sub_140_25e4() {
+void FoolGame::hermitNextStage() {
// 140:25e4
if (this->activePuzzle == 0x34) {
this->var_i16_d0c = 1;
return;
}
// 140:25f6
- if (this->var_i16_2324 < 5) {
- this->sub_140_2662();
+ if (this->hermitPathStage < 5) {
+ this->hermitScreenFlash();
}
- if (this->var_i16_2324 == 4) {
- this->sub_140_26ca();
+ if (this->hermitPathStage == 4) {
+ this->hermitScreenZoom();
}
- if (this->var_i16_2324 == 5) {
- this->sub_140_28bc();
+ if (this->hermitPathStage == 5) {
+ this->hermitScreenBehold();
}
- if (this->var_i16_2324 == 6) {
+ if (this->hermitPathStage == 6) {
this->sub_140_2968();
}
if (this->var_i16_d0c == 0) {
- this->var_i16_2324++;
- if (this->var_i16_2324 == 6) {
- this->sub_140_2998();
+ this->hermitPathStage++;
+ if (this->hermitPathStage == 6) {
+ this->thothKeyLastSetup();
}
this->sub_140_2978();
this->copyScreen(1, this->arr_bmp_b3ec);
@@ -1011,7 +1029,7 @@ void FoolGame::sub_140_25e4() {
// 140:2660
}
-void FoolGame::sub_140_2662() {
+void FoolGame::hermitScreenFlash() {
// 140:2662
Common::Rect area(0x37, 0x29, 0x1c9, 0x142);
for (int16 i = 0; i <= 0x10; i++) {
@@ -1020,7 +1038,7 @@ void FoolGame::sub_140_2662() {
}
}
-void FoolGame::sub_140_26ca() {
+void FoolGame::hermitScreenZoom() {
// 140:26ca
this->sub_128_4da(0);
g_toolbox->PenSize(0xa, 0x7);
@@ -1047,10 +1065,11 @@ void FoolGame::sub_140_26ca() {
}
g_toolbox->PenNormal();
g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ this->var_i16_1de6 = 0;
this->sub_128_4da(1);
}
-void FoolGame::sub_140_28bc() {
+void FoolGame::hermitScreenBehold() {
// 140:28bc
if (this->puzzleCompletionStatus[0x68] > 4) {
this->sub_128_6186();
@@ -1076,16 +1095,16 @@ void FoolGame::sub_140_2968() {
void FoolGame::sub_140_2978() {
// 140:2978
this->sub_128_6186();
- if (this->var_i16_2324 < 6) {
+ if (this->hermitPathStage < 6) {
this->var_i16_2338 = 1;
} else {
this->var_i16_2338 = 2;
}
}
-void FoolGame::sub_140_2998() {
+void FoolGame::thothKeyLastSetup() {
// 140:2998
- if (this->var_i16_2324 != 6) {
+ if (this->hermitPathStage != 6) {
this->sub_128_271a();
this->arr_i16_1eb8[4] = 0x37;
this->arr_i16_1eb8[5] = 0x29;
@@ -1115,9 +1134,9 @@ void FoolGame::sub_140_2998() {
}
// 140:2b54
- } else {
+ } else { // last key of thoth
// 140:2b58
- if (this->activePuzzle != 0x34) {
+ if (this->activePuzzle != 0x34) { // in the hermit
this->thothAdjustPuzzleData();
}
// FIXME: some kind of manual bodge for the puzzle data loader,
@@ -1170,7 +1189,7 @@ void FoolGame::sub_140_2998() {
}
}
// 140:2d94
- if (this->var_i16_2324 != 6) {
+ if (this->hermitPathStage != 6) {
g_toolbox->PenPat(this->arr_pat_58f4[1]);
for (int16 j = 0; j <= 0x13; j++) {
for (int16 i = 0; i <= 0xd; i++) {
@@ -1198,7 +1217,7 @@ void FoolGame::sub_140_2998() {
}
}
// 140:2f2e
- if ((this->var_i16_2324 == 6) && (this->activePuzzle != 0x34)) {
+ if ((this->hermitPathStage == 6) && (this->activePuzzle != 0x34)) {
g_zbasic->menu(8, 0, 1, g_zbasic->str(324)); // the last key of thoth
g_zbasic->menu(8, 1, 1, g_zbasic->str(325)); // return to scroll
}
@@ -1254,7 +1273,7 @@ Common::Rect FoolGame::thothRandomVRect() {
void FoolGame::sub_140_3296() {
// 140:3296
if (this->var_i16_37a == 0) {
- g_toolbox->SetPort(this->var_i32_8);
+ g_toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 369c8a90b2c..a2b7a0636f9 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -72,9 +72,9 @@ void FoolGame::wordSearchRun() {
this->activePuzzleBuffer = g_zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
} else {
// 131:01f2
- this->arr_i16_4758[0] = g_zbasic->unk_310(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_198e + 1, 2));
+ this->arr_i16_4758[0] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_198e + 1, 2));
for (int i = 1; i <= this->arr_i16_4758[0]; i++) {
- this->arr_i16_4758[i] = g_zbasic->unk_310(g_zbasic->midStr(
+ this->arr_i16_4758[i] = g_zbasic->decodeInt(g_zbasic->midStr(
this->activePuzzleBuffer,
this->var_i16_198e + 1 + i*2,
2
@@ -364,7 +364,7 @@ void FoolGame::wordSearchStoreState() {
debugC(5, kDebugLoading, "wordSearchStoreState:");
for (int i = 0; i <= this->arr_i16_4758[0]; i++) {
debugCN(5, kDebugLoading, "%04x ", this->arr_i16_4758[i]);
- this->activePuzzleBuffer += g_zbasic->unk_88(this->arr_i16_4758[i]);
+ this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_4758[i]);
}
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index eb715d59d3a..5415aa16bd4 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -560,10 +560,18 @@ Common::U32String ZBasic::leftStr(const Common::U32String &str, int16 expression
return str.substr(0, expression);
}
+Common::String ZBasic::leftStr(const Common::String &str, int16 expression) {
+ return str.substr(0, expression);
+}
+
Common::U32String ZBasic::rightStr(const Common::U32String &str, int16 expression) {
return str.substr(str.size() - expression, expression);
}
+Common::String ZBasic::rightStr(const Common::String &str, int16 expression) {
+ return str.substr(str.size() - expression, expression);
+}
+
int16 ZBasic::rndInt(int16 max) {
if (max == 0)
return 0;
@@ -680,14 +688,11 @@ void ZBasic::writeFileDblInt(int16 fileNo, int32 data) {
_fileWriteStreams[fileNo]->writeSint32BE(data);
}
-Common::String ZBasic::unk_88(uint16 unk1) {
+Common::String ZBasic::encodeInt(uint16 data) {
// convert uint16 data into string bytes.
- // all of the toolbox APIs use U32String and convert when
- // necessary to MacRoman, and unfortunately that's what
- // we have to do there too.
Common::String inter;
- inter.push_back((char)(unk1 >> 8));
- inter.push_back((char)(unk1 & 0xff));
+ inter.push_back((char)(data >> 8));
+ inter.push_back((char)(data & 0xff));
return inter;
}
@@ -699,14 +704,14 @@ void ZBasic::unk_158() {
warning("STUB: ZBasic::unk_158");
}
-uint16 ZBasic::unk_310(const Common::String &unk1) {
+uint16 ZBasic::decodeInt(const Common::String &data) {
uint16 result = 0;
- if (unk1.size() == 0)
+ if (data.size() == 0)
return result;
- result |= (byte)(unk1[0]) << 8;
- if (unk1.size() == 1)
+ result |= (byte)(data[0]) << 8;
+ if (data.size() == 1)
return result;
- result |= (byte)(unk1[1]);
+ result |= (byte)(data[1]);
return result;
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index dd35895e4b8..9e1d4d4a2b7 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -254,7 +254,9 @@ public:
uint32 mem(int16 index);
void menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title);
Common::U32String leftStr(const Common::U32String &str, int16 expression);
+ Common::String leftStr(const Common::String &str, int16 expression);
Common::U32String rightStr(const Common::U32String &str, int16 expression);
+ Common::String rightStr(const Common::String &str, int16 expression);
Common::U32String midStr(const Common::U32String &str, int16 expr1, int16 expr2);
void midStrSet(Common::U32String &target, int16 expr1, int16 expr2, const Common::U32String &src);
Common::String midStr(const Common::String &str, int16 expr1, int16 expr2);
@@ -296,11 +298,11 @@ public:
void unk_20();
bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
void unk_44(int16 unk1);
- Common::String unk_88(uint16 unk1);
+ Common::String encodeInt(uint16 data);
void stringCopy(Common::U32String &dest, const Common::U32String &src);
void unk_130(int16 unk1);
void unk_158();
- uint16 unk_310(const Common::String &unk1);
+ uint16 decodeInt(const Common::String &data);
void unk_331(uint16 unk1, int16 unk2);
void unk_333(uint16 unk1);
void indexSet(const Common::U32String &value, int16 table, int16 index);
Commit: 18d321dd0ebede632f8ef171d92b7f6dff25352a
https://github.com/scummvm/scummvm/commit/18d321dd0ebede632f8ef171d92b7f6dff25352a
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:20+02:00
Commit Message:
FOOL: Fix checkbox next to completed thoth puzzles
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index dd3fa4328d1..d32bfcc37ca 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -164,14 +164,14 @@ void FoolGame::sub_128_004() {
if (this->var_ev_46.what == kMouseDown) {
this->sub_128_1f76();
}
- if ((this->var_i16_7d0 == 0x10) &&
+ if ((this->storyCurrentChapter == 0x10) &&
(this->puzzleCompletionStatus[0x10] < 0x64) &&
(this->var_ev_46.where.y > 0x113) &&
(this->var_ev_46.where.x < 0x8c)) {
- this->setStateBits(0x80);
+ this->setStateBits(kStatePuzzleSelect);
}
// 128:1de0
- if (this->var_i16_7d2 && (this->keyLastPressed == 0x20)) {
+ if (this->sunMapRestored && (this->keyLastPressed == 0x20)) {
this->setStateBits(0x100);
}
// 128:1e06
@@ -195,8 +195,8 @@ void FoolGame::sub_128_004() {
if (this->stateFlags & 0x200) {
this->sub_128_1f44();
}
- if (this->stateFlags & 0x80) {
- this->sub_128_39a0();
+ if (this->stateFlags & kStatePuzzleSelect) {
+ this->puzzleRun();
}
if (this->stateFlags & 0x100) {
this->sub_138_004();
@@ -399,7 +399,7 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
this->var_i16_34 = wait;
this->var_i16_32 = duration;
this->var_i16_30 = freq;
- if (this->var_i16_378 == 1) {
+ if (this->soundEnabled == 1) {
g_zbasic->sound(this->var_i16_30, this->var_i16_32, 0x96, 0);
if (this->var_i16_34 == 1) {
while (g_zbasic->unk_5()) {
@@ -817,18 +817,19 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
- // behold the first key of thoth animation
+ // behold the Nth key of thoth animation
this->var_i16_32 = unk1;
this->var_i16_30 = unk2;
if (this->var_i16_30 > 0) {
- if ((this->arr_i16_1d24[this->var_i16_30] & 2) == 0) {
- this->arr_i16_1d24[this->var_i16_30] ^= 0x2;
- this->arr_i16_1d24[this->var_i16_30] |= 0x1;
+ if ((this->puzzleFlags[this->var_i16_30] & kFlagMenuDiamond)) {
+ this->puzzleFlags[this->var_i16_30] ^= kFlagMenuDiamond;
+ this->puzzleFlags[this->var_i16_30] |= kFlagMenuEnabled;
}
// 128:1818
this->var_i16_34 = 3 + ((this->var_i16_30 - 1) / 0x10);
this->var_i16_36 = 1 + ((this->var_i16_30 - 1) % 0x10);
this->var_str_172 = this->arr_str_195e8[this->var_i16_30] + g_zbasic->str(9);
+ // add the wadjet eye next to the chapter name
g_zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
}
// 128:188a
@@ -900,17 +901,15 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
g_toolbox->PenNormal();
}
-void FoolGame::setStateBits(int16 unk1) {
+void FoolGame::setStateBits(uint16 bits) {
// 128:1c2c
- this->var_i16_30 = unk1;
- this->stateFlags |= this->var_i16_30;
+ this->stateFlags |= bits;
}
-void FoolGame::clearStateBits(int16 unk1) {
+void FoolGame::clearStateBits(uint16 bits) {
// 128:1c4a
- this->var_i16_30 = unk1;
- if (this->stateFlags & this->var_i16_30) {
- this->stateFlags ^= this->var_i16_30;
+ if (this->stateFlags & bits) {
+ this->stateFlags ^= bits;
}
// 128:1c78
}
@@ -955,7 +954,7 @@ void FoolGame::sub_128_1f76() {
} while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
} else {
// 128:1fee
- if ((this->var_i16_7d0 == 0x10) && (this->puzzleCompletionStatus[0x10] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
+ if ((this->storyCurrentChapter == 0x10) && (this->puzzleCompletionStatus[0x10] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
return;
}
// 128:2042
@@ -1008,10 +1007,10 @@ void FoolGame::menuChapterSelect() {
// 128:2160
}
// 128:2170
- this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
+ this->storyCurrentChapter = this->pageToChapter[this->storyNextPage];
if (this->var_i16_7ce & 4) {
this->var_i16_7ce ^= 4;
- if (this->arr_i16_18b2[this->var_i16_7d0] > 0) {
+ if (this->puzzleType[this->storyCurrentChapter] > 0) {
// 128:21bc
this->sub_128_21c8();
return;
@@ -1023,10 +1022,10 @@ void FoolGame::menuChapterSelect() {
void FoolGame::sub_128_21c8() {
// 128:21c8
- if ((this->var_i16_7d0 == 1) && (this->var_i16_7d2 > 0)) {
+ if ((this->storyCurrentChapter == 1) && (this->sunMapRestored > 0)) {
this->setStateBits(0x100);
} else {
- this->setStateBits(0x80);
+ this->setStateBits(kStatePuzzleSelect);
}
}
@@ -1047,7 +1046,7 @@ void FoolGame::storyRenderPage() {
// 128:22da
// erase lower controls on scroll
this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
- this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
+ this->storyCurrentChapter = this->pageToChapter[this->storyNextPage];
// if we've solved a puzzle, fill the scroll with crazy patterns
if ((this->var_i16_7ce & 0x8) != 0) {
this->var_i16_7ce ^= 0x8;
@@ -1055,13 +1054,13 @@ void FoolGame::storyRenderPage() {
this->sub_128_bde(1, 0, 0, 0, 0, 0);
}
// 128:235e
- if (this->arr_i16_18b2[this->var_i16_7d0] > 0) {
+ if (this->puzzleType[this->storyCurrentChapter] > 0) {
this->var_str_384 = g_zbasic->str(10); // ?
- if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x63) {
+ if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x63) {
this->var_str_384 = g_zbasic->str(11); // ~
}
// 128:23b8
- if (this->puzzleCompletionStatus[this->var_i16_7d0] >= 0x64) {
+ if (this->puzzleCompletionStatus[this->storyCurrentChapter] >= 0x64) {
this->var_str_384 = g_zbasic->str(12); // *
}
// 128:23e8
@@ -1070,13 +1069,13 @@ void FoolGame::storyRenderPage() {
this->var_i16_7d6 = 1;
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x8a, 0x133);
- g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
+ g_toolbox->DrawString(this->arr_str_195e8[this->storyCurrentChapter]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x70, 0x133);
- g_toolbox->DrawString(this->arr_str_195e8[this->var_i16_7d0]);
+ g_toolbox->DrawString(this->arr_str_195e8[this->storyCurrentChapter]);
}
// 128:2468
if (this->arr_str_1a288[this->storyNextPage] != g_zbasic->str(13)) { // blank
@@ -1168,7 +1167,7 @@ void FoolGame::sub_128_271a() {
// new game
void FoolGame::menuNewGame() {
// 128:27d6
- this->sub_128_32fa();
+ this->savePrompt();
if (this->var_i16_7be == 3)
return;
if (this->var_i16_7ce & 1) {
@@ -1230,7 +1229,7 @@ void FoolGame::menuOpenGame() {
if (this->var_str_588 == g_zbasic->str(23)) {
return;
}
- this->sub_128_32fa();
+ this->savePrompt();
// 128:29d4
if (this->var_i16_7be != 3) {
if ((this->var_i16_7ce & 1) != 0) {
@@ -1279,7 +1278,7 @@ void FoolGame::menuSaveGameAs() {
// quit
void FoolGame::menuQuit() {
// 128:2ab6
- this->sub_128_32fa();
+ this->savePrompt();
if (this->var_i16_7be == 3) {
return;
}
@@ -1310,6 +1309,7 @@ void FoolGame::sub_128_2b0a() {
}
void FoolGame::newGame() {
+ // 128:2bc6
this->clearStateBits(kStateNewGame);
this->sub_128_3774();
this->sub_128_3744();
@@ -1349,7 +1349,7 @@ void FoolGame::newGame() {
this->var_i16_7e4 = g_zbasic->rndInt(0x51);
g_zbasic->swapInt(this->sunMapTileID[this->var_i16_484], this->sunMapTileID[this->var_i16_7e4]);
this->puzzleCompletionStatus[i] = 0;
- this->arr_i16_1d24[i] = 0;
+ this->puzzleFlags[i] = kFlagMenuDisabled;
}
// 128:2d6a
this->var_i16_484 = 0;
@@ -1358,13 +1358,13 @@ void FoolGame::newGame() {
// 128:2d9c
this->var_i16_484++;
if (this->pageVisible[i] == 1) {
- if (this->arr_i16_197c[this->var_i16_484] != 0) {
- this->var_i16_9f2 = 2;
+ if (this->puzzleUnlockChapter[this->var_i16_484] != 0) {
+ this->var_i16_9f2 = kFlagMenuDiamond;
} else {
- this->var_i16_9f2 = 1;
+ this->var_i16_9f2 = kFlagMenuEnabled;
}
// 128:2de2
- this->arr_i16_1d24[this->var_i16_484] = this->var_i16_9f2 + 4;
+ this->puzzleFlags[this->var_i16_484] = this->var_i16_9f2 + 4;
}
// 128:2e02
}
@@ -1375,7 +1375,7 @@ void FoolGame::newGame() {
this->storyNextPage = 1;
this->var_i16_7ce = 0;
this->activePuzzle = 0;
- this->var_i16_7d2 = 0;
+ this->sunMapRestored = 0;
this->var_i16_7b2 = 0;
this->sub_128_3032();
// 128:2e3c
@@ -1400,16 +1400,16 @@ void FoolGame::openGame() {
this->storyNextPage = g_zbasic->readFileInt(2);
this->activePuzzle = g_zbasic->readFileInt(2);
this->var_i16_7ce = g_zbasic->readFileInt(2);
- this->var_i16_7d2 = g_zbasic->readFileInt(2);
+ this->sunMapRestored = g_zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
- this->arr_i16_1d24[i] = g_zbasic->readFileInt(2);
+ this->puzzleFlags[i] = g_zbasic->readFileInt(2);
this->puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
this->pageVisible[i] = g_zbasic->readFileInt(2);
- this->var_i16_484 = g_zbasic->readFileInt(2);
- debugC(5, kDebugLoading, "openGame: puzzle %d:, arr_i16_1d24: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, this->arr_i16_1d24[i], this->puzzleCompletionStatus[i], this->pageVisible[i], this->var_i16_484);
- Common::String state = g_zbasic->readFileStr(2, this->var_i16_484);
+ int16 payloadSize = g_zbasic->readFileInt(2);
+ debugC(5, kDebugLoading, "openGame: puzzle %d:, puzzleFlags: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, this->puzzleFlags[i], this->puzzleCompletionStatus[i], this->pageVisible[i], payloadSize);
+ Common::String state = g_zbasic->readFileStr(2, payloadSize);
if (debugChannelSet(5, kDebugLoading)) {
- Common::hexdump((const byte *)state.c_str(), this->var_i16_484);
+ Common::hexdump((const byte *)state.c_str(), payloadSize);
}
g_zbasic->indexRawSet(state, 2, i);
}
@@ -1439,7 +1439,7 @@ void FoolGame::openGame() {
}
void FoolGame::sub_128_3032() {
- this->var_i16_7d0 = 0;
+ this->storyCurrentChapter = 0;
this->stateFlags = 0;
this->var_i16_484 = 0;
this->var_i16_68c = 3;
@@ -1449,12 +1449,12 @@ void FoolGame::sub_128_3032() {
g_zbasic->menu(j, 0, 1, this->var_str_384);
for (int i = 1; i <= 0x10; i++) {
this->var_i16_484++;
- this->var_i16_9f2 = this->arr_i16_1d24[this->var_i16_484] & 3;
+ this->var_i16_9f2 = this->puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
if (this->puzzleCompletionStatus[this->var_i16_484] == 0x63) {
- this->var_str_384 = g_zbasic->str(39);
+ this->var_str_384 = g_zbasic->str(39); // " ~ "
} else {
// 128:30e4
- this->var_str_384 = g_zbasic->str(40);
+ this->var_str_384 = g_zbasic->str(40); // " "
}
// 128:30f8
this->var_str_9f4 = this->arr_str_195e8[this->var_i16_484] + this->var_str_384;
@@ -1485,17 +1485,17 @@ void FoolGame::sub_128_3032() {
this->storyCurrentPage = 1;
this->storyRenderPage();
if ((this->var_i16_7ce & 1) == 0) {
- this->sub_128_378a();
+ this->cursorExplodingWatch();
} else {
if ((this->activePuzzle > 0) && (this->activePuzzle <= 0x50)) {
- this->setStateBits(0x80);
+ this->setStateBits(kStatePuzzleSelect);
} else {
this->setStateBits(0x100);
}
}
// 128:3294
this->sub_128_32c8();
- if (this->var_i16_7d2 == 0) {
+ if (this->sunMapRestored == 0) {
g_zbasic->menu(2, 7, 0, Common::U32String());
} else {
g_zbasic->menu(2, 7, 1, Common::U32String());
@@ -1503,14 +1503,14 @@ void FoolGame::sub_128_3032() {
}
void FoolGame::sub_128_32c8() {
- if (this->var_i16_378 == 0) {
+ if (this->soundEnabled == 0) {
g_zbasic->menu(2, 6, 1, Common::U32String());
} else {
g_zbasic->menu(2, 6, 0x86, Common::U32String());
}
}
-void FoolGame::sub_128_32fa() {
+void FoolGame::savePrompt() {
// 128:32fa
if (this->var_i16_7ce == 0x29a) {
return;
@@ -1551,7 +1551,7 @@ void FoolGame::saveGame() {
}
// 128:3580
if ((this->var_i16_7ce & 1) != 0) {
- this->sub_128_41aa();
+ this->puzzleSaveContext();
}
// 128:3594
do {
@@ -1569,9 +1569,9 @@ void FoolGame::saveGame() {
g_zbasic->writeFileInt(2, this->storyNextPage);
g_zbasic->writeFileInt(2, this->activePuzzle);
g_zbasic->writeFileInt(2, this->var_i16_7ce);
- g_zbasic->writeFileInt(2, this->var_i16_7d2);
+ g_zbasic->writeFileInt(2, this->sunMapRestored);
for (int i = 1; i <= 0x64; i++) {
- g_zbasic->writeFileInt(2, this->arr_i16_1d24[i]);
+ g_zbasic->writeFileInt(2, this->puzzleFlags[i]);
g_zbasic->writeFileInt(2, this->puzzleCompletionStatus[i]);
g_zbasic->writeFileInt(2, this->pageVisible[i]);
Common::String state = g_zbasic->indexRaw(2, i);
@@ -1623,8 +1623,7 @@ void FoolGame::sub_128_3774() {
this->var_i16_7b2 = 0xa;
}
-// exploding watch cursor
-void FoolGame::sub_128_378a() {
+void FoolGame::cursorExplodingWatch() {
// 128:378a
for (int j = 0; j <= 1; j++) {
for (int i = 3; i <= 6; i++) {
@@ -1658,30 +1657,30 @@ void FoolGame::sub_128_388a() {
warning("STUB: %s", __func__);
}
-void FoolGame::sub_128_39a0() {
+void FoolGame::puzzleRun() {
// 128:39a0
this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
this->stateFlags = 0;
this->var_i16_c00 = 0;
this->var_i16_7d6 = 0;
this->var_i16_7b2 = 0xa;
- this->activePuzzle = this->var_i16_7d0;
+ this->activePuzzle = this->storyCurrentChapter;
this->var_i16_7ce |= 1;
g_toolbox->InitCursor();
this->copyScreen(0, this->arr_bmp_5dfc);
// 128:39fa
- if (this->arr_i16_15e8[this->var_i16_7d0] > 0) {
+ if (this->arr_i16_15e8[this->storyCurrentChapter] > 0) {
this->sub_128_41d8();
}
// 128:3a12
this->sub_128_3fb6();
this->sub_128_26f6();
this->sub_128_61ec();
- this->sub_128_4168();
+ this->puzzleLoadContext();
// 128:3a22
// 128:3a38: JSR - "ZBASIC_115"
- debugC(5, kDebugLoading, "sub_128_39a0: chapter 0x%x, puzzle module %d", this->var_i16_7d0, this->arr_i16_18b2[this->var_i16_7d0]-1);
- switch (this->arr_i16_18b2[this->var_i16_7d0]-1) {
+ debugC(5, kDebugLoading, "puzzleRun: chapter 0x%x, puzzle module %d", this->storyCurrentChapter, this->puzzleType[this->storyCurrentChapter]-1);
+ switch (this->puzzleType[this->storyCurrentChapter]-1) {
case 0:
case 1:
case 2:
@@ -1739,12 +1738,12 @@ void FoolGame::sub_128_39a0() {
}
// 128:3a8a
this->sub_128_5fea();
- if (this->var_i16_7d2 == 1) {
+ if (this->sunMapRestored == 1) {
this->setStateBits(0x100);
return;
}
// 128:3aa4
- this->sub_128_41aa();
+ this->puzzleSaveContext();
if ((this->stateFlags & kStateQuit) == 0) {
g_toolbox->PenNormal();
this->copyScreen(1, this->arr_bmp_5dfc);
@@ -1755,21 +1754,21 @@ void FoolGame::sub_128_39a0() {
}
// 128:3aea
g_zbasic->unk_333(1);
- if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x63) {
- this->sub_128_3de6();
+ if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x63) {
+ this->storyUnlockChapter();
}
- if (this->puzzleCompletionStatus[this->var_i16_7d0] == 0x64) {
+ if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x64) {
// bodge for completing The Chariot
- if (this->var_i16_7d0 == 0x41) {
- if ((this->arr_i16_1d24[0x41] & 2) != 0) {
- this->arr_i16_1d24[0x41] ^= 2;
- this->arr_i16_1d24[0x41] |= 1;
+ if (this->storyCurrentChapter == 0x41) {
+ if ((this->puzzleFlags[0x41] & kFlagMenuDiamond) != 0) {
+ this->puzzleFlags[0x41] ^= kFlagMenuDiamond;
+ this->puzzleFlags[0x41] |= kFlagMenuEnabled;
}
// 128:3b9e
for (int i = 1; i <= 5; i++) {
g_zbasic->menu(7, i, 1, Common::U32String());
if (i > 1) {
- this->arr_i16_1d24[0x40 + i] |= 0x5;
+ this->puzzleFlags[0x40 + i] |= 0x5;
}
}
// 128:3c04
@@ -1794,15 +1793,15 @@ void FoolGame::sub_128_39a0() {
this->var_i16_7ce |= 8;
} else {
// 128:3cc0
- if ((this->arr_i16_1d24[this->var_i16_7d0] & 2) != 0) {
- this->arr_i16_1d24[this->var_i16_7d0] ^= 2;
- this->arr_i16_1d24[this->var_i16_7d0] |= 1;
+ if ((this->puzzleFlags[this->storyCurrentChapter] & 2) != 0) {
+ this->puzzleFlags[this->storyCurrentChapter] ^= 2;
+ this->puzzleFlags[this->storyCurrentChapter] |= 1;
}
// 128:3d3a
- this->var_i16_484 = 3 + ((this->var_i16_7d0 - 1) / 0x10);
- this->var_i16_7e4 = 1 + ((this->var_i16_7d0 - 1) % 0x10);
+ this->var_i16_484 = 3 + ((this->storyCurrentChapter - 1) / 0x10);
+ this->var_i16_7e4 = 1 + ((this->storyCurrentChapter - 1) % 0x10);
g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
- this->sub_128_3de6();
+ this->storyUnlockChapter();
}
}
// 128:3d82
@@ -1822,38 +1821,39 @@ void FoolGame::sub_128_39a0() {
// 128:3de4
}
-void FoolGame::sub_128_3de6() {
+void FoolGame::storyUnlockChapter() {
// 128:3de6
- if ((this->arr_i16_197c[this->var_i16_7d0] > 0) && ((this->arr_i16_1d24[this->arr_i16_197c[this->var_i16_7d0]] & 3) == 0)) {
+ if ((this->puzzleUnlockChapter[this->storyCurrentChapter] > 0) &&
+ ((this->puzzleFlags[this->puzzleUnlockChapter[this->storyCurrentChapter]] & 3) == 0)) {
this->storyNextPage = 0;
this->var_i16_7ce |= 8;
for (int i = 1; i <= this->storyPageCount; i++ ) {
// 128:3e56
- if (this->pageToChapter[i] == this->arr_i16_197c[this->var_i16_7d0]) {
+ if (this->pageToChapter[i] == this->puzzleUnlockChapter[this->storyCurrentChapter]) {
this->pageVisible[i] = 1;
if (this->storyNextPage == 0) {
this->storyNextPage = i;
}
}
// 128:3ea6
- if (this->pageToChapter[i] - this->arr_i16_197c[this->var_i16_7d0] > 0) {
+ if (this->pageToChapter[i] > this->puzzleUnlockChapter[this->storyCurrentChapter]) {
i = this->storyPageCount;
}
// 128:3eda
}
// 128:3eec
- this->var_i16_7d0 = this->pageToChapter[this->storyNextPage];
- this->var_i16_484 = 3 + ((this->var_i16_7d0 - 1) / 0x10);
- this->var_i16_7e4 = 1 + ((this->var_i16_7d0 - 1) % 0x10);
- if (this->arr_i16_197c[this->var_i16_7d0] == 0) {
+ this->storyCurrentChapter = this->pageToChapter[this->storyNextPage];
+ int16 menuNo = 3 + ((this->storyCurrentChapter - 1) / 0x10);
+ int16 itemNo = 1 + ((this->storyCurrentChapter - 1) % 0x10);
+ if (this->puzzleUnlockChapter[this->storyCurrentChapter] == 0) {
this->var_i16_9f2 = 1;
- this->puzzleCompletionStatus[this->var_i16_7d0] = 0x64;
+ this->puzzleCompletionStatus[this->storyCurrentChapter] = 0x64;
} else {
// 128:3f66
this->var_i16_9f2 = 2;
}
- this->arr_i16_1d24[this->var_i16_7d0] |= (this->var_i16_9f2 + 4);
- g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, this->var_i16_9f2, Common::U32String());
+ this->puzzleFlags[this->storyCurrentChapter] |= (this->var_i16_9f2 + 4);
+ g_zbasic->menu(menuNo, itemNo, this->var_i16_9f2, Common::U32String());
}
// 128:3fb4
}
@@ -1871,11 +1871,11 @@ void FoolGame::sub_128_3fb6() {
}
g_zbasic->menu(8, 1, 1, this->var_str_384);
// 128:4056
- if (this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2] <= this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2 + 1]) {
+ if (this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2] <= this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2 + 1]) {
g_zbasic->menu(8, 2, 0, g_zbasic->str(75)); // line
// 128:40c6
this->var_i16_484 = 2;
- for (int i = this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2]; i <= this->arr_i16_1b10[this->arr_i16_18b2[this->activePuzzle]*2 + 1]; i++) {
+ for (int i = this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2]; i <= this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2 + 1]; i++) {
// 128:40f6
this->var_i16_484++;
this->var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(76);
@@ -1885,7 +1885,7 @@ void FoolGame::sub_128_3fb6() {
// 128:4166
}
-void FoolGame::sub_128_4168() {
+void FoolGame::puzzleLoadContext() {
// 128:4168
this->var_i16_c04 = this->puzzleCompletionStatus[this->activePuzzle];
if (this->var_i16_c04 == 0x64) {
@@ -1894,18 +1894,18 @@ void FoolGame::sub_128_4168() {
this->activePuzzleBuffer = g_zbasic->indexRaw(2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = this->activePuzzleBuffer;
- debugC(5, kDebugLoading, "sub_128_4168: loading puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
+ debugC(5, kDebugLoading, "puzzleLoadContext: loading puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
-void FoolGame::sub_128_41aa() {
+void FoolGame::puzzleSaveContext() {
// 128:41aa
this->puzzleCompletionStatus[this->activePuzzle] = this->var_i16_c04;
g_zbasic->indexRawSet(this->activePuzzleBuffer, 2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = this->activePuzzleBuffer;
- debugC(5, kDebugLoading, "sub_128_41aa: saving puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
+ debugC(5, kDebugLoading, "puzzleSaveContext: saving puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
@@ -1931,7 +1931,7 @@ void FoolGame::sub_128_41d8() {
}
// 128:42f0
if (this->puzzleCompletionStatus[0x34] >= 4) {
- if (this->var_i16_7d2 == 0) {
+ if (this->sunMapRestored == 0) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 0x47;
this->arr_i16_4758[2] = 0;
@@ -2073,7 +2073,7 @@ void FoolGame::sub_128_4472() {
}
// about screen
-void FoolGame::sub_128_4a92() {
+void FoolGame::menuAbout() {
// 128:4a92
if (this->var_str_8ec == g_zbasic->str(77)) {
// untitled game in progress
@@ -2084,12 +2084,12 @@ void FoolGame::sub_128_4a92() {
}
// 128:4b28
this->arr_str_1a8d8[1] = g_zbasic->str(81);
- if (this->var_i16_7d2 == 0) {
+ if (this->sunMapRestored == 0) {
this->var_i16_68c = 0x51;
this->var_i16_68a = 1;
for (int i = 1; i <= 0x51; i++) {
- if ((this->arr_i16_1d24[i] & 3) != 0) {
+ if ((this->puzzleFlags[i] & 3) != 0) {
this->var_i16_68c--;
}
}
@@ -2109,7 +2109,7 @@ void FoolGame::sub_128_4a92() {
this->var_i16_68c = 0;
for (int i = 2; i <= 0x50; i++) {
this->var_i16_68a = 2;
- if ((this->puzzleCompletionStatus[i] < 0x63) && (this->arr_i16_18b2[i] > 0)) {
+ if ((this->puzzleCompletionStatus[i] < 0x63) && (this->puzzleType[i] > 0)) {
this->var_i16_68c++;
}
}
@@ -2495,7 +2495,7 @@ void FoolGame::sub_128_5baa() {
void FoolGame::sub_128_5c20() {
this->stateFlags = 0;
if (this->selectedMenuID == 1) { // Eye menu
- this->sub_128_4a92();
+ this->menuAbout();
}
if (this->selectedMenuID == 2) { // File menu
if (this->selectedMenuItem == 1) {
@@ -2509,10 +2509,10 @@ void FoolGame::sub_128_5c20() {
} else if (this->selectedMenuItem == 4) {
this->menuSaveGameAs();
} else if (this->selectedMenuItem == 6) {
- if (this->var_i16_378 == 0) {
- this->var_i16_378 = 1;
+ if (this->soundEnabled == 0) {
+ this->soundEnabled = 1;
} else {
- this->var_i16_378 = 0;
+ this->soundEnabled = 0;
}
// 128:5cbc
this->sub_128_32c8();
@@ -2544,7 +2544,7 @@ void FoolGame::sub_128_5c20() {
} while (this->var_ev_46.what != kNullEvent);
}
// 128:5dae
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->storyCurrentChapter != this->selectedMenuChapter)) {
this->setStateBits(kStateChapterSelect);
}
// 128:5df6
@@ -2557,7 +2557,7 @@ void FoolGame::sub_128_5c20() {
this->setStateBits(kStateChapterSelect | kStateReturn);
}
// 128:5e5e
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->var_i16_7d0 != this->selectedMenuChapter)) {
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->storyCurrentChapter != this->selectedMenuChapter)) {
this->setStateBits(kStateChapterSelect | kStateReturn);
this->var_i16_7ce |= 0x4;
}
@@ -2726,7 +2726,7 @@ void FoolGame::sub_129_004() {
void FoolGame::sub_129_068() {
this->var_i16_7ce = 0x29a;
this->var_i16_372 = { 0, 0, 0 };
- this->var_i16_378 = 1;
+ this->soundEnabled = 1;
this->var_i16_7a0 = 1;
this->sub_128_4da(0);
for (size_t i = 0; i <= 3; i++) {
@@ -3017,9 +3017,9 @@ void FoolGame::sub_129_068() {
this->var_i16_103a = this->puzzlesReadShort();
// story menu entries + endgame puzzles
for (int i = 1; i <= this->var_i16_103a; i++) {
- this->arr_i16_18b2[i] = this->puzzlesReadShort();
+ this->puzzleType[i] = this->puzzlesReadShort();
this->arr_i16_15e8[i] = this->puzzlesReadShort();
- this->arr_i16_197c[i] = this->puzzlesReadShort();
+ this->puzzleUnlockChapter[i] = this->puzzlesReadShort();
this->arr_str_195e8[i] = this->puzzlesReadString().decode(Common::kMacRoman);
}
// 129:0c0a
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 71535bdff70..f1ccb4108ce 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -39,6 +39,14 @@ enum FoolStateBits : uint16 {
kStateOpenGame = 0x10,
kStateQuit = 0x20,
kStateChapterSelect = 0x40,
+ kStatePuzzleSelect = 0x80,
+};
+
+enum FoolPuzzleFlags : uint16 {
+ kFlagMenuDisabled = 0x00,
+ kFlagMenuEnabled = 0x01,
+ kFlagMenuDiamond = 0x02,
+ kFlagMapTile = 0x08,
};
class FoolGame {
@@ -76,8 +84,8 @@ public:
void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void sub_128_178a(int16 unk2, int16 unk1);
- void setStateBits(int16 unk1); // sub_128_1c2c
- void clearStateBits(int16 unk1); // sub_128_1c4a
+ void setStateBits(uint16 bits); // sub_128_1c2c
+ void clearStateBits(uint16 bits); // sub_128_1c4a
void sub_128_1ef8();
void sub_128_1f1e();
void sub_128_1f44();
@@ -104,22 +112,22 @@ public:
void sub_128_3032();
void sub_128_32c8();
- void sub_128_32fa();
+ void savePrompt(); // sub_128_32fa
void saveGame(); // sub_128_3536
void sub_128_3744();
void sub_128_3774();
- void sub_128_378a();
+ void cursorExplodingWatch(); // sub_128_378a
void sub_128_37ce();
void sub_128_388a();
- void sub_128_39a0();
- void sub_128_3de6();
+ void puzzleRun(); // sub_128_39a0
+ void storyUnlockChapter(); // sub_128_3de6
void sub_128_3fb6();
- void sub_128_4168();
- void sub_128_41aa();
+ void puzzleLoadContext(); // sub_128_4168
+ void puzzleSaveContext(); // sub_128_41aa
void sub_128_41d8();
void sub_128_4472();
- void sub_128_4a92();
+ void menuAbout(); // sub_128_4a92
void shipsRun(); // sub_128_5140
void sub_128_55ac();
@@ -137,7 +145,7 @@ public:
void sub_128_6154();
void sub_128_6186();
void sub_128_61c2();
- void sub_128_61ec();
+ void sub_128_61ec(); // sub_128_61ec
void sub_128_6244();
void sub_129_004();
@@ -352,7 +360,7 @@ private:
Common::U32String var_str_172;
Common::U32String var_str_272;
RGBColor var_i16_372;
- int16 var_i16_378;
+ int16 soundEnabled; // var_i16_378
int16 var_i16_37a;
uint32 var_i32_37c;
Common::U32String var_str_384;
@@ -392,8 +400,8 @@ private:
uint32 var_i32_7c8;
int16 var_i16_7cc;
int16 var_i16_7ce;
- int16 var_i16_7d0;
- int16 var_i16_7d2;
+ int16 storyCurrentChapter; // var_i16_7d0
+ int16 sunMapRestored; // var_i16_7d2
int16 storyCurrentPage; // var_i16_7d4
int16 var_i16_7d6;
int16 storyNextPage; // var_i16_7d8
@@ -566,13 +574,13 @@ private:
int16 pageLineBreak[1301]; // arr_i16_bbe
int16 arr_i16_15e8[101];
int16 arr_i16_16b2[0x100];
- int16 arr_i16_18b2[101];
- int16 arr_i16_197c[101];
+ int16 puzzleType[101]; // arr_i16_18b2
+ int16 puzzleUnlockChapter[101]; // arr_i16_197c
int16 pageToChapter[101]; // arr_i16_1a46
int16 arr_i16_1b10[6969];
int16 pageVisible[101]; // arr_i16_1b90
int16 puzzleCompletionStatus[101]; // arr_i16_1c5a
- int16 arr_i16_1d24[101];
+ uint16 puzzleFlags[101]; // arr_i16_1d24
int16 arr_i16_1dee[202];
int16 arr_i16_1eb8[0x29];
// used just for death?
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 35446fb3c51..e7a7da90cac 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -58,19 +58,19 @@ void FoolGame::sunMapRun() {
// 137:0148
for (int i = 1; i <= 0x51; i++) {
this->var_i16_484 = this->arr_i16_4c7c[i];
- if ((this->arr_i16_1d24[this->var_i16_484] & 3) != 0) {
+ if ((this->puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled)) != 0) {
this->arr_i32_192c0[i] = this->arr_i32_1912c[i];
} else {
// 137:01b2
this->arr_i32_192c0[i] = this->arr_i32_1912c[0x52];
}
// 137:01d8
- if ((this->arr_i16_1d24[this->var_i16_484] & 4) != 0) {
- this->arr_i16_1d24[this->var_i16_484] ^= 4;
- this->arr_i16_1d24[i] |= 8;
+ if ((this->puzzleFlags[this->var_i16_484] & 4) != 0) {
+ this->puzzleFlags[this->var_i16_484] ^= 4;
+ this->puzzleFlags[i] |= kFlagMapTile;
}
// 137:0252
- if ((this->arr_i16_1d24[i] & 8) != 0) {
+ if ((this->puzzleFlags[i] & kFlagMapTile) != 0) {
this->arr_i32_192c0[i] = this->arr_i32_1912c[0x53];
}
// 137:0294
@@ -114,10 +114,10 @@ void FoolGame::sunMapRun() {
// 137:1654
this->activePuzzle = 0;
this->var_i16_c04 = 0x64;
- this->var_i16_7d2 = 1;
+ this->sunMapRestored = 1;
g_zbasic->menu(2, 7, 1, Common::U32String());
for (int i = 1; i <= 0x50; i++) {
- this->arr_i16_1d24[i] = 1;
+ this->puzzleFlags[i] = kFlagMenuEnabled;
}
for (int j = 3; j <= 7; j++) {
for (int i = 1; i <= 0x10; i++) {
@@ -141,7 +141,7 @@ void FoolGame::sunMapOnClick() {
g_toolbox->PenMode(kPatXor);
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
- if (this->arr_i16_1d24[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & 8) {
+ if (this->puzzleFlags[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & kFlagMapTile) {
this->sunMapRevealPiece();
return;
}
@@ -325,7 +325,7 @@ void FoolGame::sunMapCheckIfSolved() {
if (this->var_i16_d0c == 1) {
for (int i = 1; i <= 0x51; i++) {
this->var_i16_484 = this->arr_i16_4c7c[i];
- if ((this->arr_i16_1d24[this->var_i16_484] & 8) || (this->arr_i16_1d24[this->var_i16_484] == 0)) {
+ if ((this->puzzleFlags[this->var_i16_484] & kFlagMapTile) || (this->puzzleFlags[this->var_i16_484] == kFlagMenuDisabled)) {
this->var_i16_d0c = 0;
i = 0x51;
}
@@ -340,7 +340,7 @@ void FoolGame::sunMapCheckIfSolved() {
void FoolGame::sunMapRevealPiece() {
// 137:131a
- this->arr_i16_1d24[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= 8;
+ this->puzzleFlags[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= kFlagMapTile;
this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = this->arr_i32_1912c[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
// 137:142c
// unrolled loop
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 1005203bb8a..1d779d16123 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -100,7 +100,7 @@ void FoolGame::highPriestessRun() {
this->sub_140_3412();
return;
}
- this->arr_i16_1d24[0x51] |= 0x5;
+ this->puzzleFlags[0x51] |= 0x5;
if (this->puzzleCompletionStatus[0x48] == 0x63) {
// is the hermit marked with the wadjet eye? if so, unmark
this->puzzleCompletionStatus[0x48] = 0x64;
@@ -109,7 +109,7 @@ void FoolGame::highPriestessRun() {
}
}
// 140:024c
- if (this->var_i16_7d2 == 0) {
+ if (this->sunMapRestored == 0) {
// show the fake puzzle picture
g_toolbox->PenNormal();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
@@ -128,10 +128,12 @@ void FoolGame::highPriestessRun() {
for (int16 i = 1; i <= 0x155; i++) {
g_zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
g_zbasic->put(g_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kPutCopy);
- g_toolbox->Delay(0);
+ if (i % 2 == 0) {
+ g_toolbox->Delay(0);
+ }
}
// 140:0328
- if (this->var_i16_7d2 == 0) {
+ if (this->sunMapRestored == 0) {
g_toolbox->PenNormal();
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
Commit: a6ad01b387306366ccc2630cefb505312929e7a0
https://github.com/scummvm/scummvm/commit/a6ad01b387306366ccc2630cefb505312929e7a0
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:21+02:00
Commit Message:
FOOL: Fix Wheel of Fortune + High Priestess completion
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_thoth.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index df0c4dab92b..b9e4d1565b2 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -112,7 +112,7 @@ void FoolGame::cardsRun() {
}
// 139:0456
this->cardsDrawTable();
- while ((this->stateFlags & 1) == 0) {
+ while ((this->stateFlags & kStateReturn) == 0) {
// 139:045e
this->var_i16_2014 = 0;
this->stateFlags = 0;
@@ -130,7 +130,7 @@ void FoolGame::cardsRun() {
if (this->stateFlags == 2) {
this->sub_139_4de();
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->cardsStoreState();
this->saveGame();
}
@@ -289,8 +289,8 @@ void FoolGame::cardsOnClick() {
}
}
// 139:09d8
- if (((this->stateFlags & 1) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->stateFlags = 2;
+ if (((this->stateFlags & kStateReturn) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
+ this->stateFlags = kStateUndo;
this->var_i16_2014 = 0;
}
}
@@ -696,8 +696,8 @@ void FoolGame::cardsStoreState() {
void FoolGame::sub_139_1d3e() {
// 139:1d3e
- this->stateFlags = 1;
- if (this->var_i16_c04 >= 0x64) {
+ this->stateFlags = kFlagMenuEnabled;
+ if (this->var_i16_c04 < 0x64) {
this->var_i16_c04 = 0x64;
}
this->sub_128_6186();
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 1d779d16123..eaea8442a27 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -100,6 +100,7 @@ void FoolGame::highPriestessRun() {
this->sub_140_3412();
return;
}
+ this->var_i16_c04 = 0x64;
this->puzzleFlags[0x51] |= 0x5;
if (this->puzzleCompletionStatus[0x48] == 0x63) {
// is the hermit marked with the wadjet eye? if so, unmark
Commit: 4526581315e1bd6eb8b1c761bb50742108fd88f9
https://github.com/scummvm/scummvm/commit/4526581315e1bd6eb8b1c761bb50742108fd88f9
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:21+02:00
Commit Message:
AUDIO: Allow PCSpeakerStream commands to adjust volume
Changed paths:
audio/softsynth/pcspk.cpp
audio/softsynth/pcspk.h
diff --git a/audio/softsynth/pcspk.cpp b/audio/softsynth/pcspk.cpp
index fd74b09e65e..e7e40777e35 100644
--- a/audio/softsynth/pcspk.cpp
+++ b/audio/softsynth/pcspk.cpp
@@ -27,8 +27,8 @@
namespace Audio {
-PCSpeakerStream::Command::Command(PCSpeaker::WaveForm aWaveForm, float aFrequency, uint32 aLength) :
- waveForm(aWaveForm), frequency(aFrequency), length(aLength) { }
+PCSpeakerStream::Command::Command(PCSpeaker::WaveForm aWaveForm, float aFrequency, uint32 aLength, byte aVolume) :
+ waveForm(aWaveForm), frequency(aFrequency), length(aLength), volume(aVolume) { }
const PCSpeakerStream::generatorFunc PCSpeakerStream::generateWave[] =
{&PCSpeakerStream::generateSquare, &PCSpeakerStream::generateSilence};
@@ -41,7 +41,7 @@ PCSpeakerStream::PCSpeakerStream(int rate) {
_oscSamples = 0;
_remainingSamples = 0;
_mixedSamples = 0;
- _volume = 20; // The maximum volume is 255
+ _volume = PCSPK_DEFAULT_VOLUME;
_commandQueue = new Common::Queue<Command>();
_commandActive = false;
}
@@ -50,7 +50,7 @@ PCSpeakerStream::~PCSpeakerStream() {
delete _commandQueue;
}
-void PCSpeakerStream::play(PCSpeaker::WaveForm wave, int freq, int32 length) {
+void PCSpeakerStream::play(PCSpeaker::WaveForm wave, int freq, int32 length, byte volume) {
Common::StackLock lock(_mutex);
assert(wave == PCSpeaker::kWaveFormSquare);
@@ -71,14 +71,15 @@ void PCSpeakerStream::play(PCSpeaker::WaveForm wave, int freq, int32 length) {
_playForever = false;
}
_mixedSamples = 0;
+ _volume = volume;
}
-void PCSpeakerStream::playQueue(PCSpeaker::WaveForm wave, float freq, uint32 lengthus) {
+void PCSpeakerStream::playQueue(PCSpeaker::WaveForm wave, float freq, uint32 lengthus, byte volume) {
Common::StackLock lock(_mutex);
// Put the new instruction in the queue. This will be picked up by the
// readBuffer method.
- _commandQueue->push(Command(wave, freq, lengthus));
+ _commandQueue->push(Command(wave, freq, lengthus, volume));
}
void PCSpeakerStream::stop(int32 delay) {
@@ -118,6 +119,7 @@ int PCSpeakerStream::readBuffer(int16 *buffer, const int numSamples) {
_wave = command.waveForm;
_oscLength = command.frequency > 0 ? (uint32)(_rate / command.frequency) : 0;
_oscSamples = 0;
+ _volume = command.volume;
// Length is in microseconds.
_remainingSamples = ((uint64)_rate * (uint64)command.length) / 1000000;
_playForever = false;
@@ -190,14 +192,14 @@ void PCSpeaker::quit() {
_speakerStream = nullptr;
}
-void PCSpeaker::play(WaveForm wave, int freq, int32 length) {
+void PCSpeaker::play(WaveForm wave, int freq, int32 length, byte volume) {
assert(_speakerStream);
- _speakerStream->play(wave, freq, length);
+ _speakerStream->play(wave, freq, length, volume);
}
-void PCSpeaker::playQueue(WaveForm wave, float freq, uint32 lengthus) {
+void PCSpeaker::playQueue(WaveForm wave, float freq, uint32 lengthus, byte volume) {
assert(_speakerStream);
- _speakerStream->playQueue(wave, freq, lengthus);
+ _speakerStream->playQueue(wave, freq, lengthus, volume);
}
void PCSpeaker::stop(int32 delay) {
diff --git a/audio/softsynth/pcspk.h b/audio/softsynth/pcspk.h
index 37ec225788a..47e555b580a 100644
--- a/audio/softsynth/pcspk.h
+++ b/audio/softsynth/pcspk.h
@@ -29,6 +29,8 @@
namespace Audio {
+#define PCSPK_DEFAULT_VOLUME 20
+
class PCSpeakerStream;
class PCSpeaker {
@@ -49,7 +51,7 @@ public:
*
* If length is negative, play until told to stop.
*/
- void play(WaveForm wave, int freq, int32 length);
+ void play(WaveForm wave, int freq, int32 length, byte volume = PCSPK_DEFAULT_VOLUME);
/**
* Queue the specified playback instruction. It will be executed when all
@@ -71,7 +73,7 @@ public:
* @param lengthus The length in microseconds for which to play the
* waveform.
*/
- void playQueue(WaveForm wave, float freq, uint32 lengthus);
+ void playQueue(WaveForm wave, float freq, uint32 lengthus, byte volume = PCSPK_DEFAULT_VOLUME);
/** Stop the currently playing note after delay ms. */
void stop(int32 delay = 0);
@@ -90,8 +92,9 @@ protected:
PCSpeaker::WaveForm waveForm;
float frequency;
uint32 length;
+ byte volume;
- Command(PCSpeaker::WaveForm waveForm, float frequency, uint32 length);
+ Command(PCSpeaker::WaveForm waveForm, float frequency, uint32 length, byte volume = PCSPK_DEFAULT_VOLUME);
};
public:
@@ -102,7 +105,7 @@ public:
*
* If length is negative, play until told to stop.
*/
- void play(PCSpeaker::WaveForm wave, int freq, int32 length);
+ void play(PCSpeaker::WaveForm wave, int freq, int32 length, byte volume = PCSPK_DEFAULT_VOLUME);
/**
* Queue the specified playback instruction. It will be executed when all
* previously queued instructions have finished. Use this method for
@@ -116,14 +119,14 @@ public:
* Use isPlaying to check if all queued instructions have finished playing.
* This will return true even if the current instruction is "playing"
* silence.
- *
+ *
* @param wave The waveform to use. For PC speaker, use square wave or
* silence.
* @param freq The frequency (in Hertz) to play.
* @param lengthus The length in microseconds for which to play the
* waveform.
*/
- void playQueue(PCSpeaker::WaveForm wave, float freq, uint32 lengthus);
+ void playQueue(PCSpeaker::WaveForm wave, float freq, uint32 lengthus, byte volume = PCSPK_DEFAULT_VOLUME);
/** Stop the currently playing note after delay ms. */
void stop(int32 delay = 0);
Commit: 45d977aa860c6e4c4f43f0ba08c276e78e0dc633
https://github.com/scummvm/scummvm/commit/45d977aa860c6e4c4f43f0ba08c276e78e0dc633
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:21+02:00
Commit Message:
FOOL: Add sound, first pass of maze engine
Changed paths:
A engines/fool/fool_maze.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_thoth.cpp
engines/fool/module.mk
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_sound.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index d32bfcc37ca..5e05a91bfc1 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -400,9 +400,10 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
this->var_i16_32 = duration;
this->var_i16_30 = freq;
if (this->soundEnabled == 1) {
- g_zbasic->sound(this->var_i16_30, this->var_i16_32, 0x96, 0);
+ // the volume was originally 150, this is crazy loud.
+ g_zbasic->sound(this->var_i16_30, this->var_i16_32, 20, 0);
if (this->var_i16_34 == 1) {
- while (g_zbasic->unk_5()) {
+ while (g_zbasic->soundBusy()) {
g_toolbox->Delay(0);
}
}
@@ -1703,7 +1704,7 @@ void FoolGame::puzzleRun() {
this->sentenceRun();
break;
case 9:
- this->sub_136_004();
+ this->mazeRun();
break;
case 10:
this->jumbleRun();
@@ -3192,11 +3193,6 @@ void FoolGame::sub_129_123a() {
-// maze game
-void FoolGame::sub_136_004() {
- warning("STUB: %s", __func__);
-}
-
void FoolGame::sub_138_004() {
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index f1ccb4108ce..744a7542d73 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -241,7 +241,28 @@ public:
void sub_135_c1c();
void sub_135_cee();
- void sub_136_004();
+ // fool_maze.cpp
+ void mazeRun();
+ void sub_136_79e();
+ void sub_136_994();
+ void sub_136_a22();
+ void sub_136_ade();
+ void sub_136_b00();
+ void sub_136_2582();
+ void sub_136_274e();
+ void sub_136_2a7c();
+ void sub_136_2b30();
+ void sub_136_2be2();
+ void sub_136_2c96();
+ void sub_136_2d4c();
+ void sub_136_2dd0();
+ void sub_136_2e52();
+ void sub_136_2ed6();
+ void sub_136_2f5c();
+ void sub_136_3408();
+ void sub_136_342a();
+ void sub_136_3466();
+ void sub_136_3a70();
// fool_sun.cpp
void sunMapRun(); // sub_137_004
@@ -528,13 +549,39 @@ private:
int16 var_i16_1aba;
int16 var_i16_1abc;
int16 var_i16_1abe;
+ PicHandle var_i32_1ac0;
+ int16 var_i16_1ac4;
+ Common::String var_str_1ac8;
+ int16 var_i16_1bc8;
+
+ int16 var_i16_1bcc;
+ int16 var_i16_1bce;
+ int16 var_i16_1bd0;
+
+ int16 var_i16_1bd2;
+ int16 var_i16_1bd4;
+ int16 var_i16_1bd6;
+ int16 var_i16_1bd8;
+ int16 var_i16_1bda;
+ int16 var_i16_1bdc;
+ Common::U32String var_str_1bde;
+
+ int16 var_i16_1de4;
int16 var_i16_1de6;
+ int16 var_i16_1de8;
+ int16 var_i16_1dea;
+
PatternMode var_i16_1dee;
int16 var_i16_1e00;
+ Common::U32String var_str_1e08;
+
+ uint16 var_i16_1f08;
+ int16 var_i16_1f0a;
+
int16 var_i16_2010;
int16 var_i16_2012;
int16 var_i16_2014;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
new file mode 100644
index 00000000000..e30864743a0
--- /dev/null
+++ b/engines/fool/fool_maze.cpp
@@ -0,0 +1,774 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+void FoolGame::mazeRun() {
+ // 136:0004
+ sub_128_271a();
+ sub_128_4da(0);
+ for (int16 i = 0; i <= 0x17; i++) {
+ arr_i16_1eb8[i] = puzzlesReadShort();
+ }
+ var_i16_484 = 0;
+ do {
+ var_i16_68c = arr_i16_1eb8[8];
+ do {
+ var_i16_68a = arr_i16_1eb8[10];
+ var_i16_484++;
+ g_toolbox->SetRect(
+ arr_rect_1f38[var_i16_484],
+ var_i16_68a,
+ var_i16_68c,
+ arr_i16_1eb8[13],
+ arr_i16_1eb8[12]
+ );
+ // 136:00ca
+ } while (g_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
+ } while (g_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
+ if (this->arr_i16_1eb8[20] != 0) {
+ var_i32_1ac0 = g_toolbox->GetPicture(arr_i16_1eb8[20]);
+ g_zbasic->picture(arr_i16_1eb8[18], arr_i16_1eb8[19], var_i32_1ac0);
+ }
+ // 136:018c
+ for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
+ arr_i16_5cbc[i] = 0;
+ }
+ // 136:01d2
+ var_i16_484 = 0;
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ var_i16_484++;
+ arr_i16_3738[var_i16_484] = puzzlesReadByte();
+ arr_i16_2f38[i*32 + j] = var_i16_484;
+ arr_i16_4338[var_i16_484] = 0;
+ }
+ }
+ // 136:026a
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ arr_i16_3b38[i*32 + j] = puzzlesReadByte();
+ }
+ }
+ // 136:02ce
+ sub_128_bde(1, arr_i16_1eb8[17], 0, 1, 0, 1);
+
+ Common::Rect playArea;
+ playArea.top = arr_rect_1f38[1].top + 3;
+ playArea.left = arr_rect_1f38[0].top + 3;
+ playArea.bottom = arr_rect_1f38[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].bottom - 3;
+ playArea.right = arr_rect_1f38[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].right - 3;
+ g_toolbox->FillRect(playArea, arr_pat_58f4[2]);
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(5, 5);
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ // 136:042c
+ var_i16_1ac4 = arr_i16_1eb8[1];
+ var_i16_1574 = 0;
+ var_i16_68c = 1;
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ var_i16_1574++;
+ if ((arr_i16_3738[var_i16_1574] & 0x10) != 0) {
+ sub_136_2a7c();
+ }
+ if ((arr_i16_3738[var_i16_1574] & 0x20) != 0) {
+ sub_136_2b30();
+ }
+ if ((arr_i16_3738[var_i16_1574] & 0x40) != 0) {
+ sub_136_2be2();
+ }
+ // 136:04b6
+ if ((arr_i16_3738[var_i16_1574] & 0x80) != 0) {
+ sub_136_2c96();
+ }
+ }
+ if ((arr_i16_3738[var_i16_1574 - 1] & 4) == 0) {
+ Common::Rect temp;
+ temp.top = arr_rect_1f38[var_i16_1574].top + 3;
+ temp.left = arr_rect_1f38[var_i16_1574].left - 3;
+ temp.bottom = arr_rect_1f38[var_i16_1574].bottom - 3;
+ temp.right = SCREEN_WIDTH;
+ g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ }
+ // 136:05d0
+ }
+ // 136:05ec
+ if (activePuzzleBuffer.empty()) { // was: str(223)
+ for (int16 j = 1; j <= arr_i16_1eb8[23]; j++) {
+ var_str_1ac8 = g_zbasic->indexRaw(1, j);
+ var_i16_1bc8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, 3, 2));
+ if (var_i16_1bc8 != 0x29a) {
+ for (int16 i = 1; i <= var_i16_1bc8; i++) {
+ sub_136_2582();
+ }
+ }
+ // 136:0664
+ }
+ // 136:067e
+ var_i16_1bcc = arr_i16_1eb8[15];
+ var_i16_1bce = arr_i16_1eb8[16];
+ var_i16_1bd0 = 0;
+ } else {
+ // 136:06b0
+ sub_136_3466();
+ }
+ // 136:06b4
+ var_str_1578.clear(); // was str(224)
+ sub_136_274e();
+ sub_136_ade();
+ stateFlags = 0;
+ sub_128_4da(1);
+ if (var_i16_1bcc == 0x19) {
+ var_i16_d0c = 1;
+ } else {
+ // 136:06f0
+ var_i16_d0c = 0;
+ }
+ // 136:06f6
+ // JMP 0x75c
+ while (((stateFlags & kStateReturn) == 0) && (var_i16_d0c == 0)) {
+ // 136:06fa
+ while ((stateFlags == kStateNull) && (var_i16_d0c == 0)) {
+ // 136:06fe
+ getNextEvent(-1);
+ if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ sub_136_79e();
+ }
+ }
+ // 136:074a
+ if (stateFlags == kStateSaveGame) {
+ sub_136_2f5c();
+ saveGame();
+ }
+ // 136:075c
+ }
+ // 136:0786
+ if (var_i16_d0c != 0) {
+ sub_136_3a70();
+ }
+ sub_136_2f5c();
+}
+
+void FoolGame::sub_136_79e() {
+ // 136:079e
+ sub_128_2be(var_i16_68a, var_i16_68c);
+ if ((var_i16_68a == var_i16_1bcc) && (var_i16_68c == var_i16_1bce)) {
+ return;
+ }
+ // 136:07e2
+ if (var_i16_1bce > var_i16_68c) {
+ var_i16_1bd2 = 2;
+ }
+ if (var_i16_1bcc > var_i16_68a) {
+ var_i16_1bd2 = 1;
+ }
+ if (var_i16_1bce < var_i16_68c) {
+ var_i16_1bd2 = 4;
+ }
+ if (var_i16_1bcc < var_i16_68a) {
+ var_i16_1bd2 = 3;
+ }
+ if (var_i16_1bd4 != var_i16_1bd2) {
+ if ((var_i16_1bd2 == 1) && ((arr_i16_3738[var_i16_1574] & 1) == 1)) {
+ sub_136_994();
+ return;
+ }
+ // 136:088a
+ if ((var_i16_1bd2 == 2) && ((arr_i16_3738[var_i16_1574] & 2) == 2)) {
+ sub_136_994();
+ return;
+ }
+ if ((var_i16_1bd2 == 3) && ((arr_i16_3738[var_i16_1574] & 4) == 4)) {
+ sub_136_994();
+ return;
+ }
+ if ((var_i16_1bd2 == 4) && ((arr_i16_3738[var_i16_1574] & 8) == 8)) {
+ sub_136_994();
+ return;
+ }
+ // 136:0944
+ if (var_i16_1bd6 == var_i16_1bd2) {
+ return;
+ }
+ }
+ // 136:0956
+ if (var_i16_1bd2 == 1)
+ var_i16_1bcc--;
+ if (var_i16_1bd2 == 2)
+ var_i16_1bce--;
+ if (var_i16_1bd2 == 3)
+ var_i16_1bcc++;
+ if (var_i16_1bd2 == 4)
+ var_i16_1bce++;
+ sub_136_a22();
+}
+
+void FoolGame::sub_136_994() {
+ // 136:0994
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(5, 5);
+ if (arr_i16_1eb8[21] == 0) {
+ g_toolbox->PenMode(kPatXor);
+ switch (var_i16_1bd2-1) {
+ case 0:
+ sub_136_2a7c();
+ break;
+ case 1:
+ sub_136_2b30();
+ break;
+ case 2:
+ sub_136_2be2();
+ break;
+ case 3:
+ sub_136_2c96();
+ break;
+ default:
+ warning("sub_136_994: breaking out of switch");
+ break;
+ }
+ } else {
+ // 136:09de
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ }
+ // 136:0a00
+ switch (var_i16_1bd2-1) {
+ case 0:
+ sub_136_2a7c();
+ break;
+ case 1:
+ sub_136_2b30();
+ break;
+ case 2:
+ sub_136_2be2();
+ break;
+ case 3:
+ sub_136_2c96();
+ break;
+ default:
+ warning("sub_136_994: breaking out of switch");
+ break;
+ }
+}
+
+void FoolGame::sub_136_a22() {
+ // 136:0a22
+ if (var_i16_1bd6 != 0) {
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[2]);
+ g_toolbox->PenSize(5, 5);
+ switch (var_i16_1bd6 - 1) {
+ case 0:
+ sub_136_2d4c();
+ break;
+ case 1:
+ sub_136_2dd0();
+ break;
+ case 2:
+ sub_136_2e52();
+ break;
+ case 3:
+ sub_136_2ed6();
+ break;
+ default:
+ warning("sub_136_a22: breaking out of switch");
+ break;
+ }
+ }
+ // 136:0a66
+ if (var_i16_1bd4 != 0) {
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenSize(5, 5);
+ switch (var_i16_1bd6 - 1) {
+ case 0:
+ sub_136_2d4c();
+ break;
+ case 1:
+ sub_136_2dd0();
+ break;
+ case 2:
+ sub_136_2e52();
+ break;
+ case 3:
+ sub_136_2ed6();
+ break;
+ default:
+ warning("sub_136_a22: breaking out of switch");
+ break;
+ }
+ }
+ // 136:0abe
+ do {
+ var_i16_1bd6 = 0;
+ var_i16_1bd4 = 0;
+ var_i16_1bd8 = 0;
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[12];
+ temp.left = arr_i16_1eb8[13];
+ temp.bottom = arr_i16_1eb8[14];
+ temp.right = arr_i16_1eb8[15];
+ g_toolbox->InvertOval(temp);
+ var_i16_1bda = var_i16_1574;
+ sub_136_b00();
+ } while (var_i16_1bd8 != var_i16_1574);
+}
+
+
+void FoolGame::sub_136_ade() {
+ // 136:0ade
+
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_b00() {
+ // 136:0b00
+ if (arr_i16_1eb8[11] | var_i16_1bdc) {
+ fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
+ var_i16_1bdc = 0;
+ var_str_1578.clear(); // was: str(225)
+ }
+ // 136:0b5e
+ if ((arr_i16_3738[var_i16_1574] & 0x1000) == 0) {
+ var_i16_1bd0 = var_i16_1574;
+ return;
+ }
+ var_str_1ac8 = g_zbasic->index(1, arr_i16_3b38[var_i16_1bcc*32 + var_i16_1bce]);
+ var_str_1bde = g_zbasic->str(226); // CILTDABRPXMOZSFQGWEJKV
+
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_2582() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_274e() {
+ // 136:274e
+ g_zbasic->menu(8, 0, 1, arr_str_195e8[activePuzzle]);
+ if (activePuzzle < 0x50) {
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(243)); // return to scroll
+ } else {
+ // 136:279a
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(244)); // return to map
+ }
+ // 136:27b2
+ g_zbasic->menu(8, 2, 0, g_zbasic->str(245)); // -
+ g_zbasic->menu(8, 3, 1, g_zbasic->str(246)); // to escape from the maze
+ g_zbasic->menu(8, 4, 1, g_zbasic->str(247)); // use the mouse to maneuver
+ g_zbasic->menu(8, 5, 1, g_zbasic->str(248)); // the white dot to the exit
+ if (activePuzzle == 0x57) {
+ // 136:281c
+ var_i16_103a = 7;
+ var_i16_68a = 1;
+ for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
+
+ if ((arr_i16_5cbc[var_i16_68a] > 0) &&
+ (g_zbasic->instr(1, g_zbasic->index(1, var_i16_68a), g_zbasic->str(249)) > 0)) {
+ if (var_i16_103a == 7) {
+ g_zbasic->menu(8, 6, 0, g_zbasic->str(250)); // -
+ g_zbasic->menu(8, 7, 0, g_zbasic->str(251)); // you have acquired
+ }
+ // 136:28b4
+ var_i16_1dea = g_zbasic->instr(1, g_zbasic->index(1, var_i16_68a), g_zbasic->str(252)); // ++
+ var_i16_1de8 = g_zbasic->instr(1, g_zbasic->index(1, var_i16_68a), g_zbasic->str(253)); // \xa5\xa5
+ var_str_1e08 = g_zbasic->midStr(g_zbasic->index(1, var_i16_68a), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
+ if (g_zbasic->leftStr(var_str_1e08, 1) == g_zbasic->str(254)) { // +
+ // 136:2964
+ var_i16_484 = var_str_1e08.size();
+ var_str_1e08 = g_zbasic->rightStr(var_str_1e08, var_i16_484 - 1);
+ }
+ // 136:298e
+ var_str_384 = Common::U32String::format(" %d", arr_i16_5cbc[var_i16_68a]);
+ var_str_384 = g_zbasic->space(4 - var_str_384.size()) + var_str_384 + g_zbasic->str(255) + var_str_1e08; // ' '
+ if (arr_i16_5cbc[var_i16_68a] > 1) {
+ var_str_384 += g_zbasic->str(256); // s
+ }
+ // 136:2a2a
+ var_str_384 += g_zbasic->str(257); // ' '
+ var_i16_103a++;
+ g_zbasic->menu(8, var_i16_103a, 1, var_str_384);
+ }
+ // 136:2a5e
+ }
+ }
+ // 136:2a7a
+ return;
+}
+
+void FoolGame::sub_136_2a7c() {
+ // 136:2a7c
+ arr_i16_3738[var_i16_1574] |= 0x100;
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1574].left - 2,
+ arr_rect_1f38[var_i16_1574].top - 2
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1574].left - 2,
+ arr_rect_1f38[var_i16_1574].bottom - 3
+ );
+}
+
+void FoolGame::sub_136_2b30() {
+ // 136:2b30
+ arr_i16_3738[var_i16_1574] |= 0x200;
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1574].left - 2,
+ arr_rect_1f38[var_i16_1574].top - 2
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1574].right - 3,
+ arr_rect_1f38[var_i16_1574].top - 2
+ );
+}
+
+void FoolGame::sub_136_2be2() {
+ // 136:2be2
+ arr_i16_3738[var_i16_1574] |= 0x400;
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1574].right - 3,
+ arr_rect_1f38[var_i16_1574].top - 2
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1574].right - 3,
+ arr_rect_1f38[var_i16_1574].bottom - 3
+ );
+}
+
+void FoolGame::sub_136_2c96() {
+ // 136:2c96
+ arr_i16_3738[var_i16_1574] |= 0x800;
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1574].left - 2,
+ arr_rect_1f38[var_i16_1574].bottom - 3
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1574].right - 3,
+ arr_rect_1f38[var_i16_1574].bottom - 3
+ );
+}
+
+void FoolGame::sub_136_2d4c() {
+ // 136:2d4c
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1bd8].left - 2,
+ arr_rect_1f38[var_i16_1bd8].top + 3
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1bd8].left - 2,
+ arr_rect_1f38[var_i16_1bd8].bottom - 8
+ );
+}
+
+void FoolGame::sub_136_2dd0() {
+ // 136:2dd0
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1bd8].left + 3,
+ arr_rect_1f38[var_i16_1bd8].top - 2
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1bd8].right - 8,
+ arr_rect_1f38[var_i16_1bd8].top - 2
+ );
+}
+
+void FoolGame::sub_136_2e52() {
+ // 136:2e52
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1bd8].right - 3,
+ arr_rect_1f38[var_i16_1bd8].top + 3
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1bd8].right - 3,
+ arr_rect_1f38[var_i16_1bd8].bottom - 8
+ );
+}
+
+void FoolGame::sub_136_2ed6() {
+ // 136:2ed6
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1bd8].left + 3,
+ arr_rect_1f38[var_i16_1bd8].bottom - 3
+ );
+ g_toolbox->LineTo(
+ arr_rect_1f38[var_i16_1bd8].right - 8,
+ arr_rect_1f38[var_i16_1bd8].bottom - 3
+ );
+}
+
+void FoolGame::sub_136_2f5c() {
+ // 136:2f5c
+ if ((activePuzzle != 0x57) && (var_i16_d0c == 0)) {
+ activePuzzleBuffer.clear(); // was: str(258)
+ return;
+ }
+ activePuzzleBuffer = g_zbasic->encodeInt(var_i16_1bcc) +
+ g_zbasic->encodeInt(var_i16_1bce) +
+ g_zbasic->encodeInt(var_i16_1bd0) +
+ g_zbasic->encodeInt(var_i16_1bd6) +
+ g_zbasic->encodeInt(var_i16_1bd4) +
+ g_zbasic->encodeInt(var_i16_1bd8);
+ // 136:300a
+ for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
+ activePuzzleBuffer += g_zbasic->encodeInt(arr_i16_5cbc[i]);
+ }
+ // 136:3054
+ var_i16_484 = 0;
+ Common::String buffer;
+ var_i16_1de6 = 0;
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ var_i16_484++;
+ if (arr_i16_4338[var_i16_484] > 0) {
+ var_i16_1de6++;
+ buffer += g_zbasic->encodeInt(arr_i16_2f38[i*32 + j]) + g_zbasic->encodeInt(arr_i16_4338[var_i16_484]);
+ }
+ // 136:30f0
+ }
+ }
+ // 136:3128
+ activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1de6) + buffer;
+
+ var_i16_484 = 0;
+ var_i16_1de6 = 0;
+ var_i16_1f08 = 0;
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ var_i16_484++;
+ if (arr_i16_1eb8[21] != 0) {
+ // 136:3188
+ if (((arr_i16_3738[var_i16_484] & 1) == 1) && ((arr_i16_3738[var_i16_484] & 0x10) == 0)) {
+ if ((arr_i16_3738[var_i16_484] & 0x100) != 0) {
+ sub_136_3408();
+ }
+ sub_136_342a();
+ }
+ // 136:31fe
+ if (((arr_i16_3738[var_i16_484] & 2) == 2) && ((arr_i16_3738[var_i16_484] & 0x20) == 0)) {
+ if ((arr_i16_3738[var_i16_484] & 0x200) != 0) {
+ sub_136_3408();
+ }
+ sub_136_342a();
+ }
+ // 136:3274
+ if (((arr_i16_3738[var_i16_484] & 4) == 4) && ((arr_i16_3738[var_i16_484] & 0x40) == 0)) {
+ if ((arr_i16_3738[var_i16_484] & 0x400) != 0) {
+ sub_136_3408();
+ }
+ sub_136_342a();
+ }
+ // 136:32ea
+ if (((arr_i16_3738[var_i16_484] & 8) == 8) && ((arr_i16_3738[var_i16_484] & 0x80) == 0)) {
+ if ((arr_i16_3738[var_i16_484] & 0x800) != 0) {
+ sub_136_3408();
+ }
+ sub_136_342a();
+ }
+ }
+ // 136:3362
+ if (arr_i16_3b38[i*32 + j] > 0) {
+ if ((arr_i16_3738[var_i16_484] & 0x1000) != 0) {
+ sub_136_3408();
+ }
+ sub_136_342a();
+ }
+ // 136:33b0
+ }
+ }
+ // 136:33e8
+ activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
+}
+
+void FoolGame::sub_136_3408() {
+ // 136:3408
+ var_i16_1f08 |= bitLUT[var_i16_1de6];
+}
+
+void FoolGame::sub_136_342a() {
+ // 136:342a
+ var_i16_1de6++;
+ if (var_i16_1de6 > 0xf) {
+ activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
+ var_i16_1f08 = 0;
+ var_i16_1de6 = 0;
+ }
+ // 136:3464
+}
+
+void FoolGame::sub_136_3466() {
+ // 136:3466
+ var_i16_1bcc = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 1, 2));
+ var_i16_1bce = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 3, 2));
+ var_i16_1bd0 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 5, 2));
+ var_i16_1bd6 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 7, 2));
+ var_i16_1bd4 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 9, 2));
+ var_i16_1bd8 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 0xb, 2));
+ if (var_i16_1bd6 > 0) {
+ // 136:3500
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenSize(5, 5);
+ switch (var_i16_1bd6 - 1) {
+ case 0:
+ sub_136_2d4c();
+ break;
+ case 1:
+ sub_136_2dd0();
+ break;
+ case 2:
+ sub_136_2e52();
+ break;
+ case 3:
+ sub_136_2ed6();
+ break;
+ default:
+ warning("sub_136_3466: breaking out of switch");
+ break;
+ }
+ }
+ // 136:354e
+ if (var_i16_1bd4 > 0) {
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[2]);
+ g_toolbox->PenSize(5, 5);
+ switch (var_i16_1bd4 - 1) {
+ case 0:
+ sub_136_2d4c();
+ break;
+ case 1:
+ sub_136_2dd0();
+ break;
+ case 2:
+ sub_136_2e52();
+ break;
+ case 3:
+ sub_136_2ed6();
+ break;
+ default:
+ warning("sub_136_3466: breaking out of switch");
+ break;
+ }
+ }
+ // 136:3592
+ var_i16_1f0a = 0xd;
+ var_i16_68a = 1;
+ arr_i16_5cbc[var_i16_68a] = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f0a += 2;
+ if (var_i16_1de4 > 0) {
+ g_zbasic->text(0xfb, 0xc, 0, kSrcBic);
+ for (int16 i = 1; i <= var_i16_1de4; i++) {
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f0a += 2;
+ var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f0a += 2;
+ // 136:366e
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1dea].left + arr_i16_1eb8[2],
+ arr_rect_1f38[var_i16_1dea].top + arr_i16_1eb8[3]
+ );
+ g_zbasic->unk_8();
+ // the one place that used ZBasic's print API,
+ // easier to cut out the middleman and use DrawString
+ g_toolbox->DrawString(g_zbasic->chr(var_i16_106e));
+ //g_zbasic->print(g_zbasic->chr(var_i16_106e));
+ //g_zbasic->printNewline();
+ arr_i16_4338[var_i16_1dea] = var_i16_106e;
+ }
+ }
+ // 136:3710
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[16]]);
+ g_toolbox->PenSize(5, 5);
+ var_i16_1574 = 0;
+ var_i16_1de6 = 0;
+ var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ // 136:3766
+ var_i16_1f0a += 2;
+ var_i16_68c = 1;
+ var_i16_68a = 1;
+
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_3a70() {
+ // 136:3a70
+ if (activePuzzle == 0x57) {
+ var_i16_c04 = 0x64;
+ sub_128_2664();
+ sub_128_61c2();
+ } else {
+ // 136:3a8e
+ if (var_i16_c04 < 0x64) {
+ var_i16_c04 = 0x64;
+ }
+ var_i16_484 = 1 + (arr_i16_1eb8[24] - 0x14) / 0x23;
+ var_i16_7e4 = 1 + (arr_i16_1eb8[25]) / 0x23;
+ var_i16_9f2 = 1 + (SCREEN_HEIGHT - arr_i16_1eb8[26]) / 0x23;
+ g_toolbox->PenNormal();
+ // 136:3b0e
+ for (int16 j = 0; j <= 1; j++) {
+ if (j == 1) {
+ g_toolbox->PenMode(kNotPatOr);
+ g_toolbox->PenPat(arr_pat_58f4[1]);
+ }
+ // 136:3b32
+ for (int16 i = 4; i <= 7; i++) {
+ arr_i16_4758[i] = arr_i16_1eb8[i + 0x14];
+ }
+ // 136:3b7a
+ for (int16 i = 0; i <= 0x23; i++) {
+ arr_i16_4758[4] -= var_i16_484;
+ arr_i16_4758[5] -= var_i16_7e4;
+ arr_i16_4758[6] += var_i16_9f2;
+ arr_i16_4758[7] = SCREEN_WIDTH;
+ Common::Rect temp;
+ temp.top = arr_i16_4758[4];
+ temp.left = arr_i16_4758[5];
+ temp.bottom = arr_i16_4758[6];
+ temp.right = arr_i16_4758[7];
+ if (arr_i16_4758[4] < 0x14) {
+ arr_i16_4758[4] = 0x14;
+ }
+
+ if (var_i16_68c == 0) {
+ g_toolbox->InvertRect(temp);
+ } else {
+ // 136:3c48
+ g_toolbox->PaintRect(temp);
+ }
+ // 136:3c56
+ }
+ // 136:3c64
+ }
+ }
+ // 136:3c72
+}
+
+}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index eaea8442a27..5cb0afb05b6 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -19,8 +19,6 @@
*
*/
-#include "graphics/managed_surface.h"
-
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/toolbox.h"
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index e18f4a853fa..c36161ae86a 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
fool_jigsaw.o \
fool_jumble.o \
fool_justice.o \
+ fool_maze.o \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 46952484329..cc471223803 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -19,6 +19,8 @@
*
*/
+#include "audio/mixer.h"
+#include "audio/softsynth/pcspk.h"
#include "common/events.h"
#include "common/system.h"
@@ -159,12 +161,26 @@ static const struct MacKeyCodeMapping {
Toolbox::Toolbox() {
_frameLimiter = new Graphics::FrameLimiter(g_system, 60, false);
- for (const MacKeyCodeMapping *k = MackeyCodeMappings; k->scummvm != Common::KEYCODE_INVALID; k++)
+ for (const MacKeyCodeMapping *k = MackeyCodeMappings; k->scummvm != Common::KEYCODE_INVALID; k++) {
_keyMap[k->scummvm] = k->mac;
+ }
+ Audio::Mixer *mixer = g_system->getMixer();
+ if (mixer) {
+ _swSynth = new Audio::PCSpeakerStream(mixer->getOutputRate());
+ mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundDriver,
+ _swSynth, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ }
+
}
Toolbox::~Toolbox() {
delete _frameLimiter;
+ Audio::Mixer *mixer = g_system->getMixer();
+ if (mixer) {
+ mixer->stopHandle(_soundDriver);
+ }
+ delete _swSynth;
+ _swSynth = nullptr;
}
void Toolbox::_pumpEvents() {
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 8c418b28807..b9e80fd5bc2 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -29,6 +29,7 @@
#include "common/str.h"
#include "common/ustr.h"
+#include "audio/mixer.h"
#include "graphics/cursor.h"
#include "image/pict.h"
#include "graphics/framelimiter.h"
@@ -38,6 +39,10 @@
#include "fool/siphash/halfsip.h"
+namespace Audio {
+class PCSpeakerStream;
+}
+
namespace Fool {
struct RGBColor {
@@ -550,6 +555,10 @@ struct SynthRec {
typedef SynthRec * SynthPtr;
struct SWSynthRec : SynthRec {
+
+ SWSynthRec() {
+ mode = swMode;
+ }
Common::Array<Tone> triplets;
};
@@ -609,6 +618,19 @@ public:
// toolbox_sound.cpp
+ // PROCEDURE GetSoundVol (VAR level : INTEGER);
+ // GetSoundVol returns the current speaker volume, from 0 (silent) to 7 (loudest).
+ int16 GetSoundVol();
+
+ // PROCEDURE SetSoundVol (level: INTEGER);
+ // SetSoundVol immediately sets the speaker volume to the specified level, from 0 (silent) to 7 (loudest).
+ void SetSoundVol(int16 level);
+
+ // FUNCTION SoundDone: BOOLEAN;
+ // SoundDone returns TRUE if the Sound Driver isn't currently producing sound and there are no
+ // asynchronous StartSound calls pending; otherwise it returns FALSE.
+ bool SoundDone();
+
// PROCEDURE StartSound (synthRec: Ptr; numBytes: LONGINT; completionRtn: ProcPtr);
// StartSound begins producing the sound described by the synthesizer buffer pointed to by
// synthRec. NumBytes indicates the size of the synthesizer buffer (in bytes), and completionRtn
@@ -620,6 +642,11 @@ public:
// completionRtn will be executed when the sound finishes.
void StartSound(SynthPtr synthRec, uint32 numBytes, ProcPtr completionRtn);
+ // PROCEDURE StopSound;
+ // StopSound immediately stops the current StartSound call (if any), executes the current
+ // StartSound call's completion routine (if any), and cancels any pending asynchronous StartSound calls.
+ void StopSound();
+
// toolbox_resman.cpp
// FUNCTION CountResources (theType: ResType): Integer;
@@ -1290,6 +1317,8 @@ private:
Common::Point _mouse;
uint16 _modifiers = 0x80;
Common::HashMap<uint16, MenuHandle> _menu;
+ Audio::SoundHandle _soundDriver;
+ Audio::PCSpeakerStream *_swSynth;
Common::List<EventRecord> _events;
diff --git a/engines/fool/toolbox_sound.cpp b/engines/fool/toolbox_sound.cpp
index 08dffdb73a4..b9ab2abd137 100644
--- a/engines/fool/toolbox_sound.cpp
+++ b/engines/fool/toolbox_sound.cpp
@@ -19,6 +19,8 @@
*
*/
+#include "audio/audiostream.h"
+#include "audio/softsynth/pcspk.h"
#include "common/system.h"
#include "common/savefile.h"
@@ -29,18 +31,47 @@
namespace Fool {
+// FIXME: This sound code is incredibly basic, only providing
+// an interface for the square wave synthesiser.
+
void Toolbox::StartSound(SynthPtr synthRec, uint32 numBytes, ProcPtr completionRtn) {
if (!synthRec) {
warning("Toolbox::startSound: record not found");
return;
}
+ bool synch = completionRtn == -1;
if (synthRec->mode == swMode) {
SWSynthRec *rec = static_cast<SWSynthRec *>(synthRec);
+ for (auto &it : rec->triplets) {
+ _swSynth->playQueue(Audio::PCSpeaker::kWaveFormSquare, it.count == 0 ? 783360.0f : (783360.0f / it.count), it.duration*1000000/60, MIN(it.amplitude, (uint16)255));
+ }
+ if (synch) {
+ while (_swSynth->isPlaying()) {
+ Delay(1);
+ }
+ }
} else {
warning("Toolbox::startSound: unimplemented synth mode %d", synthRec->mode);
return;
}
}
+void Toolbox::StopSound() {
+ _swSynth->stop();
+}
+
+bool Toolbox::SoundDone() {
+ return !_swSynth->isPlaying();
+}
+
+void Toolbox::SetSoundVol(int16 level) {
+ warning("STUB: Toolbox::SetSoundVol");
+}
+
+int16 Toolbox::GetSoundVol() {
+ warning("STUB: Toolbox::GetSoundVol");
+ return 7;
+}
+
} // namespace Fool
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 5415aa16bd4..38048fcb3c0 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -626,13 +626,25 @@ void ZBasic::unk_4() {
warning("STUB: ZBasic::unk_4");
}
-int16 ZBasic::unk_5() {
- warning("STUB: ZBasic::unk_5");
- return 0;
+int16 ZBasic::soundBusy() {
+ return _toolbox->SoundDone() ? 0 : 1;
}
void ZBasic::sound(int16 frequency, int32 duration, int16 volume, int16 voice) {
+ // FIXME: It is possible to use voice and the WAVE command
+ // to program the 4-tone synthesizer.
+ // Without this, out of the box ZBasic seems to use
+ // square wave output.
warning("STUB: ZBasic::unk_6: frequency %d, duration %d, volume %d, voice %d", frequency, duration, volume, voice);
+ SWSynthRec record;
+ if (frequency == 0)
+ return;
+ record.triplets.push_back({ (uint16)(783360/frequency), MIN(MAX((uint16)volume, (uint16)0), (uint16)255), (uint16)(duration*60/1000) });
+ _toolbox->StartSound(&record, 8, 0);
+}
+
+void ZBasic::unk_8() {
+ warning("STUB: ZBasic::unk_8");
}
void ZBasic::unk_11(int16 unk1) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 9e1d4d4a2b7..bf823831cb7 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -291,8 +291,9 @@ public:
void unk_4(); // possibly quit?
- int16 unk_5();
+ int16 soundBusy();
void sound(int16 frequency, int32 duration, int16 volume, int16 voice);
+ void unk_8();
void unk_10();
void unk_11(int16 unk1);
void unk_20();
Commit: a596b261136735ed846b511a295ed536e80c16b2
https://github.com/scummvm/scummvm/commit/a596b261136735ed846b511a295ed536e80c16b2
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:22+02:00
Commit Message:
FOOL: Maze not crashing anymore
Changed paths:
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 744a7542d73..c79e389304c 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -249,6 +249,7 @@ public:
void sub_136_ade();
void sub_136_b00();
void sub_136_2582();
+ void sub_136_2664();
void sub_136_274e();
void sub_136_2a7c();
void sub_136_2b30();
@@ -575,8 +576,12 @@ private:
PatternMode var_i16_1dee;
+ int16 var_i16_1df2;
+
int16 var_i16_1e00;
+ int16 var_i16_1e06;
+
Common::U32String var_str_1e08;
uint16 var_i16_1f08;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index e30864743a0..8d783308bdb 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -37,17 +37,17 @@ void FoolGame::mazeRun() {
arr_i16_1eb8[i] = puzzlesReadShort();
}
var_i16_484 = 0;
+ var_i16_68c = arr_i16_1eb8[8];
do {
- var_i16_68c = arr_i16_1eb8[8];
+ var_i16_68a = arr_i16_1eb8[10];
do {
- var_i16_68a = arr_i16_1eb8[10];
var_i16_484++;
g_toolbox->SetRect(
arr_rect_1f38[var_i16_484],
var_i16_68a,
var_i16_68c,
- arr_i16_1eb8[13],
- arr_i16_1eb8[12]
+ var_i16_68a + arr_i16_1eb8[13],
+ var_i16_68c + arr_i16_1eb8[12]
);
// 136:00ca
} while (g_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
@@ -331,26 +331,43 @@ void FoolGame::sub_136_a22() {
var_i16_1bd4 = 0;
var_i16_1bd8 = 0;
Common::Rect temp;
- temp.top = arr_i16_1eb8[12];
- temp.left = arr_i16_1eb8[13];
- temp.bottom = arr_i16_1eb8[14];
- temp.right = arr_i16_1eb8[15];
+ temp.top = arr_i16_1eb8[24];
+ temp.left = arr_i16_1eb8[25];
+ temp.bottom = arr_i16_1eb8[26];
+ temp.right = arr_i16_1eb8[27];
g_toolbox->InvertOval(temp);
+ sub_136_2664();
var_i16_1bda = var_i16_1574;
sub_136_b00();
- } while (var_i16_1bd8 != var_i16_1574);
+ } while (var_i16_1bda != var_i16_1574);
}
void FoolGame::sub_136_ade() {
// 136:0ade
-
- warning("STUB: %s", __func__);
+ // this was done by a GOTO into the previous function, so we copy most of it here.
+ sub_136_2664();
+ var_i16_1bda = var_i16_1574;
+ sub_136_b00();
+ while (var_i16_1bda != var_i16_1574) {
+ var_i16_1bd6 = 0;
+ var_i16_1bd4 = 0;
+ var_i16_1bd8 = 0;
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[24];
+ temp.left = arr_i16_1eb8[25];
+ temp.bottom = arr_i16_1eb8[26];
+ temp.right = arr_i16_1eb8[27];
+ g_toolbox->InvertOval(temp);
+ sub_136_2664();
+ var_i16_1bda = var_i16_1574;
+ sub_136_b00();
+ };
}
void FoolGame::sub_136_b00() {
// 136:0b00
- if (arr_i16_1eb8[11] | var_i16_1bdc) {
+ if (arr_i16_1eb8[22] | var_i16_1bdc) {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
var_i16_1bdc = 0;
var_str_1578.clear(); // was: str(225)
@@ -367,7 +384,35 @@ void FoolGame::sub_136_b00() {
}
void FoolGame::sub_136_2582() {
- warning("STUB: %s", __func__);
+ // 136:2582
+ var_i16_1df2 = 0;
+ var_i16_1e06 = g_zbasic->decodeInt(g_zbasic->leftStr(var_str_1ac8, 2));
+ for (int16 i = 1; i <= var_i16_1e06; i++) {
+ var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, i*2 + 3, 2));
+ if (arr_i16_3738[var_i16_484] & 0x1000) {
+ var_i16_1df2++;
+ arr_i16_5bbc[var_i16_1df2] = var_i16_484;
+ }
+ // 136:2602
+ }
+ var_i16_484 = arr_i16_5bbc[g_zbasic->rndInt(var_i16_1df2)];
+ arr_i16_3738[var_i16_484] |= 0x1000;
+}
+
+void FoolGame::sub_136_2664() {
+ // 136:2664
+ var_i16_1574 = arr_i16_2f38[var_i16_1bcc*32 + var_i16_1bce];
+ arr_i16_1eb8[24] = arr_rect_1f38[var_i16_1574].top + 4;
+ arr_i16_1eb8[25] = arr_rect_1f38[var_i16_1574].left + 4;
+ arr_i16_1eb8[26] = arr_rect_1f38[var_i16_1574].bottom - 4;
+ arr_i16_1eb8[27] = arr_rect_1f38[var_i16_1574].right - 4;
+ // 136:273e
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[24];
+ temp.left = arr_i16_1eb8[25];
+ temp.bottom = arr_i16_1eb8[26];
+ temp.right = arr_i16_1eb8[27];
+ g_toolbox->InvertOval(temp);
}
void FoolGame::sub_136_274e() {
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 38048fcb3c0..dc5f2920255 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -635,7 +635,6 @@ void ZBasic::sound(int16 frequency, int32 duration, int16 volume, int16 voice) {
// to program the 4-tone synthesizer.
// Without this, out of the box ZBasic seems to use
// square wave output.
- warning("STUB: ZBasic::unk_6: frequency %d, duration %d, volume %d, voice %d", frequency, duration, volume, voice);
SWSynthRec record;
if (frequency == 0)
return;
Commit: 942dbf93526ba7b7dbf7c0bc8b5086d1dafd6528
https://github.com/scummvm/scummvm/commit/942dbf93526ba7b7dbf7c0bc8b5086d1dafd6528
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:22+02:00
Commit Message:
FOOL: Archway completable
Changed paths:
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index c79e389304c..755207459c1 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -248,6 +248,33 @@ public:
void sub_136_a22();
void sub_136_ade();
void sub_136_b00();
+
+ void sub_136_d64();
+ void sub_136_e4c();
+ void sub_136_ed8();
+ void sub_136_f74();
+ void sub_136_115a();
+ void sub_136_137c();
+ void sub_136_163c();
+ void sub_136_1650();
+ void sub_136_1756();
+ void sub_136_17a4();
+ void sub_136_1806();
+ void sub_136_185a();
+ void sub_136_1898();
+ void sub_136_18f4();
+ void sub_136_1932();
+ void sub_136_19d2();
+ void sub_136_1cf4();
+ void sub_136_1ddc();
+ void sub_136_1df4();
+ void sub_136_1e4c();
+ void sub_136_21fa();
+ void sub_136_2200();
+
+ void sub_136_24ae();
+ void sub_136_2538();
+
void sub_136_2582();
void sub_136_2664();
void sub_136_274e();
@@ -565,7 +592,11 @@ private:
int16 var_i16_1bd8;
int16 var_i16_1bda;
int16 var_i16_1bdc;
- Common::U32String var_str_1bde;
+ Common::String var_str_1bde;
+
+ int16 var_i16_1cde;
+ int16 var_i16_1ce0;
+ Common::String var_str_1ce2;
int16 var_i16_1de4;
@@ -577,8 +608,11 @@ private:
PatternMode var_i16_1dee;
int16 var_i16_1df2;
+ int16 var_i16_1df4;
int16 var_i16_1e00;
+ int16 var_i16_1e02;
+ int16 var_i16_1e04;
int16 var_i16_1e06;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 8d783308bdb..f1de11d91bd 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -82,7 +82,7 @@ void FoolGame::mazeRun() {
Common::Rect playArea;
playArea.top = arr_rect_1f38[1].top + 3;
- playArea.left = arr_rect_1f38[0].top + 3;
+ playArea.left = arr_rect_1f38[1].left + 3;
playArea.bottom = arr_rect_1f38[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].bottom - 3;
playArea.right = arr_rect_1f38[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].right - 3;
g_toolbox->FillRect(playArea, arr_pat_58f4[2]);
@@ -90,7 +90,7 @@ void FoolGame::mazeRun() {
g_toolbox->PenSize(5, 5);
g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
// 136:042c
- var_i16_1ac4 = arr_i16_1eb8[1];
+ var_i16_1ac4 = arr_i16_1eb8[17];
var_i16_1574 = 0;
var_i16_68c = 1;
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
@@ -125,7 +125,7 @@ void FoolGame::mazeRun() {
for (int16 j = 1; j <= arr_i16_1eb8[23]; j++) {
var_str_1ac8 = g_zbasic->indexRaw(1, j);
var_i16_1bc8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, 3, 2));
- if (var_i16_1bc8 != 0x29a) {
+ if (var_i16_1bc8 != 666) {
for (int16 i = 1; i <= var_i16_1bc8; i++) {
sub_136_2582();
}
@@ -144,7 +144,7 @@ void FoolGame::mazeRun() {
var_str_1578.clear(); // was str(224)
sub_136_274e();
sub_136_ade();
- stateFlags = 0;
+ stateFlags = kStateNull;
sub_128_4da(1);
if (var_i16_1bcc == 0x19) {
var_i16_d0c = 1;
@@ -162,6 +162,9 @@ void FoolGame::mazeRun() {
if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
sub_136_79e();
}
+ if (var_i16_1bcc == 0x19) {
+ var_i16_d0c = 1;
+ }
}
// 136:074a
if (stateFlags == kStateSaveGame) {
@@ -307,7 +310,7 @@ void FoolGame::sub_136_a22() {
g_toolbox->PenNormal();
g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
- switch (var_i16_1bd6 - 1) {
+ switch (var_i16_1bd4 - 1) {
case 0:
sub_136_2d4c();
break;
@@ -377,19 +380,292 @@ void FoolGame::sub_136_b00() {
var_i16_1bd0 = var_i16_1574;
return;
}
- var_str_1ac8 = g_zbasic->index(1, arr_i16_3b38[var_i16_1bcc*32 + var_i16_1bce]);
- var_str_1bde = g_zbasic->str(226); // CILTDABRPXMOZSFQGWEJKV
+ var_str_1ac8 = g_zbasic->indexRaw(1, arr_i16_3b38[var_i16_1bcc*32 + var_i16_1bce]);
+ var_str_1bde = g_zbasic->strRaw(226); // CILTDABRPXMOZSFQGWEJKV
+ // 136:0bd0
+ var_i16_1cde = 1;
+ g_zbasic->unk_20();
+ while (var_i16_1cde > 0) {
+ // 136:0bde
+ var_i16_1cde = g_zbasic->instr(var_i16_1cde, var_str_1ac8, g_zbasic->strRaw(227)); // \xa5\xa5
+ if (var_i16_1cde > 0) {
+ var_i16_484 = 1;
+ for (int16 i = 1; i <= (int16)var_str_1bde.size(); i++) {
+ if (g_zbasic->midStr(var_str_1ac8, var_i16_1cde + 2, 1) == g_zbasic->midStr(var_str_1bde, i, 1)) {
+ var_i16_1a9a = i;
+ }
+ // 136:0c4c
+ }
+ // 136:0c5e
+ var_i16_1ce0 = g_zbasic->instr(var_i16_1cde, var_str_1ac8, g_zbasic->strRaw(228)); // <<
+ var_str_1ce2 = g_zbasic->midStr(var_str_1ac8, var_i16_1cde + 3, var_i16_1ce0 - var_i16_1cde - 3);
+ if (g_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == g_zbasic->strRaw(229)) {
+ // 136:0cdc
+ var_i16_1cde = 0;
+ } else {
+ var_i16_1cde = var_i16_1ce0;
+ }
+ // 136:0cec
+ switch (var_i16_1a9a - 1) {
+ case 0:
+ sub_136_d64();
+ break;
+ case 1:
+ sub_136_e4c();
+ break;
+ case 2:
+ sub_136_ed8();
+ break;
+ case 3:
+ sub_136_f74();
+ break;
+ case 4:
+ sub_136_115a();
+ break;
+ case 5:
+ sub_136_137c();
+ break;
+ case 6:
+ sub_136_163c();
+ break;
+ case 7:
+ sub_136_1650();
+ break;
+ case 8:
+ sub_136_1756();
+ break;
+ case 9:
+ sub_136_17a4();
+ break;
+ case 10:
+ sub_136_1806();
+ break;
+ case 11:
+ sub_136_185a();
+ break;
+ case 12:
+ sub_136_1898();
+ break;
+ case 13:
+ sub_136_18f4();
+ break;
+ case 14:
+ sub_136_1932();
+ break;
+ case 15:
+ sub_136_19d2();
+ break;
+ case 16:
+ sub_136_1cf4();
+ break;
+ case 17:
+ sub_136_1ddc();
+ break;
+ case 18:
+ sub_136_1df4();
+ break;
+ case 19:
+ sub_136_1e4c();
+ break;
+ case 20:
+ sub_136_21fa();
+ break;
+ case 21:
+ sub_136_2200();
+ break;
+ default:
+ warning("sub_136_b00: breaking out of switch statement");
+ break;
+ }
+ }
+ // 136:0d54
+ }
+ // 136:0d5c
+ var_i16_1bd0 = var_i16_1574;
+}
+
+void FoolGame::sub_136_d64() {
+ // 136:0d64
+ if (var_str_1ce2.decode(Common::kMacRoman) == var_str_1578) {
+ return;
+ }
+ fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
+ if (!var_str_1ce2.empty()) { // was: str(230)
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ var_i16_484 = g_toolbox->StringWidth(var_str_1ce2);
+ fillRect(0x13b, 0xf1 - (var_i16_484 / 2), 0x14f, 0x10f + (var_i16_484 / 2), 2);
+ var_i16_7a2 = 0x149;
+ sub_128_918(var_str_1ce2.decode(Common::kMacRoman));
+ }
+ // 136:0e3a
+ var_str_1578 = var_str_1ce2.decode(Common::kMacRoman);
+}
+
+void FoolGame::sub_136_e4c() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_ed8() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_f74() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_115a() {
+ warning("STUB: %s", __func__);
+}
+void FoolGame::sub_136_137c() {
warning("STUB: %s", __func__);
}
+void FoolGame::sub_136_163c() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1650() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1756() {
+ // 136:1756
+ var_i16_1bd8 = var_i16_1574;
+ var_i16_1bd4 = g_zbasic->decodeInt(var_str_1ce2);
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[2]);
+ g_toolbox->PenSize(5, 5);
+ switch (var_i16_1bd4-1) {
+ case 0:
+ sub_136_2d4c();
+ break;
+ case 1:
+ sub_136_2dd0();
+ break;
+ case 2:
+ sub_136_2e52();
+ break;
+ case 3:
+ sub_136_2ed6();
+ break;
+ default:
+ warning("sub_136_1756: broke out of switch statement");
+ break;
+ }
+}
+
+void FoolGame::sub_136_17a4() {
+ // 136:17a4
+ var_i16_1bd8 = var_i16_1574;
+ var_i16_1bd6 = g_zbasic->decodeInt(var_str_1ce2);
+ g_toolbox->PenNormal();
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenSize(5, 5);
+ switch (var_i16_1bd6-1) {
+ case 0:
+ sub_136_2d4c();
+ break;
+ case 1:
+ sub_136_2dd0();
+ break;
+ case 2:
+ sub_136_2e52();
+ break;
+ case 3:
+ sub_136_2ed6();
+ break;
+ default:
+ warning("sub_136_17a4: broke out of switch statement");
+ break;
+ }
+}
+
+void FoolGame::sub_136_1806() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_185a() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1898() {
+ // 136:1898
+ var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
+ if (arr_i16_3738[var_i16_484] & 0x1000) {
+ arr_i16_3738[var_i16_484] ^= 0x1000;
+ }
+}
+
+void FoolGame::sub_136_18f4() {
+ // 136:18f4
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_484 = 3;
+ sub_136_24ae();
+ for (var_i16_68a = 1; var_i16_68a <= var_i16_1de4; var_i16_68a++) {
+ sub_136_2538();
+ }
+}
+
+void FoolGame::sub_136_1932() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_19d2() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1cf4() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1ddc() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1df4() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_1e4c() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_21fa() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_2200() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_136_24ae() {
+ // 136:24ae
+ var_i16_1df4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
+ if (var_i16_1df4 > 0) {
+ var_i16_1e02 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484 + 2, 2));
+ var_i16_1372 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484 + 4, 2))*2;
+ var_i16_1e04 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484 + 6, 2));
+ }
+ // 136:2536
+}
+
+void FoolGame::sub_136_2538() {
+ // 136:2538
+ sub_128_50e(var_i16_1df4, var_i16_1372, 0);
+ if ((var_i16_1df4 > 0xe) && (var_i16_1df4 < 0x7d00)) {
+ var_i16_1df4 += var_i16_1e02;
+ }
+}
+
+
void FoolGame::sub_136_2582() {
// 136:2582
var_i16_1df2 = 0;
var_i16_1e06 = g_zbasic->decodeInt(g_zbasic->leftStr(var_str_1ac8, 2));
for (int16 i = 1; i <= var_i16_1e06; i++) {
var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, i*2 + 3, 2));
- if (arr_i16_3738[var_i16_484] & 0x1000) {
+ if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df2++;
arr_i16_5bbc[var_i16_1df2] = var_i16_484;
}
@@ -802,7 +1078,7 @@ void FoolGame::sub_136_3a70() {
arr_i16_4758[4] = 0x14;
}
- if (var_i16_68c == 0) {
+ if (j == 0) {
g_toolbox->InvertRect(temp);
} else {
// 136:3c48
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 01e861aa5be..14a6487e98e 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -226,6 +226,11 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
pm.drawEllipse(0, 0, destRect.width(), destRect.height(), fgColor, !frame, &pd);
+ byte fakePal[768];
+ Common::fill(fakePal, fakePal+3, 0xff);
+ Common::fill(fakePal+3, fakePal+768, 0x00);
+ mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
+
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
_addDirtyRect(dstRect);
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index dc5f2920255..8b5afea7836 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -251,6 +251,13 @@ int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Co
return (int16)(result + 1);
}
+int16 ZBasic::instr(int16 expression, const Common::String &string1, const Common::String &string2) {
+ uint32 result = string1.find(string2, (uint32)MAX<int16>(expression - 1, 0));
+ if (result == Common::String::npos)
+ return 0;
+ return (int16)(result + 1);
+}
+
Common::U32String ZBasic::files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume) {
warning("STUB: ZBasic::files");
return Common::U32String();
@@ -584,6 +591,10 @@ const Common::U32String &ZBasic::str(size_t index) {
return *_stringTable[index]->data.str;
}
+const Common::String ZBasic::strRaw(size_t index) {
+ return _stringTable[index]->data.str->encode(Common::kMacRoman);
+}
+
Common::U32String ZBasic::space(int16 count) {
Common::U32String result;
for (int i = 0; i < count; i++) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index bf823831cb7..b89564cb329 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -248,6 +248,7 @@ public:
void defOpen(const Common::U32String &str);
void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims = false);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
+ int16 instr(int16 expression, const Common::String &string1, const Common::String &string2);
Common::U32String files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume);
int finderInfo(int16 &count, Common::U32String &var, OSType &type, uint16 volume);
bool maybe();
@@ -288,6 +289,7 @@ public:
Common::U32String ucase(const Common::U32String &str);
const Common::U32String &str(size_t index);
+ const Common::String strRaw(size_t index);
void unk_4(); // possibly quit?
Commit: a23d1443a694e5406523c6858d8ea75ecf202502
https://github.com/scummvm/scummvm/commit/a23d1443a694e5406523c6858d8ea75ecf202502
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:22+02:00
Commit Message:
FOOL: Fix blend mode for oval draw routines
Changed paths:
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 14a6487e98e..806cf414eb4 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -226,12 +226,12 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
pm.drawEllipse(0, 0, destRect.width(), destRect.height(), fgColor, !frame, &pd);
- byte fakePal[768];
- Common::fill(fakePal, fakePal+3, 0xff);
- Common::fill(fakePal+3, fakePal+768, 0x00);
- mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
_addDirtyRect(dstRect);
}
}
@@ -603,6 +603,10 @@ void Toolbox::LineTo(int16 h, int16 v) {
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
_addDirtyRect(dstRect);
+ if (debugChannelSet(5, kDebugGraphics)) {
+ debugC(5, kDebugGraphics, "Toolbox::LineTo: startPos(%d, %d), endPos(%d, %d), dstRect (%d, %d) %dx%d, pattern %s, mode %d, fgColor %08x, bkColor %08x", _port->pnLoc.x, _port->pnLoc.y, h, v, dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), _port->pnPat.format().c_str(), _port->pnMode, _port->fgColor, _port->bkColor);
+ }
+
}
if (_port) {
// update polygon if we're in openPoly mode
Commit: 8cb802a46a5880e7f163f3c585bcc43cd6126cd1
https://github.com/scummvm/scummvm/commit/8cb802a46a5880e7f163f3c585bcc43cd6126cd1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:23+02:00
Commit Message:
FOOL: Add large chunk of metapuzzle
Changed paths:
A engines/fool/fool_metapuzzle.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/module.mk
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5e05a91bfc1..b7bcff21d83 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -3192,12 +3192,6 @@ void FoolGame::sub_129_123a() {
}
-
-void FoolGame::sub_138_004() {
- warning("STUB: %s", __func__);
-}
-
-
// hermit key trace
void FoolGame::hermitRun() {
// 142:12ac
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 755207459c1..e40bc20f308 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -242,8 +242,8 @@ public:
void sub_135_cee();
// fool_maze.cpp
- void mazeRun();
- void sub_136_79e();
+ void mazeRun(); // sub_136_004
+ void mazeOnClick(); // sub_136_79e
void sub_136_994();
void sub_136_a22();
void sub_136_ade();
@@ -257,8 +257,8 @@ public:
void sub_136_137c();
void sub_136_163c();
void sub_136_1650();
- void sub_136_1756();
- void sub_136_17a4();
+ void mazeHiddenDoorOpen(); // sub_136_1756
+ void mazeHiddenDoorShut(); // sub_136_17a4
void sub_136_1806();
void sub_136_185a();
void sub_136_1898();
@@ -271,6 +271,7 @@ public:
void sub_136_1e4c();
void sub_136_21fa();
void sub_136_2200();
+ void sub_136_2208();
void sub_136_24ae();
void sub_136_2538();
@@ -290,6 +291,7 @@ public:
void sub_136_3408();
void sub_136_342a();
void sub_136_3466();
+ void sub_136_3a30();
void sub_136_3a70();
// fool_sun.cpp
@@ -302,7 +304,21 @@ public:
void sunMapCheckIfSolved(); // sub_137_124e
void sunMapRevealPiece(); // sub_137_131a
+ // fool_metapuzzle.cpp
void sub_138_004();
+ void sub_138_1b4();
+ void sub_138_21e();
+ void sub_138_3e0();
+ void sub_138_49e();
+ void sub_138_550();
+ void sub_138_864();
+ void sub_138_9c4();
+ void sub_138_a22();
+ void sub_138_a90();
+ void sub_138_b06();
+ void sub_138_b6a();
+
+ void sub_143_004();
// fool_cards.cpp
void cardsRun(); // sub_139_004
@@ -363,6 +379,7 @@ public:
void deathCaught(); // sub_141_8b8
void deathDrawZoom(); // sub_141_934
+ // fool_humbug.cpp
void humbugRun(); // sub_142_004
void humbugTrail(); // sub_142_0e6
void sub_142_370();
@@ -502,6 +519,7 @@ private:
int16 var_i16_f2e;
Common::U32String var_str_f30;
int16 var_i16_1030;
+ PicHandle var_pic_1032;
int32 var_i32_1036;
int16 var_i16_103a;
int16 var_i16_103c;
@@ -564,6 +582,7 @@ private:
uint16 var_i16_1a9c;
int16 var_i16_1a9e;
int16 var_i16_1aa0;
+ int16 var_i16_1aa2;
int16 var_i16_1aa4;
int16 var_i16_1aa6;
int16 var_i16_1aa8;
@@ -604,8 +623,10 @@ private:
int16 var_i16_1de8;
int16 var_i16_1dea;
+ int16 var_i16_1dec;
PatternMode var_i16_1dee;
+ SourceMode var_src_1dee;
int16 var_i16_1df2;
int16 var_i16_1df4;
@@ -620,7 +641,10 @@ private:
uint16 var_i16_1f08;
int16 var_i16_1f0a;
+ Common::U32String var_str_1f0c;
+ int16 var_i16_200c;
+ int16 var_i16_200e;
int16 var_i16_2010;
int16 var_i16_2012;
int16 var_i16_2014;
@@ -663,7 +687,7 @@ private:
int16 puzzleType[101]; // arr_i16_18b2
int16 puzzleUnlockChapter[101]; // arr_i16_197c
int16 pageToChapter[101]; // arr_i16_1a46
- int16 arr_i16_1b10[6969];
+ int16 arr_i16_1b10[0x40];
int16 pageVisible[101]; // arr_i16_1b90
int16 puzzleCompletionStatus[101]; // arr_i16_1c5a
uint16 puzzleFlags[101]; // arr_i16_1d24
@@ -686,7 +710,7 @@ private:
PicHandle arr_pic_49d8[0x80];
int16 sunMapTileID[0x52]; // arr_i16_4bd8
int16 arr_i16_4c7c[0x52];
- int16 arr_i16_4d20[48];
+ int16 arr_i16_4d20[52];
Common::SharedPtr<Cursor> arr_curs_4d88[0x2b]; // 0x44
Pattern arr_pat_58f4[0x51];
Common::Rect arr_rect_5b7c;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index f1de11d91bd..473565e6cf8 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -160,7 +160,7 @@ void FoolGame::mazeRun() {
// 136:06fe
getNextEvent(-1);
if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
- sub_136_79e();
+ mazeOnClick();
}
if (var_i16_1bcc == 0x19) {
var_i16_d0c = 1;
@@ -180,7 +180,7 @@ void FoolGame::mazeRun() {
sub_136_2f5c();
}
-void FoolGame::sub_136_79e() {
+void FoolGame::mazeOnClick() {
// 136:079e
sub_128_2be(var_i16_68a, var_i16_68c);
if ((var_i16_68a == var_i16_1bcc) && (var_i16_68c == var_i16_1bce)) {
@@ -432,10 +432,10 @@ void FoolGame::sub_136_b00() {
sub_136_1650();
break;
case 8:
- sub_136_1756();
+ mazeHiddenDoorOpen();
break;
case 9:
- sub_136_17a4();
+ mazeHiddenDoorShut();
break;
case 10:
sub_136_1806();
@@ -510,11 +510,92 @@ void FoolGame::sub_136_ed8() {
}
void FoolGame::sub_136_f74() {
- warning("STUB: %s", __func__);
+ // 136:0f74
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(231)) { // L
+ var_i16_1de6 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_1de4 = g_zbasic->rndInt(var_i16_1de6);
+ var_i16_1de8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_1de4 * 2 + 2, 2));
+ var_i16_484 = var_i16_1de6 * 2 + 4;
+ sub_136_24ae();
+ }
+ // 136:0ffc
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(232)) { // A
+ var_i16_68a = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_68c = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 4, 2));
+ var_i16_1a96 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 6, 2));
+ var_i16_1a98 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 8, 2));
+ var_i16_68a += g_zbasic->rndInt(var_i16_1a96 + 1) - 1;
+ var_i16_68c += g_zbasic->rndInt(var_i16_1a98 + 1) - 1;
+ // 136:10bc
+ var_i16_1de8 = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
+ var_i16_484 = 0xa;
+ sub_136_24ae();
+ }
+ // 136:10ea
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[24];
+ temp.left = arr_i16_1eb8[25];
+ temp.bottom = arr_i16_1eb8[26];
+ temp.right = arr_i16_1eb8[27];
+ g_toolbox->InvertOval(temp);
+ var_i16_1dea = var_i16_1574;
+ var_i16_1dec = 2;
+ sub_136_2208();
+ // 136:1108
+ var_i16_1bcc = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
+ var_i16_1bce = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
+ sub_136_2664();
}
void FoolGame::sub_136_115a() {
- warning("STUB: %s", __func__);
+ // 136:115a
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(233)) { // P
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 4, 2));
+ if (var_i16_1dea == var_i16_1574) {
+ var_src_1dee = kSrcOr;
+ } else {
+ var_src_1dee = kSrcBic;
+ }
+ // 136:11ce
+ arr_i16_4338[var_i16_1dea] = var_i16_106e;
+ }
+ // 136:11e0
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(234)) { // E
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (var_i16_1dea < 0) {
+ var_i16_1dea = var_i16_1574;
+ }
+ var_i16_106e = arr_i16_4338[var_i16_1dea];
+ arr_i16_4338[var_i16_1dea] = 0;
+ if (var_i16_1dea == var_i16_1574) {
+ var_src_1dee = kSrcBic;
+ } else {
+ // 136:126a
+ var_src_1dee = kSrcOr;
+ }
+ }
+ // 136:1270
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(235)) { // C
+ var_i16_1dea = var_i16_1574;
+ var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (var_i16_1dea == var_i16_1574) {
+ var_src_1dee = kSrcOr;
+ } else {
+ // 136:12cc
+ var_src_1dee = kSrcBic;
+ }
+ // 136:12d2
+ arr_i16_4338[var_i16_1dea] = var_i16_106e;
+ }
+ // 136:12e4
+ g_zbasic->text(0xfb, 0xc, 0, var_src_1dee);
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1dea].left + arr_i16_1eb8[2],
+ arr_rect_1f38[var_i16_1dea].top + arr_i16_1eb8[3]
+ );
+ var_str_384 = g_zbasic->chr(var_i16_106e);
+ g_toolbox->DrawString(var_str_384);
}
void FoolGame::sub_136_137c() {
@@ -529,7 +610,7 @@ void FoolGame::sub_136_1650() {
warning("STUB: %s", __func__);
}
-void FoolGame::sub_136_1756() {
+void FoolGame::mazeHiddenDoorOpen() {
// 136:1756
var_i16_1bd8 = var_i16_1574;
var_i16_1bd4 = g_zbasic->decodeInt(var_str_1ce2);
@@ -550,12 +631,12 @@ void FoolGame::sub_136_1756() {
sub_136_2ed6();
break;
default:
- warning("sub_136_1756: broke out of switch statement");
+ warning("mazeHiddenDoorOpen: broke out of switch statement");
break;
}
}
-void FoolGame::sub_136_17a4() {
+void FoolGame::mazeHiddenDoorShut() {
// 136:17a4
var_i16_1bd8 = var_i16_1574;
var_i16_1bd6 = g_zbasic->decodeInt(var_str_1ce2);
@@ -576,7 +657,7 @@ void FoolGame::sub_136_17a4() {
sub_136_2ed6();
break;
default:
- warning("sub_136_17a4: broke out of switch statement");
+ warning("mazeHiddenDoorShut: broke out of switch statement");
break;
}
}
@@ -602,7 +683,7 @@ void FoolGame::sub_136_18f4() {
var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_484 = 3;
sub_136_24ae();
- for (var_i16_68a = 1; var_i16_68a <= var_i16_1de4; var_i16_68a++) {
+ for (int16 i = 1; i <= var_i16_1de4; i++) {
sub_136_2538();
}
}
@@ -632,11 +713,53 @@ void FoolGame::sub_136_1e4c() {
}
void FoolGame::sub_136_21fa() {
- warning("STUB: %s", __func__);
+ // 136:21fa
+ sub_128_6186();
}
void FoolGame::sub_136_2200() {
- warning("STUB: %s", __func__);
+ // 136:2200
+ var_i16_1bdc = 1;
+}
+
+void FoolGame::sub_136_2208() {
+ // 136:2208
+ // unrolled loop
+ arr_bcd_5dbc[4 + 0] = (arr_rect_1f38[var_i16_1de8].top - arr_rect_1f38[var_i16_1dea].top) / 25.0f;
+ arr_bcd_5dbc[4 + 1] = (arr_rect_1f38[var_i16_1de8].left - arr_rect_1f38[var_i16_1dea].left) / 25.0f;
+ arr_bcd_5dbc[4 + 2] = (arr_rect_1f38[var_i16_1de8].bottom - arr_rect_1f38[var_i16_1dea].bottom) / 25.0f;
+ arr_bcd_5dbc[4 + 3] = (arr_rect_1f38[var_i16_1de8].right - arr_rect_1f38[var_i16_1dea].right) / 25.0f;
+ // 136:229a
+ for (int16 k = 0; k <= 1; k++) {
+ // 136:22a0
+ arr_bcd_5dbc[0] = arr_rect_1f38[var_i16_1dea].top + 4.0f;
+ arr_bcd_5dbc[1] = arr_rect_1f38[var_i16_1dea].left + 4.0f;
+ arr_bcd_5dbc[2] = arr_rect_1f38[var_i16_1dea].bottom - 4.0f;
+ arr_bcd_5dbc[3] = arr_rect_1f38[var_i16_1dea].right - 4.0f;
+ for (int16 j = 1; j <= 0x19; j++) {
+ var_i32_692 = g_toolbox->TickCount();
+ for (int16 i = 0; i <= 3; i++) {
+ // 136:23c4
+ arr_bcd_5dbc[i] += arr_bcd_5dbc[i + 4];
+ arr_i16_4758[i] = (int16)arr_bcd_5dbc[i];
+ }
+ // 136:245a
+ Common::Rect temp;
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
+
+ if (var_i16_1dec == 1) {
+ g_toolbox->InvertRect(temp);
+ }
+ // 136:2472
+ if (var_i16_1dec == 2) {
+ g_toolbox->InvertOval(temp);
+ }
+ sub_128_406(0);
+ }
+ }
}
void FoolGame::sub_136_24ae() {
@@ -1032,10 +1155,62 @@ void FoolGame::sub_136_3466() {
var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
// 136:3766
var_i16_1f0a += 2;
- var_i16_68c = 1;
- var_i16_68a = 1;
+ for (var_i16_68c = 1; var_i16_68c <= arr_i16_1eb8[1]; var_i16_68c++) {
+ for (var_i16_68a = 1; var_i16_68a <= arr_i16_1eb8[0]; var_i16_68a++) {
+ var_i16_1574++;
+ if (arr_i16_1eb8[21] != 0) {
+ if (((arr_i16_3738[var_i16_1574] & 1) == 1) && ((arr_i16_3738[var_i16_1574] & 0x10) == 0)) {
+ if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ sub_136_2a7c();
+ }
+ sub_136_3a30();
+ }
+ // 136:380c
+ if (((arr_i16_3738[var_i16_1574] & 2) == 2) && ((arr_i16_3738[var_i16_1574] & 0x20) == 0)) {
+ if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ sub_136_2b30();
+ }
+ sub_136_3a30();
+ }
+ // 136:3886
+ if (((arr_i16_3738[var_i16_1574] & 4) == 0) && ((arr_i16_3738[var_i16_1574] & 0x40) == 0)) {
+ if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ sub_136_2be2();
+ }
+ sub_136_3a30();
+ }
+ // 136:3900
+ if (((arr_i16_3738[var_i16_1574] & 8) == 8) && ((arr_i16_3738[var_i16_1574] & 0x80) == 0)) {
+ if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ sub_136_2c96();
+ }
+ sub_136_3a30();
+ }
+ }
+ // 136:397c
+ if (arr_i16_3b38[var_i16_68a*32 + var_i16_68c] > 0) {
+ if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ arr_i16_3738[var_i16_1574] |= 0x1000;
+ }
+ // 136:39f2
+ sub_136_3a30();
+ }
+ // 136:39f6
+ }
+ }
+}
- warning("STUB: %s", __func__);
+void FoolGame::sub_136_3a30() {
+ // 136:3a30
+ var_i16_1de6++;
+ if (var_i16_1de6 > 0xf) {
+ var_i16_1de6 = 0;
+ }
+ if (var_i16_1de6 == 0) {
+ var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f0a += 2;
+ }
+ // 136:3a6e
}
void FoolGame::sub_136_3a70() {
@@ -1085,6 +1260,7 @@ void FoolGame::sub_136_3a70() {
g_toolbox->PaintRect(temp);
}
// 136:3c56
+ g_toolbox->Delay(0);
}
// 136:3c64
}
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
new file mode 100644
index 00000000000..c06b4cd72d5
--- /dev/null
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -0,0 +1,410 @@
+/* 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 "graphics/managed_surface.h"
+
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+// sun's map metapuzzle
+void FoolGame::sub_138_004() {
+ // 138:0004
+ if (sunMapRestored == 1) {
+ sunMapRestored = 666;
+ var_i32_7c8 = g_zbasic->mem(-1);
+ } else {
+ // 138:0024
+ var_i16_7ce |= 1;
+ copyScreen(0, arr_bmp_5dfc);
+ fillRect(0x127, 0x69, 0x138, 0x190, 0);
+ sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ fillRect(0x14, 0x67, SCREEN_HEIGHT, 0x1b1, 2);
+ var_i16_484 = 0;
+ for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
+ for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
+ var_i16_484++;
+ g_zbasic->picture(i, j, arr_i32_1912c[var_i16_484]);
+ }
+ }
+ }
+ // 138:00f6
+ g_toolbox->PenNormal();
+ g_toolbox->InitCursor();
+ copyScreen(0, arr_bmp_b3ec);
+ if (activePuzzle == 0) {
+ sub_138_3e0();
+ }
+ // 138:0116
+ stateFlags = 0;
+ keyLastPressed = 0;
+ while ((stateFlags & kStateReturn) == 0) {
+ // 138:0126
+ getNextEvent(-1);
+ if (var_ev_46.what == 1) {
+ sub_138_1b4();
+ }
+ if ((var_ev_46.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == 0) {
+ sub_138_b06();
+ }
+ if ((var_ev_46.modifiers & (kModLShiftKeyDown | kModMouseButtonUp)) == 0) {
+ sub_138_b6a();
+ }
+ if (activePuzzle != 0) {
+ sub_138_21e();
+ }
+ if (stateFlags == 4) {
+ saveGame();
+ }
+ if (keyLastPressed == 0x20) {
+ setStateBits(kStateReturn);
+ }
+ }
+ // JMP 0xe7c
+ // 138:0e7c
+ var_i16_c00 = 0;
+ if ((stateFlags & 0x800) == 0) {
+ var_menu_bf8 = g_toolbox->GetMHandle(8);
+ g_toolbox->DeleteMenu(8);
+ g_toolbox->DisposeMenu(var_menu_bf8);
+ g_toolbox->DrawMenuBar();
+ copyScreen(1, arr_bmp_5dfc);
+ if ((stateFlags & 0x38) == 0) {
+ if ((var_i16_7ce & 1) != 0) {
+ var_i16_7ce ^= 1;
+ }
+ // 138:0ef8
+ activePuzzle = 0;
+ if ((stateFlags & 0x40) == 0) {
+ storyRenderPage();
+ }
+ }
+ // 138:0f16
+ sub_128_61ec();
+ }
+ // 138:0f1a
+}
+
+void FoolGame::sub_138_1b4() {
+ // 138:01b4
+ var_i16_7e4 = 0;
+ activePuzzle = 0;
+ for (int16 i = 1; i <= 0xc; i++) {
+ Common::Rect temp;
+ temp.top = arr_i16_4d20[i*4];
+ temp.left = arr_i16_4d20[i*4+1];
+ temp.bottom = arr_i16_4d20[i*4+2];
+ temp.right = arr_i16_4d20[i*4+3];
+ if (g_toolbox->PtInRect(var_ev_46.where, temp) != 0) {
+ var_i16_7e4 = i;
+ }
+ // 138:01f8
+ }
+ if (var_i16_7e4 > 0) {
+ activePuzzle = var_i16_7e4 + 0x50;
+ }
+}
+
+void FoolGame::sub_138_21e() {
+ // 138:021e
+ int16 offset = activePuzzle - 0x50;
+ Common::Rect temp;
+ temp.top = arr_i16_4d20[offset*4];
+ temp.left = arr_i16_4d20[offset*4+1];
+ temp.bottom = arr_i16_4d20[offset*4+2];
+ temp.right = arr_i16_4d20[offset*4+3];
+ g_toolbox->InvertRect(temp);
+ puzzleLoadContext();
+ sub_128_3fb6();
+ sub_128_26f6();
+ sub_128_61ec();
+ if (activePuzzle == 0x55) {
+ fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x47);
+ }
+ // 138:0272
+ if ((activePuzzle >= 0x51) && (activePuzzle <= 0x55)) {
+ jumbleRun();
+ }
+ if (activePuzzle == 0x56) {
+ sub_143_004();
+ }
+ if (activePuzzle == 0x57) {
+ sub_128_962(arr_i16_4d20[28], arr_i16_4d20[0x1c+1], arr_i16_4d20[0x1c+2], arr_i16_4d20[0x1c+3], 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
+ mazeRun();
+ }
+ // 138:0334
+ if ((activePuzzle >= 0x58) && (activePuzzle <= 0x5b)) {
+ sub_138_550();
+ }
+ if (activePuzzle == 0x5c) {
+ sub_138_49e();
+ }
+ puzzleSaveContext();
+ if ((activePuzzle == 0x55) && (puzzleCompletionStatus[0x55] == 0x64)) {
+ stateFlags = 0x821;
+ }
+ if (stateFlags <= 1) {
+ stateFlags = 0;
+ activePuzzle = 0;
+ var_i16_c00 = 0;
+ g_toolbox->PenNormal();
+ copyScreen(1, arr_bmp_b3ec);
+ }
+ // 138:03da
+ sub_128_61ec();
+}
+
+void FoolGame::sub_138_3e0() {
+ // 138:03e0
+ g_zbasic->menu(8, 0, 1, g_zbasic->str(260)); // the sun's map
+ g_zbasic->menu(8, 1, 1, g_zbasic->str(261)); // return to scroll
+ g_zbasic->menu(8, 2, 0, g_zbasic->str(262)); // -
+ var_i16_484 = 2;
+ for (int16 i = arr_i16_1b10[0x30]; i <= arr_i16_1b10[0x30+1]; i++) {
+ var_i16_484++;
+ var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(263); // ' '
+ g_zbasic->menu(8, var_i16_484, 1, var_str_384);
+ }
+}
+
+void FoolGame::sub_138_49e() {
+ // 138:049e
+ for (int16 i = 1; i <= 2; i++) {
+ sub_128_962(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
+ }
+ g_zbasic->picture(6, 0x6d, var_pic_1032);
+ sub_128_2664();
+ sub_128_61c2();
+}
+
+void FoolGame::sub_138_550() {
+ // 138:0550
+ var_i16_c00 = 1;
+ for (int16 i = 1; i <= 2; i++) {
+ var_i16_68c = activePuzzle - 0x50;
+ sub_128_962(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
+ }
+ if (activePuzzle == 0x58) {
+ var_str_1170 = g_zbasic->str(264); // treasure name
+ var_i16_1aa2 = 8;
+ var_str_1f0c = g_zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
+ }
+ // 138:0650
+ if (activePuzzle == 0x59) {
+ var_str_1170 = g_zbasic->str(266); // treasure name
+ var_i16_1aa2 = 0;
+ var_str_1f0c = g_zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
+ }
+ // 138:068a
+ if (activePuzzle == 0x5a) {
+ var_str_1170 = g_zbasic->str(268); // treasure name
+ var_i16_1aa2 = 5;
+ var_str_1f0c = g_zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
+ }
+ // 138:06c4
+ if (activePuzzle == 0x5b) {
+ var_str_1170 = g_zbasic->str(270); // treasure name
+ var_i16_1aa2 = 5;
+ var_str_1f0c = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
+ }
+ // 138:06fe
+ arr_i16_1eb8[0] = 0x122;
+ arr_i16_1eb8[1] = 0;
+ arr_i16_1eb8[2] = SCREEN_HEIGHT;
+ arr_i16_1eb8[3] = SCREEN_WIDTH;
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[0];
+ temp.left = arr_i16_1eb8[1];
+ temp.bottom = arr_i16_1eb8[2];
+ temp.right = arr_i16_1eb8[3];
+ g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ if (activePuzzleBuffer.empty()) { // was: str(272)
+ sub_138_a22();
+ } else {
+ // 138:0778
+ var_str_1272 = activePuzzleBuffer;
+ var_i16_200c = 0;
+ var_i16_68a = 1;
+ for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
+ if (g_zbasic->midStr(var_str_1272, i, 1) != g_zbasic->str(273)) {
+ var_i16_200c++;
+ }
+ // 138:07c2
+ sub_138_9c4();
+ }
+ }
+ // 138:07d8
+ while ((stateFlags & kStateReturn) == 0) {
+ // 138:07dc
+ stateFlags = kStateNull;
+ keyLastPressed = 0;
+ while (stateFlags == kStateNull) {
+ // 138:07ec
+ getNextEvent(-1);
+ if (keyLastPressed > 0) {
+ sub_138_864();
+ keyLastPressed = 0;
+ }
+ if (var_str_1272 == var_str_1170) {
+ sub_138_a90();
+ }
+ // 138:081c
+ }
+ // 138:0822
+ if (stateFlags == kStateUndo) {
+ sub_138_a22();
+ }
+ activePuzzleBuffer = var_str_1272;
+ if (stateFlags == kStateSaveGame) {
+ saveGame();
+ }
+ }
+}
+
+void FoolGame::sub_138_864() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_138_9c4() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_138_a22() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_138_a90() {
+ warning("STUB: %s", __func__);
+}
+
+void FoolGame::sub_138_b06() {
+ // 138:0b06
+ var_i16_bfc++;
+ if ((var_i16_bfc < 0) || (var_i16_bfc > 0xc)) {
+ var_i16_bfc = 1;
+ }
+ Common::Rect temp;
+ temp.top = arr_i16_4d20[var_i16_bfc*4];
+ temp.left = arr_i16_4d20[var_i16_bfc*4+1];
+ temp.bottom = arr_i16_4d20[var_i16_bfc*4+2];
+ temp.right = arr_i16_4d20[var_i16_bfc*4+3];
+ g_toolbox->InvertRect(temp);
+ sub_128_3da(3);
+ g_toolbox->InvertRect(temp);
+}
+
+void FoolGame::sub_138_b6a() {
+ // 138:0b6a
+ if (!((var_ev_46.where.x >= 0x6e) && (var_ev_46.where.y >= 0x1a) && (var_ev_46.where.x <= 0x1a8) && (var_ev_46.where.y <= SCREEN_HEIGHT))) {
+ return;
+ }
+ var_i16_200e = 0;
+ while ((var_ev_46.modifiers & kModLShiftKeyDown) == 0) {
+ getNextEvent(-1); // was: 0
+ if ((var_ev_46.where.x >= 0x6e) && (var_ev_46.where.y >= 0x1a) && (var_ev_46.where.x <= 0x1a8) && (var_ev_46.where.y <= SCREEN_HEIGHT)) {
+ // 138:0c04
+ var_i16_68a = (var_ev_46.where.x - 0x6e)/0x23;
+ var_i16_68c = (var_ev_46.where.y - 0x1a)/0x23;
+ var_i16_1888 = var_i16_68c * 9 + var_i16_68a + 1;
+ selectedMenuChapter = arr_i16_4c7c[var_i16_1888];
+ if (var_i16_200e != selectedMenuChapter) {
+ if (var_i16_200e > 0) {
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[0];
+ temp.left = arr_i16_1eb8[1];
+ temp.bottom = arr_i16_1eb8[2];
+ temp.right = arr_i16_1eb8[3];
+ g_toolbox->InvertRect(temp);
+ }
+ // 138:0c8c
+ arr_i16_1eb8[0] = 0x1a + var_i16_68c * 0x23;
+ arr_i16_1eb8[1] = 0x6e + var_i16_68a * 0x23;
+ arr_i16_1eb8[2] = 0x3d + var_i16_68c * 0x23;
+ arr_i16_1eb8[3] = 0x91 + var_i16_68a * 0x23;
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[0];
+ temp.left = arr_i16_1eb8[1];
+ temp.bottom = arr_i16_1eb8[2];
+ temp.right = arr_i16_1eb8[3];
+ g_toolbox->InvertRect(temp);
+
+ // 138:0d36
+ g_toolbox->SetPort(var_i32_8);
+ fillRect(0, 7, 0x13, var_i16_5a - 7, 0);
+ if (selectedMenuChapter != 0x51) {
+ var_str_384 = arr_str_195e8[selectedMenuChapter];
+ } else {
+ // 138:0d8a
+ var_str_384 = g_zbasic->str(277); // the book of thoth
+ }
+ // 138:0d9e
+ g_zbasic->text(0, 0xc, 0, kSrcOr);
+ var_i16_30 = g_toolbox->StringWidth(var_str_384);
+ g_toolbox->MoveTo((var_i16_5a / 2) - (var_i16_30 / 2), 0xf);
+ g_toolbox->DrawString(var_str_384);
+ g_toolbox->SetPort(var_i32_0);
+ var_i16_200e = selectedMenuChapter;
+ }
+ // 138:0dfc
+ if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ if (selectedMenuChapter != 0x51) {
+ setStateBits(0x41);
+ return;
+ } else {
+ activePuzzle = 0x55;
+ return;
+ }
+ }
+ // 138:0e34
+ } else {
+ // 138:0e38
+ var_ev_46.modifiers = 0;
+ }
+ // 138:0e3e
+ }
+ // 138:0e50
+ if (var_i16_200e > 0) {
+ g_toolbox->DrawMenuBar();
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[0];
+ temp.left = arr_i16_1eb8[1];
+ temp.bottom = arr_i16_1eb8[2];
+ temp.right = arr_i16_1eb8[3];
+ g_toolbox->InvertRect(temp);
+ var_i16_200e = 0;
+ }
+ // 138:0e70
+ g_toolbox->SetPort(var_i32_0);
+ sub_128_61ec();
+}
+
+void FoolGame::sub_143_004() {
+ warning("STUB: %s", __func__);
+}
+
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index c36161ae86a..88df5427829 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
fool_jumble.o \
fool_justice.o \
fool_maze.o \
+ fool_metapuzzle.o \
fool_polyomino.o \
fool_prologue.o \
fool_reveal.o \
Commit: 4f3b69662db54eb023e7466ee293a064b8f14b02
https://github.com/scummvm/scummvm/commit/4f3b69662db54eb023e7466ee293a064b8f14b02
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:23+02:00
Commit Message:
FOOL: Fix uninitialised memory bugs
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index b9e4d1565b2..0ac81aee1d1 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -35,6 +35,9 @@ extern Toolbox *g_toolbox;
// wheel of fortune card game
void FoolGame::cardsRun() {
+ // missing zeroed state
+ var_i16_2016 = 0;
+
// 139:0004
this->sub_128_271a();
this->var_i16_c00 = 1;
@@ -75,7 +78,7 @@ void FoolGame::cardsRun() {
for (int i = 0; i <= 0x15; i++) {
this->var_i16_484 = g_zbasic->rndInt(0x16) - 1;
this->var_i16_7e4 = g_zbasic->rndInt(0x16) - 1;
- g_zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[this->var_i16_484]);
+ g_zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[this->var_i16_7e4]);
}
// 139:029c
for (int i = 0; i <= 0x15; i++) {
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index b7bcff21d83..8cd174e7a3b 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -54,6 +54,17 @@ void FoolGame::run() {
}
void FoolGame::sub_128_004() {
+ // zero out variables
+ storyCurrentChapter = 0;
+ sunMapRestored = 0;
+ menuDisabled = false;
+ menuHidesPlayfield = false;
+ // zero out pattern buffer; sub_129_123a uses entry
+ // 0 for filling the top bar
+ for (int i = 0; i <= 0x50; i++) {
+ Common::fill(arr_pat_58f4[i].data, arr_pat_58f4[i].data + 8, 0);
+ }
+
// Define the bitmap surfaces (normally pointers to raw memory)
this->arr_bmp_5dfc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
this->arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
@@ -198,8 +209,8 @@ void FoolGame::sub_128_004() {
if (this->stateFlags & kStatePuzzleSelect) {
this->puzzleRun();
}
- if (this->stateFlags & 0x100) {
- this->sub_138_004();
+ if (this->stateFlags & kStateMetapuzzleSelect) {
+ this->metapuzzleRun();
}
if (this->stateFlags & 0x400) {
this->sub_128_2b0a();
@@ -1513,7 +1524,7 @@ void FoolGame::sub_128_32c8() {
void FoolGame::savePrompt() {
// 128:32fa
- if (this->var_i16_7ce == 0x29a) {
+ if (this->var_i16_7ce == 666) {
return;
}
this->var_i16_7be = 0;
@@ -1541,7 +1552,7 @@ void FoolGame::savePrompt() {
void FoolGame::saveGame() {
// write save file
this->clearStateBits(kStateSaveGame);
- if (this->var_i16_7ce == 0x29a)
+ if (this->var_i16_7ce == 666)
return;
// 128:3548
if (this->var_str_8ec == g_zbasic->str(57)) { // empty
@@ -2451,40 +2462,40 @@ void FoolGame::sub_128_5a6c() {
void FoolGame::sub_128_5b30() {
// 128:5b30
- if (this->var_i16_e12 == 0) {
- this->var_ev_46.what = kNullEvent;
- if (this->var_i16_e14 != 0) {
- this->thothHidePlayfield();
- }
- this->var_i32_bf8 = g_toolbox->MenuSelect(this->var_ev_46.where);
- this->selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
- this->selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
- if (this->selectedMenuID > 0) {
- // 128:5b8c
- this->sub_128_5c20();
- g_toolbox->HiliteMenu(0);
- }
- // 128:5b94
- if (this->var_i16_e14 != 0) {
- this->thothShowPlayfield();
- }
- this->sub_128_61ec();
+ if (this->menuDisabled)
+ return;
+ this->var_ev_46.what = kNullEvent;
+ if (this->menuHidesPlayfield) {
+ this->thothHidePlayfield();
+ }
+ this->var_i32_bf8 = g_toolbox->MenuSelect(this->var_ev_46.where);
+ this->selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
+ this->selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
+ if (this->selectedMenuID > 0) {
+ // 128:5b8c
+ this->sub_128_5c20();
+ g_toolbox->HiliteMenu(0);
+ }
+ // 128:5b94
+ if (this->menuHidesPlayfield) {
+ this->thothShowPlayfield();
}
+ this->sub_128_61ec();
}
void FoolGame::sub_128_5baa() {
- if (this->var_i16_e12 != 0)
+ if (this->menuDisabled)
return;
this->var_i32_bf8 = g_toolbox->MenuKey((char)(this->var_ev_46.message & 0xff));
g_toolbox->Delay(0);
this->selectedMenuID = this->var_i32_bf8 >> 16;
this->selectedMenuItem = this->var_i32_bf8 & 0xffff;
if (this->selectedMenuID > 0) {
- if (this->var_i16_e14 != 0) {
+ if (this->menuHidesPlayfield) {
this->thothHidePlayfield();
}
this->sub_128_5c20();
- if (this->var_i16_e14 != 0) {
+ if (this->menuHidesPlayfield) {
this->thothShowPlayfield();
}
g_toolbox->HiliteMenu(0);
@@ -2725,7 +2736,7 @@ void FoolGame::sub_129_004() {
}
void FoolGame::sub_129_068() {
- this->var_i16_7ce = 0x29a;
+ this->var_i16_7ce = 666;
this->var_i16_372 = { 0, 0, 0 };
this->soundEnabled = 1;
this->var_i16_7a0 = 1;
@@ -2937,6 +2948,7 @@ void FoolGame::sub_129_068() {
for (int i = 0; i <= 1; i++) {
g_toolbox->ReleaseResource(this->arr_i32_192c0[i]);
}
+
// 129:091a
this->var_i32_692 = g_toolbox->TickCount();
this->var_i16_68a = 0x28;
@@ -3164,10 +3176,10 @@ void FoolGame::sub_129_068() {
// 129:11f6
if (g_zbasic->str(157) == this->var_str_8ec) { // empty
// cold start
- this->stateFlags = 8;
+ this->stateFlags = kStateNewGame;
} else {
// loading a save game
- this->stateFlags = 0x10;
+ this->stateFlags = kStateOpenGame;
this->var_str_588 = this->var_str_8ec;
this->var_i16_688 = this->var_i16_9ec;
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index e40bc20f308..8388719b9be 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -40,6 +40,7 @@ enum FoolStateBits : uint16 {
kStateQuit = 0x20,
kStateChapterSelect = 0x40,
kStatePuzzleSelect = 0x80,
+ kStateMetapuzzleSelect = 0x100,
};
enum FoolPuzzleFlags : uint16 {
@@ -249,10 +250,10 @@ public:
void sub_136_ade();
void sub_136_b00();
- void sub_136_d64();
+ void mazePrintMessage(); // sub_136_d64
void sub_136_e4c();
void sub_136_ed8();
- void sub_136_f74();
+ void mazeWanderingWinds(); // sub_136_f74
void sub_136_115a();
void sub_136_137c();
void sub_136_163c();
@@ -271,7 +272,7 @@ public:
void sub_136_1e4c();
void sub_136_21fa();
void sub_136_2200();
- void sub_136_2208();
+ void mazeMovementTrail(); // sub_136_2208
void sub_136_24ae();
void sub_136_2538();
@@ -283,7 +284,7 @@ public:
void sub_136_2b30();
void sub_136_2be2();
void sub_136_2c96();
- void sub_136_2d4c();
+ void sub_136_2d4c(); // sub_136_2d4c
void sub_136_2dd0();
void sub_136_2e52();
void sub_136_2ed6();
@@ -305,8 +306,8 @@ public:
void sunMapRevealPiece(); // sub_137_131a
// fool_metapuzzle.cpp
- void sub_138_004();
- void sub_138_1b4();
+ void metapuzzleRun(); // sub_138_004
+ void metapuzzleOnClick(); // sub_138_1b4
void sub_138_21e();
void sub_138_3e0();
void sub_138_49e();
@@ -503,8 +504,8 @@ private:
int16 var_i16_d0e;
int16 var_i16_d10;
Common::U32String var_str_d12;
- int16 var_i16_e12;
- int16 var_i16_e14;
+ bool menuDisabled; // var_i16_e12
+ bool menuHidesPlayfield; // var_i16_e14
int16 selectedMenuID; // var_i16_e16
int16 selectedMenuItem; // var_i16_e18
int16 var_i16_e1a;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 4080a2f3071..2077e9e061c 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -154,7 +154,7 @@ void FoolGame::jigsawOnClick() {
return;
}
// 132:059c
- this->var_i16_e12 = 1;
+ this->menuDisabled = true;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
@@ -182,7 +182,7 @@ void FoolGame::jigsawOnClick() {
this->jigsawCheckIfSolved();
this->sub_128_6186();
g_zbasic->menu(8, 3, 1, Common::U32String());
- this->var_i16_e12 = 0;
+ this->menuDisabled = false;
}
void FoolGame::jigsawDragSelect() {
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 473565e6cf8..5af115dbdde 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -338,7 +338,7 @@ void FoolGame::sub_136_a22() {
temp.left = arr_i16_1eb8[25];
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
- g_toolbox->InvertOval(temp);
+ g_toolbox->InvertOval(temp); // erase current spot
sub_136_2664();
var_i16_1bda = var_i16_1574;
sub_136_b00();
@@ -408,7 +408,7 @@ void FoolGame::sub_136_b00() {
// 136:0cec
switch (var_i16_1a9a - 1) {
case 0:
- sub_136_d64();
+ mazePrintMessage();
break;
case 1:
sub_136_e4c();
@@ -417,7 +417,7 @@ void FoolGame::sub_136_b00() {
sub_136_ed8();
break;
case 3:
- sub_136_f74();
+ mazeWanderingWinds();
break;
case 4:
sub_136_115a();
@@ -484,7 +484,7 @@ void FoolGame::sub_136_b00() {
var_i16_1bd0 = var_i16_1574;
}
-void FoolGame::sub_136_d64() {
+void FoolGame::mazePrintMessage() {
// 136:0d64
if (var_str_1ce2.decode(Common::kMacRoman) == var_str_1578) {
return;
@@ -509,7 +509,7 @@ void FoolGame::sub_136_ed8() {
warning("STUB: %s", __func__);
}
-void FoolGame::sub_136_f74() {
+void FoolGame::mazeWanderingWinds() {
// 136:0f74
if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(231)) { // L
var_i16_1de6 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
@@ -540,7 +540,7 @@ void FoolGame::sub_136_f74() {
g_toolbox->InvertOval(temp);
var_i16_1dea = var_i16_1574;
var_i16_1dec = 2;
- sub_136_2208();
+ mazeMovementTrail();
// 136:1108
var_i16_1bcc = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
var_i16_1bce = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
@@ -548,6 +548,7 @@ void FoolGame::sub_136_f74() {
}
void FoolGame::sub_136_115a() {
+ warning(__func__);
// 136:115a
if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(233)) { // P
var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
@@ -671,6 +672,7 @@ void FoolGame::sub_136_185a() {
}
void FoolGame::sub_136_1898() {
+ warning(__func__);
// 136:1898
var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
if (arr_i16_3738[var_i16_484] & 0x1000) {
@@ -679,6 +681,7 @@ void FoolGame::sub_136_1898() {
}
void FoolGame::sub_136_18f4() {
+ warning(__func__);
// 136:18f4
var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_484 = 3;
@@ -722,7 +725,7 @@ void FoolGame::sub_136_2200() {
var_i16_1bdc = 1;
}
-void FoolGame::sub_136_2208() {
+void FoolGame::mazeMovementTrail() {
// 136:2208
// unrolled loop
arr_bcd_5dbc[4 + 0] = (arr_rect_1f38[var_i16_1de8].top - arr_rect_1f38[var_i16_1dea].top) / 25.0f;
@@ -811,7 +814,7 @@ void FoolGame::sub_136_2664() {
temp.left = arr_i16_1eb8[25];
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
- g_toolbox->InvertOval(temp);
+ g_toolbox->InvertOval(temp); // draw new player pos
}
void FoolGame::sub_136_274e() {
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index c06b4cd72d5..e125260721c 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -32,7 +32,7 @@ extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// sun's map metapuzzle
-void FoolGame::sub_138_004() {
+void FoolGame::metapuzzleRun() {
// 138:0004
if (sunMapRestored == 1) {
sunMapRestored = 666;
@@ -66,7 +66,7 @@ void FoolGame::sub_138_004() {
// 138:0126
getNextEvent(-1);
if (var_ev_46.what == 1) {
- sub_138_1b4();
+ metapuzzleOnClick();
}
if ((var_ev_46.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == 0) {
sub_138_b06();
@@ -109,7 +109,7 @@ void FoolGame::sub_138_004() {
// 138:0f1a
}
-void FoolGame::sub_138_1b4() {
+void FoolGame::metapuzzleOnClick() {
// 138:01b4
var_i16_7e4 = 0;
activePuzzle = 0;
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index e7a7da90cac..70fb8a75679 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -134,7 +134,7 @@ void FoolGame::sunMapOnClick() {
return;
}
// 137:0466
- this->var_i16_e12 = 1;
+ this->menuDisabled = true;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
@@ -156,7 +156,7 @@ void FoolGame::sunMapOnClick() {
this->sunMapCheckIfSolved();
this->sub_128_6186();
g_zbasic->menu(8, 3, 1, Common::U32String());
- this->var_i16_e12 = 0;
+ this->menuDisabled = false;
}
void FoolGame::sunMapDragSelect() {
@@ -370,7 +370,7 @@ void FoolGame::sunMapRevealPiece() {
);
this->sub_128_6186();
this->sunMapCheckIfSolved();
- this->var_i16_e12 = 0;
+ this->menuDisabled = false;
}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 5cb0afb05b6..340ccc30679 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -39,9 +39,9 @@ void FoolGame::highPriestessRun() {
g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
}
if (this->var_i16_c04 == 0) {
- this->var_i16_e14 = 1;
+ this->menuHidesPlayfield = true;
this->thoth99Enchantments();
- this->var_i16_e14 = 0;
+ this->menuHidesPlayfield = false;
if (this->var_i16_d0c == 0) {
this->sub_140_3412();
return;
Commit: 465f9cedb280463476fc1d55763c6322243c5edf
https://github.com/scummvm/scummvm/commit/465f9cedb280463476fc1d55763c6322243c5edf
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:23+02:00
Commit Message:
FOOL: Ignore pen size for filled ovals/rects
Changed paths:
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 806cf414eb4..e4d4ace3c6f 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -217,12 +217,14 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
destPos.y += _port->portRect.top;
Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
+ // Only use a different pen size in frame mode, otherwise small filled shapes appear wrong
+ Common::Point penSize = frame ? _port->pnSize : Common::Point(1, 1);
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, penSize, bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
- destRect.right -= _port->pnSize.x - 1;
- destRect.bottom -= _port->pnSize.y - 1;
+ destRect.right -= penSize.x;
+ destRect.bottom -= penSize.y;
pm.drawEllipse(0, 0, destRect.width(), destRect.height(), fgColor, !frame, &pd);
@@ -320,12 +322,14 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
destPos.y += _port->portRect.top;
Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
+ // Only use a different pen size in frame mode, otherwise small filled shapes appear wrong
+ Common::Point penSize = frame ? _port->pnSize : Common::Point(1, 1);
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, penSize, bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
- destRect.right -= _port->pnSize.x - 1;
- destRect.bottom -= _port->pnSize.y - 1;
+ destRect.right -= penSize.x - 1;
+ destRect.bottom -= penSize.y - 1;
if (frame) {
pm.drawRect(destRect, fgColor, &pd);
@@ -357,12 +361,14 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
destPos.y += _port->portRect.top;
Graphics::MacPatterns macpat({pat.data});
- Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
+ // Only use a different pen size in frame mode, otherwise small filled shapes appear wrong
+ Common::Point penSize = frame ? _port->pnSize : Common::Point(1, 1);
+ Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, penSize, bkColor);
Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
- destRect.right -= _port->pnSize.x - 1;
- destRect.bottom -= _port->pnSize.y - 1;
+ destRect.right -= penSize.x - 1;
+ destRect.bottom -= penSize.y - 1;
if (ovalWidth != ovalHeight) {
warning("Toolbox::_drawRoundRect: different corner diameters not supported");
Commit: c56409021af1056faf6ae339ba74fae6f7fb827d
https://github.com/scummvm/scummvm/commit/c56409021af1056faf6ae339ba74fae6f7fb827d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:24+02:00
Commit Message:
FOOL: Clear state index on new game
Changed paths:
engines/fool/fool_game.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 8cd174e7a3b..5021168ae1f 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1383,7 +1383,7 @@ void FoolGame::newGame() {
// 128:2e02
}
// 128:2e14
- g_zbasic->unk_333(0x2);
+ g_zbasic->indexClear(0x2);
this->storyNextPage = 1;
this->var_i16_7ce = 0;
this->activePuzzle = 0;
@@ -1765,7 +1765,7 @@ void FoolGame::puzzleRun() {
g_toolbox->DrawMenuBar();
}
// 128:3aea
- g_zbasic->unk_333(1);
+ g_zbasic->indexClear(1);
if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x63) {
this->storyUnlockChapter();
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 8b5afea7836..31a21f0ee95 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -741,8 +741,10 @@ void ZBasic::unk_331(uint16 unk1, int16 unk2) {
warning("STUB: ZBasic::unk_331");
}
-void ZBasic::unk_333(uint16 unk1) {
- warning("STUB: ZBasic::unk_333");
+void ZBasic::indexClear(int16 table) {
+ if (_index.contains(table)) {
+ _index[table].clear();
+ }
}
void ZBasic::indexSet(const Common::U32String &value, int16 table, int16 index) {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index b89564cb329..a56257139a6 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -307,7 +307,7 @@ public:
void unk_158();
uint16 decodeInt(const Common::String &data);
void unk_331(uint16 unk1, int16 unk2);
- void unk_333(uint16 unk1);
+ void indexClear(int16 table);
void indexSet(const Common::U32String &value, int16 table, int16 index);
void indexRawSet(const Common::String &value, int16 table, int16 index);
Common::U32String index(int16 table, int16 index);
Commit: 26235071b2579a5c1bd359d14e6e27c61d214ff8
https://github.com/scummvm/scummvm/commit/26235071b2579a5c1bd359d14e6e27c61d214ff8
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:24+02:00
Commit Message:
FOOL: Fix metapuzzle hover feature
Changed paths:
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/toolbox.cpp
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 8388719b9be..0df92d477d4 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -278,7 +278,7 @@ public:
void sub_136_2538();
void sub_136_2582();
- void sub_136_2664();
+ void mazeDrawPlayer(); // sub_136_2664
void sub_136_274e();
void sub_136_2a7c();
void sub_136_2b30();
@@ -314,10 +314,11 @@ public:
void sub_138_550();
void sub_138_864();
void sub_138_9c4();
+ void sub_138_a06();
void sub_138_a22();
void sub_138_a90();
- void sub_138_b06();
- void sub_138_b6a();
+ void metapuzzleOnOption(); // sub_138_b06
+ void metapuzzleOnShift(); // sub_138_b6a
void sub_143_004();
@@ -618,6 +619,7 @@ private:
int16 var_i16_1ce0;
Common::String var_str_1ce2;
+ int16 var_i16_1de2;
int16 var_i16_1de4;
int16 var_i16_1de6;
@@ -626,6 +628,8 @@ private:
int16 var_i16_1dea;
int16 var_i16_1dec;
+ int16 var_i16_1df0;
+
PatternMode var_i16_1dee;
SourceMode var_src_1dee;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 5af115dbdde..6b1de6a60fd 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -339,7 +339,7 @@ void FoolGame::sub_136_a22() {
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
g_toolbox->InvertOval(temp); // erase current spot
- sub_136_2664();
+ mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
sub_136_b00();
} while (var_i16_1bda != var_i16_1574);
@@ -349,7 +349,7 @@ void FoolGame::sub_136_a22() {
void FoolGame::sub_136_ade() {
// 136:0ade
// this was done by a GOTO into the previous function, so we copy most of it here.
- sub_136_2664();
+ mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
sub_136_b00();
while (var_i16_1bda != var_i16_1574) {
@@ -362,13 +362,14 @@ void FoolGame::sub_136_ade() {
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
g_toolbox->InvertOval(temp);
- sub_136_2664();
+ mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
sub_136_b00();
};
}
void FoolGame::sub_136_b00() {
+ warning(__func__);
// 136:0b00
if (arr_i16_1eb8[22] | var_i16_1bdc) {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
@@ -502,11 +503,29 @@ void FoolGame::mazePrintMessage() {
}
void FoolGame::sub_136_e4c() {
- warning("STUB: %s", __func__);
+ // 136:0e4c
+ warning(__func__);
+ var_i16_1de2 = g_zbasic->decodeInt(var_str_1ce2);
+ arr_i16_5cbc[var_i16_1de2]++;
+ if (arr_i16_3738[var_i16_1574] & 0x1000) {
+ arr_i16_3738[var_i16_1574] ^= 0x1000;
+ }
+ // 136:0ed2
+ sub_136_274e();
}
void FoolGame::sub_136_ed8() {
- warning("STUB: %s", __func__);
+ warning(__func__);
+ // 136:0ed8
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de2 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
+ for (int16 i = 1; i <= var_i16_1de4; i++) {
+ arr_i16_5cbc[var_i16_1de2]--;
+ }
+ if (arr_i16_5cbc[var_i16_1de2] < 0) {
+ arr_i16_5cbc[var_i16_1de2] = 0;
+ }
+ sub_136_274e();
}
void FoolGame::mazeWanderingWinds() {
@@ -544,7 +563,7 @@ void FoolGame::mazeWanderingWinds() {
// 136:1108
var_i16_1bcc = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
var_i16_1bce = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
- sub_136_2664();
+ mazeDrawPlayer();
}
void FoolGame::sub_136_115a() {
@@ -600,7 +619,62 @@ void FoolGame::sub_136_115a() {
}
void FoolGame::sub_136_137c() {
- warning("STUB: %s", __func__);
+ warning(__func__);
+ // 136:137c
+ var_i16_1df0 = 0;
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(236)) { // I
+ var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (arr_i16_5cbc[var_i16_484] == 0) {
+ var_i16_1df0 = 1;
+ }
+ }
+ // 136:13d8
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(237)) { // M
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_1de2 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 4, 2));
+ if (arr_i16_5cbc[var_i16_1de2] < var_i16_1de4) {
+ var_i16_1df0 = 1;
+ }
+ }
+ // 136:144e
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(238)) { // B
+ var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
+ var_i16_1df0 = 1;
+ }
+ }
+ // 136:14b2
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(239)) { // L
+ // 136:14d6
+ var_i16_7e4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (arr_i16_4338[var_i16_484] != var_i16_7e4) {
+ var_i16_1df0 = 1;
+ }
+ }
+ // 136:1528
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(240)) { // S
+ var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_68a = 4;
+ for (int16 i = 4; i <= (2*var_i16_484 + 2); i += 2) {
+ var_i16_7e4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_68a, 2));
+ if (arr_i16_4338[var_i16_7e4] == 0) {
+ var_i16_1df0 = 1;
+ }
+ }
+ }
+ // 136:15c0
+ if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(241)) { // P
+ var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (var_i16_1bd0 != var_i16_484) {
+ var_i16_1df0 = 1;
+ }
+ }
+ // 136:1612
+ if (var_i16_1df0 != 0) {
+ var_i16_1cde = g_zbasic->instr(1, var_str_1ac8, g_zbasic->strRaw(242));
+ }
+ // 136:163a
+ return;
}
void FoolGame::sub_136_163c() {
@@ -692,10 +766,35 @@ void FoolGame::sub_136_18f4() {
}
void FoolGame::sub_136_1932() {
- warning("STUB: %s", __func__);
+ warning(__func__);
+ // 136:1932
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_484 = 3;
+ sub_136_24ae();
+ arr_i16_4758[0] = 0x14;
+ arr_i16_4758[1] = 0;
+ arr_i16_4758[2] = SCREEN_HEIGHT;
+ arr_i16_4758[3] = SCREEN_WIDTH;
+ for (var_i16_68a = 1; var_i16_68a <= var_i16_1de4; var_i16_68a++) {
+ Common::Rect temp;
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ if (var_i16_1df4 > 0) {
+ sub_136_2538();
+ }
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
+ g_toolbox->InvertRect(temp);
+ }
}
void FoolGame::sub_136_19d2() {
+ // 136:19d2
warning("STUB: %s", __func__);
}
@@ -766,6 +865,7 @@ void FoolGame::mazeMovementTrail() {
}
void FoolGame::sub_136_24ae() {
+ warning(__func__);
// 136:24ae
var_i16_1df4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
if (var_i16_1df4 > 0) {
@@ -777,6 +877,7 @@ void FoolGame::sub_136_24ae() {
}
void FoolGame::sub_136_2538() {
+ warning(__func__);
// 136:2538
sub_128_50e(var_i16_1df4, var_i16_1372, 0);
if ((var_i16_1df4 > 0xe) && (var_i16_1df4 < 0x7d00)) {
@@ -786,6 +887,7 @@ void FoolGame::sub_136_2538() {
void FoolGame::sub_136_2582() {
+ warning(__func__);
// 136:2582
var_i16_1df2 = 0;
var_i16_1e06 = g_zbasic->decodeInt(g_zbasic->leftStr(var_str_1ac8, 2));
@@ -801,7 +903,8 @@ void FoolGame::sub_136_2582() {
arr_i16_3738[var_i16_484] |= 0x1000;
}
-void FoolGame::sub_136_2664() {
+void FoolGame::mazeDrawPlayer() {
+ warning(__func__);
// 136:2664
var_i16_1574 = arr_i16_2f38[var_i16_1bcc*32 + var_i16_1bce];
arr_i16_1eb8[24] = arr_rect_1f38[var_i16_1574].top + 4;
@@ -818,6 +921,7 @@ void FoolGame::sub_136_2664() {
}
void FoolGame::sub_136_274e() {
+ warning(__func__);
// 136:274e
g_zbasic->menu(8, 0, 1, arr_str_195e8[activePuzzle]);
if (activePuzzle < 0x50) {
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index e125260721c..2066d01687a 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -68,11 +68,11 @@ void FoolGame::metapuzzleRun() {
if (var_ev_46.what == 1) {
metapuzzleOnClick();
}
- if ((var_ev_46.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == 0) {
- sub_138_b06();
+ if ((var_ev_46.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == (kModLOptionKeyDown | kModMouseButtonUp)) {
+ metapuzzleOnOption();
}
- if ((var_ev_46.modifiers & (kModLShiftKeyDown | kModMouseButtonUp)) == 0) {
- sub_138_b6a();
+ if ((var_ev_46.modifiers & (kModLShiftKeyDown | kModMouseButtonUp)) == (kModLShiftKeyDown | kModMouseButtonUp)) {
+ metapuzzleOnShift();
}
if (activePuzzle != 0) {
sub_138_21e();
@@ -286,22 +286,84 @@ void FoolGame::sub_138_550() {
}
void FoolGame::sub_138_864() {
- warning("STUB: %s", __func__);
+ warning(__func__);
+ // 138:0864
+ if ((keyLastPressed == 3) || (keyLastPressed == 0xd)) {
+ sub_138_a06();
+ return;
+ }
+ if ((keyLastPressed >= 0x61) && (keyLastPressed <= 0x7a)) {
+ keyLastPressed -= 0x20;
+ }
+ if ((keyLastPressed >= 0x41) && (keyLastPressed <= 0x5a)) {
+ return;
+ }
+ g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ var_i16_200c++;
+ if (var_i16_1aa2 == var_i16_200c) {
+ if (g_zbasic->leftStr(var_str_1170, var_i16_1aa2 - 1) == var_str_1272) {
+ var_str_1272 += g_zbasic->str(274); // ' '
+ }
+ }
+ // 138:0946
+ var_str_d12 = g_zbasic->midStr(var_str_1f0c, keyLastPressed - 0x40, 1);
+ var_str_1272 += var_str_d12;
+ var_i16_484 = g_toolbox->StringWidth(var_str_1272);
+ var_i16_7e4 = g_toolbox->StringWidth(var_str_1170);
+ if (var_i16_484 > var_i16_7e4) {
+ sub_138_a06();
+ } else {
+ sub_138_9c4();
+ }
}
void FoolGame::sub_138_9c4() {
- warning("STUB: %s", __func__);
+ // 138:09c4
+ g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[0];
+ temp.left = arr_i16_1eb8[1];
+ temp.bottom = arr_i16_1eb8[2];
+ temp.right = arr_i16_1eb8[3];
+ g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ var_i16_7a2 = 0x146;
+ sub_128_918(var_str_1272);
+}
+
+void FoolGame::sub_138_a06() {
+ // 138:0a06
+ sub_128_50e(0x19, 0x64, 1);
+ if (var_i16_200c == 0)
+ return;
+ sub_138_a22();
}
void FoolGame::sub_138_a22() {
- warning("STUB: %s", __func__);
+ // 138:0a22
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[0];
+ temp.left = arr_i16_1eb8[1];
+ temp.bottom = arr_i16_1eb8[2];
+ temp.right = arr_i16_1eb8[3];
+ g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ var_i16_7a2 = 0x140;
+ var_str_384 = g_zbasic->str(275); // if you know which is which, enter the letters you wish to switch
+ sub_128_918(var_str_384);
+ var_str_1272.clear(); // was: str(276)
+ var_i16_200c = 0;
}
void FoolGame::sub_138_a90() {
- warning("STUB: %s", __func__);
+ // 138:0a90
+ stateFlags = 1;
+ activePuzzleBuffer = var_str_1272;
+ sub_128_2664();
+ sub_128_6186();
+ sub_128_d34(arr_i16_1eb8[0], arr_i16_1eb8[1], arr_i16_1eb8[2], arr_i16_1eb8[3], 0xc8);
}
-void FoolGame::sub_138_b06() {
+void FoolGame::metapuzzleOnOption() {
// 138:0b06
var_i16_bfc++;
if ((var_i16_bfc < 0) || (var_i16_bfc > 0xc)) {
@@ -317,13 +379,13 @@ void FoolGame::sub_138_b06() {
g_toolbox->InvertRect(temp);
}
-void FoolGame::sub_138_b6a() {
+void FoolGame::metapuzzleOnShift() {
// 138:0b6a
if (!((var_ev_46.where.x >= 0x6e) && (var_ev_46.where.y >= 0x1a) && (var_ev_46.where.x <= 0x1a8) && (var_ev_46.where.y <= SCREEN_HEIGHT))) {
return;
}
var_i16_200e = 0;
- while ((var_ev_46.modifiers & kModLShiftKeyDown) == 0) {
+ while ((var_ev_46.modifiers & kModLShiftKeyDown) != 0) {
getNextEvent(-1); // was: 0
if ((var_ev_46.where.x >= 0x6e) && (var_ev_46.where.y >= 0x1a) && (var_ev_46.where.x <= 0x1a8) && (var_ev_46.where.y <= SCREEN_HEIGHT)) {
// 138:0c04
@@ -366,13 +428,14 @@ void FoolGame::sub_138_b6a() {
var_i16_30 = g_toolbox->StringWidth(var_str_384);
g_toolbox->MoveTo((var_i16_5a / 2) - (var_i16_30 / 2), 0xf);
g_toolbox->DrawString(var_str_384);
+ g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(var_i32_0);
var_i16_200e = selectedMenuChapter;
}
// 138:0dfc
if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
if (selectedMenuChapter != 0x51) {
- setStateBits(0x41);
+ setStateBits(kStateChapterSelect | kStateReturn);
return;
} else {
activePuzzle = 0x55;
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index cc471223803..b4aa8a73862 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -231,6 +231,11 @@ void Toolbox::_pumpEvents() {
} else {
_modifiers &= ~kModLControlKeyDown;
}
+ if (event.kbd.flags & Common::KBD_SHIFT) {
+ _modifiers |= kModLShiftKeyDown;
+ } else {
+ _modifiers &= ~kModLShiftKeyDown;
+ }
newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
break;
@@ -254,6 +259,11 @@ void Toolbox::_pumpEvents() {
} else {
_modifiers &= ~kModLControlKeyDown;
}
+ if (event.kbd.flags & Common::KBD_SHIFT) {
+ _modifiers |= kModLShiftKeyDown;
+ } else {
+ _modifiers &= ~kModLShiftKeyDown;
+ }
newRecord.modifiers = _modifiers;
_events.push_back(newRecord);
break;
Commit: b877fc79628c22aba0c68a8a932df6f7ca7179c4
https://github.com/scummvm/scummvm/commit/b877fc79628c22aba0c68a8a932df6f7ca7179c4
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:24+02:00
Commit Message:
FOOL: Add straight path challenge
Changed paths:
A engines/fool/fool_straightpath.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/module.mk
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5021168ae1f..8bd01205809 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -2968,9 +2968,12 @@ void FoolGame::sub_129_068() {
// 129:097c
this->var_i16_68a = 0x3c;
this->sub_129_123a();
+
// wadjet eye
this->var_pic_7c2 = g_toolbox->GetPicture(0x56);
g_toolbox->DetachResource(this->var_pic_7c2);
+ var_pic_1032 = g_toolbox->GetPicture(0xac);
+ g_toolbox->DetachResource(var_pic_1032);
// icon of a scroll
this->var_i32_c = g_toolbox->GetIcon(0x101);
g_toolbox->DetachResource(this->var_i32_c);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 0df92d477d4..33cd11cf2c6 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -310,17 +310,16 @@ public:
void metapuzzleOnClick(); // sub_138_1b4
void sub_138_21e();
void sub_138_3e0();
- void sub_138_49e();
- void sub_138_550();
- void sub_138_864();
+ void metapuzzleWheel(); // sub_138_49e
+ void metapuzzleSecretCode(); // sub_138_550
+ void metapuzzleSecretCodeDrawText(); // sub_138_864
void sub_138_9c4();
void sub_138_a06();
- void sub_138_a22();
+ void metapuzzleSecretCodeReset(); // sub_138_a22
void sub_138_a90();
void metapuzzleOnOption(); // sub_138_b06
void metapuzzleOnShift(); // sub_138_b6a
- void sub_143_004();
// fool_cards.cpp
void cardsRun(); // sub_139_004
@@ -400,6 +399,14 @@ public:
void hermitRun(); // sub_142_12ac
+ // fool_straightpath.cpp
+ void straightPathRun(); // sub_143_004
+ void straightPathOnClick(); // sub_143_5c0
+ void straightPathReset(); // sub_143_784
+ void straightPathDrawText(); // sub_143_864
+ void straightPathClearText(); // sub_143_890
+ void straightPathSuccess(); // sub_143_8b0
+
void sub_144_004();
private:
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 6b1de6a60fd..488a58abce6 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -678,7 +678,9 @@ void FoolGame::sub_136_137c() {
}
void FoolGame::sub_136_163c() {
- warning("STUB: %s", __func__);
+ // 136:163c
+ var_i16_1bd8 = var_i16_1574;
+ var_i16_1bd6 = g_zbasic->decodeInt(var_str_1ce2);
}
void FoolGame::sub_136_1650() {
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 2066d01687a..531616e2b1f 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -150,7 +150,7 @@ void FoolGame::sub_138_21e() {
jumbleRun();
}
if (activePuzzle == 0x56) {
- sub_143_004();
+ straightPathRun();
}
if (activePuzzle == 0x57) {
sub_128_962(arr_i16_4d20[28], arr_i16_4d20[0x1c+1], arr_i16_4d20[0x1c+2], arr_i16_4d20[0x1c+3], 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
@@ -158,10 +158,10 @@ void FoolGame::sub_138_21e() {
}
// 138:0334
if ((activePuzzle >= 0x58) && (activePuzzle <= 0x5b)) {
- sub_138_550();
+ metapuzzleSecretCode();
}
if (activePuzzle == 0x5c) {
- sub_138_49e();
+ metapuzzleWheel();
}
puzzleSaveContext();
if ((activePuzzle == 0x55) && (puzzleCompletionStatus[0x55] == 0x64)) {
@@ -191,7 +191,7 @@ void FoolGame::sub_138_3e0() {
}
}
-void FoolGame::sub_138_49e() {
+void FoolGame::metapuzzleWheel() {
// 138:049e
for (int16 i = 1; i <= 2; i++) {
sub_128_962(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
@@ -201,7 +201,7 @@ void FoolGame::sub_138_49e() {
sub_128_61c2();
}
-void FoolGame::sub_138_550() {
+void FoolGame::metapuzzleSecretCode() {
// 138:0550
var_i16_c00 = 1;
for (int16 i = 1; i <= 2; i++) {
@@ -228,7 +228,7 @@ void FoolGame::sub_138_550() {
// 138:06c4
if (activePuzzle == 0x5b) {
var_str_1170 = g_zbasic->str(270); // treasure name
- var_i16_1aa2 = 5;
+ var_i16_1aa2 = 9;
var_str_1f0c = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
}
// 138:06fe
@@ -243,7 +243,7 @@ void FoolGame::sub_138_550() {
temp.right = arr_i16_1eb8[3];
g_toolbox->FillRect(temp, arr_pat_58f4[2]);
if (activePuzzleBuffer.empty()) { // was: str(272)
- sub_138_a22();
+ metapuzzleSecretCodeReset();
} else {
// 138:0778
var_str_1272 = activePuzzleBuffer;
@@ -266,7 +266,7 @@ void FoolGame::sub_138_550() {
// 138:07ec
getNextEvent(-1);
if (keyLastPressed > 0) {
- sub_138_864();
+ metapuzzleSecretCodeDrawText();
keyLastPressed = 0;
}
if (var_str_1272 == var_str_1170) {
@@ -276,7 +276,7 @@ void FoolGame::sub_138_550() {
}
// 138:0822
if (stateFlags == kStateUndo) {
- sub_138_a22();
+ metapuzzleSecretCodeReset();
}
activePuzzleBuffer = var_str_1272;
if (stateFlags == kStateSaveGame) {
@@ -285,8 +285,7 @@ void FoolGame::sub_138_550() {
}
}
-void FoolGame::sub_138_864() {
- warning(__func__);
+void FoolGame::metapuzzleSecretCodeDrawText() {
// 138:0864
if ((keyLastPressed == 3) || (keyLastPressed == 0xd)) {
sub_138_a06();
@@ -295,7 +294,7 @@ void FoolGame::sub_138_864() {
if ((keyLastPressed >= 0x61) && (keyLastPressed <= 0x7a)) {
keyLastPressed -= 0x20;
}
- if ((keyLastPressed >= 0x41) && (keyLastPressed <= 0x5a)) {
+ if (!((keyLastPressed >= 0x41) && (keyLastPressed <= 0x5a))) {
return;
}
g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
@@ -335,10 +334,10 @@ void FoolGame::sub_138_a06() {
sub_128_50e(0x19, 0x64, 1);
if (var_i16_200c == 0)
return;
- sub_138_a22();
+ metapuzzleSecretCodeReset();
}
-void FoolGame::sub_138_a22() {
+void FoolGame::metapuzzleSecretCodeReset() {
// 138:0a22
Common::Rect temp;
temp.top = arr_i16_1eb8[0];
@@ -465,9 +464,4 @@ void FoolGame::metapuzzleOnShift() {
sub_128_61ec();
}
-void FoolGame::sub_143_004() {
- warning("STUB: %s", __func__);
-}
-
-
}
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
new file mode 100644
index 00000000000..70ba5fbe72a
--- /dev/null
+++ b/engines/fool/fool_straightpath.cpp
@@ -0,0 +1,219 @@
+/* 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 "graphics/managed_surface.h"
+
+#include "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+extern ZBasic *g_zbasic;
+extern Toolbox *g_toolbox;
+
+void FoolGame::straightPathRun() {
+ // 143:0004
+ sub_128_271a();
+ for (int16 i = 0; i <= 0xe; i++) {
+ arr_i16_1eb8[i] = puzzlesReadShort();
+ }
+ var_i16_484 = 0;
+ var_i16_68c = arr_i16_1eb8[8];
+ do {
+ var_i16_68a = arr_i16_1eb8[10];
+ do {
+ var_i16_484++;
+ g_toolbox->SetRect(
+ arr_rect_1f38[var_i16_484],
+ var_i16_68a,
+ var_i16_68c,
+ var_i16_68a + arr_i16_1eb8[13] - 1,
+ var_i16_68c + arr_i16_1eb8[12] - 1
+ );
+ } while (g_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
+ } while (g_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
+ // 143:0128
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ arr_i16_2f38[i*32 + j] = 0;
+ arr_i16_3b38[i*32 + j] = 0;
+ }
+ }
+ // 143:01a4
+ var_str_1272.clear(); // was: str(366)
+ arr_i16_1eb8[15] = puzzlesReadShort();
+ for (int16 i = 1; i <= arr_i16_1eb8[15]; i++) {
+ var_i16_1a96 = puzzlesReadByte();
+ var_i16_1a98 = puzzlesReadByte();
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
+ arr_i16_2f38[var_i16_1a96*32 + var_i16_1a98] = i;
+ arr_i16_3b38[var_i16_1a96*32 + var_i16_1a98] = g_zbasic->asc(g_zbasic->leftStr(g_zbasic->index(1, i), 1));
+ var_str_1272 += g_zbasic->index(1, i);
+ // 143:0276
+ }
+ g_zbasic->text(0xfb, arr_i16_1eb8[14], 0, kSrcOr);
+ g_zbasic->unk_20();
+ // 143:02b6
+ for (int16 j = 0; j <= arr_i16_1eb8[1]; j++) {
+ Common::Rect temp;
+ temp.top = arr_i16_1eb8[8] + arr_i16_1eb8[7] * (j - 1);
+ temp.left = 0;
+ temp.bottom = temp.top + arr_i16_1eb8[7] + 2;
+ temp.right = SCREEN_WIDTH;
+ g_toolbox->FillRect(temp, arr_pat_58f4[0]);
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
+ if (arr_i16_3b38[i*32 + j] == 0) {
+ // 143:03c4
+ arr_i16_3b38[i*32 + j] = g_zbasic->rndInt(0x1a) + 0x40;
+ }
+ // 143:03f0
+ g_toolbox->MoveTo(
+ arr_rect_1f38[var_i16_1574].left + arr_i16_1eb8[2] - 1,
+ arr_rect_1f38[var_i16_1574].top + arr_i16_1eb8[3]
+ );
+ var_str_384 = g_zbasic->chr(arr_i16_3b38[i*32 + j]);
+ g_toolbox->DrawString(var_str_384);
+ }
+ }
+ straightPathDrawText();
+ // 143:04cc
+ var_i16_1574 = 0;
+ stateFlags = kStateNull;
+ if (var_str_1272 == activePuzzleBuffer) {
+ var_i16_d0c = 1;
+ } else {
+ var_i16_d0c = 0;
+ }
+ // JMP 0x582
+ while (((stateFlags & kStateReturn) == 0) && (var_i16_d0c == 0)) {
+ // 143:0500
+ while ((stateFlags == kStateNull) && (var_i16_d0c == 0)) {
+ getNextEvent(-1);
+ if (var_ev_46.what == kMouseDown) {
+ straightPathOnClick();
+ }
+ if ((keyLastPressed == 3) || (keyLastPressed == 0xd)) {
+ straightPathReset();
+ }
+ if (var_str_1272 == activePuzzleBuffer) {
+ var_i16_d0c = 1;
+ }
+ }
+ // 143:0574
+ if (stateFlags == kStateSaveGame) {
+ saveGame();
+ }
+ }
+ // 143:05ac
+ if (var_i16_d0c != 0) {
+ straightPathSuccess();
+ }
+}
+
+void FoolGame::straightPathOnClick() {
+ // 143:05c0
+ sub_128_2be(var_i16_68a, var_i16_68c);
+ if (var_i16_1574 > 0) {
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ var_i16_1574 = 0;
+ }
+ // 143:05fc
+ if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1]))
+ return;
+ // 143:066c
+ var_i16_c04++;
+ if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] != var_i16_c04) {
+ activePuzzleBuffer += g_zbasic->chr(arr_i16_3b38[var_i16_68a*32 + var_i16_68c]);
+ } else {
+ // 143:06d8
+ activePuzzleBuffer += g_zbasic->indexRaw(1, var_i16_c04);
+ }
+ // 143:06fa
+ straightPathDrawText();
+ if (var_i16_c04 < arr_i16_1eb8[15]) {
+ var_i16_1574 = (var_i16_68c - 1)*arr_i16_1eb8[0] + var_i16_68a;
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ } else {
+ // 143:0766
+ if (activePuzzleBuffer != var_str_1272.encode(Common::kMacRoman)) {
+ straightPathReset();
+ }
+ }
+ // 143:077e
+ sub_128_6186();
+}
+
+void FoolGame::straightPathReset() {
+ // 143:0784
+ if (var_i16_1574 > 0) {
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ }
+ // 143:07a4
+ for (int16 i = 0; i <= 0x14; i++) {
+ var_i16_1574 = g_zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ sub_128_50e(g_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
+ // 143:0812
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ }
+ var_i16_c04 = 0;
+ activePuzzleBuffer.clear(); // was: str(367)
+ var_i16_1574 = 0;
+ keyLastPressed = 0;
+ straightPathClearText();
+}
+
+void FoolGame::straightPathDrawText() {
+ // 143:0864
+ straightPathClearText();
+ g_zbasic->text(0xfe, 0x18, 0x18, kSrcBic);
+ var_i16_7a2 = 0x148;
+ sub_128_918(activePuzzleBuffer);
+}
+
+void FoolGame::straightPathClearText() {
+ // 143:0890
+ fillRect(0x127, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+}
+
+void FoolGame::straightPathSuccess() {
+ // 143:08b0
+ g_toolbox->PenMode(kPatBic);
+ g_toolbox->PenPat(arr_pat_58f4[1]);
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ if (arr_i16_2f38[i*32 + j] == 0) {
+ var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
+ g_toolbox->PaintRect(arr_rect_1f38[var_i16_1574]);
+ }
+ // 143:0936
+ }
+ }
+ g_toolbox->PenNormal();
+ sub_128_2664();
+ sub_128_61c2();
+}
+
+
+}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index 88df5427829..c99cecececf 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -16,6 +16,7 @@ MODULE_OBJS = \
fool_prologue.o \
fool_reveal.o \
fool_sentence.o \
+ fool_straightpath.o \
fool_sun.o \
fool_thoth.o \
fool_wordsearch.o \
Commit: 1c1463ec19cf16c612af45fba7a70be03f295e1c
https://github.com/scummvm/scummvm/commit/1c1463ec19cf16c612af45fba7a70be03f295e1c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:25+02:00
Commit Message:
FOOL: Fix bugs in maze save code
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 8bd01205809..6f4238d1720 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1872,6 +1872,11 @@ void FoolGame::storyUnlockChapter() {
void FoolGame::sub_128_3fb6() {
// 128:3fb6
+ // new: delete existing menu 8
+ this->var_menu_bf8 = g_toolbox->GetMHandle(8);
+ g_toolbox->DeleteMenu(8);
+ g_toolbox->DisposeMenu(this->var_menu_bf8);
+
g_zbasic->menu(8, 0, 1, this->arr_str_195e8[this->activePuzzle]);
this->var_str_384 = g_zbasic->str(72); // return to scroll
if ((this->activePuzzle == 0x34) || (this->activePuzzle == 0x35)) {
@@ -2972,8 +2977,8 @@ void FoolGame::sub_129_068() {
// wadjet eye
this->var_pic_7c2 = g_toolbox->GetPicture(0x56);
g_toolbox->DetachResource(this->var_pic_7c2);
- var_pic_1032 = g_toolbox->GetPicture(0xac);
- g_toolbox->DetachResource(var_pic_1032);
+ metapuzzleWheelPic = g_toolbox->GetPicture(0xac);
+ g_toolbox->DetachResource(metapuzzleWheelPic);
// icon of a scroll
this->var_i32_c = g_toolbox->GetIcon(0x101);
g_toolbox->DetachResource(this->var_i32_c);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 33cd11cf2c6..afa14a948fd 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -245,10 +245,10 @@ public:
// fool_maze.cpp
void mazeRun(); // sub_136_004
void mazeOnClick(); // sub_136_79e
- void sub_136_994();
- void sub_136_a22();
+ void mazeFlashWall(); // sub_136_994
+ void mazeMovePlayer(); // sub_136_a22
void sub_136_ade();
- void sub_136_b00();
+ void mazeHotspot(); // sub_136_b00
void mazePrintMessage(); // sub_136_d64
void sub_136_e4c();
@@ -288,10 +288,10 @@ public:
void sub_136_2dd0();
void sub_136_2e52();
void sub_136_2ed6();
- void sub_136_2f5c();
+ void mazeStoreState(); // sub_136_2f5c
void sub_136_3408();
void sub_136_342a();
- void sub_136_3466();
+ void mazeLoadState(); // sub_136_3466
void sub_136_3a30();
void sub_136_3a70();
@@ -309,7 +309,7 @@ public:
void metapuzzleRun(); // sub_138_004
void metapuzzleOnClick(); // sub_138_1b4
void sub_138_21e();
- void sub_138_3e0();
+ void metapuzzleSetupMenu(); // sub_138_3e0
void metapuzzleWheel(); // sub_138_49e
void metapuzzleSecretCode(); // sub_138_550
void metapuzzleSecretCodeDrawText(); // sub_138_864
@@ -528,7 +528,7 @@ private:
int16 var_i16_f2e;
Common::U32String var_str_f30;
int16 var_i16_1030;
- PicHandle var_pic_1032;
+ PicHandle metapuzzleWheelPic; // var_pic_1032
int32 var_i32_1036;
int16 var_i16_103a;
int16 var_i16_103c;
@@ -591,7 +591,7 @@ private:
uint16 var_i16_1a9c;
int16 var_i16_1a9e;
int16 var_i16_1aa0;
- int16 var_i16_1aa2;
+ int16 metapuzzleSecretCodeSpaceOffset; // var_i16_1aa2
int16 var_i16_1aa4;
int16 var_i16_1aa6;
int16 var_i16_1aa8;
@@ -610,11 +610,11 @@ private:
Common::String var_str_1ac8;
int16 var_i16_1bc8;
- int16 var_i16_1bcc;
- int16 var_i16_1bce;
+ int16 mazePlayerX; // var_i16_1bcc
+ int16 mazePlayerY; // var_i16_1bce
int16 var_i16_1bd0;
- int16 var_i16_1bd2;
+ int16 mazePlayerDirection; // var_i16_1bd2
int16 var_i16_1bd4;
int16 var_i16_1bd6;
int16 var_i16_1bd8;
@@ -653,9 +653,9 @@ private:
uint16 var_i16_1f08;
int16 var_i16_1f0a;
- Common::U32String var_str_1f0c;
+ Common::U32String metapuzzleSecretCodeCipher; // var_str_1f0c
- int16 var_i16_200c;
+ int16 metapuzzleSecretCodeCount; // var_i16_200c
int16 var_i16_200e;
int16 var_i16_2010;
int16 var_i16_2012;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 488a58abce6..9e1594512f2 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -133,12 +133,12 @@ void FoolGame::mazeRun() {
// 136:0664
}
// 136:067e
- var_i16_1bcc = arr_i16_1eb8[15];
- var_i16_1bce = arr_i16_1eb8[16];
+ mazePlayerX = arr_i16_1eb8[15];
+ mazePlayerY = arr_i16_1eb8[16];
var_i16_1bd0 = 0;
} else {
// 136:06b0
- sub_136_3466();
+ mazeLoadState();
}
// 136:06b4
var_str_1578.clear(); // was str(224)
@@ -146,7 +146,7 @@ void FoolGame::mazeRun() {
sub_136_ade();
stateFlags = kStateNull;
sub_128_4da(1);
- if (var_i16_1bcc == 0x19) {
+ if (mazePlayerX == 0x19) {
var_i16_d0c = 1;
} else {
// 136:06f0
@@ -162,13 +162,13 @@ void FoolGame::mazeRun() {
if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
mazeOnClick();
}
- if (var_i16_1bcc == 0x19) {
+ if (mazePlayerX == 0x19) {
var_i16_d0c = 1;
}
}
// 136:074a
if (stateFlags == kStateSaveGame) {
- sub_136_2f5c();
+ mazeStoreState();
saveGame();
}
// 136:075c
@@ -177,70 +177,70 @@ void FoolGame::mazeRun() {
if (var_i16_d0c != 0) {
sub_136_3a70();
}
- sub_136_2f5c();
+ mazeStoreState();
}
void FoolGame::mazeOnClick() {
// 136:079e
sub_128_2be(var_i16_68a, var_i16_68c);
- if ((var_i16_68a == var_i16_1bcc) && (var_i16_68c == var_i16_1bce)) {
+ if ((var_i16_68a == mazePlayerX) && (var_i16_68c == mazePlayerY)) {
return;
}
// 136:07e2
- if (var_i16_1bce > var_i16_68c) {
- var_i16_1bd2 = 2;
+ if (mazePlayerY > var_i16_68c) {
+ mazePlayerDirection = 2;
}
- if (var_i16_1bcc > var_i16_68a) {
- var_i16_1bd2 = 1;
+ if (mazePlayerX > var_i16_68a) {
+ mazePlayerDirection = 1;
}
- if (var_i16_1bce < var_i16_68c) {
- var_i16_1bd2 = 4;
+ if (mazePlayerY < var_i16_68c) {
+ mazePlayerDirection = 4;
}
- if (var_i16_1bcc < var_i16_68a) {
- var_i16_1bd2 = 3;
+ if (mazePlayerX < var_i16_68a) {
+ mazePlayerDirection = 3;
}
- if (var_i16_1bd4 != var_i16_1bd2) {
- if ((var_i16_1bd2 == 1) && ((arr_i16_3738[var_i16_1574] & 1) == 1)) {
- sub_136_994();
+ if (var_i16_1bd4 != mazePlayerDirection) {
+ if ((mazePlayerDirection == 1) && ((arr_i16_3738[var_i16_1574] & 1) == 1)) {
+ mazeFlashWall();
return;
}
// 136:088a
- if ((var_i16_1bd2 == 2) && ((arr_i16_3738[var_i16_1574] & 2) == 2)) {
- sub_136_994();
+ if ((mazePlayerDirection == 2) && ((arr_i16_3738[var_i16_1574] & 2) == 2)) {
+ mazeFlashWall();
return;
}
- if ((var_i16_1bd2 == 3) && ((arr_i16_3738[var_i16_1574] & 4) == 4)) {
- sub_136_994();
+ if ((mazePlayerDirection == 3) && ((arr_i16_3738[var_i16_1574] & 4) == 4)) {
+ mazeFlashWall();
return;
}
- if ((var_i16_1bd2 == 4) && ((arr_i16_3738[var_i16_1574] & 8) == 8)) {
- sub_136_994();
+ if ((mazePlayerDirection == 4) && ((arr_i16_3738[var_i16_1574] & 8) == 8)) {
+ mazeFlashWall();
return;
}
// 136:0944
- if (var_i16_1bd6 == var_i16_1bd2) {
+ if (var_i16_1bd6 == mazePlayerDirection) {
return;
}
}
// 136:0956
- if (var_i16_1bd2 == 1)
- var_i16_1bcc--;
- if (var_i16_1bd2 == 2)
- var_i16_1bce--;
- if (var_i16_1bd2 == 3)
- var_i16_1bcc++;
- if (var_i16_1bd2 == 4)
- var_i16_1bce++;
- sub_136_a22();
+ if (mazePlayerDirection == 1)
+ mazePlayerX--;
+ if (mazePlayerDirection == 2)
+ mazePlayerY--;
+ if (mazePlayerDirection == 3)
+ mazePlayerX++;
+ if (mazePlayerDirection == 4)
+ mazePlayerY++;
+ mazeMovePlayer();
}
-void FoolGame::sub_136_994() {
+void FoolGame::mazeFlashWall() {
// 136:0994
g_toolbox->PenNormal();
g_toolbox->PenSize(5, 5);
if (arr_i16_1eb8[21] == 0) {
g_toolbox->PenMode(kPatXor);
- switch (var_i16_1bd2-1) {
+ switch (mazePlayerDirection-1) {
case 0:
sub_136_2a7c();
break;
@@ -254,15 +254,16 @@ void FoolGame::sub_136_994() {
sub_136_2c96();
break;
default:
- warning("sub_136_994: breaking out of switch");
+ warning("mazeFlashWall: breaking out of switch");
break;
}
+ g_toolbox->Delay(0);
} else {
// 136:09de
g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
}
// 136:0a00
- switch (var_i16_1bd2-1) {
+ switch (mazePlayerDirection-1) {
case 0:
sub_136_2a7c();
break;
@@ -276,12 +277,13 @@ void FoolGame::sub_136_994() {
sub_136_2c96();
break;
default:
- warning("sub_136_994: breaking out of switch");
+ warning("mazeFlashWall: breaking out of switch");
break;
}
+ g_toolbox->Delay(0);
}
-void FoolGame::sub_136_a22() {
+void FoolGame::mazeMovePlayer() {
// 136:0a22
if (var_i16_1bd6 != 0) {
g_toolbox->PenNormal();
@@ -301,7 +303,7 @@ void FoolGame::sub_136_a22() {
sub_136_2ed6();
break;
default:
- warning("sub_136_a22: breaking out of switch");
+ warning("mazeMovePlayer: breaking out of switch");
break;
}
}
@@ -324,7 +326,7 @@ void FoolGame::sub_136_a22() {
sub_136_2ed6();
break;
default:
- warning("sub_136_a22: breaking out of switch");
+ warning("mazeMovePlayer: breaking out of switch");
break;
}
}
@@ -341,7 +343,7 @@ void FoolGame::sub_136_a22() {
g_toolbox->InvertOval(temp); // erase current spot
mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
- sub_136_b00();
+ mazeHotspot();
} while (var_i16_1bda != var_i16_1574);
}
@@ -351,7 +353,7 @@ void FoolGame::sub_136_ade() {
// this was done by a GOTO into the previous function, so we copy most of it here.
mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
- sub_136_b00();
+ mazeHotspot();
while (var_i16_1bda != var_i16_1574) {
var_i16_1bd6 = 0;
var_i16_1bd4 = 0;
@@ -364,24 +366,27 @@ void FoolGame::sub_136_ade() {
g_toolbox->InvertOval(temp);
mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
- sub_136_b00();
+ mazeHotspot();
};
}
-void FoolGame::sub_136_b00() {
- warning(__func__);
+void FoolGame::mazeHotspot() {
// 136:0b00
- if (arr_i16_1eb8[22] | var_i16_1bdc) {
+ if (arr_i16_1eb8[22] || var_i16_1bdc) {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
var_i16_1bdc = 0;
var_str_1578.clear(); // was: str(225)
}
// 136:0b5e
- if ((arr_i16_3738[var_i16_1574] & 0x1000) == 0) {
+ if ((arr_i16_3738[var_i16_1574] & 0x1000) == 0) { // cell doesn't have hotspot flag
var_i16_1bd0 = var_i16_1574;
return;
}
- var_str_1ac8 = g_zbasic->indexRaw(1, arr_i16_3b38[var_i16_1bcc*32 + var_i16_1bce]);
+ var_str_1ac8 = g_zbasic->indexRaw(1, arr_i16_3b38[mazePlayerX*32 + mazePlayerY]);
+ debugC(5, kDebugLoading, "mazeHotspot: processing hotspot at (%d, %d)", mazePlayerX, mazePlayerY);
+ if (debugChannelSet(5, kDebugLoading)) {
+ Common::hexdump((const byte *)var_str_1ac8.c_str(), var_str_1ac8.size());
+ }
var_str_1bde = g_zbasic->strRaw(226); // CILTDABRPXMOZSFQGWEJKV
// 136:0bd0
var_i16_1cde = 1;
@@ -390,17 +395,18 @@ void FoolGame::sub_136_b00() {
// 136:0bde
var_i16_1cde = g_zbasic->instr(var_i16_1cde, var_str_1ac8, g_zbasic->strRaw(227)); // \xa5\xa5
if (var_i16_1cde > 0) {
- var_i16_484 = 1;
+ // get command ID
for (int16 i = 1; i <= (int16)var_str_1bde.size(); i++) {
if (g_zbasic->midStr(var_str_1ac8, var_i16_1cde + 2, 1) == g_zbasic->midStr(var_str_1bde, i, 1)) {
var_i16_1a9a = i;
}
// 136:0c4c
}
+
// 136:0c5e
var_i16_1ce0 = g_zbasic->instr(var_i16_1cde, var_str_1ac8, g_zbasic->strRaw(228)); // <<
var_str_1ce2 = g_zbasic->midStr(var_str_1ac8, var_i16_1cde + 3, var_i16_1ce0 - var_i16_1cde - 3);
- if (g_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == g_zbasic->strRaw(229)) {
+ if (g_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == g_zbasic->strRaw(229)) { // ||
// 136:0cdc
var_i16_1cde = 0;
} else {
@@ -408,74 +414,74 @@ void FoolGame::sub_136_b00() {
}
// 136:0cec
switch (var_i16_1a9a - 1) {
- case 0:
+ case 0: // C
mazePrintMessage();
break;
- case 1:
+ case 1: // I
sub_136_e4c();
break;
- case 2:
+ case 2: // L
sub_136_ed8();
break;
- case 3:
+ case 3: // T
mazeWanderingWinds();
break;
- case 4:
+ case 4: // D
sub_136_115a();
break;
- case 5:
+ case 5: // A
sub_136_137c();
break;
- case 6:
+ case 6: // B
sub_136_163c();
break;
- case 7:
+ case 7: // R
sub_136_1650();
break;
- case 8:
+ case 8: // P
mazeHiddenDoorOpen();
break;
- case 9:
+ case 9: // X
mazeHiddenDoorShut();
break;
- case 10:
+ case 10: // M
sub_136_1806();
break;
- case 11:
+ case 11: // O
sub_136_185a();
break;
- case 12:
+ case 12: // Z
sub_136_1898();
break;
- case 13:
+ case 13: // S
sub_136_18f4();
break;
- case 14:
+ case 14: // F
sub_136_1932();
break;
- case 15:
+ case 15: // Q
sub_136_19d2();
break;
- case 16:
+ case 16: // G
sub_136_1cf4();
break;
- case 17:
+ case 17: // W
sub_136_1ddc();
break;
- case 18:
+ case 18: // E
sub_136_1df4();
break;
- case 19:
+ case 19: // J
sub_136_1e4c();
break;
- case 20:
+ case 20: // K
sub_136_21fa();
break;
- case 21:
+ case 21: // V
sub_136_2200();
break;
default:
- warning("sub_136_b00: breaking out of switch statement");
+ warning("mazeHotspot: breaking out of switch statement");
break;
}
}
@@ -561,8 +567,8 @@ void FoolGame::mazeWanderingWinds() {
var_i16_1dec = 2;
mazeMovementTrail();
// 136:1108
- var_i16_1bcc = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
- var_i16_1bce = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
+ mazePlayerX = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
+ mazePlayerY = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
mazeDrawPlayer();
}
@@ -671,7 +677,7 @@ void FoolGame::sub_136_137c() {
}
// 136:1612
if (var_i16_1df0 != 0) {
- var_i16_1cde = g_zbasic->instr(1, var_str_1ac8, g_zbasic->strRaw(242));
+ var_i16_1cde = g_zbasic->instr(1, var_str_1ac8, g_zbasic->strRaw(242)); // ||
}
// 136:163a
return;
@@ -908,7 +914,7 @@ void FoolGame::sub_136_2582() {
void FoolGame::mazeDrawPlayer() {
warning(__func__);
// 136:2664
- var_i16_1574 = arr_i16_2f38[var_i16_1bcc*32 + var_i16_1bce];
+ var_i16_1574 = arr_i16_2f38[mazePlayerX*32 + mazePlayerY];
arr_i16_1eb8[24] = arr_rect_1f38[var_i16_1574].top + 4;
arr_i16_1eb8[25] = arr_rect_1f38[var_i16_1574].left + 4;
arr_i16_1eb8[26] = arr_rect_1f38[var_i16_1574].bottom - 4;
@@ -1076,14 +1082,14 @@ void FoolGame::sub_136_2ed6() {
);
}
-void FoolGame::sub_136_2f5c() {
+void FoolGame::mazeStoreState() {
// 136:2f5c
- if ((activePuzzle != 0x57) && (var_i16_d0c == 0)) {
+ if (!((activePuzzle != 0x57) && (var_i16_d0c == 0))) {
activePuzzleBuffer.clear(); // was: str(258)
return;
}
- activePuzzleBuffer = g_zbasic->encodeInt(var_i16_1bcc) +
- g_zbasic->encodeInt(var_i16_1bce) +
+ activePuzzleBuffer = g_zbasic->encodeInt(mazePlayerX) +
+ g_zbasic->encodeInt(mazePlayerY) +
g_zbasic->encodeInt(var_i16_1bd0) +
g_zbasic->encodeInt(var_i16_1bd6) +
g_zbasic->encodeInt(var_i16_1bd4) +
@@ -1156,6 +1162,7 @@ void FoolGame::sub_136_2f5c() {
}
}
// 136:33e8
+ debugC(5, kDebugLoading, "mazeStoreState: added mask %04x", var_i16_1f08);
activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
}
@@ -1168,6 +1175,7 @@ void FoolGame::sub_136_342a() {
// 136:342a
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
+ debugC(5, kDebugLoading, "sub_136_342a: added mask %04x", var_i16_1f08);
activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
var_i16_1f08 = 0;
var_i16_1de6 = 0;
@@ -1175,10 +1183,10 @@ void FoolGame::sub_136_342a() {
// 136:3464
}
-void FoolGame::sub_136_3466() {
+void FoolGame::mazeLoadState() {
// 136:3466
- var_i16_1bcc = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 1, 2));
- var_i16_1bce = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 3, 2));
+ mazePlayerX = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 1, 2));
+ mazePlayerY = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 3, 2));
var_i16_1bd0 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 5, 2));
var_i16_1bd6 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 7, 2));
var_i16_1bd4 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 9, 2));
@@ -1202,7 +1210,7 @@ void FoolGame::sub_136_3466() {
sub_136_2ed6();
break;
default:
- warning("sub_136_3466: breaking out of switch");
+ warning("mazeLoadState: breaking out of switch");
break;
}
}
@@ -1225,14 +1233,18 @@ void FoolGame::sub_136_3466() {
sub_136_2ed6();
break;
default:
- warning("sub_136_3466: breaking out of switch");
+ warning("mazeLoadState: breaking out of switch");
break;
}
}
// 136:3592
var_i16_1f0a = 0xd;
- var_i16_68a = 1;
- arr_i16_5cbc[var_i16_68a] = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
+ arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f0a += 2;
+ }
+ // 136:35ec
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
if (var_i16_1de4 > 0) {
g_zbasic->text(0xfb, 0xc, 0, kSrcBic);
@@ -1263,9 +1275,10 @@ void FoolGame::sub_136_3466() {
var_i16_1de6 = 0;
var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
// 136:3766
+ debugC(5, kDebugLoading, "mazeLoadState: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
- for (var_i16_68c = 1; var_i16_68c <= arr_i16_1eb8[1]; var_i16_68c++) {
- for (var_i16_68a = 1; var_i16_68a <= arr_i16_1eb8[0]; var_i16_68a++) {
+ for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
var_i16_1574++;
if (arr_i16_1eb8[21] != 0) {
if (((arr_i16_3738[var_i16_1574] & 1) == 1) && ((arr_i16_3738[var_i16_1574] & 0x10) == 0)) {
@@ -1282,7 +1295,7 @@ void FoolGame::sub_136_3466() {
sub_136_3a30();
}
// 136:3886
- if (((arr_i16_3738[var_i16_1574] & 4) == 0) && ((arr_i16_3738[var_i16_1574] & 0x40) == 0)) {
+ if (((arr_i16_3738[var_i16_1574] & 4) == 4) && ((arr_i16_3738[var_i16_1574] & 0x40) == 0)) {
if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
sub_136_2be2();
}
@@ -1297,7 +1310,7 @@ void FoolGame::sub_136_3466() {
}
}
// 136:397c
- if (arr_i16_3b38[var_i16_68a*32 + var_i16_68c] > 0) {
+ if (arr_i16_3b38[i*32 + j] > 0) {
if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
arr_i16_3738[var_i16_1574] |= 0x1000;
}
@@ -1317,6 +1330,7 @@ void FoolGame::sub_136_3a30() {
}
if (var_i16_1de6 == 0) {
var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ debugC(5, kDebugLoading, "sub_136_3a80: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
}
// 136:3a6e
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 531616e2b1f..b354da499e0 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -57,7 +57,7 @@ void FoolGame::metapuzzleRun() {
g_toolbox->InitCursor();
copyScreen(0, arr_bmp_b3ec);
if (activePuzzle == 0) {
- sub_138_3e0();
+ metapuzzleSetupMenu();
}
// 138:0116
stateFlags = 0;
@@ -173,12 +173,13 @@ void FoolGame::sub_138_21e() {
var_i16_c00 = 0;
g_toolbox->PenNormal();
copyScreen(1, arr_bmp_b3ec);
+ metapuzzleSetupMenu();
}
// 138:03da
sub_128_61ec();
}
-void FoolGame::sub_138_3e0() {
+void FoolGame::metapuzzleSetupMenu() {
// 138:03e0
g_zbasic->menu(8, 0, 1, g_zbasic->str(260)); // the sun's map
g_zbasic->menu(8, 1, 1, g_zbasic->str(261)); // return to scroll
@@ -196,7 +197,7 @@ void FoolGame::metapuzzleWheel() {
for (int16 i = 1; i <= 2; i++) {
sub_128_962(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
}
- g_zbasic->picture(6, 0x6d, var_pic_1032);
+ g_zbasic->picture(6, 0x6d, metapuzzleWheelPic);
sub_128_2664();
sub_128_61c2();
}
@@ -210,26 +211,26 @@ void FoolGame::metapuzzleSecretCode() {
}
if (activePuzzle == 0x58) {
var_str_1170 = g_zbasic->str(264); // treasure name
- var_i16_1aa2 = 8;
- var_str_1f0c = g_zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
+ metapuzzleSecretCodeSpaceOffset = 8;
+ metapuzzleSecretCodeCipher = g_zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
}
// 138:0650
if (activePuzzle == 0x59) {
var_str_1170 = g_zbasic->str(266); // treasure name
- var_i16_1aa2 = 0;
- var_str_1f0c = g_zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
+ metapuzzleSecretCodeSpaceOffset = 0;
+ metapuzzleSecretCodeCipher = g_zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
}
// 138:068a
if (activePuzzle == 0x5a) {
var_str_1170 = g_zbasic->str(268); // treasure name
- var_i16_1aa2 = 5;
- var_str_1f0c = g_zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
+ metapuzzleSecretCodeSpaceOffset = 5;
+ metapuzzleSecretCodeCipher = g_zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
}
// 138:06c4
if (activePuzzle == 0x5b) {
var_str_1170 = g_zbasic->str(270); // treasure name
- var_i16_1aa2 = 9;
- var_str_1f0c = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
+ metapuzzleSecretCodeSpaceOffset = 9;
+ metapuzzleSecretCodeCipher = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
}
// 138:06fe
arr_i16_1eb8[0] = 0x122;
@@ -247,11 +248,11 @@ void FoolGame::metapuzzleSecretCode() {
} else {
// 138:0778
var_str_1272 = activePuzzleBuffer;
- var_i16_200c = 0;
+ metapuzzleSecretCodeCount = 0;
var_i16_68a = 1;
for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
if (g_zbasic->midStr(var_str_1272, i, 1) != g_zbasic->str(273)) {
- var_i16_200c++;
+ metapuzzleSecretCodeCount++;
}
// 138:07c2
sub_138_9c4();
@@ -298,14 +299,14 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
return;
}
g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
- var_i16_200c++;
- if (var_i16_1aa2 == var_i16_200c) {
- if (g_zbasic->leftStr(var_str_1170, var_i16_1aa2 - 1) == var_str_1272) {
+ metapuzzleSecretCodeCount++;
+ if (metapuzzleSecretCodeSpaceOffset == metapuzzleSecretCodeCount) {
+ if (g_zbasic->leftStr(var_str_1170, metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
var_str_1272 += g_zbasic->str(274); // ' '
}
}
// 138:0946
- var_str_d12 = g_zbasic->midStr(var_str_1f0c, keyLastPressed - 0x40, 1);
+ var_str_d12 = g_zbasic->midStr(metapuzzleSecretCodeCipher, keyLastPressed - 0x40, 1);
var_str_1272 += var_str_d12;
var_i16_484 = g_toolbox->StringWidth(var_str_1272);
var_i16_7e4 = g_toolbox->StringWidth(var_str_1170);
@@ -332,7 +333,7 @@ void FoolGame::sub_138_9c4() {
void FoolGame::sub_138_a06() {
// 138:0a06
sub_128_50e(0x19, 0x64, 1);
- if (var_i16_200c == 0)
+ if (metapuzzleSecretCodeCount == 0)
return;
metapuzzleSecretCodeReset();
}
@@ -350,7 +351,7 @@ void FoolGame::metapuzzleSecretCodeReset() {
var_str_384 = g_zbasic->str(275); // if you know which is which, enter the letters you wish to switch
sub_128_918(var_str_384);
var_str_1272.clear(); // was: str(276)
- var_i16_200c = 0;
+ metapuzzleSecretCodeCount = 0;
}
void FoolGame::sub_138_a90() {
Commit: d4ba34e541913371d854089296ea8ea972d2354c
https://github.com/scummvm/scummvm/commit/d4ba34e541913371d854089296ea8ea972d2354c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:25+02:00
Commit Message:
FOOL: Change autosave to use dedicated file
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 0ac81aee1d1..66d0abde71e 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -286,7 +286,7 @@ void FoolGame::cardsOnClick() {
if (this->var_ev_46.what == kMouseUp) {
this->var_i16_2014 = 1;
}
- if (this->stateFlags == 4) {
+ if (this->stateFlags == kStateSaveGame) {
this->cardsStoreState();
this->saveGame();
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 6f4238d1720..88edfe6e895 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -59,6 +59,7 @@ void FoolGame::sub_128_004() {
sunMapRestored = 0;
menuDisabled = false;
menuHidesPlayfield = false;
+ isAutoSaving = false;
// zero out pattern buffer; sub_129_123a uses entry
// 0 for filling the top bar
for (int i = 0; i <= 0x50; i++) {
@@ -215,7 +216,7 @@ void FoolGame::sub_128_004() {
if (this->stateFlags & 0x400) {
this->sub_128_2b0a();
}
- if (this->stateFlags & 0x800) {
+ if (this->stateFlags & kStateMetapuzzleComplete) {
this->sub_144_004();
}
// 128:1ee2
@@ -245,10 +246,8 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
}
}
-void FoolGame::sub_128_11c(const Common::U32String &unk2, const Common::U32String &unk1) {
+void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::U32String &filename) {
// 128:011c
- g_zbasic->stringCopy(this->var_str_272, unk1);
- g_zbasic->stringCopy(this->var_str_172, unk2);
this->var_str_384 = g_zbasic->str(3);
this->var_i16_586 = 0;
@@ -262,7 +261,7 @@ void FoolGame::sub_128_11c(const Common::U32String &unk2, const Common::U32Strin
this->var_i32_16e = 0;
// 128:017e
- g_toolbox->SFPutFile(this->var_ev_46.where, this->var_str_172, this->var_str_272, this->var_i32_16e, this->var_sfr_5e);
+ g_toolbox->SFPutFile(this->var_ev_46.where, title, filename, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -752,31 +751,31 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
// 128:1518
this->sub_128_61ec();
- this->var_i16_7be = 0;
+ this->savePromptChoice = 0;
// 128:1522
do {
this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, this->var_ev_46);
g_toolbox->GlobalToLocal(this->var_ev_46.where);
if (this->var_ev_46.what == kMouseDown) {
// 128:154a
- this->var_i16_7be = 0;
+ this->savePromptChoice = 0;
Common::Rect target;
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b7c)) {
- this->var_i16_7be = 1;
+ this->savePromptChoice = 1;
target = this->arr_rect_5b7c;
}
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b84)) {
- this->var_i16_7be = 2;
+ this->savePromptChoice = 2;
target = this->arr_rect_5b84;
}
if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b8c)) {
- this->var_i16_7be = 3;
+ this->savePromptChoice = 3;
target = this->arr_rect_5b8c;
}
- if (this->var_i16_7be > 0) {
+ if (this->savePromptChoice > 0) {
// 128:15d2
- this->var_i16_30 = (this->var_i16_7be - 1)*4;
+ this->var_i16_30 = (this->savePromptChoice - 1)*4;
do {
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
@@ -803,7 +802,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
} while (this->var_ev_46.what != kMouseUp);
if (!g_toolbox->PtInRect(this->var_ev_46.where, target)) {
- this->var_i16_7be = 0;
+ this->savePromptChoice = 0;
}
this->sub_128_61ec();
}
@@ -812,13 +811,13 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
if (this->var_ev_46.what == kKeyDown) {
this->keyLastPressed = this->var_ev_46.message & 0xff;
if (this->keyLastPressed == 0xd) {
- this->var_i16_7be = 1;
+ this->savePromptChoice = 1;
}
}
if (this->var_ev_46.what == kNullEvent)
g_toolbox->Delay(0);
// 128:175c
- } while (this->var_i16_7be == 0);
+ } while (this->savePromptChoice == 0);
this->sub_128_61ec();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -1180,7 +1179,7 @@ void FoolGame::sub_128_271a() {
void FoolGame::menuNewGame() {
// 128:27d6
this->savePrompt();
- if (this->var_i16_7be == 3)
+ if (this->savePromptChoice == 3)
return;
if (this->var_i16_7ce & 1) {
this->setStateBits(kStateNewGame | kStateReturn);
@@ -1234,23 +1233,23 @@ void FoolGame::menuOpenGame() {
// 128:2988
// File -> Open
this->sub_128_1e4(g_zbasic->str(21)); // FOOL
- if (this->var_str_588 == g_zbasic->str(22)) { // empty
+ if (this->var_str_588.empty()) { // was: str(22)
return;
}
this->sub_128_2808();
- if (this->var_str_588 == g_zbasic->str(23)) {
+ if (this->var_str_588.empty()) { // was: str(23)
return;
}
this->savePrompt();
// 128:29d4
- if (this->var_i16_7be != 3) {
+ if (this->savePromptChoice != 3) {
if ((this->var_i16_7ce & 1) != 0) {
this->setStateBits(kStateOpenGame | kStateReturn);
} else {
// 128:29fa
this->setStateBits(kStateOpenGame);
}
- this->sub_128_3774();
+ this->cursorWatch();
}
}
@@ -1260,18 +1259,18 @@ void FoolGame::menuSaveGame() {
this->setStateBits(kStateSaveGame);
}
-void FoolGame::sub_128_2a0e() {
+void FoolGame::saveGameAs() {
// 128:2a0e
- if (this->var_str_8ec == g_zbasic->str(24)) {
+ if (saveFileName.empty()) { // was: str(24)
// 128:2a28
- this->sub_128_11c(g_zbasic->str(25), g_zbasic->str(26)); // name of game, blank
+ this->openSaveFileDialog(g_zbasic->str(25), g_zbasic->str(26)); // name of game, blank
} else {
// 128:2a48
- this->sub_128_11c(g_zbasic->str(27), this->var_str_8ec); // New Name?
+ this->openSaveFileDialog(g_zbasic->str(27), saveFileName); // New Name?, old filename
}
// 128:2a60
- if (this->var_str_486 != g_zbasic->str(28)) { // empty
- this->var_str_8ec = this->var_str_486;
+ if (!this->var_str_486.empty()) { // was: str(28)
+ saveFileName = this->var_str_486;
this->var_i16_9ec = this->var_i16_586;
// 128:2a90
}
@@ -1280,8 +1279,8 @@ void FoolGame::sub_128_2a0e() {
void FoolGame::menuSaveGameAs() {
// 128:2a92
// File -> Save As
- this->sub_128_2a0e();
- if (this->var_str_486 != g_zbasic->str(29)) { // empty
+ this->saveGameAs();
+ if (!this->var_str_486.empty()) { // was: str(29)
this->setStateBits(kStateSaveGame);
}
@@ -1291,7 +1290,7 @@ void FoolGame::menuSaveGameAs() {
void FoolGame::menuQuit() {
// 128:2ab6
this->savePrompt();
- if (this->var_i16_7be == 3) {
+ if (this->savePromptChoice == 3) {
return;
}
if ((this->var_i16_7ce & 1) != 0) {
@@ -1323,9 +1322,9 @@ void FoolGame::sub_128_2b0a() {
void FoolGame::newGame() {
// 128:2bc6
this->clearStateBits(kStateNewGame);
- this->sub_128_3774();
+ this->cursorWatch();
this->sub_128_3744();
- this->var_str_8ec = g_zbasic->str(33);
+ saveFileName = g_zbasic->str(33);
this->var_i16_9ec = 0;
// set up the initially visible story chapters
@@ -1397,16 +1396,16 @@ void FoolGame::openGame() {
// 128:2e3e
// save game loading code?
this->clearStateBits(kStateOpenGame);
- this->sub_128_3774();
+ this->cursorWatch();
this->sub_128_3744();
- this->var_str_8ec = this->var_str_588;
+ saveFileName = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
this->var_i16_7e6 = 0;
// FIXME: disk error handler??
// 128:2e68: LEA - [0x3808],A0
// 128:2e6c: MOVE.L - A0,-0x8ee(A5)
// 128:2e70: SF - 0x8,D0
- g_zbasic->openR(2, this->var_str_8ec, 0x400, this->var_i16_9ec);
+ g_zbasic->openR(2, saveFileName, 0x400, this->var_i16_9ec);
this->var_str_384 = g_zbasic->readFileStr(2, 0x11);
this->storyNextPage = g_zbasic->readFileInt(2);
@@ -1435,7 +1434,7 @@ void FoolGame::openGame() {
// 128:2f84
g_zbasic->close(2);
if (this->var_i16_7e6 != 0) {
- this->arr_str_1a8d8[0] = g_zbasic->str(34) + this->var_str_8ec + g_zbasic->str(35); // file cannot be opened
+ this->arr_str_1a8d8[0] = g_zbasic->str(34) + saveFileName + g_zbasic->str(35); // file cannot be opened
this->arr_str_1a8d8[1] = g_zbasic->str(36);
this->var_i16_7e6 = 0;
if ((this->var_i16_7ce & 1) == 0) {
@@ -1527,37 +1526,58 @@ void FoolGame::savePrompt() {
if (this->var_i16_7ce == 666) {
return;
}
- this->var_i16_7be = 0;
- if (this->var_str_8ec == g_zbasic->str(42)) {
- this->arr_str_1a8d8[0] = g_zbasic->str(43); // do you wish to save this game
- this->arr_str_1a8d8[1] = g_zbasic->str(44); // yes
- this->arr_str_1a8d8[2] = g_zbasic->str(45); // no
- this->arr_str_1a8d8[3] = g_zbasic->str(46); // cancel
- this->sub_128_dfe(0, 0, 3, 0);
- if (this->var_i16_7be > 1) {
- return;
- }
- this->sub_128_2a0e();
- if (this->var_str_8ec == g_zbasic->str(47)) {
- // 128:33da
- this->var_i16_7be = 3;
- return;
- }
+ this->savePromptChoice = 0;
+ // The original code would only show the save prompt if there was
+ // no game in progress.
+ // Instead, we always show the prompt.
+
+ Common::U32String previous = saveFileName;
+ saveFileName.clear();
+ this->arr_str_1a8d8[0] = g_zbasic->str(43); // do you wish to save this game
+ this->arr_str_1a8d8[1] = g_zbasic->str(44); // yes
+ this->arr_str_1a8d8[2] = g_zbasic->str(45); // no
+ this->arr_str_1a8d8[3] = g_zbasic->str(46); // cancel
+ this->sub_128_dfe(0, 0, 3, 0);
+ if (this->savePromptChoice > 1) {
+ saveFileName = previous;
+ return;
+ }
+ this->saveGameAs();
+ if (saveFileName.empty()) { // was: str(47)
+ // 128:33da
+ this->savePromptChoice = 3;
+ saveFileName = previous;
+ return;
}
// 128:33e2
this->setStateBits(kStateSaveGame);
}
+void FoolGame::autoSaveGame() {
+ // Fool's Errand had an autosave feature; once you saved or opened
+ // a game, this became the "game in progress", and on quit/load
+ // the game would do the equivalent of hitting "Save".
+ // In general, ScummVM treats user-initated save games as a snapshot,
+ // and writes any automatic progress to a dedicated "Autosave" slot.
+ // This wrapper changes the autosave behaviour to match the rest of ScummVM.
+ isAutoSaving = true;
+ Common::U32String previous = saveFileName;
+ saveFileName = Common::U32String::format("%s-Autosave.fool", g_engine->getGameId().c_str());
+ saveGame();
+ saveFileName = previous;
+ isAutoSaving = false;
+}
+
void FoolGame::saveGame() {
// write save file
this->clearStateBits(kStateSaveGame);
if (this->var_i16_7ce == 666)
return;
// 128:3548
- if (this->var_str_8ec == g_zbasic->str(57)) { // empty
- this->sub_128_2a0e();
- if (this->var_str_8ec == g_zbasic->str(58)) { // empty
+ if (saveFileName.empty()) { // was: str(57)
+ this->saveGameAs();
+ if (saveFileName.empty()) { // was: str(58)
return;
}
}
@@ -1567,13 +1587,15 @@ void FoolGame::saveGame() {
}
// 128:3594
do {
- this->sub_128_3774();
+ if (!isAutoSaving) {
+ this->cursorWatch();
+ }
// 128:3598
this->var_i16_7e6 = 0;
// 128:359e: LEA - [0x3808],A0
// 128:35a2: MOVE.L - A0,-0x8ee(A5)
g_zbasic->defOpen(g_zbasic->str(59)); // FOOLgf87
- g_zbasic->openW(2, this->var_str_8ec, 0x400, this->var_i16_9ec);
+ g_zbasic->openW(2, saveFileName, 0x400, this->var_i16_9ec);
if (this->var_i16_7e6 != 0xa) {
this->var_str_af4 = g_zbasic->str(60); // The Fool's Errand
@@ -1601,8 +1623,8 @@ void FoolGame::saveGame() {
// problem with saving
this->sub_128_388a();
do {
- this->sub_128_2a0e();
- } while (this->var_str_8ec == g_zbasic->str(61)); // empty
+ this->saveGameAs();
+ } while (saveFileName.empty()); // was: str(61)
// 128:3726: BRA - [0x3594]
} else {
@@ -1613,7 +1635,9 @@ void FoolGame::saveGame() {
// 128:372a: LEA - [0x3818],A0
// 128:372e: MOVE.L - A0,-0x8ee(A5)
if (this->stateFlags == 0) {
- this->sub_128_37ce();
+ if (!isAutoSaving) {
+ this->cursorExplodingWatchShort();
+ }
g_toolbox->InitCursor();
}
}
@@ -1629,7 +1653,7 @@ void FoolGame::sub_128_3744() {
}
// watch cursor
-void FoolGame::sub_128_3774() {
+void FoolGame::cursorWatch() {
// 128:3774
g_toolbox->SetCursor(this->arr_curs_4d88[3]);
this->var_i16_7b2 = 0xa;
@@ -1652,7 +1676,7 @@ void FoolGame::cursorExplodingWatch() {
this->var_i16_7b2 = 0xa;
}
-void FoolGame::sub_128_37ce() {
+void FoolGame::cursorExplodingWatchShort() {
// 128:37ce
for (int i = 7; i <= 0xf; i++) {
g_toolbox->SetCursor(this->arr_curs_4d88[i]);
@@ -1768,6 +1792,7 @@ void FoolGame::puzzleRun() {
g_zbasic->indexClear(1);
if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x63) {
this->storyUnlockChapter();
+ autoSaveGame(); // autosave on progress
}
if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x64) {
// bodge for completing The Chariot
@@ -1815,12 +1840,13 @@ void FoolGame::puzzleRun() {
g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
this->storyUnlockChapter();
}
+ autoSaveGame();
}
// 128:3d82
this->var_i16_c02 = 0;
this->var_i16_c00 = 0;
g_toolbox->SetPort(this->var_i32_0);
- if ((this->stateFlags & 0x38) == 0) {
+ if ((this->stateFlags & (kStateQuit | kStateOpenGame | kStateNewGame)) == 0) {
if ((this->var_i16_7ce & 1) == 0) {
this->var_i16_7ce ^= 1;
}
@@ -1911,7 +1937,7 @@ void FoolGame::puzzleLoadContext() {
this->activePuzzleBuffer = g_zbasic->indexRaw(2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = this->activePuzzleBuffer;
- debugC(5, kDebugLoading, "puzzleLoadContext: loading puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
+ debugC(5, kDebugLoading, "puzzleLoadContext: loading puzzle %d context, state %d, size %d", this->activePuzzle, this->var_i16_c04, inter.size());
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
@@ -1922,7 +1948,7 @@ void FoolGame::puzzleSaveContext() {
g_zbasic->indexRawSet(this->activePuzzleBuffer, 2, this->activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = this->activePuzzleBuffer;
- debugC(5, kDebugLoading, "puzzleSaveContext: saving puzzle %d context, state %d", this->activePuzzle, this->var_i16_c04);
+ debugC(5, kDebugLoading, "puzzleSaveContext: saving puzzle %d context, state %d, size %d", this->activePuzzle, this->var_i16_c04, inter.size());
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
@@ -2092,12 +2118,12 @@ void FoolGame::sub_128_4472() {
// about screen
void FoolGame::menuAbout() {
// 128:4a92
- if (this->var_str_8ec == g_zbasic->str(77)) {
+ if (saveFileName.empty()) { // was: str(77)
// untitled game in progress
this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + g_zbasic->str(78) + g_zbasic->chr(0x22) + g_zbasic->str(79);
} else {
// 128:4aee
- this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + this->var_str_8ec + g_zbasic->chr(0x22) + g_zbasic->str(80);
+ this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + saveFileName + g_zbasic->chr(0x22) + g_zbasic->str(80);
}
// 128:4b28
this->arr_str_1a8d8[1] = g_zbasic->str(81);
@@ -2862,7 +2888,7 @@ void FoolGame::sub_129_068() {
// 129:0496
this->var_i16_7e4 = 1;
this->var_str_e22 = g_zbasic->str(124);
- this->var_str_8ec = g_zbasic->str(125);
+ saveFileName = g_zbasic->str(125);
this->var_i16_484 = g_zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
@@ -2875,7 +2901,7 @@ void FoolGame::sub_129_068() {
this->sub_128_2808();
if (this->var_str_588 != g_zbasic->str(129)) {
// 129:054c
- this->var_str_8ec = this->var_str_588;
+ saveFileName = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
}
}
@@ -3182,13 +3208,13 @@ void FoolGame::sub_129_068() {
this->sub_128_6244();
// 129:11f6
- if (g_zbasic->str(157) == this->var_str_8ec) { // empty
+ if (saveFileName.empty()) { // was: str(157)
// cold start
this->stateFlags = kStateNewGame;
} else {
// loading a save game
this->stateFlags = kStateOpenGame;
- this->var_str_588 = this->var_str_8ec;
+ this->var_str_588 = saveFileName;
this->var_i16_688 = this->var_i16_9ec;
}
// 129:1236
@@ -3264,6 +3290,48 @@ void FoolGame::hermitRun() {
}
void FoolGame::sub_144_004() {
+ // 144:0004
+ g_toolbox->ReleaseResource(var_pic_7c2);
+ var_i32_7c8 = g_zbasic->mem(-1);
+ stateFlags = kStateQuit;
+ if (var_i16_37a == 0) {
+ g_toolbox->SetPort(var_i32_8);
+ fillRect(0, 0, 0x14, SCREEN_WIDTH, 0x47);
+ } else {
+ // 144:0046
+ sub_128_1ef8();
+ }
+ // 144:004a
+ autoSaveGame(); // was: saveGame
+ g_toolbox->InitCursor();
+ sub_128_4da(0);
+ if (var_i16_37a == 0) {
+ var_i16_42 = 0;
+ var_i16_44 = 0xab;
+ } else {
+ // 144:0070
+ var_i16_42 = 0x14;
+ var_i16_44 = 0xb5;
+ g_toolbox->SetPort(var_i32_0);
+ }
+ // 144:0082
+ g_zbasic->get(1, var_i16_42+1, SCREEN_WIDTH, SCREEN_HEIGHT-1, arr_bmp_5dfc);
+ for (int16 i = 0xa; i <= 0xf0; i += 0xa) {
+ var_i32_692 = g_toolbox->TickCount();
+ g_zbasic->put(
+ i,
+ var_i16_42 + (int16)(i*0.6f),
+ SCREEN_WIDTH - i,
+ SCREEN_HEIGHT - (int16)(i*0.6f),
+ arr_bmp_5dfc, kPutCopy);
+ // 144:015a
+ sub_128_406(0xf);
+ }
+ // 144:0170
+ sub_128_3da(0x3c);
+ var_i16_68a = 1;
+ var_i32_692 = g_toolbox->TickCount();
+ //arr_i16_4758[0], 0x100 - var_i16_68a, var_i16_44, var_i16_68a*
warning("STUB: %s", __func__);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index afa14a948fd..6cd87836c8d 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -41,6 +41,7 @@ enum FoolStateBits : uint16 {
kStateChapterSelect = 0x40,
kStatePuzzleSelect = 0x80,
kStateMetapuzzleSelect = 0x100,
+ kStateMetapuzzleComplete = 0x800,
};
enum FoolPuzzleFlags : uint16 {
@@ -59,7 +60,7 @@ public:
void sub_128_004();
void copyScreen(int16 put, BitMap &bmp); // sub_128_0a2
- void sub_128_11c(const Common::U32String &unk2, const Common::U32String &unk1);
+ void openSaveFileDialog(const Common::U32String &title, const Common::U32String &filename); // sub_128_11c
void sub_128_1e4(const Common::U32String &unk1);
void sub_128_2be(int16 unk2, int16 unk1);
void sub_128_342(int16 unk2, int16 unk1);
@@ -103,7 +104,7 @@ public:
void sub_128_2808();
void menuOpenGame(); // sub_128_2988
void menuSaveGame(); // sub_128_2a06
- void sub_128_2a0e();
+ void saveGameAs(); // sub_128_2a0e
void menuSaveGameAs(); // sub_128_2a92
void menuQuit(); // sub_128_2ab6
void menuPrintStory(); // sub_128_2ae8
@@ -114,11 +115,12 @@ public:
void sub_128_3032();
void sub_128_32c8();
void savePrompt(); // sub_128_32fa
+ void autoSaveGame();
void saveGame(); // sub_128_3536
void sub_128_3744();
- void sub_128_3774();
+ void cursorWatch(); // sub_128_3774
void cursorExplodingWatch(); // sub_128_378a
- void sub_128_37ce();
+ void cursorExplodingWatchShort(); // sub_128_37ce
void sub_128_388a();
void puzzleRun(); // sub_128_39a0
void storyUnlockChapter(); // sub_128_3de6
@@ -279,7 +281,7 @@ public:
void sub_136_2582();
void mazeDrawPlayer(); // sub_136_2664
- void sub_136_274e();
+ void mazeSetupMenu(); // sub_136_274e
void sub_136_2a7c();
void sub_136_2b30();
void sub_136_2be2();
@@ -423,6 +425,7 @@ private:
int16 var_i16_36;
int16 var_i16_38;
int16 var_i16_3a;
+ int16 var_i16_42;
int16 var_i16_44;
EventRecord var_ev_46;
int16 var_i16_56;
@@ -468,6 +471,8 @@ private:
int16 var_i16_7b8;
int16 var_i16_7ba;
int16 var_i16_7bc;
+ // this was reused, I don't know why
+ int16 savePromptChoice; // var_i16_7be
int16 var_i16_7be;
int16 keyLastPressed; // var_i16_7c0
PicHandle var_pic_7c2;
@@ -489,7 +494,8 @@ private:
int16 var_i16_7e6;
Common::U32String var_str_7e8;
int16 var_i16_8e8;
- Common::U32String var_str_8ec;
+ Common::U32String saveFileName; // var_str_8ec
+ bool isAutoSaving;
int16 var_i16_9ec;
int16 var_i16_9f2;
Common::U32String var_str_9f4;
@@ -642,6 +648,11 @@ private:
int16 var_i16_1df2;
int16 var_i16_1df4;
+ int16 var_i16_1df6;
+ int16 var_i16_1df8;
+ int16 var_i16_1dfa;
+ int16 var_i16_1dfc;
+ int16 var_i16_1dfe;
int16 var_i16_1e00;
int16 var_i16_1e02;
@@ -729,8 +740,8 @@ private:
Common::Rect arr_rect_5b84;
Common::Rect arr_rect_5b8c;
Common::Rect arr_rect_5b92;
- int16 arr_i16_5bbc[0x1b];
- int16 arr_i16_5cbc[26];
+ int16 arr_i16_5bbc[64];
+ int16 arr_i16_5cbc[64];
float arr_bcd_5dbc[8];
Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 9e1594512f2..5810ed5d135 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -142,7 +142,7 @@ void FoolGame::mazeRun() {
}
// 136:06b4
var_str_1578.clear(); // was str(224)
- sub_136_274e();
+ mazeSetupMenu();
sub_136_ade();
stateFlags = kStateNull;
sub_128_4da(1);
@@ -517,7 +517,7 @@ void FoolGame::sub_136_e4c() {
arr_i16_3738[var_i16_1574] ^= 0x1000;
}
// 136:0ed2
- sub_136_274e();
+ mazeSetupMenu();
}
void FoolGame::sub_136_ed8() {
@@ -531,7 +531,7 @@ void FoolGame::sub_136_ed8() {
if (arr_i16_5cbc[var_i16_1de2] < 0) {
arr_i16_5cbc[var_i16_1de2] = 0;
}
- sub_136_274e();
+ mazeSetupMenu();
}
void FoolGame::mazeWanderingWinds() {
@@ -660,9 +660,8 @@ void FoolGame::sub_136_137c() {
// 136:1528
if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(240)) { // S
var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
- var_i16_68a = 4;
for (int16 i = 4; i <= (2*var_i16_484 + 2); i += 2) {
- var_i16_7e4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_68a, 2));
+ var_i16_7e4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, i, 2));
if (arr_i16_4338[var_i16_7e4] == 0) {
var_i16_1df0 = 1;
}
@@ -690,7 +689,21 @@ void FoolGame::sub_136_163c() {
}
void FoolGame::sub_136_1650() {
- warning("STUB: %s", __func__);
+ // 136:1650
+ var_i16_105a = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_103a = g_zbasic->decodeInt(g_zbasic->leftStr(g_zbasic->indexRaw(1, var_i16_105a), 2));
+ var_i16_1df2 = 0;
+ for (int16 i = 1; i <= var_i16_103a; i++) {
+ var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(g_zbasic->indexRaw(1, var_i16_105a), i*2 + 3, 2));
+ if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
+ var_i16_1df2 = 1;
+ arr_i16_5bbc[var_i16_1df2] = var_i16_484;
+ }
+ // 136:16f4
+ }
+ // 136:1704
+ var_i16_484 = arr_i16_5bbc[g_zbasic->rndInt(var_i16_1df2)];
+ arr_i16_3738[var_i16_484] |= 0x1000;
}
void FoolGame::mazeHiddenDoorOpen() {
@@ -746,11 +759,18 @@ void FoolGame::mazeHiddenDoorShut() {
}
void FoolGame::sub_136_1806() {
- warning("STUB: %s", __func__);
+ // 136:1806
+ sub_136_2582();
+ if ((arr_i16_3738[var_i16_1574] & 0x1000) != 0) {
+ arr_i16_3738[var_i16_1574] ^= 0x1000;
+ }
+ // 136:1858
}
void FoolGame::sub_136_185a() {
- warning("STUB: %s", __func__);
+ // 136:185a
+ var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
+ arr_i16_3738[var_i16_484] |= 0x1000;
}
void FoolGame::sub_136_1898() {
@@ -803,23 +823,170 @@ void FoolGame::sub_136_1932() {
void FoolGame::sub_136_19d2() {
// 136:19d2
- warning("STUB: %s", __func__);
+ g_toolbox->PenNormal();
+ g_toolbox->PenMode(kPatXor);
+ g_toolbox->PenSize(6, 6);
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de4 = var_i16_1de4 * 2 - 1;
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_1de8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 7, 2));
+ var_i16_1df6 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 9, 2));
+ var_i16_484 = 0xb;
+ sub_136_24ae();
+ // 136:1a7a
+ var_i16_1df8 = arr_rect_1f38[var_i16_1dea].left + ((arr_rect_1f38[var_i16_1dea].right - arr_rect_1f38[var_i16_1dea].left) / 2) - 3;
+ var_i16_1dfa = arr_rect_1f38[var_i16_1dea].top + ((arr_rect_1f38[var_i16_1dea].bottom - arr_rect_1f38[var_i16_1dea].top) / 2) - 3;
+ // 136:1b56
+ var_i16_1dfc = arr_rect_1f38[var_i16_1de8].left + ((arr_rect_1f38[var_i16_1de8].right - arr_rect_1f38[var_i16_1de8].left) / 2) - 3;
+ var_i16_1dfe = arr_rect_1f38[var_i16_1de8].top + ((arr_rect_1f38[var_i16_1de8].bottom - arr_rect_1f38[var_i16_1de8].top) / 2) - 3;
+ // 136:1c32
+ for (int16 i = 0; i <= var_i16_1de4; i++) {
+ if (var_i16_1dec == 1) {
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1dea]);
+ }
+ // 136:1c5a
+ if (var_i16_1dec == 2) {
+ g_toolbox->InvertOval(arr_rect_1f38[var_i16_1dea]);
+ }
+ g_toolbox->MoveTo(var_i16_1df8, var_i16_1dfa);
+ g_toolbox->LineTo(var_i16_1dfc, var_i16_1dfe);
+ if (var_i16_1df6 == 1) {
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1de8]);
+ }
+ // 136:1cb2
+ if (var_i16_1df6 == 2) {
+ g_toolbox->InvertOval(arr_rect_1f38[var_i16_1de8]);
+
+ }
+ if (var_i16_1df4 > 0) {
+ sub_136_2538();
+ }
+ }
}
void FoolGame::sub_136_1cf4() {
- warning("STUB: %s", __func__);
+ // 136:1cf4
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_484 = 7;
+ sub_136_24ae();
+ for (int16 i = 1; i <= var_i16_1de4; i++) {
+ // 136:1d4c
+ if (var_i16_1df4 > 0) {
+ sub_136_2538();
+ }
+ if (var_i16_1dec == 1) {
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->Delay(0);
+ g_toolbox->InvertRect(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->Delay(0);
+ } else {
+ // 136:1d98
+ g_toolbox->InvertOval(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->Delay(0);
+ g_toolbox->InvertOval(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->Delay(0);
+ }
+ // 136:1dc8
+ }
}
void FoolGame::sub_136_1ddc() {
- warning("STUB: %s", __func__);
+ // 136:1ddc
+ var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
+ g_toolbox->Delay(var_i16_484*60/1000);
}
void FoolGame::sub_136_1df4() {
- warning("STUB: %s", __func__);
+ // 136:1df4
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_484 = 7;
+ sub_136_24ae();
+ mazeMovementTrail();
}
void FoolGame::sub_136_1e4c() {
- warning("STUB: %s", __func__);
+ // 136:1e4c
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1e00 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_484 = 7;
+ sub_136_24ae();
+ g_toolbox->PenNormal();
+ g_toolbox->PenSize(4, 4);
+ g_toolbox->PenMode(kPatXor);
+ // 136:1eb0
+ if (var_i16_1e00 == 1) {
+ arr_i16_4758[0] = 0x14;
+ arr_i16_4758[1] = 0;
+ arr_i16_4758[2] = SCREEN_HEIGHT;
+ arr_i16_4758[3] = SCREEN_WIDTH;
+ arr_i16_4758[4 + 0] = arr_rect_1f38[var_i16_1dea].top;
+ arr_i16_4758[4 + 1] = arr_rect_1f38[var_i16_1dea].left;
+ arr_i16_4758[4 + 2] = arr_rect_1f38[var_i16_1dea].bottom;
+ arr_i16_4758[4 + 3] = arr_rect_1f38[var_i16_1dea].right;
+ } else {
+ // 136:1f4a
+ arr_i16_4758[0] = arr_rect_1f38[var_i16_1dea].top + 1;
+ arr_i16_4758[1] = arr_rect_1f38[var_i16_1dea].left + 1;
+ arr_i16_4758[2] = arr_rect_1f38[var_i16_1dea].bottom + 1;
+ arr_i16_4758[3] = arr_rect_1f38[var_i16_1dea].right + 1;
+ // 136:1f96
+ arr_i16_4758[4] = 0x14;
+ arr_i16_4758[5] = 0;
+ arr_i16_4758[6] = SCREEN_HEIGHT;
+ arr_i16_4758[7] = SCREEN_HEIGHT;
+ }
+ // 136:1fd4
+ for (int16 i = 0; i <= 3; i++) {
+ arr_bcd_5dbc[4 + i] = (arr_i16_4758[i] - arr_i16_4758[4+i])/25.0;
+ }
+ // 136:2050
+ for (int16 k = 0; k <= 1; k++) {
+ // 136:2056
+ for (int16 i = 0; i <= 3; i++) {
+ arr_bcd_5dbc[i] = arr_i16_4758[4 + i];
+ }
+ for (int16 j = 1; j < 0x19; j++) {
+ if (k == 1) {
+ var_i16_1e02 *= -1;
+ }
+ // 136:20bc
+ for (int16 i = 0; i <= 3; i++) {
+ var_i16_9f2 = 0;
+ if (var_i16_1e00 == 1) {
+ arr_i16_4758[i] = (int)arr_bcd_5dbc[i];
+ }
+ // 136:2100
+ arr_bcd_5dbc[i] += arr_bcd_5dbc[i + 4];
+ if (var_i16_1e00 == 2) {
+ arr_i16_4758[i] = (int)arr_bcd_5dbc[i];
+ }
+ // 136:2192
+ }
+ // 136:21a0
+ Common::Rect temp;
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
+ if (var_i16_1dec == 1) {
+ g_toolbox->FrameRect(temp);
+ }
+ // 136:21b8
+ if (var_i16_1dec == 2) {
+ g_toolbox->FrameOval(temp);
+ }
+ // 136:21d0
+ if (var_i16_1df4 < 0) {
+ sub_136_2538();
+ }
+ }
+ }
}
void FoolGame::sub_136_21fa() {
@@ -912,7 +1079,6 @@ void FoolGame::sub_136_2582() {
}
void FoolGame::mazeDrawPlayer() {
- warning(__func__);
// 136:2664
var_i16_1574 = arr_i16_2f38[mazePlayerX*32 + mazePlayerY];
arr_i16_1eb8[24] = arr_rect_1f38[var_i16_1574].top + 4;
@@ -928,8 +1094,11 @@ void FoolGame::mazeDrawPlayer() {
g_toolbox->InvertOval(temp); // draw new player pos
}
-void FoolGame::sub_136_274e() {
- warning(__func__);
+void FoolGame::mazeSetupMenu() {
+ this->var_menu_bf8 = g_toolbox->GetMHandle(8);
+ g_toolbox->DeleteMenu(8);
+ g_toolbox->DisposeMenu(this->var_menu_bf8);
+
// 136:274e
g_zbasic->menu(8, 0, 1, arr_str_195e8[activePuzzle]);
if (activePuzzle < 0x50) {
@@ -949,25 +1118,25 @@ void FoolGame::sub_136_274e() {
var_i16_68a = 1;
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- if ((arr_i16_5cbc[var_i16_68a] > 0) &&
- (g_zbasic->instr(1, g_zbasic->index(1, var_i16_68a), g_zbasic->str(249)) > 0)) {
+ if ((arr_i16_5cbc[i] > 0) &&
+ (g_zbasic->instr(1, g_zbasic->index(1, i), g_zbasic->str(249)) > 0)) {
if (var_i16_103a == 7) {
g_zbasic->menu(8, 6, 0, g_zbasic->str(250)); // -
- g_zbasic->menu(8, 7, 0, g_zbasic->str(251)); // you have acquired
+ g_zbasic->menu(8, 7, 1, g_zbasic->str(251)); // you have acquired
}
// 136:28b4
- var_i16_1dea = g_zbasic->instr(1, g_zbasic->index(1, var_i16_68a), g_zbasic->str(252)); // ++
- var_i16_1de8 = g_zbasic->instr(1, g_zbasic->index(1, var_i16_68a), g_zbasic->str(253)); // \xa5\xa5
- var_str_1e08 = g_zbasic->midStr(g_zbasic->index(1, var_i16_68a), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
+ var_i16_1dea = g_zbasic->instr(1, g_zbasic->index(1, i), g_zbasic->str(252)); // ++
+ var_i16_1de8 = g_zbasic->instr(1, g_zbasic->index(1, i), g_zbasic->str(253)); // \xa5\xa5
+ var_str_1e08 = g_zbasic->midStr(g_zbasic->index(1, i), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
if (g_zbasic->leftStr(var_str_1e08, 1) == g_zbasic->str(254)) { // +
// 136:2964
var_i16_484 = var_str_1e08.size();
var_str_1e08 = g_zbasic->rightStr(var_str_1e08, var_i16_484 - 1);
}
// 136:298e
- var_str_384 = Common::U32String::format(" %d", arr_i16_5cbc[var_i16_68a]);
+ var_str_384 = Common::U32String::format(" %d", arr_i16_5cbc[i]);
var_str_384 = g_zbasic->space(4 - var_str_384.size()) + var_str_384 + g_zbasic->str(255) + var_str_1e08; // ' '
- if (arr_i16_5cbc[var_i16_68a] > 1) {
+ if (arr_i16_5cbc[i] > 1) {
var_str_384 += g_zbasic->str(256); // s
}
// 136:2a2a
@@ -1084,6 +1253,7 @@ void FoolGame::sub_136_2ed6() {
void FoolGame::mazeStoreState() {
// 136:2f5c
+ // for the endgame maze, there's specific code to not save the puzzle state
if (!((activePuzzle != 0x57) && (var_i16_d0c == 0))) {
activePuzzleBuffer.clear(); // was: str(258)
return;
@@ -1268,8 +1438,9 @@ void FoolGame::mazeLoadState() {
}
}
// 136:3710
+ // draw walls that are added by the visibility mask
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[16]]);
+ g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
var_i16_1574 = 0;
var_i16_1de6 = 0;
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index b354da499e0..01b42238587 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -77,7 +77,7 @@ void FoolGame::metapuzzleRun() {
if (activePuzzle != 0) {
sub_138_21e();
}
- if (stateFlags == 4) {
+ if (stateFlags == kStateSaveGame) {
saveGame();
}
if (keyLastPressed == 0x20) {
@@ -164,6 +164,8 @@ void FoolGame::sub_138_21e() {
metapuzzleWheel();
}
puzzleSaveContext();
+ // any progress is good progress
+ autoSaveGame();
if ((activePuzzle == 0x55) && (puzzleCompletionStatus[0x55] == 0x64)) {
stateFlags = 0x821;
}
Commit: a84e101b7dae99ca7f804efeafcb92c535925b9e
https://github.com/scummvm/scummvm/commit/a84e101b7dae99ca7f804efeafcb92c535925b9e
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:25+02:00
Commit Message:
FOOL: Game completable
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_thoth.cpp
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 88edfe6e895..c1fcbe3dbd9 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -2659,7 +2659,7 @@ void FoolGame::sub_128_5fb4() {
}
void FoolGame::sub_128_5fea() {
- if (this->var_i16_37a == 1) {
+ if (this->screenOversized) {
g_toolbox->SetPort(this->var_i32_8);
g_toolbox->PenNormal();
this->fillRect(0x14, 0, this->var_i16_5c, this->var_i16_56-3, 2);
@@ -2794,9 +2794,9 @@ void FoolGame::sub_129_068() {
this->var_i16_58 = (this->var_i16_5c - SCREEN_HEIGHT)/2;
// 129:0138
if ((this->var_i16_56 == 0) && (this->var_i16_58 == 0)) {
- this->var_i16_37a = 0;
+ this->screenOversized = false;
} else {
- this->var_i16_37a = 1;
+ this->screenOversized = true;
}
// 129:0166
g_zbasic->window(1, g_zbasic->str(112), 0, 0, this->var_i16_5a, this->var_i16_5c, kWindowDialogOneLine);
@@ -3294,9 +3294,10 @@ void FoolGame::sub_144_004() {
g_toolbox->ReleaseResource(var_pic_7c2);
var_i32_7c8 = g_zbasic->mem(-1);
stateFlags = kStateQuit;
- if (var_i16_37a == 0) {
+ if (!screenOversized) {
g_toolbox->SetPort(var_i32_8);
fillRect(0, 0, 0x14, SCREEN_WIDTH, 0x47);
+ g_toolbox->SetPort(var_i32_0);
} else {
// 144:0046
sub_128_1ef8();
@@ -3305,7 +3306,7 @@ void FoolGame::sub_144_004() {
autoSaveGame(); // was: saveGame
g_toolbox->InitCursor();
sub_128_4da(0);
- if (var_i16_37a == 0) {
+ if (!screenOversized) {
var_i16_42 = 0;
var_i16_44 = 0xab;
} else {
@@ -3329,10 +3330,79 @@ void FoolGame::sub_144_004() {
}
// 144:0170
sub_128_3da(0x3c);
- var_i16_68a = 1;
- var_i32_692 = g_toolbox->TickCount();
- //arr_i16_4758[0], 0x100 - var_i16_68a, var_i16_44, var_i16_68a*
- warning("STUB: %s", __func__);
+ Common::Rect temp;
+ for (int16 i = 1; i <= 0x100; i++) {
+ var_i32_692 = g_toolbox->TickCount();
+
+ g_toolbox->SetRect(
+ temp,
+ 0x100 - i,
+ var_i16_44 - (int16)(i*0.7f),
+ 0x100 + i,
+ var_i16_44 + (int16)(i*0.7f)
+ );
+ g_toolbox->InvertRect(temp);
+ sub_128_406(1);
+ }
+ // 144:0238
+ for (int16 i = 0; i <= 0xe; i++) {
+ var_i32_692 = g_toolbox->TickCount();
+ g_toolbox->InvertRect(temp);
+ sub_128_406(1);
+ }
+ // 144:0268
+ arr_str_1a8d8[0] = g_zbasic->str(368); // what's this?
+ arr_str_1a8d8[1] = g_zbasic->str(369); // more evil treachery afoot?
+ arr_str_1a8d8[2] = g_zbasic->str(370); // has not the fool has gained the gift of wisdom?
+ arr_str_1a8d8[3] = g_zbasic->str(371); // -blank-
+ arr_str_1a8d8[4] = g_zbasic->str(372); // locate and double-click the show finale file
+ arr_str_1a8d8[5] = g_zbasic->str(373); // this will oepn the 'prologue - finale' once again
+ arr_str_1a8d8[6] = g_zbasic->str(374); // but now, you'll see the finale
+ arr_str_1a8d8[7] = g_zbasic->str(375); // -blank-
+ arr_str_1a8d8[8] = g_zbasic->str(376); // congratulations!
+ arr_str_1a8d8[9] = g_zbasic->str(377); // -blank-
+ arr_str_1a8d8[10] = g_zbasic->str(378); // quit
+ sub_128_dfe(0xfa, 9, 1, 0);
+ if (screenOversized == 0) {
+ g_toolbox->ClearMenuBar();
+ g_toolbox->DrawMenuBar();
+ }
+ sub_128_1f1e();
+ sub_128_4da(1);
+ // 144:03e2
+ //if (saveFileName.empty()) {
+ // sub_144_5ca();
+ //}
+ //sub_144_406();
+}
+
+void FoolGame::sub_144_406() {
+ // write the finale file to the disk.
+ // we don't use this.
+ // 144:0406
+ while (true) {
+ var_str_384 = g_zbasic->str(384); // and now it is time to show the finale for the fool's errand
+ for (int16 i = 1; i <= 0xa; i++) {
+ var_str_384 += g_zbasic->chr(i);
+ }
+ var_i16_1372 = var_str_384.size();
+ g_zbasic->defOpen(g_zbasic->str(381)); // SHOWsF87
+ var_i16_7e6 = 0;
+ g_zbasic->openW(2, g_zbasic->str(382), 0x200, var_i16_9ec); // Show Finale
+ if (var_i16_7e6 == 0) {
+ g_zbasic->writeFileStr(2, var_str_384);
+ }
+ if (var_i16_7e6 == 0) {
+ g_zbasic->close(2);
+ }
+ if (var_i16_7e6 == 0)
+ return;
+ }
+ // 144:05ca
+}
+
+void FoolGame::sub_144_5ca() {
+ // 144:05ca
}
};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 6cd87836c8d..9371a2b3950 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -410,6 +410,9 @@ public:
void straightPathSuccess(); // sub_143_8b0
void sub_144_004();
+ void sub_144_406();
+ void sub_144_5ca();
+
private:
bool _quit = false;
@@ -439,7 +442,7 @@ private:
Common::U32String var_str_272;
RGBColor var_i16_372;
int16 soundEnabled; // var_i16_378
- int16 var_i16_37a;
+ bool screenOversized; // var_i16_37a
uint32 var_i32_37c;
Common::U32String var_str_384;
int16 var_i16_484;
@@ -770,7 +773,7 @@ private:
Common::U32String arr_str_1a288[101]; // 0x10 each
- Common::U32String arr_str_1a8d8[7]; // 0x66 each
+ Common::U32String arr_str_1a8d8[13]; // 0x66 each
Common::Rect arr_rect_1ae06;
};
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 340ccc30679..159829a5798 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -117,7 +117,7 @@ void FoolGame::highPriestessRun() {
this->sub_128_61c2();
}
// 140:02a2
- if (this->var_i16_37a == 0) {
+ if (!this->screenOversized) {
g_toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
@@ -1273,7 +1273,7 @@ Common::Rect FoolGame::thothRandomVRect() {
void FoolGame::sub_140_3296() {
// 140:3296
- if (this->var_i16_37a == 0) {
+ if (!screenOversized) {
g_toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index e4d4ace3c6f..58572ccd0ce 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -120,7 +120,7 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
clipDstRect.right += (clipSrcRect.right - srcRect.right)*sx;
clipDstRect.bottom += (clipSrcRect.bottom - srcRect.bottom)*sy;
}
- subsrc->scale(clipDstRect.width(), clipDstRect.height());
+ subsrc = BitMap(subsrc->scale(clipDstRect.width(), clipDstRect.height()));
} else {
// source and destination are the same size, no scaling
if (clipSrcRect != srcRect) {
Commit: 697ccb529b752925a310cc5fecea5d5aaf4e51a4
https://github.com/scummvm/scummvm/commit/697ccb529b752925a310cc5fecea5d5aaf4e51a4
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:26+02:00
Commit Message:
FOOL: Begin cleanup + refactoring
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 66d0abde71e..5f93ec75b4e 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -42,19 +42,19 @@ void FoolGame::cardsRun() {
this->sub_128_271a();
this->var_i16_c00 = 1;
// set up card bounding boxes
- g_toolbox->SetRect(this->arr_rect_1f38[1], 0x78, 0x19, 0xd1, 0xae);
- g_toolbox->SetRect(this->arr_rect_1f38[2], 0xd3, 0x19, 0x12c, 0xae);
- g_toolbox->SetRect(this->arr_rect_1f38[3], 0x12e, 0x19, 0x187, 0xae);
- g_toolbox->SetRect(this->arr_rect_1f38[4],1, 0x2a, 0x5a, 0xbf);
- g_toolbox->SetRect(this->arr_rect_1f38[5],0x1a6, 0x2a, 0x1ff, 0xbf);
- g_toolbox->SetRect(this->arr_rect_1f38[6], 0x1, 0xc0, 0x5a, 0x155);
- g_toolbox->SetRect(this->arr_rect_1f38[7],0x1a6, 0xc0, 0x1ff, 0x155);
- g_toolbox->SetRect(this->arr_rect_1f38[8],0x5b, 0xc0, 0xb4, 0x155);
- g_toolbox->SetRect(this->arr_rect_1f38[9],0x14c, 0xc0, 0x1a5, 0x155);
+ g_toolbox->SetRect(_screenGrid[1], 0x78, 0x19, 0xd1, 0xae);
+ g_toolbox->SetRect(_screenGrid[2], 0xd3, 0x19, 0x12c, 0xae);
+ g_toolbox->SetRect(_screenGrid[3], 0x12e, 0x19, 0x187, 0xae);
+ g_toolbox->SetRect(_screenGrid[4],1, 0x2a, 0x5a, 0xbf);
+ g_toolbox->SetRect(_screenGrid[5],0x1a6, 0x2a, 0x1ff, 0xbf);
+ g_toolbox->SetRect(_screenGrid[6], 0x1, 0xc0, 0x5a, 0x155);
+ g_toolbox->SetRect(_screenGrid[7],0x1a6, 0xc0, 0x1ff, 0x155);
+ g_toolbox->SetRect(_screenGrid[8],0x5b, 0xc0, 0xb4, 0x155);
+ g_toolbox->SetRect(_screenGrid[9],0x14c, 0xc0, 0x1a5, 0x155);
// 139:011c
for (int i = 0; i <= 0x25; i++) {
- g_zbasic->indexSet(this->puzzlesReadString(), 1, i);
+ g_zbasic->indexSet(puzzlesReadString(), 1, i);
}
this->var_i16_484 = 0x5e;
@@ -67,9 +67,9 @@ void FoolGame::cardsRun() {
this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
// illustration of the card game
g_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
- if (this->activePuzzleBuffer.empty()) { // was: str(278)
+ if (_activePuzzleBuffer.empty()) { // was: str(278)
// 139:01fa
- this->activePuzzleBuffer = g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0);
+ _activePuzzleBuffer = g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0);
// card IDs
for (int16 i = 0; i <= 0x15; i++) {
this->arr_i16_5cbc[i] = i;
@@ -82,15 +82,15 @@ void FoolGame::cardsRun() {
}
// 139:029c
for (int i = 0; i <= 0x15; i++) {
- this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
+ _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
}
}
// 139:02d8
// player scores
- this->arr_i16_1eb8[5] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, 1, 2));
- this->arr_i16_1eb8[6] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, 3, 2));
+ this->arr_i16_1eb8[5] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 1, 2));
+ this->arr_i16_1eb8[6] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 3, 2));
// 139:0320
- this->var_i16_2010 = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, 5, 2));
+ this->var_i16_2010 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 5, 2));
if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->arr_i16_1eb8[5] = 0;
this->arr_i16_1eb8[6] = 0;
@@ -99,7 +99,7 @@ void FoolGame::cardsRun() {
// 139:039e
for (int i = 0; i <= 0x15; i++) {
- this->arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, i*2 + 7, 2));
+ this->arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, i*2 + 7, 2));
}
// 139:03ea
this->arr_i16_5cbc[0x16] = 0x16;
@@ -108,21 +108,21 @@ void FoolGame::cardsRun() {
this->arr_rect_4338.bottom = 0xee;
this->arr_rect_4338.right = 0x11e;
this->var_i16_2012 = 0;
- this->stateFlags = 0;
+ _stateFlags = 0;
this->cardsDrawScores();
if (this->var_i16_2010 == 0) {
this->cardsShuffleDeck();
}
// 139:0456
this->cardsDrawTable();
- while ((this->stateFlags & kStateReturn) == 0) {
+ while ((_stateFlags & kStateReturn) == 0) {
// 139:045e
this->var_i16_2014 = 0;
- this->stateFlags = 0;
- while (this->stateFlags == 0) {
+ _stateFlags = 0;
+ while (_stateFlags == 0) {
// 139:046e
this->getNextEvent(-1);
- if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & kModMouseButtonUp) == 0) {
this->cardsOnClick();
}
if (this->var_i16_2014 != 0) {
@@ -130,10 +130,10 @@ void FoolGame::cardsRun() {
}
}
// 139:04a4
- if (this->stateFlags == 2) {
+ if (_stateFlags == 2) {
this->sub_139_4de();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->cardsStoreState();
this->saveGame();
}
@@ -189,7 +189,7 @@ void FoolGame::cardsDrawTable() {
this->sub_128_918(g_zbasic->str(279)); // Select a card above
this->var_i16_7a2 = 0xd4;
this->sub_128_918(g_zbasic->str(280)); // or
- g_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, this->arr_pat_58f4[0]);
+ g_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
g_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0xe9;
@@ -202,14 +202,14 @@ void FoolGame::cardsDrawTable() {
void FoolGame::cardsOnClick() {
// 139:06b0
this->var_i16_1e00 = 0;
- if (!((this->var_ev_46.where.x >= 0x78) && (this->var_ev_46.where.y >= 0x19) && (this->var_ev_46.where.x <= 0x187) && (this->var_ev_46.where.y <= 0xae))) {
+ if (!((_event.where.x >= 0x78) && (_event.where.y >= 0x19) && (_event.where.x <= 0x187) && (_event.where.y <= 0xae))) {
// 139:06fc
// didn't click in the three cards area
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_4338)) {
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_4338)) {
g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
this->sub_128_6186();
g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
- if (!g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_4338))
+ if (!g_toolbox->PtInRect(_event.where, this->arr_rect_4338))
return;
// 139:0778
// player clicked the yield button (bad choice)
@@ -232,18 +232,18 @@ void FoolGame::cardsOnClick() {
// 139:07ea
// player picked a card
this->fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
- if (this->var_ev_46.where.x < 0xd2) {
+ if (_event.where.x < 0xd2) {
// 139:0818
this->var_i16_1e00 = 4;
this->drawTarotCard(1, 0, 1);
}
// 139:082e
- if ((this->var_ev_46.where.x >= 0xd2) && (this->var_ev_46.where.x <= 0x12d)) {
+ if ((_event.where.x >= 0xd2) && (_event.where.x <= 0x12d)) {
this->var_i16_1e00 = 5;
this->drawTarotCard(2, 0, 1);
}
// 139:0868
- if (this->var_ev_46.where.x > 0x12d) {
+ if (_event.where.x > 0x12d) {
this->var_i16_1e00 = 6;
this->drawTarotCard(3, 0, 1);
}
@@ -280,20 +280,20 @@ void FoolGame::cardsOnClick() {
g_zbasic->text(0xfc, 9, Graphics::kMacFontRegular, kSrcBic);
this->sub_128_918(g_zbasic->str(282)); // (click mouse to continue)
this->var_i16_2014 = 0;
- this->stateFlags = 0;
- while ((this->stateFlags == 0) && (this->var_i16_2014 == 0)) {
+ _stateFlags = 0;
+ while ((_stateFlags == 0) && (this->var_i16_2014 == 0)) {
this->getNextEvent(-1);
- if (this->var_ev_46.what == kMouseUp) {
+ if (_event.what == kMouseUp) {
this->var_i16_2014 = 1;
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->cardsStoreState();
this->saveGame();
}
}
// 139:09d8
- if (((this->stateFlags & kStateReturn) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->stateFlags = kStateUndo;
+ if (((_stateFlags & kStateReturn) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
+ _stateFlags = kStateUndo;
this->var_i16_2014 = 0;
}
}
@@ -688,20 +688,20 @@ void FoolGame::cardsDrawScores() {
void FoolGame::cardsStoreState() {
// 139:1cba
- this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[5]) +
+ _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[5]) +
g_zbasic->encodeInt(this->arr_i16_1eb8[6]) +
g_zbasic->encodeInt(this->var_i16_2010);
// 139:1d00
for (int i = 0; i <= 0x15; i++) {
- this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
+ _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
}
}
void FoolGame::sub_139_1d3e() {
// 139:1d3e
- this->stateFlags = kFlagMenuEnabled;
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ _stateFlags = kFlagMenuEnabled;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
}
this->sub_128_6186();
this->sub_128_2664();
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 12877a4568f..3d195c639e1 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -47,29 +47,29 @@ void FoolGame::deathRun() {
// 141:0122
g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
- this->var_ev_46.where.y = 0x14;
+ _event.where.y = 0x14;
// JMP 0x3c2
while (true) {
// 141:01c8
// JMP 0x232
- while (this->var_ev_46.where.y >= 0x14) {
+ while (_event.where.y >= 0x14) {
// 141:01cc
this->getNextEvent(-1);
this->deathMoveBlackEye();
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1eb8)) {
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_1eb8)) {
this->deathCaught();
// 141:09f6
this->deathDrawWhiteEye();
return;
}
// 141:0200
- if (this->stateFlags == 2) {
- this->stateFlags = 0;
+ if (_stateFlags == 2) {
+ _stateFlags = 0;
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
- if ((this->stateFlags & kStateReturn)) {
+ if ((_stateFlags & kStateReturn)) {
// 141:09f6
this->deathDrawWhiteEye();
return;
@@ -80,34 +80,34 @@ void FoolGame::deathRun() {
this->sub_128_55c(g_zbasic->str(335)); // "~"
this->var_i16_233a = 1;
// JMP 0x2be
- while (this->var_ev_46.where.y < 0x14) {
+ while (_event.where.y < 0x14) {
// cursor is over the top menu, safe
// 141:0282
this->deathMoveBlackEye();
this->getNextEvent(-1);
- if (this->stateFlags == 2) {
- this->stateFlags = 0;
+ if (_stateFlags == 2) {
+ _stateFlags = 0;
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
}
// 141:02c6
this->getNextEvent(0);
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
this->var_i32_692 = g_toolbox->TickCount();
// 141:02fa
do {
this->getNextEvent(0);
- if (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) &&
- g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ if (((_event.modifiers & kModMouseButtonUp) == 0) &&
+ g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
// JMP 0x9a2
// 141:09a2
this->deathDrawWhiteEye();
g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
this->deathDrawZoom();
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
}
this->deathDrawWhiteEye();
return;
@@ -119,7 +119,7 @@ void FoolGame::deathRun() {
// mouse moved out from menu, zap the white eye
g_toolbox->PenNormal();
g_toolbox->PenMode(kNotPatXor);
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenSize(0x17, 0x10);
for (int i = 0; i <= 5; i++) {
g_toolbox->MoveTo(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top);
@@ -137,8 +137,8 @@ void FoolGame::deathRun() {
void FoolGame::deathMoveBlackEye() {
// 141:03ca
g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
- this->var_i16_68a = this->var_ev_46.where.x - 0xc - this->arr_rect_1eb8.left;
- this->var_i16_68c = this->var_ev_46.where.y - 8 - this->arr_rect_1eb8.top;
+ this->var_i16_68a = _event.where.x - 0xc - this->arr_rect_1eb8.left;
+ this->var_i16_68c = _event.where.y - 8 - this->arr_rect_1eb8.top;
// 141:0452
if (this->var_i16_68c < -4) {
this->var_i16_68c = -4;
@@ -206,14 +206,14 @@ void FoolGame::deathCaught() {
// 141:08b8
this->deathDrawWhiteEye();
this->sub_128_4da(0);
- this->sub_128_962(this->arr_rect_1eb8.top, this->arr_rect_1eb8.left, this->arr_rect_1eb8.bottom, this->arr_rect_1eb8.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ this->zoomRect(this->arr_rect_1eb8.top, this->arr_rect_1eb8.left, this->arr_rect_1eb8.bottom, this->arr_rect_1eb8.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
this->sub_128_4da(1);
}
void FoolGame::deathDrawZoom() {
// 141:0934
for (int i = 1; i <= 2; i++) {
- this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ this->zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
this->sub_128_69c(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index c1fcbe3dbd9..a5941c21845 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -55,15 +55,15 @@ void FoolGame::run() {
void FoolGame::sub_128_004() {
// zero out variables
- storyCurrentChapter = 0;
- sunMapRestored = 0;
- menuDisabled = false;
- menuHidesPlayfield = false;
- isAutoSaving = false;
+ _storyCurrentChapter = 0;
+ _sunMapRestored = 0;
+ _menuDisabled = false;
+ _menuHidesPlayfield = false;
+ _isAutoSaving = false;
// zero out pattern buffer; sub_129_123a uses entry
// 0 for filling the top bar
for (int i = 0; i <= 0x50; i++) {
- Common::fill(arr_pat_58f4[i].data, arr_pat_58f4[i].data + 8, 0);
+ Common::fill(_patterns[i].data, _patterns[i].data + 8, 0);
}
// Define the bitmap surfaces (normally pointers to raw memory)
@@ -80,7 +80,7 @@ void FoolGame::sub_128_004() {
g_zbasic->unk_331(0x1b58, 1);
g_zbasic->unk_331(0x1b58, 2);
- g_toolbox->SetRect(this->arr_rect_1ae06, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->SetRect(_screenClipRect, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
this->var_str_384 = g_zbasic->str(0);
@@ -132,21 +132,21 @@ void FoolGame::sub_128_004() {
this->sub_129_068();
this->var_i32_7c8 = g_zbasic->mem(-1);
// 128:1c88: JMP - [0x1ee2]
- while (this->stateFlags != kStateQuit) {
+ while (_stateFlags != kStateQuit) {
do {
this->getNextEvent(-1);
if (_quit)
return;
- if ((this->var_ev_46.where.y >= 0x8c) && (this->var_ev_46.where.y <= 0x11d)) {
+ if ((_event.where.y >= 0x8c) && (_event.where.y <= 0x11d)) {
this->var_i16_7cc = -1;
}
// 128:1cbe
- if (this->var_ev_46.where.y > 0x11d) {
+ if (_event.where.y > 0x11d) {
this->var_i16_7cc = 1;
}
// 128:1cce
- if ((this->var_ev_46.where.x <= 0x8c) || (this->var_ev_46.where.y < 0xdc)) {
+ if ((_event.where.x <= 0x8c) || (_event.where.y < 0xdc)) {
this->var_i16_7cc = 0;
}
// 128:1cf6
@@ -156,67 +156,67 @@ void FoolGame::sub_128_004() {
if ((this->var_i16_7ce & 2) == 0) {
g_toolbox->InitCursor();
} else {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ g_toolbox->SetCursor(_cursors[0x10]);
}
// 128:1d42
} else {
// 128:1d46
if (this->var_i16_7b2 == -1) {
// arrow pointing up
- g_toolbox->SetCursor(this->arr_curs_4d88[0x2]);
+ g_toolbox->SetCursor(_cursors[0x2]);
}
// 128:1d5e
if (this->var_i16_7b2 == 1) {
// arrow pointing down
- g_toolbox->SetCursor(this->arr_curs_4d88[0x1]);
+ g_toolbox->SetCursor(_cursors[0x1]);
}
}
}
// 128:1d76
- if (this->var_ev_46.what == kMouseDown) {
+ if (_event.what == kMouseDown) {
this->sub_128_1f76();
}
- if ((this->storyCurrentChapter == 0x10) &&
- (this->puzzleCompletionStatus[0x10] < 0x64) &&
- (this->var_ev_46.where.y > 0x113) &&
- (this->var_ev_46.where.x < 0x8c)) {
- this->setStateBits(kStatePuzzleSelect);
+ if ((_storyCurrentChapter == 0x10) &&
+ (_puzzleCompletionStatus[0x10] < 0x64) &&
+ (_event.where.y > 0x113) &&
+ (_event.where.x < 0x8c)) {
+ setStateBits(kStatePuzzleSelect);
}
// 128:1de0
- if (this->sunMapRestored && (this->keyLastPressed == 0x20)) {
- this->setStateBits(0x100);
+ if (_sunMapRestored && (_keyLastPressed == 0x20)) {
+ setStateBits(0x100);
}
// 128:1e06
- } while (this->stateFlags == 0);
+ } while (_stateFlags == 0);
- if (this->stateFlags & kStateReturn) {
+ if (_stateFlags & kStateReturn) {
this->clearStateBits(kStateReturn);
}
- if (this->stateFlags & kStateSaveGame) {
+ if (_stateFlags & kStateSaveGame) {
this->saveGame();
}
- if (this->stateFlags & kStateNewGame) {
+ if (_stateFlags & kStateNewGame) {
this->newGame();
}
- if (this->stateFlags & kStateOpenGame) {
+ if (_stateFlags & kStateOpenGame) {
this->openGame();
}
- if (this->stateFlags & kStateChapterSelect) {
+ if (_stateFlags & kStateChapterSelect) {
this->menuChapterSelect();
}
- if (this->stateFlags & 0x200) {
+ if (_stateFlags & 0x200) {
this->sub_128_1f44();
}
- if (this->stateFlags & kStatePuzzleSelect) {
+ if (_stateFlags & kStatePuzzleSelect) {
this->puzzleRun();
}
- if (this->stateFlags & kStateMetapuzzleSelect) {
+ if (_stateFlags & kStateMetapuzzleSelect) {
this->metapuzzleRun();
}
- if (this->stateFlags & 0x400) {
+ if (_stateFlags & 0x400) {
this->sub_128_2b0a();
}
- if (this->stateFlags & kStateMetapuzzleComplete) {
+ if (_stateFlags & kStateMetapuzzleComplete) {
this->sub_144_004();
}
// 128:1ee2
@@ -226,7 +226,7 @@ void FoolGame::sub_128_004() {
g_zbasic->unk_158();
g_zbasic->unk_4();
g_toolbox->SetPort(this->var_i32_8);
- this->fillRect(0, 0, 0x14, this->var_i16_5a, 2);
+ fillRect(0, 0, 0x14, _windowWidth, 2);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -255,13 +255,13 @@ void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::
this->copyScreen(0, this->arr_bmp_138bc);
// 128:015a
- this->var_ev_46.where.y = this->var_i16_58 + 0x3d;
- this->var_ev_46.where.x = this->var_i16_56 + 0x68;
+ _event.where.y = this->var_i16_58 + 0x3d;
+ _event.where.x = this->var_i16_56 + 0x68;
this->var_i16_16c = 1;
this->var_i32_16e = 0;
// 128:017e
- g_toolbox->SFPutFile(this->var_ev_46.where, title, filename, this->var_i32_16e, this->var_sfr_5e);
+ g_toolbox->SFPutFile(_event.where, title, filename, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -282,8 +282,8 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
this->copyScreen(0, this->arr_bmp_138bc);
// 128:0218
- this->var_ev_46.where.y = this->var_i16_58 + 0x3d;
- this->var_ev_46.where.x = this->var_i16_56 + 0x53;
+ _event.where.y = this->var_i16_58 + 0x3d;
+ _event.where.x = this->var_i16_56 + 0x53;
this->var_i16_16c = 1;
this->var_i32_16e = 0;
// 128:023c
@@ -295,7 +295,7 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
typeList.types[0] += this->var_str_172.at(2) << 8;
typeList.types[0] += this->var_str_172.at(3) << 0;
- g_toolbox->SFGetFile(this->var_ev_46.where, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
+ g_toolbox->SFGetFile(_event.where, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -310,9 +310,9 @@ void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
// convert mouse coordinates to grid coordinates
this->var_i16_68c = unk1;
this->var_i16_68a = unk2;
- this->var_i16_68a = (this->var_ev_46.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
+ this->var_i16_68a = (_event.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
- this->var_i16_68c = (this->var_ev_46.where.y - this->arr_i16_1eb8[5]) / (this->arr_i16_1eb8[7]);
+ this->var_i16_68c = (_event.where.y - this->arr_i16_1eb8[5]) / (this->arr_i16_1eb8[7]);
}
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
@@ -409,7 +409,7 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
this->var_i16_34 = wait;
this->var_i16_32 = duration;
this->var_i16_30 = freq;
- if (this->soundEnabled == 1) {
+ if (_soundEnabled) {
// the volume was originally 150, this is crazy loud.
g_zbasic->sound(this->var_i16_30, this->var_i16_32, 20, 0);
if (this->var_i16_34 == 1) {
@@ -451,10 +451,11 @@ OSErr FoolGame::sub_128_64c(int16 unk1) {
void FoolGame::sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:069c
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[unk6]);
+ g_toolbox->PenPat(_patterns[unk6]);
g_toolbox->PenMode(unk5);
- g_toolbox->SetRect(this->arr_rect_5b7c, unk3, unk4, unk1, unk2);
- g_toolbox->PaintRect(this->arr_rect_5b7c);
+ Common::Rect bounds; // arr_rect_5b7c
+ g_toolbox->SetRect(bounds, unk3, unk4, unk1, unk2);
+ g_toolbox->PaintRect(bounds);
g_toolbox->PenNormal();
}
@@ -463,34 +464,35 @@ void FoolGame::drawTarotCard(int16 rectID, int16 deckPos, int16 type) {
g_toolbox->PenNormal();
if (type == 0) {
g_toolbox->PenSize(0x3, 0x3);
- g_toolbox->PenPat(this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[rectID], 0xf, 0xf);
+ g_toolbox->PenPat(_patterns[0]);
+ g_toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
g_toolbox->PenSize(1, 1);
- g_toolbox->PenPat(this->arr_pat_58f4[2]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[rectID], 0xf, 0xf);
+ g_toolbox->PenPat(_patterns[2]);
+ g_toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
// 128:079e
- g_zbasic->picture(this->arr_rect_1f38[rectID].left + 3, this->arr_rect_1f38[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
+ g_zbasic->picture(_screenGrid[rectID].left + 3, _screenGrid[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
}
// 128:0806
if (type == 1) {
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->PaintRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
+ g_toolbox->PenPat(_patterns[1]);
+ g_toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
if (type == 2) {
g_toolbox->PenMode(kPatOr);
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->PaintRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
+ g_toolbox->PenPat(_patterns[1]);
+ g_toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
if (type == 3) {
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[rectID], 0xc, 0xc);
+ g_toolbox->InvertRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
g_toolbox->PenNormal();
}
void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:08b4
- g_toolbox->SetRect(this->arr_rect_5b7c, left, top, right, bottom);
- g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[patternID]);
+ Common::Rect bounds; // arr_rect_5b7c
+ g_toolbox->SetRect(bounds, left, top, right, bottom);
+ g_toolbox->FillRect(bounds, _patterns[patternID]);
}
void FoolGame::sub_128_918(const Common::U32String &unk1) {
@@ -501,48 +503,51 @@ void FoolGame::sub_128_918(const Common::U32String &unk1) {
g_toolbox->DrawString(this->var_str_172);
}
-void FoolGame::sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1) {
+void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps) {
// Zoom-fill the screen with checkerboard pattern
// after e.g. clicking a story button.
// 128:0962
- this->arr_rect_5b7c.top = unk11;
- this->arr_rect_5b7c.left = unk10;
- this->arr_rect_5b7c.bottom = unk9;
- this->arr_rect_5b7c.right = unk8;
- this->arr_rect_5b84.top = unk7;
- this->arr_rect_5b84.left = unk6;
- this->arr_rect_5b84.bottom = unk5;
- this->arr_rect_5b84.right = unk4;
+ Common::Rect start;
+ Common::Rect end;
+ start.top = startTop;
+ start.left = startLeft;
+ start.bottom = startBottom;
+ start.right = startRight;
+ end.top = endTop;
+ end.left = endLeft;
+ end.bottom = endBottom;
+ end.right = endRight;
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[unk3]);
- g_toolbox->PenMode(unk2);
+ g_toolbox->PenPat(_patterns[patternID]);
+ g_toolbox->PenMode(mode);
// 128:0a42
// unrolled loop
- this->arr_bcd_5dbc[0] = (float)(this->arr_rect_5b7c.top);
- this->arr_bcd_5dbc[1] = (float)(this->arr_rect_5b7c.left);
- this->arr_bcd_5dbc[2] = (float)(this->arr_rect_5b7c.bottom);
- this->arr_bcd_5dbc[3] = (float)(this->arr_rect_5b7c.right);
- this->arr_bcd_5dbc[4] = (float)((this->arr_rect_5b84.top) - (this->arr_rect_5b7c.top))/(float)(unk1);
- this->arr_bcd_5dbc[5] = (float)((this->arr_rect_5b84.left) - (this->arr_rect_5b7c.left))/(float)(unk1);
- this->arr_bcd_5dbc[6] = (float)((this->arr_rect_5b84.bottom) - (this->arr_rect_5b7c.bottom))/(float)(unk1);
- this->arr_bcd_5dbc[7] = (float)((this->arr_rect_5b84.right) - (this->arr_rect_5b7c.right))/(float)(unk1);
+ this->arr_bcd_5dbc[0] = (float)(start.top);
+ this->arr_bcd_5dbc[1] = (float)(start.left);
+ this->arr_bcd_5dbc[2] = (float)(start.bottom);
+ this->arr_bcd_5dbc[3] = (float)(start.right);
+ this->arr_bcd_5dbc[4] = (float)((end.top) - (start.top))/(float)(steps);
+ this->arr_bcd_5dbc[5] = (float)((end.left) - (start.left))/(float)(steps);
+ this->arr_bcd_5dbc[6] = (float)((end.bottom) - (start.bottom))/(float)(steps);
+ this->arr_bcd_5dbc[7] = (float)((end.right) - (start.right))/(float)(steps);
// 128:0af0
- g_toolbox->PaintRect(this->arr_rect_5b7c);
- for (int i = 1; i < unk1-1; i++) {
+ g_toolbox->PaintRect(start);
+ for (int i = 1; i < steps-1; i++) {
for (int j = 0; j <= 3; j++) {
this->arr_bcd_5dbc[j] = (float)this->arr_bcd_5dbc[j] + (float)this->arr_bcd_5dbc[j+4];
}
- this->arr_rect_5b92.top = (int)this->arr_bcd_5dbc[0];
- this->arr_rect_5b92.left = (int)this->arr_bcd_5dbc[1];
- this->arr_rect_5b92.bottom = (int)this->arr_bcd_5dbc[2];
- this->arr_rect_5b92.right = (int)this->arr_bcd_5dbc[3];
+ Common::Rect temp; // arr_rect_5b92
+ temp.top = (int)this->arr_bcd_5dbc[0];
+ temp.left = (int)this->arr_bcd_5dbc[1];
+ temp.bottom = (int)this->arr_bcd_5dbc[2];
+ temp.right = (int)this->arr_bcd_5dbc[3];
// 128:0ba6
- g_toolbox->PaintRect(this->arr_rect_5b92);
+ g_toolbox->PaintRect(temp);
// new: force a redraw delay
g_toolbox->Delay(0);
}
// 128:0bc8
- g_toolbox->PaintRect(this->arr_rect_5b84);
+ g_toolbox->PaintRect(end);
g_toolbox->PenNormal();
}
@@ -562,35 +567,35 @@ void FoolGame::getNextEvent(uint32 unk1) {
// This function is usually called at the start of an event processing loop,
// so yield to the event pump/display update when necessary.
- if (this->var_ev_46.what == kNullEvent)
+ if (_event.what == kNullEvent)
g_toolbox->Delay(0);
- this->var_i16_78a = g_toolbox->GetNextEvent(unk1, this->var_ev_46);
- if ((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y < 0x14)) {
+ this->var_i16_78a = g_toolbox->GetNextEvent(unk1, _event);
+ if ((_event.what == kMouseDown) && (_event.where.y < 0x14)) {
this->sub_128_5b30();
}
// 128:0caa
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == kKeyDown) {
+ g_toolbox->GlobalToLocal(_event.where);
+ if (_event.what == kKeyDown) {
// the original just checked the command key,
// non-mac PCs expect the control key to work
- if ((this->var_ev_46.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0) {
+ if ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0) {
this->sub_128_5f9e();
} else {
this->sub_128_5baa();
}
}
// 128:0ce0
- if ((this->var_ev_46.what == kAutoKey) && ((this->var_ev_46.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0)) {
+ if ((_event.what == kAutoKey) && ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0)) {
this->sub_128_5f9e();
}
- if (this->var_ev_46.what == kUpdateEvt) {
+ if (_event.what == kUpdateEvt) {
this->sub_128_5fb4();
}
- if (this->var_ev_46.what == kDiskEvt) {
+ if (_event.what == kDiskEvt) {
this->sub_128_6154();
}
- if ((this->var_ev_46.what == kScummVMQuitEvt) || (this->var_ev_46.what == kScummVMReturnToLauncherEvt)) {
+ if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
this->menuQuit();
}
}
@@ -598,15 +603,16 @@ void FoolGame::getNextEvent(uint32 unk1) {
void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// flash a rectangle on the screen until we get a click
// 128:0d34
- this->arr_rect_5b7c.top = unk5;
- this->arr_rect_5b7c.left = unk4;
- this->arr_rect_5b7c.bottom = unk3;
- this->arr_rect_5b7c.right = unk2;
- while (this->var_ev_46.modifiers & kModMouseButtonUp) {
+ Common::Rect bounds; // arr_rect_5b7c
+ bounds.top = unk5;
+ bounds.left = unk4;
+ bounds.bottom = unk3;
+ bounds.right = unk2;
+ while (_event.modifiers & kModMouseButtonUp) {
// 128:0d94
do {
// FIXME: Flashing far too intense
- g_toolbox->InvertRect(this->arr_rect_5b7c);
+ g_toolbox->InvertRect(bounds);
this->var_i16_3a = 0;
do {
// originally this used getNextEvent, but we avoid that here
@@ -614,13 +620,13 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
// originally this mask was 0, but we change it here to
// intercept all events, and fall back to NullEvent +
// wait for vsync if no events were received.
- this->var_i16_78a = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- if (this->var_ev_46.what == kNullEvent) {
+ this->var_i16_78a = g_toolbox->GetNextEvent(-1, _event);
+ if (_event.what == kNullEvent) {
g_toolbox->Delay(0);
this->var_i16_3a += 1;
}
- } while (!((this->var_i16_3a >= (unk1*60/1000)) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
- } while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0);
+ } while (!((this->var_i16_3a >= (unk1*60/1000)) || ((_event.modifiers & kModMouseButtonUp) == 0)));
+ } while ((_event.modifiers & kModMouseButtonUp) != 0);
}
}
@@ -644,7 +650,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_7b6 = 0;
for (int i = 0; i <= this->var_i16_7ac; i++) {
// 128:0e86
- this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[i]);
+ this->var_i16_7ba = g_toolbox->StringWidth(_modalText[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
}
@@ -661,25 +667,26 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_7b4 = (this->var_i16_7b4 / 2) + 0xf;
this->var_i16_7b6 = (this->var_i16_7b6 / 2);
g_toolbox->PenNormal();
- g_toolbox->SetRect(this->arr_rect_5b7c, 0xf5-this->var_i16_7b4, 0xa0-this->var_i16_7b6, 0x10b+this->var_i16_7b4, 0xb6+this->var_i16_7b6);
- g_toolbox->PenPat(this->arr_pat_58f4[0]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
- g_toolbox->InsetRect(this->arr_rect_5b7c, 1, 1);
+ Common::Rect bounds; // arr_rect_5b7c
+ g_toolbox->SetRect(bounds, 0xf5-this->var_i16_7b4, 0xa0-this->var_i16_7b6, 0x10b+this->var_i16_7b4, 0xb6+this->var_i16_7b6);
+ g_toolbox->PenPat(_patterns[0]);
+ g_toolbox->FrameRect(bounds);
+ g_toolbox->InsetRect(bounds, 1, 1);
g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(this->arr_pat_58f4[2]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
- g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
+ g_toolbox->PenPat(_patterns[2]);
+ g_toolbox->FrameRect(bounds);
+ g_toolbox->InsetRect(bounds, 5, 5);
g_toolbox->PenSize(5, 5);
// 128:0ff8
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
- g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
- g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[2]);
+ g_toolbox->PenPat(_patterns[1]);
+ g_toolbox->FrameRect(bounds);
+ g_toolbox->InsetRect(bounds, 5, 5);
+ g_toolbox->FillRect(bounds, _patterns[2]);
g_toolbox->PenNormal();
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
// 128:1056
for (int i = 0; i <= this->var_i16_7ac; i++) {
- this->var_str_384 = this->arr_str_1a8d8[i];
+ this->var_str_384 = _modalText[i];
this->sub_128_918(this->var_str_384);
// 128:1086
// 128:1086: CLR.W - -0x772(A5)
@@ -691,133 +698,133 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// 128:10c0
- // loop to zero out three rectangles??
- this->arr_rect_5b7c = Common::Rect(0, 0, 0, 0);
- this->arr_rect_5b84 = Common::Rect(0, 0, 0, 0);
- this->arr_rect_5b8c = Common::Rect(0, 0, 0, 0);
+ // loop to zero out three button rects
+ Common::Rect button1 = Common::Rect(0, 0, 0, 0); // arr_rect_5b7c
+ Common::Rect button2 = Common::Rect(0, 0, 0, 0); // arr_rect_5b84
+ Common::Rect button3 = Common::Rect(0, 0, 0, 0); // arr_rect_5b8c
// 128:10e2
if (this->var_i16_7ae == 1) {
- g_toolbox->SetRect(this->arr_rect_5b7c, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(button1, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
// 128:1122
} else if (this->var_i16_7ae == 2) {
- g_toolbox->SetRect(this->arr_rect_5b7c, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
- g_toolbox->SetRect(this->arr_rect_5b84, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(button1, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(button2, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
// 128:1182
} else if (this->var_i16_7ae == 3) {
- g_toolbox->SetRect(this->arr_rect_5b7c, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
- g_toolbox->SetRect(this->arr_rect_5b84, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
- g_toolbox->SetRect(this->arr_rect_5b8c, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(button1, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(button2, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ g_toolbox->SetRect(button3, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
}
// 128:1208
if (this->var_i16_7ae >= 1) {
- g_toolbox->EraseRoundRect(this->arr_rect_5b7c, 0xa, 0xa);
- g_toolbox->FrameRoundRect(this->arr_rect_5b7c, 0xa, 0xa);
- this->var_str_172 = this->arr_str_1a8d8[(this->var_i16_7ac + 1)];
+ g_toolbox->EraseRoundRect(button1, 0xa, 0xa);
+ g_toolbox->FrameRoundRect(button1, 0xa, 0xa);
+ this->var_str_172 = _modalText[(this->var_i16_7ac + 1)];
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
// 128:1274
- this->var_i16_30 = this->arr_rect_5b7c.left + ((this->arr_rect_5b7c.right - this->arr_rect_5b7c.left) / 2) - (this->var_i16_30 / 2);
+ this->var_i16_30 = button1.left + ((button1.right - button1.left) / 2) - (this->var_i16_30 / 2);
// 128:12d4
g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
g_toolbox->DrawString(this->var_str_172);
if (this->var_i16_7ae > 1) {
- g_toolbox->InsetRect(this->arr_rect_5b7c, -2, -2);
- g_toolbox->PenPat(this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_5b7c, 0xa, 0xa);
+ g_toolbox->InsetRect(button1, -2, -2);
+ g_toolbox->PenPat(_patterns[0]);
+ g_toolbox->FrameRoundRect(button1, 0xa, 0xa);
g_toolbox->PenNormal();
- g_toolbox->InsetRect(this->arr_rect_5b7c, 2, 2);
+ g_toolbox->InsetRect(button1, 2, 2);
}
}
// 128:134c
if (this->var_i16_7ae >= 2) {
- g_toolbox->EraseRoundRect(this->arr_rect_5b84, 0xa, 0xa);
- g_toolbox->FrameRoundRect(this->arr_rect_5b84, 0xa, 0xa);
- this->var_str_172 = this->arr_str_1a8d8[(this->var_i16_7ac+2)];
+ g_toolbox->EraseRoundRect(button2, 0xa, 0xa);
+ g_toolbox->FrameRoundRect(button2, 0xa, 0xa);
+ this->var_str_172 = _modalText[(this->var_i16_7ac+2)];
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- this->var_i16_30 = this->arr_rect_5b84.left + ((this->arr_rect_5b84.right - this->arr_rect_5b84.left)/2) - (this->var_i16_30 / 2);
+ this->var_i16_30 = button2.left + ((button2.right - button2.left)/2) - (this->var_i16_30 / 2);
// 128:1418
g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
g_toolbox->DrawString(this->var_str_172);
}
// 128:1432
if (this->var_i16_7ae == 3) {
- g_toolbox->EraseRoundRect(this->arr_rect_5b8c, 0xa, 0xa);
- g_toolbox->FrameRoundRect(this->arr_rect_5b8c, 0xa, 0xa);
- this->var_str_172 = this->arr_str_1a8d8[this->var_i16_7ac+3];
+ g_toolbox->EraseRoundRect(button3, 0xa, 0xa);
+ g_toolbox->FrameRoundRect(button3, 0xa, 0xa);
+ this->var_str_172 = _modalText[this->var_i16_7ac+3];
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- this->var_i16_30 = (this->arr_rect_5b8c.left + ((this->arr_rect_5b8c.right - this->arr_rect_5b8c.left)/2)) - (this->var_i16_30/2);
+ this->var_i16_30 = (button3.left + ((button3.right - button3.left)/2)) - (this->var_i16_30/2);
g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
g_toolbox->DrawString(this->var_str_172);
}
// 128:1518
this->sub_128_61ec();
- this->savePromptChoice = 0;
+ _savePromptChoice = 0;
// 128:1522
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, this->var_ev_46);
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == kMouseDown) {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, _event);
+ g_toolbox->GlobalToLocal(_event.where);
+ if (_event.what == kMouseDown) {
// 128:154a
- this->savePromptChoice = 0;
+ _savePromptChoice = 0;
Common::Rect target;
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b7c)) {
- this->savePromptChoice = 1;
- target = this->arr_rect_5b7c;
+ if (g_toolbox->PtInRect(_event.where, button1)) {
+ _savePromptChoice = 1;
+ target = button1;
}
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b84)) {
- this->savePromptChoice = 2;
- target = this->arr_rect_5b84;
+ if (g_toolbox->PtInRect(_event.where, button2)) {
+ _savePromptChoice = 2;
+ target = button2;
}
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_5b8c)) {
- this->savePromptChoice = 3;
- target = this->arr_rect_5b8c;
+ if (g_toolbox->PtInRect(_event.where, button3)) {
+ _savePromptChoice = 3;
+ target = button3;
}
- if (this->savePromptChoice > 0) {
+ if (_savePromptChoice > 0) {
// 128:15d2
- this->var_i16_30 = (this->savePromptChoice - 1)*4;
+ this->var_i16_30 = (_savePromptChoice - 1)*4;
do {
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1624
- while ((this->var_ev_46.what != kMouseUp) && (g_toolbox->PtInRect(this->var_ev_46.where, target))) {
+ while ((_event.what != kMouseUp) && (g_toolbox->PtInRect(_event.where, target))) {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == kNullEvent) {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ g_toolbox->GlobalToLocal(_event.where);
+ if (_event.what == kNullEvent) {
g_toolbox->Delay(0);
}
}
g_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
- while ((this->var_ev_46.what != kMouseUp) && (!g_toolbox->PtInRect(this->var_ev_46.where, target))) {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == kNullEvent) {
+ while ((_event.what != kMouseUp) && (!g_toolbox->PtInRect(_event.where, target))) {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ g_toolbox->GlobalToLocal(_event.where);
+ if (_event.what == kNullEvent) {
g_toolbox->Delay(0);
}
}
// 128:16ea
- } while (this->var_ev_46.what != kMouseUp);
+ } while (_event.what != kMouseUp);
- if (!g_toolbox->PtInRect(this->var_ev_46.where, target)) {
- this->savePromptChoice = 0;
+ if (!g_toolbox->PtInRect(_event.where, target)) {
+ _savePromptChoice = 0;
}
this->sub_128_61ec();
}
}
// 128:172c
- if (this->var_ev_46.what == kKeyDown) {
- this->keyLastPressed = this->var_ev_46.message & 0xff;
- if (this->keyLastPressed == 0xd) {
- this->savePromptChoice = 1;
+ if (_event.what == kKeyDown) {
+ _keyLastPressed = _event.message & 0xff;
+ if (_keyLastPressed == 0xd) {
+ _savePromptChoice = 1;
}
}
- if (this->var_ev_46.what == kNullEvent)
+ if (_event.what == kNullEvent)
g_toolbox->Delay(0);
// 128:175c
- } while (this->savePromptChoice == 0);
+ } while (_savePromptChoice == 0);
this->sub_128_61ec();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -832,14 +839,14 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
this->var_i16_32 = unk1;
this->var_i16_30 = unk2;
if (this->var_i16_30 > 0) {
- if ((this->puzzleFlags[this->var_i16_30] & kFlagMenuDiamond)) {
- this->puzzleFlags[this->var_i16_30] ^= kFlagMenuDiamond;
- this->puzzleFlags[this->var_i16_30] |= kFlagMenuEnabled;
+ if ((_puzzleFlags[this->var_i16_30] & kFlagMenuDiamond)) {
+ _puzzleFlags[this->var_i16_30] ^= kFlagMenuDiamond;
+ _puzzleFlags[this->var_i16_30] |= kFlagMenuEnabled;
}
// 128:1818
this->var_i16_34 = 3 + ((this->var_i16_30 - 1) / 0x10);
this->var_i16_36 = 1 + ((this->var_i16_30 - 1) % 0x10);
- this->var_str_172 = this->arr_str_195e8[this->var_i16_30] + g_zbasic->str(9);
+ this->var_str_172 = _puzzleName[this->var_i16_30] + g_zbasic->str(9);
// add the wadjet eye next to the chapter name
g_zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
}
@@ -898,11 +905,11 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
}
// 128:1bc2
if (this->var_i16_32 == 1) {
- g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_58f4[3]);
+ g_toolbox->FillRect(this->arr_rect_4338, _patterns[3]);
}
// 128:1be6
if (this->var_i16_32 == 2) {
- g_toolbox->FillRect(this->arr_rect_4338, this->arr_pat_58f4[0x47]);
+ g_toolbox->FillRect(this->arr_rect_4338, _patterns[0x47]);
}
// 128:1c0a
// was 1
@@ -914,13 +921,13 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
void FoolGame::setStateBits(uint16 bits) {
// 128:1c2c
- this->stateFlags |= bits;
+ _stateFlags |= bits;
}
void FoolGame::clearStateBits(uint16 bits) {
// 128:1c4a
- if (this->stateFlags & bits) {
- this->stateFlags ^= bits;
+ if (_stateFlags & bits) {
+ _stateFlags ^= bits;
}
// 128:1c78
}
@@ -928,7 +935,7 @@ void FoolGame::clearStateBits(uint16 bits) {
void FoolGame::sub_128_1ef8() {
// 128:1ef8
g_toolbox->SetPort(this->var_i32_8);
- this->fillRect(0, 0, 0x14, this->var_i16_5a, 2);
+ fillRect(0, 0, 0x14, _windowWidth, 2);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -942,7 +949,7 @@ void FoolGame::sub_128_1f1e() {
void FoolGame::sub_128_1f44() {
// 128:1f44
this->sub_128_61ec();
- this->storyCurrentPage = 0;
+ _storyCurrentPage = 0;
this->clearStateBits(0x200);
this->sub_128_5fea();
this->copyScreen(1, this->arr_bmp_5dfc);
@@ -961,16 +968,16 @@ void FoolGame::sub_128_1f76() {
this->sub_128_406(10);
// new: empty the event queue, so feedback is instant
g_toolbox->FlushEvents(-1, 0);
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- } while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ } while ((_event.modifiers & kModMouseButtonUp) == 0);
} else {
// 128:1fee
- if ((this->storyCurrentChapter == 0x10) && (this->puzzleCompletionStatus[0x10] < 0x64) && (this->var_ev_46.where.y > 0x113) && (this->var_ev_46.where.x < 0x8c)) {
+ if ((_storyCurrentChapter == 0x10) && (_puzzleCompletionStatus[0x10] < 0x64) && (_event.where.y > 0x113) && (_event.where.x < 0x8c)) {
return;
}
// 128:2042
if (this->var_i16_7d6 != 0) {
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
this->sub_128_2078();
}
}
@@ -985,7 +992,7 @@ void FoolGame::sub_128_2078() {
g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
this->sub_128_6186();
g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
this->sub_128_21c8();
}
}
@@ -994,34 +1001,34 @@ void FoolGame::sub_128_20d0() {
// 128:20d0
// change page on scroll
do {
- this->storyNextPage += this->var_i16_7cc;
- if (this->storyNextPage < 1) {
- this->storyNextPage = 1;
+ _storyNextPage += this->var_i16_7cc;
+ if (_storyNextPage < 1) {
+ _storyNextPage = 1;
return;
}
- if (this->storyNextPage > this->storyPageCount) {
- this->storyNextPage = this->storyPageCount;
+ if (_storyNextPage > _storyPageCount) {
+ _storyNextPage = _storyPageCount;
return;
}
- } while (this->pageVisible[this->storyNextPage] == 0);
+ } while (_pageVisible[_storyNextPage] == 0);
this->storyRenderPage();
}
void FoolGame::menuChapterSelect() {
this->clearStateBits(kStateChapterSelect);
// 128:2132
- for (int i = this->selectedMenuChapter; i <= this->storyPageCount; i++) {
- if (this->selectedMenuChapter == this->pageToChapter[i]) {
- this->storyNextPage = i;
- i = this->storyPageCount;
+ for (int i = _selectedMenuChapter; i <= _storyPageCount; i++) {
+ if (_selectedMenuChapter == _pageToChapter[i]) {
+ _storyNextPage = i;
+ i = _storyPageCount;
}
// 128:2160
}
// 128:2170
- this->storyCurrentChapter = this->pageToChapter[this->storyNextPage];
+ _storyCurrentChapter = _pageToChapter[_storyNextPage];
if (this->var_i16_7ce & 4) {
this->var_i16_7ce ^= 4;
- if (this->puzzleType[this->storyCurrentChapter] > 0) {
+ if (_puzzleType[_storyCurrentChapter] > 0) {
// 128:21bc
this->sub_128_21c8();
return;
@@ -1033,21 +1040,21 @@ void FoolGame::menuChapterSelect() {
void FoolGame::sub_128_21c8() {
// 128:21c8
- if ((this->storyCurrentChapter == 1) && (this->sunMapRestored > 0)) {
- this->setStateBits(0x100);
+ if ((_storyCurrentChapter == 1) && (_sunMapRestored > 0)) {
+ setStateBits(0x100);
} else {
- this->setStateBits(kStatePuzzleSelect);
+ setStateBits(kStatePuzzleSelect);
}
}
void FoolGame::storyRenderPage() {
// 128:2202
- if (this->storyNextPage != this->storyCurrentPage) {
- if ((this->arr_i16_1dee[this->storyNextPage] < 0xe) && (this->var_i16_7de > 0)) {
+ if (_storyNextPage != _storyCurrentPage) {
+ if ((_pageLines[_storyNextPage] < 0xe) && (this->var_i16_7de > 0)) {
this->sub_128_69c(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
// 128:226e
// grab the last N-1 lines of text from the screen
- g_zbasic->get(0x3c, 0x122 - (0xf - this->arr_i16_1dee[this->storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
+ g_zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
this->var_i16_7e0 = 1;
} else {
// 128:22d4
@@ -1056,22 +1063,22 @@ void FoolGame::storyRenderPage() {
}
// 128:22da
// erase lower controls on scroll
- this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
- this->storyCurrentChapter = this->pageToChapter[this->storyNextPage];
+ fillRect(0x127, 0x69, 0x138, 0x190, 0);
+ _storyCurrentChapter = _pageToChapter[_storyNextPage];
// if we've solved a puzzle, fill the scroll with crazy patterns
if ((this->var_i16_7ce & 0x8) != 0) {
this->var_i16_7ce ^= 0x8;
- this->sub_128_bde(1, 0, 0, 0, 1, 0);
- this->sub_128_bde(1, 0, 0, 0, 0, 0);
+ this->sub_128_bde(1, 0, kSrcCopy, 0, 1, 0);
+ this->sub_128_bde(1, 0, kSrcCopy, 0, 0, 0);
}
// 128:235e
- if (this->puzzleType[this->storyCurrentChapter] > 0) {
+ if (_puzzleType[_storyCurrentChapter] > 0) {
this->var_str_384 = g_zbasic->str(10); // ?
- if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x63) {
+ if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
this->var_str_384 = g_zbasic->str(11); // ~
}
// 128:23b8
- if (this->puzzleCompletionStatus[this->storyCurrentChapter] >= 0x64) {
+ if (_puzzleCompletionStatus[_storyCurrentChapter] >= 0x64) {
this->var_str_384 = g_zbasic->str(12); // *
}
// 128:23e8
@@ -1080,32 +1087,32 @@ void FoolGame::storyRenderPage() {
this->var_i16_7d6 = 1;
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x8a, 0x133);
- g_toolbox->DrawString(this->arr_str_195e8[this->storyCurrentChapter]);
+ g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x70, 0x133);
- g_toolbox->DrawString(this->arr_str_195e8[this->storyCurrentChapter]);
+ g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
}
// 128:2468
- if (this->arr_str_1a288[this->storyNextPage] != g_zbasic->str(13)) { // blank
+ if (_pageNumberText[_storyNextPage] != g_zbasic->str(13)) { // blank
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
- g_toolbox->DrawString(this->arr_str_1a288[this->storyNextPage]);
+ g_toolbox->DrawString(_pageNumberText[_storyNextPage]);
}
// 128:24be
- if (this->storyNextPage != this->storyCurrentPage) {
+ if (_storyNextPage != _storyCurrentPage) {
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
+ fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
if (this->var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
g_zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kPutCopy);
}
// 128:252a
// y-position where the story text should start
- this->var_i16_7a2 = 0x11d - (this->arr_i16_1dee[this->storyNextPage] * 0xf);
- debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", this->storyNextPage, this->arr_i16_1dee[this->storyNextPage]);
- if (this->arr_i16_1dee[this->storyNextPage] < 0xf) {
+ this->var_i16_7a2 = 0x11d - (_pageLines[_storyNextPage] * 0xf);
+ debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", _storyNextPage, _pageLines[_storyNextPage]);
+ if (_pageLines[_storyNextPage] < 0xf) {
g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
g_toolbox->DrawString(g_zbasic->str(14)); // infinity symbol
this->var_i16_7de = this->var_i16_7a2 - 0x1e;
@@ -1116,11 +1123,11 @@ void FoolGame::storyRenderPage() {
// 128:25b6
// printing the story to the screen
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
- for (int i = this->pageLineRanges[this->storyNextPage*2]; i <= this->pageLineRanges[this->storyNextPage*2+1]; i++) {
- g_toolbox->TextFace(this->pageLineFace[i]);
+ for (int i = _pageLineRanges[_storyNextPage*2]; i <= _pageLineRanges[_storyNextPage*2+1]; i++) {
+ g_toolbox->TextFace(_pageLineFace[i]);
this->var_str_384 = g_zbasic->index(0, i);
g_toolbox->DrawString(this->var_str_384);
- if (this->pageLineBreak[i] != 0) {
+ if (_pageLineBreak[i] != 0) {
// 128:262a
this->var_i16_7a2 += 0xf;
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
@@ -1128,7 +1135,7 @@ void FoolGame::storyRenderPage() {
// 128:263a
}
// 128:265c
- this->storyCurrentPage = this->storyNextPage;
+ _storyCurrentPage = _storyNextPage;
}
// 128:2662
}
@@ -1137,11 +1144,11 @@ void FoolGame::sub_128_2664() {
// 128:2664
// hide menu and replace with "click mouse to continue" message
g_toolbox->SetPort(this->var_i32_8);
- this->fillRect(0, 7, 0x13, this->var_i16_5a-7, 0);
+ fillRect(0, 7, 0x13, _windowWidth-7, 0);
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_str_172 = g_zbasic->str(15); // click mouse to continue
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xf);
+ g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xf);
g_toolbox->DrawString(this->var_str_172);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
@@ -1155,16 +1162,16 @@ void FoolGame::sub_128_26f6() {
}
void FoolGame::sub_128_271a() {
- int position = this->puzzleDataOffsets[this->activePuzzle] - 1;
+ int position = _puzzleDataOffsets[_activePuzzle] - 1;
// record index
this->var_i16_484 = (int16)(position / 1000);
// offset at record
this->var_i16_7e4 = (int16)(position % 1000);
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
this->var_ptr_696 = 0;
- int length = this->puzzleDataOffsets[this->activePuzzle + 1] - this->puzzleDataOffsets[this->activePuzzle];
+ int length = _puzzleDataOffsets[_activePuzzle + 1] - _puzzleDataOffsets[_activePuzzle];
debugC(8, kDebugLoading, "sub_128_271a: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
- this->activePuzzle,
+ _activePuzzle,
position,
this->var_i16_484,
this->var_i16_7e4,
@@ -1179,12 +1186,12 @@ void FoolGame::sub_128_271a() {
void FoolGame::menuNewGame() {
// 128:27d6
this->savePrompt();
- if (this->savePromptChoice == 3)
+ if (_savePromptChoice == 3)
return;
if (this->var_i16_7ce & 1) {
- this->setStateBits(kStateNewGame | kStateReturn);
+ setStateBits(kStateNewGame | kStateReturn);
} else {
- this->setStateBits(kStateNewGame);
+ setStateBits(kStateNewGame);
}
}
@@ -1221,8 +1228,8 @@ void FoolGame::sub_128_2808() {
// 128:28f8: LEA - [0x3818],A0
// 128:28fc: MOVE.L - A0,-0x8ee(A5)
if (this->var_i16_7e6 != 0) {
- this->arr_str_1a8d8[0] = g_zbasic->str(17) + this->var_str_588 + g_zbasic->str(18);
- this->arr_str_1a8d8[1] = g_zbasic->str(19);
+ _modalText[0] = g_zbasic->str(17) + this->var_str_588 + g_zbasic->str(18);
+ _modalText[1] = g_zbasic->str(19);
this->sub_128_dfe(0, 0, 1, 1);
this->var_str_588 = g_zbasic->str(20);
this->var_i16_7e6 = 0;
@@ -1242,12 +1249,12 @@ void FoolGame::menuOpenGame() {
}
this->savePrompt();
// 128:29d4
- if (this->savePromptChoice != 3) {
+ if (_savePromptChoice != 3) {
if ((this->var_i16_7ce & 1) != 0) {
- this->setStateBits(kStateOpenGame | kStateReturn);
+ setStateBits(kStateOpenGame | kStateReturn);
} else {
// 128:29fa
- this->setStateBits(kStateOpenGame);
+ setStateBits(kStateOpenGame);
}
this->cursorWatch();
}
@@ -1256,21 +1263,21 @@ void FoolGame::menuOpenGame() {
void FoolGame::menuSaveGame() {
// 128:2a06
// File -> Save
- this->setStateBits(kStateSaveGame);
+ setStateBits(kStateSaveGame);
}
void FoolGame::saveGameAs() {
// 128:2a0e
- if (saveFileName.empty()) { // was: str(24)
+ if (_saveFileName.empty()) { // was: str(24)
// 128:2a28
this->openSaveFileDialog(g_zbasic->str(25), g_zbasic->str(26)); // name of game, blank
} else {
// 128:2a48
- this->openSaveFileDialog(g_zbasic->str(27), saveFileName); // New Name?, old filename
+ this->openSaveFileDialog(g_zbasic->str(27), _saveFileName); // New Name?, old filename
}
// 128:2a60
if (!this->var_str_486.empty()) { // was: str(28)
- saveFileName = this->var_str_486;
+ _saveFileName = this->var_str_486;
this->var_i16_9ec = this->var_i16_586;
// 128:2a90
}
@@ -1281,7 +1288,7 @@ void FoolGame::menuSaveGameAs() {
// File -> Save As
this->saveGameAs();
if (!this->var_str_486.empty()) { // was: str(29)
- this->setStateBits(kStateSaveGame);
+ setStateBits(kStateSaveGame);
}
}
@@ -1290,13 +1297,13 @@ void FoolGame::menuSaveGameAs() {
void FoolGame::menuQuit() {
// 128:2ab6
this->savePrompt();
- if (this->savePromptChoice == 3) {
+ if (_savePromptChoice == 3) {
return;
}
if ((this->var_i16_7ce & 1) != 0) {
- this->setStateBits(kStateQuit | kStateReturn);
+ setStateBits(kStateQuit | kStateReturn);
} else {
- this->setStateBits(kStateQuit);
+ setStateBits(kStateQuit);
}
}
@@ -1304,9 +1311,9 @@ void FoolGame::menuQuit() {
void FoolGame::menuPrintStory() {
// 128:2ae8
if (this->var_i16_7ce & 1) {
- this->stateFlags = 0x401;
+ _stateFlags = 0x401;
} else {
- this->stateFlags = 0x400;
+ _stateFlags = 0x400;
}
}
@@ -1314,7 +1321,7 @@ void FoolGame::menuPrintStory() {
void FoolGame::sub_128_2b0a() {
// 128:2b0a
- this->stateFlags = 0;
+ _stateFlags = kStateNull;
// printing the story
warning("STUB: %s", __func__);
}
@@ -1324,7 +1331,7 @@ void FoolGame::newGame() {
this->clearStateBits(kStateNewGame);
this->cursorWatch();
this->sub_128_3744();
- saveFileName = g_zbasic->str(33);
+ _saveFileName = g_zbasic->str(33);
this->var_i16_9ec = 0;
// set up the initially visible story chapters
@@ -1339,18 +1346,18 @@ void FoolGame::newGame() {
// 128:2c5e
for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
- if (this->arr_i16_4758[j] & this->bitLUT[i]) {
- this->pageVisible[this->var_i16_484] = 1;
+ if (this->arr_i16_4758[j] & _bitLUT[i]) {
+ _pageVisible[this->var_i16_484] = 1;
} else {
// 128:2ca6
- this->pageVisible[this->var_i16_484] = 0;
+ _pageVisible[this->var_i16_484] = 0;
}
// 128:2cb6
}
}
// 128:2cce
for (int16 i = 1; i <= 0x51; i++) {
- this->sunMapTileID[i] = i;
+ _sunMapTileID[i] = i;
}
g_zbasic->unk_20();
// 128:2cf6
@@ -1358,24 +1365,24 @@ void FoolGame::newGame() {
for (int i = 1; i <= 0x64; i++) {
this->var_i16_484 = g_zbasic->rndInt(0x51);
this->var_i16_7e4 = g_zbasic->rndInt(0x51);
- g_zbasic->swapInt(this->sunMapTileID[this->var_i16_484], this->sunMapTileID[this->var_i16_7e4]);
- this->puzzleCompletionStatus[i] = 0;
- this->puzzleFlags[i] = kFlagMenuDisabled;
+ g_zbasic->swapInt(_sunMapTileID[this->var_i16_484], _sunMapTileID[this->var_i16_7e4]);
+ _puzzleCompletionStatus[i] = 0;
+ _puzzleFlags[i] = kFlagMenuDisabled;
}
// 128:2d6a
this->var_i16_484 = 0;
- for (int i = 1; i <= this->storyPageCount; i++) {
- if (this->pageToChapter[i] == this->var_i16_484+1) {
+ for (int i = 1; i <= _storyPageCount; i++) {
+ if (_pageToChapter[i] == this->var_i16_484+1) {
// 128:2d9c
this->var_i16_484++;
- if (this->pageVisible[i] == 1) {
- if (this->puzzleUnlockChapter[this->var_i16_484] != 0) {
+ if (_pageVisible[i] == 1) {
+ if (_puzzleUnlockChapter[this->var_i16_484] != 0) {
this->var_i16_9f2 = kFlagMenuDiamond;
} else {
this->var_i16_9f2 = kFlagMenuEnabled;
}
// 128:2de2
- this->puzzleFlags[this->var_i16_484] = this->var_i16_9f2 + 4;
+ _puzzleFlags[this->var_i16_484] = this->var_i16_9f2 + 4;
}
// 128:2e02
}
@@ -1383,10 +1390,10 @@ void FoolGame::newGame() {
}
// 128:2e14
g_zbasic->indexClear(0x2);
- this->storyNextPage = 1;
+ _storyNextPage = 1;
this->var_i16_7ce = 0;
- this->activePuzzle = 0;
- this->sunMapRestored = 0;
+ _activePuzzle = 0;
+ _sunMapRestored = 0;
this->var_i16_7b2 = 0;
this->sub_128_3032();
// 128:2e3c
@@ -1398,26 +1405,26 @@ void FoolGame::openGame() {
this->clearStateBits(kStateOpenGame);
this->cursorWatch();
this->sub_128_3744();
- saveFileName = this->var_str_588;
+ _saveFileName = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
this->var_i16_7e6 = 0;
// FIXME: disk error handler??
// 128:2e68: LEA - [0x3808],A0
// 128:2e6c: MOVE.L - A0,-0x8ee(A5)
// 128:2e70: SF - 0x8,D0
- g_zbasic->openR(2, saveFileName, 0x400, this->var_i16_9ec);
+ g_zbasic->openR(2, _saveFileName, 0x400, this->var_i16_9ec);
this->var_str_384 = g_zbasic->readFileStr(2, 0x11);
- this->storyNextPage = g_zbasic->readFileInt(2);
- this->activePuzzle = g_zbasic->readFileInt(2);
+ _storyNextPage = g_zbasic->readFileInt(2);
+ _activePuzzle = g_zbasic->readFileInt(2);
this->var_i16_7ce = g_zbasic->readFileInt(2);
- this->sunMapRestored = g_zbasic->readFileInt(2);
+ _sunMapRestored = g_zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
- this->puzzleFlags[i] = g_zbasic->readFileInt(2);
- this->puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
- this->pageVisible[i] = g_zbasic->readFileInt(2);
+ _puzzleFlags[i] = g_zbasic->readFileInt(2);
+ _puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
+ _pageVisible[i] = g_zbasic->readFileInt(2);
int16 payloadSize = g_zbasic->readFileInt(2);
- debugC(5, kDebugLoading, "openGame: puzzle %d:, puzzleFlags: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, this->puzzleFlags[i], this->puzzleCompletionStatus[i], this->pageVisible[i], payloadSize);
+ debugC(5, kDebugLoading, "openGame: puzzle %d:, puzzleFlags: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, _puzzleFlags[i], _puzzleCompletionStatus[i], _pageVisible[i], payloadSize);
Common::String state = g_zbasic->readFileStr(2, payloadSize);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)state.c_str(), payloadSize);
@@ -1427,20 +1434,20 @@ void FoolGame::openGame() {
// 128:2f54
debugCN(5, kDebugLoading, "openGame: sun map tile IDs: ");
for (int i = 1; i <= 0x51; i++) {
- this->sunMapTileID[i] = g_zbasic->readFileInt(2);
- debugCN(5, kDebugLoading, "%d, ", this->sunMapTileID[i]);
+ _sunMapTileID[i] = g_zbasic->readFileInt(2);
+ debugCN(5, kDebugLoading, "%d, ", _sunMapTileID[i]);
}
debugCN(5, kDebugLoading, "\n");
// 128:2f84
g_zbasic->close(2);
if (this->var_i16_7e6 != 0) {
- this->arr_str_1a8d8[0] = g_zbasic->str(34) + saveFileName + g_zbasic->str(35); // file cannot be opened
- this->arr_str_1a8d8[1] = g_zbasic->str(36);
+ _modalText[0] = g_zbasic->str(34) + _saveFileName + g_zbasic->str(35); // file cannot be opened
+ _modalText[1] = g_zbasic->str(36);
this->var_i16_7e6 = 0;
if ((this->var_i16_7ce & 1) == 0) {
- this->setStateBits(kStateNewGame | kStateReturn);
+ setStateBits(kStateNewGame | kStateReturn);
} else {
- this->setStateBits(kStateNewGame);
+ setStateBits(kStateNewGame);
}
} else {
// 128:302c
@@ -1450,8 +1457,8 @@ void FoolGame::openGame() {
}
void FoolGame::sub_128_3032() {
- this->storyCurrentChapter = 0;
- this->stateFlags = 0;
+ _storyCurrentChapter = 0;
+ _stateFlags = kStateNull;
this->var_i16_484 = 0;
this->var_i16_68c = 3;
// render chapter menu headings
@@ -1460,15 +1467,15 @@ void FoolGame::sub_128_3032() {
g_zbasic->menu(j, 0, 1, this->var_str_384);
for (int i = 1; i <= 0x10; i++) {
this->var_i16_484++;
- this->var_i16_9f2 = this->puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
- if (this->puzzleCompletionStatus[this->var_i16_484] == 0x63) {
+ this->var_i16_9f2 = _puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
+ if (_puzzleCompletionStatus[this->var_i16_484] == 0x63) {
this->var_str_384 = g_zbasic->str(39); // " ~ "
} else {
// 128:30e4
this->var_str_384 = g_zbasic->str(40); // " "
}
// 128:30f8
- this->var_str_9f4 = this->arr_str_195e8[this->var_i16_484] + this->var_str_384;
+ this->var_str_9f4 = _puzzleName[this->var_i16_484] + this->var_str_384;
if ((j == 3) && (i == 1)) {
this->var_str_9f4 = g_zbasic->str(41) + this->var_str_9f4;
}
@@ -1478,8 +1485,8 @@ void FoolGame::sub_128_3032() {
// 128:3180
}
// 128:318e
- this->fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
- this->fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
+ fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
+ fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0x3c;
this->var_i16_7de = 0x2d;
@@ -1493,20 +1500,20 @@ void FoolGame::sub_128_3032() {
}
// 128:3228
this->copyScreen(0, this->arr_bmp_5dfc);
- this->storyCurrentPage = 1;
+ _storyCurrentPage = 1;
this->storyRenderPage();
if ((this->var_i16_7ce & 1) == 0) {
this->cursorExplodingWatch();
} else {
- if ((this->activePuzzle > 0) && (this->activePuzzle <= 0x50)) {
- this->setStateBits(kStatePuzzleSelect);
+ if ((_activePuzzle > 0) && (_activePuzzle <= 0x50)) {
+ setStateBits(kStatePuzzleSelect);
} else {
- this->setStateBits(0x100);
+ setStateBits(0x100);
}
}
// 128:3294
this->sub_128_32c8();
- if (this->sunMapRestored == 0) {
+ if (_sunMapRestored == 0) {
g_zbasic->menu(2, 7, 0, Common::U32String());
} else {
g_zbasic->menu(2, 7, 1, Common::U32String());
@@ -1514,7 +1521,7 @@ void FoolGame::sub_128_3032() {
}
void FoolGame::sub_128_32c8() {
- if (this->soundEnabled == 0) {
+ if (!_soundEnabled) {
g_zbasic->menu(2, 6, 1, Common::U32String());
} else {
g_zbasic->menu(2, 6, 0x86, Common::U32String());
@@ -1526,31 +1533,31 @@ void FoolGame::savePrompt() {
if (this->var_i16_7ce == 666) {
return;
}
- this->savePromptChoice = 0;
+ _savePromptChoice = 0;
// The original code would only show the save prompt if there was
// no game in progress.
// Instead, we always show the prompt.
- Common::U32String previous = saveFileName;
- saveFileName.clear();
- this->arr_str_1a8d8[0] = g_zbasic->str(43); // do you wish to save this game
- this->arr_str_1a8d8[1] = g_zbasic->str(44); // yes
- this->arr_str_1a8d8[2] = g_zbasic->str(45); // no
- this->arr_str_1a8d8[3] = g_zbasic->str(46); // cancel
+ Common::U32String previous = _saveFileName;
+ _saveFileName.clear();
+ _modalText[0] = g_zbasic->str(43); // do you wish to save this game
+ _modalText[1] = g_zbasic->str(44); // yes
+ _modalText[2] = g_zbasic->str(45); // no
+ _modalText[3] = g_zbasic->str(46); // cancel
this->sub_128_dfe(0, 0, 3, 0);
- if (this->savePromptChoice > 1) {
- saveFileName = previous;
+ if (_savePromptChoice > 1) {
+ _saveFileName = previous;
return;
}
this->saveGameAs();
- if (saveFileName.empty()) { // was: str(47)
+ if (_saveFileName.empty()) { // was: str(47)
// 128:33da
- this->savePromptChoice = 3;
- saveFileName = previous;
+ _savePromptChoice = 3;
+ _saveFileName = previous;
return;
}
// 128:33e2
- this->setStateBits(kStateSaveGame);
+ setStateBits(kStateSaveGame);
}
@@ -1561,12 +1568,12 @@ void FoolGame::autoSaveGame() {
// In general, ScummVM treats user-initated save games as a snapshot,
// and writes any automatic progress to a dedicated "Autosave" slot.
// This wrapper changes the autosave behaviour to match the rest of ScummVM.
- isAutoSaving = true;
- Common::U32String previous = saveFileName;
- saveFileName = Common::U32String::format("%s-Autosave.fool", g_engine->getGameId().c_str());
+ _isAutoSaving = true;
+ Common::U32String previous = _saveFileName;
+ _saveFileName = Common::U32String::format("%s-Autosave.fool", g_engine->getGameId().c_str());
saveGame();
- saveFileName = previous;
- isAutoSaving = false;
+ _saveFileName = previous;
+ _isAutoSaving = false;
}
void FoolGame::saveGame() {
@@ -1575,9 +1582,9 @@ void FoolGame::saveGame() {
if (this->var_i16_7ce == 666)
return;
// 128:3548
- if (saveFileName.empty()) { // was: str(57)
+ if (_saveFileName.empty()) { // was: str(57)
this->saveGameAs();
- if (saveFileName.empty()) { // was: str(58)
+ if (_saveFileName.empty()) { // was: str(58)
return;
}
}
@@ -1587,7 +1594,7 @@ void FoolGame::saveGame() {
}
// 128:3594
do {
- if (!isAutoSaving) {
+ if (!_isAutoSaving) {
this->cursorWatch();
}
// 128:3598
@@ -1595,26 +1602,26 @@ void FoolGame::saveGame() {
// 128:359e: LEA - [0x3808],A0
// 128:35a2: MOVE.L - A0,-0x8ee(A5)
g_zbasic->defOpen(g_zbasic->str(59)); // FOOLgf87
- g_zbasic->openW(2, saveFileName, 0x400, this->var_i16_9ec);
+ g_zbasic->openW(2, _saveFileName, 0x400, this->var_i16_9ec);
if (this->var_i16_7e6 != 0xa) {
this->var_str_af4 = g_zbasic->str(60); // The Fool's Errand
g_zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
- g_zbasic->writeFileInt(2, this->storyNextPage);
- g_zbasic->writeFileInt(2, this->activePuzzle);
+ g_zbasic->writeFileInt(2, _storyNextPage);
+ g_zbasic->writeFileInt(2, _activePuzzle);
g_zbasic->writeFileInt(2, this->var_i16_7ce);
- g_zbasic->writeFileInt(2, this->sunMapRestored);
+ g_zbasic->writeFileInt(2, _sunMapRestored);
for (int i = 1; i <= 0x64; i++) {
- g_zbasic->writeFileInt(2, this->puzzleFlags[i]);
- g_zbasic->writeFileInt(2, this->puzzleCompletionStatus[i]);
- g_zbasic->writeFileInt(2, this->pageVisible[i]);
+ g_zbasic->writeFileInt(2, _puzzleFlags[i]);
+ g_zbasic->writeFileInt(2, _puzzleCompletionStatus[i]);
+ g_zbasic->writeFileInt(2, _pageVisible[i]);
Common::String state = g_zbasic->indexRaw(2, i);
g_zbasic->writeFileInt(2, (int16)state.size());
g_zbasic->writeFileStr(2, state);
}
// 128:36ba
for (int i = 1; i <= 0x51; i++) {
- g_zbasic->writeFileInt(2, this->sunMapTileID[i]);
+ g_zbasic->writeFileInt(2, _sunMapTileID[i]);
}
g_zbasic->close(2);
}
@@ -1624,7 +1631,7 @@ void FoolGame::saveGame() {
this->sub_128_388a();
do {
this->saveGameAs();
- } while (saveFileName.empty()); // was: str(61)
+ } while (_saveFileName.empty()); // was: str(61)
// 128:3726: BRA - [0x3594]
} else {
@@ -1634,8 +1641,8 @@ void FoolGame::saveGame() {
// 128:372a
// 128:372a: LEA - [0x3818],A0
// 128:372e: MOVE.L - A0,-0x8ee(A5)
- if (this->stateFlags == 0) {
- if (!isAutoSaving) {
+ if (_stateFlags == kStateNull) {
+ if (!_isAutoSaving) {
this->cursorExplodingWatchShort();
}
g_toolbox->InitCursor();
@@ -1655,7 +1662,7 @@ void FoolGame::sub_128_3744() {
// watch cursor
void FoolGame::cursorWatch() {
// 128:3774
- g_toolbox->SetCursor(this->arr_curs_4d88[3]);
+ g_toolbox->SetCursor(_cursors[3]);
this->var_i16_7b2 = 0xa;
}
@@ -1663,13 +1670,13 @@ void FoolGame::cursorExplodingWatch() {
// 128:378a
for (int j = 0; j <= 1; j++) {
for (int i = 3; i <= 6; i++) {
- g_toolbox->SetCursor(this->arr_curs_4d88[i]);
+ g_toolbox->SetCursor(_cursors[i]);
this->sub_128_3da(3);
}
// 128:37c2
}
for (int i = 7; i <= 0xf; i++) {
- g_toolbox->SetCursor(this->arr_curs_4d88[i]);
+ g_toolbox->SetCursor(_cursors[i]);
this->sub_128_3da(4);
}
@@ -1679,7 +1686,7 @@ void FoolGame::cursorExplodingWatch() {
void FoolGame::cursorExplodingWatchShort() {
// 128:37ce
for (int i = 7; i <= 0xf; i++) {
- g_toolbox->SetCursor(this->arr_curs_4d88[i]);
+ g_toolbox->SetCursor(_cursors[i]);
this->sub_128_3da(4);
}
this->var_i16_7b2 = 0xa;
@@ -1695,17 +1702,17 @@ void FoolGame::sub_128_388a() {
void FoolGame::puzzleRun() {
// 128:39a0
- this->fillRect(0x127, 0x69, 0x138, 0x190, 0);
- this->stateFlags = 0;
+ fillRect(0x127, 0x69, 0x138, 0x190, 0);
+ _stateFlags = kStateNull;
this->var_i16_c00 = 0;
this->var_i16_7d6 = 0;
this->var_i16_7b2 = 0xa;
- this->activePuzzle = this->storyCurrentChapter;
+ _activePuzzle = _storyCurrentChapter;
this->var_i16_7ce |= 1;
g_toolbox->InitCursor();
this->copyScreen(0, this->arr_bmp_5dfc);
// 128:39fa
- if (this->arr_i16_15e8[this->storyCurrentChapter] > 0) {
+ if (this->arr_i16_15e8[_storyCurrentChapter] > 0) {
this->sub_128_41d8();
}
// 128:3a12
@@ -1715,8 +1722,8 @@ void FoolGame::puzzleRun() {
this->puzzleLoadContext();
// 128:3a22
// 128:3a38: JSR - "ZBASIC_115"
- debugC(5, kDebugLoading, "puzzleRun: chapter 0x%x, puzzle module %d", this->storyCurrentChapter, this->puzzleType[this->storyCurrentChapter]-1);
- switch (this->puzzleType[this->storyCurrentChapter]-1) {
+ debugC(5, kDebugLoading, "puzzleRun: chapter 0x%x, puzzle module %d", _storyCurrentChapter, _puzzleType[_storyCurrentChapter]-1);
+ switch (_puzzleType[_storyCurrentChapter]-1) {
case 0:
case 1:
case 2:
@@ -1774,13 +1781,13 @@ void FoolGame::puzzleRun() {
}
// 128:3a8a
this->sub_128_5fea();
- if (this->sunMapRestored == 1) {
- this->setStateBits(0x100);
+ if (_sunMapRestored == 1) {
+ setStateBits(0x100);
return;
}
// 128:3aa4
this->puzzleSaveContext();
- if ((this->stateFlags & kStateQuit) == 0) {
+ if ((_stateFlags & kStateQuit) == 0) {
g_toolbox->PenNormal();
this->copyScreen(1, this->arr_bmp_5dfc);
this->var_menu_bf8 = g_toolbox->GetMHandle(8);
@@ -1790,38 +1797,38 @@ void FoolGame::puzzleRun() {
}
// 128:3aea
g_zbasic->indexClear(1);
- if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x63) {
+ if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
this->storyUnlockChapter();
autoSaveGame(); // autosave on progress
}
- if (this->puzzleCompletionStatus[this->storyCurrentChapter] == 0x64) {
+ if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x64) {
// bodge for completing The Chariot
- if (this->storyCurrentChapter == 0x41) {
- if ((this->puzzleFlags[0x41] & kFlagMenuDiamond) != 0) {
- this->puzzleFlags[0x41] ^= kFlagMenuDiamond;
- this->puzzleFlags[0x41] |= kFlagMenuEnabled;
+ if (_storyCurrentChapter == 0x41) {
+ if ((_puzzleFlags[0x41] & kFlagMenuDiamond) != 0) {
+ _puzzleFlags[0x41] ^= kFlagMenuDiamond;
+ _puzzleFlags[0x41] |= kFlagMenuEnabled;
}
// 128:3b9e
for (int i = 1; i <= 5; i++) {
g_zbasic->menu(7, i, 1, Common::U32String());
if (i > 1) {
- this->puzzleFlags[0x40 + i] |= 0x5;
+ _puzzleFlags[0x40 + i] |= 0x5;
}
}
// 128:3c04
- this->storyNextPage = 0;
+ _storyNextPage = 0;
// enable the four King Of ... chapters
for (int i = 0x42; i <= 0x45; i++) {
- for (int j = 1; j <= this->storyPageCount; j++) {
- if (this->pageToChapter[j] == i) {
- this->pageVisible[j] = 1;
- if ((i == 0x42) && (this->storyNextPage == 0)) {
- this->storyNextPage = j;
+ for (int j = 1; j <= _storyPageCount; j++) {
+ if (_pageToChapter[j] == i) {
+ _pageVisible[j] = 1;
+ if ((i == 0x42) && (_storyNextPage == 0)) {
+ _storyNextPage = j;
}
}
// 128:3c6c
- if (this->pageToChapter[j] > i) {
- j = this->storyPageCount;
+ if (_pageToChapter[j] > i) {
+ j = _storyPageCount;
}
// 128:3c8e
}
@@ -1830,13 +1837,13 @@ void FoolGame::puzzleRun() {
this->var_i16_7ce |= 8;
} else {
// 128:3cc0
- if ((this->puzzleFlags[this->storyCurrentChapter] & 2) != 0) {
- this->puzzleFlags[this->storyCurrentChapter] ^= 2;
- this->puzzleFlags[this->storyCurrentChapter] |= 1;
+ if ((_puzzleFlags[_storyCurrentChapter] & 2) != 0) {
+ _puzzleFlags[_storyCurrentChapter] ^= 2;
+ _puzzleFlags[_storyCurrentChapter] |= 1;
}
// 128:3d3a
- this->var_i16_484 = 3 + ((this->storyCurrentChapter - 1) / 0x10);
- this->var_i16_7e4 = 1 + ((this->storyCurrentChapter - 1) % 0x10);
+ this->var_i16_484 = 3 + ((_storyCurrentChapter - 1) / 0x10);
+ this->var_i16_7e4 = 1 + ((_storyCurrentChapter - 1) % 0x10);
g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
this->storyUnlockChapter();
}
@@ -1846,11 +1853,11 @@ void FoolGame::puzzleRun() {
this->var_i16_c02 = 0;
this->var_i16_c00 = 0;
g_toolbox->SetPort(this->var_i32_0);
- if ((this->stateFlags & (kStateQuit | kStateOpenGame | kStateNewGame)) == 0) {
+ if ((_stateFlags & (kStateQuit | kStateOpenGame | kStateNewGame)) == 0) {
if ((this->var_i16_7ce & 1) == 0) {
this->var_i16_7ce ^= 1;
}
- if ((this->stateFlags & kStateChapterSelect) == 0) {
+ if ((_stateFlags & kStateChapterSelect) == 0) {
this->storyRenderPage();
}
}
@@ -1861,36 +1868,36 @@ void FoolGame::puzzleRun() {
void FoolGame::storyUnlockChapter() {
// 128:3de6
- if ((this->puzzleUnlockChapter[this->storyCurrentChapter] > 0) &&
- ((this->puzzleFlags[this->puzzleUnlockChapter[this->storyCurrentChapter]] & 3) == 0)) {
- this->storyNextPage = 0;
+ if ((_puzzleUnlockChapter[_storyCurrentChapter] > 0) &&
+ ((_puzzleFlags[_puzzleUnlockChapter[_storyCurrentChapter]] & 3) == 0)) {
+ _storyNextPage = 0;
this->var_i16_7ce |= 8;
- for (int i = 1; i <= this->storyPageCount; i++ ) {
+ for (int i = 1; i <= _storyPageCount; i++ ) {
// 128:3e56
- if (this->pageToChapter[i] == this->puzzleUnlockChapter[this->storyCurrentChapter]) {
- this->pageVisible[i] = 1;
- if (this->storyNextPage == 0) {
- this->storyNextPage = i;
+ if (_pageToChapter[i] == _puzzleUnlockChapter[_storyCurrentChapter]) {
+ _pageVisible[i] = 1;
+ if (_storyNextPage == 0) {
+ _storyNextPage = i;
}
}
// 128:3ea6
- if (this->pageToChapter[i] > this->puzzleUnlockChapter[this->storyCurrentChapter]) {
- i = this->storyPageCount;
+ if (_pageToChapter[i] > _puzzleUnlockChapter[_storyCurrentChapter]) {
+ i = _storyPageCount;
}
// 128:3eda
}
// 128:3eec
- this->storyCurrentChapter = this->pageToChapter[this->storyNextPage];
- int16 menuNo = 3 + ((this->storyCurrentChapter - 1) / 0x10);
- int16 itemNo = 1 + ((this->storyCurrentChapter - 1) % 0x10);
- if (this->puzzleUnlockChapter[this->storyCurrentChapter] == 0) {
+ _storyCurrentChapter = _pageToChapter[_storyNextPage];
+ int16 menuNo = 3 + ((_storyCurrentChapter - 1) / 0x10);
+ int16 itemNo = 1 + ((_storyCurrentChapter - 1) % 0x10);
+ if (_puzzleUnlockChapter[_storyCurrentChapter] == 0) {
this->var_i16_9f2 = 1;
- this->puzzleCompletionStatus[this->storyCurrentChapter] = 0x64;
+ _puzzleCompletionStatus[_storyCurrentChapter] = 0x64;
} else {
// 128:3f66
this->var_i16_9f2 = 2;
}
- this->puzzleFlags[this->storyCurrentChapter] |= (this->var_i16_9f2 + 4);
+ _puzzleFlags[_storyCurrentChapter] |= (this->var_i16_9f2 + 4);
g_zbasic->menu(menuNo, itemNo, this->var_i16_9f2, Common::U32String());
}
// 128:3fb4
@@ -1903,22 +1910,22 @@ void FoolGame::sub_128_3fb6() {
g_toolbox->DeleteMenu(8);
g_toolbox->DisposeMenu(this->var_menu_bf8);
- g_zbasic->menu(8, 0, 1, this->arr_str_195e8[this->activePuzzle]);
+ g_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
this->var_str_384 = g_zbasic->str(72); // return to scroll
- if ((this->activePuzzle == 0x34) || (this->activePuzzle == 0x35)) {
+ if ((_activePuzzle == 0x34) || (_activePuzzle == 0x35)) {
this->var_str_384 = g_zbasic->str(73); // run for your life
}
// 128:4024
- if (this->activePuzzle > 0x50) {
+ if (_activePuzzle > 0x50) {
this->var_str_384 = g_zbasic->str(74); // return to map
}
g_zbasic->menu(8, 1, 1, this->var_str_384);
// 128:4056
- if (this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2] <= this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2 + 1]) {
+ if (_puzzleMenuInstructions[_puzzleType[_activePuzzle]*2] <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]) {
g_zbasic->menu(8, 2, 0, g_zbasic->str(75)); // line
// 128:40c6
this->var_i16_484 = 2;
- for (int i = this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2]; i <= this->arr_i16_1b10[this->puzzleType[this->activePuzzle]*2 + 1]; i++) {
+ for (int i = _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]; i <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]; i++) {
// 128:40f6
this->var_i16_484++;
this->var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(76);
@@ -1930,25 +1937,25 @@ void FoolGame::sub_128_3fb6() {
void FoolGame::puzzleLoadContext() {
// 128:4168
- this->var_i16_c04 = this->puzzleCompletionStatus[this->activePuzzle];
- if (this->var_i16_c04 == 0x64) {
- this->var_i16_c04 = 0x65;
+ _activePuzzleStatus = _puzzleCompletionStatus[_activePuzzle];
+ if (_activePuzzleStatus == 0x64) {
+ _activePuzzleStatus = 0x65;
}
- this->activePuzzleBuffer = g_zbasic->indexRaw(2, this->activePuzzle);
+ _activePuzzleBuffer = g_zbasic->indexRaw(2, _activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
- Common::String inter = this->activePuzzleBuffer;
- debugC(5, kDebugLoading, "puzzleLoadContext: loading puzzle %d context, state %d, size %d", this->activePuzzle, this->var_i16_c04, inter.size());
+ Common::String inter = _activePuzzleBuffer;
+ debugC(5, kDebugLoading, "puzzleLoadContext: loading puzzle %d context, state %d, size %d", _activePuzzle, _activePuzzleStatus, inter.size());
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
void FoolGame::puzzleSaveContext() {
// 128:41aa
- this->puzzleCompletionStatus[this->activePuzzle] = this->var_i16_c04;
- g_zbasic->indexRawSet(this->activePuzzleBuffer, 2, this->activePuzzle);
+ _puzzleCompletionStatus[_activePuzzle] = _activePuzzleStatus;
+ g_zbasic->indexRawSet(_activePuzzleBuffer, 2, _activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
- Common::String inter = this->activePuzzleBuffer;
- debugC(5, kDebugLoading, "puzzleSaveContext: saving puzzle %d context, state %d, size %d", this->activePuzzle, this->var_i16_c04, inter.size());
+ Common::String inter = _activePuzzleBuffer;
+ debugC(5, kDebugLoading, "puzzleSaveContext: saving puzzle %d context, state %d, size %d", _activePuzzle, _activePuzzleStatus, inter.size());
Common::hexdump((const byte *)inter.c_str(), inter.size());
}
}
@@ -1956,25 +1963,25 @@ void FoolGame::puzzleSaveContext() {
void FoolGame::sub_128_41d8() {
// 128:41d8
for (int i = 0; i <= 5; i++) {
- this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[this->activePuzzle]*8)];
+ this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[_activePuzzle]*8)];
}
// 128:422e
- if ((this->activePuzzle == 0x34) && (this->puzzleCompletionStatus[0x34] > 1)) {
+ if ((_activePuzzle == 0x34) && (_puzzleCompletionStatus[0x34] > 1)) {
// 128:4262
- if (this->puzzleCompletionStatus[0x34] == 2) {
+ if (_puzzleCompletionStatus[0x34] == 2) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 2;
this->arr_i16_4758[2] = 0xa;
}
// 128:42aa
- if (this->puzzleCompletionStatus[0x34] == 3) {
+ if (_puzzleCompletionStatus[0x34] == 3) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 3;
this->arr_i16_4758[2] = 0;
}
// 128:42f0
- if (this->puzzleCompletionStatus[0x34] >= 4) {
- if (this->sunMapRestored == 0) {
+ if (_puzzleCompletionStatus[0x34] >= 4) {
+ if (_sunMapRestored == 0) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 0x47;
this->arr_i16_4758[2] = 0;
@@ -1986,20 +1993,20 @@ void FoolGame::sub_128_41d8() {
// 128:4348
}
// 128:4348
- if ((this->activePuzzle == 0x17) && (this->puzzleCompletionStatus[0x17] == 0x63)) {
+ if ((_activePuzzle == 0x17) && (_puzzleCompletionStatus[0x17] == 0x63)) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 2;
this->arr_i16_4758[1] = 0xa;
}
// 128:43aa
- if ((this->activePuzzle == 0x3f) && (this->puzzleCompletionStatus[0x3f] == 0x63)) {
+ if ((_activePuzzle == 0x3f) && (_puzzleCompletionStatus[0x3f] == 0x63)) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 3;
this->arr_i16_4758[2] = 0;
}
// 128:440a
- if (this->activePuzzle == 0x48) {
- if (this->puzzleCompletionStatus[0x48] == 0x63) {
+ if (_activePuzzle == 0x48) {
+ if (_puzzleCompletionStatus[0x48] == 0x63) {
this->arr_i16_4758[0] = 0;
this->arr_i16_4758[1] = 0x47;
this->arr_i16_4758[2] = 0;
@@ -2014,19 +2021,19 @@ void FoolGame::sub_128_41d8() {
void FoolGame::sub_128_4472() {
// 128:4472
if (this->arr_i16_4758[1] == 0) {
- this->arr_i16_4758[1] = this->activePuzzle;
+ this->arr_i16_4758[1] = _activePuzzle;
}
if (this->arr_i16_4758[2] == 0) {
this->arr_i16_4758[2] = 0x8;
}
if (this->arr_i16_4758[0] == 0) {
// user clicked the puzzle button, zoom-fill with pattern
- sub_128_962(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
+ zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
return;
}
// 128:4520
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_4758[1]]);
+ g_toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
g_toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
if (this->arr_i16_4758[5] == 0) {
// 128:456a
@@ -2075,9 +2082,9 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[11] = 0x207;
}
// 128:4850
- if ((this->arr_i16_15e8[this->activePuzzle] == 0xd) || (this->arr_i16_15e8[this->activePuzzle] == 0xe)) {
- this->fillRect(0x14f, 0, 0x156, 0x7, 1);
- this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 1);
+ if ((this->arr_i16_15e8[_activePuzzle] == 0xd) || (this->arr_i16_15e8[_activePuzzle] == 0xe)) {
+ fillRect(0x14f, 0, 0x156, 0x7, 1);
+ fillRect(0x14f, 0x1f9, 0x156, 0x200, 1);
}
// 128:48d6
for (int i = 0; i <= this->arr_i16_4758[12]; i++) {
@@ -2095,7 +2102,7 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[1] = 1;
}
// 128:4a42
- g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_4758[1]]);
+ g_toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
}
// 128:4a64
// FIXME: These can sometimes be invalid.
@@ -2118,54 +2125,54 @@ void FoolGame::sub_128_4472() {
// about screen
void FoolGame::menuAbout() {
// 128:4a92
- if (saveFileName.empty()) { // was: str(77)
+ if (_saveFileName.empty()) { // was: str(77)
// untitled game in progress
- this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + g_zbasic->str(78) + g_zbasic->chr(0x22) + g_zbasic->str(79);
+ _modalText[0] = g_zbasic->chr(0x22) + g_zbasic->str(78) + g_zbasic->chr(0x22) + g_zbasic->str(79);
} else {
// 128:4aee
- this->arr_str_1a8d8[0] = g_zbasic->chr(0x22) + saveFileName + g_zbasic->chr(0x22) + g_zbasic->str(80);
+ _modalText[0] = g_zbasic->chr(0x22) + _saveFileName + g_zbasic->chr(0x22) + g_zbasic->str(80);
}
// 128:4b28
- this->arr_str_1a8d8[1] = g_zbasic->str(81);
- if (this->sunMapRestored == 0) {
+ _modalText[1] = g_zbasic->str(81);
+ if (_sunMapRestored == 0) {
this->var_i16_68c = 0x51;
this->var_i16_68a = 1;
for (int i = 1; i <= 0x51; i++) {
- if ((this->puzzleFlags[i] & 3) != 0) {
+ if ((_puzzleFlags[i] & 3) != 0) {
this->var_i16_68c--;
}
}
// 128:4b88
if (this->var_i16_68c >= 0) {
// sun's map is incomplete
- this->arr_str_1a8d8[2] = g_zbasic->str(82);
+ _modalText[2] = g_zbasic->str(82);
if (this->var_i16_68c == 1) {
// there is 1 missing piece
- this->arr_str_1a8d8[3] = g_zbasic->str(83);
+ _modalText[3] = g_zbasic->str(83);
} else {
// 128:4bde
// there are N missing pieces
- this->arr_str_1a8d8[3] = Common::U32String::format("%s %d%s", g_zbasic->str(84).encode().c_str(), this->var_i16_68c, g_zbasic->str(85).encode().c_str());
+ _modalText[3] = Common::U32String::format("%s %d%s", g_zbasic->str(84).encode().c_str(), this->var_i16_68c, g_zbasic->str(85).encode().c_str());
}
// 128:4c1a
this->var_i16_68c = 0;
for (int i = 2; i <= 0x50; i++) {
this->var_i16_68a = 2;
- if ((this->puzzleCompletionStatus[i] < 0x63) && (this->puzzleType[i] > 0)) {
+ if ((_puzzleCompletionStatus[i] < 0x63) && (_puzzleType[i] > 0)) {
this->var_i16_68c++;
}
}
// 128:4c74
// blank
- this->arr_str_1a8d8[4] = g_zbasic->str(86);
+ _modalText[4] = g_zbasic->str(86);
if (this->var_i16_68c == 1) {
// There is 1 unsolved puzzle.
- this->arr_str_1a8d8[5] = g_zbasic->str(87);
+ _modalText[5] = g_zbasic->str(87);
} else {
// 128:4cc0
// There are X unsolved puzzles.
- this->arr_str_1a8d8[5] = Common::U32String::format("%s %d%s", g_zbasic->str(88).encode().c_str(), this->var_i16_68c, g_zbasic->str(89).encode().c_str());
+ _modalText[5] = Common::U32String::format("%s %d%s", g_zbasic->str(88).encode().c_str(), this->var_i16_68c, g_zbasic->str(89).encode().c_str());
}
// 128:4cfc
this->var_i16_d06 = 5;
@@ -2173,24 +2180,24 @@ void FoolGame::menuAbout() {
} else {
// 128:4d06
// You have all the map pieces, but they are not arranged in the correct order.
- this->arr_str_1a8d8[2] = g_zbasic->str(90);
- this->arr_str_1a8d8[3] = g_zbasic->str(91);
- this->arr_str_1a8d8[4] = g_zbasic->str(92);
- this->arr_str_1a8d8[5] = g_zbasic->str(93);
+ _modalText[2] = g_zbasic->str(90);
+ _modalText[3] = g_zbasic->str(91);
+ _modalText[4] = g_zbasic->str(92);
+ _modalText[5] = g_zbasic->str(93);
// Only the Book of Thoth remains unsolved.
- this->arr_str_1a8d8[6] = g_zbasic->str(94);
- this->arr_str_1a8d8[7] = g_zbasic->str(95);
+ _modalText[6] = g_zbasic->str(94);
+ _modalText[7] = g_zbasic->str(95);
this->var_i16_d06 = 7;
}
// 128:4dc0
} else {
// 128:4dc4
// The sun's map is restored.
- this->arr_str_1a8d8[2] = g_zbasic->str(96);
- this->arr_str_1a8d8[3] = g_zbasic->str(97);
+ _modalText[2] = g_zbasic->str(96);
+ _modalText[3] = g_zbasic->str(97);
// Only the Book of Thoth remains unsolved.
- this->arr_str_1a8d8[4] = g_zbasic->str(98);
- this->arr_str_1a8d8[5] = g_zbasic->str(99);
+ _modalText[4] = g_zbasic->str(98);
+ _modalText[5] = g_zbasic->str(99);
this->var_i16_d06 = 5;
}
// 128:4e42
@@ -2204,7 +2211,7 @@ void FoolGame::menuAbout() {
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
for (int i = 0; i <= this->var_i16_d06 ; i++) {
- this->var_i16_7ba = g_toolbox->StringWidth(this->arr_str_1a8d8[i]);
+ this->var_i16_7ba = g_toolbox->StringWidth(_modalText[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
}
@@ -2215,38 +2222,39 @@ void FoolGame::menuAbout() {
this->var_i16_7b6 += 0xd;
this->var_i16_7b4 = (this->var_i16_7b4/2) + 0xf;
this->var_i16_7b6 = (this->var_i16_7b6/2);
+ Common::Rect bounds; // arr_rect_5b7c
g_toolbox->SetRect(
- this->arr_rect_5b7c,
+ bounds,
0xf5 - this->var_i16_7b4,
0x6e - this->var_i16_7b6,
0x10b + this->var_i16_7b4,
0xcf + this->var_i16_7b6
);
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[0]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->PenPat(_patterns[0]);
+ g_toolbox->FrameRect(bounds);
// 128:4f6a
- g_toolbox->InsetRect(this->arr_rect_5b7c, 1, 1);
+ g_toolbox->InsetRect(bounds, 1, 1);
g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(this->arr_pat_58f4[2]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
- g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
+ g_toolbox->PenPat(_patterns[2]);
+ g_toolbox->FrameRect(bounds);
+ g_toolbox->InsetRect(bounds, 5, 5);
g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
+ g_toolbox->PenPat(_patterns[1]);
+ g_toolbox->FrameRect(bounds);
// 128:4fe2
- g_toolbox->InsetRect(this->arr_rect_5b7c, 5, 5);
- g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[0]);
+ g_toolbox->InsetRect(bounds, 5, 5);
+ g_toolbox->FillRect(bounds, _patterns[0]);
g_toolbox->PenNormal();
// 128:5014
g_toolbox->SetRect(
- this->arr_rect_5b7c,
+ bounds,
0xb5,
0x82 - this->var_i16_7b6,
0xd5,
0x82 - this->var_i16_7b6 + 0x20
);
- g_toolbox->PlotIcon(this->arr_rect_5b7c, this->var_i32_c);
+ g_toolbox->PlotIcon(bounds, this->var_i32_c);
// the fool's errand
g_toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
g_toolbox->DrawString(g_zbasic->str(100));
@@ -2257,7 +2265,7 @@ void FoolGame::menuAbout() {
// 128:509a
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
for (int i = 0; i <= this->var_i16_d06; i++) {
- this->var_str_384 = this->arr_str_1a8d8[i];
+ this->var_str_384 = _modalText[i];
this->sub_128_918(this->var_str_384);
this->var_i16_7a2 += 0x11;
}
@@ -2275,7 +2283,7 @@ void FoolGame::menuAbout() {
// three freakin' ships
void FoolGame::shipsRun() {
// 128:5140
- this->fillRect(0x127, 0x6c, 0x137, 0x84, 0);
+ fillRect(0x127, 0x6c, 0x137, 0x84, 0);
this->sub_128_6186();
this->sub_128_55c(g_zbasic->str(103)); // "?"
g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
@@ -2285,7 +2293,7 @@ void FoolGame::shipsRun() {
//Common::fill(fakePal+3, fakePal+768, 0x00);
//this->arr_bmp_b3ec->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 160, fakePal);
- this->fillRect(0x127, 0x6c, 0x137, 0x84, 0);
+ fillRect(0x127, 0x6c, 0x137, 0x84, 0);
g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
//warning("sub_128_5140: bbbc surface");
@@ -2304,39 +2312,39 @@ void FoolGame::shipsRun() {
this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
// 128:530c
- this->var_i16_d0c = 0;
- this->keyLastPressed = 0;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ _activePuzzleSolved = false;
+ _keyLastPressed = 0;
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
this->getNextEvent(-1);
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_19114) != 0) {
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_19114) != 0) {
this->sub_128_55ac();
}
// 128:5348
- this->var_i16_d0e = this->var_ev_46.where.y;
- this->var_i16_d10 = this->var_ev_46.where.x;
- if (this->keyLastPressed > 0) {
+ this->var_i16_d0e = _event.where.y;
+ this->var_i16_d10 = _event.where.x;
+ if (_keyLastPressed > 0) {
this->sub_128_57a2();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
}
// 128:5396
- if (this->var_i16_d0c != 0) {
+ if (_activePuzzleSolved) {
this->sub_128_6186();
this->sub_128_50e(0x14, 0x64, 0);
g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
- this->var_ev_46.where.x += 5;
- this->var_ev_46.where.y -= 5;
- if (this->var_i16_c04 < 0x64) {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ _event.where.x += 5;
+ _event.where.y -= 5;
+ if (_activePuzzleStatus < 0x64) {
+ g_toolbox->SetCursor(_cursors[0x10]);
}
for (int16 i = 1; i <= 1; i++) {
// 128:541c
- this->arr_i16_4758[0] = this->var_ev_46.where.y;
- this->arr_i16_4758[1] = this->var_ev_46.where.x;
- this->arr_i16_4758[2] = this->var_ev_46.where.y;
- this->arr_i16_4758[3] = this->var_ev_46.where.x;
+ this->arr_i16_4758[0] = _event.where.y;
+ this->arr_i16_4758[1] = _event.where.x;
+ this->arr_i16_4758[2] = _event.where.y;
+ this->arr_i16_4758[3] = _event.where.x;
for (int16 j = 1; j <= 0x19; j++) {
// 128:5462
this->arr_i16_4758[0]--;
@@ -2353,16 +2361,16 @@ void FoolGame::shipsRun() {
}
// 128:5514
this->sub_128_3da(0x3c);
- if (this->var_i16_c04 < 0x64) {
+ if (_activePuzzleStatus < 0x64) {
// 128:5526
this->sub_128_6186();
- this->var_i16_c04 = 0x64;
+ _activePuzzleStatus = 0x64;
this->var_i16_7ce |= 2;
- this->sub_128_962(
- this->var_ev_46.where.y - 5,
- this->var_ev_46.where.x - 5,
- this->var_ev_46.where.y + 5,
- this->var_ev_46.where.x + 5,
+ this->zoomRect(
+ _event.where.y - 5,
+ _event.where.x - 5,
+ _event.where.y + 5,
+ _event.where.x + 5,
0x14,
0,
SCREEN_HEIGHT,
@@ -2382,7 +2390,7 @@ void FoolGame::shipsRun() {
void FoolGame::sub_128_55ac() {
// 128:55ac
- if ((this->var_i16_d10 == this->var_ev_46.where.x) && (this->var_i16_d0e == this->var_ev_46.where.y)) {
+ if ((this->var_i16_d10 == _event.where.x) && (this->var_i16_d0e == _event.where.y)) {
return;
}
this->var_i16_d08 = g_zbasic->rndInt(5) + 5;
@@ -2424,7 +2432,7 @@ void FoolGame::sub_128_55ac() {
void FoolGame::sub_128_57a2() {
// 128:57a2
- this->var_str_d12 = g_zbasic->ucase(g_zbasic->chr(this->keyLastPressed));
+ this->var_str_d12 = g_zbasic->ucase(g_zbasic->chr(_keyLastPressed));
if (g_zbasic->instr(1, g_zbasic->str(105), this->var_str_d12) > 0) { // NESW
// 128:57e0
g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
@@ -2464,12 +2472,12 @@ void FoolGame::sub_128_57a2() {
this->arr_rect_1910c.right = 0x18;
}
this->sub_128_5a6c();
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1910c)) {
- this->var_i16_d0c = 1;
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ _activePuzzleSolved = true;
}
}
// 128:59cc
- this->keyLastPressed = 0;
+ _keyLastPressed = 0;
this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
@@ -2493,40 +2501,40 @@ void FoolGame::sub_128_5a6c() {
void FoolGame::sub_128_5b30() {
// 128:5b30
- if (this->menuDisabled)
+ if (_menuDisabled)
return;
- this->var_ev_46.what = kNullEvent;
- if (this->menuHidesPlayfield) {
+ _event.what = kNullEvent;
+ if (_menuHidesPlayfield) {
this->thothHidePlayfield();
}
- this->var_i32_bf8 = g_toolbox->MenuSelect(this->var_ev_46.where);
- this->selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
- this->selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
- if (this->selectedMenuID > 0) {
+ this->var_i32_bf8 = g_toolbox->MenuSelect(_event.where);
+ _selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
+ _selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
+ if (_selectedMenuID > 0) {
// 128:5b8c
this->sub_128_5c20();
g_toolbox->HiliteMenu(0);
}
// 128:5b94
- if (this->menuHidesPlayfield) {
+ if (_menuHidesPlayfield) {
this->thothShowPlayfield();
}
this->sub_128_61ec();
}
void FoolGame::sub_128_5baa() {
- if (this->menuDisabled)
+ if (_menuDisabled)
return;
- this->var_i32_bf8 = g_toolbox->MenuKey((char)(this->var_ev_46.message & 0xff));
+ this->var_i32_bf8 = g_toolbox->MenuKey((char)(_event.message & 0xff));
g_toolbox->Delay(0);
- this->selectedMenuID = this->var_i32_bf8 >> 16;
- this->selectedMenuItem = this->var_i32_bf8 & 0xffff;
- if (this->selectedMenuID > 0) {
- if (this->menuHidesPlayfield) {
+ _selectedMenuID = this->var_i32_bf8 >> 16;
+ _selectedMenuItem = this->var_i32_bf8 & 0xffff;
+ if (_selectedMenuID > 0) {
+ if (_menuHidesPlayfield) {
this->thothHidePlayfield();
}
this->sub_128_5c20();
- if (this->menuHidesPlayfield) {
+ if (_menuHidesPlayfield) {
this->thothShowPlayfield();
}
g_toolbox->HiliteMenu(0);
@@ -2536,84 +2544,80 @@ void FoolGame::sub_128_5baa() {
}
void FoolGame::sub_128_5c20() {
- this->stateFlags = 0;
- if (this->selectedMenuID == 1) { // Eye menu
+ _stateFlags = kStateNull;
+ if (_selectedMenuID == 1) { // Eye menu
this->menuAbout();
}
- if (this->selectedMenuID == 2) { // File menu
- if (this->selectedMenuItem == 1) {
+ if (_selectedMenuID == 2) { // File menu
+ if (_selectedMenuItem == 1) {
this->menuNewGame();
- } else if (this->selectedMenuItem == 2) {
+ } else if (_selectedMenuItem == 2) {
// 128:5c5c
this->menuOpenGame();
- } else if (this->selectedMenuItem == 3) {
+ } else if (_selectedMenuItem == 3) {
// 128:5c6c
this->menuSaveGame();
- } else if (this->selectedMenuItem == 4) {
+ } else if (_selectedMenuItem == 4) {
this->menuSaveGameAs();
- } else if (this->selectedMenuItem == 6) {
- if (this->soundEnabled == 0) {
- this->soundEnabled = 1;
- } else {
- this->soundEnabled = 0;
- }
+ } else if (_selectedMenuItem == 6) {
+ _soundEnabled = !_soundEnabled;
// 128:5cbc
this->sub_128_32c8();
// 128:5cc4
- } else if (this->selectedMenuItem == 7) {
+ } else if (_selectedMenuItem == 7) {
this->menuPrintStory();
- } else if (this->selectedMenuItem == 9) {
+ } else if (_selectedMenuItem == 9) {
this->menuQuit();
}
}
// 128:5cea
- if ((this->selectedMenuID >= 3) && (this->selectedMenuID <= 7)) { // Chapter menus
+ if ((_selectedMenuID >= 3) && (_selectedMenuID <= 7)) { // Chapter menus
this->var_i16_e1a = 0;
- this->selectedMenuChapter = this->selectedMenuItem + (this->selectedMenuID - 3)*0x10;
- if ((this->selectedMenuChapter == 1) && (this->var_ev_46.what == kKeyDown)) {
+ _selectedMenuChapter = _selectedMenuItem + (_selectedMenuID - 3)*0x10;
+ if ((_selectedMenuChapter == 1) && (_event.what == kKeyDown)) {
this->var_i16_e1a = 1;
}
// 128:5d56
- if ((this->var_ev_46.modifiers & kModLOptionKeyDown) != 0) {
+ if ((_event.modifiers & kModLOptionKeyDown) != 0) {
this->var_i16_e1a = 1;
} else {
// 128:5d74
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(1 << kKeyDown, this->var_ev_46);
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if ((this->var_ev_46.modifiers & kModLOptionKeyDown) != 0) {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(1 << kKeyDown, _event);
+ g_toolbox->GlobalToLocal(_event.where);
+ if ((_event.modifiers & kModLOptionKeyDown) != 0) {
this->var_i16_e1a = 1;
}
- } while (this->var_ev_46.what != kNullEvent);
+ } while (_event.what != kNullEvent);
}
// 128:5dae
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (this->storyCurrentChapter != this->selectedMenuChapter)) {
- this->setStateBits(kStateChapterSelect);
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (_storyCurrentChapter != _selectedMenuChapter)) {
+ setStateBits(kStateChapterSelect);
}
// 128:5df6
if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1)) {
- this->setStateBits(kStateChapterSelect);
+ setStateBits(kStateChapterSelect);
}
// 128:5e38
if (((this->var_i16_7ce & 1) != 0) && (this->var_i16_e1a == 0)) {
- this->setStateBits(kStateChapterSelect | kStateReturn);
+ setStateBits(kStateChapterSelect | kStateReturn);
}
// 128:5e5e
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (this->storyCurrentChapter != this->selectedMenuChapter)) {
- this->setStateBits(kStateChapterSelect | kStateReturn);
+ if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (_storyCurrentChapter != _selectedMenuChapter)) {
+ setStateBits(kStateChapterSelect | kStateReturn);
this->var_i16_7ce |= 0x4;
}
}
// 128:5eaa
- if (this->selectedMenuID == 8) { // Puzzle menu
- if (this->selectedMenuItem == 1) {
+ if (_selectedMenuID == 8) { // Puzzle menu
+ if (_selectedMenuItem == 1) {
// return to scroll / run for your life
- this->setStateBits(kStateReturn);
+ setStateBits(kStateReturn);
}
// 128:5ec6
- if ((this->selectedMenuItem == 3) && (this->var_i16_c00 == 1)) {
- this->setStateBits(kStateUndo);
+ if ((_selectedMenuItem == 3) && (this->var_i16_c00 == 1)) {
+ setStateBits(kStateUndo);
}
}
// 128:5eee
@@ -2627,16 +2631,16 @@ void FoolGame::thothHidePlayfield() {
void FoolGame::thothShowPlayfield() {
// 128:5f16
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
// 128:5f4c
- this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
+ _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
this->saveGame();
}
// 128:5f70
- if ((this->stateFlags & 1) == 0) {
+ if ((_stateFlags & kStateReturn) == 0) {
this->sub_128_6186();
this->copyScreen(1, this->arr_bmp_b3ec);
}
@@ -2644,34 +2648,35 @@ void FoolGame::thothShowPlayfield() {
void FoolGame::sub_128_5f9e() {
// 128:5f9e
- this->keyLastPressed = this->var_ev_46.message & 0xff;
+ _keyLastPressed = _event.message & 0xff;
}
void FoolGame::sub_128_5fb4() {
// 128:5fb4
- g_toolbox->BeginUpdate(*this->var_ev_46.windowPtr);
- g_toolbox->EndUpdate(*this->var_ev_46.windowPtr);
+ g_toolbox->BeginUpdate(*_event.windowPtr);
+ g_toolbox->EndUpdate(*_event.windowPtr);
if ((this->var_i16_7ce & 1) != 0) {
- this->setStateBits(0x200 | kStateReturn);
+ setStateBits(0x200 | kStateReturn);
} else {
- this->setStateBits(0x200);
+ setStateBits(0x200);
}
}
void FoolGame::sub_128_5fea() {
- if (this->screenOversized) {
+ if (_screenOversized) {
g_toolbox->SetPort(this->var_i32_8);
g_toolbox->PenNormal();
- this->fillRect(0x14, 0, this->var_i16_5c, this->var_i16_56-3, 2);
- this->fillRect(0x14, 0, this->var_i16_58+0x11, this->var_i16_5a, 2);
- this->fillRect(0x14, this->var_i16_56+0x203, this->var_i16_5c, this->var_i16_5a, 2);
- this->fillRect(this->var_i16_58 + 0x159, 0, this->var_i16_5c, this->var_i16_5a, 2);
- g_toolbox->SetRect(this->arr_rect_5b7c, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
- g_toolbox->SetRect(this->arr_rect_5b7c, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
- g_toolbox->PenPat(this->arr_pat_58f4[2]);
- g_toolbox->FrameRect(this->arr_rect_5b7c);
+ fillRect(0x14, 0, _windowHeight, this->var_i16_56-3, 2);
+ fillRect(0x14, 0, this->var_i16_58+0x11, _windowWidth, 2);
+ fillRect(0x14, this->var_i16_56+0x203, _windowHeight, _windowWidth, 2);
+ fillRect(this->var_i16_58 + 0x159, 0, _windowHeight, _windowWidth, 2);
+ Common::Rect bounds; // arr_rect_5b7c
+ g_toolbox->SetRect(bounds, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
+ g_toolbox->PenPat(_patterns[1]);
+ g_toolbox->FrameRect(bounds);
+ g_toolbox->SetRect(bounds, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
+ g_toolbox->PenPat(_patterns[2]);
+ g_toolbox->FrameRect(bounds);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -2680,8 +2685,8 @@ void FoolGame::sub_128_5fea() {
void FoolGame::sub_128_6154() {
// 128:6154
- this->var_i16_e1c = this->var_ev_46.message >> 16;
- this->var_i16_e1e = this->var_ev_46.message & 0xffff;
+ this->var_i16_e1c = _event.message >> 16;
+ this->var_i16_e1e = _event.message & 0xffff;
if (this->var_i16_e1c != 0) {
g_zbasic->unk_11(this->var_i16_e1e);
}
@@ -2693,11 +2698,11 @@ void FoolGame::sub_128_6186() {
// wait until mouse button is up
do {
// was originally a mask of 6
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == kNullEvent)
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ g_toolbox->GlobalToLocal(_event.where);
+ if (_event.what == kNullEvent)
g_toolbox->Delay(0);
- } while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0);
+ } while ((_event.modifiers & kModMouseButtonUp) == 0);
}
void FoolGame::sub_128_61c2() {
@@ -2705,11 +2710,11 @@ void FoolGame::sub_128_61c2() {
this->sub_128_6186();
do {
// was originally a mask of 2
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- g_toolbox->GlobalToLocal(this->var_ev_46.where);
- if (this->var_ev_46.what == kNullEvent)
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ g_toolbox->GlobalToLocal(_event.where);
+ if (_event.what == kNullEvent)
g_toolbox->Delay(0);
- } while ((this->var_ev_46.what != kMouseDown));
+ } while ((_event.what != kMouseDown));
this->sub_128_6186();
}
@@ -2717,32 +2722,32 @@ void FoolGame::sub_128_61c2() {
void FoolGame::sub_128_61ec() {
// 128:61ec
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- if (this->var_ev_46.what == kUpdateEvt) {
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ if (_event.what == kUpdateEvt) {
this->sub_128_5fb4();
}
- if (this->var_ev_46.what == kDiskEvt) {
+ if (_event.what == kDiskEvt) {
this->sub_128_6154();
}
- if (this->var_ev_46.what == kNullEvent)
+ if (_event.what == kNullEvent)
g_toolbox->Delay(0);
- } while (!((this->var_ev_46.what == kNullEvent) && (this->var_ev_46.modifiers & kModMouseButtonUp)));
- this->keyLastPressed = 0;
+ } while (!((_event.what == kNullEvent) && (_event.modifiers & kModMouseButtonUp)));
+ _keyLastPressed = 0;
}
void FoolGame::sub_128_6244() {
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, this->var_ev_46);
- if (this->var_ev_46.what == kUpdateEvt) {
- g_toolbox->BeginUpdate(*this->var_ev_46.windowPtr);
- g_toolbox->EndUpdate(*this->var_ev_46.windowPtr);
+ this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ if (_event.what == kUpdateEvt) {
+ g_toolbox->BeginUpdate(*_event.windowPtr);
+ g_toolbox->EndUpdate(*_event.windowPtr);
}
// 128:6272
- if (this->var_ev_46.what == kDiskEvt) {
+ if (_event.what == kDiskEvt) {
this->sub_128_6154();
}
g_toolbox->Delay(0);
- } while ((this->var_ev_46.what == kNullEvent) && ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0));
+ } while ((_event.what == kNullEvent) && ((_event.modifiers & kModMouseButtonUp) == 0));
// SEGMENT_RETURN
}
@@ -2754,9 +2759,9 @@ void FoolGame::sub_129_004() {
// 129:000a: LEA - 0x3ea(A5),A0
// 129:000e: MOVE.L - A0,-0x8ee(A5)
// 129:0012: SF - 0x8,D0
- g_zbasic->openR(1, g_zbasic->str(110), 0x3e8, this->var_i16_e20);
+ g_zbasic->openR(1, g_zbasic->str(110), 0x3e8, this->var_i16_e20); // fool's puzzles
if (this->var_i16_7e6 == 0) {
- this->var_str_e22 = g_zbasic->str(111);
+ this->var_str_e22 = g_zbasic->str(111); // fool's puzzles
this->var_i16_f22 = this->var_i16_e20;
g_zbasic->close(1);
this->var_i16_7e6 = 0;
@@ -2769,14 +2774,14 @@ void FoolGame::sub_129_004() {
void FoolGame::sub_129_068() {
this->var_i16_7ce = 666;
this->var_i16_372 = { 0, 0, 0 };
- this->soundEnabled = 1;
+ _soundEnabled = true;
this->var_i16_7a0 = 1;
this->sub_128_4da(0);
for (size_t i = 0; i <= 3; i++) {
- this->arr_pat_58f4[1].data[2*i] = 0xaa;
- this->arr_pat_58f4[1].data[2*i+1] = 0x55;
- this->arr_pat_58f4[2].data[2*i] = 0xff;
- this->arr_pat_58f4[2].data[2*i+1] = 0xff;
+ _patterns[1].data[2*i] = 0xaa;
+ _patterns[1].data[2*i+1] = 0x55;
+ _patterns[2].data[2*i] = 0xff;
+ _patterns[2].data[2*i+1] = 0xff;
}
// 129:00d8
// get current A5 - 0x72
@@ -2784,22 +2789,22 @@ void FoolGame::sub_129_068() {
// 129:00de: JSR - "PEEKLONG"
// 129:00e2: SUBI.L - 0x72,D0
// 129:00e8: JSR - "PEEKWORD"
- this->var_i16_5a = g_engine->_wm._screenDims.width(); // window width?
+ _windowWidth = g_engine->_wm._screenDims.width(); // window width?
// 129:00f0: MOVE.L - 0x904,D0
// 129:00f6: JSR - "PEEKLONG"
// 129:00fa: SUBI.L - 0x74,D0
// 129:0100: JSR - "PEEKWORD"
- this->var_i16_5c = g_engine->_wm._screenDims.height(); // window height?
- this->var_i16_56 = (this->var_i16_5a - SCREEN_WIDTH)/2;
- this->var_i16_58 = (this->var_i16_5c - SCREEN_HEIGHT)/2;
+ _windowHeight = g_engine->_wm._screenDims.height(); // window height?
+ this->var_i16_56 = (_windowWidth - SCREEN_WIDTH)/2;
+ this->var_i16_58 = (_windowHeight - SCREEN_HEIGHT)/2;
// 129:0138
if ((this->var_i16_56 == 0) && (this->var_i16_58 == 0)) {
- this->screenOversized = false;
+ _screenOversized = false;
} else {
- this->screenOversized = true;
+ _screenOversized = true;
}
// 129:0166
- g_zbasic->window(1, g_zbasic->str(112), 0, 0, this->var_i16_5a, this->var_i16_5c, kWindowDialogOneLine);
+ g_zbasic->window(1, g_zbasic->str(112), 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
g_zbasic->coordinateWindow();
g_toolbox->ClearMenuBar();
g_toolbox->DrawMenuBar();
@@ -2817,11 +2822,11 @@ void FoolGame::sub_129_068() {
}
- if ((this->var_i16_5a != SCREEN_WIDTH) || (this->var_i16_5c != SCREEN_HEIGHT)) {
- this->fillRect(0, 0, this->var_i16_5c, this->var_i16_5a, 2);
+ if ((_windowWidth != SCREEN_WIDTH) || (_windowHeight != SCREEN_HEIGHT)) {
+ fillRect(0, 0, _windowHeight, _windowWidth, 2);
} else {
// 129:0224
- this->fillRect(0, 0, this->var_i16_5c, this->var_i16_5a, 1);
+ fillRect(0, 0, _windowHeight, _windowWidth, 1);
}
// 129:023e
g_toolbox->GetPort(this->var_i32_f24);
@@ -2842,31 +2847,31 @@ void FoolGame::sub_129_068() {
g_toolbox->OpenPort(this->var_i32_8_thoth);
g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
- g_toolbox->ClipRect(this->arr_rect_1ae06);
+ g_toolbox->ClipRect(_screenClipRect);
this->var_i32_4 = &this->arr_grafport_18f78;
g_toolbox->OpenPort(this->var_i32_4);
g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
- g_toolbox->ClipRect(this->arr_rect_1ae06);
+ g_toolbox->ClipRect(_screenClipRect);
this->var_i32_0 = &this->arr_grafport_18eae;
g_toolbox->OpenPort(this->var_i32_0);
g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
- g_toolbox->ClipRect(this->arr_rect_1ae06);
+ g_toolbox->ClipRect(_screenClipRect);
this->sub_128_5fea();
// 129:02c8
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
if (false) {
//if (this->var_i16_372.red + this->var_i16_372.blue + this->var_i16_372.green != 0) {
// we're in colour mode, chide the user
- this->arr_str_1a8d8[0] = g_zbasic->str(113);
- this->arr_str_1a8d8[1] = g_zbasic->str(114);
- this->arr_str_1a8d8[2] = g_zbasic->str(115);
- this->arr_str_1a8d8[3] = g_zbasic->str(116);
+ _modalText[0] = g_zbasic->str(113);
+ _modalText[1] = g_zbasic->str(114);
+ _modalText[2] = g_zbasic->str(115);
+ _modalText[3] = g_zbasic->str(116);
this->sub_128_dfe(0, 2, 1, 0);
g_zbasic->unk_4();
}
@@ -2875,20 +2880,20 @@ void FoolGame::sub_129_068() {
this->var_i32_37c = g_zbasic->mem(-1);
if (this->var_i32_37c < 0x1d4c0) {
// not enough memory, chide the user
- this->arr_str_1a8d8[0] = g_zbasic->str(117);
- this->arr_str_1a8d8[1] = g_zbasic->str(118);
- this->arr_str_1a8d8[2] = g_zbasic->str(119);
- this->arr_str_1a8d8[3] = g_zbasic->str(120);
- this->arr_str_1a8d8[4] = g_zbasic->str(121);
- this->arr_str_1a8d8[5] = g_zbasic->str(122);
- this->arr_str_1a8d8[6] = g_zbasic->str(123);
+ _modalText[0] = g_zbasic->str(117);
+ _modalText[1] = g_zbasic->str(118);
+ _modalText[2] = g_zbasic->str(119);
+ _modalText[3] = g_zbasic->str(120);
+ _modalText[4] = g_zbasic->str(121);
+ _modalText[5] = g_zbasic->str(122);
+ _modalText[6] = g_zbasic->str(123);
this->sub_128_dfe(0, 5, 1, 1);
g_zbasic->unk_4();
}
// 129:0496
this->var_i16_7e4 = 1;
this->var_str_e22 = g_zbasic->str(124);
- saveFileName = g_zbasic->str(125);
+ _saveFileName = g_zbasic->str(125);
this->var_i16_484 = g_zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
@@ -2901,7 +2906,7 @@ void FoolGame::sub_129_068() {
this->sub_128_2808();
if (this->var_str_588 != g_zbasic->str(129)) {
// 129:054c
- saveFileName = this->var_str_588;
+ _saveFileName = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
}
}
@@ -2930,7 +2935,7 @@ void FoolGame::sub_129_068() {
if (this->var_str_e22 == g_zbasic->str(135)) {
do {
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->fillRect(0x17, 0x92, 0x31, 0x16e, 2);
+ fillRect(0x17, 0x92, 0x31, 0x16e, 2);
this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
@@ -2938,7 +2943,7 @@ void FoolGame::sub_129_068() {
Common::U32String PUZZ = g_zbasic->str(137);
this->sub_128_1e4(PUZZ);
// 129:06a6: CLR.W - -0x772(A5)
- this->fillRect(0x17, 0x92, 0x31, 0x16e, 1);
+ fillRect(0x17, 0x92, 0x31, 0x16e, 1);
this->sub_128_4da(0);
if (this->var_str_588 == g_zbasic->str(138)) {
g_zbasic->unk_4();
@@ -2991,10 +2996,10 @@ void FoolGame::sub_129_068() {
//Common::fill(fakePal+3, fakePal+768, 0x00);
for (int i = 1; i <= 0x53; i++) {
- this->arr_i32_1912c[i] = g_toolbox->GetPicture(i);
- //this->arr_i32_1912c[i]->getSurface()->debugPrint(0, 0, 0, 0, 0, -1, 160, fakePal);
+ _sunMapTilePic[i] = g_toolbox->GetPicture(i);
+ //_sunMapTilePic[i]->getSurface()->debugPrint(0, 0, 0, 0, 0, -1, 160, fakePal);
- g_toolbox->DetachResource(this->arr_i32_1912c[i]);
+ g_toolbox->DetachResource(_sunMapTilePic[i]);
}
// 129:097c
this->var_i16_68a = 0x3c;
@@ -3003,8 +3008,8 @@ void FoolGame::sub_129_068() {
// wadjet eye
this->var_pic_7c2 = g_toolbox->GetPicture(0x56);
g_toolbox->DetachResource(this->var_pic_7c2);
- metapuzzleWheelPic = g_toolbox->GetPicture(0xac);
- g_toolbox->DetachResource(metapuzzleWheelPic);
+ _metapuzzleWheelPic = g_toolbox->GetPicture(0xac);
+ g_toolbox->DetachResource(_metapuzzleWheelPic);
// icon of a scroll
this->var_i32_c = g_toolbox->GetIcon(0x101);
g_toolbox->DetachResource(this->var_i32_c);
@@ -3022,147 +3027,147 @@ void FoolGame::sub_129_068() {
this->var_i16_68a = 0x50;
this->sub_129_123a();
for (int i = 1; i <= 0x64; i++) {
- this->puzzleDataOffsets[i] = this->puzzlesReadLong();
+ _puzzleDataOffsets[i] = this->puzzlesReadLong();
}
// 129:0a4e
// quickdraw patterns
// reworked slightly to fill the pattern buffer directly
for (int i = 0; i <= 0x50; i++) {
for (int j = 0; j <= 0x7; j++) {
- this->arr_pat_58f4[i].data[j] = (byte)this->puzzlesReadByte();
+ _patterns[i].data[j] = (byte)puzzlesReadByte();
}
}
// 129:0a8a
for (int i = 1; i <= 0x2a; i++) {
- this->arr_curs_4d88[i] = Common::SharedPtr<Cursor>(new Cursor());
+ _cursors[i] = Common::SharedPtr<Cursor>(new Cursor());
for (int j = 0; j < 16; j++) {
- this->arr_curs_4d88[i]->data[j] = (uint16)this->puzzlesReadShort();
+ _cursors[i]->data[j] = (uint16)puzzlesReadShort();
}
for (int j = 0; j < 16; j++) {
- this->arr_curs_4d88[i]->mask[j] = (uint16)this->puzzlesReadShort();
+ _cursors[i]->mask[j] = (uint16)puzzlesReadShort();
}
- this->arr_curs_4d88[i]->mouse.y = this->puzzlesReadShort();
- this->arr_curs_4d88[i]->mouse.x = this->puzzlesReadShort();
- this->arr_curs_4d88[i]->render();
+ _cursors[i]->mouse.y = puzzlesReadShort();
+ _cursors[i]->mouse.x = puzzlesReadShort();
+ _cursors[i]->render();
}
// 129:0ad4
for (int i = 0; i <= 0xf; i++) {
- // bitLUT is 1 << i
- this->bitLUT[i] = this->puzzlesReadShort();
+ // _bitLUT is 1 << i
+ _bitLUT[i] = puzzlesReadShort();
}
// 129:0b02
for (int i = 1; i <= 0x51; i++) {
- this->arr_i16_4c7c[i] = this->puzzlesReadByte();
+ this->arr_i16_4c7c[i] = puzzlesReadByte();
}
// 129:0b30
for (int i = 1; i <= 0xc; i++) {
for (int j = 0; j <= 3; j++) {
- this->arr_i16_4d20[i*4 + j] = this->puzzlesReadShort();
+ this->arr_i16_4d20[i*4 + j] = puzzlesReadShort();
}
}
// 129:0b78
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
// story menu entries + endgame puzzles
for (int i = 1; i <= this->var_i16_103a; i++) {
- this->puzzleType[i] = this->puzzlesReadShort();
- this->arr_i16_15e8[i] = this->puzzlesReadShort();
- this->puzzleUnlockChapter[i] = this->puzzlesReadShort();
- this->arr_str_195e8[i] = this->puzzlesReadString().decode(Common::kMacRoman);
+ _puzzleType[i] = puzzlesReadShort();
+ this->arr_i16_15e8[i] = puzzlesReadShort();
+ _puzzleUnlockChapter[i] = puzzlesReadShort();
+ _puzzleName[i] = puzzlesReadString().decode(Common::kMacRoman);
}
// 129:0c0a
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
for (int i = 1; i <= this->var_i16_103a; i++) {
for (int j = 0; j <= 5; j++) {
- this->arr_i16_16b2[i*8+j] = this->puzzlesReadShort();
+ this->arr_i16_16b2[i*8+j] = puzzlesReadShort();
}
}
// 129:0c5e
- this->storyPageCount = this->puzzlesReadShort();
- for (int i = 1; i <= this->storyPageCount; i++) {
- this->pageToChapter[i] = this->puzzlesReadShort();
+ _storyPageCount = puzzlesReadShort();
+ for (int i = 1; i <= _storyPageCount; i++) {
+ _pageToChapter[i] = puzzlesReadShort();
}
// 129:0c98
- for (int i = 1; i <= this->storyPageCount; i++) {
- this->pageLineRanges[i*2] = this->puzzlesReadShort();
- this->pageLineRanges[i*2 + 1] = this->puzzlesReadShort();
+ for (int i = 1; i <= _storyPageCount; i++) {
+ _pageLineRanges[i*2] = puzzlesReadShort();
+ _pageLineRanges[i*2 + 1] = puzzlesReadShort();
}
// 129:0ce0
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
for (int i = 1; i <= this->var_i16_103a; i++) {
- this->arr_i16_1b10[i*2] = this->puzzlesReadShort();
- this->arr_i16_1b10[i*2 + 1] = this->puzzlesReadShort();
+ _puzzleMenuInstructions[i*2] = puzzlesReadShort();
+ _puzzleMenuInstructions[i*2 + 1] = puzzlesReadShort();
}
// 129:0d3c
// story text
- this->var_i16_103c = this->puzzlesReadShort();
+ this->var_i16_103c = puzzlesReadShort();
this->var_i16_68a = 1;
- Common::fill(this->pageLineFace, this->pageLineFace + 1301, 0);
- Common::fill(this->pageLineBreak, this->pageLineBreak + 1301, 0);
+ Common::fill(_pageLineFace, _pageLineFace + 1301, 0);
+ Common::fill(_pageLineBreak, _pageLineBreak + 1301, 0);
for (int i = 1; i <= this->var_i16_103c; i++) {
- this->var_i16_103e = this->puzzlesReadByte();
+ this->var_i16_103e = puzzlesReadByte();
// indent at start of story paragraph
if (this->var_i16_103e & 0x8) {
this->var_i16_103e ^= 0x8;
// 129:0d7e
- g_zbasic->indexRawSet(g_zbasic->space(4).encode(Common::kMacRoman) + this->puzzlesReadString(), 0, i);
+ g_zbasic->indexRawSet(g_zbasic->space(4).encode(Common::kMacRoman) + puzzlesReadString(), 0, i);
} else {
// 129:0da4
- g_zbasic->indexRawSet(this->puzzlesReadString(), 0, i);
+ g_zbasic->indexRawSet(puzzlesReadString(), 0, i);
}
// 129:0db8
// 0x4 == newline
// 0x1 == normal formatting
if ((this->var_i16_103e == 1) || (this->var_i16_103e == 4)) {
- this->pageLineFace[i] = Graphics::kMacFontRegular;
+ _pageLineFace[i] = Graphics::kMacFontRegular;
}
// 129:0dea
// 0x2 = bold formatting
if ((this->var_i16_103e == 2) || (this->var_i16_103e == 5)) {
- this->pageLineFace[i] = Graphics::kMacFontBold;
+ _pageLineFace[i] = Graphics::kMacFontBold;
}
// 129:0e1e
// 0x3 = outlined
if ((this->var_i16_103e == 3) || (this->var_i16_103e == 6)) {
- this->pageLineFace[i] = Graphics::kMacFontBold | Graphics::kMacFontOutline | Graphics::kMacFontShadow;
+ _pageLineFace[i] = Graphics::kMacFontBold | Graphics::kMacFontOutline | Graphics::kMacFontShadow;
}
// 129:0e52
if (this->var_i16_103e > 3) {
- this->pageLineBreak[i] = 1;
+ _pageLineBreak[i] = 1;
}
// 129:0e6e
}
// 129:0e80
this->var_i16_68a = 0x64;
this->sub_129_123a();
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
- g_zbasic->indexRawSet(this->puzzlesReadString(), 0, i);
+ g_zbasic->indexRawSet(puzzlesReadString(), 0, i);
}
// 129:0ec2
for (int j = 1; j <= 0x50; j++) {
this->var_i16_1040 = 0;
- for (int i = 1; i <= this->storyPageCount; i++) {
- if (this->pageToChapter[i] == j) {
+ for (int i = 1; i <= _storyPageCount; i++) {
+ if (_pageToChapter[i] == j) {
this->var_i16_1040++;
}
// 129:0ef4
- if (this->pageToChapter[i] > j) {
- i = this->storyPageCount;
+ if (_pageToChapter[i] > j) {
+ i = _storyPageCount;
}
// 129:0f16
}
if (this->var_i16_1040 > 1) {
this->var_i16_484 = 0;
- for (int i = 1; i <= this->storyPageCount; i++) {
- if (this->pageToChapter[i] == j) {
+ for (int i = 1; i <= _storyPageCount; i++) {
+ if (_pageToChapter[i] == j) {
this->var_i16_484++;
// - X of N
- this->arr_str_1a288[i] = Common::U32String::format("%s %d%s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
+ _pageNumberText[i] = Common::U32String::format("%s %d%s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
}
// 129:0fb6
- if (this->pageToChapter[i] > j) {
- i = this->storyPageCount;
+ if (_pageToChapter[i] > j) {
+ i = _storyPageCount;
}
// 129:0fd8
}
@@ -3170,12 +3175,12 @@ void FoolGame::sub_129_068() {
// 129:0fea
}
// 129:0ff8
- Common::fill(this->arr_i16_1dee, this->arr_i16_1dee + 202, 0);
- for (int j = 1; j <= this->storyPageCount; j++) {
- for (int i = this->pageLineRanges[j*2]; i <= this->pageLineRanges[j*2 + 1]; i++) {
- if (this->pageLineBreak[i] != 0) {
+ Common::fill(_pageLines, _pageLines + 202, 0);
+ for (int j = 1; j <= _storyPageCount; j++) {
+ for (int i = _pageLineRanges[j*2]; i <= _pageLineRanges[j*2 + 1]; i++) {
+ if (_pageLineBreak[i] != 0) {
// 129:102e
- this->arr_i16_1dee[j]++;
+ _pageLines[j]++;
}
// 129:105a
}
@@ -3208,13 +3213,13 @@ void FoolGame::sub_129_068() {
this->sub_128_6244();
// 129:11f6
- if (saveFileName.empty()) { // was: str(157)
+ if (_saveFileName.empty()) { // was: str(157)
// cold start
- this->stateFlags = kStateNewGame;
+ _stateFlags = kStateNewGame;
} else {
// loading a save game
- this->stateFlags = kStateOpenGame;
- this->var_str_588 = saveFileName;
+ _stateFlags = kStateOpenGame;
+ this->var_str_588 = _saveFileName;
this->var_i16_688 = this->var_i16_9ec;
}
// 129:1236
@@ -3225,12 +3230,12 @@ void FoolGame::sub_129_068() {
void FoolGame::sub_129_123a() {
// draw the loading text on the menu bar
g_toolbox->SetPort(this->var_i32_8);
- this->fillRect(0, 7, 0x13, this->var_i16_5a - 7, 0);
+ fillRect(0, 7, 0x13, _windowWidth - 7, 0);
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
this->var_str_172 = Common::U32String::format("%s %d%s", g_zbasic->str(158).encode().c_str(), this->var_i16_68a, g_zbasic->str(159).encode().c_str());
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo((this->var_i16_5a / 2) - (this->var_i16_30 / 2), 0xe);
+ g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xe);
g_toolbox->DrawString(this->var_str_172);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
@@ -3241,7 +3246,7 @@ void FoolGame::sub_129_123a() {
// hermit key trace
void FoolGame::hermitRun() {
// 142:12ac
- if (this->puzzleCompletionStatus[0x34] < 5) {
+ if (_puzzleCompletionStatus[0x34] < 5) {
g_zbasic->menu(8, 3, 1, g_zbasic->str(362)); // to find a hidden secret
g_zbasic->menu(8, 4, 1, g_zbasic->str(363));
} else {
@@ -3250,38 +3255,38 @@ void FoolGame::hermitRun() {
g_zbasic->menu(8, 4, 1, g_zbasic->str(365));
}
// 142:132c
- if (this->var_i16_c04 == 0) {
- this->hermitPathStage = 1;
+ if (_activePuzzleStatus == 0) {
+ _hermitPathStage = 1;
}
- if ((this->var_i16_c04 > 0) && (this->var_i16_c04 < 0x63)) {
- this->hermitPathStage = this->var_i16_c04;
+ if ((_activePuzzleStatus > 0) && (_activePuzzleStatus < 0x63)) {
+ _hermitPathStage = _activePuzzleStatus;
}
// 142:1360
- if (this->var_i16_c04 == 0x63) {
- this->hermitPathStage = 6;
+ if (_activePuzzleStatus == 0x63) {
+ _hermitPathStage = 6;
}
- if (this->var_i16_c04 == 0x64) {
- this->hermitPathStage = 1;
+ if (_activePuzzleStatus == 0x64) {
+ _hermitPathStage = 1;
}
- if (this->var_i16_c04 > 0x64) {
- this->hermitPathStage = this->var_i16_c04 - 0x64;
+ if (_activePuzzleStatus > 0x64) {
+ _hermitPathStage = _activePuzzleStatus - 0x64;
}
this->thothKeyLast();
- if (this->hermitPathStage == 6) {
- this->var_i16_c04 = 0x63;
+ if (_hermitPathStage == 6) {
+ _activePuzzleStatus = 0x63;
} else {
- if (this->var_i16_c04 < 0x63) {
+ if (_activePuzzleStatus < 0x63) {
// 142:13be
- this->var_i16_c04 = this->hermitPathStage;
- if (this->var_i16_d0c != 0) {
- this->var_i16_c04 = 0x64;
+ _activePuzzleStatus = _hermitPathStage;
+ if (_activePuzzleSolved) {
+ _activePuzzleStatus = 0x64;
}
} else {
// 142:13da
- if (this->var_i16_c04 >= 0x64) {
- this->var_i16_c04 = this->hermitPathStage + 0x64;
- if (this->var_i16_d0c != 0) {
- this->var_i16_c04 = 0x65;
+ if (_activePuzzleStatus >= 0x64) {
+ _activePuzzleStatus = _hermitPathStage + 0x64;
+ if (_activePuzzleSolved) {
+ _activePuzzleStatus = 0x65;
}
}
}
@@ -3293,8 +3298,8 @@ void FoolGame::sub_144_004() {
// 144:0004
g_toolbox->ReleaseResource(var_pic_7c2);
var_i32_7c8 = g_zbasic->mem(-1);
- stateFlags = kStateQuit;
- if (!screenOversized) {
+ _stateFlags = kStateQuit;
+ if (!_screenOversized) {
g_toolbox->SetPort(var_i32_8);
fillRect(0, 0, 0x14, SCREEN_WIDTH, 0x47);
g_toolbox->SetPort(var_i32_0);
@@ -3306,7 +3311,7 @@ void FoolGame::sub_144_004() {
autoSaveGame(); // was: saveGame
g_toolbox->InitCursor();
sub_128_4da(0);
- if (!screenOversized) {
+ if (!_screenOversized) {
var_i16_42 = 0;
var_i16_44 = 0xab;
} else {
@@ -3351,58 +3356,30 @@ void FoolGame::sub_144_004() {
sub_128_406(1);
}
// 144:0268
- arr_str_1a8d8[0] = g_zbasic->str(368); // what's this?
- arr_str_1a8d8[1] = g_zbasic->str(369); // more evil treachery afoot?
- arr_str_1a8d8[2] = g_zbasic->str(370); // has not the fool has gained the gift of wisdom?
- arr_str_1a8d8[3] = g_zbasic->str(371); // -blank-
- arr_str_1a8d8[4] = g_zbasic->str(372); // locate and double-click the show finale file
- arr_str_1a8d8[5] = g_zbasic->str(373); // this will oepn the 'prologue - finale' once again
- arr_str_1a8d8[6] = g_zbasic->str(374); // but now, you'll see the finale
- arr_str_1a8d8[7] = g_zbasic->str(375); // -blank-
- arr_str_1a8d8[8] = g_zbasic->str(376); // congratulations!
- arr_str_1a8d8[9] = g_zbasic->str(377); // -blank-
- arr_str_1a8d8[10] = g_zbasic->str(378); // quit
+ _modalText[0] = g_zbasic->str(368); // what's this?
+ _modalText[1] = g_zbasic->str(369); // more evil treachery afoot?
+ _modalText[2] = g_zbasic->str(370); // has not the fool has gained the gift of wisdom?
+ _modalText[3] = g_zbasic->str(371); // -blank-
+ _modalText[4] = g_zbasic->str(372); // locate and double-click the show finale file
+ _modalText[5] = g_zbasic->str(373); // this will oepn the 'prologue - finale' once again
+ _modalText[6] = g_zbasic->str(374); // but now, you'll see the finale
+ _modalText[7] = g_zbasic->str(375); // -blank-
+ _modalText[8] = g_zbasic->str(376); // congratulations!
+ _modalText[9] = g_zbasic->str(377); // -blank-
+ _modalText[10] = g_zbasic->str(378); // quit
sub_128_dfe(0xfa, 9, 1, 0);
- if (screenOversized == 0) {
+ if (!_screenOversized) {
g_toolbox->ClearMenuBar();
g_toolbox->DrawMenuBar();
}
sub_128_1f1e();
sub_128_4da(1);
// 144:03e2
- //if (saveFileName.empty()) {
+ // write the finale file to the disk. we don't need to do this
+ //if (_saveFileName.empty()) {
// sub_144_5ca();
//}
//sub_144_406();
}
-void FoolGame::sub_144_406() {
- // write the finale file to the disk.
- // we don't use this.
- // 144:0406
- while (true) {
- var_str_384 = g_zbasic->str(384); // and now it is time to show the finale for the fool's errand
- for (int16 i = 1; i <= 0xa; i++) {
- var_str_384 += g_zbasic->chr(i);
- }
- var_i16_1372 = var_str_384.size();
- g_zbasic->defOpen(g_zbasic->str(381)); // SHOWsF87
- var_i16_7e6 = 0;
- g_zbasic->openW(2, g_zbasic->str(382), 0x200, var_i16_9ec); // Show Finale
- if (var_i16_7e6 == 0) {
- g_zbasic->writeFileStr(2, var_str_384);
- }
- if (var_i16_7e6 == 0) {
- g_zbasic->close(2);
- }
- if (var_i16_7e6 == 0)
- return;
- }
- // 144:05ca
-}
-
-void FoolGame::sub_144_5ca() {
- // 144:05ca
-}
-
};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 9371a2b3950..f3bdff4dc3a 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -79,7 +79,7 @@ public:
void drawTarotCard(int16 rectID, int16 deckPos, int16 type); // sub_128_712
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
void sub_128_918(const Common::U32String &unk1);
- void sub_128_962(int16 unk11, int16 unk10, int16 unk9, int16 unk8, int16 unk7, int16 unk6, int16 unk5, int16 unk4, int16 unk3, PatternMode unk2, int16 unk1);
+ void zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps); // sub_128_962
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void getNextEvent(uint32 mask); // sub_128_c6a
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
@@ -410,8 +410,6 @@ public:
void straightPathSuccess(); // sub_143_8b0
void sub_144_004();
- void sub_144_406();
- void sub_144_5ca();
private:
@@ -430,19 +428,19 @@ private:
int16 var_i16_3a;
int16 var_i16_42;
int16 var_i16_44;
- EventRecord var_ev_46;
- int16 var_i16_56;
- int16 var_i16_58;
- int16 var_i16_5a;
- int16 var_i16_5c;
+ EventRecord _event; // var_ev_46
+ int16 var_i16_56; // var_i16_56
+ int16 var_i16_58; // var_i16_58
+ int16 _windowWidth; // var_i16_5a
+ int16 _windowHeight; // var_i16_5c
SFReply var_sfr_5e; // -> aa
int16 var_i16_16c;
ProcPtr var_i32_16e;
Common::U32String var_str_172;
Common::U32String var_str_272;
RGBColor var_i16_372;
- int16 soundEnabled; // var_i16_378
- bool screenOversized; // var_i16_37a
+ bool _soundEnabled; // var_i16_378
+ bool _screenOversized; // var_i16_37a
uint32 var_i32_37c;
Common::U32String var_str_384;
int16 var_i16_484;
@@ -475,30 +473,30 @@ private:
int16 var_i16_7ba;
int16 var_i16_7bc;
// this was reused, I don't know why
- int16 savePromptChoice; // var_i16_7be
+ int16 _savePromptChoice; // var_i16_7be
int16 var_i16_7be;
- int16 keyLastPressed; // var_i16_7c0
+ int16 _keyLastPressed; // var_i16_7c0
PicHandle var_pic_7c2;
- uint16 stateFlags; // var_i16_7c6
+ uint16 _stateFlags; // var_i16_7c6
uint32 var_i32_7c8;
int16 var_i16_7cc;
int16 var_i16_7ce;
- int16 storyCurrentChapter; // var_i16_7d0
- int16 sunMapRestored; // var_i16_7d2
- int16 storyCurrentPage; // var_i16_7d4
+ int16 _storyCurrentChapter; // var_i16_7d0
+ int16 _sunMapRestored; // var_i16_7d2
+ int16 _storyCurrentPage; // var_i16_7d4
int16 var_i16_7d6;
- int16 storyNextPage; // var_i16_7d8
- int16 storyPageCount; // var_i16_7da
- int16 selectedMenuChapter; // var_i16_7dc
+ int16 _storyNextPage; // var_i16_7d8
+ int16 _storyPageCount; // var_i16_7da
+ int16 _selectedMenuChapter; // var_i16_7dc
int16 var_i16_7de;
int16 var_i16_7e0;
- int16 activePuzzle; // var_i16_7e2
+ int16 _activePuzzle; // var_i16_7e2
int16 var_i16_7e4;
int16 var_i16_7e6;
Common::U32String var_str_7e8;
int16 var_i16_8e8;
- Common::U32String saveFileName; // var_str_8ec
- bool isAutoSaving;
+ Common::U32String _saveFileName; // var_str_8ec
+ bool _isAutoSaving;
int16 var_i16_9ec;
int16 var_i16_9f2;
Common::U32String var_str_9f4;
@@ -511,20 +509,20 @@ private:
MenuHandle var_menu_bf8;
int16 var_i16_c00;
int16 var_i16_c02;
- int16 var_i16_c04;
- Common::String activePuzzleBuffer; // var_str_c06
+ int16 _activePuzzleStatus; // var_i16_c04
+ Common::String _activePuzzleBuffer; // var_str_c06
int16 var_i16_d06;
int16 var_i16_d08;
int16 var_i16_d0a;
- int16 var_i16_d0c;
+ bool _activePuzzleSolved; // var_i16_d0c
int16 var_i16_d0e;
int16 var_i16_d10;
Common::U32String var_str_d12;
- bool menuDisabled; // var_i16_e12
- bool menuHidesPlayfield; // var_i16_e14
- int16 selectedMenuID; // var_i16_e16
- int16 selectedMenuItem; // var_i16_e18
+ bool _menuDisabled; // var_i16_e12
+ bool _menuHidesPlayfield; // var_i16_e14
+ int16 _selectedMenuID; // var_i16_e16
+ int16 _selectedMenuItem; // var_i16_e18
int16 var_i16_e1a;
int16 var_i16_e1c;
int16 var_i16_e1e;
@@ -537,14 +535,14 @@ private:
int16 var_i16_f2e;
Common::U32String var_str_f30;
int16 var_i16_1030;
- PicHandle metapuzzleWheelPic; // var_pic_1032
+ PicHandle _metapuzzleWheelPic; // var_pic_1032
int32 var_i32_1036;
int16 var_i16_103a;
int16 var_i16_103c;
int16 var_i16_103e;
int16 var_i16_1040;
- int16 jumbleSubPuzzleCount; // var_i16_1056
- int16 jumbleCurrentSubPuzzle; // var_i16_1058
+ int16 _jumbleSubPuzzleCount; // var_i16_1056
+ int16 _jumbleCurrentSubPuzzle; // var_i16_1058
int16 var_i16_105a;
int16 var_i16_105c;
int16 var_i16_105e;
@@ -552,7 +550,7 @@ private:
int16 var_i16_1062;
int16 var_i16_1064;
int16 var_i16_1066;
- int16 jumbleGameType; // var_i16_1068
+ int16 _jumbleGameType; // var_i16_1068
int16 var_i16_106a;
SourceMode var_i16_106c;
int16 var_i16_106e;
@@ -600,7 +598,7 @@ private:
uint16 var_i16_1a9c;
int16 var_i16_1a9e;
int16 var_i16_1aa0;
- int16 metapuzzleSecretCodeSpaceOffset; // var_i16_1aa2
+ int16 _metapuzzleSecretCodeSpaceOffset; // var_i16_1aa2
int16 var_i16_1aa4;
int16 var_i16_1aa6;
int16 var_i16_1aa8;
@@ -619,11 +617,11 @@ private:
Common::String var_str_1ac8;
int16 var_i16_1bc8;
- int16 mazePlayerX; // var_i16_1bcc
- int16 mazePlayerY; // var_i16_1bce
+ int16 _mazePlayerX; // var_i16_1bcc
+ int16 _mazePlayerY; // var_i16_1bce
int16 var_i16_1bd0;
- int16 mazePlayerDirection; // var_i16_1bd2
+ int16 _mazePlayerDirection; // var_i16_1bd2
int16 var_i16_1bd4;
int16 var_i16_1bd6;
int16 var_i16_1bd8;
@@ -667,9 +665,9 @@ private:
uint16 var_i16_1f08;
int16 var_i16_1f0a;
- Common::U32String metapuzzleSecretCodeCipher; // var_str_1f0c
+ Common::U32String _metapuzzleSecretCodeCipher; // var_str_1f0c
- int16 metapuzzleSecretCodeCount; // var_i16_200c
+ int16 _metapuzzleSecretCodeCount; // var_i16_200c
int16 var_i16_200e;
int16 var_i16_2010;
int16 var_i16_2012;
@@ -685,7 +683,7 @@ private:
int16 var_i16_221e;
Common::U32String var_str_2222;
int16 var_i16_2322;
- int16 hermitPathStage; // var_i16_2324
+ int16 _hermitPathStage; // var_i16_2324
int16 var_i16_2326;
int16 var_i16_2328;
uint32 var_ptr_232a;
@@ -694,8 +692,7 @@ private:
int16 var_i16_2330;
int16 var_i16_2332;
- int16 hermitPathStartIndex; // var_i16_2334
- int16 hermitPathEndIndex; // var_i16_2336
+
int16 var_i16_2338;
int16 var_i16_233a;
int16 var_i16_233e;
@@ -705,50 +702,46 @@ private:
int16 var_i16_2342;
// FIXME: bounds on the following are guessed! need to trace index range
- int16 pageLineRanges[202]; // arr_i16_0
- int16 pageLineFace[1301]; // arr_i16_194
- int16 pageLineBreak[1301]; // arr_i16_bbe
+ int16 _pageLineRanges[202]; // arr_i16_0
+ int16 _pageLineFace[1301]; // arr_i16_194
+ int16 _pageLineBreak[1301]; // arr_i16_bbe
int16 arr_i16_15e8[101];
int16 arr_i16_16b2[0x100];
- int16 puzzleType[101]; // arr_i16_18b2
- int16 puzzleUnlockChapter[101]; // arr_i16_197c
- int16 pageToChapter[101]; // arr_i16_1a46
- int16 arr_i16_1b10[0x40];
- int16 pageVisible[101]; // arr_i16_1b90
- int16 puzzleCompletionStatus[101]; // arr_i16_1c5a
- uint16 puzzleFlags[101]; // arr_i16_1d24
- int16 arr_i16_1dee[202];
+ int16 _puzzleType[101]; // arr_i16_18b2
+ int16 _puzzleUnlockChapter[101]; // arr_i16_197c
+ int16 _pageToChapter[101]; // arr_i16_1a46
+ int16 _puzzleMenuInstructions[0x40]; // arr_i16_1b10
+ int16 _pageVisible[101]; // arr_i16_1b90
+ int16 _puzzleCompletionStatus[101]; // arr_i16_1c5a
+ uint16 _puzzleFlags[101]; // arr_i16_1d24
+ int16 _pageLines[202]; // arr_i16_1dee
int16 arr_i16_1eb8[0x29];
// used just for death?
Common::Rect arr_rect_1eb8;
Common::Rect arr_rect_1ec0;
- Common::Rect arr_rect_1f38[0x200];
- int16 arr_i16_2f38[0xc00]; // 96x32?
- int16 arr_i16_3738[0x400];
- int16 arr_i16_3b38[0xc00]; // 96x32?
+ Common::Rect _screenGrid[0x200]; // arr_rect_1f38
+ int16 arr_i16_2f38[0x400]; // arr_i16_2f38, 96x32?
+ int16 arr_i16_3738[0x200];
+ int16 arr_i16_3b38[0x400]; // 96x32?
Common::Rect arr_rect_4338;
// general-purpose puzzle buffer
int16 arr_i16_4338[0x200];
- uint16 bitLUT[16]; // arr_i16_4738
+ uint16 _bitLUT[16]; // arr_i16_4738
int16 arr_i16_4758[15];
Common::Rect arr_rect_4776;
int16 arr_i16_47d8[0x100];
PicHandle arr_pic_49d8[0x80];
- int16 sunMapTileID[0x52]; // arr_i16_4bd8
+ int16 _sunMapTileID[0x52]; // arr_i16_4bd8
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[52];
- Common::SharedPtr<Cursor> arr_curs_4d88[0x2b]; // 0x44
- Pattern arr_pat_58f4[0x51];
- Common::Rect arr_rect_5b7c;
- Common::Rect arr_rect_5b84;
- Common::Rect arr_rect_5b8c;
- Common::Rect arr_rect_5b92;
+ Common::SharedPtr<Cursor> _cursors[0x2b]; // arr_curs_4d88, 0x44
+ Pattern _patterns[0x51]; // arr_pat_58f4
int16 arr_i16_5bbc[64];
int16 arr_i16_5cbc[64];
float arr_bcd_5dbc[8];
Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
- BitMap arr_jigsaw_5dfc[128];
+ BitMap _jigsawPieces[128];
int16 arr_i16_9894[0xa43]; // inside 5dfc, used for humbug
int16 arr_i16_ac1c[0xa43]; // inside 5dfc, used for humbug
BitMap arr_bmp_b3ec;
@@ -765,16 +758,16 @@ private:
// Also 109dc and 15fcc
Common::Rect arr_rect_1910c;
Common::Rect arr_rect_19114;
- PicHandle arr_i32_1912c[0x54];
+ PicHandle _sunMapTilePic[0x54]; // arr_i32_1912c
PicHandle arr_i32_192c0[101];
- PolyHandle arr_poly_192c0[101];
- int32 puzzleDataOffsets[101]; // arr_i32_19454
- Common::U32String arr_str_195e8[101]; // 0x20 each
+ PolyHandle _revealPoly[101]; // arr_poly_192c0
+ int32 _puzzleDataOffsets[101]; // arr_i32_19454
+ Common::U32String _puzzleName[101]; // arr_str_195e8, 0x20 each
- Common::U32String arr_str_1a288[101]; // 0x10 each
+ Common::U32String _pageNumberText[101]; // arr_str_1a288, 0x10 each
- Common::U32String arr_str_1a8d8[13]; // 0x66 each
- Common::Rect arr_rect_1ae06;
+ Common::U32String _modalText[13]; // arr_str_1a8d8, 0x66 each
+ Common::Rect _screenClipRect; // arr_rect_1ae06
};
}
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 374ac60b2d0..a19d6508687 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -32,29 +32,29 @@ extern Toolbox *g_toolbox;
// the humbug - "irritating stick" style challenge
void FoolGame::humbugRun() {
// 142:0004
- if (this->var_i16_c04 < 0x63) {
+ if (_activePuzzleStatus < 0x63) {
this->humbugTrail();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
return;
}
this->sub_142_5f2();
- if (this->puzzleCompletionStatus[0x34] > 2) {
- this->var_i16_c04 = 0x64;
+ if (_puzzleCompletionStatus[0x34] > 2) {
+ _activePuzzleStatus = 0x64;
return;
}
// 142:004e
- this->var_i16_c04 = 0x63;
- this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ _activePuzzleStatus = 0x63;
+ this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
this->var_str_384 = g_zbasic->str(336); // behold the 2nd key of thoth
this->sub_128_178a(0x17, 0);
}
// 142:00b2
- if (this->var_i16_c04 == 0x63) {
+ if (_activePuzzleStatus == 0x63) {
this->sub_142_630();
}
- if (this->var_i16_c04 >= 0x64) {
+ if (_activePuzzleStatus >= 0x64) {
this->humbugTrail();
- if (this->var_i16_d0c != 0) {
+ if (_activePuzzleSolved) {
this->sub_142_5f2();
}
}
@@ -64,7 +64,7 @@ void FoolGame::humbugRun() {
void FoolGame::humbugTrail() {
// 142:00e6
- if (this->puzzleCompletionStatus[0x34] < 3) {
+ if (_puzzleCompletionStatus[0x34] < 3) {
g_zbasic->menu(8, 3, 1, g_zbasic->str(337)); // A secret is undone
g_zbasic->menu(8, 4, 1, g_zbasic->str(338)); // if the two become one.
} else {
@@ -80,8 +80,8 @@ void FoolGame::humbugTrail() {
// eye button
g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
for (int16 i = 1; i <= 0xa42; i++) {
- this->arr_i16_9894[i] = this->puzzlesReadShort();
- this->arr_i16_ac1c[i] = this->puzzlesReadShort();
+ this->arr_i16_9894[i] = puzzlesReadShort();
+ this->arr_i16_ac1c[i] = puzzlesReadShort();
g_zbasic->put(
this->arr_i16_9894[i],
this->arr_i16_ac1c[i],
@@ -101,21 +101,21 @@ void FoolGame::humbugTrail() {
kPutCopy
);
this->var_i16_233c = 1;
- this->stateFlags = kStateNull;
- this->var_i16_d0c = 0;
+ _stateFlags = kStateNull;
+ _activePuzzleSolved = false;
this->var_i16_1ab6 = 0;
this->var_i16_1ab8 = 0;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 142:02ee
this->getNextEvent(-1);
- if (!((this->var_i16_1ab6 == this->var_ev_46.where.x) && (this->var_i16_1ab8 == this->var_ev_46.where.y))) {
+ if (!((this->var_i16_1ab6 == _event.where.x) && (this->var_i16_1ab8 == _event.where.y))) {
this->sub_142_370();
}
if (this->var_i16_233c >= 0xa42) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
// 142:0346
@@ -134,8 +134,8 @@ void FoolGame::sub_142_370() {
}
this->var_i16_1a9c = 0;
for (int16 i = this->var_i16_7e4; i >= this->var_i16_9f2; i--) {
- this->var_i16_1a96 = this->var_ev_46.where.x - this->arr_i16_9894[i];
- this->var_i16_1a98 = this->var_ev_46.where.y - this->arr_i16_ac1c[i];
+ this->var_i16_1a96 = _event.where.x - this->arr_i16_9894[i];
+ this->var_i16_1a98 = _event.where.y - this->arr_i16_ac1c[i];
if ((this->var_i16_1a96 >= -5) && (this->var_i16_1a96 <= 0x1e) && (this->var_i16_1a98 >= -5) && (this->var_i16_1a98 <= 0x19)) {
this->var_i16_1a9c = i + 0xa;
}
@@ -162,8 +162,8 @@ void FoolGame::sub_142_370() {
// 142:051c
} while (g_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
this->var_i16_233c = this->var_i16_1a9c;
- this->var_i16_1ab6 = this->var_ev_46.where.x;
- this->var_i16_1ab8 = this->var_ev_46.where.y;
+ this->var_i16_1ab6 = _event.where.x;
+ this->var_i16_1ab8 = _event.where.y;
} else {
// 142:054a
this->var_i16_7e4 = this->var_i16_233c - 0xa;
@@ -189,7 +189,7 @@ void FoolGame::sub_142_370() {
void FoolGame::sub_142_5f2() {
// 142:05f2
- this->sub_128_962(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
}
void FoolGame::sub_142_630() {
@@ -197,7 +197,7 @@ void FoolGame::sub_142_630() {
g_zbasic->menu(8, 0, 1, g_zbasic->str(342)); // the 2nd key of thoth
g_zbasic->menu(8, 1, 1, g_zbasic->str(343)); // return to scroll
this->thothKey2nd();
- if (this->var_i16_d0c == 1) {
+ if (_activePuzzleSolved) {
// 142:066e
g_toolbox->PenNormal();
g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
@@ -207,7 +207,7 @@ void FoolGame::sub_142_630() {
temp.left = this->arr_i16_2f38[i*32+1];
temp.bottom = this->arr_i16_2f38[i*32+2];
temp.right = this->arr_i16_2f38[i*32+3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(temp, _patterns[2]);
g_toolbox->FrameRect(temp);
this->var_str_384 = Common::U32String::format(" %d ", i);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
@@ -226,7 +226,7 @@ void FoolGame::sub_142_630() {
this->var_i16_484 = 0;
this->var_i16_7e4 = 0;
this->var_i16_9f2 = 0;
- while (this->var_ev_46.modifiers & kModMouseButtonUp) {
+ while (_event.modifiers & kModMouseButtonUp) {
// 142:07f8
this->getNextEvent(-1); // was: 0
this->var_i16_7e4++;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 2077e9e061c..bb4b779f7d3 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -36,15 +36,15 @@ void FoolGame::jigsawRun() {
// 132:0004
this->var_i16_c00 = 1;
this->sub_128_271a();
- this->var_i16_1066 = this->puzzlesReadShort();
+ this->var_i16_1066 = puzzlesReadShort();
for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 132:0044
// puzzle dimensions
this->var_i16_1a9e = this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1];
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- this->arr_i16_3738[i] = this->puzzlesReadByte();
+ this->arr_i16_3738[i] = puzzlesReadByte();
}
// 132:00a2
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
@@ -60,7 +60,7 @@ void FoolGame::jigsawRun() {
do {
this->var_i16_484++;
g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
+ _screenGrid[this->var_i16_484],
this->var_i16_68a + 1,
this->var_i16_68c + 1,
this->var_i16_68a + this->arr_i16_1eb8[13],
@@ -68,13 +68,13 @@ void FoolGame::jigsawRun() {
);
//this->var_i16_1aa2 = 0x2af8 + this->var_i16_1aa0*(this->arr_i16_3738[this->var_i16_484] - 1);
// 132:0216
- this->arr_jigsaw_5dfc[this->arr_i16_3738[this->var_i16_484]] = BitMap(new Graphics::ManagedSurface());
+ _jigsawPieces[this->arr_i16_3738[this->var_i16_484]] = BitMap(new Graphics::ManagedSurface());
g_zbasic->get(
- this->arr_rect_1f38[this->var_i16_484].left,
- this->arr_rect_1f38[this->var_i16_484].top,
- this->arr_rect_1f38[this->var_i16_484].right,
- this->arr_rect_1f38[this->var_i16_484].bottom,
- this->arr_jigsaw_5dfc[this->arr_i16_3738[this->var_i16_484]]
+ _screenGrid[this->var_i16_484].left,
+ _screenGrid[this->var_i16_484].top,
+ _screenGrid[this->var_i16_484].right,
+ _screenGrid[this->var_i16_484].bottom,
+ _jigsawPieces[this->arr_i16_3738[this->var_i16_484]]
);
} while (g_zbasic->incrAndCheck(
this->var_i16_68a,
@@ -97,21 +97,21 @@ void FoolGame::jigsawRun() {
}
// 132:0376
// rearrange picture tiles to match state
- if (!this->activePuzzleBuffer.empty()) { // was: str(207)
+ if (!_activePuzzleBuffer.empty()) { // was: str(207)
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- Common::String tileData = g_zbasic->midStr(this->activePuzzleBuffer, i*2 - 1, 2);
+ Common::String tileData = g_zbasic->midStr(_activePuzzleBuffer, i*2 - 1, 2);
this->arr_i16_3738[i] = g_zbasic->decodeInt(tileData);
g_zbasic->put(
- this->arr_rect_1f38[i].left,
- this->arr_rect_1f38[i].top,
- this->arr_jigsaw_5dfc[this->arr_i16_3738[i]],
+ _screenGrid[i].left,
+ _screenGrid[i].top,
+ _jigsawPieces[this->arr_i16_3738[i]],
kPutCopy
);
// 132:0452
}
}
// 132:0464
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->jigsawCheckIfSolved();
@@ -119,27 +119,27 @@ void FoolGame::jigsawRun() {
// 132:04d8
// input loop
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 132:0484
// 132:049c
- while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0)) {
+ while ((_stateFlags == kStateNull) && !_activePuzzleSolved) {
// 132:0488
this->getNextEvent(-1);
- if (this->var_ev_46.what == kMouseDown) {
+ if (_event.what == kMouseDown) {
this->jigsawOnClick();
}
}
// 132:04b8
- if (this->stateFlags == kStateUndo) {
+ if (_stateFlags == kStateUndo) {
this->jigsawCancelSelect();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->jigsawStoreState();
this->saveGame();
}
}
// 132:0500
- if (this->var_i16_d0c != 0) {
+ if (_activePuzzleSolved) {
this->jigsawSuccess();
}
this->jigsawStoreState();
@@ -154,7 +154,7 @@ void FoolGame::jigsawOnClick() {
return;
}
// 132:059c
- this->menuDisabled = true;
+ _menuDisabled = true;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
@@ -182,7 +182,7 @@ void FoolGame::jigsawOnClick() {
this->jigsawCheckIfSolved();
this->sub_128_6186();
g_zbasic->menu(8, 3, 1, Common::U32String());
- this->menuDisabled = false;
+ _menuDisabled = false;
}
void FoolGame::jigsawDragSelect() {
@@ -209,18 +209,18 @@ void FoolGame::jigsawDragSelect() {
this->arr_i16_4758[7] = this->arr_i16_4758[1];
}
// 132:07b0
- this->arr_i16_4758[11] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
+ this->arr_i16_4758[11] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
// 132:080e
- this->arr_i16_4758[12] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
- this->arr_i16_4758[13] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
- this->arr_i16_4758[14] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
+ this->arr_i16_4758[12] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
+ this->arr_i16_4758[13] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
+ this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
// 132:092e
g_toolbox->FrameRect(temp);
this->sub_128_3da(2);
g_toolbox->FrameRect(temp);
this->sub_128_3da(1);
- } while (this->var_ev_46.what != kMouseUp);
+ } while (_event.what != kMouseUp);
}
void FoolGame::jigsawMoveSelected() {
@@ -269,23 +269,23 @@ void FoolGame::jigsawMoveSelected() {
this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
}
// 132:0c90
- this->arr_rect_4776.top = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
- this->arr_rect_4776.left = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
+ this->arr_rect_4776.top = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
+ this->arr_rect_4776.left = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
// 132:0d4e
- this->arr_rect_4776.bottom = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
- this->arr_rect_4776.right = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
+ this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
+ this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
// 132:0e0e
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(2);
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(1);
}
- while (!((this->var_ev_46.what == kMouseDown) && (this->var_ev_46.where.y > 0x14)));
+ while (!((_event.what == kMouseDown) && (_event.where.y > 0x14)));
}
void FoolGame::jigsawCancelSelect() {
// 132:0e5a
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
@@ -344,9 +344,9 @@ void FoolGame::jigsawDropSelected() {
// 0x2af8, this->var_i16_1aa0 * (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] - 1)
// blit tiles to screen
g_zbasic->put(
- this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
- this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_jigsaw_5dfc[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
+ _screenGrid[this->arr_i16_2f38[i*32 + j]].left,
+ _screenGrid[this->arr_i16_2f38[i*32 + j]].top,
+ _jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
kPutCopy
);
}
@@ -363,9 +363,9 @@ void FoolGame::jigsawDropSelected() {
debug(8, "(%d, %d) [src]: %d <- buffer 2", i, j, this->arr_i16_3738[this->var_i16_1aa6]);
this->arr_i16_3738[this->arr_i16_2f38[i*32+j]] = this->arr_i16_3738[this->var_i16_1aa6];
g_zbasic->put(
- this->arr_rect_1f38[this->arr_i16_2f38[i*32+j]].left,
- this->arr_rect_1f38[this->arr_i16_2f38[i*32+j]].top,
- this->arr_jigsaw_5dfc[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
+ _screenGrid[this->arr_i16_2f38[i*32+j]].left,
+ _screenGrid[this->arr_i16_2f38[i*32+j]].top,
+ _jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
kPutCopy
);
}
@@ -377,9 +377,9 @@ void FoolGame::jigsawDropSelected() {
void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
- this->activePuzzleBuffer = g_zbasic->str(208);
+ _activePuzzleBuffer = g_zbasic->str(208);
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_3738[i]);
+ _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_3738[i]);
}
}
@@ -387,27 +387,27 @@ void FoolGame::jigsawStoreState() {
void FoolGame::jigsawCheckIfSolved() {
// check if puzzle is solved
// 132:13ea
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
for (int i = 1; i <= this->var_i16_1a9e; i++) {
if (this->arr_i16_3738[i] != i) {
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
i = this->var_i16_1a9e;
}
// 132:1420
}
// 132:1430
- if (this->var_i16_d0c != 0) {
- this->stateFlags = kStateReturn;
+ if (_activePuzzleSolved) {
+ _stateFlags = kStateReturn;
}
}
void FoolGame::jigsawSuccess() {
// strobe puzzle pieces once on victory
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- g_toolbox->InvertRect(this->arr_rect_1f38[i]);
+ g_toolbox->InvertRect(_screenGrid[i]);
this->sub_128_3da(1);
}
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index b30c8de75e7..4a8eea58c4a 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -33,14 +33,14 @@ extern Toolbox *g_toolbox;
// word jumble/substitute puzzle
void FoolGame::jumbleRun() {
// 130:0004
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
this->sub_128_271a();
- this->jumbleSubPuzzleCount = this->puzzlesReadShort();
- debugC(5, kDebugLoading, "FoolGame::jumbleRun: racking %d subpuzzles", this->jumbleSubPuzzleCount);
+ _jumbleSubPuzzleCount = puzzlesReadShort();
+ debugC(5, kDebugLoading, "FoolGame::jumbleRun: racking %d subpuzzles", _jumbleSubPuzzleCount);
- for (this->jumbleCurrentSubPuzzle = 1; this->jumbleCurrentSubPuzzle <= this->jumbleSubPuzzleCount; this->jumbleCurrentSubPuzzle++) {
- this->var_i16_105a = this->puzzlesReadShort();
- debugC(5, kDebugLoading, "FoolGame::jumbleRun: subpuzzle %d", this->jumbleCurrentSubPuzzle);
+ for (_jumbleCurrentSubPuzzle = 1; _jumbleCurrentSubPuzzle <= _jumbleSubPuzzleCount; _jumbleCurrentSubPuzzle++) {
+ this->var_i16_105a = puzzlesReadShort();
+ debugC(5, kDebugLoading, "FoolGame::jumbleRun: subpuzzle %d", _jumbleCurrentSubPuzzle);
// load grid information block
// 0x0: grid width (squares)
// 0x1: grid height (squares)
@@ -58,7 +58,7 @@ void FoolGame::jumbleRun() {
// 0xd: grid square inner width (px)
if ((this->var_i16_105a & 0x1) == 1) {
for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[i] = puzzlesReadShort();
}
}
// 130:0066
@@ -69,7 +69,7 @@ void FoolGame::jumbleRun() {
do {
this->var_i16_484++;
g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
+ _screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
this->var_i16_68a + this->arr_i16_1eb8[13],
@@ -81,12 +81,12 @@ void FoolGame::jumbleRun() {
} while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
// 130:0156
if ((this->var_i16_105a & 0x2) == 2) {
- this->var_i16_105c = this->puzzlesReadShort();
- this->var_i16_105e = this->puzzlesReadShort();
- this->var_i16_1060 = this->puzzlesReadShort();
- this->var_i16_1062 = this->puzzlesReadShort();
- this->var_i16_1064 = this->puzzlesReadShort();
- this->var_i16_1066 = this->puzzlesReadShort();
+ this->var_i16_105c = puzzlesReadShort();
+ this->var_i16_105e = puzzlesReadShort();
+ this->var_i16_1060 = puzzlesReadShort();
+ this->var_i16_1062 = puzzlesReadShort();
+ this->var_i16_1064 = puzzlesReadShort();
+ this->var_i16_1066 = puzzlesReadShort();
if (this->var_i16_1066 > 0) {
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
@@ -94,11 +94,11 @@ void FoolGame::jumbleRun() {
}
}
// 130:01f0
- this->jumbleGameType = this->puzzlesReadShort();
- if (this->jumbleGameType == 6) {
+ _jumbleGameType = puzzlesReadShort();
+ if (_jumbleGameType == 6) {
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_2f38[i*32 + j] = this->puzzlesReadByte();
+ this->arr_i16_2f38[i*32 + j] = puzzlesReadByte();
this->arr_i16_3b38[i*32 + j] = 0;
}
}
@@ -112,21 +112,21 @@ void FoolGame::jumbleRun() {
}
}
// 130:0306
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
if (this->var_i16_103a > 0) {
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_1060]);
+ g_toolbox->PenPat(_patterns[this->var_i16_1060]);
this->var_i16_484 = 0;
for (int j = 1; j <= this->var_i16_103a; j++) {
- this->var_i16_106a = this->puzzlesReadShort();
+ this->var_i16_106a = puzzlesReadShort();
if (this->var_i16_106a == 0) {
this->var_i16_484 += 0x10;
} else {
// 130:035a
for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
- if (this->var_i16_106a & this->bitLUT[i]) {
- g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_484]);
+ if (this->var_i16_106a & _bitLUT[i]) {
+ g_toolbox->PaintRect(_screenGrid[this->var_i16_484]);
}
}
// 130:039e
@@ -142,46 +142,46 @@ void FoolGame::jumbleRun() {
this->var_i16_106c = kSrcOr;
}
// 130:03d4
- if (this->jumbleGameType == 4) {
+ if (_jumbleGameType == 4) {
this->fillRect(0x63, 0xae, 0x108, 0x153, 2);
}
// 130:03fe
- //if (this->var_i16_c04 <= this->jumbleCurrentSubPuzzle)
+ //if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle)
this->var_i16_106e = 0;
this->var_str_1070 = g_zbasic->str(168); // empty
this->var_str_1170 = g_zbasic->str(169); // empty
- this->var_i16_1270 = this->puzzlesReadShort();
+ this->var_i16_1270 = puzzlesReadShort();
for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
- this->var_str_1272 = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
this->var_i16_1372 = this->var_str_1272.size();
this->var_str_1170 += this->var_str_1272;
// 130:047e
- if (this->var_i16_c04 > this->jumbleCurrentSubPuzzle) {
+ if (_activePuzzleStatus > _jumbleCurrentSubPuzzle) {
this->var_str_1070 += this->var_str_1272;
} else {
// 130:04ac
- if ((this->var_i16_c04 == this->jumbleCurrentSubPuzzle) && !this->activePuzzleBuffer.empty()) { // was: str(170)
+ if ((_activePuzzleStatus == _jumbleCurrentSubPuzzle) && !_activePuzzleBuffer.empty()) { // was: str(170)
// 130:04dc
- this->var_str_1070 = this->activePuzzleBuffer;
+ this->var_str_1070 = _activePuzzleBuffer;
} else {
// 130:04f0
- if ((this->jumbleGameType == 1) || (this->jumbleGameType == 5)) {
+ if ((_jumbleGameType == 1) || (_jumbleGameType == 5)) {
// 130:0514
this->var_str_384 = this->var_str_1272;
this->sub_130_25d8();
}
// 130:0528
- if (this->jumbleGameType == 2) {
+ if (_jumbleGameType == 2) {
this->var_str_384 = this->var_str_1272;
this->sub_130_2790();
}
// 130:0548
- if ((this->jumbleGameType == 3) || (this->jumbleGameType == 6)) {
+ if ((_jumbleGameType == 3) || (_jumbleGameType == 6)) {
this->var_str_9f4 = g_zbasic->space(this->var_i16_1372);
}
// 130:0580
// word square
- if (this->jumbleGameType == 4) {
+ if (_jumbleGameType == 4) {
this->var_str_384 = g_zbasic->leftStr(this->var_str_1272, 4);
this->sub_130_25d8();
this->var_str_1374 = this->var_str_9f4;
@@ -197,7 +197,7 @@ void FoolGame::jumbleRun() {
// 130:0628
for (this->var_i16_484 = 1; this->var_i16_484 <= this->var_i16_1372; this->var_i16_484++) {
this->var_i16_106e++;
- this->arr_i16_3738[this->var_i16_106e] = this->puzzlesReadShort();
+ this->arr_i16_3738[this->var_i16_106e] = puzzlesReadShort();
this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
this->sub_130_20fe();
this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_103a;
@@ -205,7 +205,7 @@ void FoolGame::jumbleRun() {
this->sub_130_1c6c();
this->var_str_d12 = g_zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
// 130:06d4
- if ((this->activePuzzle <= 0x50) || (this->activePuzzle == 0x55)) {
+ if ((_activePuzzle <= 0x50) || (_activePuzzle == 0x55)) {
this->sub_130_1dcc();
} else {
// 130:0700
@@ -213,16 +213,16 @@ void FoolGame::jumbleRun() {
}
}
// 130:0716
- g_zbasic->indexRawSet(this->puzzlesReadString(), 1, this->var_i16_103a);
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, this->var_i16_103a);
}
// 130:073e
this->var_i16_1576 = this->var_str_1170.size();
- if ((this->activePuzzle == 0x51) || (this->activePuzzle == 0x54)) {
+ if ((_activePuzzle == 0x51) || (_activePuzzle == 0x54)) {
// 130:076e
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenSize(3, 3);
- if (this->activePuzzle == 0x51) {
+ if (_activePuzzle == 0x51) {
// 130:0794
g_toolbox->MoveTo(0xf3, 0x6f);
g_toolbox->LineTo(0xf3, 0xe4);
@@ -230,7 +230,7 @@ void FoolGame::jumbleRun() {
g_toolbox->LineTo(0x14c, 0xa9);
}
// 130:07bc
- if (this->activePuzzle == 0x54) {
+ if (_activePuzzle == 0x54) {
g_toolbox->MoveTo(0xe9, 0x81);
g_toolbox->LineTo(0x17d, 0x81);
g_toolbox->MoveTo(0x124, 0x47);
@@ -240,12 +240,12 @@ void FoolGame::jumbleRun() {
g_toolbox->PenNormal();
}
// 130:07f2
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
if (this->var_i16_103a > 0) {
for (this->var_i16_68a = 1; this->var_i16_68a <= this->var_i16_103a; this->var_i16_68a++) {
- this->var_i16_484 = this->puzzlesReadShort();
- this->var_i16_7e4 = this->puzzlesReadShort();
- this->var_str_1578 = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->var_i16_484 = puzzlesReadShort();
+ this->var_i16_7e4 = puzzlesReadShort();
+ this->var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
if (this->var_i16_7e4 > 0) {
g_toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
@@ -258,19 +258,19 @@ void FoolGame::jumbleRun() {
// 130:086a
this->var_i16_1678 = 0;
this->var_str_1578 = g_zbasic->str(171);
- if (this->jumbleCurrentSubPuzzle == this->jumbleSubPuzzleCount) {
+ if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
// all puzzles done, load the success animation list
- this->arr_i16_4338[0] = this->puzzlesReadShort();
+ this->arr_i16_4338[0] = puzzlesReadShort();
if (this->arr_i16_4338[0] > 0) {
// 130:08be
for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
- this->arr_i16_4338[i] = this->puzzlesReadShort();
+ this->arr_i16_4338[i] = puzzlesReadShort();
}
}
}
// 130:08fa
- if (this->var_i16_c04 <= this->jumbleCurrentSubPuzzle) {
- switch (this->jumbleGameType-1) {
+ if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle) {
+ switch (_jumbleGameType-1) {
case 0:
this->sub_130_d2e();
break;
@@ -290,12 +290,12 @@ void FoolGame::jumbleRun() {
default:
break;
}
- if ((this->stateFlags & kStateReturn) != 0) {
+ if ((_stateFlags & kStateReturn) != 0) {
this->sub_130_c66();
- this->jumbleCurrentSubPuzzle = this->jumbleSubPuzzleCount;
+ _jumbleCurrentSubPuzzle = _jumbleSubPuzzleCount;
} else {
// 130:0956
- if (this->activePuzzle <= 0x50) {
+ if (_activePuzzle <= 0x50) {
if ((this->var_i16_1678 > 0) && (this->var_str_1578 != g_zbasic->str(172))) {
// 130:098c
this->var_str_1578 = g_zbasic->str(173);
@@ -308,18 +308,18 @@ void FoolGame::jumbleRun() {
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->var_i16_1576; i++) {
g_toolbox->Delay((0xc - (this->var_i16_1576 / 0xa))*60/1000);
- g_toolbox->InvertRect(this->arr_rect_1f38[ABS(this->arr_i16_3738[i])]);
+ g_toolbox->InvertRect(_screenGrid[ABS(this->arr_i16_3738[i])]);
}
}
- if (this->jumbleCurrentSubPuzzle == this->jumbleSubPuzzleCount) {
- this->var_i16_d0c = 1;
+ if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
+ _activePuzzleSolved = true;
}
}
}
}
// 130:0a5c
}
- if ((this->stateFlags & kStateReturn) != 0) {
+ if ((_stateFlags & kStateReturn) != 0) {
// JMP 0x2962
return;
}
@@ -329,9 +329,9 @@ void FoolGame::jumbleRun() {
this->sub_128_6186();
this->sub_128_61ec();
// 130:0a90
- if (this->activePuzzle != 0x55) {
+ if (_activePuzzle != 0x55) {
// 130:0b68
- while ((this->var_ev_46.modifiers & kModMouseButtonUp) != 0) {
+ while ((_event.modifiers & kModMouseButtonUp) != 0) {
// 130:0aa0
if (this->arr_i16_4338[0] > 0) {
// strobe the squares in the victory list
@@ -346,12 +346,12 @@ void FoolGame::jumbleRun() {
do {
int ticks = (int)g_toolbox->TickCount();
this->var_i16_68a++;
- g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[this->var_i16_68a]]);
+ g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[this->var_i16_68a]]);
// mask was originally 0
this->getNextEvent(-1);
int delta = MAX(0, this->var_i16_7e4*60/1000 - ((int)g_toolbox->TickCount() - ticks));
g_toolbox->Delay(delta);
- } while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0)));
+ } while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((_event.modifiers & kModMouseButtonUp) == 0)));
} else {
// 130:0b62
// mask was originally 0
@@ -362,15 +362,15 @@ void FoolGame::jumbleRun() {
} else {
// 130:0b7e
this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
this->var_i16_bfc = 0;
do {
for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
g_toolbox->Delay(0xd*60/1000);
- g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
this->getNextEvent(0);
- if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
- this->var_i16_d0c = 1;
+ if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ _activePuzzleSolved = true;
}
}
// 130:0c14
@@ -379,7 +379,7 @@ void FoolGame::jumbleRun() {
} else {
this->var_i16_bfc = 0;
}
- } while (!((this->var_i16_d0c == 1) && (this->var_i16_bfc == 1)));
+ } while (!((_activePuzzleSolved) && (this->var_i16_bfc == 1)));
}
// 130:0c4e
this->sub_130_c66();
@@ -389,30 +389,30 @@ void FoolGame::sub_130_c56() {
// 130:0c56
this->sub_130_c66();
this->saveGame();
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
}
void FoolGame::sub_130_c66() {
// 130:0c66
- if (this->var_i16_d0c != 0) {
- this->var_i16_c04 = 0x64;
- this->activePuzzleBuffer.clear(); // was: str(174)
- this->var_i16_d0c = 0;
+ if (_activePuzzleSolved) {
+ _activePuzzleStatus = 0x64;
+ _activePuzzleBuffer.clear(); // was: str(174)
+ _activePuzzleSolved = false;
} else {
// 130:0c98
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = this->jumbleCurrentSubPuzzle;
- if ((this->jumbleGameType == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
- this->activePuzzleBuffer = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = _jumbleCurrentSubPuzzle;
+ if ((_jumbleGameType == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
+ _activePuzzleBuffer = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
} else {
// 130:0cfe
- this->activePuzzleBuffer = this->var_str_1070;
+ _activePuzzleBuffer = this->var_str_1070;
}
// 130:0d0e
} else {
// 130:0d12
- this->var_i16_c04 = 0x65;
- this->activePuzzleBuffer.clear(); // was: str(176)
+ _activePuzzleStatus = 0x65;
+ _activePuzzleBuffer.clear(); // was: str(176)
}
}
// 130:0d2c
@@ -423,13 +423,13 @@ void FoolGame::sub_130_d2e() {
// 130:0d2e
this->sub_130_1426();
this->sub_128_61ec();
- this->stateFlags = kStateNull;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ _stateFlags = kStateNull;
+ while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -475,19 +475,19 @@ void FoolGame::sub_130_d90() {
this->var_i16_106e = 1;
this->sub_130_1c1a();
this->sub_128_61ec();
- this->stateFlags = kStateNull;
- this->keyLastPressed = 0;
+ _stateFlags = kStateNull;
+ _keyLastPressed = 0;
// 130:0fa0
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:0fa4
this->getNextEvent(-1);
- if (this->keyLastPressed != 0) {
+ if (_keyLastPressed != 0) {
this->sub_130_15da();
}
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -503,18 +503,18 @@ void FoolGame::sub_130_1004() {
}
this->sub_130_20d2();
this->sub_128_61ec();
- this->stateFlags = kStateNull;
- this->keyLastPressed = 0;
+ _stateFlags = kStateNull;
+ _keyLastPressed = 0;
// 130:1042
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->getNextEvent(-1);
- if (this->keyLastPressed != 0) {
+ if (_keyLastPressed != 0) {
this->sub_130_15da();
}
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -525,7 +525,7 @@ void FoolGame::sub_130_10a6() {
// 130:10a6
// word square
this->sub_130_1426();
- if (this->jumbleGameType != 5) {
+ if (_jumbleGameType != 5) {
this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 1, 1) + g_zbasic->midStr(this->var_str_1170, 4, 1) + g_zbasic->midStr(this->var_str_1170, 7, 1);
this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 2, 1) + g_zbasic->midStr(this->var_str_1170, 5, 1) + g_zbasic->midStr(this->var_str_1170, 8, 1);
this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 3, 1) + g_zbasic->midStr(this->var_str_1170, 6, 1) + g_zbasic->midStr(this->var_str_1170, 9, 1);
@@ -536,14 +536,14 @@ void FoolGame::sub_130_10a6() {
}
// 130:1212
this->sub_128_61ec();
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
// 130:121c
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
+ while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->sub_130_1476();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -559,17 +559,17 @@ void FoolGame::sub_130_1282() {
this->sub_130_20d2();
this->sub_128_61ec();
this->var_i16_7b2 = 0;
- this->stateFlags = kStateNull;
- this->keyLastPressed = 0;
+ _stateFlags = kStateNull;
+ _keyLastPressed = 0;
g_toolbox->InitCursor();
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:12cc
this->getNextEvent(-1);
- if (this->keyLastPressed != 0) {
+ if (_keyLastPressed != 0) {
this->sub_130_15da();
}
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->sub_130_1476();
}
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
@@ -582,14 +582,14 @@ void FoolGame::sub_130_1282() {
if (this->var_i16_187c < 0x11) {
g_toolbox->InitCursor();
} else {
- g_toolbox->SetCursor(this->arr_curs_4d88[this->var_i16_187c]);
+ g_toolbox->SetCursor(_cursors[this->var_i16_187c]);
}
// 130:13dc
this->var_i16_7b2 = this->var_i16_187c;
}
// 130:13e2
this->var_i16_7b2 = this->var_i16_187c;
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
@@ -615,7 +615,7 @@ void FoolGame::sub_130_1476() {
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
// 130:14fa
- if (this->var_ev_46.where.x > 0x14) {
+ if (_event.where.x > 0x14) {
this->sub_128_50e(0xf, 0x42, 0x1);
}
return;
@@ -626,12 +626,12 @@ void FoolGame::sub_130_1476() {
return;
}
// 130:1558
- if ((this->jumbleGameType == 6) && (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] >= 0x11)) {
+ if ((_jumbleGameType == 6) && (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] >= 0x11)) {
this->sub_128_50e(0xf, 0x42, 0x1);
return;
}
// 130:15b0
- switch (this->jumbleGameType - 1) {
+ switch (_jumbleGameType - 1) {
case 0:
this->sub_130_172c();
break;
@@ -645,54 +645,54 @@ void FoolGame::sub_130_1476() {
this->sub_130_172c();
break;
default:
- warning("sub_130_1476: unhandled case %d", this->jumbleGameType-1);
+ warning("sub_130_1476: unhandled case %d", _jumbleGameType-1);
break;
}
}
void FoolGame::sub_130_15da() {
// 130:15da
- if ((this->keyLastPressed == 3) || (this->keyLastPressed == 0xd)) {
+ if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
this->sub_130_1c52();
this->sub_130_2078();
this->sub_130_20d2();
- this->keyLastPressed = 0;
+ _keyLastPressed = 0;
return;
}
- if (this->keyLastPressed == 8) {
+ if (_keyLastPressed == 8) {
this->sub_130_1c52();
this->sub_130_2094();
this->sub_130_20d2();
- this->keyLastPressed = 0;
+ _keyLastPressed = 0;
return;
}
// 130:1632
- if ((this->keyLastPressed >= 0x61) && (this->keyLastPressed <= 0x7a)) {
- this->keyLastPressed -= 0x20;
+ if ((_keyLastPressed >= 0x61) && (_keyLastPressed <= 0x7a)) {
+ _keyLastPressed -= 0x20;
}
- if (this->jumbleGameType != 3) {
- if ((this->keyLastPressed < 0x41) || (this->keyLastPressed > 0x5a)) {
+ if (_jumbleGameType != 3) {
+ if ((_keyLastPressed < 0x41) || (_keyLastPressed > 0x5a)) {
return;
}
} else {
// 130:1690
this->var_i16_1882 = 0;
- if ((this->keyLastPressed < 0x41) || (this->keyLastPressed > 0x5a)) {
+ if ((_keyLastPressed < 0x41) || (_keyLastPressed > 0x5a)) {
this->var_i16_1882 = 1;
}
- if (this->keyLastPressed == 0x20) {
+ if (_keyLastPressed == 0x20) {
this->var_i16_1882 = 0;
}
if (this->var_i16_1882 != 0)
return;
}
// 130:16dc
- this->var_str_d12 = g_zbasic->chr(this->keyLastPressed);
+ this->var_str_d12 = g_zbasic->chr(_keyLastPressed);
// 130:16f2
- this->keyLastPressed = 0;
- if (this->jumbleGameType != 2) {
+ _keyLastPressed = 0;
+ if (_jumbleGameType != 2) {
// 130:1706
- if (!((this->jumbleGameType == 3) || (this->jumbleGameType == 6))) {
+ if (!((_jumbleGameType == 3) || (_jumbleGameType == 6))) {
this->sub_130_172c();
} else {
this->sub_130_201a();
@@ -705,7 +705,7 @@ void FoolGame::sub_130_15da() {
void FoolGame::sub_130_172c() {
// 130:172c
// word square, disallow clicking the centre tile
- if ((this->jumbleGameType == 4) && (this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] == 5)) {
+ if ((_jumbleGameType == 4) && (this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] == 5)) {
this->sub_130_19da();
return;
}
@@ -715,7 +715,7 @@ void FoolGame::sub_130_172c() {
this->sub_130_19ac();
this->var_i16_187e = ABS(this->arr_i16_3738[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]]);
this->var_i16_1884 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_187e]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
this->sub_130_2178();
return;
}
@@ -726,7 +726,7 @@ void FoolGame::sub_130_172c() {
return;
}
// 130:189a
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1880]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_1880]);
this->var_i16_1886 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
this->var_str_1374 = g_zbasic->midStr(this->var_str_1070, this->var_i16_1884, 1);
this->var_str_1474 = g_zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
@@ -749,7 +749,7 @@ void FoolGame::sub_130_172c() {
void FoolGame::sub_130_19ac() {
// 130:19ac
if (this->var_i16_187e > 0) {
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_187e]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
}
this->var_i16_187e = 0;
this->var_i16_1880 = 0;
@@ -761,7 +761,7 @@ void FoolGame::sub_130_19da() {
this->sub_130_19ac();
this->sub_128_50e(0x19, 0x64, 0);
for (int i = 0; i <= 0x19; i++) {
- g_toolbox->InvertRect(this->arr_rect_1f38[13]);
+ g_toolbox->InvertRect(_screenGrid[13]);
this->sub_128_3da(1);
}
}
@@ -818,30 +818,30 @@ void FoolGame::sub_130_1a16() {
void FoolGame::sub_130_1c1a() {
// 130:1c1a
this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
}
void FoolGame::sub_130_1c52() {
// 130:1c52
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
}
void FoolGame::sub_130_1c6c() {
g_toolbox->PenNormal();
- g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_1574], this->arr_pat_58f4[this->var_i16_105e]);
- g_toolbox->PenPat(this->arr_pat_58f4[this->var_i16_105c]);
- g_toolbox->FrameRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->FillRect(_screenGrid[this->var_i16_1574], _patterns[this->var_i16_105e]);
+ g_toolbox->PenPat(_patterns[this->var_i16_105c]);
+ g_toolbox->FrameRect(_screenGrid[this->var_i16_1574]);
if (this->arr_i16_3738[this->var_i16_106e] >= 0) {
return;
}
// 130:1ce2
- if ((this->activePuzzle > 0x50) && (this->activePuzzle < 0x55)) {
+ if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
return;
}
- this->arr_i16_4758[0] = this->arr_rect_1f38[this->var_i16_1574].top + 2;
- this->arr_i16_4758[1] = this->arr_rect_1f38[this->var_i16_1574].left + 2;
- this->arr_i16_4758[2] = this->arr_rect_1f38[this->var_i16_1574].bottom - 2;
- this->arr_i16_4758[3] = this->arr_rect_1f38[this->var_i16_1574].right - 2;
+ this->arr_i16_4758[0] = _screenGrid[this->var_i16_1574].top + 2;
+ this->arr_i16_4758[1] = _screenGrid[this->var_i16_1574].left + 2;
+ this->arr_i16_4758[2] = _screenGrid[this->var_i16_1574].bottom - 2;
+ this->arr_i16_4758[3] = _screenGrid[this->var_i16_1574].right - 2;
Common::Rect temp;
temp.top = this->arr_i16_4758[0];
temp.left = this->arr_i16_4758[1];
@@ -854,8 +854,8 @@ void FoolGame::sub_130_1dcc() {
// 130:1dcc
g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2],
- this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ _screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
+ _screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
g_toolbox->DrawString(this->var_str_d12);
}
@@ -863,34 +863,34 @@ void FoolGame::sub_130_1dcc() {
void FoolGame::sub_130_1e5c() {
// 130:1e5c
g_toolbox->PenNormal();
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
this->sub_130_1e76();
}
void FoolGame::sub_130_1e76() {
// 130:1e76
- this->arr_i16_4758[0] = this->arr_rect_1f38[this->var_i16_1574].top + 3;
- this->arr_i16_4758[1] = this->arr_rect_1f38[this->var_i16_1574].left + 3;
- this->arr_i16_4758[2] = this->arr_rect_1f38[this->var_i16_1574].bottom - 3;
- this->arr_i16_4758[3] = this->arr_rect_1f38[this->var_i16_1574].right - 3;
+ this->arr_i16_4758[0] = _screenGrid[this->var_i16_1574].top + 3;
+ this->arr_i16_4758[1] = _screenGrid[this->var_i16_1574].left + 3;
+ this->arr_i16_4758[2] = _screenGrid[this->var_i16_1574].bottom - 3;
+ this->arr_i16_4758[3] = _screenGrid[this->var_i16_1574].right - 3;
Common::Rect temp;
temp.top = this->arr_i16_4758[0];
temp.left = this->arr_i16_4758[1];
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[this->var_i16_105e]);
+ g_toolbox->FillRect(temp, _patterns[this->var_i16_105e]);
g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
// 130:1f70
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2],
- this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ _screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
+ _screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
g_toolbox->DrawString(this->var_str_d12);
if (this->arr_i16_3738[this->var_i16_106e] < 0)
return;
// 130:1ff4
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenMode(kPatBic);
g_toolbox->PaintRect(temp);
}
@@ -898,7 +898,7 @@ void FoolGame::sub_130_1e76() {
void FoolGame::sub_130_201a() {
// 130:201a
g_zbasic->midStrSet(this->var_str_1070, this->var_i16_106e, 1, this->var_str_d12);
- if ((this->activePuzzle > 0x50) && (this->activePuzzle < 0x55)) {
+ if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
this->sub_130_1e5c();
} else {
// 130:2066
@@ -951,7 +951,7 @@ void FoolGame::sub_130_20fe() {
void FoolGame::sub_130_2178() {
// 130:2178
- if ((this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == this->var_i16_1678) || (this->jumbleGameType == 2))
+ if ((this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == this->var_i16_1678) || (_jumbleGameType == 2))
return;
this->var_i16_1678 = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
@@ -964,19 +964,19 @@ void FoolGame::sub_130_2178() {
void FoolGame::sub_130_2226() {
// 130:2226
- if (this->activePuzzle == 0x14) {
+ if (_activePuzzle == 0x14) {
this->sub_130_23cc();
return;
}
- if (this->activePuzzle == 0x3c) {
+ if (_activePuzzle == 0x3c) {
this->sub_130_22ee();
return;
}
- if (this->activePuzzle == 0x35) {
+ if (_activePuzzle == 0x35) {
this->sub_130_24aa();
return;
}
- if (this->activePuzzle == 0x55) {
+ if (_activePuzzle == 0x55) {
this->sub_130_2548();
return;
}
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index e796fc7f333..eebd810f79f 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -32,44 +32,44 @@ extern Toolbox *g_toolbox;
// justice - lights on
void FoolGame::justiceRun() {
// 142:0852
- if (this->var_i16_c04 < 0x63) {
+ if (_activePuzzleStatus < 0x63) {
this->sub_142_9be();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
this->justiceStoreState();
return;
}
// 142:0874
this->justiceResetGrid();
- if (this->puzzleCompletionStatus[0x34] > 3) {
- this->var_i16_c04 = 0x64;
+ if (_puzzleCompletionStatus[0x34] > 3) {
+ _activePuzzleStatus = 0x64;
return;
} else {
// 142:08a2
- this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
- this->var_i16_c04 = 0x63;
+ this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
+ _activePuzzleStatus = 0x63;
this->var_str_384 = g_zbasic->str(345); // behold the 3rd key of thoth
this->sub_128_178a(0x3f, 1);
}
}
// 142:0906
- if (this->var_i16_c04 == 0x63) {
+ if (_activePuzzleStatus == 0x63) {
g_zbasic->menu(8, 0, 1, g_zbasic->str(346)); // the 3rd key of thoth
g_zbasic->menu(8, 1, 1, g_zbasic->str(347)); // return to scroll
this->thothKey3rd();
- if (this->var_i16_d0c == 1) {
- this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
+ if (_activePuzzleSolved) {
+ this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
}
}
// 142:098a
- if (this->var_i16_c04 >= 0x64) {
+ if (_activePuzzleStatus >= 0x64) {
this->sub_142_9be();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
this->justiceStoreState();
return;
}
// 142:09b0
this->justiceResetGrid();
- this->var_i16_c04 = 0x65;
+ _activePuzzleStatus = 0x65;
}
// 142:09ba
return;
@@ -79,10 +79,10 @@ void FoolGame::sub_142_9be() {
// 142:09be
this->sub_128_271a();
for (int16 i = 1; i <= 0x19; i++) {
- g_zbasic->indexRawSet(this->puzzlesReadString(), 1, i);
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
}
// 142:09ea
- if (this->puzzleCompletionStatus[0x34] < 4) {
+ if (_puzzleCompletionStatus[0x34] < 4) {
g_zbasic->menu(8, 3, 1, g_zbasic->str(348)); // a secret hides here
g_zbasic->menu(8, 4, 1, g_zbasic->str(349)); // if twenty-five appear
} else {
@@ -97,7 +97,7 @@ void FoolGame::sub_142_9be() {
for (int16 j = 0x8c; j <= 0x185; j += 0x32) {
this->var_i16_484++;
g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
+ _screenGrid[this->var_i16_484],
j,
i,
j + 0x32,
@@ -108,17 +108,17 @@ void FoolGame::sub_142_9be() {
// 142:0adc
this->justiceZoom();
this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
- if (this->activePuzzleBuffer.empty()) { // was: str(352)
- this->activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
+ if (_activePuzzleBuffer.empty()) { // was: str(352)
+ _activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
this->var_i16_233e = 1;
} else {
// 142:0b4c
- this->var_i16_233e = g_zbasic->castInt(g_zbasic->leftStr(this->activePuzzleBuffer, 1));
- this->activePuzzleBuffer = g_zbasic->rightStr(this->activePuzzleBuffer, 0x19);
+ this->var_i16_233e = g_zbasic->castInt(g_zbasic->leftStr(_activePuzzleBuffer, 1));
+ _activePuzzleBuffer = g_zbasic->rightStr(_activePuzzleBuffer, 0x19);
}
// 142:0b7c
for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_484, 1));
+ this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_484, 1));
if ((this->var_i16_103a & 2) == 0) {
g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
} else {
@@ -133,18 +133,18 @@ void FoolGame::sub_142_9be() {
}
}
// 142:0c32
- this->var_i16_d0c = 0;
- this->stateFlags = 0;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ _activePuzzleSolved = false;
+ _stateFlags = 0;
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
// 142:0c42
- while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
+ while ((_stateFlags == 0) && (!_activePuzzleSolved)) {
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->justiceOnClick();
}
}
// 142:0c76
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->justiceStoreState();
this->saveGame();
}
@@ -154,8 +154,8 @@ void FoolGame::sub_142_9be() {
void FoolGame::justiceOnClick() {
// 142:0cb2
- this->var_i16_68a = (this->var_ev_46.where.x - 0x5a) / 0x32;
- this->var_i16_68c = (this->var_ev_46.where.y + 0xe) / 0x32;
+ this->var_i16_68a = (_event.where.x - 0x5a) / 0x32;
+ this->var_i16_68c = (_event.where.y + 0xe) / 0x32;
if ((this->var_i16_68a < 0) || (this->var_i16_68c < 0) || (this->var_i16_68a > 5) || (this->var_i16_68c > 5)) {
return;
}
@@ -165,7 +165,7 @@ void FoolGame::justiceOnClick() {
return;
}
// 142:0d56
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_103a], 0x1e, 0x1e);
+ g_toolbox->InvertRoundRect(_screenGrid[this->var_i16_103a], 0x1e, 0x1e);
if (g_zbasic->index(1, this->var_i16_103a + 0x19) == g_zbasic->str(356)) { // \xa5
g_zbasic->indexSet(g_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
}
@@ -209,10 +209,10 @@ void FoolGame::justiceOnClick() {
}
}
// 142:0f20
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
for (int16 i = 1; i <= 0x19; i++) {
if (this->arr_i16_3738[i] == 0) {
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
}
}
this->sub_128_6186();
@@ -220,7 +220,7 @@ void FoolGame::justiceOnClick() {
void FoolGame::justiceZoom() {
// 142:0f58
- this->sub_128_962(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
+ this->zoomRect(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
}
void FoolGame::justiceDrawBlock() {
@@ -228,15 +228,15 @@ void FoolGame::justiceDrawBlock() {
this->arr_i16_3738[this->var_i16_484] = 1;
this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
g_toolbox->PenNormal();
- g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e, this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x1e, 0x1e);
+ g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
+ g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
g_zbasic->text(0, 0xc, 0, kSrcOr);
this->var_str_384 = g_zbasic->index(1, this->var_i16_484 + 0x19);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
// 142:1056
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
- this->arr_rect_1f38[this->var_i16_484].top + 0x1e
+ _screenGrid[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
+ _screenGrid[this->var_i16_484].top + 0x1e
);
g_toolbox->DrawString(this->var_str_384);
}
@@ -245,19 +245,19 @@ void FoolGame::justiceRemoveBlock() {
// 142:10bc
this->arr_i16_3738[this->var_i16_484] = 0;
this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_484], this->arr_pat_58f4[g_zbasic->rndInt(0x4d)+3]);
+ g_toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[g_zbasic->rndInt(0x4d)+3]);
}
void FoolGame::justiceStoreState() {
// 142:111e
this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
- this->activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
+ _activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
for (int16 i = 1; i <= 0x19; i++) {
this->var_i16_484 = this->arr_i16_3738[i];
if (g_zbasic->index(1, i + 0x19) == g_zbasic->str(360)) { // ~
this->var_i16_484 |= 2;
this->var_str_384 = g_zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
- this->activePuzzleBuffer += this->var_str_384;
+ _activePuzzleBuffer += this->var_str_384;
}
}
// 142:11fc
@@ -266,13 +266,13 @@ void FoolGame::justiceStoreState() {
void FoolGame::justiceResetGrid() {
// 142:11fe
this->sub_128_3da(0x28);
- this->activePuzzleBuffer.clear();
+ _activePuzzleBuffer.clear();
for (int16 i = 1; i <= 0x19; i++) {
this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(this->arr_rect_1f38[i], this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(_screenGrid[i], _patterns[2]);
}
// 142:126e
- this->sub_128_962(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
}
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 5810ed5d135..1dda3e06d47 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -43,7 +43,7 @@ void FoolGame::mazeRun() {
do {
var_i16_484++;
g_toolbox->SetRect(
- arr_rect_1f38[var_i16_484],
+ _screenGrid[var_i16_484],
var_i16_68a,
var_i16_68c,
var_i16_68a + arr_i16_1eb8[13],
@@ -81,14 +81,14 @@ void FoolGame::mazeRun() {
sub_128_bde(1, arr_i16_1eb8[17], 0, 1, 0, 1);
Common::Rect playArea;
- playArea.top = arr_rect_1f38[1].top + 3;
- playArea.left = arr_rect_1f38[1].left + 3;
- playArea.bottom = arr_rect_1f38[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].bottom - 3;
- playArea.right = arr_rect_1f38[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].right - 3;
- g_toolbox->FillRect(playArea, arr_pat_58f4[2]);
+ playArea.top = _screenGrid[1].top + 3;
+ playArea.left = _screenGrid[1].left + 3;
+ playArea.bottom = _screenGrid[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].bottom - 3;
+ playArea.right = _screenGrid[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].right - 3;
+ g_toolbox->FillRect(playArea, _patterns[2]);
g_toolbox->PenNormal();
g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
// 136:042c
var_i16_1ac4 = arr_i16_1eb8[17];
var_i16_1574 = 0;
@@ -112,16 +112,16 @@ void FoolGame::mazeRun() {
}
if ((arr_i16_3738[var_i16_1574 - 1] & 4) == 0) {
Common::Rect temp;
- temp.top = arr_rect_1f38[var_i16_1574].top + 3;
- temp.left = arr_rect_1f38[var_i16_1574].left - 3;
- temp.bottom = arr_rect_1f38[var_i16_1574].bottom - 3;
+ temp.top = _screenGrid[var_i16_1574].top + 3;
+ temp.left = _screenGrid[var_i16_1574].left - 3;
+ temp.bottom = _screenGrid[var_i16_1574].bottom - 3;
temp.right = SCREEN_WIDTH;
- g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ g_toolbox->FillRect(temp, _patterns[2]);
}
// 136:05d0
}
// 136:05ec
- if (activePuzzleBuffer.empty()) { // was: str(223)
+ if (_activePuzzleBuffer.empty()) { // was: str(223)
for (int16 j = 1; j <= arr_i16_1eb8[23]; j++) {
var_str_1ac8 = g_zbasic->indexRaw(1, j);
var_i16_1bc8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, 3, 2));
@@ -133,8 +133,8 @@ void FoolGame::mazeRun() {
// 136:0664
}
// 136:067e
- mazePlayerX = arr_i16_1eb8[15];
- mazePlayerY = arr_i16_1eb8[16];
+ _mazePlayerX = arr_i16_1eb8[15];
+ _mazePlayerY = arr_i16_1eb8[16];
var_i16_1bd0 = 0;
} else {
// 136:06b0
@@ -144,37 +144,37 @@ void FoolGame::mazeRun() {
var_str_1578.clear(); // was str(224)
mazeSetupMenu();
sub_136_ade();
- stateFlags = kStateNull;
+ _stateFlags = kStateNull;
sub_128_4da(1);
- if (mazePlayerX == 0x19) {
- var_i16_d0c = 1;
+ if (_mazePlayerX == 0x19) {
+ _activePuzzleSolved = true;
} else {
// 136:06f0
- var_i16_d0c = 0;
+ _activePuzzleSolved = false;
}
// 136:06f6
// JMP 0x75c
- while (((stateFlags & kStateReturn) == 0) && (var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
// 136:06fa
- while ((stateFlags == kStateNull) && (var_i16_d0c == 0)) {
+ while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
// 136:06fe
getNextEvent(-1);
- if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & kModMouseButtonUp) == 0) {
mazeOnClick();
}
- if (mazePlayerX == 0x19) {
- var_i16_d0c = 1;
+ if (_mazePlayerX == 0x19) {
+ _activePuzzleSolved = true;
}
}
// 136:074a
- if (stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
mazeStoreState();
saveGame();
}
// 136:075c
}
// 136:0786
- if (var_i16_d0c != 0) {
+ if (_activePuzzleSolved != 0) {
sub_136_3a70();
}
mazeStoreState();
@@ -183,54 +183,54 @@ void FoolGame::mazeRun() {
void FoolGame::mazeOnClick() {
// 136:079e
sub_128_2be(var_i16_68a, var_i16_68c);
- if ((var_i16_68a == mazePlayerX) && (var_i16_68c == mazePlayerY)) {
+ if ((var_i16_68a == _mazePlayerX) && (var_i16_68c == _mazePlayerY)) {
return;
}
// 136:07e2
- if (mazePlayerY > var_i16_68c) {
- mazePlayerDirection = 2;
+ if (_mazePlayerY > var_i16_68c) {
+ _mazePlayerDirection = 2;
}
- if (mazePlayerX > var_i16_68a) {
- mazePlayerDirection = 1;
+ if (_mazePlayerX > var_i16_68a) {
+ _mazePlayerDirection = 1;
}
- if (mazePlayerY < var_i16_68c) {
- mazePlayerDirection = 4;
+ if (_mazePlayerY < var_i16_68c) {
+ _mazePlayerDirection = 4;
}
- if (mazePlayerX < var_i16_68a) {
- mazePlayerDirection = 3;
+ if (_mazePlayerX < var_i16_68a) {
+ _mazePlayerDirection = 3;
}
- if (var_i16_1bd4 != mazePlayerDirection) {
- if ((mazePlayerDirection == 1) && ((arr_i16_3738[var_i16_1574] & 1) == 1)) {
+ if (var_i16_1bd4 != _mazePlayerDirection) {
+ if ((_mazePlayerDirection == 1) && ((arr_i16_3738[var_i16_1574] & 1) == 1)) {
mazeFlashWall();
return;
}
// 136:088a
- if ((mazePlayerDirection == 2) && ((arr_i16_3738[var_i16_1574] & 2) == 2)) {
+ if ((_mazePlayerDirection == 2) && ((arr_i16_3738[var_i16_1574] & 2) == 2)) {
mazeFlashWall();
return;
}
- if ((mazePlayerDirection == 3) && ((arr_i16_3738[var_i16_1574] & 4) == 4)) {
+ if ((_mazePlayerDirection == 3) && ((arr_i16_3738[var_i16_1574] & 4) == 4)) {
mazeFlashWall();
return;
}
- if ((mazePlayerDirection == 4) && ((arr_i16_3738[var_i16_1574] & 8) == 8)) {
+ if ((_mazePlayerDirection == 4) && ((arr_i16_3738[var_i16_1574] & 8) == 8)) {
mazeFlashWall();
return;
}
// 136:0944
- if (var_i16_1bd6 == mazePlayerDirection) {
+ if (var_i16_1bd6 == _mazePlayerDirection) {
return;
}
}
// 136:0956
- if (mazePlayerDirection == 1)
- mazePlayerX--;
- if (mazePlayerDirection == 2)
- mazePlayerY--;
- if (mazePlayerDirection == 3)
- mazePlayerX++;
- if (mazePlayerDirection == 4)
- mazePlayerY++;
+ if (_mazePlayerDirection == 1)
+ _mazePlayerX--;
+ if (_mazePlayerDirection == 2)
+ _mazePlayerY--;
+ if (_mazePlayerDirection == 3)
+ _mazePlayerX++;
+ if (_mazePlayerDirection == 4)
+ _mazePlayerY++;
mazeMovePlayer();
}
@@ -240,7 +240,7 @@ void FoolGame::mazeFlashWall() {
g_toolbox->PenSize(5, 5);
if (arr_i16_1eb8[21] == 0) {
g_toolbox->PenMode(kPatXor);
- switch (mazePlayerDirection-1) {
+ switch (_mazePlayerDirection-1) {
case 0:
sub_136_2a7c();
break;
@@ -260,10 +260,10 @@ void FoolGame::mazeFlashWall() {
g_toolbox->Delay(0);
} else {
// 136:09de
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
}
// 136:0a00
- switch (mazePlayerDirection-1) {
+ switch (_mazePlayerDirection-1) {
case 0:
sub_136_2a7c();
break;
@@ -287,7 +287,7 @@ void FoolGame::mazeMovePlayer() {
// 136:0a22
if (var_i16_1bd6 != 0) {
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[2]);
+ g_toolbox->PenPat(_patterns[2]);
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd6 - 1) {
case 0:
@@ -310,7 +310,7 @@ void FoolGame::mazeMovePlayer() {
// 136:0a66
if (var_i16_1bd4 != 0) {
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd4 - 1) {
case 0:
@@ -382,8 +382,8 @@ void FoolGame::mazeHotspot() {
var_i16_1bd0 = var_i16_1574;
return;
}
- var_str_1ac8 = g_zbasic->indexRaw(1, arr_i16_3b38[mazePlayerX*32 + mazePlayerY]);
- debugC(5, kDebugLoading, "mazeHotspot: processing hotspot at (%d, %d)", mazePlayerX, mazePlayerY);
+ var_str_1ac8 = g_zbasic->indexRaw(1, arr_i16_3b38[_mazePlayerX*32 + _mazePlayerY]);
+ debugC(5, kDebugLoading, "mazeHotspot: processing hotspot at (%d, %d)", _mazePlayerX, _mazePlayerY);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)var_str_1ac8.c_str(), var_str_1ac8.size());
}
@@ -567,8 +567,8 @@ void FoolGame::mazeWanderingWinds() {
var_i16_1dec = 2;
mazeMovementTrail();
// 136:1108
- mazePlayerX = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
- mazePlayerY = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
+ _mazePlayerX = ((var_i16_1de8 - 1) % arr_i16_1eb8[0]) + 1;
+ _mazePlayerY = ((var_i16_1de8 - 1) / arr_i16_1eb8[0]) + 1;
mazeDrawPlayer();
}
@@ -617,8 +617,8 @@ void FoolGame::sub_136_115a() {
// 136:12e4
g_zbasic->text(0xfb, 0xc, 0, var_src_1dee);
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1dea].left + arr_i16_1eb8[2],
- arr_rect_1f38[var_i16_1dea].top + arr_i16_1eb8[3]
+ _screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
+ _screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
);
var_str_384 = g_zbasic->chr(var_i16_106e);
g_toolbox->DrawString(var_str_384);
@@ -711,7 +711,7 @@ void FoolGame::mazeHiddenDoorOpen() {
var_i16_1bd8 = var_i16_1574;
var_i16_1bd4 = g_zbasic->decodeInt(var_str_1ce2);
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[2]);
+ g_toolbox->PenPat(_patterns[2]);
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd4-1) {
case 0:
@@ -737,7 +737,7 @@ void FoolGame::mazeHiddenDoorShut() {
var_i16_1bd8 = var_i16_1574;
var_i16_1bd6 = g_zbasic->decodeInt(var_str_1ce2);
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd6-1) {
case 0:
@@ -835,28 +835,28 @@ void FoolGame::sub_136_19d2() {
var_i16_484 = 0xb;
sub_136_24ae();
// 136:1a7a
- var_i16_1df8 = arr_rect_1f38[var_i16_1dea].left + ((arr_rect_1f38[var_i16_1dea].right - arr_rect_1f38[var_i16_1dea].left) / 2) - 3;
- var_i16_1dfa = arr_rect_1f38[var_i16_1dea].top + ((arr_rect_1f38[var_i16_1dea].bottom - arr_rect_1f38[var_i16_1dea].top) / 2) - 3;
+ var_i16_1df8 = _screenGrid[var_i16_1dea].left + ((_screenGrid[var_i16_1dea].right - _screenGrid[var_i16_1dea].left) / 2) - 3;
+ var_i16_1dfa = _screenGrid[var_i16_1dea].top + ((_screenGrid[var_i16_1dea].bottom - _screenGrid[var_i16_1dea].top) / 2) - 3;
// 136:1b56
- var_i16_1dfc = arr_rect_1f38[var_i16_1de8].left + ((arr_rect_1f38[var_i16_1de8].right - arr_rect_1f38[var_i16_1de8].left) / 2) - 3;
- var_i16_1dfe = arr_rect_1f38[var_i16_1de8].top + ((arr_rect_1f38[var_i16_1de8].bottom - arr_rect_1f38[var_i16_1de8].top) / 2) - 3;
+ var_i16_1dfc = _screenGrid[var_i16_1de8].left + ((_screenGrid[var_i16_1de8].right - _screenGrid[var_i16_1de8].left) / 2) - 3;
+ var_i16_1dfe = _screenGrid[var_i16_1de8].top + ((_screenGrid[var_i16_1de8].bottom - _screenGrid[var_i16_1de8].top) / 2) - 3;
// 136:1c32
for (int16 i = 0; i <= var_i16_1de4; i++) {
if (var_i16_1dec == 1) {
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
}
// 136:1c5a
if (var_i16_1dec == 2) {
- g_toolbox->InvertOval(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->InvertOval(_screenGrid[var_i16_1dea]);
}
g_toolbox->MoveTo(var_i16_1df8, var_i16_1dfa);
g_toolbox->LineTo(var_i16_1dfc, var_i16_1dfe);
if (var_i16_1df6 == 1) {
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1de8]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1de8]);
}
// 136:1cb2
if (var_i16_1df6 == 2) {
- g_toolbox->InvertOval(arr_rect_1f38[var_i16_1de8]);
+ g_toolbox->InvertOval(_screenGrid[var_i16_1de8]);
}
if (var_i16_1df4 > 0) {
@@ -878,15 +878,15 @@ void FoolGame::sub_136_1cf4() {
sub_136_2538();
}
if (var_i16_1dec == 1) {
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
g_toolbox->Delay(0);
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
g_toolbox->Delay(0);
} else {
// 136:1d98
- g_toolbox->InvertOval(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->InvertOval(_screenGrid[var_i16_1dea]);
g_toolbox->Delay(0);
- g_toolbox->InvertOval(arr_rect_1f38[var_i16_1dea]);
+ g_toolbox->InvertOval(_screenGrid[var_i16_1dea]);
g_toolbox->Delay(0);
}
// 136:1dc8
@@ -925,16 +925,16 @@ void FoolGame::sub_136_1e4c() {
arr_i16_4758[1] = 0;
arr_i16_4758[2] = SCREEN_HEIGHT;
arr_i16_4758[3] = SCREEN_WIDTH;
- arr_i16_4758[4 + 0] = arr_rect_1f38[var_i16_1dea].top;
- arr_i16_4758[4 + 1] = arr_rect_1f38[var_i16_1dea].left;
- arr_i16_4758[4 + 2] = arr_rect_1f38[var_i16_1dea].bottom;
- arr_i16_4758[4 + 3] = arr_rect_1f38[var_i16_1dea].right;
+ arr_i16_4758[4 + 0] = _screenGrid[var_i16_1dea].top;
+ arr_i16_4758[4 + 1] = _screenGrid[var_i16_1dea].left;
+ arr_i16_4758[4 + 2] = _screenGrid[var_i16_1dea].bottom;
+ arr_i16_4758[4 + 3] = _screenGrid[var_i16_1dea].right;
} else {
// 136:1f4a
- arr_i16_4758[0] = arr_rect_1f38[var_i16_1dea].top + 1;
- arr_i16_4758[1] = arr_rect_1f38[var_i16_1dea].left + 1;
- arr_i16_4758[2] = arr_rect_1f38[var_i16_1dea].bottom + 1;
- arr_i16_4758[3] = arr_rect_1f38[var_i16_1dea].right + 1;
+ arr_i16_4758[0] = _screenGrid[var_i16_1dea].top + 1;
+ arr_i16_4758[1] = _screenGrid[var_i16_1dea].left + 1;
+ arr_i16_4758[2] = _screenGrid[var_i16_1dea].bottom + 1;
+ arr_i16_4758[3] = _screenGrid[var_i16_1dea].right + 1;
// 136:1f96
arr_i16_4758[4] = 0x14;
arr_i16_4758[5] = 0;
@@ -1002,17 +1002,17 @@ void FoolGame::sub_136_2200() {
void FoolGame::mazeMovementTrail() {
// 136:2208
// unrolled loop
- arr_bcd_5dbc[4 + 0] = (arr_rect_1f38[var_i16_1de8].top - arr_rect_1f38[var_i16_1dea].top) / 25.0f;
- arr_bcd_5dbc[4 + 1] = (arr_rect_1f38[var_i16_1de8].left - arr_rect_1f38[var_i16_1dea].left) / 25.0f;
- arr_bcd_5dbc[4 + 2] = (arr_rect_1f38[var_i16_1de8].bottom - arr_rect_1f38[var_i16_1dea].bottom) / 25.0f;
- arr_bcd_5dbc[4 + 3] = (arr_rect_1f38[var_i16_1de8].right - arr_rect_1f38[var_i16_1dea].right) / 25.0f;
+ arr_bcd_5dbc[4 + 0] = (_screenGrid[var_i16_1de8].top - _screenGrid[var_i16_1dea].top) / 25.0f;
+ arr_bcd_5dbc[4 + 1] = (_screenGrid[var_i16_1de8].left - _screenGrid[var_i16_1dea].left) / 25.0f;
+ arr_bcd_5dbc[4 + 2] = (_screenGrid[var_i16_1de8].bottom - _screenGrid[var_i16_1dea].bottom) / 25.0f;
+ arr_bcd_5dbc[4 + 3] = (_screenGrid[var_i16_1de8].right - _screenGrid[var_i16_1dea].right) / 25.0f;
// 136:229a
for (int16 k = 0; k <= 1; k++) {
// 136:22a0
- arr_bcd_5dbc[0] = arr_rect_1f38[var_i16_1dea].top + 4.0f;
- arr_bcd_5dbc[1] = arr_rect_1f38[var_i16_1dea].left + 4.0f;
- arr_bcd_5dbc[2] = arr_rect_1f38[var_i16_1dea].bottom - 4.0f;
- arr_bcd_5dbc[3] = arr_rect_1f38[var_i16_1dea].right - 4.0f;
+ arr_bcd_5dbc[0] = _screenGrid[var_i16_1dea].top + 4.0f;
+ arr_bcd_5dbc[1] = _screenGrid[var_i16_1dea].left + 4.0f;
+ arr_bcd_5dbc[2] = _screenGrid[var_i16_1dea].bottom - 4.0f;
+ arr_bcd_5dbc[3] = _screenGrid[var_i16_1dea].right - 4.0f;
for (int16 j = 1; j <= 0x19; j++) {
var_i32_692 = g_toolbox->TickCount();
for (int16 i = 0; i <= 3; i++) {
@@ -1080,11 +1080,11 @@ void FoolGame::sub_136_2582() {
void FoolGame::mazeDrawPlayer() {
// 136:2664
- var_i16_1574 = arr_i16_2f38[mazePlayerX*32 + mazePlayerY];
- arr_i16_1eb8[24] = arr_rect_1f38[var_i16_1574].top + 4;
- arr_i16_1eb8[25] = arr_rect_1f38[var_i16_1574].left + 4;
- arr_i16_1eb8[26] = arr_rect_1f38[var_i16_1574].bottom - 4;
- arr_i16_1eb8[27] = arr_rect_1f38[var_i16_1574].right - 4;
+ var_i16_1574 = arr_i16_2f38[_mazePlayerX*32 + _mazePlayerY];
+ arr_i16_1eb8[24] = _screenGrid[var_i16_1574].top + 4;
+ arr_i16_1eb8[25] = _screenGrid[var_i16_1574].left + 4;
+ arr_i16_1eb8[26] = _screenGrid[var_i16_1574].bottom - 4;
+ arr_i16_1eb8[27] = _screenGrid[var_i16_1574].right - 4;
// 136:273e
Common::Rect temp;
temp.top = arr_i16_1eb8[24];
@@ -1100,8 +1100,8 @@ void FoolGame::mazeSetupMenu() {
g_toolbox->DisposeMenu(this->var_menu_bf8);
// 136:274e
- g_zbasic->menu(8, 0, 1, arr_str_195e8[activePuzzle]);
- if (activePuzzle < 0x50) {
+ g_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
+ if (_activePuzzle < 0x50) {
g_zbasic->menu(8, 1, 1, g_zbasic->str(243)); // return to scroll
} else {
// 136:279a
@@ -1112,7 +1112,7 @@ void FoolGame::mazeSetupMenu() {
g_zbasic->menu(8, 3, 1, g_zbasic->str(246)); // to escape from the maze
g_zbasic->menu(8, 4, 1, g_zbasic->str(247)); // use the mouse to maneuver
g_zbasic->menu(8, 5, 1, g_zbasic->str(248)); // the white dot to the exit
- if (activePuzzle == 0x57) {
+ if (_activePuzzle == 0x57) {
// 136:281c
var_i16_103a = 7;
var_i16_68a = 1;
@@ -1155,12 +1155,12 @@ void FoolGame::sub_136_2a7c() {
// 136:2a7c
arr_i16_3738[var_i16_1574] |= 0x100;
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1574].left - 2,
- arr_rect_1f38[var_i16_1574].top - 2
+ _screenGrid[var_i16_1574].left - 2,
+ _screenGrid[var_i16_1574].top - 2
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1574].left - 2,
- arr_rect_1f38[var_i16_1574].bottom - 3
+ _screenGrid[var_i16_1574].left - 2,
+ _screenGrid[var_i16_1574].bottom - 3
);
}
@@ -1168,12 +1168,12 @@ void FoolGame::sub_136_2b30() {
// 136:2b30
arr_i16_3738[var_i16_1574] |= 0x200;
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1574].left - 2,
- arr_rect_1f38[var_i16_1574].top - 2
+ _screenGrid[var_i16_1574].left - 2,
+ _screenGrid[var_i16_1574].top - 2
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1574].right - 3,
- arr_rect_1f38[var_i16_1574].top - 2
+ _screenGrid[var_i16_1574].right - 3,
+ _screenGrid[var_i16_1574].top - 2
);
}
@@ -1181,12 +1181,12 @@ void FoolGame::sub_136_2be2() {
// 136:2be2
arr_i16_3738[var_i16_1574] |= 0x400;
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1574].right - 3,
- arr_rect_1f38[var_i16_1574].top - 2
+ _screenGrid[var_i16_1574].right - 3,
+ _screenGrid[var_i16_1574].top - 2
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1574].right - 3,
- arr_rect_1f38[var_i16_1574].bottom - 3
+ _screenGrid[var_i16_1574].right - 3,
+ _screenGrid[var_i16_1574].bottom - 3
);
}
@@ -1194,79 +1194,79 @@ void FoolGame::sub_136_2c96() {
// 136:2c96
arr_i16_3738[var_i16_1574] |= 0x800;
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1574].left - 2,
- arr_rect_1f38[var_i16_1574].bottom - 3
+ _screenGrid[var_i16_1574].left - 2,
+ _screenGrid[var_i16_1574].bottom - 3
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1574].right - 3,
- arr_rect_1f38[var_i16_1574].bottom - 3
+ _screenGrid[var_i16_1574].right - 3,
+ _screenGrid[var_i16_1574].bottom - 3
);
}
void FoolGame::sub_136_2d4c() {
// 136:2d4c
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1bd8].left - 2,
- arr_rect_1f38[var_i16_1bd8].top + 3
+ _screenGrid[var_i16_1bd8].left - 2,
+ _screenGrid[var_i16_1bd8].top + 3
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1bd8].left - 2,
- arr_rect_1f38[var_i16_1bd8].bottom - 8
+ _screenGrid[var_i16_1bd8].left - 2,
+ _screenGrid[var_i16_1bd8].bottom - 8
);
}
void FoolGame::sub_136_2dd0() {
// 136:2dd0
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1bd8].left + 3,
- arr_rect_1f38[var_i16_1bd8].top - 2
+ _screenGrid[var_i16_1bd8].left + 3,
+ _screenGrid[var_i16_1bd8].top - 2
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1bd8].right - 8,
- arr_rect_1f38[var_i16_1bd8].top - 2
+ _screenGrid[var_i16_1bd8].right - 8,
+ _screenGrid[var_i16_1bd8].top - 2
);
}
void FoolGame::sub_136_2e52() {
// 136:2e52
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1bd8].right - 3,
- arr_rect_1f38[var_i16_1bd8].top + 3
+ _screenGrid[var_i16_1bd8].right - 3,
+ _screenGrid[var_i16_1bd8].top + 3
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1bd8].right - 3,
- arr_rect_1f38[var_i16_1bd8].bottom - 8
+ _screenGrid[var_i16_1bd8].right - 3,
+ _screenGrid[var_i16_1bd8].bottom - 8
);
}
void FoolGame::sub_136_2ed6() {
// 136:2ed6
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1bd8].left + 3,
- arr_rect_1f38[var_i16_1bd8].bottom - 3
+ _screenGrid[var_i16_1bd8].left + 3,
+ _screenGrid[var_i16_1bd8].bottom - 3
);
g_toolbox->LineTo(
- arr_rect_1f38[var_i16_1bd8].right - 8,
- arr_rect_1f38[var_i16_1bd8].bottom - 3
+ _screenGrid[var_i16_1bd8].right - 8,
+ _screenGrid[var_i16_1bd8].bottom - 3
);
}
void FoolGame::mazeStoreState() {
// 136:2f5c
// for the endgame maze, there's specific code to not save the puzzle state
- if (!((activePuzzle != 0x57) && (var_i16_d0c == 0))) {
- activePuzzleBuffer.clear(); // was: str(258)
+ if (!((_activePuzzle != 0x57) && (!_activePuzzleSolved))) {
+ _activePuzzleBuffer.clear(); // was: str(258)
return;
}
- activePuzzleBuffer = g_zbasic->encodeInt(mazePlayerX) +
- g_zbasic->encodeInt(mazePlayerY) +
+ _activePuzzleBuffer = g_zbasic->encodeInt(_mazePlayerX) +
+ g_zbasic->encodeInt(_mazePlayerY) +
g_zbasic->encodeInt(var_i16_1bd0) +
g_zbasic->encodeInt(var_i16_1bd6) +
g_zbasic->encodeInt(var_i16_1bd4) +
g_zbasic->encodeInt(var_i16_1bd8);
// 136:300a
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- activePuzzleBuffer += g_zbasic->encodeInt(arr_i16_5cbc[i]);
+ _activePuzzleBuffer += g_zbasic->encodeInt(arr_i16_5cbc[i]);
}
// 136:3054
var_i16_484 = 0;
@@ -1283,7 +1283,7 @@ void FoolGame::mazeStoreState() {
}
}
// 136:3128
- activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1de6) + buffer;
+ _activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1de6) + buffer;
var_i16_484 = 0;
var_i16_1de6 = 0;
@@ -1333,12 +1333,12 @@ void FoolGame::mazeStoreState() {
}
// 136:33e8
debugC(5, kDebugLoading, "mazeStoreState: added mask %04x", var_i16_1f08);
- activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
+ _activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
}
void FoolGame::sub_136_3408() {
// 136:3408
- var_i16_1f08 |= bitLUT[var_i16_1de6];
+ var_i16_1f08 |= _bitLUT[var_i16_1de6];
}
void FoolGame::sub_136_342a() {
@@ -1346,7 +1346,7 @@ void FoolGame::sub_136_342a() {
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
debugC(5, kDebugLoading, "sub_136_342a: added mask %04x", var_i16_1f08);
- activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
+ _activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
var_i16_1f08 = 0;
var_i16_1de6 = 0;
}
@@ -1355,16 +1355,16 @@ void FoolGame::sub_136_342a() {
void FoolGame::mazeLoadState() {
// 136:3466
- mazePlayerX = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 1, 2));
- mazePlayerY = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 3, 2));
- var_i16_1bd0 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 5, 2));
- var_i16_1bd6 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 7, 2));
- var_i16_1bd4 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 9, 2));
- var_i16_1bd8 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, 0xb, 2));
+ _mazePlayerX = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 1, 2));
+ _mazePlayerY = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 3, 2));
+ var_i16_1bd0 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 5, 2));
+ var_i16_1bd6 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 7, 2));
+ var_i16_1bd4 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 9, 2));
+ var_i16_1bd8 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 0xb, 2));
if (var_i16_1bd6 > 0) {
// 136:3500
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd6 - 1) {
case 0:
@@ -1387,7 +1387,7 @@ void FoolGame::mazeLoadState() {
// 136:354e
if (var_i16_1bd4 > 0) {
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[2]);
+ g_toolbox->PenPat(_patterns[2]);
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd4 - 1) {
case 0:
@@ -1410,23 +1410,23 @@ void FoolGame::mazeLoadState() {
// 136:3592
var_i16_1f0a = 0xd;
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
}
// 136:35ec
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
if (var_i16_1de4 > 0) {
g_zbasic->text(0xfb, 0xc, 0, kSrcBic);
for (int16 i = 1; i <= var_i16_1de4; i++) {
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
- var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
// 136:366e
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1dea].left + arr_i16_1eb8[2],
- arr_rect_1f38[var_i16_1dea].top + arr_i16_1eb8[3]
+ _screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
+ _screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
);
g_zbasic->unk_8();
// the one place that used ZBasic's print API,
@@ -1440,11 +1440,11 @@ void FoolGame::mazeLoadState() {
// 136:3710
// draw walls that are added by the visibility mask
g_toolbox->PenNormal();
- g_toolbox->PenPat(arr_pat_58f4[arr_i16_1eb8[17]]);
+ g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
var_i16_1574 = 0;
var_i16_1de6 = 0;
- var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
// 136:3766
debugC(5, kDebugLoading, "mazeLoadState: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
@@ -1453,28 +1453,28 @@ void FoolGame::mazeLoadState() {
var_i16_1574++;
if (arr_i16_1eb8[21] != 0) {
if (((arr_i16_3738[var_i16_1574] & 1) == 1) && ((arr_i16_3738[var_i16_1574] & 0x10) == 0)) {
- if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
sub_136_2a7c();
}
sub_136_3a30();
}
// 136:380c
if (((arr_i16_3738[var_i16_1574] & 2) == 2) && ((arr_i16_3738[var_i16_1574] & 0x20) == 0)) {
- if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
sub_136_2b30();
}
sub_136_3a30();
}
// 136:3886
if (((arr_i16_3738[var_i16_1574] & 4) == 4) && ((arr_i16_3738[var_i16_1574] & 0x40) == 0)) {
- if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
sub_136_2be2();
}
sub_136_3a30();
}
// 136:3900
if (((arr_i16_3738[var_i16_1574] & 8) == 8) && ((arr_i16_3738[var_i16_1574] & 0x80) == 0)) {
- if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
sub_136_2c96();
}
sub_136_3a30();
@@ -1482,7 +1482,7 @@ void FoolGame::mazeLoadState() {
}
// 136:397c
if (arr_i16_3b38[i*32 + j] > 0) {
- if ((var_i16_1f08 & bitLUT[var_i16_1de6]) != 0) {
+ if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
arr_i16_3738[var_i16_1574] |= 0x1000;
}
// 136:39f2
@@ -1500,7 +1500,7 @@ void FoolGame::sub_136_3a30() {
var_i16_1de6 = 0;
}
if (var_i16_1de6 == 0) {
- var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
debugC(5, kDebugLoading, "sub_136_3a80: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
}
@@ -1509,14 +1509,14 @@ void FoolGame::sub_136_3a30() {
void FoolGame::sub_136_3a70() {
// 136:3a70
- if (activePuzzle == 0x57) {
- var_i16_c04 = 0x64;
+ if (_activePuzzle == 0x57) {
+ _activePuzzleStatus = 0x64;
sub_128_2664();
sub_128_61c2();
} else {
// 136:3a8e
- if (var_i16_c04 < 0x64) {
- var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
}
var_i16_484 = 1 + (arr_i16_1eb8[24] - 0x14) / 0x23;
var_i16_7e4 = 1 + (arr_i16_1eb8[25]) / 0x23;
@@ -1526,7 +1526,7 @@ void FoolGame::sub_136_3a70() {
for (int16 j = 0; j <= 1; j++) {
if (j == 1) {
g_toolbox->PenMode(kNotPatOr);
- g_toolbox->PenPat(arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
}
// 136:3b32
for (int16 i = 4; i <= 7; i++) {
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 01b42238587..59f5f1438ce 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -34,8 +34,8 @@ extern Toolbox *g_toolbox;
// sun's map metapuzzle
void FoolGame::metapuzzleRun() {
// 138:0004
- if (sunMapRestored == 1) {
- sunMapRestored = 666;
+ if (_sunMapRestored == 1) {
+ _sunMapRestored = 666;
var_i32_7c8 = g_zbasic->mem(-1);
} else {
// 138:0024
@@ -48,7 +48,7 @@ void FoolGame::metapuzzleRun() {
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
var_i16_484++;
- g_zbasic->picture(i, j, arr_i32_1912c[var_i16_484]);
+ g_zbasic->picture(i, j, _sunMapTilePic[var_i16_484]);
}
}
}
@@ -56,50 +56,50 @@ void FoolGame::metapuzzleRun() {
g_toolbox->PenNormal();
g_toolbox->InitCursor();
copyScreen(0, arr_bmp_b3ec);
- if (activePuzzle == 0) {
+ if (_activePuzzle == 0) {
metapuzzleSetupMenu();
}
// 138:0116
- stateFlags = 0;
- keyLastPressed = 0;
- while ((stateFlags & kStateReturn) == 0) {
+ _stateFlags = kStateNull;
+ _keyLastPressed = 0;
+ while ((_stateFlags & kStateReturn) == 0) {
// 138:0126
getNextEvent(-1);
- if (var_ev_46.what == 1) {
+ if (_event.what == 1) {
metapuzzleOnClick();
}
- if ((var_ev_46.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == (kModLOptionKeyDown | kModMouseButtonUp)) {
+ if ((_event.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == (kModLOptionKeyDown | kModMouseButtonUp)) {
metapuzzleOnOption();
}
- if ((var_ev_46.modifiers & (kModLShiftKeyDown | kModMouseButtonUp)) == (kModLShiftKeyDown | kModMouseButtonUp)) {
+ if ((_event.modifiers & (kModLShiftKeyDown | kModMouseButtonUp)) == (kModLShiftKeyDown | kModMouseButtonUp)) {
metapuzzleOnShift();
}
- if (activePuzzle != 0) {
+ if (_activePuzzle != 0) {
sub_138_21e();
}
- if (stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
saveGame();
}
- if (keyLastPressed == 0x20) {
+ if (_keyLastPressed == 0x20) {
setStateBits(kStateReturn);
}
}
// JMP 0xe7c
// 138:0e7c
var_i16_c00 = 0;
- if ((stateFlags & 0x800) == 0) {
+ if ((_stateFlags & kStateMetapuzzleComplete) == 0) {
var_menu_bf8 = g_toolbox->GetMHandle(8);
g_toolbox->DeleteMenu(8);
g_toolbox->DisposeMenu(var_menu_bf8);
g_toolbox->DrawMenuBar();
copyScreen(1, arr_bmp_5dfc);
- if ((stateFlags & 0x38) == 0) {
+ if ((_stateFlags & (kStateNewGame | kStateOpenGame | kStateQuit)) == 0) {
if ((var_i16_7ce & 1) != 0) {
var_i16_7ce ^= 1;
}
// 138:0ef8
- activePuzzle = 0;
- if ((stateFlags & 0x40) == 0) {
+ _activePuzzle = 0;
+ if ((_stateFlags & kStateChapterSelect) == 0) {
storyRenderPage();
}
}
@@ -112,26 +112,26 @@ void FoolGame::metapuzzleRun() {
void FoolGame::metapuzzleOnClick() {
// 138:01b4
var_i16_7e4 = 0;
- activePuzzle = 0;
+ _activePuzzle = 0;
for (int16 i = 1; i <= 0xc; i++) {
Common::Rect temp;
temp.top = arr_i16_4d20[i*4];
temp.left = arr_i16_4d20[i*4+1];
temp.bottom = arr_i16_4d20[i*4+2];
temp.right = arr_i16_4d20[i*4+3];
- if (g_toolbox->PtInRect(var_ev_46.where, temp) != 0) {
+ if (g_toolbox->PtInRect(_event.where, temp) != 0) {
var_i16_7e4 = i;
}
// 138:01f8
}
if (var_i16_7e4 > 0) {
- activePuzzle = var_i16_7e4 + 0x50;
+ _activePuzzle = var_i16_7e4 + 0x50;
}
}
void FoolGame::sub_138_21e() {
// 138:021e
- int16 offset = activePuzzle - 0x50;
+ int16 offset = _activePuzzle - 0x50;
Common::Rect temp;
temp.top = arr_i16_4d20[offset*4];
temp.left = arr_i16_4d20[offset*4+1];
@@ -142,36 +142,36 @@ void FoolGame::sub_138_21e() {
sub_128_3fb6();
sub_128_26f6();
sub_128_61ec();
- if (activePuzzle == 0x55) {
+ if (_activePuzzle == 0x55) {
fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x47);
}
// 138:0272
- if ((activePuzzle >= 0x51) && (activePuzzle <= 0x55)) {
+ if ((_activePuzzle >= 0x51) && (_activePuzzle <= 0x55)) {
jumbleRun();
}
- if (activePuzzle == 0x56) {
+ if (_activePuzzle == 0x56) {
straightPathRun();
}
- if (activePuzzle == 0x57) {
- sub_128_962(arr_i16_4d20[28], arr_i16_4d20[0x1c+1], arr_i16_4d20[0x1c+2], arr_i16_4d20[0x1c+3], 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
+ if (_activePuzzle == 0x57) {
+ zoomRect(arr_i16_4d20[28], arr_i16_4d20[0x1c+1], arr_i16_4d20[0x1c+2], arr_i16_4d20[0x1c+3], 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
mazeRun();
}
// 138:0334
- if ((activePuzzle >= 0x58) && (activePuzzle <= 0x5b)) {
+ if ((_activePuzzle >= 0x58) && (_activePuzzle <= 0x5b)) {
metapuzzleSecretCode();
}
- if (activePuzzle == 0x5c) {
+ if (_activePuzzle == 0x5c) {
metapuzzleWheel();
}
puzzleSaveContext();
// any progress is good progress
autoSaveGame();
- if ((activePuzzle == 0x55) && (puzzleCompletionStatus[0x55] == 0x64)) {
- stateFlags = 0x821;
+ if ((_activePuzzle == 0x55) && (_puzzleCompletionStatus[0x55] == 0x64)) {
+ _stateFlags = kStateMetapuzzleComplete | kStateQuit | kStateReturn;
}
- if (stateFlags <= 1) {
- stateFlags = 0;
- activePuzzle = 0;
+ if (_stateFlags <= 1) {
+ _stateFlags = kStateNull;
+ _activePuzzle = 0;
var_i16_c00 = 0;
g_toolbox->PenNormal();
copyScreen(1, arr_bmp_b3ec);
@@ -187,7 +187,7 @@ void FoolGame::metapuzzleSetupMenu() {
g_zbasic->menu(8, 1, 1, g_zbasic->str(261)); // return to scroll
g_zbasic->menu(8, 2, 0, g_zbasic->str(262)); // -
var_i16_484 = 2;
- for (int16 i = arr_i16_1b10[0x30]; i <= arr_i16_1b10[0x30+1]; i++) {
+ for (int16 i = _puzzleMenuInstructions[0x30]; i <= _puzzleMenuInstructions[0x30+1]; i++) {
var_i16_484++;
var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(263); // ' '
g_zbasic->menu(8, var_i16_484, 1, var_str_384);
@@ -197,9 +197,9 @@ void FoolGame::metapuzzleSetupMenu() {
void FoolGame::metapuzzleWheel() {
// 138:049e
for (int16 i = 1; i <= 2; i++) {
- sub_128_962(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
+ zoomRect(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
}
- g_zbasic->picture(6, 0x6d, metapuzzleWheelPic);
+ g_zbasic->picture(6, 0x6d, _metapuzzleWheelPic);
sub_128_2664();
sub_128_61c2();
}
@@ -208,31 +208,31 @@ void FoolGame::metapuzzleSecretCode() {
// 138:0550
var_i16_c00 = 1;
for (int16 i = 1; i <= 2; i++) {
- var_i16_68c = activePuzzle - 0x50;
- sub_128_962(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
+ var_i16_68c = _activePuzzle - 0x50;
+ zoomRect(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
}
- if (activePuzzle == 0x58) {
+ if (_activePuzzle == 0x58) {
var_str_1170 = g_zbasic->str(264); // treasure name
- metapuzzleSecretCodeSpaceOffset = 8;
- metapuzzleSecretCodeCipher = g_zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
+ _metapuzzleSecretCodeSpaceOffset = 8;
+ _metapuzzleSecretCodeCipher = g_zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
}
// 138:0650
- if (activePuzzle == 0x59) {
+ if (_activePuzzle == 0x59) {
var_str_1170 = g_zbasic->str(266); // treasure name
- metapuzzleSecretCodeSpaceOffset = 0;
- metapuzzleSecretCodeCipher = g_zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
+ _metapuzzleSecretCodeSpaceOffset = 0;
+ _metapuzzleSecretCodeCipher = g_zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
}
// 138:068a
- if (activePuzzle == 0x5a) {
+ if (_activePuzzle == 0x5a) {
var_str_1170 = g_zbasic->str(268); // treasure name
- metapuzzleSecretCodeSpaceOffset = 5;
- metapuzzleSecretCodeCipher = g_zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
+ _metapuzzleSecretCodeSpaceOffset = 5;
+ _metapuzzleSecretCodeCipher = g_zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
}
// 138:06c4
- if (activePuzzle == 0x5b) {
+ if (_activePuzzle == 0x5b) {
var_str_1170 = g_zbasic->str(270); // treasure name
- metapuzzleSecretCodeSpaceOffset = 9;
- metapuzzleSecretCodeCipher = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
+ _metapuzzleSecretCodeSpaceOffset = 9;
+ _metapuzzleSecretCodeCipher = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
}
// 138:06fe
arr_i16_1eb8[0] = 0x122;
@@ -244,33 +244,33 @@ void FoolGame::metapuzzleSecretCode() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->FillRect(temp, arr_pat_58f4[2]);
- if (activePuzzleBuffer.empty()) { // was: str(272)
+ g_toolbox->FillRect(temp, _patterns[2]);
+ if (_activePuzzleBuffer.empty()) { // was: str(272)
metapuzzleSecretCodeReset();
} else {
// 138:0778
- var_str_1272 = activePuzzleBuffer;
- metapuzzleSecretCodeCount = 0;
+ var_str_1272 = _activePuzzleBuffer;
+ _metapuzzleSecretCodeCount = 0;
var_i16_68a = 1;
for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
if (g_zbasic->midStr(var_str_1272, i, 1) != g_zbasic->str(273)) {
- metapuzzleSecretCodeCount++;
+ _metapuzzleSecretCodeCount++;
}
// 138:07c2
sub_138_9c4();
}
}
// 138:07d8
- while ((stateFlags & kStateReturn) == 0) {
+ while ((_stateFlags & kStateReturn) == 0) {
// 138:07dc
- stateFlags = kStateNull;
- keyLastPressed = 0;
- while (stateFlags == kStateNull) {
+ _stateFlags = kStateNull;
+ _keyLastPressed = 0;
+ while (_stateFlags == kStateNull) {
// 138:07ec
getNextEvent(-1);
- if (keyLastPressed > 0) {
+ if (_keyLastPressed > 0) {
metapuzzleSecretCodeDrawText();
- keyLastPressed = 0;
+ _keyLastPressed = 0;
}
if (var_str_1272 == var_str_1170) {
sub_138_a90();
@@ -278,11 +278,11 @@ void FoolGame::metapuzzleSecretCode() {
// 138:081c
}
// 138:0822
- if (stateFlags == kStateUndo) {
+ if (_stateFlags == kStateUndo) {
metapuzzleSecretCodeReset();
}
- activePuzzleBuffer = var_str_1272;
- if (stateFlags == kStateSaveGame) {
+ _activePuzzleBuffer = var_str_1272;
+ if (_stateFlags == kStateSaveGame) {
saveGame();
}
}
@@ -290,25 +290,25 @@ void FoolGame::metapuzzleSecretCode() {
void FoolGame::metapuzzleSecretCodeDrawText() {
// 138:0864
- if ((keyLastPressed == 3) || (keyLastPressed == 0xd)) {
+ if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
sub_138_a06();
return;
}
- if ((keyLastPressed >= 0x61) && (keyLastPressed <= 0x7a)) {
- keyLastPressed -= 0x20;
+ if ((_keyLastPressed >= 0x61) && (_keyLastPressed <= 0x7a)) {
+ _keyLastPressed -= 0x20;
}
- if (!((keyLastPressed >= 0x41) && (keyLastPressed <= 0x5a))) {
+ if (!((_keyLastPressed >= 0x41) && (_keyLastPressed <= 0x5a))) {
return;
}
g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
- metapuzzleSecretCodeCount++;
- if (metapuzzleSecretCodeSpaceOffset == metapuzzleSecretCodeCount) {
- if (g_zbasic->leftStr(var_str_1170, metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
+ _metapuzzleSecretCodeCount++;
+ if (_metapuzzleSecretCodeSpaceOffset == _metapuzzleSecretCodeCount) {
+ if (g_zbasic->leftStr(var_str_1170, _metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
var_str_1272 += g_zbasic->str(274); // ' '
}
}
// 138:0946
- var_str_d12 = g_zbasic->midStr(metapuzzleSecretCodeCipher, keyLastPressed - 0x40, 1);
+ var_str_d12 = g_zbasic->midStr(_metapuzzleSecretCodeCipher, _keyLastPressed - 0x40, 1);
var_str_1272 += var_str_d12;
var_i16_484 = g_toolbox->StringWidth(var_str_1272);
var_i16_7e4 = g_toolbox->StringWidth(var_str_1170);
@@ -327,7 +327,7 @@ void FoolGame::sub_138_9c4() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ g_toolbox->FillRect(temp, _patterns[2]);
var_i16_7a2 = 0x146;
sub_128_918(var_str_1272);
}
@@ -335,7 +335,7 @@ void FoolGame::sub_138_9c4() {
void FoolGame::sub_138_a06() {
// 138:0a06
sub_128_50e(0x19, 0x64, 1);
- if (metapuzzleSecretCodeCount == 0)
+ if (_metapuzzleSecretCodeCount == 0)
return;
metapuzzleSecretCodeReset();
}
@@ -347,19 +347,19 @@ void FoolGame::metapuzzleSecretCodeReset() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->FillRect(temp, arr_pat_58f4[2]);
+ g_toolbox->FillRect(temp, _patterns[2]);
g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
var_i16_7a2 = 0x140;
var_str_384 = g_zbasic->str(275); // if you know which is which, enter the letters you wish to switch
sub_128_918(var_str_384);
var_str_1272.clear(); // was: str(276)
- metapuzzleSecretCodeCount = 0;
+ _metapuzzleSecretCodeCount = 0;
}
void FoolGame::sub_138_a90() {
// 138:0a90
- stateFlags = 1;
- activePuzzleBuffer = var_str_1272;
+ _stateFlags = kStateReturn;
+ _activePuzzleBuffer = var_str_1272;
sub_128_2664();
sub_128_6186();
sub_128_d34(arr_i16_1eb8[0], arr_i16_1eb8[1], arr_i16_1eb8[2], arr_i16_1eb8[3], 0xc8);
@@ -383,19 +383,19 @@ void FoolGame::metapuzzleOnOption() {
void FoolGame::metapuzzleOnShift() {
// 138:0b6a
- if (!((var_ev_46.where.x >= 0x6e) && (var_ev_46.where.y >= 0x1a) && (var_ev_46.where.x <= 0x1a8) && (var_ev_46.where.y <= SCREEN_HEIGHT))) {
+ if (!((_event.where.x >= 0x6e) && (_event.where.y >= 0x1a) && (_event.where.x <= 0x1a8) && (_event.where.y <= SCREEN_HEIGHT))) {
return;
}
var_i16_200e = 0;
- while ((var_ev_46.modifiers & kModLShiftKeyDown) != 0) {
+ while ((_event.modifiers & kModLShiftKeyDown) != 0) {
getNextEvent(-1); // was: 0
- if ((var_ev_46.where.x >= 0x6e) && (var_ev_46.where.y >= 0x1a) && (var_ev_46.where.x <= 0x1a8) && (var_ev_46.where.y <= SCREEN_HEIGHT)) {
+ if ((_event.where.x >= 0x6e) && (_event.where.y >= 0x1a) && (_event.where.x <= 0x1a8) && (_event.where.y <= SCREEN_HEIGHT)) {
// 138:0c04
- var_i16_68a = (var_ev_46.where.x - 0x6e)/0x23;
- var_i16_68c = (var_ev_46.where.y - 0x1a)/0x23;
+ var_i16_68a = (_event.where.x - 0x6e)/0x23;
+ var_i16_68c = (_event.where.y - 0x1a)/0x23;
var_i16_1888 = var_i16_68c * 9 + var_i16_68a + 1;
- selectedMenuChapter = arr_i16_4c7c[var_i16_1888];
- if (var_i16_200e != selectedMenuChapter) {
+ _selectedMenuChapter = arr_i16_4c7c[var_i16_1888];
+ if (var_i16_200e != _selectedMenuChapter) {
if (var_i16_200e > 0) {
Common::Rect temp;
temp.top = arr_i16_1eb8[0];
@@ -418,9 +418,9 @@ void FoolGame::metapuzzleOnShift() {
// 138:0d36
g_toolbox->SetPort(var_i32_8);
- fillRect(0, 7, 0x13, var_i16_5a - 7, 0);
- if (selectedMenuChapter != 0x51) {
- var_str_384 = arr_str_195e8[selectedMenuChapter];
+ fillRect(0, 7, 0x13, _windowWidth - 7, 0);
+ if (_selectedMenuChapter != 0x51) {
+ var_str_384 = _puzzleName[_selectedMenuChapter];
} else {
// 138:0d8a
var_str_384 = g_zbasic->str(277); // the book of thoth
@@ -428,26 +428,26 @@ void FoolGame::metapuzzleOnShift() {
// 138:0d9e
g_zbasic->text(0, 0xc, 0, kSrcOr);
var_i16_30 = g_toolbox->StringWidth(var_str_384);
- g_toolbox->MoveTo((var_i16_5a / 2) - (var_i16_30 / 2), 0xf);
+ g_toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
g_toolbox->DrawString(var_str_384);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(var_i32_0);
- var_i16_200e = selectedMenuChapter;
+ var_i16_200e = _selectedMenuChapter;
}
// 138:0dfc
- if ((var_ev_46.modifiers & kModMouseButtonUp) == 0) {
- if (selectedMenuChapter != 0x51) {
+ if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ if (_selectedMenuChapter != 0x51) {
setStateBits(kStateChapterSelect | kStateReturn);
return;
} else {
- activePuzzle = 0x55;
+ _activePuzzle = 0x55;
return;
}
}
// 138:0e34
} else {
// 138:0e38
- var_ev_46.modifiers = 0;
+ _event.modifiers = 0;
}
// 138:0e3e
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 62a6b3480ca..ef697af97de 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -35,10 +35,10 @@ void FoolGame::polyominoRun() {
this->sub_128_271a();
this->var_i16_c00 = 1;
for (int i = 0; i <= 0x11; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 133:003c
- this->var_str_384 = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
// "the completed puzzle will reveal..."
this->var_str_384 = g_zbasic->str(209) + this->var_str_384 + g_zbasic->str(210);
g_zbasic->menu(8, 0xf, 1, this->var_str_384);
@@ -51,7 +51,7 @@ void FoolGame::polyominoRun() {
// 133:00b2
this->var_i16_484 += 1;
g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
+ _screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
this->var_i16_68a + this->arr_i16_1eb8[13],
@@ -83,7 +83,7 @@ void FoolGame::polyominoRun() {
}
// 133:01fa
for (int i = 0x12; i <= 0x19; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 133:0228
g_toolbox->SetPort(this->var_i32_f24);
@@ -92,9 +92,9 @@ void FoolGame::polyominoRun() {
// for each polyomino
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
// read number of coordinate parts
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
for (int i = 0; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = this->puzzlesReadShort();
+ this->arr_i16_47d8[j*8 + i] = puzzlesReadShort();
}
// 133:0284
for (int i = 5; i <= 6; i++) {
@@ -117,19 +117,19 @@ void FoolGame::polyominoRun() {
this->arr_i16_47d8[j*8 + 4]
);
// 133:02de
- if (!this->activePuzzleBuffer.empty()) { // was: str(211)
+ if (!_activePuzzleBuffer.empty()) { // was: str(211)
if (j == 1) {
this->var_i16_1aa8 = 1;
}
for (int i = 3; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_1aa8, 2));
+ this->arr_i16_47d8[j*8 + i] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_1aa8, 2));
this->var_i16_1aa8 += 2;
}
}
// 133:0356
// read coordinates. these are unsigned bytes in pixel units
for (int i = 0; i <= this->var_i16_103a; i++) {
- this->arr_i16_4338[i] = this->puzzlesReadByte();
+ this->arr_i16_4338[i] = puzzlesReadByte();
}
// 133:0388
@@ -143,15 +143,15 @@ void FoolGame::polyominoRun() {
// 133:0408
// load in letter placement information
- this->var_i16_103a = this->puzzlesReadShort();
+ this->var_i16_103a = puzzlesReadShort();
if (this->var_i16_103a >= 3) {
for (int i = 1; i <= this->var_i16_103a; i++) {
- this->arr_i16_3738[i] = this->puzzlesReadByte();
+ this->arr_i16_3738[i] = puzzlesReadByte();
}
}
// 133:044a
- this->arr_i16_1eb8[0x1a] = this->puzzlesReadShort(); // polygon fill pattern index
- this->arr_i16_1eb8[0x1b] = this->puzzlesReadShort(); // text source mode
+ this->arr_i16_1eb8[0x1a] = puzzlesReadShort(); // polygon fill pattern index
+ this->arr_i16_1eb8[0x1b] = puzzlesReadShort(); // text source mode
g_toolbox->PenNormal();
// 133:0476: JSR - "PICTURE_ON"
@@ -175,8 +175,8 @@ void FoolGame::polyominoRun() {
// 133:0530: JSR - "PICTURE_ON"
// picture handle 1:
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- g_toolbox->FillPoly(this->var_poly_1aac, this->arr_pat_58f4[this->arr_i16_1eb8[0x1a]]);
- g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xf]]);
+ g_toolbox->FillPoly(this->var_poly_1aac, _patterns[this->arr_i16_1eb8[0x1a]]);
+ g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
g_toolbox->FramePoly(this->var_poly_1aac);
// 133:0582
if (this->var_i16_103a >= 3) {
@@ -197,7 +197,7 @@ void FoolGame::polyominoRun() {
// 133:0642: JSR - "PICTURE_ON"
// picture handle 2: draw the shape without letters
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[0xf]]);
+ g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
g_toolbox->FramePoly(this->var_poly_1aac);
g_toolbox->PaintPoly(this->var_poly_1aac);
g_toolbox->ClosePicture();
@@ -213,7 +213,7 @@ void FoolGame::polyominoRun() {
for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
this->var_i16_484++;
- this->arr_i16_4338[this->var_i16_484] = this->puzzlesReadByte();
+ this->arr_i16_4338[this->var_i16_484] = puzzlesReadByte();
}
}
// 133:073c
@@ -227,26 +227,26 @@ void FoolGame::polyominoRun() {
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
this->polyominoCheckIfSolved();
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
do {
do {
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->polyominoOnClick();
}
// 133:0800
- } while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0));
+ } while ((_stateFlags == kStateNull) && (!_activePuzzleSolved));
// 133:081c
- if (this->stateFlags == kStateUndo) {
+ if (_stateFlags == kStateUndo) {
this->polyominoReset();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->polyominoStoreState();
this->saveGame();
}
- } while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0));
+ } while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved));
// 133:0864
- if (this->var_i16_d0c != 0) {
+ if (_activePuzzleSolved) {
this->polyominoSuccess();
}
this->polyominoStoreState();
@@ -292,7 +292,7 @@ void FoolGame::polyominoOnClick() {
for (int j = this->var_i16_1a98; j <= this->var_i16_1a98 + 3; j++) {
// 133:09dc
for (int i = this->var_i16_1a96; i <= this->var_i16_1a96 + 3; i++) {
- if (this->arr_i16_47d8[this->var_i16_7cc*8] & this->bitLUT[this->var_i16_106a]) {
+ if (this->arr_i16_47d8[this->var_i16_7cc*8] & _bitLUT[this->var_i16_106a]) {
// erase grabbed polyomino from collision map
this->arr_i16_2f38[i*32 + j] = 0;
}
@@ -303,8 +303,8 @@ void FoolGame::polyominoOnClick() {
// 133:0a60
this->var_i16_1ab2 = this->var_i16_1a96 - this->var_i16_68a;
this->var_i16_1ab4 = this->var_i16_1a98 - this->var_i16_68c;
- this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].left;
- this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].top;
+ this->var_i16_1062 = _screenGrid[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].left;
+ this->var_i16_1064 = _screenGrid[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].top;
debug(5, "FoolGame::polyominoOnClick: Draw pic 2 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 2]);
// 133:0b1c
@@ -315,15 +315,15 @@ void FoolGame::polyominoOnClick() {
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
// 133:0b5a: JMP - [0xde0]
- while (this->var_ev_46.what != 2) {
+ while (_event.what != 2) {
// 133:0b5e
// 133:0d3a
- while ((this->var_i16_1ab6 == this->var_i16_1062) && (this->var_i16_1ab8 == this->var_i16_1064) && (this->var_ev_46.what != 2)) {
+ while ((this->var_i16_1ab6 == this->var_i16_1062) && (this->var_i16_1ab8 == this->var_i16_1064) && (_event.what != 2)) {
// 133:0b62
this->getNextEvent(4);
- this->var_i16_68a = this->var_i16_1ab2 + ((this->var_ev_46.where.x - this->arr_i16_1eb8[4]) / this->arr_i16_1eb8[6]);
- this->var_i16_68c = this->var_i16_1ab4 + ((this->var_ev_46.where.y - this->arr_i16_1eb8[5]) / this->arr_i16_1eb8[7]);
+ this->var_i16_68a = this->var_i16_1ab2 + ((_event.where.x - this->arr_i16_1eb8[4]) / this->arr_i16_1eb8[6]);
+ this->var_i16_68c = this->var_i16_1ab4 + ((_event.where.y - this->arr_i16_1eb8[5]) / this->arr_i16_1eb8[7]);
if (this->var_i16_68a < 1) {
this->var_i16_68a = 1;
@@ -341,13 +341,13 @@ void FoolGame::polyominoOnClick() {
this->var_i16_68c = 0xb - this->arr_i16_47d8[this->var_i16_7cc*8 + 2];
}
// 133:0cc8
- this->var_i16_1ab6 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
- this->var_i16_1ab8 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ this->var_i16_1ab6 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
+ this->var_i16_1ab8 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
//debug(5, "FoolGame::polyominoOnClick: Move to (%d, %d) -> (%d, %d)", this->var_i16_68a, this->var_i16_68c, this->var_i16_1ab6, this->var_i16_1ab8);
}
// 133:0d78
- if (this->var_ev_46.what != 2) {
+ if (_event.what != 2) {
debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
// XOR out original position
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
@@ -368,7 +368,7 @@ void FoolGame::polyominoOnClick() {
for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
if (this->arr_i16_2f38[i*32 + j] > 0) {
- this->var_i16_1a9c |= this->bitLUT[this->var_i16_106a];
+ this->var_i16_1a9c |= _bitLUT[this->var_i16_106a];
}
// 133:0e44
this->var_i16_106a++;
@@ -403,7 +403,7 @@ void FoolGame::polyominoMove() {
// add the polyomino to the collision map
for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
- if ((this->arr_i16_47d8[this->var_i16_7cc*8] & this->bitLUT[this->var_i16_106a]) != 0) {
+ if ((this->arr_i16_47d8[this->var_i16_7cc*8] & _bitLUT[this->var_i16_106a]) != 0) {
this->arr_i16_2f38[i*32 + j] = this->var_i16_7cc;
}
// 133:0f6c
@@ -421,8 +421,8 @@ void FoolGame::polyominoMove() {
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:1002
- this->var_i16_1062 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
- this->var_i16_1064 = this->arr_rect_1f38[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ this->var_i16_1062 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
+ this->var_i16_1064 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
debug(5, "FoolGame::polyominoMove: Draw pic 1 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
@@ -430,8 +430,8 @@ void FoolGame::polyominoMove() {
void FoolGame::polyominoOnClickFixed() {
// 133:10a0
- this->var_i16_484 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
- this->var_i16_7e4 = this->arr_rect_1f38[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
+ this->var_i16_484 = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
+ this->var_i16_7e4 = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
// play bass tone
this->sub_128_50e(0x14, 0x64, 0);
// why do this???
@@ -466,7 +466,7 @@ void FoolGame::polyominoReset() {
// 133:12c2
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
}
void FoolGame::polyominoDrawFrame() {
@@ -484,14 +484,14 @@ void FoolGame::polyominoDrawFrame() {
void FoolGame::polyominoCheckIfSolved() {
// 133:12f2
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
this->var_i16_484 = 0;
for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
this->var_i16_484++;
if (this->arr_i16_2f38[i*32 + j] != this->arr_i16_4338[this->var_i16_484]) {
// 133:1368
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
j = this->arr_i16_1eb8[0x17];
i = this->arr_i16_1eb8[0x19];
}
@@ -499,15 +499,15 @@ void FoolGame::polyominoCheckIfSolved() {
}
}
// 133:13ce
- if (this->var_i16_d0c != 0) {
- this->stateFlags = kStateReturn;
+ if (_activePuzzleSolved) {
+ _stateFlags = kStateReturn;
}
}
void FoolGame::polyominoSuccess() {
// 133:13e2
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
}
this->sub_128_2664();
this->sub_128_6186();
@@ -516,12 +516,12 @@ void FoolGame::polyominoSuccess() {
void FoolGame::polyominoStoreState() {
// 133:1452
- this->activePuzzleBuffer = g_zbasic->str(212); // empty
+ _activePuzzleBuffer = g_zbasic->str(212); // empty
this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
Common::String val1 = g_zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
Common::String val2 = g_zbasic->encodeInt(this->arr_i16_47d8[i*8 + 4]);
- this->activePuzzleBuffer += val1 + val2;
+ _activePuzzleBuffer += val1 + val2;
}
}
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 325d0ba0331..202b491dde3 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -34,15 +34,15 @@ void FoolGame::revealRun() {
// 134:0004
this->sub_128_271a();
this->var_i16_c00 = 1;
- this->arr_i16_1eb8[15] = this->puzzlesReadShort();
- this->arr_i16_1eb8[16] = this->puzzlesReadShort();
- this->arr_i16_1eb8[21] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[15] = puzzlesReadShort();
+ this->arr_i16_1eb8[16] = puzzlesReadShort();
+ this->arr_i16_1eb8[21] = puzzlesReadShort();
debugC(5, kDebugLoading, "%d, %d, %04x", this->arr_i16_1eb8[15], this->arr_i16_1eb8[16], this->arr_i16_1eb8[21]);
- this->var_str_384 = this->puzzlesReadString();
+ this->var_str_384 = puzzlesReadString();
this->var_str_384 = g_zbasic->str(213) + this->var_str_384 + g_zbasic->str(214);
g_zbasic->menu(8, 6, 1, this->var_str_384);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- this->arr_i16_3738[i] = this->puzzlesReadByte();
+ this->arr_i16_3738[i] = puzzlesReadByte();
}
// 134:00ce
// rack up polygon information
@@ -50,12 +50,12 @@ void FoolGame::revealRun() {
this->arr_i16_1eb8[20] = 0;
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- this->var_i16_103a = this->puzzlesReadShort();
- this->arr_poly_192c0[i] = g_toolbox->OpenPoly();
+ this->var_i16_103a = puzzlesReadShort();
+ _revealPoly[i] = g_toolbox->OpenPoly();
// 134:010e
for (int j = 5; j <= this->var_i16_103a - 1; j += 2) {
- this->var_i16_484 = this->puzzlesReadShort();
- this->var_i16_7e4 = this->puzzlesReadShort();
+ this->var_i16_484 = puzzlesReadShort();
+ this->var_i16_7e4 = puzzlesReadShort();
if (j == 5) {
g_toolbox->MoveTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
} else {
@@ -65,7 +65,7 @@ void FoolGame::revealRun() {
}
g_toolbox->ClosePoly();
if (i <= this->arr_i16_1eb8[16]) {
- this->arr_i16_1eb8[20] |= this->bitLUT[i - 1];
+ this->arr_i16_1eb8[20] |= _bitLUT[i - 1];
}
// 134:01ce
}
@@ -74,11 +74,11 @@ void FoolGame::revealRun() {
this->arr_i16_1eb8[17] = (0x1c2 / this->arr_i16_1eb8[15]);
this->arr_i16_1eb8[18] = 0x100 - ((this->arr_i16_1eb8[15] * this->arr_i16_1eb8[17]) / 2);
- this->var_str_1272 = this->puzzlesReadString();
- this->sub_128_962(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- this->sub_128_962(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
+ this->var_str_1272 = puzzlesReadString();
+ this->zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ this->zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
// 134:02f0
- this->arr_i16_1eb8[19] = g_zbasic->decodeInt(this->activePuzzleBuffer);
+ this->arr_i16_1eb8[19] = g_zbasic->decodeInt(_activePuzzleBuffer);
this->var_i16_1aba = this->arr_i16_1eb8[18];
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
@@ -89,70 +89,70 @@ void FoolGame::revealRun() {
1
);
// 134:0352
- this->arr_rect_1f38[this->var_i16_7be].top = 0x10f;
- this->arr_rect_1f38[this->var_i16_7be].left = this->var_i16_1aba;
- this->arr_rect_1f38[this->var_i16_7be].bottom = 0x137;
- this->arr_rect_1f38[this->var_i16_7be].right = this->var_i16_1aba + this->arr_i16_1eb8[17];
+ _screenGrid[this->var_i16_7be].top = 0x10f;
+ _screenGrid[this->var_i16_7be].left = this->var_i16_1aba;
+ _screenGrid[this->var_i16_7be].bottom = 0x137;
+ _screenGrid[this->var_i16_7be].right = this->var_i16_1aba + this->arr_i16_1eb8[17];
this->var_i16_1aba += this->arr_i16_1eb8[17];
// 134:03fc
- g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19, this->arr_pat_58f4[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19);
+ g_toolbox->FillRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19, _patterns[0]);
+ g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
// 134:0448
this->var_str_384 = g_zbasic->midStr(this->var_str_1272, this->var_i16_7be, 1);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
+ _screenGrid[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
0x127
);
g_toolbox->DrawString(this->var_str_384);
// 134:04d6
- if (this->arr_i16_1eb8[19] & this->bitLUT[this->arr_i16_3738[this->var_i16_7be] - 1]) {
+ if (this->arr_i16_1eb8[19] & _bitLUT[this->arr_i16_3738[this->var_i16_7be] - 1]) {
this->revealSelectButton();
}
}
// 134:0538
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
} else {
// 134:0572
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
}
g_toolbox->PenNormal();
// 134:057a
// 134:057a: JMP - [0x61e]
// main event loop
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
// 134:057e
- while ((this->stateFlags == 0) && (this->var_i16_d0c == 0)) {
+ while ((_stateFlags == 0) && (!_activePuzzleSolved)) {
// 134:0582
this->getNextEvent(-1);
- if (this->var_ev_46.what == kMouseDown) {
+ if (_event.what == kMouseDown) {
this->revealOnClick();
}
if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
}
// 134:05e2
- if (this->stateFlags == kStateUndo) {
+ if (_stateFlags == kStateUndo) {
this->revealReset();
}
- if (this->stateFlags == kStateSaveGame) {
- this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
+ if (_stateFlags == kStateSaveGame) {
+ _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
this->saveGame();
}
// 134:061e
}
// 134:0648
- if (this->var_i16_d0c != 0) {
+ if (_activePuzzleSolved) {
this->revealSuccess();
}
- this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
+ _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- g_toolbox->KillPoly(this->arr_poly_192c0[i]);
+ g_toolbox->KillPoly(_revealPoly[i]);
}
}
@@ -160,7 +160,7 @@ void FoolGame::revealOnClick() {
// 134:067c
this->var_i16_7be = 0;
for (int j = 1; j <= this->arr_i16_1eb8[15]; j++) {
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1f38[j])) {
+ if (g_toolbox->PtInRect(_event.where, _screenGrid[j])) {
this->var_i16_7be = j;
j = this->arr_i16_1eb8[15];
}
@@ -171,7 +171,7 @@ void FoolGame::revealOnClick() {
}
// 134:06f4
this->revealSelectButton();
- this->arr_i16_1eb8[19] ^= this->bitLUT[this->arr_i16_3738[this->var_i16_7be]-1];
+ this->arr_i16_1eb8[19] ^= _bitLUT[this->arr_i16_3738[this->var_i16_7be]-1];
debugC(5, kDebugLoading, "reveal: %d, %04x, %04x", this->var_i16_7be, this->arr_i16_1eb8[19], this->arr_i16_1eb8[20]);
this->sub_128_6186();
}
@@ -179,11 +179,11 @@ void FoolGame::revealOnClick() {
void FoolGame::revealSelectButton() {
// 134:074a
// invert the button
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[this->var_i16_7be], 0x19, 0x19);
- g_toolbox->PenPat(this->arr_pat_58f4[this->arr_i16_1eb8[21]]);
+ g_toolbox->InvertRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
+ g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[21]]);
// fill the polygon
g_toolbox->PenMode(kPatXor);
- g_toolbox->PaintPoly(this->arr_poly_192c0[this->arr_i16_3738[this->var_i16_7be]]);
+ g_toolbox->PaintPoly(_revealPoly[this->arr_i16_3738[this->var_i16_7be]]);
g_toolbox->PenNormal();
}
@@ -191,19 +191,19 @@ void FoolGame::revealReset() {
// 134:07bc
this->fillRect(0x37, 0x13, 0xff, 0x1ee, 0);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- if (this->arr_i16_1eb8[19] & this->bitLUT[this->arr_i16_3738[i]-1]) {
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[i], 0x19, 0x19);
+ if (this->arr_i16_1eb8[19] & _bitLUT[this->arr_i16_3738[i]-1]) {
+ g_toolbox->InvertRoundRect(_screenGrid[i], 0x19, 0x19);
}
}
// 134:085c
this->arr_i16_1eb8[19] = 0;
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
}
void FoolGame::revealSuccess() {
// 134:0872
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
}
this->sub_128_2664();
this->sub_128_6186();
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 35d7640be36..af31d750606 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -49,12 +49,12 @@ void FoolGame::sentenceRun() {
this->arr_i16_3738[0xf] = 0x200;
// 135:00ce
- this->var_i16_1066 = this->puzzlesReadShort();
+ this->var_i16_1066 = puzzlesReadShort();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
- this->arr_i16_1eb8[0] = this->puzzlesReadShort();
- g_zbasic->indexRawSet(this->puzzlesReadString(), 1, 0);
- this->var_str_1272 = this->puzzlesReadString().decode(Common::kMacRoman);
- this->var_str_384 = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->arr_i16_1eb8[0] = puzzlesReadShort();
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
+ this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
+ this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
this->var_str_384 = g_zbasic->str(215) + this->var_str_384 + g_zbasic->str(216); // to reveal XXXXX
// 135:0152
g_zbasic->menu(8, 7, 1, this->var_str_384);
@@ -65,14 +65,14 @@ void FoolGame::sentenceRun() {
this->var_i16_7e4 = this->arr_i16_1eb8[2];
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->arr_i16_4338[i] = 0;
- this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = this->puzzlesReadByte();
- g_zbasic->indexRawSet(this->puzzlesReadString(), 1, i);
+ this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = puzzlesReadByte();
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
// 135:0254
- g_zbasic->indexRawSet(this->puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
- this->arr_rect_1f38[i].top = 0xf2;
- this->arr_rect_1f38[i].left = this->var_i16_7e4;
- this->arr_rect_1f38[i].bottom = 0x156;
- this->arr_rect_1f38[i].right = this->var_i16_7e4 + this->arr_i16_1eb8[1];
+ g_zbasic->indexRawSet(puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
+ _screenGrid[i].top = 0xf2;
+ _screenGrid[i].left = this->var_i16_7e4;
+ _screenGrid[i].bottom = 0x156;
+ _screenGrid[i].right = this->var_i16_7e4 + this->arr_i16_1eb8[1];
// 135:030c
this->var_i16_7e4 += this->arr_i16_1eb8[1];
}
@@ -80,15 +80,15 @@ void FoolGame::sentenceRun() {
g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(temp, _patterns[2]);
this->arr_i16_1eb8[4] = 0;
for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
// 135:03a4
- if (this->activePuzzleBuffer.empty()) { // was: str(217)
+ if (_activePuzzleBuffer.empty()) { // was: str(217)
this->arr_i16_4338[this->var_i16_68a] = 1;
} else {
// 135:03d4
- this->arr_i16_4338[this->var_i16_68a] = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_68a, 1));
+ this->arr_i16_4338[this->var_i16_68a] = g_zbasic->castInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_68a, 1));
}
// 135:0408
@@ -99,45 +99,45 @@ void FoolGame::sentenceRun() {
// 135:044a
}
// 135:0466
- if (this->activePuzzleBuffer.empty()) { // was: str(218)
+ if (_activePuzzleBuffer.empty()) { // was: str(218)
this->var_str_1070 = g_zbasic->index(1, 0);
} else {
// 135:049a
- this->var_i16_1372 = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
- this->var_str_1070 = g_zbasic->midStr(this->activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
+ this->var_i16_1372 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
+ this->var_str_1070 = g_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
}
// 135:04f2
this->sub_135_b16();
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
if (this->var_str_1070 == this->var_str_1272) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
} else {
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
}
// 135:0520
do {
this->getNextEvent(-1);
- if (this->var_ev_46.what == kMouseDown) {
+ if (_event.what == kMouseDown) {
this->sub_135_5b6();
}
// 135:0538
if (this->var_str_1070 == this->var_str_1272) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
// 135:0552
- if (this->stateFlags == kStateUndo) {
+ if (_stateFlags == kStateUndo) {
this->sub_135_9ba();
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
}
// 135:0566
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->sub_135_c1c();
this->saveGame();
}
// 135:0578
- } while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0));
+ } while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved));
// 135:05a0
- if (this->var_i16_d0c == 1) {
+ if (_activePuzzleSolved) {
this->sub_135_cee();
}
this->sub_135_c1c();
@@ -147,16 +147,16 @@ void FoolGame::sentenceRun() {
void FoolGame::sub_135_5b6() {
// 135:05b6
this->var_i16_1abc = 0;
- if ((this->var_ev_46.where.x < this->arr_i16_1eb8[2]) || (this->var_ev_46.where.y < 0xf2))
+ if ((_event.where.x < this->arr_i16_1eb8[2]) || (_event.where.y < 0xf2))
return;
// determine which button was clicked on
- this->var_i16_103a = ((this->var_ev_46.where.x - this->arr_i16_1eb8[2]) / this->arr_i16_1eb8[1]) + 1;
+ this->var_i16_103a = ((_event.where.x - this->arr_i16_1eb8[2]) / this->arr_i16_1eb8[1]) + 1;
// 135:0632
if ((this->var_i16_103a > this->arr_i16_1eb8[0]) || (this->arr_i16_4338[this->var_i16_103a] == 0))
return;
// 135:0676
this->arr_i16_4338[this->var_i16_103a] = 0;
- g_toolbox->FillOval(this->arr_rect_1f38[this->var_i16_103a], this->arr_pat_58f4[2]);
+ g_toolbox->FillOval(_screenGrid[this->var_i16_103a], _patterns[2]);
// 135:06aa
switch (this->arr_i16_4338[this->var_i16_103a + this->arr_i16_1eb8[0]]-1) {
case 0:
@@ -200,13 +200,13 @@ void FoolGame::sub_135_5b6() {
this->sub_128_6186();
this->var_i16_1abc = 1;
- this->stateFlags = kNullEvent;
+ _stateFlags = kNullEvent;
// 135:07a0
- while ((this->var_ev_46.modifiers & kModMouseButtonUp) && (this->stateFlags == kNullEvent)) {
+ while ((_event.modifiers & kModMouseButtonUp) && (_stateFlags == kNullEvent)) {
this->getNextEvent(-1);
}
// 135:07c8
- if (this->stateFlags == kNullEvent) {
+ if (_stateFlags == kNullEvent) {
this->sub_135_9ba();
}
}
@@ -262,7 +262,7 @@ void FoolGame::sub_135_9ba() {
// 135:09ba
this->arr_i16_1eb8[4] = 0;
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
- g_toolbox->FillRect(temp, this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(temp, _patterns[2]);
for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
this->arr_i16_4338[this->var_i16_68a] = 1;
this->sub_135_a34();
@@ -276,9 +276,9 @@ void FoolGame::sub_135_a34() {
g_zbasic->text(0, 0xc, 0, kSrcOr);
this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + g_zbasic->str(221);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
- g_toolbox->FillOval(this->arr_rect_1f38[this->var_i16_68a], this->arr_pat_58f4[0]);
- g_toolbox->FrameOval(this->arr_rect_1f38[this->var_i16_68a]);
- g_toolbox->MoveTo(this->arr_rect_1f38[this->var_i16_68a].left + (this->arr_i16_1eb8[1] / 2) - (this->var_i16_7e4 / 2), 0x129);
+ g_toolbox->FillOval(_screenGrid[this->var_i16_68a], _patterns[0]);
+ g_toolbox->FrameOval(_screenGrid[this->var_i16_68a]);
+ g_toolbox->MoveTo(_screenGrid[this->var_i16_68a].left + (this->arr_i16_1eb8[1] / 2) - (this->var_i16_7e4 / 2), 0x129);
g_toolbox->DrawString(this->var_str_384);
}
@@ -295,14 +295,14 @@ void FoolGame::sub_135_b16() {
this->arr_i16_3738[1] = 0xf6 - (this->var_i16_484 / 2);
this->arr_i16_3738[3] = 0x109 + (this->var_i16_484 / 2);
Common::Rect temp(this->arr_i16_3738[1], this->arr_i16_3738[0], this->arr_i16_3738[3], this->arr_i16_3738[2]);
- g_toolbox->FillRect(temp, this->arr_pat_58f4[0]);
+ g_toolbox->FillRect(temp, _patterns[0]);
g_toolbox->MoveTo(0x100 - (this->var_i16_484 / 2), 0xd9);
g_toolbox->DrawString(this->var_str_1070);
}
void FoolGame::sub_135_c1c() {
// 135:0c1c
- this->activePuzzleBuffer.clear(); // was: str(222)
+ _activePuzzleBuffer.clear(); // was: str(222)
if (this->var_i16_1abc != 0) {
this->var_i16_1abc = 0;
return;
@@ -311,18 +311,18 @@ void FoolGame::sub_135_c1c() {
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_4338[i]);
this->var_str_384 = g_zbasic->rightStr(this->var_str_384, 1);
- this->activePuzzleBuffer += this->var_str_384;
+ _activePuzzleBuffer += this->var_str_384;
}
// 135:0cba
Common::String temp = this->var_str_1070.encode(Common::kMacRoman);
this->var_i16_1372 = (int16)temp.size();
- this->activePuzzleBuffer += g_zbasic->encodeInt(this->var_i16_1372) + temp;
+ _activePuzzleBuffer += g_zbasic->encodeInt(this->var_i16_1372) + temp;
}
void FoolGame::sub_135_cee() {
// 135:0cee
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
this->var_i16_68a = 1;
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->sub_128_50e(g_zbasic->rndInt(1000) + 0x19, 0x28, 0);
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index 70ba5fbe72a..aae0d0a45ad 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -44,7 +44,7 @@ void FoolGame::straightPathRun() {
do {
var_i16_484++;
g_toolbox->SetRect(
- arr_rect_1f38[var_i16_484],
+ _screenGrid[var_i16_484],
var_i16_68a,
var_i16_68c,
var_i16_68a + arr_i16_1eb8[13] - 1,
@@ -80,7 +80,7 @@ void FoolGame::straightPathRun() {
temp.left = 0;
temp.bottom = temp.top + arr_i16_1eb8[7] + 2;
temp.right = SCREEN_WIDTH;
- g_toolbox->FillRect(temp, arr_pat_58f4[0]);
+ g_toolbox->FillRect(temp, _patterns[0]);
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
if (arr_i16_3b38[i*32 + j] == 0) {
@@ -89,8 +89,8 @@ void FoolGame::straightPathRun() {
}
// 143:03f0
g_toolbox->MoveTo(
- arr_rect_1f38[var_i16_1574].left + arr_i16_1eb8[2] - 1,
- arr_rect_1f38[var_i16_1574].top + arr_i16_1eb8[3]
+ _screenGrid[var_i16_1574].left + arr_i16_1eb8[2] - 1,
+ _screenGrid[var_i16_1574].top + arr_i16_1eb8[3]
);
var_str_384 = g_zbasic->chr(arr_i16_3b38[i*32 + j]);
g_toolbox->DrawString(var_str_384);
@@ -99,34 +99,34 @@ void FoolGame::straightPathRun() {
straightPathDrawText();
// 143:04cc
var_i16_1574 = 0;
- stateFlags = kStateNull;
- if (var_str_1272 == activePuzzleBuffer) {
- var_i16_d0c = 1;
+ _stateFlags = kStateNull;
+ if (var_str_1272 == _activePuzzleBuffer) {
+ _activePuzzleSolved = true;
} else {
- var_i16_d0c = 0;
+ _activePuzzleSolved = false;
}
// JMP 0x582
- while (((stateFlags & kStateReturn) == 0) && (var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
// 143:0500
- while ((stateFlags == kStateNull) && (var_i16_d0c == 0)) {
+ while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
getNextEvent(-1);
- if (var_ev_46.what == kMouseDown) {
+ if (_event.what == kMouseDown) {
straightPathOnClick();
}
- if ((keyLastPressed == 3) || (keyLastPressed == 0xd)) {
+ if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
straightPathReset();
}
- if (var_str_1272 == activePuzzleBuffer) {
- var_i16_d0c = 1;
+ if (var_str_1272 == _activePuzzleBuffer) {
+ _activePuzzleSolved = true;
}
}
// 143:0574
- if (stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
saveGame();
}
}
// 143:05ac
- if (var_i16_d0c != 0) {
+ if (_activePuzzleSolved != 0) {
straightPathSuccess();
}
}
@@ -135,28 +135,28 @@ void FoolGame::straightPathOnClick() {
// 143:05c0
sub_128_2be(var_i16_68a, var_i16_68c);
if (var_i16_1574 > 0) {
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
var_i16_1574 = 0;
}
// 143:05fc
if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1]))
return;
// 143:066c
- var_i16_c04++;
- if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] != var_i16_c04) {
- activePuzzleBuffer += g_zbasic->chr(arr_i16_3b38[var_i16_68a*32 + var_i16_68c]);
+ _activePuzzleStatus++;
+ if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] != _activePuzzleStatus) {
+ _activePuzzleBuffer += g_zbasic->chr(arr_i16_3b38[var_i16_68a*32 + var_i16_68c]);
} else {
// 143:06d8
- activePuzzleBuffer += g_zbasic->indexRaw(1, var_i16_c04);
+ _activePuzzleBuffer += g_zbasic->indexRaw(1, _activePuzzleStatus);
}
// 143:06fa
straightPathDrawText();
- if (var_i16_c04 < arr_i16_1eb8[15]) {
+ if (_activePuzzleStatus < arr_i16_1eb8[15]) {
var_i16_1574 = (var_i16_68c - 1)*arr_i16_1eb8[0] + var_i16_68a;
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
} else {
// 143:0766
- if (activePuzzleBuffer != var_str_1272.encode(Common::kMacRoman)) {
+ if (_activePuzzleBuffer != var_str_1272.encode(Common::kMacRoman)) {
straightPathReset();
}
}
@@ -167,20 +167,20 @@ void FoolGame::straightPathOnClick() {
void FoolGame::straightPathReset() {
// 143:0784
if (var_i16_1574 > 0) {
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
// 143:07a4
for (int16 i = 0; i <= 0x14; i++) {
var_i16_1574 = g_zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
sub_128_50e(g_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
// 143:0812
- g_toolbox->InvertRect(arr_rect_1f38[var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
- var_i16_c04 = 0;
- activePuzzleBuffer.clear(); // was: str(367)
+ _activePuzzleStatus = 0;
+ _activePuzzleBuffer.clear(); // was: str(367)
var_i16_1574 = 0;
- keyLastPressed = 0;
+ _keyLastPressed = 0;
straightPathClearText();
}
@@ -189,7 +189,7 @@ void FoolGame::straightPathDrawText() {
straightPathClearText();
g_zbasic->text(0xfe, 0x18, 0x18, kSrcBic);
var_i16_7a2 = 0x148;
- sub_128_918(activePuzzleBuffer);
+ sub_128_918(_activePuzzleBuffer);
}
void FoolGame::straightPathClearText() {
@@ -200,12 +200,12 @@ void FoolGame::straightPathClearText() {
void FoolGame::straightPathSuccess() {
// 143:08b0
g_toolbox->PenMode(kPatBic);
- g_toolbox->PenPat(arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
if (arr_i16_2f38[i*32 + j] == 0) {
var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
- g_toolbox->PaintRect(arr_rect_1f38[var_i16_1574]);
+ g_toolbox->PaintRect(_screenGrid[var_i16_1574]);
}
// 143:0936
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 70fb8a75679..51bcc351fd0 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -44,7 +44,7 @@ void FoolGame::sunMapRun() {
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
this->var_i16_484++;
- g_toolbox->SetRect(this->arr_rect_1f38[this->var_i16_484], i, j, i+0x24, j+0x24);
+ g_toolbox->SetRect(_screenGrid[this->var_i16_484], i, j, i+0x24, j+0x24);
}
}
// 137:00fa
@@ -58,66 +58,66 @@ void FoolGame::sunMapRun() {
// 137:0148
for (int i = 1; i <= 0x51; i++) {
this->var_i16_484 = this->arr_i16_4c7c[i];
- if ((this->puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled)) != 0) {
- this->arr_i32_192c0[i] = this->arr_i32_1912c[i];
+ if ((_puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled)) != 0) {
+ this->arr_i32_192c0[i] = _sunMapTilePic[i];
} else {
// 137:01b2
- this->arr_i32_192c0[i] = this->arr_i32_1912c[0x52];
+ this->arr_i32_192c0[i] = _sunMapTilePic[0x52];
}
// 137:01d8
- if ((this->puzzleFlags[this->var_i16_484] & 4) != 0) {
- this->puzzleFlags[this->var_i16_484] ^= 4;
- this->puzzleFlags[i] |= kFlagMapTile;
+ if ((_puzzleFlags[this->var_i16_484] & 4) != 0) {
+ _puzzleFlags[this->var_i16_484] ^= 4;
+ _puzzleFlags[i] |= kFlagMapTile;
}
// 137:0252
- if ((this->puzzleFlags[i] & kFlagMapTile) != 0) {
- this->arr_i32_192c0[i] = this->arr_i32_1912c[0x53];
+ if ((_puzzleFlags[i] & kFlagMapTile) != 0) {
+ this->arr_i32_192c0[i] = _sunMapTilePic[0x53];
}
// 137:0294
}
// 137:02a2
this->fillRect(0x14, 0x67, 0x156, 0x1b1, 2);
for (int i = 1; i <= 0x51; i++) {
- g_zbasic->picture(this->arr_rect_1f38[i].left, this->arr_rect_1f38[i].top, this->arr_i32_192c0[this->sunMapTileID[i]]);
+ g_zbasic->picture(_screenGrid[i].left, _screenGrid[i].top, this->arr_i32_192c0[_sunMapTileID[i]]);
}
// 137:0336
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->sunMapCheckIfSolved();
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
- while ((this->stateFlags == kStateNull) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
+ while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
this->getNextEvent(-1);
- if (this->var_ev_46.what == kMouseDown) {
+ if (_event.what == kMouseDown) {
this->sunMapOnClick();
}
}
// 137:038a
- if (this->stateFlags == kStateUndo) {
+ if (_stateFlags == kStateUndo) {
this->sunMapUndoMove();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
}
// 137:03ce
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
return;
}
// JMP 0x1618
this->var_i16_68c = 0;
for (int j = 0; j <= 5; j++) {
for (int i = 1; i <= 0x51; i++) {
- g_toolbox->InvertRect(this->arr_rect_1f38[i]);
+ g_toolbox->InvertRect(_screenGrid[i]);
}
}
// 137:1654
- this->activePuzzle = 0;
- this->var_i16_c04 = 0x64;
- this->sunMapRestored = 1;
+ _activePuzzle = 0;
+ _activePuzzleStatus = 0x64;
+ _sunMapRestored = 1;
g_zbasic->menu(2, 7, 1, Common::U32String());
for (int i = 1; i <= 0x50; i++) {
- this->puzzleFlags[i] = kFlagMenuEnabled;
+ _puzzleFlags[i] = kFlagMenuEnabled;
}
for (int j = 3; j <= 7; j++) {
for (int i = 1; i <= 0x10; i++) {
@@ -134,14 +134,14 @@ void FoolGame::sunMapOnClick() {
return;
}
// 137:0466
- this->menuDisabled = true;
+ _menuDisabled = true;
g_zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
g_toolbox->PenMode(kPatXor);
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
- if (this->puzzleFlags[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & kFlagMapTile) {
+ if (_puzzleFlags[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & kFlagMapTile) {
this->sunMapRevealPiece();
return;
}
@@ -156,7 +156,7 @@ void FoolGame::sunMapOnClick() {
this->sunMapCheckIfSolved();
this->sub_128_6186();
g_zbasic->menu(8, 3, 1, Common::U32String());
- this->menuDisabled = false;
+ _menuDisabled = false;
}
void FoolGame::sunMapDragSelect() {
@@ -183,16 +183,16 @@ void FoolGame::sunMapDragSelect() {
this->arr_i16_4758[7] = this->arr_i16_4758[1];
}
// 137:06ce
- this->arr_i16_4758[11] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
- this->arr_i16_4758[12] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
- this->arr_i16_4758[13] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
- this->arr_i16_4758[14] = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
+ this->arr_i16_4758[11] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
+ this->arr_i16_4758[12] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
+ this->arr_i16_4758[13] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
+ this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
// 137:084c
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->sub_128_3da(2);
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->sub_128_3da(1);
- } while (this->var_ev_46.what != kMouseUp);
+ } while (_event.what != kMouseUp);
// 137:087e
}
@@ -240,20 +240,20 @@ void FoolGame::sunMapMoveSelected() {
this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
}
// 137:0bae
- this->arr_rect_4776.top = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
- this->arr_rect_4776.left = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
- this->arr_rect_4776.bottom = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
- this->arr_rect_4776.right = this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
+ this->arr_rect_4776.top = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
+ this->arr_rect_4776.left = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
+ this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
+ this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(2);
g_toolbox->FrameRect(this->arr_rect_4776);
this->sub_128_3da(1);
- } while (this->var_ev_46.what != kMouseDown);
+ } while (_event.what != kMouseDown);
}
void FoolGame::sunMapUndoMove() {
// 137:0d60
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
@@ -267,9 +267,9 @@ void FoolGame::sunMapDropSelected() {
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
this->var_i16_1aa4++;
- this->arr_i16_3738[this->var_i16_1aa4] = this->sunMapTileID[this->arr_i16_2f38[i*32 + j]];
+ this->arr_i16_3738[this->var_i16_1aa4] = _sunMapTileID[this->arr_i16_2f38[i*32 + j]];
// 137:0e5a
- this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] = 0;
+ _sunMapTileID[this->arr_i16_2f38[i*32 + j]] = 0;
}
}
@@ -279,30 +279,30 @@ void FoolGame::sunMapDropSelected() {
for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
this->var_i16_1aa4++;
- if (this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] > 0) {
+ if (_sunMapTileID[this->arr_i16_2f38[i*32 + j]] > 0) {
this->var_i16_1aa6++;
- this->arr_i16_3738[this->var_i16_1aa6] = this->sunMapTileID[this->arr_i16_2f38[i*32 + j]];
+ this->arr_i16_3738[this->var_i16_1aa6] = _sunMapTileID[this->arr_i16_2f38[i*32 + j]];
}
// 137:0f7c
- this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
+ _sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
g_zbasic->picture(
- this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
- this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
+ _screenGrid[this->arr_i16_2f38[i*32 + j]].left,
+ _screenGrid[this->arr_i16_2f38[i*32 + j]].top,
+ this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
);
}
}
this->var_i16_1aa6 = this->var_i16_1aa4;
for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
- if (this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] == 0) {
+ if (_sunMapTileID[this->arr_i16_2f38[i*32 + j]] == 0) {
// 137:1114
this->var_i16_1aa6++;
- this->sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
+ _sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
g_zbasic->picture(
- this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].left,
- this->arr_rect_1f38[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
+ _screenGrid[this->arr_i16_2f38[i*32 + j]].left,
+ _screenGrid[this->arr_i16_2f38[i*32 + j]].top,
+ this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
);
}
// 137:1214
@@ -314,40 +314,40 @@ void FoolGame::sunMapDropSelected() {
void FoolGame::sunMapCheckIfSolved() {
// 137:124e
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
for (int i = 1; i <= 0x51; i++) {
- if (this->sunMapTileID[i] != i) {
- this->var_i16_d0c = 0;
+ if (_sunMapTileID[i] != i) {
+ _activePuzzleSolved = false;
i = 0x51;
}
}
// 137:128e
- if (this->var_i16_d0c == 1) {
+ if (_activePuzzleSolved) {
for (int i = 1; i <= 0x51; i++) {
this->var_i16_484 = this->arr_i16_4c7c[i];
- if ((this->puzzleFlags[this->var_i16_484] & kFlagMapTile) || (this->puzzleFlags[this->var_i16_484] == kFlagMenuDisabled)) {
- this->var_i16_d0c = 0;
+ if ((_puzzleFlags[this->var_i16_484] & kFlagMapTile) || (_puzzleFlags[this->var_i16_484] == kFlagMenuDisabled)) {
+ _activePuzzleSolved = false;
i = 0x51;
}
// 137:12fa
}
}
// 137:1306
- if (this->var_i16_d0c != 0) {
- this->stateFlags = kStateReturn;
+ if (_activePuzzleSolved) {
+ _stateFlags = kStateReturn;
}
}
void FoolGame::sunMapRevealPiece() {
// 137:131a
- this->puzzleFlags[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= kFlagMapTile;
- this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = this->arr_i32_1912c[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
+ _puzzleFlags[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= kFlagMapTile;
+ this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = _sunMapTilePic[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
// 137:142c
// unrolled loop
- this->arr_i16_4758[0] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top;
- this->arr_i16_4758[1] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left;
- this->arr_i16_4758[2] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].bottom;
- this->arr_i16_4758[3] = this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].right;
+ this->arr_i16_4758[0] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top;
+ this->arr_i16_4758[1] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left;
+ this->arr_i16_4758[2] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].bottom;
+ this->arr_i16_4758[3] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].right;
// 137:1490
for (int16 i = 0; i <= 0xf; i++) {
this->arr_i16_4758[0] += i;
@@ -364,13 +364,13 @@ void FoolGame::sunMapRevealPiece() {
}
// 137:1550
g_zbasic->picture(
- this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left,
- this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
- this->arr_i32_192c0[this->sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
+ _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left,
+ _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
+ this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
);
this->sub_128_6186();
this->sunMapCheckIfSolved();
- this->menuDisabled = false;
+ _menuDisabled = false;
}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 159829a5798..5bb186fdc66 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -32,83 +32,83 @@ extern Toolbox *g_toolbox;
// high priestess challenge
void FoolGame::highPriestessRun() {
// 140:0004
- if (this->var_i16_c04 < 0x64) {
+ if (_activePuzzleStatus < 0x64) {
this->thothAdjustPuzzleData();
}
if ((this->var_i16_7ce & 2) != 0) {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ g_toolbox->SetCursor(_cursors[0x10]);
}
- if (this->var_i16_c04 == 0) {
- this->menuHidesPlayfield = true;
+ if (_activePuzzleStatus == 0) {
+ _menuHidesPlayfield = true;
this->thoth99Enchantments();
- this->menuHidesPlayfield = false;
- if (this->var_i16_d0c == 0) {
+ _menuHidesPlayfield = false;
+ if (!_activePuzzleSolved) {
this->sub_140_3412();
return;
}
// 140:0056
- this->var_i16_c04 = 1;
+ _activePuzzleStatus = 1;
}
// 140:005c
- if (this->var_i16_c04 == 1) {
+ if (_activePuzzleStatus == 1) {
this->thothKey1st();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
this->sub_140_3412();
return;
}
- this->var_i16_c04 = 2;
+ _activePuzzleStatus = 2;
}
// 140:007e
- g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ g_toolbox->SetCursor(_cursors[0x10]);
this->sub_140_2f92();
- if (this->var_i16_c04 == 2) {
+ if (_activePuzzleStatus == 2) {
this->thothKey2nd();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
this->sub_140_3412();
return;
}
- this->var_i16_c04 = 3;
- if (this->puzzleCompletionStatus[0x17] == 0x63) {
+ _activePuzzleStatus = 3;
+ if (_puzzleCompletionStatus[0x17] == 0x63) {
// is the humbug marked with the wadjet eye? if so, unmark
// 140:00ce
- this->puzzleCompletionStatus[0x17] = 0x64;
- this->var_str_384 = this->arr_str_195e8[0x17] + g_zbasic->str(301); // ' '
+ _puzzleCompletionStatus[0x17] = 0x64;
+ this->var_str_384 = _puzzleName[0x17] + g_zbasic->str(301); // ' '
g_zbasic->menu(0x4, 0x7, 0x1, this->var_str_384);
}
}
// 140:0116
- if (this->var_i16_c04 == 3) {
+ if (_activePuzzleStatus == 3) {
this->thothKey3rd();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
return;
}
- this->var_i16_c04 = 4;
- if (this->puzzleCompletionStatus[0x3f] == 0x63) {
+ _activePuzzleStatus = 4;
+ if (_puzzleCompletionStatus[0x3f] == 0x63) {
// is justice marked with the wadjet eye? if so, unmark
- this->puzzleCompletionStatus[0x3f] = 0x64;
- this->var_str_384 = this->arr_str_195e8[0x3f] + g_zbasic->str(302); // ' '
+ _puzzleCompletionStatus[0x3f] = 0x64;
+ this->var_str_384 = _puzzleName[0x3f] + g_zbasic->str(302); // ' '
g_zbasic->menu(6, 0xf, 1, this->var_str_384);
}
}
// 140:019c
- if (this->var_i16_c04 == 4) {
- this->hermitPathStage = 6;
+ if (_activePuzzleStatus == 4) {
+ _hermitPathStage = 6;
this->thothKeyLast();
- if (this->var_i16_d0c == 0) {
+ if (!_activePuzzleSolved) {
this->sub_140_3412();
return;
}
- this->var_i16_c04 = 0x64;
- this->puzzleFlags[0x51] |= 0x5;
- if (this->puzzleCompletionStatus[0x48] == 0x63) {
+ _activePuzzleStatus = 0x64;
+ _puzzleFlags[0x51] |= 0x5;
+ if (_puzzleCompletionStatus[0x48] == 0x63) {
// is the hermit marked with the wadjet eye? if so, unmark
- this->puzzleCompletionStatus[0x48] = 0x64;
- this->var_str_384 = this->arr_str_195e8[0x48] + g_zbasic->str(303);
+ _puzzleCompletionStatus[0x48] = 0x64;
+ this->var_str_384 = _puzzleName[0x48] + g_zbasic->str(303);
g_zbasic->menu(7, 8, 1, this->var_str_384);
}
}
// 140:024c
- if (this->sunMapRestored == 0) {
+ if (_sunMapRestored == 0) {
// show the fake puzzle picture
g_toolbox->PenNormal();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
@@ -117,7 +117,7 @@ void FoolGame::highPriestessRun() {
this->sub_128_61c2();
}
// 140:02a2
- if (!this->screenOversized) {
+ if (!_screenOversized) {
g_toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
@@ -132,7 +132,7 @@ void FoolGame::highPriestessRun() {
}
}
// 140:0328
- if (this->sunMapRestored == 0) {
+ if (_sunMapRestored == 0) {
g_toolbox->PenNormal();
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -177,10 +177,10 @@ void FoolGame::highPriestessRun() {
void FoolGame::thoth99Enchantments() {
// 140:0458
this->sub_128_4da(0);
- if (this->activePuzzleBuffer.empty()) { // was: str(307)
+ if (_activePuzzleBuffer.empty()) { // was: str(307)
this->arr_i16_1eb8[0] = 0x63;
} else {
- this->arr_i16_1eb8[0] = g_zbasic->decodeInt(this->activePuzzleBuffer);
+ this->arr_i16_1eb8[0] = g_zbasic->decodeInt(_activePuzzleBuffer);
}
// 140:04a2
if (this->arr_i16_1eb8[0] < 1) {
@@ -196,10 +196,10 @@ void FoolGame::thoth99Enchantments() {
}
// 140:0532
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_rect_1f38[i].top = puzzlesReadShort();
- this->arr_rect_1f38[i].left = puzzlesReadShort();
- this->arr_rect_1f38[i].bottom = this->arr_rect_1f38[i].top + 0x28;
- this->arr_rect_1f38[i].right = this->arr_rect_1f38[i].left + 0x28;
+ _screenGrid[i].top = puzzlesReadShort();
+ _screenGrid[i].left = puzzlesReadShort();
+ _screenGrid[i].bottom = _screenGrid[i].top + 0x28;
+ _screenGrid[i].right = _screenGrid[i].left + 0x28;
}
// 140:060c
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
@@ -209,8 +209,8 @@ void FoolGame::thoth99Enchantments() {
g_toolbox->PenMode(kPatXor);
for (int16 j = 0; j <= 1; j++) {
g_toolbox->MoveTo(0x104, 0xa2);
- g_toolbox->LineTo(this->arr_rect_1f38[i].left + 0x14, this->arr_rect_1f38[i].top + 0x14);
- g_toolbox->InvertRoundRect(this->arr_rect_1f38[i], 0x14, 0x14);
+ g_toolbox->LineTo(_screenGrid[i].left + 0x14, _screenGrid[i].top + 0x14);
+ g_toolbox->InvertRoundRect(_screenGrid[i], 0x14, 0x14);
g_toolbox->Delay(0);
}
g_toolbox->PenNormal();
@@ -228,15 +228,15 @@ void FoolGame::thoth99Enchantments() {
this->arr_i16_1eb8[1] = 0;
g_zbasic->unk_20();
this->sub_128_4da(1);
- this->stateFlags = kStateNull;
- this->var_i16_d0c = 0;
+ _stateFlags = kStateNull;
+ _activePuzzleSolved = false;
this->var_i16_2326 = 0;
this->var_i16_2328 = 0;
// new value: number of updates before a screen flash
this->arr_i16_1eb8[3] = 0;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:0752
this->var_i32_692 = g_toolbox->TickCount();
this->arr_i16_1eb8[1]++;
@@ -289,74 +289,74 @@ void FoolGame::thoth99Enchantments() {
}
do {
this->getNextEvent(-1);
- if ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & kModMouseButtonUp) == 0) {
this->sub_140_c4c();
}
// 140:0934
if (this->var_i16_2326 != 0) {
this->thothScrambleScreen();
}
- } while (this->var_ev_46.what != 0);
+ } while (_event.what != 0);
// 140:094a
this->sub_128_406(1);
}
// 140:097a
- if (this->var_i16_d0c != 0) {
+ if (_activePuzzleSolved) {
this->sub_140_f84();
- this->activePuzzleBuffer.clear(); // was: 310
+ _activePuzzleBuffer.clear(); // was: 310
} else {
// 140:09a4
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
- this->activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
+ _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
}
// 140:09ee
}
void FoolGame::thothMoveEnchantment() {
// 140:09f0
- g_toolbox->FillRoundRect(this->arr_rect_1f38[this->arr_i16_1eb8[2]], 0x14, 0x14, this->arr_pat_58f4[2]);
- this->arr_rect_1f38[this->arr_i16_1eb8[2]].top = g_zbasic->rndInt(0x11a) + 0x14;
- this->arr_rect_1f38[this->arr_i16_1eb8[2]].left = g_zbasic->rndInt(0x1da);
- this->arr_rect_1f38[this->arr_i16_1eb8[2]].bottom = this->arr_rect_1f38[this->arr_i16_1eb8[2]].top + 0x28;
- this->arr_rect_1f38[this->arr_i16_1eb8[2]].right = this->arr_rect_1f38[this->arr_i16_1eb8[2]].left + 0x28;
+ g_toolbox->FillRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14, _patterns[2]);
+ _screenGrid[this->arr_i16_1eb8[2]].top = g_zbasic->rndInt(0x11a) + 0x14;
+ _screenGrid[this->arr_i16_1eb8[2]].left = g_zbasic->rndInt(0x1da);
+ _screenGrid[this->arr_i16_1eb8[2]].bottom = _screenGrid[this->arr_i16_1eb8[2]].top + 0x28;
+ _screenGrid[this->arr_i16_1eb8[2]].right = _screenGrid[this->arr_i16_1eb8[2]].left + 0x28;
this->thothDrawEnchantment();
}
void FoolGame::thothDrawEnchantment() {
// 140:0b2c
g_toolbox->PenNormal();
- g_toolbox->EraseRoundRect(this->arr_rect_1f38[this->arr_i16_1eb8[2]], 0x14, 0x14);
- g_toolbox->FrameRoundRect(this->arr_rect_1f38[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ g_toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ g_toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
g_zbasic->text(0, 0xc, 0, kSrcOr);
this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(311)
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
// 140:0bd2
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->arr_i16_1eb8[2]].left + 0x14 - (this->var_i16_484 / 2),
- this->arr_rect_1f38[this->arr_i16_1eb8[2]].top + 0x18
+ _screenGrid[this->arr_i16_1eb8[2]].left + 0x14 - (this->var_i16_484 / 2),
+ _screenGrid[this->arr_i16_1eb8[2]].top + 0x18
);
g_toolbox->DrawString(this->var_str_384);
}
void FoolGame::sub_140_c4c() {
// 140:0c4c
- if (this->var_i16_d0c != 0)
+ if (_activePuzzleSolved)
return;
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1f38[this->arr_i16_1eb8[0]])) {
+ if (g_toolbox->PtInRect(_event.where, _screenGrid[this->arr_i16_1eb8[0]])) {
this->arr_i16_1eb8[0]--;
if (this->arr_i16_1eb8[0] <= 0) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
return;
}
this->var_i16_484 = this->arr_i16_1eb8[0] + 1;
- g_toolbox->FillRoundRect(this->arr_rect_1f38[this->var_i16_484], 0x14, 0x14, this->arr_pat_58f4[2]);
- this->sub_128_962(
- this->arr_rect_1f38[this->var_i16_484].top,
- this->arr_rect_1f38[this->var_i16_484].left,
- this->arr_rect_1f38[this->var_i16_484].bottom,
- this->arr_rect_1f38[this->var_i16_484].right,
+ g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x14, 0x14, _patterns[2]);
+ this->zoomRect(
+ _screenGrid[this->var_i16_484].top,
+ _screenGrid[this->var_i16_484].left,
+ _screenGrid[this->var_i16_484].bottom,
+ _screenGrid[this->var_i16_484].right,
0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatXor, 0xd
);
this->arr_i16_1eb8[1] = 0;
@@ -413,14 +413,14 @@ void FoolGame::sub_140_f84() {
// 140:0f84
g_toolbox->PenNormal();
g_toolbox->PenSize(5, 5);
- this->arr_i16_4758[4] = (this->arr_rect_1f38[1].top / 0x19) + 1;
- this->arr_i16_4758[5] = (this->arr_rect_1f38[1].left / 0x19) + 1;
+ this->arr_i16_4758[4] = (_screenGrid[1].top / 0x19) + 1;
+ this->arr_i16_4758[5] = (_screenGrid[1].left / 0x19) + 1;
// 140:0fea
- this->arr_i16_4758[6] = ((SCREEN_HEIGHT - this->arr_rect_1f38[1].bottom) / 0x19) + 1;
- this->arr_i16_4758[7] = ((SCREEN_WIDTH - this->arr_rect_1f38[1].right) / 0x19) + 1;
+ this->arr_i16_4758[6] = ((SCREEN_HEIGHT - _screenGrid[1].bottom) / 0x19) + 1;
+ this->arr_i16_4758[7] = ((SCREEN_WIDTH - _screenGrid[1].right) / 0x19) + 1;
// 140:1066
// unrolled loop
- Common::Rect area = this->arr_rect_1f38[1];
+ Common::Rect area = _screenGrid[1];
// 140:10aa
for (int16 i = 0; i <= 0x1a; i++) {
area.top -= this->arr_i16_4758[4];
@@ -432,7 +432,7 @@ void FoolGame::sub_140_f84() {
}
// 140:11ae
// unrolled loop
- area = this->arr_rect_1f38[1];
+ area = _screenGrid[1];
// 140:11f2
for (int16 i = 0; i <= 0x1a; i++) {
area.top -= this->arr_i16_4758[4];
@@ -451,34 +451,34 @@ void FoolGame::thothKey1st() {
this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
g_zbasic->picture(0, 0x14, this->var_pic_7c2);
if ((this->var_i16_7ce & 2) != 0) {
- g_toolbox->SetCursor(this->arr_curs_4d88[0x10]);
+ g_toolbox->SetCursor(_cursors[0x10]);
}
// 140:1346
g_toolbox->PenSize(5, 5);
g_toolbox->PenMode(kPatXor);
- this->var_ev_46.where = Common::Point(0, 0);
+ _event.where = Common::Point(0, 0);
// 140:139a
while (!(
- (this->var_ev_46.where.x >= 0xff) &&
- (this->var_ev_46.where.y >= 0xa2) &&
- (this->var_ev_46.where.x <= 0x10e) &&
- (this->var_ev_46.where.y <= 0xac)
+ (_event.where.x >= 0xff) &&
+ (_event.where.y >= 0xa2) &&
+ (_event.where.x <= 0x10e) &&
+ (_event.where.y <= 0xac)
)) {
// 140:1366
this->getNextEvent(-1); // was: 0
g_toolbox->MoveTo(0x105, 0xa2);
- g_toolbox->LineTo(this->var_ev_46.where.x, this->var_ev_46.where.y);
+ g_toolbox->LineTo(_event.where.x, _event.where.y);
this->sub_128_3da(2);
g_toolbox->MoveTo(0x105, 0xa2);
- g_toolbox->LineTo(this->var_ev_46.where.x, this->var_ev_46.where.y);
+ g_toolbox->LineTo(_event.where.x, _event.where.y);
}
// 140:13dc
g_toolbox->PenNormal();
if ((this->var_i16_7ce & 2) == 0) {
- this->stateFlags = kStateReturn;
- this->sub_128_962(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
+ _stateFlags = kStateReturn;
+ this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
this->sub_128_3da(0x3c);
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
} else {
// 140:1446
this->var_str_384 = g_zbasic->str(322); // behold ye the book of thoth
@@ -486,14 +486,14 @@ void FoolGame::thothKey1st() {
this->sub_140_2f92();
this->var_i16_7ce ^= 2;
this->var_i16_7b2 = 0xa;
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
// 140:1484
}
void FoolGame::thothKey2nd() {
// 140:1486
- if (this->activePuzzle != 0x34) {
+ if (_activePuzzle != 0x34) {
this->thothAdjustPuzzleData();
}
// FIXME: this looks lethal
@@ -504,15 +504,15 @@ void FoolGame::thothKey2nd() {
this->var_ptr_696 = this->var_ptr_232a + 0x18c;
for (int16 j = 1; j <= 7; j++) {
for (int16 i = 0; i <= 3; i++) {
- this->arr_i16_2f38[j*32+i] = this->puzzlesReadShort();
+ this->arr_i16_2f38[j*32+i] = puzzlesReadShort();
}
}
- this->var_i16_d0c = 0;
+ _activePuzzleSolved = false;
this->var_i16_103a = 0;
- this->stateFlags = kStateNull;
+ _stateFlags = kStateNull;
this->var_i16_232e = 0;
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:1506
// was: SetRect
this->arr_i16_4758[4] = 0x14;
@@ -544,37 +544,37 @@ void FoolGame::thothKey2nd() {
break;
case 3:
// 140:31fa
- g_toolbox->FillRect(this->thothRandomSquare(), this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(this->thothRandomSquare(), _patterns[2]);
break;
case 4:
// 140:321a
- g_toolbox->FillRect(this->thothRandomHRect(), this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(this->thothRandomHRect(), _patterns[2]);
break;
case 5:
// 140:323a
- g_toolbox->FillRect(this->thothRandomVRect(), this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(this->thothRandomVRect(), _patterns[2]);
break;
default:
warning("thothKey2nd: breaking out of switch statement");
break;
}
- if (this->activePuzzle != 0x34) {
+ if (_activePuzzle != 0x34) {
Common::Rect temp;
temp.top = this->arr_i16_2f38[(this->var_i16_103a + 1)*32];
temp.left = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+1];
temp.bottom = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+2];
temp.right = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+3];
- g_toolbox->FillRect(temp, this->arr_pat_58f4[1]);
+ g_toolbox->FillRect(temp, _patterns[1]);
}
// 140:159e
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->sub_140_15fc();
}
if (this->var_i16_103a == 4) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
@@ -593,7 +593,7 @@ void FoolGame::sub_140_15fc() {
temp.bottom = this->arr_i16_2f38[i*32+2];
temp.right = this->arr_i16_2f38[i*32+3];
- if (g_toolbox->PtInRect(this->var_ev_46.where, temp)) {
+ if (g_toolbox->PtInRect(_event.where, temp)) {
this->var_i16_7e4 = i;
}
}
@@ -611,7 +611,7 @@ void FoolGame::sub_140_15fc() {
}
} else {
// 140:1698
- if (this->activePuzzle == 0x34) {
+ if (_activePuzzle == 0x34) {
for (int16 i = 0; i <= 7; i++) {
Common::Rect temp;
temp.top = this->arr_i16_2f38[32*i];
@@ -652,7 +652,7 @@ void FoolGame::sub_140_15fc() {
this->var_i16_1dee = kPatCopy;
}
// 140:1762
- this->sub_128_962(
+ this->zoomRect(
this->arr_i16_2f38[32*this->var_i16_7e4],
this->arr_i16_2f38[32*this->var_i16_7e4+1],
this->arr_i16_2f38[32*this->var_i16_7e4+2],
@@ -686,7 +686,7 @@ void FoolGame::sub_140_15fc() {
void FoolGame::thothKey3rd() {
// 140:18fa
- if (this->activePuzzle != 0x34) {
+ if (_activePuzzle != 0x34) {
this->thothAdjustPuzzleData();
}
// FIXME: this looks lethal
@@ -702,16 +702,16 @@ void FoolGame::thothKey3rd() {
}
// 140:195e
for (int16 i = 0; i <= 3; i++) {
- this->arr_rect_1f38[i].top = 0x14;
- this->arr_rect_1f38[i].left = 0;
- this->arr_rect_1f38[i].bottom = SCREEN_HEIGHT;
- this->arr_rect_1f38[i].right = SCREEN_WIDTH;
+ _screenGrid[i].top = 0x14;
+ _screenGrid[i].left = 0;
+ _screenGrid[i].bottom = SCREEN_HEIGHT;
+ _screenGrid[i].right = SCREEN_WIDTH;
}
// 140:19dc
- this->arr_rect_1f38[0].right = 0xf;
- this->arr_rect_1f38[1].left = 0x1f1;
- this->arr_rect_1f38[2].bottom = 0x23;
- this->arr_rect_1f38[3].top = 0x147;
+ _screenGrid[0].right = 0xf;
+ _screenGrid[1].left = 0x1f1;
+ _screenGrid[2].bottom = 0x23;
+ _screenGrid[3].top = 0x147;
this->arr_i16_4338[1] = 0;
this->arr_i16_4338[9] = 2;
for (int16 i = 0x14; i <= 0x1a; i++) {
@@ -721,12 +721,12 @@ void FoolGame::thothKey3rd() {
// 140:1a9c
this->var_i16_103a = 0;
this->var_i16_232e = 0;
- this->stateFlags = kStateNull;
- this->var_i16_d0c = 0;
+ _stateFlags = kStateNull;
+ _activePuzzleSolved = false;
// 140:1b98
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:1ab8
- if (this->activePuzzle == 0x34) { // in high priestess, no hints
+ if (_activePuzzle == 0x34) { // in high priestess, no hints
this->var_i16_232e++;
if (this->var_i16_232e < 1) {
this->var_i16_232e = 1;
@@ -760,18 +760,18 @@ void FoolGame::thothKey3rd() {
if (this->var_i16_232e > 0x10) {
this->var_i16_232e = 1;
}
- g_toolbox->FillRect(this->arr_rect_1f38[this->var_i16_103a], this->arr_pat_58f4[this->arr_i16_4338[this->var_i16_232e]]);
+ g_toolbox->FillRect(_screenGrid[this->var_i16_103a], _patterns[this->arr_i16_4338[this->var_i16_232e]]);
}
// 140:1b66
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->thothKey3rdOnClick();
}
// 140:1b7a
if (this->var_i16_103a == 4) {
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
}
@@ -781,13 +781,13 @@ void FoolGame::thothKey3rd() {
void FoolGame::thothKey3rdOnClick() {
// 140:1bc4
this->var_i16_2332 = 1;
- if (this->activePuzzle == 0x34) {
- if ((this->var_ev_46.where.x >= 0xf) && (this->var_ev_46.where.y >= 0x2d) && (this->var_ev_46.where.x <= 0x1f1) && (this->var_ev_46.where.y <= 0x147)) {
+ if (_activePuzzle == 0x34) {
+ if ((_event.where.x >= 0xf) && (_event.where.y >= 0x2d) && (_event.where.x <= 0x1f1) && (_event.where.y <= 0x147)) {
this->var_i16_2332 = 0;
}
} else {
// 140:1c22
- if (g_toolbox->PtInRect(this->var_ev_46.where, this->arr_rect_1f38[this->var_i16_103a]) == 0) {
+ if (g_toolbox->PtInRect(_event.where, _screenGrid[this->var_i16_103a]) == 0) {
this->var_i16_2332 = 0;
}
}
@@ -798,50 +798,50 @@ void FoolGame::thothKey3rdOnClick() {
}
// 140:1c66
Common::Rect area(-1, 0x14, SCREEN_WIDTH + 1, SCREEN_HEIGHT + 1);
- if (this->var_ev_46.where.x < 0xf) {
+ if (_event.where.x < 0xf) {
area.right = 0xf;
this->var_i16_1de6 = 0;
}
// 140:1cc6
- if (this->var_ev_46.where.x > 0x1f1) {
+ if (_event.where.x > 0x1f1) {
area.left = 0x1f1;
this->var_i16_1de6 = 1;
}
// 140:1ce6
- if (this->var_ev_46.where.y < 0x2d) {
+ if (_event.where.y < 0x2d) {
area.bottom = 0x2d;
this->var_i16_1de6 = 2;
}
// 140:1d06
- if (this->var_ev_46.where.y > 0x147) {
+ if (_event.where.y > 0x147) {
area.top = 0x147;
this->var_i16_1de6 = 3;
}
// 140:1d26
- while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ while ((_event.modifiers & kModMouseButtonUp) == 0) {
// 140:1d2a
// was: 0
this->getNextEvent(-1);
if (this->var_i16_1de6 == 0) {
- area.right = this->var_ev_46.where.x + 0xa;
+ area.right = _event.where.x + 0xa;
}
if (this->var_i16_1de6 == 1) {
- area.left = this->var_ev_46.where.x - 0xa;
+ area.left = _event.where.x - 0xa;
}
if (this->var_i16_1de6 == 2) {
- area.bottom = this->var_ev_46.where.y + 0xa;
+ area.bottom = _event.where.y + 0xa;
}
if (this->var_i16_1de6 == 3) {
- area.top = this->var_ev_46.where.y - 0xa;
+ area.top = _event.where.y - 0xa;
}
// 140:1dc6
if (area.top < 0x14) {
area.top = 0x14;
}
- g_toolbox->FillRect(area, this->arr_pat_58f4[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
+ g_toolbox->FillRect(area, _patterns[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
// 140:1e2e
if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
- this->var_ev_46.modifiers = kModMouseButtonUp;
+ _event.modifiers = kModMouseButtonUp;
}
// 140:1eae
}
@@ -861,7 +861,7 @@ void FoolGame::sub_140_1f68() {
this->sub_128_50e(0xf, 0x64, 1);
this->var_i16_103a = 0;
g_toolbox->PenSize(0x14, 0x14);
- g_toolbox->PenPat(this->arr_pat_58f4[3]);
+ g_toolbox->PenPat(_patterns[3]);
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x104; i += 0x14) {
area.top = 0x14 + i;
@@ -885,38 +885,38 @@ void FoolGame::sub_140_205e() {
void FoolGame::thothKeyLast() {
// 140:206a
- this->var_i16_d0c = 0;
- this->stateFlags = kStateNull;
+ _activePuzzleSolved = false;
+ _stateFlags = kStateNull;
this->thothKeyLastSetup();
this->sub_140_2978();
this->copyScreen(1, this->arr_bmp_b3ec);
this->arr_i16_1eb8[1] = -1;
- this->var_i16_1de6 = this->arr_i16_3b38[this->hermitPathStage];
- warning("thothKeyLast: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1));
+ this->var_i16_1de6 = this->arr_i16_3b38[_hermitPathStage];
+ warning("thothKeyLast: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1));
// JMP 0x228c
- while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0)) {
+ while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:20c2
do {
- if (this->activePuzzle != 0x34) { // we're in the hermit, print the shape
- this->hermitPathStartIndex = this->arr_i16_3b38[this->hermitPathStage];
- this->hermitPathEndIndex = this->arr_i16_3b38[this->hermitPathStage + 0x20];
+ if (_activePuzzle != 0x34) { // we're in the hermit, print the shape
+ int hermitPathStartIndex = this->arr_i16_3b38[_hermitPathStage]; // var_i16_2334
+ int hermitPathEndIndex = this->arr_i16_3b38[_hermitPathStage + 0x20]; // var_i16_2336
do {
this->getNextEvent(-1);
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[this->hermitPathStartIndex]], this->arr_pat_58f4[this->var_i16_2338]);
- this->hermitPathStartIndex++;
+ g_toolbox->FillRect(_screenGrid[this->arr_i16_3738[hermitPathStartIndex]], _patterns[this->var_i16_2338]);
+ hermitPathStartIndex++;
// we're updating the screen in the event handler, this has no effect
- /*if (this->hermitPathStage == 5) {
- if (this->hermitPathStartIndex % 4 == 0)
+ /*if (_hermitPathStage == 5) {
+ if (hermitPathStartIndex % 4 == 0)
g_toolbox->Delay(0);
} else {
- if (this->hermitPathStartIndex % 8 == 0)
+ if (hermitPathStartIndex % 8 == 0)
g_toolbox->Delay(0);
}*/
// 140:2168
- } while (!((this->var_ev_46.what == 1) || (this->hermitPathStartIndex > this->hermitPathEndIndex) || ((this->stateFlags & kStateReturn) != 0)));
+ } while (!((_event.what == 1) || (hermitPathStartIndex > hermitPathEndIndex) || ((_stateFlags & kStateReturn) != 0)));
// 140:219e
- if ((this->var_ev_46.what == 0) && ((this->stateFlags & kStateReturn) == 0)) {
- if (this->hermitPathStage != 5) {
+ if ((_event.what == 0) && ((_stateFlags & kStateReturn) == 0)) {
+ if (_hermitPathStage != 5) {
g_toolbox->Delay(0x7d*60/1000);
} else {
g_toolbox->Delay(0xfa*60/1000);
@@ -930,23 +930,23 @@ void FoolGame::thothKeyLast() {
this->var_i16_68a = g_zbasic->rndInt(0x14) - 1;
this->var_i16_68c = g_zbasic->rndInt(0xe) - 1;
// 140:2222
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], this->arr_pat_58f4[this->var_i16_484]);
+ g_toolbox->FillRect(_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], _patterns[this->var_i16_484]);
this->getNextEvent(-1);
}
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->thothKeyLastOnClick();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->saveGame();
}
// 140:228c
- } while (((this->stateFlags & kStateReturn) == 0) && (this->var_i16_d0c == 0));
+ } while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved);
}
}
void FoolGame::thothKeyLastOnClick() {
// 140:22b8
- while (((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1))) {
+ while (((_event.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1))) {
// 140:22bc
this->getNextEvent(-1); // was: 0
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -962,15 +962,15 @@ void FoolGame::thothKeyLastOnClick() {
// 140:23aa
this->arr_i16_1eb8[1] = this->arr_i16_1eb8[0];
this->sub_128_50e(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_1eb8[0]], this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[2]);
this->var_i16_1de6++;
- warning("thothKeyLastOnClick: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1));
+ warning("thothKeyLastOnClick: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1));
}
}
// 140:2422
}
// 140:2472
- if (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + this->hermitPathStage] + 1)) {
+ if (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1)) {
this->thothBadSelect();
} else {
this->hermitNextStage();
@@ -980,48 +980,48 @@ void FoolGame::thothKeyLastOnClick() {
void FoolGame::thothBadSelect() {
// 140:24ae
this->sub_128_50e(0x14, 0x64, 0x0);
- while ((this->var_ev_46.modifiers & kModMouseButtonUp) == 0) {
+ while ((_event.modifiers & kModMouseButtonUp) == 0) {
// 140:24c4
this->getNextEvent(-1);
this->var_i16_484 = g_zbasic->rndInt(0x50);
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_1eb8[0]], this->arr_pat_58f4[this->var_i16_484]);
+ g_toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[this->var_i16_484]);
}
// 140:2520
- if (this->activePuzzle != 0x34) {
+ if (_activePuzzle != 0x34) {
this->copyScreen(1, this->arr_bmp_b3ec);
} else {
- for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[this->hermitPathStage]; i--) {
+ for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[_hermitPathStage]; i--) {
this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
- g_toolbox->FillRect(this->arr_rect_1f38[this->arr_i16_3738[i]], this->arr_pat_58f4[this->var_i16_484]);
+ g_toolbox->FillRect(_screenGrid[this->arr_i16_3738[i]], _patterns[this->var_i16_484]);
}
}
// 140:25b4
this->arr_i16_1eb8[1] = -1;
- this->var_i16_1de6 = this->arr_i16_3b38[this->hermitPathStage];
+ this->var_i16_1de6 = this->arr_i16_3b38[_hermitPathStage];
}
void FoolGame::hermitNextStage() {
// 140:25e4
- if (this->activePuzzle == 0x34) {
- this->var_i16_d0c = 1;
+ if (_activePuzzle == 0x34) {
+ _activePuzzleSolved = true;
return;
}
// 140:25f6
- if (this->hermitPathStage < 5) {
+ if (_hermitPathStage < 5) {
this->hermitScreenFlash();
}
- if (this->hermitPathStage == 4) {
+ if (_hermitPathStage == 4) {
this->hermitScreenZoom();
}
- if (this->hermitPathStage == 5) {
+ if (_hermitPathStage == 5) {
this->hermitScreenBehold();
}
- if (this->hermitPathStage == 6) {
+ if (_hermitPathStage == 6) {
this->sub_140_2968();
}
- if (this->var_i16_d0c == 0) {
- this->hermitPathStage++;
- if (this->hermitPathStage == 6) {
+ if (!_activePuzzleSolved) {
+ _hermitPathStage++;
+ if (_hermitPathStage == 6) {
this->thothKeyLastSetup();
}
this->sub_140_2978();
@@ -1065,21 +1065,21 @@ void FoolGame::hermitScreenZoom() {
}
}
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
this->var_i16_1de6 = 0;
this->sub_128_4da(1);
}
void FoolGame::hermitScreenBehold() {
// 140:28bc
- if (this->puzzleCompletionStatus[0x68] > 4) {
+ if (_puzzleCompletionStatus[0x68] > 4) {
this->sub_128_6186();
this->sub_128_2664();
this->sub_128_d34(0x29, 0x37, 0x142, 0x1c9, 0x96);
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
} else {
// 140:290c
- this->sub_128_962(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
+ this->zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
this->var_str_384 = g_zbasic->str(323); // behold the last key of thoth
this->sub_128_178a(0x48, 2);
}
@@ -1090,13 +1090,13 @@ void FoolGame::sub_140_2968() {
// 140:2968
this->sub_128_2664();
this->sub_128_61c2();
- this->var_i16_d0c = 1;
+ _activePuzzleSolved = true;
}
void FoolGame::sub_140_2978() {
// 140:2978
this->sub_128_6186();
- if (this->hermitPathStage < 6) {
+ if (_hermitPathStage < 6) {
this->var_i16_2338 = 1;
} else {
this->var_i16_2338 = 2;
@@ -1105,7 +1105,7 @@ void FoolGame::sub_140_2978() {
void FoolGame::thothKeyLastSetup() {
// 140:2998
- if (this->hermitPathStage != 6) {
+ if (_hermitPathStage != 6) {
this->sub_128_271a();
this->arr_i16_1eb8[4] = 0x37;
this->arr_i16_1eb8[5] = 0x29;
@@ -1118,26 +1118,26 @@ void FoolGame::thothKeyLastSetup() {
this->arr_i16_1eb8[12] = 0x15;
this->arr_i16_1eb8[13] = 0x15;
for (int16 i = 0; i <= 0x13; i++) {
- this->arr_i16_5bbc[i] = this->puzzlesReadShort();
+ this->arr_i16_5bbc[i] = puzzlesReadShort();
}
for (int16 i = 0; i <= 0xd; i++) {
- this->arr_i16_5cbc[i] = this->puzzlesReadShort();
+ this->arr_i16_5cbc[i] = puzzlesReadShort();
}
// 140:2aa4
for (int16 i = 0; i <= 0xcd; i++) {
- this->arr_i16_3738[i] = this->puzzlesReadShort();
+ this->arr_i16_3738[i] = puzzlesReadShort();
this->arr_i16_3738[i] = (this->arr_i16_3738[i]/4) + 1;
}
// 140:2b06
for (int16 i = 1; i <= 6; i++) {
- this->arr_i16_3b38[i] = this->puzzlesReadShort();
- this->arr_i16_3b38[0x20 + i] = this->puzzlesReadShort();
+ this->arr_i16_3b38[i] = puzzlesReadShort();
+ this->arr_i16_3b38[0x20 + i] = puzzlesReadShort();
}
// 140:2b54
} else { // last key of thoth
// 140:2b58
- if (this->activePuzzle != 0x34) { // in the hermit
+ if (_activePuzzle != 0x34) { // in the hermit
this->thothAdjustPuzzleData();
}
// FIXME: some kind of manual bodge for the puzzle data loader,
@@ -1148,17 +1148,17 @@ void FoolGame::thothKeyLastSetup() {
this->var_bytes_696 = this->var_bytes_232a;
this->var_ptr_696 = this->var_ptr_232a + 0x1e4;
for (int16 i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[i] = puzzlesReadShort();
}
for (int16 i = 0; i <= 0x13; i++) {
- this->arr_i16_5bbc[i] = this->puzzlesReadShort();
+ this->arr_i16_5bbc[i] = puzzlesReadShort();
}
for (int16 i = 0; i <= 0xd; i++) {
- this->arr_i16_5cbc[i] = this->puzzlesReadShort();
+ this->arr_i16_5cbc[i] = puzzlesReadShort();
}
// 140:2bfe
for (int16 i = 0x9c; i <= 0xcd; i++) {
- this->arr_i16_3738[i] = this->puzzlesReadShort();
+ this->arr_i16_3738[i] = puzzlesReadShort();
}
this->arr_i16_3b38[6] = 0x9c;
this->arr_i16_3b38[6+0x20] = 0xcd;
@@ -1171,7 +1171,7 @@ void FoolGame::thothKeyLastSetup() {
do {
this->var_i16_484++;
g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
+ _screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
this->var_i16_68a + this->arr_i16_1eb8[0xd],
@@ -1190,12 +1190,12 @@ void FoolGame::thothKeyLastSetup() {
}
}
// 140:2d94
- if (this->hermitPathStage != 6) {
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ if (_hermitPathStage != 6) {
+ g_toolbox->PenPat(_patterns[1]);
for (int16 j = 0; j <= 0x13; j++) {
for (int16 i = 0; i <= 0xd; i++) {
- g_toolbox->EraseRect(this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
- g_toolbox->FrameRect(this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ g_toolbox->EraseRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ g_toolbox->FrameRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
}
}
} else {
@@ -1206,8 +1206,8 @@ void FoolGame::thothKeyLastSetup() {
// 140:2e8c
this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
g_toolbox->FillRect(
- this->arr_rect_1f38[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
- this->arr_pat_58f4[this->var_i16_484]
+ _screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
+ _patterns[this->var_i16_484]
);
this->var_i16_68a++;
if (this->var_i16_68a > 0x13) {
@@ -1218,7 +1218,7 @@ void FoolGame::thothKeyLastSetup() {
}
}
// 140:2f2e
- if ((this->hermitPathStage == 6) && (this->activePuzzle != 0x34)) {
+ if ((_hermitPathStage == 6) && (_activePuzzle != 0x34)) {
g_zbasic->menu(8, 0, 1, g_zbasic->str(324)); // the last key of thoth
g_zbasic->menu(8, 1, 1, g_zbasic->str(325)); // return to scroll
}
@@ -1273,7 +1273,7 @@ Common::Rect FoolGame::thothRandomVRect() {
void FoolGame::sub_140_3296() {
// 140:3296
- if (!screenOversized) {
+ if (!_screenOversized) {
g_toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
@@ -1299,7 +1299,7 @@ void FoolGame::sub_140_32ac() {
this->sub_128_406(1);
}
// 140:334a
- g_toolbox->FillRect(area, this->arr_pat_58f4[2]);
+ g_toolbox->FillRect(area, _patterns[2]);
this->sub_128_4da(1);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -1307,11 +1307,11 @@ void FoolGame::sub_140_32ac() {
void FoolGame::thothAdjustPuzzleData() {
// 140:3372
// change puzzle data pointer to use high priestess data
- this->var_i16_484 = (this->puzzleDataOffsets[0x34] - 1) / 1000;
- this->var_i16_7e4 = (this->puzzleDataOffsets[0x34] - 1) % 1000;
+ this->var_i16_484 = (_puzzleDataOffsets[0x34] - 1) / 1000;
+ this->var_i16_7e4 = (_puzzleDataOffsets[0x34] - 1) % 1000;
g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
//this->var_bytes_696 = this->arr_bytes_109dc;
- this->var_bytes_696 = g_zbasic->readFile(1, this->puzzleDataOffsets[0x35] - this->puzzleDataOffsets[0x34]);
+ this->var_bytes_696 = g_zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
this->var_ptr_696 = 0;
this->var_bytes_232a = this->var_bytes_696;
this->var_ptr_232a = this->var_ptr_696;
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index a2b7a0636f9..83b50c66363 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -34,9 +34,9 @@ extern Toolbox *g_toolbox;
void FoolGame::wordSearchRun() {
// 131:0004
this->sub_128_271a();
- this->var_str_188e = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->var_str_188e = puzzlesReadString().decode(Common::kMacRoman);
for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = this->puzzlesReadShort();
+ this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 131:0042
this->var_i16_484 = 0;
@@ -46,7 +46,7 @@ void FoolGame::wordSearchRun() {
do {
this->var_i16_484++;
g_toolbox->SetRect(
- this->arr_rect_1f38[this->var_i16_484],
+ _screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
this->var_i16_68a + this->arr_i16_1eb8[0xd] - 1,
@@ -67,15 +67,15 @@ void FoolGame::wordSearchRun() {
// 131:01b6
// total hidden word count
- this->var_i16_198e = this->puzzlesReadShort();
- if (this->activePuzzleBuffer.empty()) { // was: str(191)
- this->activePuzzleBuffer = g_zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
+ this->var_i16_198e = puzzlesReadShort();
+ if (_activePuzzleBuffer.empty()) { // was: str(191)
+ _activePuzzleBuffer = g_zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
} else {
// 131:01f2
- this->arr_i16_4758[0] = g_zbasic->decodeInt(g_zbasic->midStr(this->activePuzzleBuffer, this->var_i16_198e + 1, 2));
+ this->arr_i16_4758[0] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_198e + 1, 2));
for (int i = 1; i <= this->arr_i16_4758[0]; i++) {
this->arr_i16_4758[i] = g_zbasic->decodeInt(g_zbasic->midStr(
- this->activePuzzleBuffer,
+ _activePuzzleBuffer,
this->var_i16_198e + 1 + i*2,
2
));
@@ -88,7 +88,7 @@ void FoolGame::wordSearchRun() {
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
// 131:029a
- if ((this->arr_i16_4758[this->var_i16_106a] & this->bitLUT[this->var_i16_484]) != 0) {
+ if ((this->arr_i16_4758[this->var_i16_106a] & _bitLUT[this->var_i16_484]) != 0) {
this->arr_i16_2f38[i*32 + j] = 1;
}
// 131:02e8
@@ -107,7 +107,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_1990 = 0;
this->var_i16_68a = 1;
for (int i = 1; i <= this->var_i16_198e; i++) {
- this->arr_i16_3738[i] = g_zbasic->castInt(g_zbasic->midStr(this->activePuzzleBuffer, i, 1));
+ this->arr_i16_3738[i] = g_zbasic->castInt(g_zbasic->midStr(_activePuzzleBuffer, i, 1));
if (this->arr_i16_3738[i] != 0) {
this->var_i16_1990++;
}
@@ -116,7 +116,7 @@ void FoolGame::wordSearchRun() {
// 131:039e
this->var_i16_1992 = 1;
do {
- g_zbasic->indexSet(this->puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
+ g_zbasic->indexSet(puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
g_zbasic->indexSet(g_zbasic->str(192), 1, this->var_i16_1992); // blank string
this->var_i16_484 = 1;
do {
@@ -142,19 +142,20 @@ void FoolGame::wordSearchRun() {
this->var_str_384 = this->var_str_188e;
this->wordSearchDrawFooter();
g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenMode(kPatBic);
g_zbasic->unk_20();
// 131:04e0
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- this->var_str_1994 = this->puzzlesReadString().decode(Common::kMacRoman);
+ this->var_str_1994 = puzzlesReadString().decode(Common::kMacRoman);
this->var_i16_1574 = 1 + (j - 1) * this->arr_i16_1eb8[0];
// 131:051e
- this->arr_rect_5b7c.top = this->arr_rect_1f38[this->var_i16_1574].top - 1;
- this->arr_rect_5b7c.left = 0;
- this->arr_rect_5b7c.bottom = this->arr_rect_1f38[this->var_i16_1574].bottom + 1;
- this->arr_rect_5b7c.right = SCREEN_WIDTH;
- g_toolbox->FillRect(this->arr_rect_5b7c, this->arr_pat_58f4[0]);
+ Common::Rect temp; // arr_rect_5b7c
+ temp.top = _screenGrid[this->var_i16_1574].top - 1;
+ temp.left = 0;
+ temp.bottom = _screenGrid[this->var_i16_1574].bottom + 1;
+ temp.right = SCREEN_WIDTH;
+ g_toolbox->FillRect(temp, _patterns[0]);
// 131:05b0
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->var_i16_1574 = i + (j - 1) * this->arr_i16_1eb8[0];
@@ -162,13 +163,13 @@ void FoolGame::wordSearchRun() {
this->arr_i16_3b38[i*32 + j] = g_zbasic->asc(this->var_str_384);
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
- this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ _screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
+ _screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
g_toolbox->DrawString(this->var_str_384);
// 131:069e
if (this->arr_i16_2f38[i*32 + j] != 0) {
- g_toolbox->PaintRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->PaintRect(_screenGrid[this->var_i16_1574]);
}
// 131:06dc
}
@@ -183,7 +184,7 @@ void FoolGame::wordSearchRun() {
}
// 131:077a
this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_198e);
- if (this->activePuzzle != 0x50) {
+ if (_activePuzzle != 0x50) {
// There are X words hidden below
this->var_str_384 = g_zbasic->str(196) + this->var_str_9f4 + g_zbasic->str(197);
g_zbasic->menu(8, 3, 1, this->var_str_384);
@@ -195,16 +196,16 @@ void FoolGame::wordSearchRun() {
g_zbasic->menu(8, 4, 1, g_zbasic->str(201));
}
// 131:084c
- this->stateFlags = kStateNull;
- while ((this->stateFlags & kStateReturn) == 0) {
+ _stateFlags = kStateNull;
+ while ((_stateFlags & kStateReturn) == 0) {
this->getNextEvent(-1);
- if (this->var_ev_46.what == 1) {
+ if (_event.what == 1) {
this->wordSearchOnClick();
}
if (this->var_i16_1990 == this->var_i16_198e) {
this->wordSearchSuccess();
}
- if (this->stateFlags == kStateSaveGame) {
+ if (_stateFlags == kStateSaveGame) {
this->wordSearchStoreState();
this->saveGame();
}
@@ -223,7 +224,7 @@ void FoolGame::wordSearchOnClick() {
this->var_i16_1a96 = -1;
this->var_i16_1a98 = -1;
- while ((this->var_ev_46.modifiers & 0x80) == 0) {
+ while ((_event.modifiers & 0x80) == 0) {
// 131:08d4
this->getNextEvent(0);
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
@@ -234,7 +235,7 @@ void FoolGame::wordSearchOnClick() {
this->var_i16_1a96 = this->var_i16_68a;
this->var_i16_1a98 = this->var_i16_68c;
this->var_str_1070 += g_zbasic->chr(this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]);
- g_toolbox->InvertRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
this->var_i16_1a94++;
// 131:09c4
this->arr_i16_4338[this->var_i16_1a94] = this->var_i16_1574;
@@ -278,7 +279,7 @@ void FoolGame::wordSearchOnClick() {
}
// found a word, update the screen
g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_58f4[1]);
+ g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenMode(kPatBic);
// for every letter in the word
for (int i = 1; i <= this->var_i16_1a94; i++) {
@@ -286,9 +287,9 @@ void FoolGame::wordSearchOnClick() {
this->sub_128_50e(0xa + g_zbasic->rndInt(0x3e8), 0x28, 1);
// 131:0b54
// remove the inverted square
- g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
// paint the square with white checkerboard
- g_toolbox->PaintRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ g_toolbox->PaintRect(_screenGrid[this->arr_i16_4338[i]]);
this->var_i16_484 = ((this->arr_i16_4338[i] - 1) % this->arr_i16_1eb8[0]) + 1;
// 131:0bce
this->var_i16_7e4 = ((this->arr_i16_4338[i] - 1) / this->arr_i16_1eb8[0]) + 1;
@@ -315,7 +316,7 @@ void FoolGame::wordSearchBadSelect() {
this->sub_128_50e(0x14, 0x64, 0);
// uninvert all highlighted boxes
for (int i = 1; i <= this->var_i16_1a94; i++) {
- g_toolbox->InvertRect(this->arr_rect_1f38[this->arr_i16_4338[i]]);
+ g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
}
// 131:0d0a
this->var_i16_1a96 = -1;
@@ -334,10 +335,10 @@ void FoolGame::wordSearchDrawFooter() {
void FoolGame::wordSearchStoreState() {
// 131:0d66
- this->activePuzzleBuffer = g_zbasic->str(206); // empty
+ _activePuzzleBuffer = g_zbasic->str(206); // empty
for (int i = 1; i <= this->var_i16_198e; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_3738[i]);
- this->activePuzzleBuffer += g_zbasic->rightStr(this->var_str_384, 1);
+ _activePuzzleBuffer += g_zbasic->rightStr(this->var_str_384, 1);
}
// 131:0dd6
this->var_i16_484 = 0;
@@ -347,7 +348,7 @@ void FoolGame::wordSearchStoreState() {
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
if (this->arr_i16_2f38[i*32 + j] != 0) {
- this->arr_i16_4758[this->var_i16_106a] |= this->bitLUT[this->var_i16_484];
+ this->arr_i16_4758[this->var_i16_106a] |= _bitLUT[this->var_i16_484];
}
// 131:0e72
this->var_i16_484++;
@@ -364,14 +365,14 @@ void FoolGame::wordSearchStoreState() {
debugC(5, kDebugLoading, "wordSearchStoreState:");
for (int i = 0; i <= this->arr_i16_4758[0]; i++) {
debugCN(5, kDebugLoading, "%04x ", this->arr_i16_4758[i]);
- this->activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_4758[i]);
+ _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_4758[i]);
}
}
void FoolGame::wordSearchSuccess() {
// 131:0f42
- if (this->var_i16_c04 < 0x64) {
- this->var_i16_c04 = 0x64;
+ if (_activePuzzleStatus < 0x64) {
+ _activePuzzleStatus = 0x64;
}
// 131:0f52
this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
@@ -381,10 +382,10 @@ void FoolGame::wordSearchSuccess() {
if (this->arr_i16_2f38[i*32 + j] != 0) {
// 131:0fc8
this->var_i16_1574 = i + (j - 1)* this->arr_i16_1eb8[0];
- g_toolbox->EraseRect(this->arr_rect_1f38[this->var_i16_1574]);
+ g_toolbox->EraseRect(_screenGrid[this->var_i16_1574]);
g_toolbox->MoveTo(
- this->arr_rect_1f38[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
- this->arr_rect_1f38[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ _screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
+ _screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
// 131:107a
this->var_str_384 = g_zbasic->chr(this->arr_i16_3b38[i*32 + j]);
@@ -397,7 +398,7 @@ void FoolGame::wordSearchSuccess() {
this->fillRect(0x1eb, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
this->sub_128_2664();
this->sub_128_61c2();
- this->stateFlags = kStateReturn;
+ _stateFlags = kStateReturn;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 31a21f0ee95..4b4600b8703 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -69,12 +69,12 @@ ZBasic::~ZBasic() {
}
void ZBasic::loadProgram(const Common::Path &path) {
- _fileId = this->_toolbox->OpenResFile(path);
+ _fileId = _toolbox->OpenResFile(path);
if (_fileId == -1) {
warning("ZBasic::loadProgram: unable to open %s", path.toString(':').c_str());
return;
}
- Handle scotRes = this->_toolbox->GetResource(MKTAG('S', 'C', 'O', 'T'), 1);
+ Handle scotRes = _toolbox->GetResource(MKTAG('S', 'C', 'O', 'T'), 1);
if (!scotRes) {
warning("ZBasic::loadProgram: could not find SCOT chunk");
return;
@@ -85,9 +85,9 @@ void ZBasic::loadProgram(const Common::Path &path) {
Common::MemoryReadStream *scot = new Common::MemoryReadStream(scotRes->data(), scotRes->size());
- this->_dataTable.clear();
- this->_dataPtr = 0;
- this->_stringTable.clear();
+ _dataTable.clear();
+ _dataPtr = 0;
+ _stringTable.clear();
bool hasStringTable = false;
while (scot->pos() < scot->size()) {
uint32 offset = scot->pos();
@@ -98,8 +98,8 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
switch (opcode) {
case kDatumNULL:
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, NULL\n", this->_dataTable.size(), offset);
- this->_dataTable.push_back(ZBasicDatum::newNull(offset));
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, NULL\n", _dataTable.size(), offset);
+ _dataTable.push_back(ZBasicDatum::newNull(offset));
break;
case kDatumINT:
{
@@ -107,12 +107,12 @@ void ZBasic::loadProgram(const Common::Path &path) {
Common::SharedPtr<ZBasicDatum> result;
if (size == 0) {
result = ZBasicDatum::newInt(offset, 0);
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
- this->_dataTable.push_back(result);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", _dataTable.size(), offset, result->data.i16);
+ _dataTable.push_back(result);
} else if (size == 2) {
result = ZBasicDatum::newInt(offset, scot->readSint16BE());
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i16);
- this->_dataTable.push_back(result);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", _dataTable.size(), offset, result->data.i16);
+ _dataTable.push_back(result);
} else {
warning("ZBasic::loadProgram: unexpected size for int %d", size);
scot->skip(size);
@@ -125,12 +125,12 @@ void ZBasic::loadProgram(const Common::Path &path) {
Common::SharedPtr<ZBasicDatum> result;
if (size == 0) {
result = ZBasicDatum::newDblInt(offset, 0);
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
- this->_dataTable.push_back(result);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", _dataTable.size(), offset, result->data.i32);
+ _dataTable.push_back(result);
} else if (size == 4) {
result = ZBasicDatum::newDblInt(offset, scot->readSint32BE());
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", this->_dataTable.size(), offset, result->data.i32);
- this->_dataTable.push_back(result);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, %d\n", _dataTable.size(), offset, result->data.i32);
+ _dataTable.push_back(result);
} else {
warning("ZBasic::loadProgram: unexpected size for dblint %d", size);
scot->skip(size);
@@ -143,16 +143,16 @@ void ZBasic::loadProgram(const Common::Path &path) {
char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
Common::SharedPtr<ZBasicDatum> result = ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman));
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, \"%s\"\n", this->_dataTable.size(), offset, result->data.str->encode().c_str());
- this->_dataTable.push_back(result);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, \"%s\"\n", _dataTable.size(), offset, result->data.str->encode().c_str());
+ _dataTable.push_back(result);
free(buf);
}
break;
case kDatumBCD:
{
scot->seek(-1);
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, BCD\n", this->_dataTable.size(), offset);
- this->_dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _dataTable[%d]: offset %d, BCD\n", _dataTable.size(), offset);
+ _dataTable.push_back(ZBasicDatum::newBcd(offset, ZBasicBCD::read(scot)));
}
break;
default:
@@ -168,8 +168,8 @@ void ZBasic::loadProgram(const Common::Path &path) {
char *buf = (char*)calloc(size+1, 1);
scot->read(buf, size);
Common::SharedPtr<ZBasicDatum> result = ZBasicDatum::newStr(offset, Common::convertToU32String(buf, Common::kMacRoman));
- debugC(5, kDebugLoading, "ZBasic::loadProgram: _stringTable[%d]: offset %d, \"%s\"\n", this->_stringTable.size(), offset, result->data.str->encode().c_str());
- this->_stringTable.push_back(result);
+ debugC(5, kDebugLoading, "ZBasic::loadProgram: _stringTable[%d]: offset %d, \"%s\"\n", _stringTable.size(), offset, result->data.str->encode().c_str());
+ _stringTable.push_back(result);
offset += size + 1;
free(buf);
scot->skip(scot->pos() % 2);
@@ -205,14 +205,14 @@ void ZBasic::bufferFlush(const Common::U32String &str) {
}
void ZBasic::close(int16 fileNo) {
- if (this->_fileStreams.contains(fileNo)) {
- this->_fileStreams.erase(fileNo);
+ if (_fileStreams.contains(fileNo)) {
+ _fileStreams.erase(fileNo);
}
- if (this->_fileWriteStreams.contains(fileNo)) {
- this->_fileWriteStreams.erase(fileNo);
+ if (_fileWriteStreams.contains(fileNo)) {
+ _fileWriteStreams.erase(fileNo);
}
- if (this->_fileLineSize.contains(fileNo)) {
- this->_fileLineSize.erase(fileNo);
+ if (_fileLineSize.contains(fileNo)) {
+ _fileLineSize.erase(fileNo);
}
}
Commit: 92faa181adeec286374102cc3ff9effbee57fbdc
https://github.com/scummvm/scummvm/commit/92faa181adeec286374102cc3ff9effbee57fbdc
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:26+02:00
Commit Message:
FOOL: Slightly more finale
Changed paths:
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_thoth.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 3d195c639e1..9b75bd5f4ea 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -36,7 +36,7 @@ void FoolGame::deathRun() {
this->sub_128_55c(g_zbasic->str(334));
g_toolbox->InvertRect(this->arr_rect_1910c);
g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
- g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kPutCopy);
+ g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
this->deathDrawZoom();
this->fillRect(0x14f, 0, 0x156, 0x7, 0x2);
this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
@@ -46,7 +46,7 @@ void FoolGame::deathRun() {
this->arr_rect_1eb8.right = 0x1a8;
// 141:0122
g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
_event.where.y = 0x14;
// JMP 0x3c2
while (true) {
@@ -104,7 +104,7 @@ void FoolGame::deathRun() {
// JMP 0x9a2
// 141:09a2
this->deathDrawWhiteEye();
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
this->deathDrawZoom();
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
@@ -136,7 +136,7 @@ void FoolGame::deathRun() {
void FoolGame::deathMoveBlackEye() {
// 141:03ca
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
this->var_i16_68a = _event.where.x - 0xc - this->arr_rect_1eb8.left;
this->var_i16_68c = _event.where.y - 8 - this->arr_rect_1eb8.top;
// 141:0452
@@ -152,14 +152,14 @@ void FoolGame::deathMoveBlackEye() {
if (this->var_i16_68a > 6) {
this->var_i16_68a = 6;
}
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:04ce
this->arr_rect_1ec0.top = this->arr_rect_1eb8.top + this->var_i16_68c;
this->arr_rect_1ec0.left = this->arr_rect_1eb8.left + this->var_i16_68a;
this->arr_rect_1ec0.bottom = this->arr_rect_1eb8.bottom + this->var_i16_68c;
this->arr_rect_1ec0.right = this->arr_rect_1eb8.right + this->var_i16_68a;
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:05a2
if (this->arr_rect_1ec0.top < 0x14) {
this->arr_rect_1ec0.top = 0x14;
@@ -179,15 +179,15 @@ void FoolGame::deathMoveBlackEye() {
this->arr_rect_1ec0.left = 0x1e8;
this->arr_rect_1ec0.right = 0x200;
}
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:06bc
if (!((this->arr_rect_1eb8.top == this->arr_rect_1ec0.top) &&
((this->arr_rect_1eb8.left == this->arr_rect_1ec0.left)))) {
// 141:0722
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
this->arr_rect_1eb8 = this->arr_rect_1ec0;
g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
this->sub_128_3da(1);
}
// 141:0880
@@ -196,7 +196,7 @@ void FoolGame::deathMoveBlackEye() {
void FoolGame::deathDrawWhiteEye() {
// 141:0882
if (this->var_i16_233a != 0) {
- g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kPutCopy);
+ g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
}
// 141:08b0
this->var_i16_233a = 0;
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index a5941c21845..300c7ab3c92 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -242,7 +242,7 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
// 128:00e6
if (put == 1) {
- g_zbasic->put(0, 0, bmp, kPutCopy);
+ g_zbasic->put(0, 0, bmp, kSrcCopy);
}
}
@@ -1106,7 +1106,7 @@ void FoolGame::storyRenderPage() {
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
if (this->var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
- g_zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kPutCopy);
+ g_zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kSrcCopy);
}
// 128:252a
// y-position where the story text should start
@@ -2302,7 +2302,7 @@ void FoolGame::shipsRun() {
this->var_i16_d08 = g_zbasic->rndInt(5) + 5;
this->var_i16_d0a = g_zbasic->rndInt(5) - 0xa;
for (int16 i = 0; i <= 5; i++) {
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->sub_128_5a6c();
}
@@ -2333,7 +2333,7 @@ void FoolGame::shipsRun() {
if (_activePuzzleSolved) {
this->sub_128_6186();
this->sub_128_50e(0x14, 0x64, 0);
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
_event.where.x += 5;
_event.where.y -= 5;
if (_activePuzzleStatus < 0x64) {
@@ -2418,7 +2418,7 @@ void FoolGame::sub_128_55ac() {
}
// 128:56a0
for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->sub_128_5a6c();
}
@@ -2435,7 +2435,7 @@ void FoolGame::sub_128_57a2() {
this->var_str_d12 = g_zbasic->ucase(g_zbasic->chr(_keyLastPressed));
if (g_zbasic->instr(1, g_zbasic->str(105), this->var_str_d12) > 0) { // NESW
// 128:57e0
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kPutCopy);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
this->var_i16_d08 = 0;
this->var_i16_d0a = 0;
if (this->var_str_d12 == g_zbasic->str(106)) { // N
@@ -2495,7 +2495,7 @@ void FoolGame::sub_128_5a6c() {
//Common::fill(fakePal+3, fakePal+768, 0x00);
//this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kPutXOR);
+ g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
this->sub_128_406(0);
}
@@ -2972,12 +2972,12 @@ void FoolGame::sub_129_068() {
// unfurl the scroll by blitting the lower half a bunch of times
for (int i = 0; i <= 0x15; i++) {
this->var_i16_484 = g_zbasic->readDataInt();
- g_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kPutCopy);
+ g_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kSrcCopy);
this->sub_128_3da(2);
}
// 129:0888
- g_zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kPutCopy);
- g_zbasic->put(0x1f9, 0x14f, this->arr_bmp_109dc, kPutCopy);
+ g_zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kSrcCopy);
+ g_zbasic->put(0x1f9, 0x14f, this->arr_bmp_109dc, kSrcCopy);
g_zbasic->picture(0x39, 0x29, this->arr_i32_192c0[1]);
// 129:08ee
@@ -3329,7 +3329,7 @@ void FoolGame::sub_144_004() {
var_i16_42 + (int16)(i*0.6f),
SCREEN_WIDTH - i,
SCREEN_HEIGHT - (int16)(i*0.6f),
- arr_bmp_5dfc, kPutCopy);
+ arr_bmp_5dfc, kSrcCopy);
// 144:015a
sub_128_406(0xf);
}
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index a19d6508687..ce2ab5e669c 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -86,7 +86,7 @@ void FoolGame::humbugTrail() {
this->arr_i16_9894[i],
this->arr_i16_ac1c[i],
this->arr_bmp_b3ec,
- kPutCopy
+ kSrcCopy
);
// Simulate slow draw speed
if ((i % 42) == 0)
@@ -98,7 +98,7 @@ void FoolGame::humbugTrail() {
this->arr_i16_9894[this->var_i16_233c],
this->arr_i16_ac1c[this->var_i16_233c],
this->arr_bmp_b3ec,
- kPutCopy
+ kSrcCopy
);
this->var_i16_233c = 1;
_stateFlags = kStateNull;
@@ -157,7 +157,7 @@ void FoolGame::sub_142_370() {
this->arr_i16_9894[this->var_i16_7a8],
this->arr_i16_ac1c[this->var_i16_7a8],
this->arr_bmp_b3ec,
- kPutCopy
+ kSrcCopy
);
// 142:051c
} while (g_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
@@ -175,7 +175,7 @@ void FoolGame::sub_142_370() {
this->arr_i16_9894[i],
this->arr_i16_ac1c[i],
this->arr_bmp_b3ec,
- kPutCopy
+ kSrcCopy
);
// 142:05c8
}
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index bb4b779f7d3..437724810b1 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -105,7 +105,7 @@ void FoolGame::jigsawRun() {
_screenGrid[i].left,
_screenGrid[i].top,
_jigsawPieces[this->arr_i16_3738[i]],
- kPutCopy
+ kSrcCopy
);
// 132:0452
}
@@ -347,7 +347,7 @@ void FoolGame::jigsawDropSelected() {
_screenGrid[this->arr_i16_2f38[i*32 + j]].left,
_screenGrid[this->arr_i16_2f38[i*32 + j]].top,
_jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
- kPutCopy
+ kSrcCopy
);
}
}
@@ -366,7 +366,7 @@ void FoolGame::jigsawDropSelected() {
_screenGrid[this->arr_i16_2f38[i*32+j]].left,
_screenGrid[this->arr_i16_2f38[i*32+j]].top,
_jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
- kPutCopy
+ kSrcCopy
);
}
// 132:134a
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 09b61e02b8a..52645cd06d9 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -44,12 +44,13 @@ void FoolPrologue::run() {
g_toolbox = new Toolbox();
g_zbasic = new ZBasic(g_toolbox);
g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
- this->sub_128_004();
+ this->sub_128_004(true);
delete g_zbasic;
delete g_toolbox;
}
-void FoolPrologue::sub_128_004() {
+void FoolPrologue::sub_128_004(bool finale) {
+ var_i16_1aa = finale ? 2 : 1;
// 128:0004
g_zbasic->coordinateWindow();
@@ -115,7 +116,7 @@ void FoolPrologue::sub_128_004() {
}
// 128:0cb0
if (this->var_i16_1aa == 2) {
- this->sub_131_004();
+ this->finaleRun();
this->var_i32_1a6 = g_zbasic->mem(-1);
}
// 128:0cc8
@@ -162,7 +163,7 @@ void FoolPrologue::drawTextCenterAlign(int16 y, int16 x) {
g_toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right) {
+void FoolPrologue::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:02f0
g_toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
g_toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[patternID]);
@@ -508,7 +509,7 @@ void FoolPrologue::sub_129_004() {
// code checks Rom85 for presence of 128K ROM before doing next bit
// 129:00a2
- if (true) {
+ if (false) {
this->var_i16_1c = { 0x4e20, 0x4e20, 0x4e20 };
g_toolbox->SetCPixel(0x64, 0x64, this->var_i16_1c);
g_toolbox->GetCPixel(0x64, 0x64, this->var_i16_1c);
@@ -526,7 +527,7 @@ void FoolPrologue::sub_129_004() {
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
// 129:013a
- this->fillRect(0x2, 0x14, 0, this->var_i16_12, this->var_i16_10);
+ this->fillRect(0x14, 0, this->var_i16_12, this->var_i16_10, 2);
g_toolbox->SetRect(this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
g_toolbox->PenPat(this->arr_pat_194[1]);
g_toolbox->FrameRect(this->arr_i16_1bc);
@@ -573,11 +574,11 @@ void FoolPrologue::sub_129_004() {
g_toolbox->InitCursor();
g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
g_zbasic->sound(0x19, 0x64, 0xff, 0x0);
- this->fillRect(2, 0x46, 0x64, 0xdc, 0x19c);
- this->fillRect(1, 0x4b, 0x69, 0xd7, 0x197);
+ this->fillRect(0x46, 0x64, 0xdc, 0x19c, 2);
+ this->fillRect(0x4b, 0x69, 0xd7, 0x197, 1);
// 129:0386
- this->fillRect(2, 0x50, 0x6e, 0xd2, 0x192);
+ this->fillRect(0x50, 0x6e, 0xd2, 0x192, 2);
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "not enough memory" message
this->var_str_76 = g_zbasic->str(6);
@@ -594,12 +595,20 @@ void FoolPrologue::sub_129_004() {
if (_quit)
return;
- g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kPutCopy);
+ g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
this->var_i16_1aa = 0;
} else {
// 129:04a0
this->var_i16_180 = 1;
+ // this next blob of code is for determining whether to
+ // open the prologue or the finale.
+ // both are in the same EXE, however the finale is accessed
+ // by opening a file with the right associated application code
+ // that contains the words "And now it's time to show the finale of the Fool's Errand" and a sequence of numbers.
+ // we don't need to worry about files as we add a start trigger
+ // in the game's menu.
+ /*
this->var_i16_1aa = 1;
// 180 == number, possibly file number
// 1c4 == string
@@ -638,16 +647,16 @@ void FoolPrologue::sub_129_004() {
} else {
this->var_i16_1aa = 0;
}
-
}
+ */
// 129:05a6
if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
g_toolbox->InitCursor();
g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
g_zbasic->sound(0x19, 0x64, 0xff, 0x00);
- this->fillRect(2, 0x64, 0x82, 0xdc, 0x17e);
- this->fillRect(1, 0x69, 0x87, 0xd7, 0x179);
- this->fillRect(2, 0x6e, 0x8c, 0xd2, 0x174);
+ this->fillRect(0x64, 0x82, 0xdc, 0x17e, 2);
+ this->fillRect(0x69, 0x87, 0xd7, 0x179, 1);
+ this->fillRect(0x6e, 0x8c, 0xd2, 0x174, 2);
// 129:0662
g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "set your monitor to black and white" message"
@@ -669,7 +678,7 @@ void FoolPrologue::sub_129_004() {
this->sub_128_e58();
if (_quit)
return;
- g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kPutCopy);
+ g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
this->var_i16_1aa = 0;
} else {
// 129:075c
@@ -713,7 +722,7 @@ void FoolPrologue::prologueRun() {
this->var_i16_3ce = 10;
this->prologueDrawLoadingMsg();
this->setPortBitsToPage(0xb);
- this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
g_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
g_toolbox->ReleaseResource(this->glob_i32_2ce);
@@ -729,13 +738,13 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(7);
// 130:00d6
- this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
g_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->setPortBitsToPage(8);
// 130:011c
- this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
g_zbasic->picture(0, 0x96, this->arr_i32_0[2]);
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
@@ -766,7 +775,7 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(2);
// 130:0234
- this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
g_zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
g_toolbox->ReleaseResource(this->arr_i32_0[8]);
@@ -808,10 +817,10 @@ void FoolPrologue::prologueRun() {
// 130:0380
if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
- this->fillRect(1, 0, 0, 0x14, SCREEN_WIDTH);
+ this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
} else {
g_toolbox->SetPort(this->var_i32_c);
- this->fillRect(2, 0, 0, 0x14, this->var_i16_10);
+ this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
}
@@ -975,14 +984,14 @@ void FoolPrologue::prologueRun() {
// 130:0890
// g_zbasic->52(0);
this->setPortBitsToPage(0);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->prologueRenderNextText();
this->sub_128_de2();
this->setPortBitsToPage(1);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->prologueRenderNextText();
@@ -1009,7 +1018,7 @@ void FoolPrologue::prologueRun() {
}
// 130:0a42
this->setPortBitsToPage(6);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
g_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
this->sub_128_de2();
//g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
@@ -1024,7 +1033,7 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(8);
//g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
- this->fillRect(0, 0x73, 0x163, 0xfa, 0x1e0);
+ this->fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
g_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1107,7 +1116,7 @@ void FoolPrologue::prologueRun() {
// 130:0ce6
// JMP 1002
// g_zbasic->pushOldCodeResource(0x82);
- //this->sub_131_004();
+ //this->finaleRun();
}
void FoolPrologue::prologueBufferNextPicture() {
@@ -1130,7 +1139,7 @@ void FoolPrologue::prologueDrawLoadingMsg() {
// 130:0d70
// white out the contents of the top menu bar.
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
- this->fillRect(0, 0, 0x7, 0x13, this->var_i16_10 - 7);
+ this->fillRect(0, 0x7, 0x13, this->var_i16_10 - 7, 0);
this->drawTextCenterAlign(0xe, this->var_i16_10/2);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
@@ -1194,11 +1203,11 @@ void FoolPrologue::prologueRenderNextText() {
void FoolPrologue::sub_130_1002() {
// 130:1002
// g_zbasic->pushOldCodeResource(0x82);
- //this->sub_131_004();
+ //this->finaleRun();
}
// run finale
-void FoolPrologue::sub_131_004() {
+void FoolPrologue::finaleRun() {
// 131:0004
this->var_i16_3ce = 0x2d;
this->sub_131_4dc0();
@@ -1226,7 +1235,7 @@ void FoolPrologue::sub_131_004() {
// 131:00e6
for (int i = 6; i <= 9; i++) {
this->setPortBitsToPage(i);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
// 131:0110
if (i < 8) {
g_zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
@@ -1267,10 +1276,10 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
- this->fillRect(0x1, 0, 0, 0x14, SCREEN_WIDTH);
+ this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
} else {
g_toolbox->SetPort(this->var_i32_c);
- this->fillRect(0x2, 0, 0, 0x14, this->var_i16_10);
+ this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_8);
}
@@ -1338,7 +1347,7 @@ void FoolPrologue::sub_131_004() {
this->var_i32_40 = this->arr_i32_41296[5];
g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
- this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
this->sub_131_4e48();
// 131:0538
@@ -1346,9 +1355,9 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_4e);
// 131:0554
- this->fillRect(0, 0, 0, 0xa0, 0x15e);
- this->fillRect(0, 0xa0, 0x5a, 0xd2, 0xaa);
- this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
+ this->fillRect(0, 0, 0xa0, 0x15e, 0);
+ this->fillRect(0xa0, 0x5a, 0xd2, 0xaa, 0);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
// 131:05b0
this->setPortBitsToPage(6);
@@ -1364,7 +1373,7 @@ void FoolPrologue::sub_131_004() {
g_toolbox->SetPortBits(this->var_i32_32);
g_zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
this->delayFromMarker(0x3c);
- this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
this->sub_128_50a(0x6, 0, 0x200, 0x3);
this->sub_131_4e48();
@@ -1372,7 +1381,7 @@ void FoolPrologue::sub_131_004() {
this->sub_128_50a(5, 0, 0x200, 2);
this->sub_128_50a(7, 0, 0x200, 2);
this->sub_128_50a(8, 0, 0x200, 1);
- this->fillRect(0, 0xaa, 0x177, 0xb9, 0x200);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
this->sub_128_50a(0x9, 0, 0x200, 1);
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
@@ -1438,7 +1447,7 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kPutCopy);
+ g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
g_toolbox->InvertRect(this->arr_i16_1bc);
this->delayFromMarker(1);
}
@@ -1455,7 +1464,7 @@ void FoolPrologue::sub_131_004() {
// 131:0b54
this->var_i16_74 = g_zbasic->rndInt(0x1ca);
this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kPutCopy);
+ g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
}
// 131:0bb0
@@ -1519,10 +1528,10 @@ void FoolPrologue::sub_131_004() {
g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
g_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
this->setPortBitsToPage(0x6);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
this->setPortBitsToPage(0x7);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
//g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
@@ -1533,14 +1542,14 @@ void FoolPrologue::sub_131_004() {
this->setPortBitsToPage(0x9);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
this->setPortBitsToPage(0xa);
- this->fillRect(2, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delayFromMarker(0x78);
- this->fillRect(2, 0xc8, 0x145, 0xd7, SCREEN_WIDTH);
+ this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
this->sub_128_50a(0x5, 0x64, 0x19c, 0x0);
this->delay(0x28);
@@ -1569,7 +1578,7 @@ void FoolPrologue::sub_131_004() {
// 131:11a4
this->sub_128_1ba(0x5);
this->setPortBitsToPage(0x5);
- this->fillRect(0x2, 0xc8, 0x145, 0xd7, SCREEN_WIDTH);
+ this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
@@ -1604,7 +1613,7 @@ void FoolPrologue::sub_131_004() {
this->var_i32_2 = g_toolbox->TickCount();
this->setPortBitsToPage(0x5);
- this->fillRect(0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delayFromMarker(0xa);
@@ -1697,7 +1706,186 @@ void FoolPrologue::sub_131_004() {
this->drawTextRightAlign(0x181, 0x3c);
// 131:17c8
- // ...
+ var_i32_2 = g_toolbox->TickCount();
+ for (int16 i = 0x30; i <= 0x31; i++) {
+ arr_i32_0[i] = g_toolbox->GetPicture(i);
+ }
+ for (int16 i = 0x4b; i <= 0x52; i++) {
+ arr_i32_0[i] = g_toolbox->GetPicture(i);
+ }
+ delayFromMarker(0xd2);
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
+ delay(1);
+ g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ var_str_76 = g_zbasic->chr(0x22) + g_zbasic->str(26); // high priestess!
+ drawTextRightAlign(0x181, 0x3c);
+ var_str_76 = g_zbasic->str(27); // am I to suffer this fate merely for uncovering
+ drawTextRightAlign(0x181, 0x4d);
+ var_str_76 = g_zbasic->chr(0x22) + g_zbasic->str(28); // the fourteen lost treasures of the land?
+ drawTextRightAlign(0x181, 0x5e);
+ for (int16 i = 0x30; i <= 0x31; i++) {
+ g_toolbox->ReleaseResource(arr_i32_0[i]);
+ }
+ for (int16 i = 0x32; i <= 0x38; i++) {
+ arr_i32_0[i] = g_toolbox->GetPicture(i);
+ if (i == 0x37) {
+ setPortBitsToPage(5);
+ g_zbasic->picture(0, 0, arr_i32_0[0x37]);
+ g_toolbox->ReleaseResource(arr_i32_0[0x37]);
+ g_toolbox->SetPortBits(var_i32_32);
+ }
+ }
+ // 131:19be
+ sub_128_e1c();
+ sub_128_e58();
+ sub_128_e1c();
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
+ g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ var_str_76 = g_zbasic->chr(0x22) + g_zbasic->str(29); // for if that be true
+ drawTextRightAlign(0x181, 0x3c);
+ var_str_76 = g_zbasic->str(30); // I wish you had made the challenge more difficult
+ drawTextRightAlign(0x181, 0x4d);
+ var_str_76 = g_zbasic->str(31); // after all, I am just a fool and I should not
+ drawTextRightAlign(0x181, 0x5e);
+ var_str_76 = g_zbasic->str(32) + g_zbasic->chr(0x22); // have been able to find them so easily
+ drawTextRightAlign(0x181, 0x6f);
+ arr_i16_41af4.top = 6;
+ arr_i16_41af4.left = 0xd0;
+ arr_i16_41af4.bottom = 0x6c;
+ arr_i16_41af4.right = 0x133;
+ arr_i16_41afc.top = 0xa;
+ arr_i16_41afc.left = 0xb4;
+ arr_i16_41afc.bottom = 0x1fc;
+ arr_i16_41afc.right = 0x1f6;
+ arr_i16_41b04[0] = 2;
+ arr_i16_41b04[1] = 0xa;
+ arr_i16_41b04[2] = 0xd;
+
+ // 131:1b6e
+ // unroll loops
+ arr_f64_41bbe[0] = (float)arr_i16_41af4.top;
+ arr_f64_41bbe[0+4] = (float)(arr_i16_41afc.top - arr_i16_41af4.top) / arr_i16_41b04[2];
+ arr_f64_41bbe[1] = (float)arr_i16_41af4.left;
+ arr_f64_41bbe[1+4] = (float)(arr_i16_41afc.left - arr_i16_41af4.left) / arr_i16_41b04[2];
+ arr_f64_41bbe[2] = (float)arr_i16_41af4.bottom;
+ arr_f64_41bbe[2+4] = (float)(arr_i16_41afc.bottom - arr_i16_41af4.bottom) / arr_i16_41b04[2];
+ arr_f64_41bbe[3] = (float)arr_i16_41af4.right;
+ arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_i16_41af4.right) / arr_i16_41b04[2];
+ // 131:1c24
+ g_toolbox->PenPat(arr_pat_194[1]);
+ g_toolbox->PenMode(kPatXor);
+ for (int16 j = 6; j <= 9; j++) {
+ arr_i32_41296[j]->copyFrom(*arr_i32_41296[j - 1]);
+ // 131:1c7a
+ setPortBitsToPage(j);
+ if (j == 6) {
+ g_toolbox->PaintOval(arr_i16_41af4);
+ }
+ // 131:1c9c
+ for (int16 i = 0; i <= 2; i++) {
+ // unrolled loop
+ arr_f64_41bbe[0] += arr_f64_41bbe[0+4];
+ arr_i16_41b0a.top = (int16)arr_f64_41bbe[0];
+ arr_f64_41bbe[1] += arr_f64_41bbe[1+4];
+ arr_i16_41b0a.left = (int16)arr_f64_41bbe[1];
+ arr_f64_41bbe[2] += arr_f64_41bbe[2+4];
+ arr_i16_41b0a.bottom = (int16)arr_f64_41bbe[2];
+ arr_f64_41bbe[3] += arr_f64_41bbe[3+4];
+ arr_i16_41b0a.right = (int16)arr_f64_41bbe[3];
+ // 131:1d44
+ g_toolbox->PaintOval(arr_i16_41b0a);
+ }
+ }
+ arr_i32_41296[10]->copyFrom(*arr_i32_41296[9]);
+ // 131:1d98
+ setPortBitsToPage(0xa);
+ g_toolbox->PaintOval(arr_i16_41afc);
+ setPortBitsToPage(5);
+ g_toolbox->SetRect(arr_i16_1bc, 0xae, 0x8c, 0xb6, 0x94);
+ g_toolbox->InvertOval(arr_i16_1bc);
+ g_toolbox->SetRect(arr_i16_1bc, 0x151, 0x86, 0x159, 0x8e);
+ g_toolbox->InvertOval(arr_i16_1bc);
+ g_toolbox->SetPortBits(var_i32_32);
+ sub_128_e1c();
+ sub_128_e58();
+ // 131:1e18
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ fillRect(0x12c, 0x15e, 0x156, 0x200, 2);
+ var_i16_18e = 0;
+ for (int16 i = 0xa; i <= 0x96; i += 0xa) {
+ g_zbasic->get(
+ 0x190,
+ i + 0xa,
+ 0x1ea,
+ i + 0x14,
+ arr_i32_1e3fc[i/0xa]
+ );
+ arr_i16_1e8[i + 0] = 0x190;
+ var_i16_18e++;
+ if (var_i16_18e > 4) {
+ var_i16_18e = 1;
+ }
+ arr_i16_1e8[i + 0xfb] = var_i16_18e;
+ }
+ // 131:1f1a
+ for (int16 j = 1; j <= 0xf; j++) {
+ if (j < 9) {
+ g_toolbox->InvertRect(var_i16_38);
+ }
+ var_i32_2 = g_toolbox->TickCount();
+ for (int16 i = 0xa; i <= 0x96; i += 0xa) {
+ g_zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
+ arr_i16_1e8[i] -= arr_i16_1e8[0xfb + i]*j;
+ g_zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ // 131:2062
+ }
+ // 131:2072
+ delayFromMarker(2);
+ }
+ for (int16 j = 1; j <= 0xf; j++) {
+ var_i32_2 = g_toolbox->TickCount();
+ for (int16 i = 0xa; i <= 0x96; i += 0xa) {
+ g_zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
+ arr_i16_1e8[i] += arr_i16_1e8[0xfb + i]*j;
+ g_zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ }
+ delayFromMarker(2);
+ }
+ // 131:21e0
+ g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x33]);
+ var_i16_1b6 = 0x14;
+ var_str_76 = g_zbasic->str(33); // be content that you still live
+ for (int16 i = 1; i <= 0x18; i++) {
+ var_i32_2 = g_toolbox->TickCount();
+ g_zbasic->text(0xfa, i, 0, kSrcXor);
+ var_i16_1b6 += i;
+ drawText(5 + i*2, var_i16_1b6);
+ delayFromMarker(3);
+ }
+ // 131:2282
+ g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x34]);
+ var_i32_2 = g_toolbox->TickCount();
+ setPortBitsToPage(4);
+ g_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
+ g_toolbox->InvertRect(arr_i16_1bc);
+ g_toolbox->SetRect(arr_i16_1bc, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
+ g_toolbox->PenMode(kPatOr);
+ g_toolbox->PenPat(arr_pat_194[1]);
+ g_toolbox->PaintRect(arr_i16_1bc);
+ // 131:2316
+ // 131:2316: MOVE.L - HEAP(0x412a6),D0
+ // 131:2320: MOVEA.L - D0,A0
+ // 131:2322: MOVE.L - (A0),D0
+ // 131:2324: PUSH.L - D0
+ // 131:2326: MOVE.L - HEAP(0x412c2),D0
+ // 131:2330: MOVEA.L - D0,A0
+ // 131:2332: MOVE.L - (A0),D0
+ // 131:2334: PUSH.L - D0
+ // 131:2336: MOVE.L - 0x5580,D0
+ setPortBitsToPage(0xb);
}
void FoolPrologue::sub_131_4dc0() {
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 5375115dcc0..56bb68d3fb1 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -38,14 +38,14 @@ public:
void run();
- void sub_128_004();
+ void sub_128_004(bool finale);
void sub_128_1ba(int16 screenPage);
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
void delayFromMarker(int16 numTicks); // sub_128_24a
void drawTextRightAlign(int16 y, int16 x); // sub_128_26c
void drawTextCenterAlign(int16 unk1, int16 unk2); // sub_128_2a6
- void fillRect(int16 patternID, int16 top, int16 left, int16 bottom, int16 right); // sub_128_2f0
+ void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_2f0
void sub_128_354(PatternMode mode, uint16 unk2);
void sub_128_3ee(int16 unk1);
void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
@@ -77,7 +77,7 @@ public:
void prologueRenderNextText(); // sub_130_f48
void sub_130_1002();
- void sub_131_004();
+ void finaleRun(); // sub_131_004
void sub_131_4dc0();
void sub_131_4e48();
@@ -161,6 +161,7 @@ private:
int16 var_i16_3da;
int16 var_i16_3dc;
int16 var_i16_3e0;
+ int16 var_i16_3e2;
int16 var_i16_3fc;
@@ -180,6 +181,8 @@ private:
byte arr_i32_b54[SCREEN_PAGE_SIZE*12];
+ BitMap arr_i32_1e3fc[16];
+
BitMap arr_i32_3bca4;
BitMap arr_i32_41296[12];
@@ -190,6 +193,7 @@ private:
Common::Rect arr_i16_41af4;
Common::Rect arr_i16_41afc;
+ int16 arr_i16_41b04[3];
Common::Rect arr_i16_41b0a;
double arr_f64_41bbe[8] = { 0 };
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 5bb186fdc66..26c341f7e70 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -126,7 +126,7 @@ void FoolGame::highPriestessRun() {
this->var_i16_68a = 1;
for (int16 i = 1; i <= 0x155; i++) {
g_zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
- g_zbasic->put(g_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kPutCopy);
+ g_zbasic->put(g_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kSrcCopy);
if (i % 2 == 0) {
g_toolbox->Delay(0);
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 4b4600b8703..c29ea3bde26 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -445,24 +445,16 @@ void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
warning("STUB: ZBasic::picture");
}
-void ZBasic::put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode) {
+void ZBasic::put(int16 x, int16 y, BitMap &src, SourceMode mode) {
this->put(x, y, x+src->w, y+src->h, src, mode);
}
-void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutMode mode) {
+void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, SourceMode mode) {
debugC(8, kDebugGraphics, "ZBasic::put: %p -> (%d, %d) (%d, %d)", (void *)src.get(), x1, y1, x2, y2);
Common::Rect destRect(x1, y1, x2, y2);
- SourceMode sm = kSrcCopy;
- if (mode == kPutXOR) {
- sm = kSrcXor;
- } else if (mode == kPutAND) {
- sm = kSrcBic;
- } else if (mode == kPutOR) {
- sm = kSrcOr;
- }
GrafPtr port;
_toolbox->GetPort(port);
- _toolbox->CopyBits(src, port->portBits, src->getBounds(), destRect, sm, nullptr);
+ _toolbox->CopyBits(src, port->portBits, src->getBounds(), destRect, mode, nullptr);
}
int32 ZBasic::readDataDblInt() {
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index a56257139a6..76d6ba1ad55 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -138,13 +138,6 @@ enum ZBasicWindowType {
kWindowDocumentFixed = 5,
};
-enum ZBasicPutMode {
- kPutCopy = 0,
- kPutXOR = 1,
- kPutOR = 2,
- kPutAND = 3, // FIXME: check that these are right
-};
-
struct ZBasicDatum {
ZBasicDatumType type = kDatumNULL;
uint32 offset = 0;
@@ -266,8 +259,8 @@ public:
void openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void picture(int16 x, int16 y, PicHandle &src);
void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
- void put(int16 x, int16 y, BitMap &src, ZBasicPutMode mode);
- void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, ZBasicPutMode mode);
+ void put(int16 x, int16 y, BitMap &src, SourceMode mode);
+ void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, SourceMode mode);
int16 readDataInt();
int32 readDataDblInt();
Common::U32String readDataStr();
Commit: d41983b4f303fa9240f75518af88b347a6536458
https://github.com/scummvm/scummvm/commit/d41983b4f303fa9240f75518af88b347a6536458
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:26+02:00
Commit Message:
FOOL: Move ZBasic state to local var
Changed paths:
engines/fool/fool.cpp
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index d1b619c91be..f87dda84eb6 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -32,18 +32,21 @@
#include "fool/fool_prologue.h"
#include "fool/detection.h"
#include "fool/console.h"
+#include "fool/toolbox.h"
namespace Fool {
FoolEngine *g_engine;
+Toolbox *g_toolbox;
FoolEngine::FoolEngine(OSystem *syst, const FOOLGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Fool") {
g_engine = this;
-
+ g_toolbox = new Toolbox();
}
FoolEngine::~FoolEngine() {
+ delete g_toolbox;
}
uint32 FoolEngine::getFeatures() const {
@@ -63,8 +66,6 @@ Common::Error FoolEngine::run() {
_screen.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_wm.setScreen(&_screen);
- //FoolPrologue fp;
- //fp.run();
FoolGame fg;
fg.run();
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 5f93ec75b4e..f22cfb332ee 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
#define CARDS_MAX_SCORE 700
@@ -54,7 +54,7 @@ void FoolGame::cardsRun() {
// 139:011c
for (int i = 0; i <= 0x25; i++) {
- g_zbasic->indexSet(puzzlesReadString(), 1, i);
+ _zbasic->indexSet(puzzlesReadString(), 1, i);
}
this->var_i16_484 = 0x5e;
@@ -66,31 +66,31 @@ void FoolGame::cardsRun() {
this->sub_128_bde(1, 1, 0, 1, 1, 1);
this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
// illustration of the card game
- g_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
+ _zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
if (_activePuzzleBuffer.empty()) { // was: str(278)
// 139:01fa
- _activePuzzleBuffer = g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0) + g_zbasic->encodeInt(0);
+ _activePuzzleBuffer = _zbasic->encodeInt(0) + _zbasic->encodeInt(0) + _zbasic->encodeInt(0);
// card IDs
for (int16 i = 0; i <= 0x15; i++) {
this->arr_i16_5cbc[i] = i;
}
// 139:0244
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = g_zbasic->rndInt(0x16) - 1;
- this->var_i16_7e4 = g_zbasic->rndInt(0x16) - 1;
- g_zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[this->var_i16_7e4]);
+ this->var_i16_484 = _zbasic->rndInt(0x16) - 1;
+ this->var_i16_7e4 = _zbasic->rndInt(0x16) - 1;
+ _zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[this->var_i16_7e4]);
}
// 139:029c
for (int i = 0; i <= 0x15; i++) {
- _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_5cbc[i]);
}
}
// 139:02d8
// player scores
- this->arr_i16_1eb8[5] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 1, 2));
- this->arr_i16_1eb8[6] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 3, 2));
+ this->arr_i16_1eb8[5] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 1, 2));
+ this->arr_i16_1eb8[6] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 3, 2));
// 139:0320
- this->var_i16_2010 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 5, 2));
+ this->var_i16_2010 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 5, 2));
if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
this->arr_i16_1eb8[5] = 0;
this->arr_i16_1eb8[6] = 0;
@@ -99,7 +99,7 @@ void FoolGame::cardsRun() {
// 139:039e
for (int i = 0; i <= 0x15; i++) {
- this->arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, i*2 + 7, 2));
+ this->arr_i16_5cbc[i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, i*2 + 7, 2));
}
// 139:03ea
this->arr_i16_5cbc[0x16] = 0x16;
@@ -165,11 +165,11 @@ void FoolGame::sub_139_50e() {
void FoolGame::cardsShuffleDeck() {
// 139:051e
- g_zbasic->unk_20();
+ _zbasic->unk_20();
for (int j = 0; j <= 2; j++) {
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = g_zbasic->rndInt(0x16)-1;
- g_zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[i]);
+ this->var_i16_484 = _zbasic->rndInt(0x16)-1;
+ _zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[i]);
}
}
}
@@ -183,17 +183,17 @@ void FoolGame::cardsDrawTable() {
this->drawTarotCard(1, 4, 0);
this->drawTarotCard(2, 5, 0);
this->drawTarotCard(3, 6, 0);
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0xc3;
// 139:061a
- this->sub_128_918(g_zbasic->str(279)); // Select a card above
+ this->sub_128_918(_zbasic->str(279)); // Select a card above
this->var_i16_7a2 = 0xd4;
- this->sub_128_918(g_zbasic->str(280)); // or
+ this->sub_128_918(_zbasic->str(280)); // or
g_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
g_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0xe9;
- this->sub_128_918(g_zbasic->str(281)); // Yield
+ this->sub_128_918(_zbasic->str(281)); // Yield
this->var_i16_2016 = 1;
this->var_i16_2010 = 1;
this->sub_128_6186();
@@ -249,8 +249,8 @@ void FoolGame::cardsOnClick() {
}
// 139:088a
this->drawTarotCard(9, this->var_i16_1e00, 0);
- g_zbasic->indexSet(
- g_zbasic->chr(this->arr_i16_5cbc[0]+0x41) + g_zbasic->chr(this->arr_i16_5cbc[2]+0x41) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00]+0x41),
+ _zbasic->indexSet(
+ _zbasic->chr(this->arr_i16_5cbc[0]+0x41) + _zbasic->chr(this->arr_i16_5cbc[2]+0x41) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00]+0x41),
1,
0x26
);
@@ -277,8 +277,8 @@ void FoolGame::cardsOnClick() {
this->sub_128_61ec();
// original code has the font ID as 1... maybe there's a fallback?
// this was intended to be Small
- g_zbasic->text(0xfc, 9, Graphics::kMacFontRegular, kSrcBic);
- this->sub_128_918(g_zbasic->str(282)); // (click mouse to continue)
+ _zbasic->text(0xfc, 9, Graphics::kMacFontRegular, kSrcBic);
+ this->sub_128_918(_zbasic->str(282)); // (click mouse to continue)
this->var_i16_2014 = 0;
_stateFlags = 0;
while ((_stateFlags == 0) && (this->var_i16_2014 == 0)) {
@@ -303,17 +303,17 @@ void FoolGame::cardsOnClick() {
void FoolGame::sub_139_a22() {
// 139:0a22
- this->var_str_201a = g_zbasic->chr(this->arr_i16_5cbc[0] + 0x41) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41);
+ this->var_str_201a = _zbasic->chr(this->arr_i16_5cbc[0] + 0x41) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41);
this->var_i16_211a = this->var_i16_1e00;
- g_zbasic->indexSet(g_zbasic->chr(this->arr_i16_5cbc[1] + 0x41) + g_zbasic->chr(this->arr_i16_5cbc[3] + 0x41), 1, 0x27);
- this->var_str_211c = g_zbasic->index(1, 0x27);
+ _zbasic->indexSet(_zbasic->chr(this->arr_i16_5cbc[1] + 0x41) + _zbasic->chr(this->arr_i16_5cbc[3] + 0x41), 1, 0x27);
+ this->var_str_211c = _zbasic->index(1, 0x27);
this->var_i16_2016 = 0x2;
this->var_i16_221c = 0;
this->var_i16_221e = 0;
for (int16 i = 4; i <= 6; i++) {
// 139:0ae8
if (i != this->var_i16_211a) {
- g_zbasic->indexSet(this->var_str_211c + g_zbasic->chr(this->arr_i16_5cbc[i] + 0x41), 1, 0x27);
+ _zbasic->indexSet(this->var_str_211c + _zbasic->chr(this->arr_i16_5cbc[i] + 0x41), 1, 0x27);
this->sub_139_19da();
if (this->arr_i16_1eb8[2] >= this->var_i16_221c) {
// 139:0b52
@@ -332,7 +332,7 @@ void FoolGame::sub_139_a22() {
}
// 139:0bc4
}
- g_zbasic->indexSet(this->var_str_211c + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
+ _zbasic->indexSet(this->var_str_211c + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
// 139:0c0a
this->arr_i16_1eb8[2] = this->var_i16_221c;
this->sub_139_191c();
@@ -341,11 +341,11 @@ void FoolGame::sub_139_a22() {
for (int16 j = 8; j >= 1; j--) {
this->var_i16_7a8 = 0;
// count the number of combination cards in the hand
- for (int16 i = 1; i <= (int16)g_zbasic->index(1, j + 0x15).size(); i++) {
- if (g_zbasic->instr(
+ for (int16 i = 1; i <= (int16)_zbasic->index(1, j + 0x15).size(); i++) {
+ if (_zbasic->instr(
1,
this->var_str_201a,
- g_zbasic->midStr(g_zbasic->index(1, j + 0x15), i, 1))
+ _zbasic->midStr(_zbasic->index(1, j + 0x15), i, 1))
) {
this->var_i16_7a8++;
}
@@ -366,7 +366,7 @@ void FoolGame::sub_139_a22() {
// 139:0ce2
if (this->var_i16_221c == this->arr_i16_1eb8[2]) {
for (int16 i = 1; i <= (int16)this->var_str_201a.size(); i++) {
- this->var_i16_484 = 0x15 - (g_zbasic->asc(g_zbasic->midStr(this->var_str_201a, i, 1)) - 0x41);
+ this->var_i16_484 = 0x15 - (_zbasic->asc(_zbasic->midStr(this->var_str_201a, i, 1)) - 0x41);
if (this->var_i16_484 > this->arr_i16_1eb8[4]) {
this->var_i16_2018 = 1;
}
@@ -387,9 +387,9 @@ void FoolGame::cardsOpponentYields() {
this->sub_128_50e(0x19, 0x64, 0x1);
this->var_i16_2012 = -CARDS_YIELD_PENALTY;
this->cardsDrawScores();
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0xc4;
- this->sub_128_918(g_zbasic->str(283)); // The Old Man yields
+ this->sub_128_918(_zbasic->str(283)); // The Old Man yields
}
void FoolGame::cardsRevealHands() {
@@ -402,37 +402,37 @@ void FoolGame::cardsRevealHands() {
// show ol' mate's draw from the pile
this->drawTarotCard(8, this->var_i16_1e00, 0);
- g_zbasic->indexSet(g_zbasic->index(1, 0x27) + g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
+ _zbasic->indexSet(_zbasic->index(1, 0x27) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
// 139:0e70
for (int16 i = 1; i <= 2; i++) {
- g_zbasic->indexSet(g_zbasic->str(284), 1, i + 0x27);
+ _zbasic->indexSet(_zbasic->str(284), 1, i + 0x27);
if ((this->arr_i16_1eb8[i] > 0) && (this->arr_i16_1eb8[i] < 9)) {
// 139:0ed6
- g_zbasic->indexSet(
- g_zbasic->index(1, 0x1d + this->arr_i16_1eb8[i]) + g_zbasic->str(285), // X pair
+ _zbasic->indexSet(
+ _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i]) + _zbasic->str(285), // X pair
1,
i + 0x27
);
}
// 139:0f1e
if (this->arr_i16_1eb8[i] > 8) {
- g_zbasic->indexSet(
- g_zbasic->index(1, 0x1d + this->arr_i16_1eb8[i] - 8) + g_zbasic->str(286), // X triplet
+ _zbasic->indexSet(
+ _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i] - 8) + _zbasic->str(286), // X triplet
1,
0x27 + i
);
}
// 139:0f84
- g_zbasic->indexSet(
- g_zbasic->index(1,0x15 - this->arr_i16_1eb8[i + 2]),
+ _zbasic->indexSet(
+ _zbasic->index(1,0x15 - this->arr_i16_1eb8[i + 2]),
1,
i + 0x29
);
// 139:0fca
- if (g_zbasic->index(1, i + 0x27) == g_zbasic->str(287)) { // blank
+ if (_zbasic->index(1, i + 0x27) == _zbasic->str(287)) { // blank
// 139:0ff0
- g_zbasic->indexSet(
- g_zbasic->index(1, 0x29 + i),
+ _zbasic->indexSet(
+ _zbasic->index(1, 0x29 + i),
1,
i + 0x27
);
@@ -461,8 +461,8 @@ void FoolGame::cardsRevealHands() {
// 139:10f8
if (this->arr_i16_1eb8[1] != 0) {
for (int i = 1; i <= 2; i++) {
- g_zbasic->indexSet(
- g_zbasic->index(1, 0x27 + i) + g_zbasic->str(288) + g_zbasic->index(1, 0x29 + i) + g_zbasic->str(289),
+ _zbasic->indexSet(
+ _zbasic->index(1, 0x27 + i) + _zbasic->str(288) + _zbasic->index(1, 0x29 + i) + _zbasic->str(289),
1,
0x27 + i
);
@@ -476,26 +476,26 @@ void FoolGame::cardsRevealHands() {
this->cardsDrawScores();
if (this->var_i16_2016 == 1) {
- this->var_str_384 = g_zbasic->str(290); // The fool
+ this->var_str_384 = _zbasic->str(290); // The fool
} else {
// 139:11ce
- this->var_str_384 = g_zbasic->str(291); // The Old Man
+ this->var_str_384 = _zbasic->str(291); // The Old Man
}
// 139:11e2
if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->var_str_9f4 = g_zbasic->str(292); // the game!
+ this->var_str_9f4 = _zbasic->str(292); // the game!
} else {
// 139:123e
- this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_2012) + g_zbasic->str(293); // X points
+ this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_2012) + _zbasic->str(293); // X points
}
// 139:1264
- this->var_str_384 += g_zbasic->str(294) + this->var_str_9f4; // X wins Y
+ this->var_str_384 += _zbasic->str(294) + this->var_str_9f4; // X wins Y
// winning hand
- this->var_str_167c = g_zbasic->index(1, 0x28);
+ this->var_str_167c = _zbasic->index(1, 0x28);
// losing hand
- this->var_str_2222 = g_zbasic->index(1, 0x29);
+ this->var_str_2222 = _zbasic->index(1, 0x29);
if (this->var_i16_2016 == 2) {
- g_zbasic->swapStr(this->var_str_167c, this->var_str_2222);
+ _zbasic->swapStr(this->var_str_167c, this->var_str_2222);
}
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_167c);
@@ -514,13 +514,13 @@ void FoolGame::cardsRevealHands() {
// 139:1344
this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
this->fillRect(0x2e, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0x46;
this->sub_128_918(this->var_str_384);
this->var_i16_7a2 = 0x64;
this->sub_128_918(this->var_str_167c);
this->var_i16_7a2 = 0x78;
- this->sub_128_918(g_zbasic->str(295)); // beats
+ this->sub_128_918(_zbasic->str(295)); // beats
this->var_i16_7a2 = 0x8c;
this->sub_128_918(this->var_str_2222);
if (this->arr_i16_1eb8[1] != 0) {
@@ -529,40 +529,40 @@ void FoolGame::cardsRevealHands() {
this->var_i16_68a -= 8;
}
// 139:1420
- if (g_zbasic->instr(
+ if (_zbasic->instr(
1,
- g_zbasic->index(1, 0x15 + this->var_i16_68a),
- g_zbasic->midStr(g_zbasic->index(1, 0x26), 1, 1)
+ _zbasic->index(1, 0x15 + this->var_i16_68a),
+ _zbasic->midStr(_zbasic->index(1, 0x26), 1, 1)
) == 0) {
this->drawTarotCard(5, 0, 2);
}
// 139:1470
- if (g_zbasic->instr(
+ if (_zbasic->instr(
1,
- g_zbasic->index(1, 0x15 + this->var_i16_68a),
- g_zbasic->midStr(g_zbasic->index(1, 0x26), 2, 1)
+ _zbasic->index(1, 0x15 + this->var_i16_68a),
+ _zbasic->midStr(_zbasic->index(1, 0x26), 2, 1)
) == 0) {
this->drawTarotCard(7, 0, 2);
}
// 139:14c0
- if (g_zbasic->instr(
+ if (_zbasic->instr(
1,
- g_zbasic->index(1, 0x15 + this->var_i16_68a),
- g_zbasic->midStr(g_zbasic->index(1, 0x26), 3, 1)
+ _zbasic->index(1, 0x15 + this->var_i16_68a),
+ _zbasic->midStr(_zbasic->index(1, 0x26), 3, 1)
) == 0) {
this->drawTarotCard(9, 0, 2);
}
} else {
// 139:1514
- this->var_str_384 = g_zbasic->chr((0x15 - this->arr_i16_1eb8[3]) + 0x41);
- if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 1, 1) != this->var_str_384) {
+ this->var_str_384 = _zbasic->chr((0x15 - this->arr_i16_1eb8[3]) + 0x41);
+ if (_zbasic->midStr(_zbasic->index(1, 0x26), 1, 1) != this->var_str_384) {
this->drawTarotCard(5, 0, 2);
}
// 139:157e
- if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 2, 1) != this->var_str_384) {
+ if (_zbasic->midStr(_zbasic->index(1, 0x26), 2, 1) != this->var_str_384) {
this->drawTarotCard(7, 0, 2);
}
- if (g_zbasic->midStr(g_zbasic->index(1, 0x26), 3, 1) != this->var_str_384) {
+ if (_zbasic->midStr(_zbasic->index(1, 0x26), 3, 1) != this->var_str_384) {
this->drawTarotCard(9, 0, 2);
}
}
@@ -572,28 +572,28 @@ void FoolGame::cardsRevealHands() {
if (this->var_i16_68a > 8) {
this->var_i16_68a -= 8;
}
- if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 1, 1)) == 0) {
+ if (_zbasic->instr(1, _zbasic->index(1, 0x15 + this->var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 1, 1)) == 0) {
this->drawTarotCard(4, 0, 2);
}
// 139:1678
- if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 2, 1)) == 0) {
+ if (_zbasic->instr(1, _zbasic->index(1, 0x15 + this->var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 2, 1)) == 0) {
this->drawTarotCard(6, 0, 2);
}
// 139:16c8
- if (g_zbasic->instr(1, g_zbasic->index(1, 0x15 + this->var_i16_68a), g_zbasic->midStr(g_zbasic->index(1, 0x27), 3, 1)) == 0) {
+ if (_zbasic->instr(1, _zbasic->index(1, 0x15 + this->var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 3, 1)) == 0) {
this->drawTarotCard(8, 0, 2);
}
} else {
// 139:171c
- this->var_str_384 = g_zbasic->chr((0x15 - this->arr_i16_1eb8[4]) + 0x41);
- if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 1, 1)) {
+ this->var_str_384 = _zbasic->chr((0x15 - this->arr_i16_1eb8[4]) + 0x41);
+ if (this->var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 1, 1)) {
this->drawTarotCard(4, 0, 2);
}
// 139:1786
- if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 2, 1)) {
+ if (this->var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 2, 1)) {
this->drawTarotCard(6, 0, 2);
}
- if (this->var_str_384 != g_zbasic->midStr(g_zbasic->index(1, 0x27), 3, 1)) {
+ if (this->var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 3, 1)) {
this->drawTarotCard(8, 0, 2);
}
}
@@ -610,17 +610,17 @@ void FoolGame::sub_139_17fc() {
for (int i = 1; i <= 2; i++) {
this->arr_i16_1eb8[i + 2] = 0;
this->arr_i16_1eb8[i] = 0;
- g_zbasic->indexSet(g_zbasic->str(296), 1, 0x25 + i); // blank
- g_zbasic->indexSet(g_zbasic->str(297), 1, 0x27 + i); // blank
- g_zbasic->indexSet(g_zbasic->str(298), 1, 0x29 + i); // blank
+ _zbasic->indexSet(_zbasic->str(296), 1, 0x25 + i); // blank
+ _zbasic->indexSet(_zbasic->str(297), 1, 0x27 + i); // blank
+ _zbasic->indexSet(_zbasic->str(298), 1, 0x29 + i); // blank
}
}
void FoolGame::sub_139_191c() {
// 139:191c
this->arr_i16_1eb8[this->var_i16_2016 + 2] = 0;
- for (int i = 1; i <= (int)g_zbasic->index(1, this->var_i16_2016 + 0x25).size(); i++) {
- this->var_i16_484 = 0x15 - (g_zbasic->asc(g_zbasic->midStr(g_zbasic->index(1, 0x25 + this->var_i16_2016), i, 1)) - 0x41);
+ for (int i = 1; i <= (int)_zbasic->index(1, this->var_i16_2016 + 0x25).size(); i++) {
+ this->var_i16_484 = 0x15 - (_zbasic->asc(_zbasic->midStr(_zbasic->index(1, 0x25 + this->var_i16_2016), i, 1)) - 0x41);
// 139:1974
if (this->var_i16_484 > this->arr_i16_1eb8[2 + this->var_i16_2016]) {
this->arr_i16_1eb8[2 + this->var_i16_2016] = this->var_i16_484;
@@ -636,11 +636,11 @@ void FoolGame::sub_139_19da() {
// cycle backward through the scoring combinations
for (int j = 8; j >= 1; j--) {
this->var_i16_7a8 = 0;
- for (int i = 1; i <= (int)g_zbasic->index(1, j + 0x15).size(); i++) {
- if (g_zbasic->instr(
+ for (int i = 1; i <= (int)_zbasic->index(1, j + 0x15).size(); i++) {
+ if (_zbasic->instr(
1,
- g_zbasic->index(1, this->var_i16_2016 + 0x25),
- g_zbasic->midStr(g_zbasic->index(1, 0x15 + j), i, 1)
+ _zbasic->index(1, this->var_i16_2016 + 0x25),
+ _zbasic->midStr(_zbasic->index(1, 0x15 + j), i, 1)
) != 0) {
this->var_i16_7a8++;
}
@@ -661,7 +661,7 @@ void FoolGame::sub_139_19da() {
void FoolGame::cardsDrawScores() {
// 139:1b12
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->arr_i16_1eb8[this->var_i16_2016 + 4] += this->var_i16_2012;
if (this->arr_i16_1eb8[5] < CARDS_MIN_SCORE) {
this->arr_i16_1eb8[5] = CARDS_MIN_SCORE;
@@ -673,14 +673,14 @@ void FoolGame::cardsDrawScores() {
// 139:1bb2
this->fillRect(0x14, 0, 0x29, 0x5a, 2);
// Old Man
- this->var_str_384 = g_zbasic->str(299) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
+ this->var_str_384 = _zbasic->str(299) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(0x2d - (this->var_i16_484 / 2), 0x23);
g_toolbox->DrawString(this->var_str_384);
// 139:1c30
this->fillRect(0x14, 0x1a6, 0x29, 0x200, 2);
- this->var_str_384 = g_zbasic->str(300) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
+ this->var_str_384 = _zbasic->str(300) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(0x1d3 - (this->var_i16_484 / 2), 0x23);
g_toolbox->DrawString(this->var_str_384);
@@ -688,12 +688,12 @@ void FoolGame::cardsDrawScores() {
void FoolGame::cardsStoreState() {
// 139:1cba
- _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[5]) +
- g_zbasic->encodeInt(this->arr_i16_1eb8[6]) +
- g_zbasic->encodeInt(this->var_i16_2010);
+ _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[5]) +
+ _zbasic->encodeInt(this->arr_i16_1eb8[6]) +
+ _zbasic->encodeInt(this->var_i16_2010);
// 139:1d00
for (int i = 0; i <= 0x15; i++) {
- _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_5cbc[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_5cbc[i]);
}
}
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 9b75bd5f4ea..ca5ebe3b15e 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -26,17 +26,16 @@
namespace Fool {
-extern ZBasic *g_zbasic;
extern Toolbox *g_toolbox;
// Death challenge
void FoolGame::deathRun() {
// 141:0004
- g_zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
- this->sub_128_55c(g_zbasic->str(334));
+ _zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
+ this->sub_128_55c(_zbasic->str(334));
g_toolbox->InvertRect(this->arr_rect_1910c);
- g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
- g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ _zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
this->deathDrawZoom();
this->fillRect(0x14f, 0, 0x156, 0x7, 0x2);
this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
@@ -45,8 +44,8 @@ void FoolGame::deathRun() {
this->arr_rect_1eb8.bottom = 0x2e;
this->arr_rect_1eb8.right = 0x1a8;
// 141:0122
- g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
_event.where.y = 0x14;
// JMP 0x3c2
while (true) {
@@ -76,8 +75,8 @@ void FoolGame::deathRun() {
}
}
// 141:023a
- g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
- this->sub_128_55c(g_zbasic->str(335)); // "~"
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
+ this->sub_128_55c(_zbasic->str(335)); // "~"
this->var_i16_233a = 1;
// JMP 0x2be
while (_event.where.y < 0x14) {
@@ -104,7 +103,7 @@ void FoolGame::deathRun() {
// JMP 0x9a2
// 141:09a2
this->deathDrawWhiteEye();
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
this->deathDrawZoom();
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
@@ -136,7 +135,7 @@ void FoolGame::deathRun() {
void FoolGame::deathMoveBlackEye() {
// 141:03ca
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
this->var_i16_68a = _event.where.x - 0xc - this->arr_rect_1eb8.left;
this->var_i16_68c = _event.where.y - 8 - this->arr_rect_1eb8.top;
// 141:0452
@@ -152,14 +151,14 @@ void FoolGame::deathMoveBlackEye() {
if (this->var_i16_68a > 6) {
this->var_i16_68a = 6;
}
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:04ce
this->arr_rect_1ec0.top = this->arr_rect_1eb8.top + this->var_i16_68c;
this->arr_rect_1ec0.left = this->arr_rect_1eb8.left + this->var_i16_68a;
this->arr_rect_1ec0.bottom = this->arr_rect_1eb8.bottom + this->var_i16_68c;
this->arr_rect_1ec0.right = this->arr_rect_1eb8.right + this->var_i16_68a;
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:05a2
if (this->arr_rect_1ec0.top < 0x14) {
this->arr_rect_1ec0.top = 0x14;
@@ -179,15 +178,15 @@ void FoolGame::deathMoveBlackEye() {
this->arr_rect_1ec0.left = 0x1e8;
this->arr_rect_1ec0.right = 0x200;
}
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:06bc
if (!((this->arr_rect_1eb8.top == this->arr_rect_1ec0.top) &&
((this->arr_rect_1eb8.left == this->arr_rect_1ec0.left)))) {
// 141:0722
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
this->arr_rect_1eb8 = this->arr_rect_1ec0;
- g_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
- g_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
+ _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
this->sub_128_3da(1);
}
// 141:0880
@@ -196,7 +195,7 @@ void FoolGame::deathMoveBlackEye() {
void FoolGame::deathDrawWhiteEye() {
// 141:0882
if (this->var_i16_233a != 0) {
- g_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
+ _zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
}
// 141:08b0
this->var_i16_233a = 0;
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 300c7ab3c92..a5710ba0c66 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -22,13 +22,13 @@
#include "common/util.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
+#include "fool/fool_prologue.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
-ZBasic *g_zbasic;
-Toolbox *g_toolbox;
+extern Toolbox *g_toolbox;
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
@@ -37,20 +37,18 @@ Toolbox *g_toolbox;
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
void FoolGame::run() {
- g_toolbox = new Toolbox();
- g_zbasic = new ZBasic(g_toolbox);
+ _zbasic = new ZBasic(g_toolbox);
Common::MacFinderInfo finfo;
if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
- g_zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
+ _zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
// v1.0 filename ends with "tm"
} else if (g_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
- g_zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
+ _zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
} else {
error("FoolGame::run: Fool's Errand program not found");
}
this->sub_128_004();
- delete g_zbasic;
- delete g_toolbox;
+ delete _zbasic;
}
void FoolGame::sub_128_004() {
@@ -76,21 +74,21 @@ void FoolGame::sub_128_004() {
this->arr_bmp_138bc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
// 128:0004
- g_zbasic->unk_331(0xdac0, 0);
- g_zbasic->unk_331(0x1b58, 1);
- g_zbasic->unk_331(0x1b58, 2);
+ _zbasic->unk_331(0xdac0, 0);
+ _zbasic->unk_331(0x1b58, 1);
+ _zbasic->unk_331(0x1b58, 2);
g_toolbox->SetRect(_screenClipRect, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
- this->var_str_384 = g_zbasic->str(0);
- this->var_str_384 = g_zbasic->str(1);
- this->var_str_384 = g_zbasic->str(2);
+ this->var_str_384 = _zbasic->str(0);
+ this->var_str_384 = _zbasic->str(1);
+ this->var_str_384 = _zbasic->str(2);
// 128:0086
// 128:0086: MOVEQ - 0x0,D0
// 128:0088: SNE - -0x98c(A5)
- g_zbasic->unk_44(0);
+ _zbasic->unk_44(0);
this->var_i16_484 = 0;
@@ -107,7 +105,7 @@ void FoolGame::sub_128_004() {
// 128:0442: JMP - [0x45e]
// 128:045e: JMP - [0x478]
// 128:0478
- this->var_str_69a = g_zbasic->str(6);
+ this->var_str_69a = _zbasic->str(6);
//this->var_i32_79a = &this->var_str_69a;
// 128:0496: JMP - [0x4d6]
// 128:04d6: JMP - [0x50a]
@@ -130,7 +128,7 @@ void FoolGame::sub_128_004() {
// 128:1c7a
this->sub_129_068();
- this->var_i32_7c8 = g_zbasic->mem(-1);
+ this->var_i32_7c8 = _zbasic->mem(-1);
// 128:1c88: JMP - [0x1ee2]
while (_stateFlags != kStateQuit) {
do {
@@ -213,7 +211,7 @@ void FoolGame::sub_128_004() {
if (_stateFlags & kStateMetapuzzleSelect) {
this->metapuzzleRun();
}
- if (_stateFlags & 0x400) {
+ if (_stateFlags & kStatePrintStory) {
this->sub_128_2b0a();
}
if (_stateFlags & kStateMetapuzzleComplete) {
@@ -223,8 +221,8 @@ void FoolGame::sub_128_004() {
}
// 128:1eec
this->sub_128_1f1e();
- g_zbasic->unk_158();
- g_zbasic->unk_4();
+ _zbasic->unk_158();
+ _zbasic->unk_4();
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 0, 0x14, _windowWidth, 2);
g_toolbox->_defaultMenu->setOverlayDirty(true);
@@ -237,18 +235,18 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
// to make this less bad, our version passes a BitMap pointer
warning("copyScreen: put %d, bmp %p", put, (void *)&bmp);
if (put == 0) {
- g_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bmp);
+ _zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bmp);
}
// 128:00e6
if (put == 1) {
- g_zbasic->put(0, 0, bmp, kSrcCopy);
+ _zbasic->put(0, 0, bmp, kSrcCopy);
}
}
void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::U32String &filename) {
// 128:011c
- this->var_str_384 = g_zbasic->str(3);
+ this->var_str_384 = _zbasic->str(3);
this->var_i16_586 = 0;
@@ -276,8 +274,8 @@ void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::
void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
// 128:01e4
- g_zbasic->stringCopy(this->var_str_172, unk1);
- this->var_str_588 = g_zbasic->str(4);
+ _zbasic->stringCopy(this->var_str_172, unk1);
+ this->var_str_588 = _zbasic->str(4);
this->var_i16_688 = 0;
this->copyScreen(0, this->arr_bmp_138bc);
@@ -295,7 +293,7 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
typeList.types[0] += this->var_str_172.at(2) << 8;
typeList.types[0] += this->var_str_172.at(3) << 0;
- g_toolbox->SFGetFile(_event.where, g_zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
+ g_toolbox->SFGetFile(_event.where, _zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -411,9 +409,9 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
this->var_i16_30 = freq;
if (_soundEnabled) {
// the volume was originally 150, this is crazy loud.
- g_zbasic->sound(this->var_i16_30, this->var_i16_32, 20, 0);
+ _zbasic->sound(this->var_i16_30, this->var_i16_32, 20, 0);
if (this->var_i16_34 == 1) {
- while (g_zbasic->soundBusy()) {
+ while (_zbasic->soundBusy()) {
g_toolbox->Delay(0);
}
}
@@ -422,12 +420,12 @@ void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
void FoolGame::sub_128_55c(const Common::U32String &unk1) {
// 128:055c
- g_zbasic->stringCopy(this->var_str_172, unk1);
+ _zbasic->stringCopy(this->var_str_172, unk1);
g_toolbox->PenNormal();
g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
g_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133);
g_toolbox->DrawString(this->var_str_172);
@@ -470,7 +468,7 @@ void FoolGame::drawTarotCard(int16 rectID, int16 deckPos, int16 type) {
g_toolbox->PenPat(_patterns[2]);
g_toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
// 128:079e
- g_zbasic->picture(_screenGrid[rectID].left + 3, _screenGrid[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
+ _zbasic->picture(_screenGrid[rectID].left + 3, _screenGrid[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
}
// 128:0806
if (type == 1) {
@@ -497,7 +495,7 @@ void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16
void FoolGame::sub_128_918(const Common::U32String &unk1) {
// 128:0918
- g_zbasic->stringCopy(this->var_str_172, unk1);
+ _zbasic->stringCopy(this->var_str_172, unk1);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo(0x100 - (this->var_i16_30 / 2), this->var_i16_7a2);
g_toolbox->DrawString(this->var_str_172);
@@ -645,7 +643,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
// 128:0e46
this->copyScreen(0, this->arr_bmp_138bc);
- g_zbasic->text(this->var_i16_7aa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(this->var_i16_7aa, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7b4 = this->var_i16_7ae*0x46;
this->var_i16_7b6 = 0;
for (int i = 0; i <= this->var_i16_7ac; i++) {
@@ -695,7 +693,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:10a0
if (this->var_i16_7ae != 0) {
g_toolbox->PenNormal();
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// 128:10c0
// loop to zero out three button rects
@@ -846,14 +844,14 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
// 128:1818
this->var_i16_34 = 3 + ((this->var_i16_30 - 1) / 0x10);
this->var_i16_36 = 1 + ((this->var_i16_30 - 1) % 0x10);
- this->var_str_172 = _puzzleName[this->var_i16_30] + g_zbasic->str(9);
+ this->var_str_172 = _puzzleName[this->var_i16_30] + _zbasic->str(9);
// add the wadjet eye next to the chapter name
- g_zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
+ _zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
}
// 128:188a
this->sub_128_4da(0);
- g_zbasic->picture(0, 0x14, this->var_pic_7c2);
- g_zbasic->text(0xfa, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
+ _zbasic->picture(0, 0x14, this->var_pic_7c2);
+ _zbasic->text(0xfa, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
for (int j = 0; j <= 1; j++) {
// 128:18c4
for (int i = 0; i <= 0x64; i += 4) {
@@ -1054,7 +1052,7 @@ void FoolGame::storyRenderPage() {
this->sub_128_69c(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
// 128:226e
// grab the last N-1 lines of text from the screen
- g_zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
+ _zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
this->var_i16_7e0 = 1;
} else {
// 128:22d4
@@ -1073,40 +1071,40 @@ void FoolGame::storyRenderPage() {
}
// 128:235e
if (_puzzleType[_storyCurrentChapter] > 0) {
- this->var_str_384 = g_zbasic->str(10); // ?
+ this->var_str_384 = _zbasic->str(10); // ?
if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
- this->var_str_384 = g_zbasic->str(11); // ~
+ this->var_str_384 = _zbasic->str(11); // ~
}
// 128:23b8
if (_puzzleCompletionStatus[_storyCurrentChapter] >= 0x64) {
- this->var_str_384 = g_zbasic->str(12); // *
+ this->var_str_384 = _zbasic->str(12); // *
}
// 128:23e8
this->sub_128_55c(this->var_str_384);
// 128:23f0: CLR.W - -0x772(A5)
this->var_i16_7d6 = 1;
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x8a, 0x133);
g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x70, 0x133);
g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
}
// 128:2468
- if (_pageNumberText[_storyNextPage] != g_zbasic->str(13)) { // blank
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ if (_pageNumberText[_storyNextPage] != _zbasic->str(13)) { // blank
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->DrawString(_pageNumberText[_storyNextPage]);
}
// 128:24be
if (_storyNextPage != _storyCurrentPage) {
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
if (this->var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
- g_zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kSrcCopy);
}
// 128:252a
// y-position where the story text should start
@@ -1114,7 +1112,7 @@ void FoolGame::storyRenderPage() {
debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", _storyNextPage, _pageLines[_storyNextPage]);
if (_pageLines[_storyNextPage] < 0xf) {
g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
- g_toolbox->DrawString(g_zbasic->str(14)); // infinity symbol
+ g_toolbox->DrawString(_zbasic->str(14)); // infinity symbol
this->var_i16_7de = this->var_i16_7a2 - 0x1e;
} else {
// 128:25a6
@@ -1125,7 +1123,7 @@ void FoolGame::storyRenderPage() {
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
for (int i = _pageLineRanges[_storyNextPage*2]; i <= _pageLineRanges[_storyNextPage*2+1]; i++) {
g_toolbox->TextFace(_pageLineFace[i]);
- this->var_str_384 = g_zbasic->index(0, i);
+ this->var_str_384 = _zbasic->index(0, i);
g_toolbox->DrawString(this->var_str_384);
if (_pageLineBreak[i] != 0) {
// 128:262a
@@ -1145,8 +1143,8 @@ void FoolGame::sub_128_2664() {
// hide menu and replace with "click mouse to continue" message
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_str_172 = g_zbasic->str(15); // click mouse to continue
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ this->var_str_172 = _zbasic->str(15); // click mouse to continue
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xf);
g_toolbox->DrawString(this->var_str_172);
@@ -1167,7 +1165,7 @@ void FoolGame::sub_128_271a() {
this->var_i16_484 = (int16)(position / 1000);
// offset at record
this->var_i16_7e4 = (int16)(position % 1000);
- g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
+ _zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
this->var_ptr_696 = 0;
int length = _puzzleDataOffsets[_activePuzzle + 1] - _puzzleDataOffsets[_activePuzzle];
debugC(8, kDebugLoading, "sub_128_271a: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
@@ -1177,7 +1175,7 @@ void FoolGame::sub_128_271a() {
this->var_i16_7e4,
length
);
- this->arr_bytes_109dc = g_zbasic->readFile(1, length);
+ this->arr_bytes_109dc = _zbasic->readFile(1, length);
this->var_bytes_696 = this->arr_bytes_109dc;
}
@@ -1201,37 +1199,37 @@ void FoolGame::sub_128_2808() {
this->var_i16_7e6 = 0;
// 128:280e: LEA - [0x3808],A0
// 128:2812: MOVE.L - A0,-0x8ee(A5)
- g_zbasic->openR(2, this->var_str_588, 0x400, this->var_i16_688);
- this->var_str_7e8 = g_zbasic->readFileStr(2, 0x11);
- if (this->var_str_7e8 == g_zbasic->str(16)) { // The Fool's Errand
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ _zbasic->openR(2, this->var_str_588, 0x400, this->var_i16_688);
+ this->var_str_7e8 = _zbasic->readFileStr(2, 0x11);
+ if (this->var_str_7e8 == _zbasic->str(16)) { // The Fool's Errand
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
- this->var_str_7e8 = g_zbasic->readFileStr(2, this->var_i16_8e8);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
+ this->var_str_7e8 = _zbasic->readFileStr(2, this->var_i16_8e8);
}
// 128:28c8
for (int i = 1; i <= 0x51; i++) {
- this->var_i16_8e8 = g_zbasic->readFileInt(2);
+ this->var_i16_8e8 = _zbasic->readFileInt(2);
}
} else {
// 128:28ec
this->var_i16_7e6 = 1;
}
- g_zbasic->close(2);
+ _zbasic->close(2);
// 128:28f8: LEA - [0x3818],A0
// 128:28fc: MOVE.L - A0,-0x8ee(A5)
if (this->var_i16_7e6 != 0) {
- _modalText[0] = g_zbasic->str(17) + this->var_str_588 + g_zbasic->str(18);
- _modalText[1] = g_zbasic->str(19);
+ _modalText[0] = _zbasic->str(17) + this->var_str_588 + _zbasic->str(18);
+ _modalText[1] = _zbasic->str(19);
this->sub_128_dfe(0, 0, 1, 1);
- this->var_str_588 = g_zbasic->str(20);
+ this->var_str_588 = _zbasic->str(20);
this->var_i16_7e6 = 0;
}
}
@@ -1239,7 +1237,7 @@ void FoolGame::sub_128_2808() {
void FoolGame::menuOpenGame() {
// 128:2988
// File -> Open
- this->sub_128_1e4(g_zbasic->str(21)); // FOOL
+ this->sub_128_1e4(_zbasic->str(21)); // FOOL
if (this->var_str_588.empty()) { // was: str(22)
return;
}
@@ -1270,10 +1268,10 @@ void FoolGame::saveGameAs() {
// 128:2a0e
if (_saveFileName.empty()) { // was: str(24)
// 128:2a28
- this->openSaveFileDialog(g_zbasic->str(25), g_zbasic->str(26)); // name of game, blank
+ this->openSaveFileDialog(_zbasic->str(25), _zbasic->str(26)); // name of game, blank
} else {
// 128:2a48
- this->openSaveFileDialog(g_zbasic->str(27), _saveFileName); // New Name?, old filename
+ this->openSaveFileDialog(_zbasic->str(27), _saveFileName); // New Name?, old filename
}
// 128:2a60
if (!this->var_str_486.empty()) { // was: str(28)
@@ -1311,9 +1309,9 @@ void FoolGame::menuQuit() {
void FoolGame::menuPrintStory() {
// 128:2ae8
if (this->var_i16_7ce & 1) {
- _stateFlags = 0x401;
+ _stateFlags = kStatePrintStory | kStateReturn;
} else {
- _stateFlags = 0x400;
+ _stateFlags = kStatePrintStory;
}
}
@@ -1331,7 +1329,7 @@ void FoolGame::newGame() {
this->clearStateBits(kStateNewGame);
this->cursorWatch();
this->sub_128_3744();
- _saveFileName = g_zbasic->str(33);
+ _saveFileName = _zbasic->str(33);
this->var_i16_9ec = 0;
// set up the initially visible story chapters
@@ -1359,13 +1357,13 @@ void FoolGame::newGame() {
for (int16 i = 1; i <= 0x51; i++) {
_sunMapTileID[i] = i;
}
- g_zbasic->unk_20();
+ _zbasic->unk_20();
// 128:2cf6
// shuffle around the pieces of the sun's map
for (int i = 1; i <= 0x64; i++) {
- this->var_i16_484 = g_zbasic->rndInt(0x51);
- this->var_i16_7e4 = g_zbasic->rndInt(0x51);
- g_zbasic->swapInt(_sunMapTileID[this->var_i16_484], _sunMapTileID[this->var_i16_7e4]);
+ this->var_i16_484 = _zbasic->rndInt(0x51);
+ this->var_i16_7e4 = _zbasic->rndInt(0x51);
+ _zbasic->swapInt(_sunMapTileID[this->var_i16_484], _sunMapTileID[this->var_i16_7e4]);
_puzzleCompletionStatus[i] = 0;
_puzzleFlags[i] = kFlagMenuDisabled;
}
@@ -1389,7 +1387,7 @@ void FoolGame::newGame() {
// 128:2e02
}
// 128:2e14
- g_zbasic->indexClear(0x2);
+ _zbasic->indexClear(0x2);
_storyNextPage = 1;
this->var_i16_7ce = 0;
_activePuzzle = 0;
@@ -1412,37 +1410,37 @@ void FoolGame::openGame() {
// 128:2e68: LEA - [0x3808],A0
// 128:2e6c: MOVE.L - A0,-0x8ee(A5)
// 128:2e70: SF - 0x8,D0
- g_zbasic->openR(2, _saveFileName, 0x400, this->var_i16_9ec);
+ _zbasic->openR(2, _saveFileName, 0x400, this->var_i16_9ec);
- this->var_str_384 = g_zbasic->readFileStr(2, 0x11);
- _storyNextPage = g_zbasic->readFileInt(2);
- _activePuzzle = g_zbasic->readFileInt(2);
- this->var_i16_7ce = g_zbasic->readFileInt(2);
- _sunMapRestored = g_zbasic->readFileInt(2);
+ this->var_str_384 = _zbasic->readFileStr(2, 0x11);
+ _storyNextPage = _zbasic->readFileInt(2);
+ _activePuzzle = _zbasic->readFileInt(2);
+ this->var_i16_7ce = _zbasic->readFileInt(2);
+ _sunMapRestored = _zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
- _puzzleFlags[i] = g_zbasic->readFileInt(2);
- _puzzleCompletionStatus[i] = g_zbasic->readFileInt(2);
- _pageVisible[i] = g_zbasic->readFileInt(2);
- int16 payloadSize = g_zbasic->readFileInt(2);
+ _puzzleFlags[i] = _zbasic->readFileInt(2);
+ _puzzleCompletionStatus[i] = _zbasic->readFileInt(2);
+ _pageVisible[i] = _zbasic->readFileInt(2);
+ int16 payloadSize = _zbasic->readFileInt(2);
debugC(5, kDebugLoading, "openGame: puzzle %d:, puzzleFlags: %d, puzzleCompletionStatus: %d, pageVisible: %d, payload size: %d", i, _puzzleFlags[i], _puzzleCompletionStatus[i], _pageVisible[i], payloadSize);
- Common::String state = g_zbasic->readFileStr(2, payloadSize);
+ Common::String state = _zbasic->readFileStr(2, payloadSize);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)state.c_str(), payloadSize);
}
- g_zbasic->indexRawSet(state, 2, i);
+ _zbasic->indexRawSet(state, 2, i);
}
// 128:2f54
debugCN(5, kDebugLoading, "openGame: sun map tile IDs: ");
for (int i = 1; i <= 0x51; i++) {
- _sunMapTileID[i] = g_zbasic->readFileInt(2);
+ _sunMapTileID[i] = _zbasic->readFileInt(2);
debugCN(5, kDebugLoading, "%d, ", _sunMapTileID[i]);
}
debugCN(5, kDebugLoading, "\n");
// 128:2f84
- g_zbasic->close(2);
+ _zbasic->close(2);
if (this->var_i16_7e6 != 0) {
- _modalText[0] = g_zbasic->str(34) + _saveFileName + g_zbasic->str(35); // file cannot be opened
- _modalText[1] = g_zbasic->str(36);
+ _modalText[0] = _zbasic->str(34) + _saveFileName + _zbasic->str(35); // file cannot be opened
+ _modalText[1] = _zbasic->str(36);
this->var_i16_7e6 = 0;
if ((this->var_i16_7ce & 1) == 0) {
setStateBits(kStateNewGame | kStateReturn);
@@ -1463,38 +1461,38 @@ void FoolGame::sub_128_3032() {
this->var_i16_68c = 3;
// render chapter menu headings
for (int j = 3; j <= 7; j++) {
- this->var_str_384 = g_zbasic->str(37) + g_zbasic->chr(0x7d+j) + g_zbasic->str(38);
- g_zbasic->menu(j, 0, 1, this->var_str_384);
+ this->var_str_384 = _zbasic->str(37) + _zbasic->chr(0x7d+j) + _zbasic->str(38);
+ _zbasic->menu(j, 0, 1, this->var_str_384);
for (int i = 1; i <= 0x10; i++) {
this->var_i16_484++;
this->var_i16_9f2 = _puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
if (_puzzleCompletionStatus[this->var_i16_484] == 0x63) {
- this->var_str_384 = g_zbasic->str(39); // " ~ "
+ this->var_str_384 = _zbasic->str(39); // " ~ "
} else {
// 128:30e4
- this->var_str_384 = g_zbasic->str(40); // " "
+ this->var_str_384 = _zbasic->str(40); // " "
}
// 128:30f8
this->var_str_9f4 = _puzzleName[this->var_i16_484] + this->var_str_384;
if ((j == 3) && (i == 1)) {
- this->var_str_9f4 = g_zbasic->str(41) + this->var_str_9f4;
+ this->var_str_9f4 = _zbasic->str(41) + this->var_str_9f4;
}
// 128:315e
- g_zbasic->menu(j, i, this->var_i16_9f2, this->var_str_9f4);
+ _zbasic->menu(j, i, this->var_i16_9f2, this->var_str_9f4);
}
// 128:3180
}
// 128:318e
fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0x3c;
this->var_i16_7de = 0x2d;
// draw the first page of text
for (int i = 1; i <= 0xf; i++) {
// 128:31ec
g_toolbox->MoveTo(0x41, this->var_i16_7a2);
- this->var_str_384 = g_zbasic->index(0, i);
+ this->var_str_384 = _zbasic->index(0, i);
g_toolbox->DrawString(this->var_str_384);
this->var_i16_7a2 += 0xf;
}
@@ -1514,17 +1512,17 @@ void FoolGame::sub_128_3032() {
// 128:3294
this->sub_128_32c8();
if (_sunMapRestored == 0) {
- g_zbasic->menu(2, 7, 0, Common::U32String());
+ _zbasic->menu(2, 7, 0, Common::U32String());
} else {
- g_zbasic->menu(2, 7, 1, Common::U32String());
+ _zbasic->menu(2, 7, 1, Common::U32String());
}
}
void FoolGame::sub_128_32c8() {
if (!_soundEnabled) {
- g_zbasic->menu(2, 6, 1, Common::U32String());
+ _zbasic->menu(2, 6, 1, Common::U32String());
} else {
- g_zbasic->menu(2, 6, 0x86, Common::U32String());
+ _zbasic->menu(2, 6, 0x86, Common::U32String());
}
}
@@ -1540,10 +1538,10 @@ void FoolGame::savePrompt() {
Common::U32String previous = _saveFileName;
_saveFileName.clear();
- _modalText[0] = g_zbasic->str(43); // do you wish to save this game
- _modalText[1] = g_zbasic->str(44); // yes
- _modalText[2] = g_zbasic->str(45); // no
- _modalText[3] = g_zbasic->str(46); // cancel
+ _modalText[0] = _zbasic->str(43); // do you wish to save this game
+ _modalText[1] = _zbasic->str(44); // yes
+ _modalText[2] = _zbasic->str(45); // no
+ _modalText[3] = _zbasic->str(46); // cancel
this->sub_128_dfe(0, 0, 3, 0);
if (_savePromptChoice > 1) {
_saveFileName = previous;
@@ -1601,29 +1599,29 @@ void FoolGame::saveGame() {
this->var_i16_7e6 = 0;
// 128:359e: LEA - [0x3808],A0
// 128:35a2: MOVE.L - A0,-0x8ee(A5)
- g_zbasic->defOpen(g_zbasic->str(59)); // FOOLgf87
- g_zbasic->openW(2, _saveFileName, 0x400, this->var_i16_9ec);
+ _zbasic->defOpen(_zbasic->str(59)); // FOOLgf87
+ _zbasic->openW(2, _saveFileName, 0x400, this->var_i16_9ec);
if (this->var_i16_7e6 != 0xa) {
- this->var_str_af4 = g_zbasic->str(60); // The Fool's Errand
- g_zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
- g_zbasic->writeFileInt(2, _storyNextPage);
- g_zbasic->writeFileInt(2, _activePuzzle);
- g_zbasic->writeFileInt(2, this->var_i16_7ce);
- g_zbasic->writeFileInt(2, _sunMapRestored);
+ this->var_str_af4 = _zbasic->str(60); // The Fool's Errand
+ _zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
+ _zbasic->writeFileInt(2, _storyNextPage);
+ _zbasic->writeFileInt(2, _activePuzzle);
+ _zbasic->writeFileInt(2, this->var_i16_7ce);
+ _zbasic->writeFileInt(2, _sunMapRestored);
for (int i = 1; i <= 0x64; i++) {
- g_zbasic->writeFileInt(2, _puzzleFlags[i]);
- g_zbasic->writeFileInt(2, _puzzleCompletionStatus[i]);
- g_zbasic->writeFileInt(2, _pageVisible[i]);
- Common::String state = g_zbasic->indexRaw(2, i);
- g_zbasic->writeFileInt(2, (int16)state.size());
- g_zbasic->writeFileStr(2, state);
+ _zbasic->writeFileInt(2, _puzzleFlags[i]);
+ _zbasic->writeFileInt(2, _puzzleCompletionStatus[i]);
+ _zbasic->writeFileInt(2, _pageVisible[i]);
+ Common::String state = _zbasic->indexRaw(2, i);
+ _zbasic->writeFileInt(2, (int16)state.size());
+ _zbasic->writeFileStr(2, state);
}
// 128:36ba
for (int i = 1; i <= 0x51; i++) {
- g_zbasic->writeFileInt(2, _sunMapTileID[i]);
+ _zbasic->writeFileInt(2, _sunMapTileID[i]);
}
- g_zbasic->close(2);
+ _zbasic->close(2);
}
// 128:36fe
if (this->var_i16_7e6 != 0) {
@@ -1796,7 +1794,7 @@ void FoolGame::puzzleRun() {
g_toolbox->DrawMenuBar();
}
// 128:3aea
- g_zbasic->indexClear(1);
+ _zbasic->indexClear(1);
if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
this->storyUnlockChapter();
autoSaveGame(); // autosave on progress
@@ -1810,7 +1808,7 @@ void FoolGame::puzzleRun() {
}
// 128:3b9e
for (int i = 1; i <= 5; i++) {
- g_zbasic->menu(7, i, 1, Common::U32String());
+ _zbasic->menu(7, i, 1, Common::U32String());
if (i > 1) {
_puzzleFlags[0x40 + i] |= 0x5;
}
@@ -1844,7 +1842,7 @@ void FoolGame::puzzleRun() {
// 128:3d3a
this->var_i16_484 = 3 + ((_storyCurrentChapter - 1) / 0x10);
this->var_i16_7e4 = 1 + ((_storyCurrentChapter - 1) % 0x10);
- g_zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
+ _zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
this->storyUnlockChapter();
}
autoSaveGame();
@@ -1898,7 +1896,7 @@ void FoolGame::storyUnlockChapter() {
this->var_i16_9f2 = 2;
}
_puzzleFlags[_storyCurrentChapter] |= (this->var_i16_9f2 + 4);
- g_zbasic->menu(menuNo, itemNo, this->var_i16_9f2, Common::U32String());
+ _zbasic->menu(menuNo, itemNo, this->var_i16_9f2, Common::U32String());
}
// 128:3fb4
}
@@ -1910,26 +1908,26 @@ void FoolGame::sub_128_3fb6() {
g_toolbox->DeleteMenu(8);
g_toolbox->DisposeMenu(this->var_menu_bf8);
- g_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
- this->var_str_384 = g_zbasic->str(72); // return to scroll
+ _zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
+ this->var_str_384 = _zbasic->str(72); // return to scroll
if ((_activePuzzle == 0x34) || (_activePuzzle == 0x35)) {
- this->var_str_384 = g_zbasic->str(73); // run for your life
+ this->var_str_384 = _zbasic->str(73); // run for your life
}
// 128:4024
if (_activePuzzle > 0x50) {
- this->var_str_384 = g_zbasic->str(74); // return to map
+ this->var_str_384 = _zbasic->str(74); // return to map
}
- g_zbasic->menu(8, 1, 1, this->var_str_384);
+ _zbasic->menu(8, 1, 1, this->var_str_384);
// 128:4056
if (_puzzleMenuInstructions[_puzzleType[_activePuzzle]*2] <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]) {
- g_zbasic->menu(8, 2, 0, g_zbasic->str(75)); // line
+ _zbasic->menu(8, 2, 0, _zbasic->str(75)); // line
// 128:40c6
this->var_i16_484 = 2;
for (int i = _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]; i <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]; i++) {
// 128:40f6
this->var_i16_484++;
- this->var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(76);
- g_zbasic->menu(8, this->var_i16_484, 1, this->var_str_384);
+ this->var_str_384 = _zbasic->index(0, i) + _zbasic->str(76);
+ _zbasic->menu(8, this->var_i16_484, 1, this->var_str_384);
}
}
// 128:4166
@@ -1941,7 +1939,7 @@ void FoolGame::puzzleLoadContext() {
if (_activePuzzleStatus == 0x64) {
_activePuzzleStatus = 0x65;
}
- _activePuzzleBuffer = g_zbasic->indexRaw(2, _activePuzzle);
+ _activePuzzleBuffer = _zbasic->indexRaw(2, _activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = _activePuzzleBuffer;
debugC(5, kDebugLoading, "puzzleLoadContext: loading puzzle %d context, state %d, size %d", _activePuzzle, _activePuzzleStatus, inter.size());
@@ -1952,7 +1950,7 @@ void FoolGame::puzzleLoadContext() {
void FoolGame::puzzleSaveContext() {
// 128:41aa
_puzzleCompletionStatus[_activePuzzle] = _activePuzzleStatus;
- g_zbasic->indexRawSet(_activePuzzleBuffer, 2, _activePuzzle);
+ _zbasic->indexRawSet(_activePuzzleBuffer, 2, _activePuzzle);
if (debugChannelSet(5, kDebugLoading)) {
Common::String inter = _activePuzzleBuffer;
debugC(5, kDebugLoading, "puzzleSaveContext: saving puzzle %d context, state %d, size %d", _activePuzzle, _activePuzzleStatus, inter.size());
@@ -2127,13 +2125,13 @@ void FoolGame::menuAbout() {
// 128:4a92
if (_saveFileName.empty()) { // was: str(77)
// untitled game in progress
- _modalText[0] = g_zbasic->chr(0x22) + g_zbasic->str(78) + g_zbasic->chr(0x22) + g_zbasic->str(79);
+ _modalText[0] = _zbasic->chr(0x22) + _zbasic->str(78) + _zbasic->chr(0x22) + _zbasic->str(79);
} else {
// 128:4aee
- _modalText[0] = g_zbasic->chr(0x22) + _saveFileName + g_zbasic->chr(0x22) + g_zbasic->str(80);
+ _modalText[0] = _zbasic->chr(0x22) + _saveFileName + _zbasic->chr(0x22) + _zbasic->str(80);
}
// 128:4b28
- _modalText[1] = g_zbasic->str(81);
+ _modalText[1] = _zbasic->str(81);
if (_sunMapRestored == 0) {
this->var_i16_68c = 0x51;
@@ -2146,14 +2144,14 @@ void FoolGame::menuAbout() {
// 128:4b88
if (this->var_i16_68c >= 0) {
// sun's map is incomplete
- _modalText[2] = g_zbasic->str(82);
+ _modalText[2] = _zbasic->str(82);
if (this->var_i16_68c == 1) {
// there is 1 missing piece
- _modalText[3] = g_zbasic->str(83);
+ _modalText[3] = _zbasic->str(83);
} else {
// 128:4bde
// there are N missing pieces
- _modalText[3] = Common::U32String::format("%s %d%s", g_zbasic->str(84).encode().c_str(), this->var_i16_68c, g_zbasic->str(85).encode().c_str());
+ _modalText[3] = Common::U32String::format("%s %d%s", _zbasic->str(84).encode().c_str(), this->var_i16_68c, _zbasic->str(85).encode().c_str());
}
// 128:4c1a
this->var_i16_68c = 0;
@@ -2165,14 +2163,14 @@ void FoolGame::menuAbout() {
}
// 128:4c74
// blank
- _modalText[4] = g_zbasic->str(86);
+ _modalText[4] = _zbasic->str(86);
if (this->var_i16_68c == 1) {
// There is 1 unsolved puzzle.
- _modalText[5] = g_zbasic->str(87);
+ _modalText[5] = _zbasic->str(87);
} else {
// 128:4cc0
// There are X unsolved puzzles.
- _modalText[5] = Common::U32String::format("%s %d%s", g_zbasic->str(88).encode().c_str(), this->var_i16_68c, g_zbasic->str(89).encode().c_str());
+ _modalText[5] = Common::U32String::format("%s %d%s", _zbasic->str(88).encode().c_str(), this->var_i16_68c, _zbasic->str(89).encode().c_str());
}
// 128:4cfc
this->var_i16_d06 = 5;
@@ -2180,24 +2178,24 @@ void FoolGame::menuAbout() {
} else {
// 128:4d06
// You have all the map pieces, but they are not arranged in the correct order.
- _modalText[2] = g_zbasic->str(90);
- _modalText[3] = g_zbasic->str(91);
- _modalText[4] = g_zbasic->str(92);
- _modalText[5] = g_zbasic->str(93);
+ _modalText[2] = _zbasic->str(90);
+ _modalText[3] = _zbasic->str(91);
+ _modalText[4] = _zbasic->str(92);
+ _modalText[5] = _zbasic->str(93);
// Only the Book of Thoth remains unsolved.
- _modalText[6] = g_zbasic->str(94);
- _modalText[7] = g_zbasic->str(95);
+ _modalText[6] = _zbasic->str(94);
+ _modalText[7] = _zbasic->str(95);
this->var_i16_d06 = 7;
}
// 128:4dc0
} else {
// 128:4dc4
// The sun's map is restored.
- _modalText[2] = g_zbasic->str(96);
- _modalText[3] = g_zbasic->str(97);
+ _modalText[2] = _zbasic->str(96);
+ _modalText[3] = _zbasic->str(97);
// Only the Book of Thoth remains unsolved.
- _modalText[4] = g_zbasic->str(98);
- _modalText[5] = g_zbasic->str(99);
+ _modalText[4] = _zbasic->str(98);
+ _modalText[5] = _zbasic->str(99);
this->var_i16_d06 = 5;
}
// 128:4e42
@@ -2206,7 +2204,7 @@ void FoolGame::menuAbout() {
g_toolbox->InitCursor();
this->sub_128_4da(1);
this->copyScreen(0, this->arr_bmp_138bc);
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7b4 = 0;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
@@ -2257,10 +2255,10 @@ void FoolGame::menuAbout() {
g_toolbox->PlotIcon(bounds, this->var_i32_c);
// the fool's errand
g_toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
- g_toolbox->DrawString(g_zbasic->str(100));
+ g_toolbox->DrawString(_zbasic->str(100));
// by Cliff Johnson
g_toolbox->MoveTo(0xee, 0x9b - this->var_i16_7b6);
- g_toolbox->DrawString(g_zbasic->str(101));
+ g_toolbox->DrawString(_zbasic->str(101));
// 128:509a
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
@@ -2270,9 +2268,9 @@ void FoolGame::menuAbout() {
this->var_i16_7a2 += 0x11;
}
// 128:50f4
- g_zbasic->text(0xfc, 0x9, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfc, 0x9, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 += 0xe;
- this->sub_128_918(g_zbasic->str(102)); // version string
+ this->sub_128_918(_zbasic->str(102)); // version string
this->sub_128_2664();
this->sub_128_61c2();
g_toolbox->DrawMenuBar();
@@ -2280,13 +2278,21 @@ void FoolGame::menuAbout() {
g_toolbox->SetPort(this->var_i32_0);
}
+void FoolGame::menuPrologue() {
+ // this is brand new
+ this->copyScreen(0, this->arr_bmp_138bc);
+ FoolPrologue fp;
+ fp.run();
+ this->copyScreen(1, this->arr_bmp_138bc);
+}
+
// three freakin' ships
void FoolGame::shipsRun() {
// 128:5140
fillRect(0x127, 0x6c, 0x137, 0x84, 0);
this->sub_128_6186();
- this->sub_128_55c(g_zbasic->str(103)); // "?"
- g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ this->sub_128_55c(_zbasic->str(103)); // "?"
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
//warning("sub_128_5140: b3ec surface");
//byte fakePal[768];
//Common::fill(fakePal, fakePal+3, 0xff);
@@ -2295,14 +2301,14 @@ void FoolGame::shipsRun() {
fillRect(0x127, 0x6c, 0x137, 0x84, 0);
- g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
//warning("sub_128_5140: bbbc surface");
//this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 160, fakePal);
// 138:51f0
- this->var_i16_d08 = g_zbasic->rndInt(5) + 5;
- this->var_i16_d0a = g_zbasic->rndInt(5) - 0xa;
+ this->var_i16_d08 = _zbasic->rndInt(5) + 5;
+ this->var_i16_d0a = _zbasic->rndInt(5) - 0xa;
for (int16 i = 0; i <= 5; i++) {
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->sub_128_5a6c();
}
@@ -2333,7 +2339,7 @@ void FoolGame::shipsRun() {
if (_activePuzzleSolved) {
this->sub_128_6186();
this->sub_128_50e(0x14, 0x64, 0);
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
_event.where.x += 5;
_event.where.y -= 5;
if (_activePuzzleStatus < 0x64) {
@@ -2379,7 +2385,7 @@ void FoolGame::shipsRun() {
kPatCopy,
0x42
);
- this->var_str_384 = g_zbasic->str(104); // behold the 1st key of thoth
+ this->var_str_384 = _zbasic->str(104); // behold the 1st key of thoth
this->sub_128_178a(0, 0);
}
// 128:55aa
@@ -2393,13 +2399,13 @@ void FoolGame::sub_128_55ac() {
if ((this->var_i16_d10 == _event.where.x) && (this->var_i16_d0e == _event.where.y)) {
return;
}
- this->var_i16_d08 = g_zbasic->rndInt(5) + 5;
- this->var_i16_d0a = g_zbasic->rndInt(5) + 5;
- if (g_zbasic->maybe()) {
+ this->var_i16_d08 = _zbasic->rndInt(5) + 5;
+ this->var_i16_d0a = _zbasic->rndInt(5) + 5;
+ if (_zbasic->maybe()) {
this->var_i16_d08 *= -1;
}
// 128:560a
- if (g_zbasic->maybe()) {
+ if (_zbasic->maybe()) {
this->var_i16_d0a *= -1;
}
// 128:5620
@@ -2418,7 +2424,7 @@ void FoolGame::sub_128_55ac() {
}
// 128:56a0
for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->sub_128_5a6c();
}
@@ -2432,22 +2438,22 @@ void FoolGame::sub_128_55ac() {
void FoolGame::sub_128_57a2() {
// 128:57a2
- this->var_str_d12 = g_zbasic->ucase(g_zbasic->chr(_keyLastPressed));
- if (g_zbasic->instr(1, g_zbasic->str(105), this->var_str_d12) > 0) { // NESW
+ this->var_str_d12 = _zbasic->ucase(_zbasic->chr(_keyLastPressed));
+ if (_zbasic->instr(1, _zbasic->str(105), this->var_str_d12) > 0) { // NESW
// 128:57e0
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
this->var_i16_d08 = 0;
this->var_i16_d0a = 0;
- if (this->var_str_d12 == g_zbasic->str(106)) { // N
+ if (this->var_str_d12 == _zbasic->str(106)) { // N
this->var_i16_d0a = -0x10;
}
- if (this->var_str_d12 == g_zbasic->str(107)) { // S
+ if (this->var_str_d12 == _zbasic->str(107)) { // S
this->var_i16_d0a = 0x10;
}
- if (this->var_str_d12 == g_zbasic->str(108)) { // W
+ if (this->var_str_d12 == _zbasic->str(108)) { // W
this->var_i16_d08 = -0x18;
}
- if (this->var_str_d12 == g_zbasic->str(109)) { // E
+ if (this->var_str_d12 == _zbasic->str(109)) { // E
this->var_i16_d08 = 0x18;
}
g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
@@ -2488,14 +2494,14 @@ void FoolGame::sub_128_57a2() {
void FoolGame::sub_128_5a6c() {
// 128:5a6c
this->var_i32_692 = g_toolbox->TickCount();
- g_zbasic->get(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_rect_1910c.right, this->arr_rect_1910c.bottom, this->arr_bmp_bbbc);
+ _zbasic->get(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_rect_1910c.right, this->arr_rect_1910c.bottom, this->arr_bmp_bbbc);
//warning("sub_128_5a6c: bbbc surface");
//byte fakePal[768];
//Common::fill(fakePal, fakePal+3, 0xff);
//Common::fill(fakePal+3, fakePal+768, 0x00);
//this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
- g_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
this->sub_128_406(0);
}
@@ -2546,7 +2552,11 @@ void FoolGame::sub_128_5baa() {
void FoolGame::sub_128_5c20() {
_stateFlags = kStateNull;
if (_selectedMenuID == 1) { // Eye menu
- this->menuAbout();
+ if (_selectedMenuItem == 2) {
+ this->menuAbout();
+ } else if (_selectedMenuItem == 3) {
+ this->menuPrologue();
+ }
}
if (_selectedMenuID == 2) { // File menu
if (_selectedMenuItem == 1) {
@@ -2626,7 +2636,7 @@ void FoolGame::sub_128_5c20() {
void FoolGame::thothHidePlayfield() {
// 128:5ef0
this->copyScreen(0, this->arr_bmp_b3ec);
- g_zbasic->picture(0, 0x14, this->var_pic_7c2);
+ _zbasic->picture(0, 0x14, this->var_pic_7c2);
}
void FoolGame::thothShowPlayfield() {
@@ -2636,7 +2646,7 @@ void FoolGame::thothShowPlayfield() {
this->arr_i16_1eb8[0] = 1;
}
// 128:5f4c
- _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
+ _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[0]);
this->saveGame();
}
// 128:5f70
@@ -2688,7 +2698,7 @@ void FoolGame::sub_128_6154() {
this->var_i16_e1c = _event.message >> 16;
this->var_i16_e1e = _event.message & 0xffff;
if (this->var_i16_e1c != 0) {
- g_zbasic->unk_11(this->var_i16_e1e);
+ _zbasic->unk_11(this->var_i16_e1e);
}
}
@@ -2759,11 +2769,11 @@ void FoolGame::sub_129_004() {
// 129:000a: LEA - 0x3ea(A5),A0
// 129:000e: MOVE.L - A0,-0x8ee(A5)
// 129:0012: SF - 0x8,D0
- g_zbasic->openR(1, g_zbasic->str(110), 0x3e8, this->var_i16_e20); // fool's puzzles
+ _zbasic->openR(1, _zbasic->str(110), 0x3e8, this->var_i16_e20); // fool's puzzles
if (this->var_i16_7e6 == 0) {
- this->var_str_e22 = g_zbasic->str(111); // fool's puzzles
+ this->var_str_e22 = _zbasic->str(111); // fool's puzzles
this->var_i16_f22 = this->var_i16_e20;
- g_zbasic->close(1);
+ _zbasic->close(1);
this->var_i16_7e6 = 0;
}
@@ -2804,8 +2814,8 @@ void FoolGame::sub_129_068() {
_screenOversized = true;
}
// 129:0166
- g_zbasic->window(1, g_zbasic->str(112), 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
- g_zbasic->coordinateWindow();
+ _zbasic->window(1, _zbasic->str(112), 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
+ _zbasic->coordinateWindow();
g_toolbox->ClearMenuBar();
g_toolbox->DrawMenuBar();
@@ -2868,43 +2878,43 @@ void FoolGame::sub_129_068() {
if (false) {
//if (this->var_i16_372.red + this->var_i16_372.blue + this->var_i16_372.green != 0) {
// we're in colour mode, chide the user
- _modalText[0] = g_zbasic->str(113);
- _modalText[1] = g_zbasic->str(114);
- _modalText[2] = g_zbasic->str(115);
- _modalText[3] = g_zbasic->str(116);
+ _modalText[0] = _zbasic->str(113);
+ _modalText[1] = _zbasic->str(114);
+ _modalText[2] = _zbasic->str(115);
+ _modalText[3] = _zbasic->str(116);
this->sub_128_dfe(0, 2, 1, 0);
- g_zbasic->unk_4();
+ _zbasic->unk_4();
}
// 129:0390
this->sub_128_61ec();
- this->var_i32_37c = g_zbasic->mem(-1);
+ this->var_i32_37c = _zbasic->mem(-1);
if (this->var_i32_37c < 0x1d4c0) {
// not enough memory, chide the user
- _modalText[0] = g_zbasic->str(117);
- _modalText[1] = g_zbasic->str(118);
- _modalText[2] = g_zbasic->str(119);
- _modalText[3] = g_zbasic->str(120);
- _modalText[4] = g_zbasic->str(121);
- _modalText[5] = g_zbasic->str(122);
- _modalText[6] = g_zbasic->str(123);
+ _modalText[0] = _zbasic->str(117);
+ _modalText[1] = _zbasic->str(118);
+ _modalText[2] = _zbasic->str(119);
+ _modalText[3] = _zbasic->str(120);
+ _modalText[4] = _zbasic->str(121);
+ _modalText[5] = _zbasic->str(122);
+ _modalText[6] = _zbasic->str(123);
this->sub_128_dfe(0, 5, 1, 1);
- g_zbasic->unk_4();
+ _zbasic->unk_4();
}
// 129:0496
this->var_i16_7e4 = 1;
- this->var_str_e22 = g_zbasic->str(124);
- _saveFileName = g_zbasic->str(125);
+ this->var_str_e22 = _zbasic->str(124);
+ _saveFileName = _zbasic->str(125);
- this->var_i16_484 = g_zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
+ this->var_i16_484 = _zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
- if (this->var_str_588 != g_zbasic->str(126)) {
- if (this->var_str_588 == g_zbasic->str(127)) { // Fool's Puzzles
- this->var_str_e22 = g_zbasic->str(128);
+ if (this->var_str_588 != _zbasic->str(126)) {
+ if (this->var_str_588 == _zbasic->str(127)) { // Fool's Puzzles
+ this->var_str_e22 = _zbasic->str(128);
this->var_i16_f22 = this->var_i16_688;
} else {
// 129:052e
this->sub_128_2808();
- if (this->var_str_588 != g_zbasic->str(129)) {
+ if (this->var_str_588 != _zbasic->str(129)) {
// 129:054c
_saveFileName = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
@@ -2914,43 +2924,43 @@ void FoolGame::sub_129_068() {
// 129:0562
this->var_i16_f2c = this->sub_128_5fe(); // volume ref num
this->var_i16_e20 = this->var_i16_f2c;
- if (this->var_str_e22 == g_zbasic->str(130)) {
+ if (this->var_str_e22 == _zbasic->str(130)) {
this->sub_129_004();
}
// 129:058c
- if (this->var_str_e22 == g_zbasic->str(131)) {
+ if (this->var_str_e22 == _zbasic->str(131)) {
for (this->var_i16_f2e = 1; this->var_i16_f2e < 0x3e8; this->var_i16_f2e++) {
- this->var_str_f30 = g_zbasic->files(-this->var_i16_f2e, g_zbasic->str(132), Common::U32String(), this->var_i16_e20);
- if ((this->var_i16_e20 == 0) || (this->var_str_f30 == g_zbasic->str(133))) {
+ this->var_str_f30 = _zbasic->files(-this->var_i16_f2e, _zbasic->str(132), Common::U32String(), this->var_i16_e20);
+ if ((this->var_i16_e20 == 0) || (this->var_str_f30 == _zbasic->str(133))) {
this->var_i16_f2e = 0x3e8;
}
// 129:0606
this->sub_129_004();
- if (this->var_str_e22 != g_zbasic->str(134)) {
+ if (this->var_str_e22 != _zbasic->str(134)) {
this->var_i16_f2e = 0x3e8;
}
}
}
// 129:0636
- if (this->var_str_e22 == g_zbasic->str(135)) {
+ if (this->var_str_e22 == _zbasic->str(135)) {
do {
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
fillRect(0x17, 0x92, 0x31, 0x16e, 2);
this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
this->sub_128_4da(1);
- Common::U32String PUZZ = g_zbasic->str(137);
+ Common::U32String PUZZ = _zbasic->str(137);
this->sub_128_1e4(PUZZ);
// 129:06a6: CLR.W - -0x772(A5)
fillRect(0x17, 0x92, 0x31, 0x16e, 1);
this->sub_128_4da(0);
- if (this->var_str_588 == g_zbasic->str(138)) {
- g_zbasic->unk_4();
+ if (this->var_str_588 == _zbasic->str(138)) {
+ _zbasic->unk_4();
}
this->var_str_e22 = this->var_str_588;
this->var_i16_f22 = this->var_i16_688;
- } while (this->var_str_e22 != g_zbasic->str(139));
+ } while (this->var_str_e22 != _zbasic->str(139));
}
// 129:0718
this->sub_128_64c(this->var_i16_f22);
@@ -2964,21 +2974,21 @@ void FoolGame::sub_129_068() {
g_toolbox->DetachResource(h);
}
// 129:07a2
- g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
- g_zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, this->arr_bmp_5dfc);
- g_zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, this->arr_bmp_b3ec);
- g_zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
+ _zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ _zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, this->arr_bmp_5dfc);
+ _zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, this->arr_bmp_b3ec);
+ _zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
// 129:0846
// unfurl the scroll by blitting the lower half a bunch of times
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = g_zbasic->readDataInt();
- g_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kSrcCopy);
+ this->var_i16_484 = _zbasic->readDataInt();
+ _zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kSrcCopy);
this->sub_128_3da(2);
}
// 129:0888
- g_zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kSrcCopy);
- g_zbasic->put(0x1f9, 0x14f, this->arr_bmp_109dc, kSrcCopy);
- g_zbasic->picture(0x39, 0x29, this->arr_i32_192c0[1]);
+ _zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(0x1f9, 0x14f, this->arr_bmp_109dc, kSrcCopy);
+ _zbasic->picture(0x39, 0x29, this->arr_i32_192c0[1]);
// 129:08ee
for (int i = 0; i <= 1; i++) {
@@ -3014,13 +3024,13 @@ void FoolGame::sub_129_068() {
this->var_i32_c = g_toolbox->GetIcon(0x101);
g_toolbox->DetachResource(this->var_i32_c);
// 129:09c2: SF - 0x8,D0
- g_zbasic->openR(1, g_zbasic->str(140), 1000, this->var_i16_f22);
- this->var_i32_1036 = g_zbasic->readFileDblInt(1);
+ _zbasic->openR(1, _zbasic->str(140), 1000, this->var_i16_f22);
+ this->var_i32_1036 = _zbasic->readFileDblInt(1);
this->var_ptr_696 = 0;
// read into pointer
- this->arr_bytes_5dfc = g_zbasic->readFile(1, this->var_i32_1036);
+ this->arr_bytes_5dfc = _zbasic->readFile(1, this->var_i32_1036);
this->var_bytes_696 = this->arr_bytes_5dfc;
// 129:0a0a
@@ -3109,10 +3119,10 @@ void FoolGame::sub_129_068() {
if (this->var_i16_103e & 0x8) {
this->var_i16_103e ^= 0x8;
// 129:0d7e
- g_zbasic->indexRawSet(g_zbasic->space(4).encode(Common::kMacRoman) + puzzlesReadString(), 0, i);
+ _zbasic->indexRawSet(_zbasic->space(4).encode(Common::kMacRoman) + puzzlesReadString(), 0, i);
} else {
// 129:0da4
- g_zbasic->indexRawSet(puzzlesReadString(), 0, i);
+ _zbasic->indexRawSet(puzzlesReadString(), 0, i);
}
// 129:0db8
// 0x4 == newline
@@ -3142,7 +3152,7 @@ void FoolGame::sub_129_068() {
this->sub_129_123a();
this->var_i16_103a = puzzlesReadShort();
for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
- g_zbasic->indexRawSet(puzzlesReadString(), 0, i);
+ _zbasic->indexRawSet(puzzlesReadString(), 0, i);
}
// 129:0ec2
for (int j = 1; j <= 0x50; j++) {
@@ -3163,7 +3173,7 @@ void FoolGame::sub_129_068() {
if (_pageToChapter[i] == j) {
this->var_i16_484++;
// - X of N
- _pageNumberText[i] = Common::U32String::format("%s %d%s %d", g_zbasic->str(141).encode().c_str(), this->var_i16_484, g_zbasic->str(142).encode().c_str(), this->var_i16_1040);
+ _pageNumberText[i] = Common::U32String::format("%s %d%s %d", _zbasic->str(141).encode().c_str(), this->var_i16_484, _zbasic->str(142).encode().c_str(), this->var_i16_1040);
}
// 129:0fb6
if (_pageToChapter[i] > j) {
@@ -3194,22 +3204,24 @@ void FoolGame::sub_129_068() {
g_toolbox->InitCursor();
this->sub_128_4da(1);
// Apple menu
- g_zbasic->menu(1, 0, 1, g_zbasic->str(143)); // wadjet eye
- g_zbasic->menu(1, 1, 0, g_zbasic->str(144)); // sep
- g_zbasic->menu(1, 2, 1, g_zbasic->str(145)); // about fool's errand
- g_zbasic->menu(1, 3, 0, g_zbasic->str(146)); // sep
+ _zbasic->menu(1, 0, 1, _zbasic->str(143)); // wadjet eye
+ _zbasic->menu(1, 1, 0, _zbasic->str(144)); // sep
+ _zbasic->menu(1, 2, 1, _zbasic->str(145)); // about fool's errand
+ // this is brand new
+ _zbasic->menu(1, 3, 1, Common::U32String("Show Prologue"));
+ _zbasic->menu(1, 4, 0, _zbasic->str(146)); // sep
// File menu
- g_zbasic->menu(2, 0, 1, g_zbasic->str(147)); // file
- g_zbasic->menu(2, 1, 1, g_zbasic->str(148)); // new
- g_zbasic->menu(2, 2, 1, g_zbasic->str(149)); // open
- g_zbasic->menu(2, 3, 1, g_zbasic->str(150)); // save
- g_zbasic->menu(2, 4, 1, g_zbasic->str(151)); // save as
- g_zbasic->menu(2, 5, 0, g_zbasic->str(152)); // sep
- g_zbasic->menu(2, 6, 1, g_zbasic->str(153)); // sound
- g_zbasic->menu(2, 7, 1, g_zbasic->str(154)); // print story
- g_zbasic->menu(2, 8, 0, g_zbasic->str(155)); // sep
- g_zbasic->menu(2, 9, 1, g_zbasic->str(156)); // quit
+ _zbasic->menu(2, 0, 1, _zbasic->str(147)); // file
+ _zbasic->menu(2, 1, 1, _zbasic->str(148)); // new
+ _zbasic->menu(2, 2, 1, _zbasic->str(149)); // open
+ _zbasic->menu(2, 3, 1, _zbasic->str(150)); // save
+ _zbasic->menu(2, 4, 1, _zbasic->str(151)); // save as
+ _zbasic->menu(2, 5, 0, _zbasic->str(152)); // sep
+ _zbasic->menu(2, 6, 1, _zbasic->str(153)); // sound
+ _zbasic->menu(2, 7, 1, _zbasic->str(154)); // print story
+ _zbasic->menu(2, 8, 0, _zbasic->str(155)); // sep
+ _zbasic->menu(2, 9, 1, _zbasic->str(156)); // quit
this->sub_128_6244();
// 129:11f6
@@ -3231,9 +3243,9 @@ void FoolGame::sub_129_123a() {
// draw the loading text on the menu bar
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
- this->var_str_172 = Common::U32String::format("%s %d%s", g_zbasic->str(158).encode().c_str(), this->var_i16_68a, g_zbasic->str(159).encode().c_str());
+ this->var_str_172 = Common::U32String::format("%s %d%s", _zbasic->str(158).encode().c_str(), this->var_i16_68a, _zbasic->str(159).encode().c_str());
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xe);
g_toolbox->DrawString(this->var_str_172);
@@ -3247,12 +3259,12 @@ void FoolGame::sub_129_123a() {
void FoolGame::hermitRun() {
// 142:12ac
if (_puzzleCompletionStatus[0x34] < 5) {
- g_zbasic->menu(8, 3, 1, g_zbasic->str(362)); // to find a hidden secret
- g_zbasic->menu(8, 4, 1, g_zbasic->str(363));
+ _zbasic->menu(8, 3, 1, _zbasic->str(362)); // to find a hidden secret
+ _zbasic->menu(8, 4, 1, _zbasic->str(363));
} else {
// 142:12fc
- g_zbasic->menu(8, 3, 1, g_zbasic->str(364)); // to find the straight path
- g_zbasic->menu(8, 4, 1, g_zbasic->str(365));
+ _zbasic->menu(8, 3, 1, _zbasic->str(364)); // to find the straight path
+ _zbasic->menu(8, 4, 1, _zbasic->str(365));
}
// 142:132c
if (_activePuzzleStatus == 0) {
@@ -3297,7 +3309,7 @@ void FoolGame::hermitRun() {
void FoolGame::sub_144_004() {
// 144:0004
g_toolbox->ReleaseResource(var_pic_7c2);
- var_i32_7c8 = g_zbasic->mem(-1);
+ var_i32_7c8 = _zbasic->mem(-1);
_stateFlags = kStateQuit;
if (!_screenOversized) {
g_toolbox->SetPort(var_i32_8);
@@ -3321,10 +3333,10 @@ void FoolGame::sub_144_004() {
g_toolbox->SetPort(var_i32_0);
}
// 144:0082
- g_zbasic->get(1, var_i16_42+1, SCREEN_WIDTH, SCREEN_HEIGHT-1, arr_bmp_5dfc);
+ _zbasic->get(1, var_i16_42+1, SCREEN_WIDTH, SCREEN_HEIGHT-1, arr_bmp_5dfc);
for (int16 i = 0xa; i <= 0xf0; i += 0xa) {
var_i32_692 = g_toolbox->TickCount();
- g_zbasic->put(
+ _zbasic->put(
i,
var_i16_42 + (int16)(i*0.6f),
SCREEN_WIDTH - i,
@@ -3356,17 +3368,17 @@ void FoolGame::sub_144_004() {
sub_128_406(1);
}
// 144:0268
- _modalText[0] = g_zbasic->str(368); // what's this?
- _modalText[1] = g_zbasic->str(369); // more evil treachery afoot?
- _modalText[2] = g_zbasic->str(370); // has not the fool has gained the gift of wisdom?
- _modalText[3] = g_zbasic->str(371); // -blank-
- _modalText[4] = g_zbasic->str(372); // locate and double-click the show finale file
- _modalText[5] = g_zbasic->str(373); // this will oepn the 'prologue - finale' once again
- _modalText[6] = g_zbasic->str(374); // but now, you'll see the finale
- _modalText[7] = g_zbasic->str(375); // -blank-
- _modalText[8] = g_zbasic->str(376); // congratulations!
- _modalText[9] = g_zbasic->str(377); // -blank-
- _modalText[10] = g_zbasic->str(378); // quit
+ _modalText[0] = _zbasic->str(368); // what's this?
+ _modalText[1] = _zbasic->str(369); // more evil treachery afoot?
+ _modalText[2] = _zbasic->str(370); // has not the fool has gained the gift of wisdom?
+ _modalText[3] = _zbasic->str(371); // -blank-
+ _modalText[4] = _zbasic->str(372); // locate and double-click the show finale file
+ _modalText[5] = _zbasic->str(373); // this will oepn the 'prologue - finale' once again
+ _modalText[6] = _zbasic->str(374); // but now, you'll see the finale
+ _modalText[7] = _zbasic->str(375); // -blank-
+ _modalText[8] = _zbasic->str(376); // congratulations!
+ _modalText[9] = _zbasic->str(377); // -blank-
+ _modalText[10] = _zbasic->str(378); // quit
sub_128_dfe(0xfa, 9, 1, 0);
if (!_screenOversized) {
g_toolbox->ClearMenuBar();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index f3bdff4dc3a..6a6dd09f049 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -30,6 +30,8 @@
namespace Fool {
+class ZBasic;
+
enum FoolStateBits : uint16 {
kStateNull = 0x00,
kStateReturn = 0x01,
@@ -41,6 +43,7 @@ enum FoolStateBits : uint16 {
kStateChapterSelect = 0x40,
kStatePuzzleSelect = 0x80,
kStateMetapuzzleSelect = 0x100,
+ kStatePrintStory = 0x400,
kStateMetapuzzleComplete = 0x800,
};
@@ -131,6 +134,7 @@ public:
void sub_128_41d8();
void sub_128_4472();
void menuAbout(); // sub_128_4a92
+ void menuPrologue();
void shipsRun(); // sub_128_5140
void sub_128_55ac();
@@ -413,6 +417,7 @@ public:
private:
+ ZBasic *_zbasic;
bool _quit = false;
GrafPtr var_i32_0;
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index ce2ab5e669c..16ddbf404f7 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// the humbug - "irritating stick" style challenge
@@ -45,7 +45,7 @@ void FoolGame::humbugRun() {
// 142:004e
_activePuzzleStatus = 0x63;
this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- this->var_str_384 = g_zbasic->str(336); // behold the 2nd key of thoth
+ this->var_str_384 = _zbasic->str(336); // behold the 2nd key of thoth
this->sub_128_178a(0x17, 0);
}
// 142:00b2
@@ -65,24 +65,24 @@ void FoolGame::humbugRun() {
void FoolGame::humbugTrail() {
// 142:00e6
if (_puzzleCompletionStatus[0x34] < 3) {
- g_zbasic->menu(8, 3, 1, g_zbasic->str(337)); // A secret is undone
- g_zbasic->menu(8, 4, 1, g_zbasic->str(338)); // if the two become one.
+ _zbasic->menu(8, 3, 1, _zbasic->str(337)); // A secret is undone
+ _zbasic->menu(8, 4, 1, _zbasic->str(338)); // if the two become one.
} else {
// 142:0136
- g_zbasic->menu(8, 3, 1, g_zbasic->str(339)); // A puzzle is undone
- g_zbasic->menu(8, 4, 1, g_zbasic->str(340)); // if the two become one.
+ _zbasic->menu(8, 3, 1, _zbasic->str(339)); // A puzzle is undone
+ _zbasic->menu(8, 4, 1, _zbasic->str(340)); // if the two become one.
}
// 142:0166
this->sub_128_271a();
this->sub_128_4da(0);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
- this->sub_128_55c(g_zbasic->str(341)); // ~
+ _zbasic->text(0, 0xc, 0, kSrcOr);
+ this->sub_128_55c(_zbasic->str(341)); // ~
// eye button
- g_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
for (int16 i = 1; i <= 0xa42; i++) {
this->arr_i16_9894[i] = puzzlesReadShort();
this->arr_i16_ac1c[i] = puzzlesReadShort();
- g_zbasic->put(
+ _zbasic->put(
this->arr_i16_9894[i],
this->arr_i16_ac1c[i],
this->arr_bmp_b3ec,
@@ -94,7 +94,7 @@ void FoolGame::humbugTrail() {
}
// 142:026e
this->sub_128_4da(1);
- g_zbasic->put(
+ _zbasic->put(
this->arr_i16_9894[this->var_i16_233c],
this->arr_i16_ac1c[this->var_i16_233c],
this->arr_bmp_b3ec,
@@ -153,14 +153,14 @@ void FoolGame::sub_142_370() {
}
this->var_i16_7a8 = this->var_i16_233c;
do {
- g_zbasic->put(
+ _zbasic->put(
this->arr_i16_9894[this->var_i16_7a8],
this->arr_i16_ac1c[this->var_i16_7a8],
this->arr_bmp_b3ec,
kSrcCopy
);
// 142:051c
- } while (g_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
+ } while (_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
this->var_i16_233c = this->var_i16_1a9c;
this->var_i16_1ab6 = _event.where.x;
this->var_i16_1ab8 = _event.where.y;
@@ -171,7 +171,7 @@ void FoolGame::sub_142_370() {
this->var_i16_7e4 = 1;
}
for (int16 i = this->var_i16_233c; i >= this->var_i16_7e4; i--) {
- g_zbasic->put(
+ _zbasic->put(
this->arr_i16_9894[i],
this->arr_i16_ac1c[i],
this->arr_bmp_b3ec,
@@ -194,13 +194,13 @@ void FoolGame::sub_142_5f2() {
void FoolGame::sub_142_630() {
// 142:0630
- g_zbasic->menu(8, 0, 1, g_zbasic->str(342)); // the 2nd key of thoth
- g_zbasic->menu(8, 1, 1, g_zbasic->str(343)); // return to scroll
+ _zbasic->menu(8, 0, 1, _zbasic->str(342)); // the 2nd key of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(343)); // return to scroll
this->thothKey2nd();
if (_activePuzzleSolved) {
// 142:066e
g_toolbox->PenNormal();
- g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ _zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
for (int16 i = 1; i <= 4; i++) {
Common::Rect temp;
temp.top = this->arr_i16_2f38[i*32];
@@ -220,7 +220,7 @@ void FoolGame::sub_142_630() {
g_toolbox->DrawString(this->var_str_384);
}
// 142:07ca
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ _zbasic->text(0, 0xc, 0, kSrcOr);
this->sub_128_6186();
this->sub_128_2664();
this->var_i16_484 = 0;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 437724810b1..a2af15c6793 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -28,7 +28,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// jigsaw puzzle game
@@ -48,7 +48,7 @@ void FoolGame::jigsawRun() {
}
// 132:00a2
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
- g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ _zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
this->var_i16_1aa0 = 4 + ((this->arr_i16_1eb8[12] + 1)*2) * ((this->arr_i16_1eb8[13]+0x10)/0x10);
// 132:0136
@@ -69,20 +69,20 @@ void FoolGame::jigsawRun() {
//this->var_i16_1aa2 = 0x2af8 + this->var_i16_1aa0*(this->arr_i16_3738[this->var_i16_484] - 1);
// 132:0216
_jigsawPieces[this->arr_i16_3738[this->var_i16_484]] = BitMap(new Graphics::ManagedSurface());
- g_zbasic->get(
+ _zbasic->get(
_screenGrid[this->var_i16_484].left,
_screenGrid[this->var_i16_484].top,
_screenGrid[this->var_i16_484].right,
_screenGrid[this->var_i16_484].bottom,
_jigsawPieces[this->arr_i16_3738[this->var_i16_484]]
);
- } while (g_zbasic->incrAndCheck(
+ } while (_zbasic->incrAndCheck(
this->var_i16_68a,
this->arr_i16_1eb8[11],
this->arr_i16_1eb8[6]
));
// 132:02dc
- } while (g_zbasic->incrAndCheck(
+ } while (_zbasic->incrAndCheck(
this->var_i16_68c,
this->arr_i16_1eb8[9],
this->arr_i16_1eb8[7]
@@ -99,9 +99,9 @@ void FoolGame::jigsawRun() {
// rearrange picture tiles to match state
if (!_activePuzzleBuffer.empty()) { // was: str(207)
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- Common::String tileData = g_zbasic->midStr(_activePuzzleBuffer, i*2 - 1, 2);
- this->arr_i16_3738[i] = g_zbasic->decodeInt(tileData);
- g_zbasic->put(
+ Common::String tileData = _zbasic->midStr(_activePuzzleBuffer, i*2 - 1, 2);
+ this->arr_i16_3738[i] = _zbasic->decodeInt(tileData);
+ _zbasic->put(
_screenGrid[i].left,
_screenGrid[i].top,
_jigsawPieces[this->arr_i16_3738[i]],
@@ -112,7 +112,7 @@ void FoolGame::jigsawRun() {
}
// 132:0464
_stateFlags = kStateNull;
- g_zbasic->menu(8, 3, 0, Common::U32String());
+ _zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->jigsawCheckIfSolved();
// JMP 0x4d8
@@ -155,7 +155,7 @@ void FoolGame::jigsawOnClick() {
}
// 132:059c
_menuDisabled = true;
- g_zbasic->menu(8, 3, 0, Common::U32String());
+ _zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
g_toolbox->PenMode(kPatXor);
@@ -181,7 +181,7 @@ void FoolGame::jigsawOnClick() {
this->jigsawDropSelected();
this->jigsawCheckIfSolved();
this->sub_128_6186();
- g_zbasic->menu(8, 3, 1, Common::U32String());
+ _zbasic->menu(8, 3, 1, Common::U32String());
_menuDisabled = false;
}
@@ -286,10 +286,10 @@ void FoolGame::jigsawMoveSelected() {
void FoolGame::jigsawCancelSelect() {
// 132:0e5a
_stateFlags = kStateNull;
- g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
- g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
- g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
- g_zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
+ _zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
+ _zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
+ _zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
+ _zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
jigsawDropSelected();
}
@@ -343,7 +343,7 @@ void FoolGame::jigsawDropSelected() {
// 132:10ba
// 0x2af8, this->var_i16_1aa0 * (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] - 1)
// blit tiles to screen
- g_zbasic->put(
+ _zbasic->put(
_screenGrid[this->arr_i16_2f38[i*32 + j]].left,
_screenGrid[this->arr_i16_2f38[i*32 + j]].top,
_jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
@@ -362,7 +362,7 @@ void FoolGame::jigsawDropSelected() {
this->var_i16_1aa6++;
debug(8, "(%d, %d) [src]: %d <- buffer 2", i, j, this->arr_i16_3738[this->var_i16_1aa6]);
this->arr_i16_3738[this->arr_i16_2f38[i*32+j]] = this->arr_i16_3738[this->var_i16_1aa6];
- g_zbasic->put(
+ _zbasic->put(
_screenGrid[this->arr_i16_2f38[i*32+j]].left,
_screenGrid[this->arr_i16_2f38[i*32+j]].top,
_jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
@@ -377,9 +377,9 @@ void FoolGame::jigsawDropSelected() {
void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
- _activePuzzleBuffer = g_zbasic->str(208);
+ _activePuzzleBuffer = _zbasic->str(208);
for (int i = 1; i <= this->var_i16_1a9e; i++) {
- _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_3738[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_3738[i]);
}
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 4a8eea58c4a..6a9a147b2a4 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -27,7 +27,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// word jumble/substitute puzzle
@@ -76,9 +76,9 @@ void FoolGame::jumbleRun() {
this->var_i16_68c + this->arr_i16_1eb8[12]
);
// 130:00f6
- } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[11], this->arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[11], this->arr_i16_1eb8[6]));
// 130:0126
- } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
// 130:0156
if ((this->var_i16_105a & 0x2) == 2) {
this->var_i16_105c = puzzlesReadShort();
@@ -89,7 +89,7 @@ void FoolGame::jumbleRun() {
this->var_i16_1066 = puzzlesReadShort();
if (this->var_i16_1066 > 0) {
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
}
}
@@ -148,8 +148,8 @@ void FoolGame::jumbleRun() {
// 130:03fe
//if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle)
this->var_i16_106e = 0;
- this->var_str_1070 = g_zbasic->str(168); // empty
- this->var_str_1170 = g_zbasic->str(169); // empty
+ this->var_str_1070 = _zbasic->str(168); // empty
+ this->var_str_1170 = _zbasic->str(169); // empty
this->var_i16_1270 = puzzlesReadShort();
for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
@@ -177,18 +177,18 @@ void FoolGame::jumbleRun() {
}
// 130:0548
if ((_jumbleGameType == 3) || (_jumbleGameType == 6)) {
- this->var_str_9f4 = g_zbasic->space(this->var_i16_1372);
+ this->var_str_9f4 = _zbasic->space(this->var_i16_1372);
}
// 130:0580
// word square
if (_jumbleGameType == 4) {
- this->var_str_384 = g_zbasic->leftStr(this->var_str_1272, 4);
+ this->var_str_384 = _zbasic->leftStr(this->var_str_1272, 4);
this->sub_130_25d8();
this->var_str_1374 = this->var_str_9f4;
- this->var_str_384 = g_zbasic->rightStr(this->var_str_1272, 4);
+ this->var_str_384 = _zbasic->rightStr(this->var_str_1272, 4);
this->sub_130_25d8();
this->var_str_1474 = this->var_str_9f4;
- this->var_str_9f4 = this->var_str_1374 + g_zbasic->midStr(this->var_str_1272, 5, 1) + this->var_str_1474;
+ this->var_str_9f4 = this->var_str_1374 + _zbasic->midStr(this->var_str_1272, 5, 1) + this->var_str_1474;
}
// 130:0610
this->var_str_1070 += this->var_str_9f4;
@@ -203,7 +203,7 @@ void FoolGame::jumbleRun() {
this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_103a;
this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_106e;
this->sub_130_1c6c();
- this->var_str_d12 = g_zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
+ this->var_str_d12 = _zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
// 130:06d4
if ((_activePuzzle <= 0x50) || (_activePuzzle == 0x55)) {
this->sub_130_1dcc();
@@ -213,7 +213,7 @@ void FoolGame::jumbleRun() {
}
}
// 130:0716
- g_zbasic->indexRawSet(puzzlesReadString(), 1, this->var_i16_103a);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, this->var_i16_103a);
}
// 130:073e
this->var_i16_1576 = this->var_str_1170.size();
@@ -246,7 +246,7 @@ void FoolGame::jumbleRun() {
this->var_i16_484 = puzzlesReadShort();
this->var_i16_7e4 = puzzlesReadShort();
this->var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ _zbasic->text(0xfa, 0xc, 0, kSrcOr);
if (this->var_i16_7e4 > 0) {
g_toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
g_toolbox->DrawString(this->var_str_1578);
@@ -257,7 +257,7 @@ void FoolGame::jumbleRun() {
}
// 130:086a
this->var_i16_1678 = 0;
- this->var_str_1578 = g_zbasic->str(171);
+ this->var_str_1578 = _zbasic->str(171);
if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
// all puzzles done, load the success animation list
this->arr_i16_4338[0] = puzzlesReadShort();
@@ -296,14 +296,14 @@ void FoolGame::jumbleRun() {
} else {
// 130:0956
if (_activePuzzle <= 0x50) {
- if ((this->var_i16_1678 > 0) && (this->var_str_1578 != g_zbasic->str(172))) {
+ if ((this->var_i16_1678 > 0) && (this->var_str_1578 != _zbasic->str(172))) {
// 130:098c
- this->var_str_1578 = g_zbasic->str(173);
+ this->var_str_1578 = _zbasic->str(173);
this->sub_130_2226();
}
// 130:09a4
for (int i = 1; i <= 3; i++) {
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
+ this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
}
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->var_i16_1576; i++) {
@@ -402,8 +402,8 @@ void FoolGame::sub_130_c66() {
// 130:0c98
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = _jumbleCurrentSubPuzzle;
- if ((_jumbleGameType == 2) && (this->var_str_1578 != g_zbasic->str(175))) {
- _activePuzzleBuffer = this->var_str_1070 + g_zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
+ if ((_jumbleGameType == 2) && (this->var_str_1578 != _zbasic->str(175))) {
+ _activePuzzleBuffer = this->var_str_1070 + _zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
} else {
// 130:0cfe
_activePuzzleBuffer = this->var_str_1070;
@@ -438,38 +438,38 @@ void FoolGame::sub_130_d2e() {
void FoolGame::sub_130_d90() {
// 130:0d90
// substitution cipher
- if (g_zbasic->index(1, 1) != g_zbasic->str(177)) {
+ if (_zbasic->index(1, 1) != _zbasic->str(177)) {
if (this->var_str_1070.size() == this->var_str_1170.size()) {
- this->var_i16_1372 = g_zbasic->index(1, 1).size();
- this->var_str_1578 = g_zbasic->space(this->var_i16_1372);
+ this->var_i16_1372 = _zbasic->index(1, 1).size();
+ this->var_str_1578 = _zbasic->space(this->var_i16_1372);
for (int i = 1; i<= this->var_i16_1372; i++) {
- this->var_str_167c = g_zbasic->midStr(g_zbasic->index(1, 1), i, 1);
- this->var_i16_7e4 = g_zbasic->asc(g_zbasic->ucase(this->var_str_167c)) - 0x40;
+ this->var_str_167c = _zbasic->midStr(_zbasic->index(1, 1), i, 1);
+ this->var_i16_7e4 = _zbasic->asc(_zbasic->ucase(this->var_str_167c)) - 0x40;
if ((this->var_i16_7e4 >= 1) && (this->var_i16_7e4 <= 0x1a)) {
- this->var_str_d12 = g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4] + 0x40);
+ this->var_str_d12 = _zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4] + 0x40);
} else {
// 130:0e88
this->var_str_d12 = this->var_str_167c;
}
// 130:0e98
- g_zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
+ _zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
}
} else {
// 130:0ece
this->var_i16_484 = this->var_str_1070.size();
this->var_i16_7e4 = this->var_str_1170.size();
- this->var_str_1578 = g_zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_7e4);
- this->var_str_1070 = g_zbasic->leftStr(this->var_str_1070, this->var_i16_7e4);
+ this->var_str_1578 = _zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_7e4);
+ this->var_str_1070 = _zbasic->leftStr(this->var_str_1070, this->var_i16_7e4);
}
// 130:0f24
- this->var_str_1578 += g_zbasic->str(178) + g_zbasic->index(1, 1); // ABC = XYZ
- this->var_i16_167a = g_zbasic->instr(1, this->var_str_1578, g_zbasic->str(179));
+ this->var_str_1578 += _zbasic->str(178) + _zbasic->index(1, 1); // ABC = XYZ
+ this->var_i16_167a = _zbasic->instr(1, this->var_str_1578, _zbasic->str(179));
this->sub_130_2226();
} else {
// 130:0f72
- this->var_str_1578 = g_zbasic->str(180);
+ this->var_str_1578 = _zbasic->str(180);
}
// 130:0f86
this->var_i16_106e = 1;
@@ -497,7 +497,7 @@ void FoolGame::sub_130_d90() {
void FoolGame::sub_130_1004() {
// 130:1004
- this->var_i16_106e = g_zbasic->instr(1, this->var_str_1070, g_zbasic->str(181));
+ this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, _zbasic->str(181));
if (this->var_i16_106e == 0) {
this->var_i16_106e = 1;
}
@@ -526,13 +526,13 @@ void FoolGame::sub_130_10a6() {
// word square
this->sub_130_1426();
if (_jumbleGameType != 5) {
- this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 1, 1) + g_zbasic->midStr(this->var_str_1170, 4, 1) + g_zbasic->midStr(this->var_str_1170, 7, 1);
- this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 2, 1) + g_zbasic->midStr(this->var_str_1170, 5, 1) + g_zbasic->midStr(this->var_str_1170, 8, 1);
- this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 3, 1) + g_zbasic->midStr(this->var_str_1170, 6, 1) + g_zbasic->midStr(this->var_str_1170, 9, 1);
+ this->var_str_177c = _zbasic->midStr(this->var_str_1170, 1, 1) + _zbasic->midStr(this->var_str_1170, 4, 1) + _zbasic->midStr(this->var_str_1170, 7, 1);
+ this->var_str_177c += _zbasic->midStr(this->var_str_1170, 2, 1) + _zbasic->midStr(this->var_str_1170, 5, 1) + _zbasic->midStr(this->var_str_1170, 8, 1);
+ this->var_str_177c += _zbasic->midStr(this->var_str_1170, 3, 1) + _zbasic->midStr(this->var_str_1170, 6, 1) + _zbasic->midStr(this->var_str_1170, 9, 1);
} else {
// 130:1196
- this->var_str_177c = g_zbasic->midStr(this->var_str_1170, 3, 2) + g_zbasic->midStr(this->var_str_1170, 1, 2) + g_zbasic->midStr(this->var_str_1170, 5, 1);
- this->var_str_177c += g_zbasic->midStr(this->var_str_1170, 8, 2) + g_zbasic->midStr(this->var_str_1170, 6, 2);
+ this->var_str_177c = _zbasic->midStr(this->var_str_1170, 3, 2) + _zbasic->midStr(this->var_str_1170, 1, 2) + _zbasic->midStr(this->var_str_1170, 5, 1);
+ this->var_str_177c += _zbasic->midStr(this->var_str_1170, 8, 2) + _zbasic->midStr(this->var_str_1170, 6, 2);
}
// 130:1212
this->sub_128_61ec();
@@ -552,7 +552,7 @@ void FoolGame::sub_130_10a6() {
void FoolGame::sub_130_1282() {
// 130:1282
// hidden message, change the mouse cursor
- this->var_i16_106e = g_zbasic->instr(1, this->var_str_1070, g_zbasic->str(182));
+ this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, _zbasic->str(182));
if (this->var_i16_106e == 0) {
this->var_i16_106e = 1;
}
@@ -602,9 +602,9 @@ void FoolGame::sub_130_1426() {
// 130:1426
this->var_i16_187e = 0;
this->var_i16_1880 = 0;
- if (g_zbasic->index(1, 1) != g_zbasic->str(183)) {
+ if (_zbasic->index(1, 1) != _zbasic->str(183)) {
this->var_i16_1678 = 1;
- this->var_str_1578 = g_zbasic->index(1, 1);
+ this->var_str_1578 = _zbasic->index(1, 1);
this->sub_130_2226();
}
// 130:1474
@@ -687,7 +687,7 @@ void FoolGame::sub_130_15da() {
return;
}
// 130:16dc
- this->var_str_d12 = g_zbasic->chr(_keyLastPressed);
+ this->var_str_d12 = _zbasic->chr(_keyLastPressed);
// 130:16f2
_keyLastPressed = 0;
if (_jumbleGameType != 2) {
@@ -728,10 +728,10 @@ void FoolGame::sub_130_172c() {
// 130:189a
g_toolbox->InvertRect(_screenGrid[this->var_i16_1880]);
this->var_i16_1886 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
- this->var_str_1374 = g_zbasic->midStr(this->var_str_1070, this->var_i16_1884, 1);
- this->var_str_1474 = g_zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
- g_zbasic->midStrSet(this->var_str_1070, this->var_i16_1884, 1, this->var_str_1474);
- g_zbasic->midStrSet(this->var_str_1070, this->var_i16_1886, 1, this->var_str_1374);
+ this->var_str_1374 = _zbasic->midStr(this->var_str_1070, this->var_i16_1884, 1);
+ this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
+ _zbasic->midStrSet(this->var_str_1070, this->var_i16_1884, 1, this->var_str_1474);
+ _zbasic->midStrSet(this->var_str_1070, this->var_i16_1886, 1, this->var_str_1374);
this->var_i16_1574 = this->var_i16_187e;
this->var_i16_106e = this->var_i16_1884;
this->var_str_d12 = this->var_str_1474;
@@ -769,14 +769,14 @@ void FoolGame::sub_130_19da() {
void FoolGame::sub_130_1a16() {
// 130:1a16
this->var_str_1374 = this->var_str_d12;
- this->var_str_1474 = g_zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
+ this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
if (this->var_str_1374 == this->var_str_1474)
return;
// 130:1a5c
this->sub_130_1c52();
for (int16 i = 1; i <= this->var_i16_1576; i++) {
// 130:1a66
- this->var_str_384 = g_zbasic->midStr(this->var_str_1070, i, 1);
+ this->var_str_384 = _zbasic->midStr(this->var_str_1070, i, 1);
if ((this->var_str_384 == this->var_str_1374) || (this->var_str_384 == this->var_str_1474)) {
if (this->var_str_384 == this->var_str_1374) {
this->var_str_d12 = this->var_str_1474;
@@ -785,7 +785,7 @@ void FoolGame::sub_130_1a16() {
this->var_str_d12 = this->var_str_1374;
}
// 130:1ae8
- g_zbasic->midStrSet(this->var_str_1070, i, 1, this->var_str_d12);
+ _zbasic->midStrSet(this->var_str_1070, i, 1, this->var_str_d12);
this->var_i16_1574 = ABS(this->arr_i16_3738[i]);
this->sub_130_1c6c();
this->sub_130_1dcc();
@@ -793,9 +793,9 @@ void FoolGame::sub_130_1a16() {
// 130:1b2e
}
// 130:1b40
- if (this->var_str_1578 != g_zbasic->str(184)) { // blank
+ if (this->var_str_1578 != _zbasic->str(184)) { // blank
for (int16 i = 1; i <= this->var_i16_167a - 2; i++) {
- this->var_str_d12 = g_zbasic->midStr(this->var_str_1578, i, 1);
+ this->var_str_d12 = _zbasic->midStr(this->var_str_1578, i, 1);
if ((this->var_str_d12 == this->var_str_1374) || (this->var_str_d12 == this->var_str_1474)) {
// 130:1ba8
if (this->var_str_d12 == this->var_str_1374) {
@@ -805,7 +805,7 @@ void FoolGame::sub_130_1a16() {
this->var_str_d12 = this->var_str_1374;
}
// 130:1be2
- g_zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
+ _zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
}
// 130:1c02
}
@@ -852,7 +852,7 @@ void FoolGame::sub_130_1c6c() {
void FoolGame::sub_130_1dcc() {
// 130:1dcc
- g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
g_toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
_screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
@@ -879,7 +879,7 @@ void FoolGame::sub_130_1e76() {
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
g_toolbox->FillRect(temp, _patterns[this->var_i16_105e]);
- g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
// 130:1f70
g_toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
@@ -897,7 +897,7 @@ void FoolGame::sub_130_1e76() {
void FoolGame::sub_130_201a() {
// 130:201a
- g_zbasic->midStrSet(this->var_str_1070, this->var_i16_106e, 1, this->var_str_d12);
+ _zbasic->midStrSet(this->var_str_1070, this->var_i16_106e, 1, this->var_str_d12);
if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
this->sub_130_1e5c();
} else {
@@ -955,8 +955,8 @@ void FoolGame::sub_130_2178() {
return;
this->var_i16_1678 = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
- if (g_zbasic->index(1, this->var_i16_1678) != g_zbasic->str(185)) { // empty
- this->var_str_1578 = g_zbasic->index(1, this->var_i16_1678);
+ if (_zbasic->index(1, this->var_i16_1678) != _zbasic->str(185)) { // empty
+ this->var_str_1578 = _zbasic->index(1, this->var_i16_1678);
this->sub_130_2226();
}
// 130:2224
@@ -982,10 +982,10 @@ void FoolGame::sub_130_2226() {
}
// 130:2266
this->fillRect(0x124, 0x64, 0x139, 0x1ef, 0);
- if (this->var_str_1578 == g_zbasic->str(186)) // blank
+ if (this->var_str_1578 == _zbasic->str(186)) // blank
return;
// 130:22a0
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ _zbasic->text(0xfa, 0xc, 0, kSrcOr);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1578);
g_toolbox->MoveTo(0x127 - (this->var_i16_484 / 2), 0x133);
g_toolbox->DrawString(this->var_str_1578);
@@ -994,9 +994,9 @@ void FoolGame::sub_130_2226() {
void FoolGame::sub_130_22ee() {
// 130:22ee
this->fillRect(0x131, 0x84, 0x156, 0x17e, this->var_i16_1060);
- if (this->var_str_1578 == g_zbasic->str(187)) // blank
+ if (this->var_str_1578 == _zbasic->str(187)) // blank
return;
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x13c, 0xf6 - (this->var_i16_7ba / 2), 0x150, 0x10a + (this->var_i16_7ba / 2), 2);
g_toolbox->MoveTo(0x100 - (this->var_i16_7ba / 2), 0x14a);
@@ -1006,9 +1006,9 @@ void FoolGame::sub_130_22ee() {
void FoolGame::sub_130_23cc() {
// 130:23cc
this->fillRect(0x12c, 0x8c, 0x156, 0x186, this->var_i16_1060);
- if (this->var_str_1578 == g_zbasic->str(188))
+ if (this->var_str_1578 == _zbasic->str(188))
return;
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x130, 0x100 - (this->var_i16_7ba / 2), 0x144, 0x114 + (this->var_i16_7ba / 2), 2);
g_toolbox->MoveTo(0x10a - (this->var_i16_7ba / 2), 0x13e);
@@ -1018,9 +1018,9 @@ void FoolGame::sub_130_23cc() {
void FoolGame::sub_130_24aa() {
// 130:24aa
this->fillRect(0x125, 0x20, 0x136, 0x15e, 2);
- if (this->var_str_1578 == g_zbasic->str(189)) // blank
+ if (this->var_str_1578 == _zbasic->str(189)) // blank
return;
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
g_toolbox->MoveTo(0xc4 - (this->var_i16_7ba / 2), 0x131);
g_toolbox->DrawString(this->var_str_1578);
@@ -1028,9 +1028,9 @@ void FoolGame::sub_130_24aa() {
void FoolGame::sub_130_2548() {
// 130:2548
- g_zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ _zbasic->text(0xfa, 0xc, 0, kSrcOr);
this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
- if (this->var_str_1578 == g_zbasic->str(190)) // blank
+ if (this->var_str_1578 == _zbasic->str(190)) // blank
return;
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
@@ -1041,16 +1041,16 @@ void FoolGame::sub_130_2548() {
void FoolGame::sub_130_25d8() {
// 130:25d8
- g_zbasic->unk_20();
+ _zbasic->unk_20();
this->var_i16_188a = this->var_str_384.size();
- this->var_str_9f4 = g_zbasic->space(this->var_i16_188a);
+ this->var_str_9f4 = _zbasic->space(this->var_i16_188a);
for (int16 i = 1; i <= this->var_i16_188a; i++) {
this->arr_i16_5bbc[i] = i;
}
this->var_i16_188c = 0;
for (int16 i = this->var_i16_188a; i >= 1; i--) {
do {
- this->var_i16_7e4 = g_zbasic->rndInt(i);
+ this->var_i16_7e4 = _zbasic->rndInt(i);
// 130:2640
if (i == 1) {
// 130:266e
@@ -1070,16 +1070,16 @@ void FoolGame::sub_130_25d8() {
}
// 130:2712
if (this->var_i16_188c != 0) {
- g_zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
+ _zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
}
// 130:273c
for (int16 i = 1; i <= this->var_i16_188a; i++) {
- g_zbasic->midStrSet(this->var_str_9f4, i, 1, g_zbasic->midStr(this->var_str_384, this->arr_i16_5cbc[i], 1));
+ _zbasic->midStrSet(this->var_str_9f4, i, 1, _zbasic->midStr(this->var_str_384, this->arr_i16_5cbc[i], 1));
}
}
void FoolGame::sub_130_2790() {
- g_zbasic->unk_20();
+ _zbasic->unk_20();
for (int16 i = 1; i <= 0x1a; i++) {
this->arr_i16_5bbc[i] = i;
}
@@ -1087,7 +1087,7 @@ void FoolGame::sub_130_2790() {
for (int16 i = 0x1a; i > 0; i--) {
// 130:27c4
do {
- this->var_i16_7e4 = g_zbasic->rndInt(i);
+ this->var_i16_7e4 = _zbasic->rndInt(i);
// 130:27d2
if (i == 1) {
// 130:2800
@@ -1107,13 +1107,13 @@ void FoolGame::sub_130_2790() {
}
// 130:28a4
if (this->var_i16_188c != 0) {
- g_zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
+ _zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
}
this->var_i16_188a = this->var_str_384.size();
- this->var_str_9f4 = g_zbasic->space(this->var_i16_188a);
+ this->var_str_9f4 = _zbasic->space(this->var_i16_188a);
for (int16 i = 1; i <= this->var_i16_188a; i++) {
- this->var_i16_7e4 = g_zbasic->asc(g_zbasic->midStr(this->var_str_384, i, 1)) - 0x40;
- g_zbasic->midStrSet(this->var_str_9f4, i, 1, g_zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4]+0x40));
+ this->var_i16_7e4 = _zbasic->asc(_zbasic->midStr(this->var_str_384, i, 1)) - 0x40;
+ _zbasic->midStrSet(this->var_str_9f4, i, 1, _zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4]+0x40));
}
}
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index eebd810f79f..a6a86775070 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// justice - lights on
@@ -47,14 +47,14 @@ void FoolGame::justiceRun() {
// 142:08a2
this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
_activePuzzleStatus = 0x63;
- this->var_str_384 = g_zbasic->str(345); // behold the 3rd key of thoth
+ this->var_str_384 = _zbasic->str(345); // behold the 3rd key of thoth
this->sub_128_178a(0x3f, 1);
}
}
// 142:0906
if (_activePuzzleStatus == 0x63) {
- g_zbasic->menu(8, 0, 1, g_zbasic->str(346)); // the 3rd key of thoth
- g_zbasic->menu(8, 1, 1, g_zbasic->str(347)); // return to scroll
+ _zbasic->menu(8, 0, 1, _zbasic->str(346)); // the 3rd key of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(347)); // return to scroll
this->thothKey3rd();
if (_activePuzzleSolved) {
this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
@@ -79,16 +79,16 @@ void FoolGame::sub_142_9be() {
// 142:09be
this->sub_128_271a();
for (int16 i = 1; i <= 0x19; i++) {
- g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, i);
}
// 142:09ea
if (_puzzleCompletionStatus[0x34] < 4) {
- g_zbasic->menu(8, 3, 1, g_zbasic->str(348)); // a secret hides here
- g_zbasic->menu(8, 4, 1, g_zbasic->str(349)); // if twenty-five appear
+ _zbasic->menu(8, 3, 1, _zbasic->str(348)); // a secret hides here
+ _zbasic->menu(8, 4, 1, _zbasic->str(349)); // if twenty-five appear
} else {
// 142:0a3a
- g_zbasic->menu(8, 3, 1, g_zbasic->str(350)); // you will remain here
- g_zbasic->menu(8, 4, 1, g_zbasic->str(351)); // unless twenty-five appear
+ _zbasic->menu(8, 3, 1, _zbasic->str(350)); // you will remain here
+ _zbasic->menu(8, 4, 1, _zbasic->str(351)); // unless twenty-five appear
}
// 142:0a6a
this->justiceZoom();
@@ -109,21 +109,21 @@ void FoolGame::sub_142_9be() {
this->justiceZoom();
this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
if (_activePuzzleBuffer.empty()) { // was: str(352)
- _activePuzzleBuffer = (g_zbasic->space(0xc) + g_zbasic->str(353) + g_zbasic->space(0xc)).encode(Common::kMacRoman); // 1
+ _activePuzzleBuffer = (_zbasic->space(0xc) + _zbasic->str(353) + _zbasic->space(0xc)).encode(Common::kMacRoman); // 1
this->var_i16_233e = 1;
} else {
// 142:0b4c
- this->var_i16_233e = g_zbasic->castInt(g_zbasic->leftStr(_activePuzzleBuffer, 1));
- _activePuzzleBuffer = g_zbasic->rightStr(_activePuzzleBuffer, 0x19);
+ this->var_i16_233e = _zbasic->castInt(_zbasic->leftStr(_activePuzzleBuffer, 1));
+ _activePuzzleBuffer = _zbasic->rightStr(_activePuzzleBuffer, 0x19);
}
// 142:0b7c
for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- this->var_i16_103a = g_zbasic->castInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_484, 1));
+ this->var_i16_103a = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_484, 1));
if ((this->var_i16_103a & 2) == 0) {
- g_zbasic->indexSet(g_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
+ _zbasic->indexSet(_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
} else {
// 142:0be0
- g_zbasic->indexSet(g_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
+ _zbasic->indexSet(_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
}
// 142:0c06
if ((this->var_i16_103a & 1) != 0) {
@@ -166,14 +166,14 @@ void FoolGame::justiceOnClick() {
}
// 142:0d56
g_toolbox->InvertRoundRect(_screenGrid[this->var_i16_103a], 0x1e, 0x1e);
- if (g_zbasic->index(1, this->var_i16_103a + 0x19) == g_zbasic->str(356)) { // \xa5
- g_zbasic->indexSet(g_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
+ if (_zbasic->index(1, this->var_i16_103a + 0x19) == _zbasic->str(356)) { // \xa5
+ _zbasic->indexSet(_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
}
// 142:0dc6
if (this->var_i16_103a == 0xd) { // center button
if (this->var_i16_233e == 0) {
for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- g_zbasic->indexSet(g_zbasic->str(358), 1, this->var_i16_484 + 0x19); // \xa5
+ _zbasic->indexSet(_zbasic->str(358), 1, this->var_i16_484 + 0x19); // \xa5
this->arr_i16_3738[this->var_i16_484] = 0;
this->justiceRemoveBlock();
}
@@ -187,9 +187,9 @@ void FoolGame::justiceOnClick() {
this->var_i16_233e = 0;
}
// 142:0e44
- Common::String buffer = g_zbasic->indexRaw(1, this->var_i16_103a);
- if (g_zbasic->leftStr(buffer, 1) == g_zbasic->str(359).encode(Common::kMacRoman)) { // M
- this->var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(buffer, 2, 2));
+ Common::String buffer = _zbasic->indexRaw(1, this->var_i16_103a);
+ if (_zbasic->leftStr(buffer, 1) == _zbasic->str(359).encode(Common::kMacRoman)) { // M
+ this->var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(buffer, 2, 2));
this->justiceDrawBlock();
this->var_i16_2340 = 5;
} else {
@@ -197,10 +197,10 @@ void FoolGame::justiceOnClick() {
this->var_i16_2340 = 2;
}
// 142:0eae
- this->var_i16_2342 = g_zbasic->decodeInt(g_zbasic->midStr(buffer, this->var_i16_2340, 2));
+ this->var_i16_2342 = _zbasic->decodeInt(_zbasic->midStr(buffer, this->var_i16_2340, 2));
for (int16 i = 1; i <= this->var_i16_2342; i++) {
this->var_i16_2340 += 2;
- this->var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(buffer, this->var_i16_2340, 2));
+ this->var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(buffer, this->var_i16_2340, 2));
// 142:0ef0
if (this->arr_i16_3738[this->var_i16_484] == 0) {
this->justiceDrawBlock();
@@ -226,12 +226,12 @@ void FoolGame::justiceZoom() {
void FoolGame::justiceDrawBlock() {
// 142:0f96
this->arr_i16_3738[this->var_i16_484] = 1;
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
g_toolbox->PenNormal();
g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
- this->var_str_384 = g_zbasic->index(1, this->var_i16_484 + 0x19);
+ _zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_384 = _zbasic->index(1, this->var_i16_484 + 0x19);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
// 142:1056
g_toolbox->MoveTo(
@@ -244,19 +244,19 @@ void FoolGame::justiceDrawBlock() {
void FoolGame::justiceRemoveBlock() {
// 142:10bc
this->arr_i16_3738[this->var_i16_484] = 0;
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[g_zbasic->rndInt(0x4d)+3]);
+ this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ g_toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[_zbasic->rndInt(0x4d)+3]);
}
void FoolGame::justiceStoreState() {
// 142:111e
this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
- _activePuzzleBuffer = g_zbasic->rightStr(this->var_str_384, 1);
+ _activePuzzleBuffer = _zbasic->rightStr(this->var_str_384, 1);
for (int16 i = 1; i <= 0x19; i++) {
this->var_i16_484 = this->arr_i16_3738[i];
- if (g_zbasic->index(1, i + 0x19) == g_zbasic->str(360)) { // ~
+ if (_zbasic->index(1, i + 0x19) == _zbasic->str(360)) { // ~
this->var_i16_484 |= 2;
- this->var_str_384 = g_zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
+ this->var_str_384 = _zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
_activePuzzleBuffer += this->var_str_384;
}
}
@@ -268,7 +268,7 @@ void FoolGame::justiceResetGrid() {
this->sub_128_3da(0x28);
_activePuzzleBuffer.clear();
for (int16 i = 1; i <= 0x19; i++) {
- this->sub_128_50e(g_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
g_toolbox->FillRect(_screenGrid[i], _patterns[2]);
}
// 142:126e
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 1dda3e06d47..c4b80a91edb 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
void FoolGame::mazeRun() {
@@ -50,15 +50,15 @@ void FoolGame::mazeRun() {
var_i16_68c + arr_i16_1eb8[12]
);
// 136:00ca
- } while (g_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
- } while (g_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
if (this->arr_i16_1eb8[20] != 0) {
var_i32_1ac0 = g_toolbox->GetPicture(arr_i16_1eb8[20]);
- g_zbasic->picture(arr_i16_1eb8[18], arr_i16_1eb8[19], var_i32_1ac0);
+ _zbasic->picture(arr_i16_1eb8[18], arr_i16_1eb8[19], var_i32_1ac0);
}
// 136:018c
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, i);
arr_i16_5cbc[i] = 0;
}
// 136:01d2
@@ -123,8 +123,8 @@ void FoolGame::mazeRun() {
// 136:05ec
if (_activePuzzleBuffer.empty()) { // was: str(223)
for (int16 j = 1; j <= arr_i16_1eb8[23]; j++) {
- var_str_1ac8 = g_zbasic->indexRaw(1, j);
- var_i16_1bc8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, 3, 2));
+ var_str_1ac8 = _zbasic->indexRaw(1, j);
+ var_i16_1bc8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ac8, 3, 2));
if (var_i16_1bc8 != 666) {
for (int16 i = 1; i <= var_i16_1bc8; i++) {
sub_136_2582();
@@ -382,31 +382,31 @@ void FoolGame::mazeHotspot() {
var_i16_1bd0 = var_i16_1574;
return;
}
- var_str_1ac8 = g_zbasic->indexRaw(1, arr_i16_3b38[_mazePlayerX*32 + _mazePlayerY]);
+ var_str_1ac8 = _zbasic->indexRaw(1, arr_i16_3b38[_mazePlayerX*32 + _mazePlayerY]);
debugC(5, kDebugLoading, "mazeHotspot: processing hotspot at (%d, %d)", _mazePlayerX, _mazePlayerY);
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)var_str_1ac8.c_str(), var_str_1ac8.size());
}
- var_str_1bde = g_zbasic->strRaw(226); // CILTDABRPXMOZSFQGWEJKV
+ var_str_1bde = _zbasic->strRaw(226); // CILTDABRPXMOZSFQGWEJKV
// 136:0bd0
var_i16_1cde = 1;
- g_zbasic->unk_20();
+ _zbasic->unk_20();
while (var_i16_1cde > 0) {
// 136:0bde
- var_i16_1cde = g_zbasic->instr(var_i16_1cde, var_str_1ac8, g_zbasic->strRaw(227)); // \xa5\xa5
+ var_i16_1cde = _zbasic->instr(var_i16_1cde, var_str_1ac8, _zbasic->strRaw(227)); // \xa5\xa5
if (var_i16_1cde > 0) {
// get command ID
for (int16 i = 1; i <= (int16)var_str_1bde.size(); i++) {
- if (g_zbasic->midStr(var_str_1ac8, var_i16_1cde + 2, 1) == g_zbasic->midStr(var_str_1bde, i, 1)) {
+ if (_zbasic->midStr(var_str_1ac8, var_i16_1cde + 2, 1) == _zbasic->midStr(var_str_1bde, i, 1)) {
var_i16_1a9a = i;
}
// 136:0c4c
}
// 136:0c5e
- var_i16_1ce0 = g_zbasic->instr(var_i16_1cde, var_str_1ac8, g_zbasic->strRaw(228)); // <<
- var_str_1ce2 = g_zbasic->midStr(var_str_1ac8, var_i16_1cde + 3, var_i16_1ce0 - var_i16_1cde - 3);
- if (g_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == g_zbasic->strRaw(229)) { // ||
+ var_i16_1ce0 = _zbasic->instr(var_i16_1cde, var_str_1ac8, _zbasic->strRaw(228)); // <<
+ var_str_1ce2 = _zbasic->midStr(var_str_1ac8, var_i16_1cde + 3, var_i16_1ce0 - var_i16_1cde - 3);
+ if (_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == _zbasic->strRaw(229)) { // ||
// 136:0cdc
var_i16_1cde = 0;
} else {
@@ -498,7 +498,7 @@ void FoolGame::mazePrintMessage() {
}
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
if (!var_str_1ce2.empty()) { // was: str(230)
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
var_i16_484 = g_toolbox->StringWidth(var_str_1ce2);
fillRect(0x13b, 0xf1 - (var_i16_484 / 2), 0x14f, 0x10f + (var_i16_484 / 2), 2);
var_i16_7a2 = 0x149;
@@ -511,7 +511,7 @@ void FoolGame::mazePrintMessage() {
void FoolGame::sub_136_e4c() {
// 136:0e4c
warning(__func__);
- var_i16_1de2 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_1de2 = _zbasic->decodeInt(var_str_1ce2);
arr_i16_5cbc[var_i16_1de2]++;
if (arr_i16_3738[var_i16_1574] & 0x1000) {
arr_i16_3738[var_i16_1574] ^= 0x1000;
@@ -523,8 +523,8 @@ void FoolGame::sub_136_e4c() {
void FoolGame::sub_136_ed8() {
warning(__func__);
// 136:0ed8
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_1de2 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de2 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
for (int16 i = 1; i <= var_i16_1de4; i++) {
arr_i16_5cbc[var_i16_1de2]--;
}
@@ -536,21 +536,21 @@ void FoolGame::sub_136_ed8() {
void FoolGame::mazeWanderingWinds() {
// 136:0f74
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(231)) { // L
- var_i16_1de6 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
- var_i16_1de4 = g_zbasic->rndInt(var_i16_1de6);
- var_i16_1de8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_1de4 * 2 + 2, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(231)) { // L
+ var_i16_1de6 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_1de4 = _zbasic->rndInt(var_i16_1de6);
+ var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_1de4 * 2 + 2, 2));
var_i16_484 = var_i16_1de6 * 2 + 4;
sub_136_24ae();
}
// 136:0ffc
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(232)) { // A
- var_i16_68a = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
- var_i16_68c = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 4, 2));
- var_i16_1a96 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 6, 2));
- var_i16_1a98 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 8, 2));
- var_i16_68a += g_zbasic->rndInt(var_i16_1a96 + 1) - 1;
- var_i16_68c += g_zbasic->rndInt(var_i16_1a98 + 1) - 1;
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(232)) { // A
+ var_i16_68a = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_68c = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
+ var_i16_1a96 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 6, 2));
+ var_i16_1a98 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 8, 2));
+ var_i16_68a += _zbasic->rndInt(var_i16_1a96 + 1) - 1;
+ var_i16_68c += _zbasic->rndInt(var_i16_1a98 + 1) - 1;
// 136:10bc
var_i16_1de8 = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
var_i16_484 = 0xa;
@@ -575,9 +575,9 @@ void FoolGame::mazeWanderingWinds() {
void FoolGame::sub_136_115a() {
warning(__func__);
// 136:115a
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(233)) { // P
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
- var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 4, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(233)) { // P
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
if (var_i16_1dea == var_i16_1574) {
var_src_1dee = kSrcOr;
} else {
@@ -587,8 +587,8 @@ void FoolGame::sub_136_115a() {
arr_i16_4338[var_i16_1dea] = var_i16_106e;
}
// 136:11e0
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(234)) { // E
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(234)) { // E
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1dea < 0) {
var_i16_1dea = var_i16_1574;
}
@@ -602,9 +602,9 @@ void FoolGame::sub_136_115a() {
}
}
// 136:1270
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(235)) { // C
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(235)) { // C
var_i16_1dea = var_i16_1574;
- var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1dea == var_i16_1574) {
var_src_1dee = kSrcOr;
} else {
@@ -615,12 +615,12 @@ void FoolGame::sub_136_115a() {
arr_i16_4338[var_i16_1dea] = var_i16_106e;
}
// 136:12e4
- g_zbasic->text(0xfb, 0xc, 0, var_src_1dee);
+ _zbasic->text(0xfb, 0xc, 0, var_src_1dee);
g_toolbox->MoveTo(
_screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
_screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
);
- var_str_384 = g_zbasic->chr(var_i16_106e);
+ var_str_384 = _zbasic->chr(var_i16_106e);
g_toolbox->DrawString(var_str_384);
}
@@ -628,55 +628,55 @@ void FoolGame::sub_136_137c() {
warning(__func__);
// 136:137c
var_i16_1df0 = 0;
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(236)) { // I
- var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(236)) { // I
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (arr_i16_5cbc[var_i16_484] == 0) {
var_i16_1df0 = 1;
}
}
// 136:13d8
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(237)) { // M
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
- var_i16_1de2 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 4, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(237)) { // M
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_1de2 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
if (arr_i16_5cbc[var_i16_1de2] < var_i16_1de4) {
var_i16_1df0 = 1;
}
}
// 136:144e
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(238)) { // B
- var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(238)) { // B
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df0 = 1;
}
}
// 136:14b2
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(239)) { // L
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(239)) { // L
// 136:14d6
- var_i16_7e4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (arr_i16_4338[var_i16_484] != var_i16_7e4) {
var_i16_1df0 = 1;
}
}
// 136:1528
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(240)) { // S
- var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(240)) { // S
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
for (int16 i = 4; i <= (2*var_i16_484 + 2); i += 2) {
- var_i16_7e4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, i, 2));
+ var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, i, 2));
if (arr_i16_4338[var_i16_7e4] == 0) {
var_i16_1df0 = 1;
}
}
}
// 136:15c0
- if (g_zbasic->leftStr(var_str_1ce2, 1) == g_zbasic->strRaw(241)) { // P
- var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 2, 2));
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(241)) { // P
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1bd0 != var_i16_484) {
var_i16_1df0 = 1;
}
}
// 136:1612
if (var_i16_1df0 != 0) {
- var_i16_1cde = g_zbasic->instr(1, var_str_1ac8, g_zbasic->strRaw(242)); // ||
+ var_i16_1cde = _zbasic->instr(1, var_str_1ac8, _zbasic->strRaw(242)); // ||
}
// 136:163a
return;
@@ -685,16 +685,16 @@ void FoolGame::sub_136_137c() {
void FoolGame::sub_136_163c() {
// 136:163c
var_i16_1bd8 = var_i16_1574;
- var_i16_1bd6 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_1bd6 = _zbasic->decodeInt(var_str_1ce2);
}
void FoolGame::sub_136_1650() {
// 136:1650
- var_i16_105a = g_zbasic->decodeInt(var_str_1ce2);
- var_i16_103a = g_zbasic->decodeInt(g_zbasic->leftStr(g_zbasic->indexRaw(1, var_i16_105a), 2));
+ var_i16_105a = _zbasic->decodeInt(var_str_1ce2);
+ var_i16_103a = _zbasic->decodeInt(_zbasic->leftStr(_zbasic->indexRaw(1, var_i16_105a), 2));
var_i16_1df2 = 0;
for (int16 i = 1; i <= var_i16_103a; i++) {
- var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(g_zbasic->indexRaw(1, var_i16_105a), i*2 + 3, 2));
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(_zbasic->indexRaw(1, var_i16_105a), i*2 + 3, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df2 = 1;
arr_i16_5bbc[var_i16_1df2] = var_i16_484;
@@ -702,14 +702,14 @@ void FoolGame::sub_136_1650() {
// 136:16f4
}
// 136:1704
- var_i16_484 = arr_i16_5bbc[g_zbasic->rndInt(var_i16_1df2)];
+ var_i16_484 = arr_i16_5bbc[_zbasic->rndInt(var_i16_1df2)];
arr_i16_3738[var_i16_484] |= 0x1000;
}
void FoolGame::mazeHiddenDoorOpen() {
// 136:1756
var_i16_1bd8 = var_i16_1574;
- var_i16_1bd4 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_1bd4 = _zbasic->decodeInt(var_str_1ce2);
g_toolbox->PenNormal();
g_toolbox->PenPat(_patterns[2]);
g_toolbox->PenSize(5, 5);
@@ -735,7 +735,7 @@ void FoolGame::mazeHiddenDoorOpen() {
void FoolGame::mazeHiddenDoorShut() {
// 136:17a4
var_i16_1bd8 = var_i16_1574;
- var_i16_1bd6 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_1bd6 = _zbasic->decodeInt(var_str_1ce2);
g_toolbox->PenNormal();
g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
g_toolbox->PenSize(5, 5);
@@ -769,14 +769,14 @@ void FoolGame::sub_136_1806() {
void FoolGame::sub_136_185a() {
// 136:185a
- var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
arr_i16_3738[var_i16_484] |= 0x1000;
}
void FoolGame::sub_136_1898() {
warning(__func__);
// 136:1898
- var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
if (arr_i16_3738[var_i16_484] & 0x1000) {
arr_i16_3738[var_i16_484] ^= 0x1000;
}
@@ -785,7 +785,7 @@ void FoolGame::sub_136_1898() {
void FoolGame::sub_136_18f4() {
warning(__func__);
// 136:18f4
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_484 = 3;
sub_136_24ae();
for (int16 i = 1; i <= var_i16_1de4; i++) {
@@ -796,7 +796,7 @@ void FoolGame::sub_136_18f4() {
void FoolGame::sub_136_1932() {
warning(__func__);
// 136:1932
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_484 = 3;
sub_136_24ae();
arr_i16_4758[0] = 0x14;
@@ -826,12 +826,12 @@ void FoolGame::sub_136_19d2() {
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
g_toolbox->PenSize(6, 6);
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1de4 = var_i16_1de4 * 2 - 1;
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
- var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
- var_i16_1de8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 7, 2));
- var_i16_1df6 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 9, 2));
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 7, 2));
+ var_i16_1df6 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 9, 2));
var_i16_484 = 0xb;
sub_136_24ae();
// 136:1a7a
@@ -867,9 +867,9 @@ void FoolGame::sub_136_19d2() {
void FoolGame::sub_136_1cf4() {
// 136:1cf4
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
- var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
var_i16_484 = 7;
sub_136_24ae();
for (int16 i = 1; i <= var_i16_1de4; i++) {
@@ -895,15 +895,15 @@ void FoolGame::sub_136_1cf4() {
void FoolGame::sub_136_1ddc() {
// 136:1ddc
- var_i16_484 = g_zbasic->decodeInt(var_str_1ce2);
+ var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
g_toolbox->Delay(var_i16_484*60/1000);
}
void FoolGame::sub_136_1df4() {
// 136:1df4
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_1de8 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
- var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
var_i16_484 = 7;
sub_136_24ae();
mazeMovementTrail();
@@ -911,9 +911,9 @@ void FoolGame::sub_136_1df4() {
void FoolGame::sub_136_1e4c() {
// 136:1e4c
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_1dec = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 3, 2));
- var_i16_1e00 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, 5, 2));
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
+ var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
+ var_i16_1e00 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
var_i16_484 = 7;
sub_136_24ae();
g_toolbox->PenNormal();
@@ -1042,11 +1042,11 @@ void FoolGame::mazeMovementTrail() {
void FoolGame::sub_136_24ae() {
warning(__func__);
// 136:24ae
- var_i16_1df4 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
+ var_i16_1df4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
if (var_i16_1df4 > 0) {
- var_i16_1e02 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484 + 2, 2));
- var_i16_1372 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484 + 4, 2))*2;
- var_i16_1e04 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ce2, var_i16_484 + 6, 2));
+ var_i16_1e02 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 2, 2));
+ var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 4, 2))*2;
+ var_i16_1e04 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 6, 2));
}
// 136:2536
}
@@ -1065,16 +1065,16 @@ void FoolGame::sub_136_2582() {
warning(__func__);
// 136:2582
var_i16_1df2 = 0;
- var_i16_1e06 = g_zbasic->decodeInt(g_zbasic->leftStr(var_str_1ac8, 2));
+ var_i16_1e06 = _zbasic->decodeInt(_zbasic->leftStr(var_str_1ac8, 2));
for (int16 i = 1; i <= var_i16_1e06; i++) {
- var_i16_484 = g_zbasic->decodeInt(g_zbasic->midStr(var_str_1ac8, i*2 + 3, 2));
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ac8, i*2 + 3, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df2++;
arr_i16_5bbc[var_i16_1df2] = var_i16_484;
}
// 136:2602
}
- var_i16_484 = arr_i16_5bbc[g_zbasic->rndInt(var_i16_1df2)];
+ var_i16_484 = arr_i16_5bbc[_zbasic->rndInt(var_i16_1df2)];
arr_i16_3738[var_i16_484] |= 0x1000;
}
@@ -1100,18 +1100,18 @@ void FoolGame::mazeSetupMenu() {
g_toolbox->DisposeMenu(this->var_menu_bf8);
// 136:274e
- g_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
+ _zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
if (_activePuzzle < 0x50) {
- g_zbasic->menu(8, 1, 1, g_zbasic->str(243)); // return to scroll
+ _zbasic->menu(8, 1, 1, _zbasic->str(243)); // return to scroll
} else {
// 136:279a
- g_zbasic->menu(8, 1, 1, g_zbasic->str(244)); // return to map
+ _zbasic->menu(8, 1, 1, _zbasic->str(244)); // return to map
}
// 136:27b2
- g_zbasic->menu(8, 2, 0, g_zbasic->str(245)); // -
- g_zbasic->menu(8, 3, 1, g_zbasic->str(246)); // to escape from the maze
- g_zbasic->menu(8, 4, 1, g_zbasic->str(247)); // use the mouse to maneuver
- g_zbasic->menu(8, 5, 1, g_zbasic->str(248)); // the white dot to the exit
+ _zbasic->menu(8, 2, 0, _zbasic->str(245)); // -
+ _zbasic->menu(8, 3, 1, _zbasic->str(246)); // to escape from the maze
+ _zbasic->menu(8, 4, 1, _zbasic->str(247)); // use the mouse to maneuver
+ _zbasic->menu(8, 5, 1, _zbasic->str(248)); // the white dot to the exit
if (_activePuzzle == 0x57) {
// 136:281c
var_i16_103a = 7;
@@ -1119,30 +1119,30 @@ void FoolGame::mazeSetupMenu() {
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
if ((arr_i16_5cbc[i] > 0) &&
- (g_zbasic->instr(1, g_zbasic->index(1, i), g_zbasic->str(249)) > 0)) {
+ (_zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(249)) > 0)) {
if (var_i16_103a == 7) {
- g_zbasic->menu(8, 6, 0, g_zbasic->str(250)); // -
- g_zbasic->menu(8, 7, 1, g_zbasic->str(251)); // you have acquired
+ _zbasic->menu(8, 6, 0, _zbasic->str(250)); // -
+ _zbasic->menu(8, 7, 1, _zbasic->str(251)); // you have acquired
}
// 136:28b4
- var_i16_1dea = g_zbasic->instr(1, g_zbasic->index(1, i), g_zbasic->str(252)); // ++
- var_i16_1de8 = g_zbasic->instr(1, g_zbasic->index(1, i), g_zbasic->str(253)); // \xa5\xa5
- var_str_1e08 = g_zbasic->midStr(g_zbasic->index(1, i), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
- if (g_zbasic->leftStr(var_str_1e08, 1) == g_zbasic->str(254)) { // +
+ var_i16_1dea = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(252)); // ++
+ var_i16_1de8 = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(253)); // \xa5\xa5
+ var_str_1e08 = _zbasic->midStr(_zbasic->index(1, i), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
+ if (_zbasic->leftStr(var_str_1e08, 1) == _zbasic->str(254)) { // +
// 136:2964
var_i16_484 = var_str_1e08.size();
- var_str_1e08 = g_zbasic->rightStr(var_str_1e08, var_i16_484 - 1);
+ var_str_1e08 = _zbasic->rightStr(var_str_1e08, var_i16_484 - 1);
}
// 136:298e
var_str_384 = Common::U32String::format(" %d", arr_i16_5cbc[i]);
- var_str_384 = g_zbasic->space(4 - var_str_384.size()) + var_str_384 + g_zbasic->str(255) + var_str_1e08; // ' '
+ var_str_384 = _zbasic->space(4 - var_str_384.size()) + var_str_384 + _zbasic->str(255) + var_str_1e08; // ' '
if (arr_i16_5cbc[i] > 1) {
- var_str_384 += g_zbasic->str(256); // s
+ var_str_384 += _zbasic->str(256); // s
}
// 136:2a2a
- var_str_384 += g_zbasic->str(257); // ' '
+ var_str_384 += _zbasic->str(257); // ' '
var_i16_103a++;
- g_zbasic->menu(8, var_i16_103a, 1, var_str_384);
+ _zbasic->menu(8, var_i16_103a, 1, var_str_384);
}
// 136:2a5e
}
@@ -1258,15 +1258,15 @@ void FoolGame::mazeStoreState() {
_activePuzzleBuffer.clear(); // was: str(258)
return;
}
- _activePuzzleBuffer = g_zbasic->encodeInt(_mazePlayerX) +
- g_zbasic->encodeInt(_mazePlayerY) +
- g_zbasic->encodeInt(var_i16_1bd0) +
- g_zbasic->encodeInt(var_i16_1bd6) +
- g_zbasic->encodeInt(var_i16_1bd4) +
- g_zbasic->encodeInt(var_i16_1bd8);
+ _activePuzzleBuffer = _zbasic->encodeInt(_mazePlayerX) +
+ _zbasic->encodeInt(_mazePlayerY) +
+ _zbasic->encodeInt(var_i16_1bd0) +
+ _zbasic->encodeInt(var_i16_1bd6) +
+ _zbasic->encodeInt(var_i16_1bd4) +
+ _zbasic->encodeInt(var_i16_1bd8);
// 136:300a
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- _activePuzzleBuffer += g_zbasic->encodeInt(arr_i16_5cbc[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(arr_i16_5cbc[i]);
}
// 136:3054
var_i16_484 = 0;
@@ -1277,13 +1277,13 @@ void FoolGame::mazeStoreState() {
var_i16_484++;
if (arr_i16_4338[var_i16_484] > 0) {
var_i16_1de6++;
- buffer += g_zbasic->encodeInt(arr_i16_2f38[i*32 + j]) + g_zbasic->encodeInt(arr_i16_4338[var_i16_484]);
+ buffer += _zbasic->encodeInt(arr_i16_2f38[i*32 + j]) + _zbasic->encodeInt(arr_i16_4338[var_i16_484]);
}
// 136:30f0
}
}
// 136:3128
- _activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1de6) + buffer;
+ _activePuzzleBuffer += _zbasic->encodeInt(var_i16_1de6) + buffer;
var_i16_484 = 0;
var_i16_1de6 = 0;
@@ -1333,7 +1333,7 @@ void FoolGame::mazeStoreState() {
}
// 136:33e8
debugC(5, kDebugLoading, "mazeStoreState: added mask %04x", var_i16_1f08);
- _activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
+ _activePuzzleBuffer += _zbasic->encodeInt(var_i16_1f08);
}
void FoolGame::sub_136_3408() {
@@ -1346,7 +1346,7 @@ void FoolGame::sub_136_342a() {
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
debugC(5, kDebugLoading, "sub_136_342a: added mask %04x", var_i16_1f08);
- _activePuzzleBuffer += g_zbasic->encodeInt(var_i16_1f08);
+ _activePuzzleBuffer += _zbasic->encodeInt(var_i16_1f08);
var_i16_1f08 = 0;
var_i16_1de6 = 0;
}
@@ -1355,12 +1355,12 @@ void FoolGame::sub_136_342a() {
void FoolGame::mazeLoadState() {
// 136:3466
- _mazePlayerX = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 1, 2));
- _mazePlayerY = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 3, 2));
- var_i16_1bd0 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 5, 2));
- var_i16_1bd6 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 7, 2));
- var_i16_1bd4 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 9, 2));
- var_i16_1bd8 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, 0xb, 2));
+ _mazePlayerX = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 1, 2));
+ _mazePlayerY = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 3, 2));
+ var_i16_1bd0 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 5, 2));
+ var_i16_1bd6 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 7, 2));
+ var_i16_1bd4 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 9, 2));
+ var_i16_1bd8 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 0xb, 2));
if (var_i16_1bd6 > 0) {
// 136:3500
g_toolbox->PenNormal();
@@ -1410,30 +1410,30 @@ void FoolGame::mazeLoadState() {
// 136:3592
var_i16_1f0a = 0xd;
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- arr_i16_5cbc[i] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ arr_i16_5cbc[i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
}
// 136:35ec
- var_i16_1de4 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
if (var_i16_1de4 > 0) {
- g_zbasic->text(0xfb, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfb, 0xc, 0, kSrcBic);
for (int16 i = 1; i <= var_i16_1de4; i++) {
- var_i16_1dea = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
- var_i16_106e = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
// 136:366e
g_toolbox->MoveTo(
_screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
_screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
);
- g_zbasic->unk_8();
+ _zbasic->unk_8();
// the one place that used ZBasic's print API,
// easier to cut out the middleman and use DrawString
- g_toolbox->DrawString(g_zbasic->chr(var_i16_106e));
- //g_zbasic->print(g_zbasic->chr(var_i16_106e));
- //g_zbasic->printNewline();
+ g_toolbox->DrawString(_zbasic->chr(var_i16_106e));
+ //_zbasic->print(_zbasic->chr(var_i16_106e));
+ //_zbasic->printNewline();
arr_i16_4338[var_i16_1dea] = var_i16_106e;
}
}
@@ -1444,7 +1444,7 @@ void FoolGame::mazeLoadState() {
g_toolbox->PenSize(5, 5);
var_i16_1574 = 0;
var_i16_1de6 = 0;
- var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f08 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
// 136:3766
debugC(5, kDebugLoading, "mazeLoadState: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
@@ -1500,7 +1500,7 @@ void FoolGame::sub_136_3a30() {
var_i16_1de6 = 0;
}
if (var_i16_1de6 == 0) {
- var_i16_1f08 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ var_i16_1f08 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
debugC(5, kDebugLoading, "sub_136_3a80: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
}
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 59f5f1438ce..3505c172785 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -28,7 +28,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// sun's map metapuzzle
@@ -36,7 +36,7 @@ void FoolGame::metapuzzleRun() {
// 138:0004
if (_sunMapRestored == 1) {
_sunMapRestored = 666;
- var_i32_7c8 = g_zbasic->mem(-1);
+ var_i32_7c8 = _zbasic->mem(-1);
} else {
// 138:0024
var_i16_7ce |= 1;
@@ -48,7 +48,7 @@ void FoolGame::metapuzzleRun() {
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
var_i16_484++;
- g_zbasic->picture(i, j, _sunMapTilePic[var_i16_484]);
+ _zbasic->picture(i, j, _sunMapTilePic[var_i16_484]);
}
}
}
@@ -183,14 +183,14 @@ void FoolGame::sub_138_21e() {
void FoolGame::metapuzzleSetupMenu() {
// 138:03e0
- g_zbasic->menu(8, 0, 1, g_zbasic->str(260)); // the sun's map
- g_zbasic->menu(8, 1, 1, g_zbasic->str(261)); // return to scroll
- g_zbasic->menu(8, 2, 0, g_zbasic->str(262)); // -
+ _zbasic->menu(8, 0, 1, _zbasic->str(260)); // the sun's map
+ _zbasic->menu(8, 1, 1, _zbasic->str(261)); // return to scroll
+ _zbasic->menu(8, 2, 0, _zbasic->str(262)); // -
var_i16_484 = 2;
for (int16 i = _puzzleMenuInstructions[0x30]; i <= _puzzleMenuInstructions[0x30+1]; i++) {
var_i16_484++;
- var_str_384 = g_zbasic->index(0, i) + g_zbasic->str(263); // ' '
- g_zbasic->menu(8, var_i16_484, 1, var_str_384);
+ var_str_384 = _zbasic->index(0, i) + _zbasic->str(263); // ' '
+ _zbasic->menu(8, var_i16_484, 1, var_str_384);
}
}
@@ -199,7 +199,7 @@ void FoolGame::metapuzzleWheel() {
for (int16 i = 1; i <= 2; i++) {
zoomRect(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
}
- g_zbasic->picture(6, 0x6d, _metapuzzleWheelPic);
+ _zbasic->picture(6, 0x6d, _metapuzzleWheelPic);
sub_128_2664();
sub_128_61c2();
}
@@ -212,27 +212,27 @@ void FoolGame::metapuzzleSecretCode() {
zoomRect(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
}
if (_activePuzzle == 0x58) {
- var_str_1170 = g_zbasic->str(264); // treasure name
+ var_str_1170 = _zbasic->str(264); // treasure name
_metapuzzleSecretCodeSpaceOffset = 8;
- _metapuzzleSecretCodeCipher = g_zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
+ _metapuzzleSecretCodeCipher = _zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
}
// 138:0650
if (_activePuzzle == 0x59) {
- var_str_1170 = g_zbasic->str(266); // treasure name
+ var_str_1170 = _zbasic->str(266); // treasure name
_metapuzzleSecretCodeSpaceOffset = 0;
- _metapuzzleSecretCodeCipher = g_zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
+ _metapuzzleSecretCodeCipher = _zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
}
// 138:068a
if (_activePuzzle == 0x5a) {
- var_str_1170 = g_zbasic->str(268); // treasure name
+ var_str_1170 = _zbasic->str(268); // treasure name
_metapuzzleSecretCodeSpaceOffset = 5;
- _metapuzzleSecretCodeCipher = g_zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
+ _metapuzzleSecretCodeCipher = _zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
}
// 138:06c4
if (_activePuzzle == 0x5b) {
- var_str_1170 = g_zbasic->str(270); // treasure name
+ var_str_1170 = _zbasic->str(270); // treasure name
_metapuzzleSecretCodeSpaceOffset = 9;
- _metapuzzleSecretCodeCipher = g_zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
+ _metapuzzleSecretCodeCipher = _zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
}
// 138:06fe
arr_i16_1eb8[0] = 0x122;
@@ -253,7 +253,7 @@ void FoolGame::metapuzzleSecretCode() {
_metapuzzleSecretCodeCount = 0;
var_i16_68a = 1;
for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
- if (g_zbasic->midStr(var_str_1272, i, 1) != g_zbasic->str(273)) {
+ if (_zbasic->midStr(var_str_1272, i, 1) != _zbasic->str(273)) {
_metapuzzleSecretCodeCount++;
}
// 138:07c2
@@ -300,15 +300,15 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
if (!((_keyLastPressed >= 0x41) && (_keyLastPressed <= 0x5a))) {
return;
}
- g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ _zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
_metapuzzleSecretCodeCount++;
if (_metapuzzleSecretCodeSpaceOffset == _metapuzzleSecretCodeCount) {
- if (g_zbasic->leftStr(var_str_1170, _metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
- var_str_1272 += g_zbasic->str(274); // ' '
+ if (_zbasic->leftStr(var_str_1170, _metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
+ var_str_1272 += _zbasic->str(274); // ' '
}
}
// 138:0946
- var_str_d12 = g_zbasic->midStr(_metapuzzleSecretCodeCipher, _keyLastPressed - 0x40, 1);
+ var_str_d12 = _zbasic->midStr(_metapuzzleSecretCodeCipher, _keyLastPressed - 0x40, 1);
var_str_1272 += var_str_d12;
var_i16_484 = g_toolbox->StringWidth(var_str_1272);
var_i16_7e4 = g_toolbox->StringWidth(var_str_1170);
@@ -321,7 +321,7 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
void FoolGame::sub_138_9c4() {
// 138:09c4
- g_zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ _zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
Common::Rect temp;
temp.top = arr_i16_1eb8[0];
temp.left = arr_i16_1eb8[1];
@@ -348,9 +348,9 @@ void FoolGame::metapuzzleSecretCodeReset() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
g_toolbox->FillRect(temp, _patterns[2]);
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
var_i16_7a2 = 0x140;
- var_str_384 = g_zbasic->str(275); // if you know which is which, enter the letters you wish to switch
+ var_str_384 = _zbasic->str(275); // if you know which is which, enter the letters you wish to switch
sub_128_918(var_str_384);
var_str_1272.clear(); // was: str(276)
_metapuzzleSecretCodeCount = 0;
@@ -423,10 +423,10 @@ void FoolGame::metapuzzleOnShift() {
var_str_384 = _puzzleName[_selectedMenuChapter];
} else {
// 138:0d8a
- var_str_384 = g_zbasic->str(277); // the book of thoth
+ var_str_384 = _zbasic->str(277); // the book of thoth
}
// 138:0d9e
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ _zbasic->text(0, 0xc, 0, kSrcOr);
var_i16_30 = g_toolbox->StringWidth(var_str_384);
g_toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
g_toolbox->DrawString(var_str_384);
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index ef697af97de..3e27a711685 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// polyomino puzzle
@@ -40,8 +40,8 @@ void FoolGame::polyominoRun() {
// 133:003c
this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
// "the completed puzzle will reveal..."
- this->var_str_384 = g_zbasic->str(209) + this->var_str_384 + g_zbasic->str(210);
- g_zbasic->menu(8, 0xf, 1, this->var_str_384);
+ this->var_str_384 = _zbasic->str(209) + this->var_str_384 + _zbasic->str(210);
+ _zbasic->menu(8, 0xf, 1, this->var_str_384);
this->var_i16_484 = 0;
this->var_i16_68c = this->arr_i16_1eb8[8];
do {
@@ -58,13 +58,13 @@ void FoolGame::polyominoRun() {
this->var_i16_68c + this->arr_i16_1eb8[12]
);
// 133:0112
- } while (g_zbasic->incrAndCheck(
+ } while (_zbasic->incrAndCheck(
this->var_i16_68a,
this->arr_i16_1eb8[11],
this->arr_i16_1eb8[6]
));
// 133:0142
- } while (g_zbasic->incrAndCheck(
+ } while (_zbasic->incrAndCheck(
this->var_i16_68c,
this->arr_i16_1eb8[9],
this->arr_i16_1eb8[7]
@@ -87,7 +87,7 @@ void FoolGame::polyominoRun() {
}
// 133:0228
g_toolbox->SetPort(this->var_i32_f24);
- g_zbasic->text(0xfb, 0x18, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfb, 0x18, Graphics::kMacFontRegular, kSrcOr);
// for each polyomino
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
@@ -122,7 +122,7 @@ void FoolGame::polyominoRun() {
this->var_i16_1aa8 = 1;
}
for (int i = 3; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_1aa8, 2));
+ this->arr_i16_47d8[j*8 + i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_1aa8, 2));
this->var_i16_1aa8 += 2;
}
}
@@ -162,7 +162,7 @@ void FoolGame::polyominoRun() {
g_toolbox->TextMode(kSrcXor);
for (int i = 1; i <= this->var_i16_103a; i += 3) {
g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
- this->var_str_384 = g_zbasic->chr(this->arr_i16_3738[i+2]);
+ this->var_str_384 = _zbasic->chr(this->arr_i16_3738[i+2]);
g_toolbox->DrawString(this->var_str_384);
}
}
@@ -183,7 +183,7 @@ void FoolGame::polyominoRun() {
g_toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
for (int i = 1; i <= this->var_i16_103a; i += 3) {
g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
- this->var_str_384 = g_zbasic->chr(this->arr_i16_3738[i+2]);
+ this->var_str_384 = _zbasic->chr(this->arr_i16_3738[i+2]);
g_toolbox->DrawString(this->var_str_384);
}
}
@@ -306,13 +306,13 @@ void FoolGame::polyominoOnClick() {
this->var_i16_1062 = _screenGrid[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].left;
this->var_i16_1064 = _screenGrid[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].top;
debug(5, "FoolGame::polyominoOnClick: Draw pic 2 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 2]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 2]);
// 133:0b1c
this->polyominoDrawFrame();
this->sub_128_4da(0);
this->var_i16_1ab6 = this->var_i16_1062;
this->var_i16_1ab8 = this->var_i16_1064;
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
// 133:0b5a: JMP - [0xde0]
while (_event.what != 2) {
@@ -350,13 +350,13 @@ void FoolGame::polyominoOnClick() {
if (_event.what != 2) {
debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
// XOR out original position
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
// drag to cursor position
this->var_i16_1062 = this->var_i16_1ab6;
this->var_i16_1064 = this->var_i16_1ab8;
// XOR out new position
debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:0de0
@@ -418,13 +418,13 @@ void FoolGame::polyominoMove() {
// 133:0fce
if (this->var_i16_1ab0 != 0) {
debug(5, "FoolGame::polyominoMove: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
}
// 133:1002
this->var_i16_1062 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
this->var_i16_1064 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
debug(5, "FoolGame::polyominoMove: Draw pic 1 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- g_zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
+ _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
}
@@ -439,7 +439,7 @@ void FoolGame::polyominoOnClickFixed() {
// 133:1188
debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", this->var_i16_484, this->var_i16_7e4);
for (int i = 0; i <= 9; i++) {
- g_zbasic->picture(this->var_i16_484, this->var_i16_7e4, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(this->var_i16_484, this->var_i16_7e4, this->arr_pic_49d8[this->var_i16_7cc*4]);
g_toolbox->Delay(0);
}
// 133:11c2
@@ -516,11 +516,11 @@ void FoolGame::polyominoSuccess() {
void FoolGame::polyominoStoreState() {
// 133:1452
- _activePuzzleBuffer = g_zbasic->str(212); // empty
+ _activePuzzleBuffer = _zbasic->str(212); // empty
this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
- Common::String val1 = g_zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
- Common::String val2 = g_zbasic->encodeInt(this->arr_i16_47d8[i*8 + 4]);
+ Common::String val1 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
+ Common::String val2 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 4]);
_activePuzzleBuffer += val1 + val2;
}
}
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 52645cd06d9..15188935d25 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -31,8 +31,7 @@
namespace Fool {
-ZBasic *g_zbasic;
-Toolbox *g_toolbox;
+extern Toolbox *g_toolbox;
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
@@ -41,19 +40,17 @@ Toolbox *g_toolbox;
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
void FoolPrologue::run() {
- g_toolbox = new Toolbox();
- g_zbasic = new ZBasic(g_toolbox);
- g_zbasic->loadProgram(Common::Path("Prologue - Finale"));
+ _zbasic = new ZBasic(g_toolbox);
+ _zbasic->loadProgram(Common::Path("Prologue - Finale"));
this->sub_128_004(true);
- delete g_zbasic;
- delete g_toolbox;
+ delete _zbasic;
}
void FoolPrologue::sub_128_004(bool finale) {
var_i16_1aa = finale ? 2 : 1;
// 128:0004
- g_zbasic->coordinateWindow();
+ _zbasic->coordinateWindow();
g_toolbox->ClearMenuBar();
g_toolbox->HideCursor();
g_toolbox->UseResFile(g_toolbox->CurResFile());
@@ -81,12 +78,12 @@ void FoolPrologue::sub_128_004(bool finale) {
// 128:017a
// about message
- this->var_str_76 = g_zbasic->str(0);
- g_zbasic->bufferFlush(this->var_str_76);
- this->var_str_76 = g_zbasic->str(1);
- g_zbasic->bufferFlush(this->var_str_76);
- this->var_str_76 = g_zbasic->str(2);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 = _zbasic->str(0);
+ _zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 = _zbasic->str(1);
+ _zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 = _zbasic->str(2);
+ _zbasic->bufferFlush(this->var_str_76);
// 128:01b6
// JMP 0x1f0
@@ -109,18 +106,18 @@ void FoolPrologue::sub_128_004(bool finale) {
this->sub_129_004();
if (_quit)
return;
- this->var_i32_1a6 = g_zbasic->mem(-1);
+ this->var_i32_1a6 = _zbasic->mem(-1);
if (this->var_i16_1aa == 1) {
this->prologueRun();
- this->var_i32_1a6 = g_zbasic->mem(-1);
+ this->var_i32_1a6 = _zbasic->mem(-1);
}
// 128:0cb0
if (this->var_i16_1aa == 2) {
this->finaleRun();
- this->var_i32_1a6 = g_zbasic->mem(-1);
+ this->var_i32_1a6 = _zbasic->mem(-1);
}
// 128:0cc8
- //g_zbasic->unk4(); // exit command?
+ //_zbasic->unk4(); // exit command?
}
void FoolPrologue::sub_128_1ba(int16 screenPage) {
@@ -350,10 +347,10 @@ void FoolPrologue::drawRainRecycle(int16_t unk) {
if ((this->arr_i16_1e8[this->var_i16_6] > 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] > 0x140)) {
// 128:0bae
- this->arr_i16_1e8[this->var_i16_6] = g_zbasic->rndInt(0x264) - 0xc8;
- this->arr_i16_1e8[0xfb + this->var_i16_6] = g_zbasic->rndInt(0x1ba) - 0xc8;
- this->arr_i16_1e8[0x1f6 + this->var_i16_6] = g_zbasic->rndInt(0x5) + 0x1;
- this->arr_i16_1e8[0x2f1 + this->var_i16_6] = g_zbasic->rndInt(0xa) + 0x19;
+ this->arr_i16_1e8[this->var_i16_6] = _zbasic->rndInt(0x264) - 0xc8;
+ this->arr_i16_1e8[0xfb + this->var_i16_6] = _zbasic->rndInt(0x1ba) - 0xc8;
+ this->arr_i16_1e8[0x1f6 + this->var_i16_6] = _zbasic->rndInt(0x5) + 0x1;
+ this->arr_i16_1e8[0x2f1 + this->var_i16_6] = _zbasic->rndInt(0xa) + 0x19;
}
// 128:0c56
this->drawRainDrop();
@@ -371,7 +368,7 @@ void FoolPrologue::sub_128_c8a() {
}
void FoolPrologue::shuffleScanlines() {
- g_zbasic->unk_20();
+ _zbasic->unk_20();
this->var_i32_1ac = (byte *)&this->arr_i16_41598[0];
this->var_i32_1b0 = (byte *)&this->arr_i16_41846[0];
this->var_i16_1b4 = this->var_i16_18e * 2;
@@ -381,25 +378,25 @@ void FoolPrologue::shuffleScanlines() {
}
// 128:0d2a
for (int i=this->var_i16_18e - 1; i >= 0; i--) {
- this->var_i16_1b6 = g_zbasic->rndInt(i + 1) - 1;
+ this->var_i16_1b6 = _zbasic->rndInt(i + 1) - 1;
this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
- g_zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
- g_zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8 - 2, this->var_i16_1b4 - this->var_i16_1b8);
+ _zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
+ _zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8 - 2, this->var_i16_1b4 - this->var_i16_1b8);
}
}
void FoolPrologue::sub_128_de2() {
// 128:0de2
- g_zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
- this->var_str_76 = g_zbasic->str(3);
+ _zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
+ this->var_str_76 = _zbasic->str(3);
this->drawText(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
- g_zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
- this->var_str_76 = g_zbasic->str(4);
+ _zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
+ this->var_str_76 = _zbasic->str(4);
this->drawTextRightAlign(0x154, 0x1fb);
}
@@ -458,11 +455,11 @@ void FoolPrologue::sub_128_ee0() {
// done by using PEEKWORD into fixed offsets of the window pointer
//this->var_i16_1bc = &this->var_window_24; // +0
//this->var_i16_1be = &this->var_window_24; // +2
- //g_zbasic->unk11(this->var_i16_1be);
+ //_zbasic->unk11(this->var_i16_1be);
}
void FoolPrologue::sub_128_f0a() {
- // g_zbasic->pushOldCodeResource(0x80); // switch CODE resource?
+ // _zbasic->pushOldCodeResource(0x80); // switch CODE resource?
}
// Sources:
@@ -502,8 +499,8 @@ void FoolPrologue::sub_129_004() {
this->var_i16_16 = (this->var_i16_12 - SCREEN_HEIGHT)/2;
// 129:0064
- g_zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, kWindowDialogOneLine);
- g_zbasic->coordinateWindow();
+ _zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, kWindowDialogOneLine);
+ _zbasic->coordinateWindow();
this->var_i16_1c = { 0, 0, 0 };
@@ -567,35 +564,35 @@ void FoolPrologue::sub_129_004() {
this->var_i16_54.bottom = SCREEN_HEIGHT;
this->var_i16_54.right = SCREEN_WIDTH;
- this->var_i32_1c0 = g_zbasic->mem(-1);
+ this->var_i32_1c0 = _zbasic->mem(-1);
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
- g_zbasic->sound(0x19, 0x64, 0xff, 0x0);
+ _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
+ _zbasic->sound(0x19, 0x64, 0xff, 0x0);
this->fillRect(0x46, 0x64, 0xdc, 0x19c, 2);
this->fillRect(0x4b, 0x69, 0xd7, 0x197, 1);
// 129:0386
this->fillRect(0x50, 0x6e, 0xd2, 0x192, 2);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "not enough memory" message
- this->var_str_76 = g_zbasic->str(6);
+ this->var_str_76 = _zbasic->str(6);
this->drawTextCenterAlign(0x64, 0x100);
- this->var_str_76 = g_zbasic->str(7);
+ this->var_str_76 = _zbasic->str(7);
this->drawTextCenterAlign(0x78, 0x100);
- this->var_str_76 = g_zbasic->str(8);
+ this->var_str_76 = _zbasic->str(8);
this->drawTextCenterAlign(0x96, 0x100);
- this->var_str_76 = g_zbasic->str(9);
+ this->var_str_76 = _zbasic->str(9);
this->drawTextCenterAlign(0xaa, 0x100);
- this->var_str_76 = g_zbasic->str(10);
+ this->var_str_76 = _zbasic->str(10);
this->drawTextCenterAlign(0xcb, 0x100);
this->sub_128_e58();
if (_quit)
return;
- g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
+ _zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
this->var_i16_1aa = 0;
} else {
@@ -614,16 +611,16 @@ void FoolPrologue::sub_129_004() {
// 1c4 == string
// 2c4 == unused
// 2c8 == volume number?
- this->var_i16_176 = g_zbasic->finderInfo(this->var_i16_180, this->var_i16_1c4, this->var_i32_2c4, this->var_i16_2c8);
+ this->var_i16_176 = _zbasic->finderInfo(this->var_i16_180, this->var_i16_1c4, this->var_i32_2c4, this->var_i16_2c8);
if (Common::U32String("") != this->var_i16_1c4) {
// 129:04de
// "and now it is time to show the finale" message
- this->var_str_76 = g_zbasic->str(12);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 = _zbasic->str(12);
+ _zbasic->bufferFlush(this->var_str_76);
for (int i = 1; i <= 0xa; i++) {
- this->var_str_76 += g_zbasic->chr(i);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += _zbasic->chr(i);
+ _zbasic->bufferFlush(this->var_str_76);
}
// 129:0522
@@ -634,11 +631,11 @@ void FoolPrologue::sub_129_004() {
// 0x0534: LEA - [0x0764],A0
// 0x0538: MOVE.L - A0,-0x8ee(A5)
// 0x053c: SF - 0x8,D0
- g_zbasic->openR(1, this->var_i16_1c4, 0x400, this->var_i16_2c8);
+ _zbasic->openR(1, this->var_i16_1c4, 0x400, this->var_i16_2c8);
- Handle payload = g_zbasic->readFile(1, this->var_i16_2ca);
+ Handle payload = _zbasic->readFile(1, this->var_i16_2ca);
this->var_i16_2ce = Common::U32String((char *)payload->data(), this->var_i16_2ca, Common::kMacRoman);
- g_zbasic->close(1);
+ _zbasic->close(1);
// 0x0570: CLR.L - -0x8ee(A5)
// 129:0582
if ((this->var_i16_2ce == this->var_str_76) &&
@@ -652,40 +649,40 @@ void FoolPrologue::sub_129_004() {
// 129:05a6
if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
g_toolbox->InitCursor();
- g_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
- g_zbasic->sound(0x19, 0x64, 0xff, 0x00);
+ _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
+ _zbasic->sound(0x19, 0x64, 0xff, 0x00);
this->fillRect(0x64, 0x82, 0xdc, 0x17e, 2);
this->fillRect(0x69, 0x87, 0xd7, 0x179, 1);
this->fillRect(0x6e, 0x8c, 0xd2, 0x174, 2);
// 129:0662
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "set your monitor to black and white" message"
- this->var_str_76 = g_zbasic->str(13);
+ this->var_str_76 = _zbasic->str(13);
this->drawTextCenterAlign(0x82, 0x100);
- this->var_str_76 = g_zbasic->str(14);
+ this->var_str_76 = _zbasic->str(14);
this->drawTextCenterAlign(0x96, 0x100);
- this->var_str_76 = g_zbasic->str(15);
+ this->var_str_76 = _zbasic->str(15);
// if this is the finale
if (this->var_i16_1aa == 2) {
- this->var_str_76 = g_zbasic->str(16);
+ this->var_str_76 = _zbasic->str(16);
}
this->drawTextCenterAlign(0xaa, 0x100);
- this->var_str_76 = g_zbasic->str(17);
+ this->var_str_76 = _zbasic->str(17);
this->drawTextCenterAlign(0xcb, 0xfc);
// 129:0730
this->sub_128_e58();
if (_quit)
return;
- g_zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
+ _zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
this->var_i16_1aa = 0;
} else {
// 129:075c
this->sub_128_e80();
}
// 129:0772
- // g_zbasic->pushOldCodeResource(0x81);
+ // _zbasic->pushOldCodeResource(0x81);
this->prologueRun();
}
@@ -694,11 +691,11 @@ void FoolPrologue::sub_129_004() {
void FoolPrologue::sub_129_764() {
// 129:0764
this->var_i16_2cc = 1;
- g_zbasic->unk_130(0);
+ _zbasic->unk_130(0);
}
void FoolPrologue::sub_129_772() {
- // g_zbasic->pushOldCodeResource(0x81);
+ // _zbasic->pushOldCodeResource(0x81);
}
void FoolPrologue::prologueRun() {
@@ -723,12 +720,12 @@ void FoolPrologue::prologueRun() {
this->prologueDrawLoadingMsg();
this->setPortBitsToPage(0xb);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- g_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
+ _zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
- g_zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = g_zbasic->str(18);
+ _zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcBic);
+ this->var_str_76 = _zbasic->str(18);
this->drawTextCenterAlign(0x10d, 0x103);
g_toolbox->SetPortBits(this->var_i32_32);
// cliffside images with lightning
@@ -739,18 +736,18 @@ void FoolPrologue::prologueRun() {
// 130:00d6
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- g_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
+ _zbasic->picture(0, 0x96, this->arr_i32_0[1]);
g_toolbox->ReleaseResource(this->arr_i32_0[1]);
this->setPortBitsToPage(8);
// 130:011c
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- g_zbasic->picture(0, 0x96, this->arr_i32_0[2]);
+ _zbasic->picture(0, 0x96, this->arr_i32_0[2]);
g_toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
for (int i = 3; i <= 5; i++) {
- //g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[7]);
}
// high priestess skull
@@ -758,17 +755,17 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(0);
// 130:01aa
- g_zbasic->picture(0, 0, this->arr_i32_0[6]);
+ _zbasic->picture(0, 0, this->arr_i32_0[6]);
g_toolbox->ReleaseResource(this->arr_i32_0[6]);
// high priestess face
this->prologueBufferNextPicture();
- //g_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
this->arr_i32_41296[1]->copyFrom(*this->arr_i32_41296[0]);
this->setPortBitsToPage(1);
// 130:0202
- g_zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
+ _zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
g_toolbox->ReleaseResource(this->arr_i32_0[7]);
// priestess on mountain
this->prologueBufferNextPicture();
@@ -776,7 +773,7 @@ void FoolPrologue::prologueRun() {
// 130:0234
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- g_zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
+ _zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
g_toolbox->ReleaseResource(this->arr_i32_0[8]);
// 130:0276
@@ -792,8 +789,8 @@ void FoolPrologue::prologueRun() {
// 130:029a
this->setPortBitsToPage(j - 6);
- g_zbasic->picture(0, 0, this->arr_i32_0[j]);
- g_zbasic->picture(this->var_i16_74, 0x96, this->arr_i32_0[j - 6]);
+ _zbasic->picture(0, 0, this->arr_i32_0[j]);
+ _zbasic->picture(this->var_i16_74, 0x96, this->arr_i32_0[j - 6]);
g_toolbox->ReleaseResource(this->arr_i32_0[j]);
g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
@@ -802,7 +799,7 @@ void FoolPrologue::prologueRun() {
// 130:0320
this->setPortBitsToPage(6);
- g_zbasic->picture(0, 0, this->arr_i32_0[0xc]);
+ _zbasic->picture(0, 0, this->arr_i32_0[0xc]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
// 130:034a
@@ -962,7 +959,7 @@ void FoolPrologue::prologueRun() {
// 130:083c
// Draw the priestess silhouette
- g_zbasic->picture(0, 0, this->arr_i32_0[0xd]);
+ _zbasic->picture(0, 0, this->arr_i32_0[0xd]);
// Image two in this sequence is a PICT that draws the words
// "...for no-one can undo the treachery I have inflicted upon the land!"
@@ -974,7 +971,7 @@ void FoolPrologue::prologueRun() {
// screen with the line tool and gives a cool fade-in effect, which we
// simulate here.
this->arr_i32_0[0xe]->_opsPerTick = 32;
- g_zbasic->picture(5, 0, this->arr_i32_0[0xe]);
+ _zbasic->picture(5, 0, this->arr_i32_0[0xe]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xd]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xe]);
@@ -982,23 +979,23 @@ void FoolPrologue::prologueRun() {
// start loading some new resources from the floppy disk into the screen buffers
this->var_i32_2 = g_toolbox->TickCount();
// 130:0890
- // g_zbasic->52(0);
+ // _zbasic->52(0);
this->setPortBitsToPage(0);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- g_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
+ _zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->prologueRenderNextText();
this->sub_128_de2();
this->setPortBitsToPage(1);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- g_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
+ _zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->prologueRenderNextText();
this->sub_128_de2();
// 130:0934
for (int i = 2; i <= 5; i++) {
- //g_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[1]);
}
// 130:0978
@@ -1019,22 +1016,22 @@ void FoolPrologue::prologueRun() {
// 130:0a42
this->setPortBitsToPage(6);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- g_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
+ _zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
this->sub_128_de2();
- //g_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
this->arr_i32_41296[7]->copyFrom(*this->arr_i32_41296[6]);
this->prologueRenderNextText();
g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->setPortBitsToPage(7);
// 130:0ac2
- g_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
+ _zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
this->prologueRenderNextText();
g_toolbox->ReleaseResource(this->arr_i32_0[0x12]);
this->setPortBitsToPage(8);
- //g_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
this->fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
- g_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
+ _zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1115,7 +1112,7 @@ void FoolPrologue::prologueRun() {
this->sub_128_354(kPatCopy, 1);
// 130:0ce6
// JMP 1002
- // g_zbasic->pushOldCodeResource(0x82);
+ // _zbasic->pushOldCodeResource(0x82);
//this->finaleRun();
}
@@ -1131,11 +1128,11 @@ void FoolPrologue::prologueBufferNextPicture() {
void FoolPrologue::prologueDrawLoadingMsg() {
// 130:0d28
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// "loading prologue" message
- this->var_str_76 = g_zbasic->str(19);
+ this->var_str_76 = _zbasic->str(19);
this->var_str_76 += Common::U32String::format(" %d", this->var_i16_3ce);
- this->var_str_76 += g_zbasic->str(20);
+ this->var_str_76 += _zbasic->str(20);
// 130:0d70
// white out the contents of the top menu bar.
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
@@ -1148,15 +1145,15 @@ void FoolPrologue::prologueDrawLoadingMsg() {
void FoolPrologue::drawRain() {
// 130:0db0
- g_zbasic->unk_20();
+ _zbasic->unk_20();
g_toolbox->PenMode(kPatXor);
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
// 130:0dc0
- this->arr_i16_1e8[this->var_i16_6] = g_zbasic->rndInt(0x264) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0xfb] = g_zbasic->rndInt(0x1ba) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = g_zbasic->rndInt(0x5) + 1;
- this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = g_zbasic->rndInt(0xa) + 0x19;
+ this->arr_i16_1e8[this->var_i16_6] = _zbasic->rndInt(0x264) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0xfb] = _zbasic->rndInt(0x1ba) - 0x64;
+ this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = _zbasic->rndInt(0x5) + 1;
+ this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = _zbasic->rndInt(0xa) + 0x19;
// 130:0e68
this->drawRainDrop();
this->var_i16_6 += 1;
@@ -1178,33 +1175,28 @@ void FoolPrologue::drawRainDrop() {
void FoolPrologue::prologueRenderNextText() {
// 130:0f48
- this->var_i16_3d2 = g_zbasic->readDataInt();
+ this->var_i16_3d2 = _zbasic->readDataInt();
for (int i = 1; i <= this->var_i16_3d2; i++) {
// 130:0f56
- this->var_i16_176 = g_zbasic->readDataInt();
- this->var_i16_180 = g_zbasic->readDataInt();
- this->var_str_76 = g_zbasic->readDataStr();
+ this->var_i16_176 = _zbasic->readDataInt();
+ this->var_i16_180 = _zbasic->readDataInt();
+ this->var_str_76 = _zbasic->readDataStr();
this->var_i16_1ba = 1;
// JMP 0xfc2
while (this->var_i16_1ba > 0) {
// 130:0f78
- this->var_i16_1ba = g_zbasic->instr(this->var_i16_1ba, this->var_str_76, g_zbasic->str(21));
+ this->var_i16_1ba = _zbasic->instr(this->var_i16_1ba, this->var_str_76, _zbasic->str(21));
if (this->var_i16_1ba > 0) {
this->var_str_76.replace(this->var_i16_1ba-1, 1, Common::U32String("\""));
}
}
// 130:0fc8
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->drawText(this->var_i16_180, this->var_i16_176);
}
}
-void FoolPrologue::sub_130_1002() {
- // 130:1002
- // g_zbasic->pushOldCodeResource(0x82);
- //this->finaleRun();
-}
// run finale
void FoolPrologue::finaleRun() {
@@ -1221,7 +1213,7 @@ void FoolPrologue::finaleRun() {
// 131:004c
this->arr_i32_0[0x1f] = g_toolbox->GetPicture(0x1f);
this->setPortBitsToPage(0x4);
- g_zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
+ _zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
this->sub_131_4dc0();
for (int i = 0x14; i < 0x1e; i++) {
@@ -1238,13 +1230,13 @@ void FoolPrologue::finaleRun() {
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
// 131:0110
if (i < 8) {
- g_zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
+ _zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
}
if (i == 8) {
- g_zbasic->picture(0, 0, this->arr_i32_0[0x1a]);
+ _zbasic->picture(0, 0, this->arr_i32_0[0x1a]);
}
if (i == 9) {
- g_zbasic->picture(0x60, 0x4c, this->arr_i32_0[0x1b]);
+ _zbasic->picture(0x60, 0x4c, this->arr_i32_0[0x1b]);
}
}
// 131:0184
@@ -1254,8 +1246,8 @@ void FoolPrologue::finaleRun() {
// 131:01aa
this->arr_i32_0[0x13] = g_toolbox->GetPicture(0x13);
this->setPortBitsToPage(0x5);
- g_zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
- g_zbasic->picture(0, 0, this->arr_i32_0[0x18]);
+ _zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
+ _zbasic->picture(0, 0, this->arr_i32_0[0x18]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x13]);
g_toolbox->ReleaseResource(this->arr_i32_0[0x18]);
this->sub_131_4e98();
@@ -1272,7 +1264,7 @@ void FoolPrologue::finaleRun() {
// 131:026e
this->var_i16_18e = SCREEN_HEIGHT;
this->shuffleScanlines();
- this->var_i32_1a6 = g_zbasic->mem(-1);
+ this->var_i32_1a6 = _zbasic->mem(-1);
g_toolbox->SetPortBits(this->var_i32_32);
if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
@@ -1291,17 +1283,17 @@ void FoolPrologue::finaleRun() {
return;
this->sub_131_4e98();
- // g_zbasic->52(0x4c);
+ // _zbasic->52(0x4c);
for (int j = 1; j < 0xe; j++) {
this->var_i16_3da = 1;
// 131:030c
- this->var_i16_18e = g_zbasic->readDataInt();
+ this->var_i16_18e = _zbasic->readDataInt();
for (int i = 1; i < this->var_i16_18e; i++) {
// 131:031a
- this->arr_i16_1e8[i] = g_zbasic->readDataInt();
- this->arr_i16_1e8[i + 0xfb] = g_zbasic->readDataInt();
- this->arr_i16_1e8[i + 0x1f6] = g_zbasic->readDataInt();
+ this->arr_i16_1e8[i] = _zbasic->readDataInt();
+ this->arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
+ this->arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
}
// 131:0380
@@ -1318,24 +1310,24 @@ void FoolPrologue::finaleRun() {
// 131:03c0
this->delay(0x1e);
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(22));
- g_zbasic->bufferFlush(this->var_str_76);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(22));
+ _zbasic->bufferFlush(this->var_str_76);
// 131:0400
this->drawText(0x17c, 0xb4);
this->delay(0x1e);
// 131:041a
- g_zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
+ _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
this->delay(0x2);
- g_zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
+ _zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
this->delay(0x3c);
- g_zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
+ _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
this->delay(0x6);
- g_zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
+ _zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
this->delay(0x6);
- g_zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
+ _zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
// 131:04b4
for (int i = 0x14; i < 0x17; i++) {
@@ -1371,7 +1363,7 @@ void FoolPrologue::finaleRun() {
// 131:0630
g_toolbox->SetPortBits(this->var_i32_32);
- g_zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
+ _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
this->delayFromMarker(0x3c);
this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
this->sub_128_50a(0x6, 0, 0x200, 0x3);
@@ -1385,7 +1377,7 @@ void FoolPrologue::finaleRun() {
this->sub_128_50a(0x9, 0, 0x200, 1);
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
- g_zbasic->unk_20();
+ _zbasic->unk_20();
// 131:0730
this->var_i16_3dc = 0;
@@ -1393,14 +1385,14 @@ void FoolPrologue::finaleRun() {
for (int j = 1; j < 0x63; j++) {
if (this->var_i16_3dc > SCREEN_HEIGHT) {
// 131:074e
- this->var_i16_3dc += g_zbasic->maybe() ? 0x4 : 0x5;
+ this->var_i16_3dc += _zbasic->maybe() ? 0x4 : 0x5;
}
if (this->var_i16_18e > 0x41) {
// 131:0770
this->var_i16_18e += 1;
- this->arr_i16_1e8[this->var_i16_18e] = g_zbasic->rndInt(32);
- this->arr_i16_1e8[this->var_i16_18e+0xfb] = g_zbasic->rndInt(this->var_i16_3dc);
- this->arr_i16_1e8[this->var_i16_18e+0x1f6] = g_zbasic->rndInt(0xa) + 0xa;
+ this->arr_i16_1e8[this->var_i16_18e] = _zbasic->rndInt(32);
+ this->arr_i16_1e8[this->var_i16_18e+0xfb] = _zbasic->rndInt(this->var_i16_3dc);
+ this->arr_i16_1e8[this->var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
this->sub_131_4f96();
}
// 131:07ea
@@ -1411,8 +1403,8 @@ void FoolPrologue::finaleRun() {
// 131:0870
if (this->arr_i16_1e8[i] < SCREEN_WIDTH) {
this->arr_i16_1e8[i] = 1;
- this->arr_i16_1e8[0xfb+i] = g_zbasic->rndInt(this->var_i16_3dc);
- this->arr_i16_1e8[0x1f6+i] = g_zbasic->rndInt(0xa) + 0xa;
+ this->arr_i16_1e8[0xfb+i] = _zbasic->rndInt(this->var_i16_3dc);
+ this->arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
}
// 131:0902
@@ -1424,9 +1416,9 @@ void FoolPrologue::finaleRun() {
// 131:0926
g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g_toolbox->PenPat(this->arr_pat_194[3]);
- g_zbasic->picture(0x6d, 0x49, this->arr_i32_0[0x1c]);
- g_zbasic->picture(0x65, 0x48, this->arr_i32_0[0x1d]);
- g_zbasic->picture(0x64, 0x54, this->arr_i32_0[0x1e]);
+ _zbasic->picture(0x6d, 0x49, this->arr_i32_0[0x1c]);
+ _zbasic->picture(0x65, 0x48, this->arr_i32_0[0x1d]);
+ _zbasic->picture(0x64, 0x54, this->arr_i32_0[0x1e]);
// 131:099c
g_toolbox->PaintPoly(this->var_i32_3d6);
@@ -1445,9 +1437,9 @@ void FoolPrologue::finaleRun() {
// 131:0a7a
for (int i = 1; i < 0x63; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_74 = g_zbasic->rndInt(0x1ca);
- this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
+ this->var_i16_74 = _zbasic->rndInt(0x1ca);
+ this->var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
g_toolbox->InvertRect(this->arr_i16_1bc);
this->delayFromMarker(1);
}
@@ -1457,24 +1449,24 @@ void FoolPrologue::finaleRun() {
// 131:0af6
while (g_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
- this->var_i16_74 = g_zbasic->rndInt(0x1ca);
- this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_i16_192 + 0x5a, this->arr_i32_3bca4);
+ this->var_i16_74 = _zbasic->rndInt(0x1ca);
+ this->var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_i16_192 + 0x5a, this->arr_i32_3bca4);
// 131:0b54
- this->var_i16_74 = g_zbasic->rndInt(0x1ca);
- this->var_i16_192 = g_zbasic->rndInt(0xfc);
- g_zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
+ this->var_i16_74 = _zbasic->rndInt(0x1ca);
+ this->var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
}
// 131:0bb0
this->sub_128_50a(4, 0, SCREEN_WIDTH, 3);
this->sub_128_1ba(5);
- g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delay(0x3c);
this->sub_128_50a(5, 0, SCREEN_WIDTH, 0);
- g_zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
+ _zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
// 131:0c36
this->var_i32_2 = g_toolbox->TickCount();
@@ -1485,19 +1477,19 @@ void FoolPrologue::finaleRun() {
// 131:0c6c
for (int i = 0x6; i < 0xa; i++) {
- //g_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
+ //_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[5]);
}
this->setPortBitsToPage(0x6);
- g_zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
+ _zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
this->setPortBitsToPage(0x7);
- g_zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
+ _zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
this->setPortBitsToPage(0x8);
- g_zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
+ _zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
this->setPortBitsToPage(0x9);
- g_zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
+ _zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
this->setPortBitsToPage(0xa);
- g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
+ _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
// 131:0d64
for (int i = 0x20; i < 0x23; i++) {
@@ -1505,45 +1497,45 @@ void FoolPrologue::finaleRun() {
}
g_toolbox->SetPortBits(this->var_i32_32);
this->delayFromMarker(0x64);
- g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
for (int i = 0x6; i < 0xa; i++) {
this->delay(0xf);
this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
}
- g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
+ _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
this->delay(0x3c);
// 131:0e08
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(23));
- g_zbasic->bufferFlush(this->var_str_76);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(23));
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
this->var_i32_2 = g_toolbox->TickCount();
// 131:0e76
- //g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
this->arr_i32_41296[5]->copyFrom(*this->arr_i32_41296[4]);
this->setPortBitsToPage(0x5);
- g_zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
- g_zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
- g_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
+ _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
+ _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
+ _zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
this->setPortBitsToPage(0x6);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
+ _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
this->setPortBitsToPage(0x7);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- g_zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
- //g_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
+ _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
+ //_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
this->setPortBitsToPage(0x8);
- g_zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
- //g_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
+ _zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
+ //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
this->arr_i32_41296[9]->copyFrom(*this->arr_i32_41296[4]);
this->setPortBitsToPage(0x9);
- g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
this->setPortBitsToPage(0xa);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
// 131:1056
g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
@@ -1563,7 +1555,7 @@ void FoolPrologue::finaleRun() {
for (int i = 0xdc; i > 0x19; i -= 5) {
// 131:10de
this->var_i32_2 = g_toolbox->TickCount();
- //g_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
this->var_i32_4e->copyFrom(*this->arr_i32_41296[5]);
this->var_i16_64.top = i;
this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
@@ -1579,7 +1571,7 @@ void FoolPrologue::finaleRun() {
this->sub_128_1ba(0x5);
this->setPortBitsToPage(0x5);
this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- g_zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
g_toolbox->SetPortBits(this->var_i32_32);
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
@@ -1591,11 +1583,11 @@ void FoolPrologue::finaleRun() {
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(24).encode().c_str());
- g_zbasic->bufferFlush(this->var_str_76);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str());
+ _zbasic->bufferFlush(this->var_str_76);
this->drawTextRightAlign(0x1f4, 0xd2);
- g_zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
}
this->delayFromMarker(0x2);
g_toolbox->MoveTo(0x172, 0x33);
@@ -1614,7 +1606,7 @@ void FoolPrologue::finaleRun() {
this->setPortBitsToPage(0x5);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- g_zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
+ _zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
g_toolbox->SetPortBits(this->var_i32_32);
this->delayFromMarker(0xa);
this->var_i16_5c.left = 0x18b;
@@ -1634,11 +1626,11 @@ void FoolPrologue::finaleRun() {
}
// 131:1424
- g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
+ _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
this->delay(0x1);
- g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
+ _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
this->delay(0x1);
- g_zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
+ _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
this->sub_128_1ba(0x6);
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
@@ -1658,7 +1650,7 @@ void FoolPrologue::finaleRun() {
g_toolbox->SetPortBits(this->var_i32_4e);
for (int i = 1; i < 0xf; i++) {
this->var_i32_2 = g_toolbox->TickCount();
- //g_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
+ //_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
this->var_i32_4e->copyFrom(*this->arr_i32_41296[6]);
this->var_i16_3e0 += 5 + i*2;
this->var_i16_64.left = 0x1e0;
@@ -1682,8 +1674,8 @@ void FoolPrologue::finaleRun() {
this->var_i32_2 = g_toolbox->TickCount();
if (j == 0) {
- this->arr_i16_1e8[i] = 0x1f4 - i + g_zbasic->rndInt(i);
- this->arr_i16_1e8[i+0xfb] = g_zbasic->rndInt(i)- SCREEN_HEIGHT;
+ this->arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
+ this->arr_i16_1e8[i+0xfb] = _zbasic->rndInt(i)- SCREEN_HEIGHT;
}
// 131:1692
g_toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
@@ -1700,9 +1692,9 @@ void FoolPrologue::finaleRun() {
}
this->delayFromMarker(0x3c);
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = Common::U32String::format("\"%s\"", g_zbasic->str(25).c_str());
- g_zbasic->bufferFlush(this->var_str_76);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(25).c_str());
+ _zbasic->bufferFlush(this->var_str_76);
this->drawTextRightAlign(0x181, 0x3c);
// 131:17c8
@@ -1715,15 +1707,15 @@ void FoolPrologue::finaleRun() {
}
delayFromMarker(0xd2);
fillRect(0, 0, 0x96, 0x18b, 2);
- g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
delay(1);
- g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
- var_str_76 = g_zbasic->chr(0x22) + g_zbasic->str(26); // high priestess!
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ var_str_76 = _zbasic->chr(0x22) + _zbasic->str(26); // high priestess!
drawTextRightAlign(0x181, 0x3c);
- var_str_76 = g_zbasic->str(27); // am I to suffer this fate merely for uncovering
+ var_str_76 = _zbasic->str(27); // am I to suffer this fate merely for uncovering
drawTextRightAlign(0x181, 0x4d);
- var_str_76 = g_zbasic->chr(0x22) + g_zbasic->str(28); // the fourteen lost treasures of the land?
+ var_str_76 = _zbasic->chr(0x22) + _zbasic->str(28); // the fourteen lost treasures of the land?
drawTextRightAlign(0x181, 0x5e);
for (int16 i = 0x30; i <= 0x31; i++) {
g_toolbox->ReleaseResource(arr_i32_0[i]);
@@ -1732,7 +1724,7 @@ void FoolPrologue::finaleRun() {
arr_i32_0[i] = g_toolbox->GetPicture(i);
if (i == 0x37) {
setPortBitsToPage(5);
- g_zbasic->picture(0, 0, arr_i32_0[0x37]);
+ _zbasic->picture(0, 0, arr_i32_0[0x37]);
g_toolbox->ReleaseResource(arr_i32_0[0x37]);
g_toolbox->SetPortBits(var_i32_32);
}
@@ -1742,15 +1734,15 @@ void FoolPrologue::finaleRun() {
sub_128_e58();
sub_128_e1c();
fillRect(0, 0, 0x96, 0x18b, 2);
- g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
- var_str_76 = g_zbasic->chr(0x22) + g_zbasic->str(29); // for if that be true
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ var_str_76 = _zbasic->chr(0x22) + _zbasic->str(29); // for if that be true
drawTextRightAlign(0x181, 0x3c);
- var_str_76 = g_zbasic->str(30); // I wish you had made the challenge more difficult
+ var_str_76 = _zbasic->str(30); // I wish you had made the challenge more difficult
drawTextRightAlign(0x181, 0x4d);
- var_str_76 = g_zbasic->str(31); // after all, I am just a fool and I should not
+ var_str_76 = _zbasic->str(31); // after all, I am just a fool and I should not
drawTextRightAlign(0x181, 0x5e);
- var_str_76 = g_zbasic->str(32) + g_zbasic->chr(0x22); // have been able to find them so easily
+ var_str_76 = _zbasic->str(32) + _zbasic->chr(0x22); // have been able to find them so easily
drawTextRightAlign(0x181, 0x6f);
arr_i16_41af4.top = 6;
arr_i16_41af4.left = 0xd0;
@@ -1816,7 +1808,7 @@ void FoolPrologue::finaleRun() {
fillRect(0x12c, 0x15e, 0x156, 0x200, 2);
var_i16_18e = 0;
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- g_zbasic->get(
+ _zbasic->get(
0x190,
i + 0xa,
0x1ea,
@@ -1837,9 +1829,9 @@ void FoolPrologue::finaleRun() {
}
var_i32_2 = g_toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- g_zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
+ _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
arr_i16_1e8[i] -= arr_i16_1e8[0xfb + i]*j;
- g_zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
// 131:2062
}
// 131:2072
@@ -1848,25 +1840,25 @@ void FoolPrologue::finaleRun() {
for (int16 j = 1; j <= 0xf; j++) {
var_i32_2 = g_toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- g_zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
+ _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
arr_i16_1e8[i] += arr_i16_1e8[0xfb + i]*j;
- g_zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
}
delayFromMarker(2);
}
// 131:21e0
- g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x33]);
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x33]);
var_i16_1b6 = 0x14;
- var_str_76 = g_zbasic->str(33); // be content that you still live
+ var_str_76 = _zbasic->str(33); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
var_i32_2 = g_toolbox->TickCount();
- g_zbasic->text(0xfa, i, 0, kSrcXor);
+ _zbasic->text(0xfa, i, 0, kSrcXor);
var_i16_1b6 += i;
drawText(5 + i*2, var_i16_1b6);
delayFromMarker(3);
}
// 131:2282
- g_zbasic->picture(0x193, 0x2d, arr_i32_0[0x34]);
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x34]);
var_i32_2 = g_toolbox->TickCount();
setPortBitsToPage(4);
g_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
@@ -1891,11 +1883,11 @@ void FoolPrologue::finaleRun() {
void FoolPrologue::sub_131_4dc0() {
// 131:4dc0
g_toolbox->SetPort(this->var_i32_c);
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Finale
- this->var_str_76 += g_zbasic->str(78);
+ this->var_str_76 += _zbasic->str(78);
this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
- g_zbasic->bufferFlush(this->var_str_76);
+ _zbasic->bufferFlush(this->var_str_76);
// 131:4e08
this->fillRect(0, 0, 7, 0x13, this->var_i16_10 - 7);
@@ -1906,38 +1898,38 @@ void FoolPrologue::sub_131_4dc0() {
void FoolPrologue::sub_131_4e48() {
// 131:4e48
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Uh oh . . .
- this->var_str_76 += Common::U32String::format("\"%s\"", g_zbasic->str(80).c_str());
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += Common::U32String::format("\"%s\"", _zbasic->str(80).c_str());
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0x1aa, 0xb4);
}
void FoolPrologue::sub_131_4e98() {
// 131:4e98
- g_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcXor);
this->var_i16_3fc = 0xa0;
// "And so the fool heeded the advice of the magician..."
- this->var_str_76 += g_zbasic->str(81);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += _zbasic->str(81);
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0x92, this->var_i16_3fc);
- this->var_str_76 += g_zbasic->str(82);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += _zbasic->str(82);
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0x9c, this->var_i16_3fc + 0xf);
- this->var_str_76 += g_zbasic->str(83);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += _zbasic->str(83);
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0xa6, this->var_i16_3fc + 0x1e);
- this->var_str_76 += g_zbasic->str(84);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += _zbasic->str(84);
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0xc4, this->var_i16_3fc + 0x2d);
- this->var_str_76 += g_zbasic->str(85);
- g_zbasic->bufferFlush(this->var_str_76);
+ this->var_str_76 += _zbasic->str(85);
+ _zbasic->bufferFlush(this->var_str_76);
this->drawText(0xe2, this->var_i16_3fc + 0x3c);
this->sub_128_de2();
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 56bb68d3fb1..a05e58aa294 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -31,6 +31,8 @@
namespace Fool {
+class ZBasic;
+
class FoolPrologue {
public:
FoolPrologue() {}
@@ -75,7 +77,6 @@ public:
void drawRain(); // sub_130_db0
void drawRainDrop(); // sub_130_e82
void prologueRenderNextText(); // sub_130_f48
- void sub_130_1002();
void finaleRun(); // sub_131_004
@@ -85,6 +86,7 @@ public:
void sub_131_4f96();
private:
+ ZBasic *_zbasic;
bool _quit = false;
// last tick count
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 202b491dde3..2f18e0f0cd1 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// mask reveal puzzle
@@ -39,8 +39,8 @@ void FoolGame::revealRun() {
this->arr_i16_1eb8[21] = puzzlesReadShort();
debugC(5, kDebugLoading, "%d, %d, %04x", this->arr_i16_1eb8[15], this->arr_i16_1eb8[16], this->arr_i16_1eb8[21]);
this->var_str_384 = puzzlesReadString();
- this->var_str_384 = g_zbasic->str(213) + this->var_str_384 + g_zbasic->str(214);
- g_zbasic->menu(8, 6, 1, this->var_str_384);
+ this->var_str_384 = _zbasic->str(213) + this->var_str_384 + _zbasic->str(214);
+ _zbasic->menu(8, 6, 1, this->var_str_384);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
this->arr_i16_3738[i] = puzzlesReadByte();
}
@@ -78,13 +78,13 @@ void FoolGame::revealRun() {
this->zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
this->zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
// 134:02f0
- this->arr_i16_1eb8[19] = g_zbasic->decodeInt(_activePuzzleBuffer);
+ this->arr_i16_1eb8[19] = _zbasic->decodeInt(_activePuzzleBuffer);
this->var_i16_1aba = this->arr_i16_1eb8[18];
- g_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
this->sub_128_50e(
- g_zbasic->rndInt(0x3e8) + 0x19,
+ _zbasic->rndInt(0x3e8) + 0x19,
0x28,
1
);
@@ -99,7 +99,7 @@ void FoolGame::revealRun() {
g_toolbox->FillRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19, _patterns[0]);
g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
// 134:0448
- this->var_str_384 = g_zbasic->midStr(this->var_str_1272, this->var_i16_7be, 1);
+ this->var_str_384 = _zbasic->midStr(this->var_str_1272, this->var_i16_7be, 1);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(
_screenGrid[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
@@ -140,7 +140,7 @@ void FoolGame::revealRun() {
this->revealReset();
}
if (_stateFlags == kStateSaveGame) {
- _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
+ _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[19]);
this->saveGame();
}
// 134:061e
@@ -149,7 +149,7 @@ void FoolGame::revealRun() {
if (_activePuzzleSolved) {
this->revealSuccess();
}
- _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[19]);
+ _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
g_toolbox->KillPoly(_revealPoly[i]);
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index af31d750606..73999daa2d2 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -27,7 +27,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// sentence join game
@@ -52,12 +52,12 @@ void FoolGame::sentenceRun() {
this->var_i16_1066 = puzzlesReadShort();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
this->arr_i16_1eb8[0] = puzzlesReadShort();
- g_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, 0);
this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
- this->var_str_384 = g_zbasic->str(215) + this->var_str_384 + g_zbasic->str(216); // to reveal XXXXX
+ this->var_str_384 = _zbasic->str(215) + this->var_str_384 + _zbasic->str(216); // to reveal XXXXX
// 135:0152
- g_zbasic->menu(8, 7, 1, this->var_str_384);
+ _zbasic->menu(8, 7, 1, this->var_str_384);
this->arr_i16_1eb8[1] = 0x1c2 / this->arr_i16_1eb8[0];
this->arr_i16_1eb8[2] = 0x100 - ((this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1]) / 2);
@@ -66,9 +66,9 @@ void FoolGame::sentenceRun() {
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->arr_i16_4338[i] = 0;
this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = puzzlesReadByte();
- g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, i);
// 135:0254
- g_zbasic->indexRawSet(puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
_screenGrid[i].top = 0xf2;
_screenGrid[i].left = this->var_i16_7e4;
_screenGrid[i].bottom = 0x156;
@@ -77,7 +77,7 @@ void FoolGame::sentenceRun() {
this->var_i16_7e4 += this->arr_i16_1eb8[1];
}
// 135:0348
- g_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ _zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
g_toolbox->FillRect(temp, _patterns[2]);
@@ -88,23 +88,23 @@ void FoolGame::sentenceRun() {
this->arr_i16_4338[this->var_i16_68a] = 1;
} else {
// 135:03d4
- this->arr_i16_4338[this->var_i16_68a] = g_zbasic->castInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_68a, 1));
+ this->arr_i16_4338[this->var_i16_68a] = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_68a, 1));
}
// 135:0408
if (this->arr_i16_4338[this->var_i16_68a] == 1) {
- this->sub_128_50e(g_zbasic->rndInt(1000) + 0x19, 0x28, 1);
+ this->sub_128_50e(_zbasic->rndInt(1000) + 0x19, 0x28, 1);
this->sub_135_a34();
}
// 135:044a
}
// 135:0466
if (_activePuzzleBuffer.empty()) { // was: str(218)
- this->var_str_1070 = g_zbasic->index(1, 0);
+ this->var_str_1070 = _zbasic->index(1, 0);
} else {
// 135:049a
- this->var_i16_1372 = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
- this->var_str_1070 = g_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
+ this->var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
+ this->var_str_1070 = _zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
}
// 135:04f2
this->sub_135_b16();
@@ -194,9 +194,9 @@ void FoolGame::sub_135_5b6() {
if (this->var_i16_484 != 0) {
return;
}
- g_zbasic->text(0, 0xc, 0, kSrcBic);
+ _zbasic->text(0, 0xc, 0, kSrcBic);
this->var_i16_7a2 = 0x124;
- this->sub_128_918(g_zbasic->str(219)); // click mouse to reset puzzle
+ this->sub_128_918(_zbasic->str(219)); // click mouse to reset puzzle
this->sub_128_6186();
this->var_i16_1abc = 1;
@@ -213,36 +213,36 @@ void FoolGame::sub_135_5b6() {
void FoolGame::sentenceAddLeft() {
// 135:07d6
- this->var_str_1070 = g_zbasic->index(1, this->var_i16_103a) + this->var_str_1070;
+ this->var_str_1070 = _zbasic->index(1, this->var_i16_103a) + this->var_str_1070;
}
void FoolGame::sentenceAddRight() {
// 135:07fa
- this->var_str_1070 += g_zbasic->index(1, this->var_i16_103a);
+ this->var_str_1070 += _zbasic->index(1, this->var_i16_103a);
}
void FoolGame::sub_135_81e() {
// 135:0813
- this->var_str_1070 = g_zbasic->index(1, this->var_i16_103a)
+ this->var_str_1070 = _zbasic->index(1, this->var_i16_103a)
+ this->var_str_1070
- + g_zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0]);
+ + _zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0]);
}
void FoolGame::sub_135_86a() {
// 135:086a
- this->var_i16_9f2 = g_zbasic->index(1, this->var_i16_103a).size();
+ this->var_i16_9f2 = _zbasic->index(1, this->var_i16_103a).size();
while (true) {
// 135:0884
this->var_i16_484 = this->var_str_1070.size();
- this->var_i16_1abe = g_zbasic->instr(1, this->var_str_1070, g_zbasic->index(1, this->var_i16_103a));
+ this->var_i16_1abe = _zbasic->instr(1, this->var_str_1070, _zbasic->index(1, this->var_i16_103a));
if (this->var_i16_1abe == 0)
return;
// 135:08bc
if ((this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2) < 0)
return;
- this->var_str_1070 = g_zbasic->leftStr(this->var_str_1070, this->var_i16_1abe - 1)
- + g_zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0])
- + g_zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2);
+ this->var_str_1070 = _zbasic->leftStr(this->var_str_1070, this->var_i16_1abe - 1)
+ + _zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0])
+ + _zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2);
}
// should never reach here
this->sub_135_94c();
@@ -253,7 +253,7 @@ void FoolGame::sub_135_94c() {
this->var_i16_484 = this->var_str_1070.size();
this->var_str_384.clear(); // was: str(220)
for (int16 i = this->var_i16_484; i >= 1; i--) {
- this->var_str_384 += g_zbasic->midStr(this->var_str_1070, i, 1);
+ this->var_str_384 += _zbasic->midStr(this->var_str_1070, i, 1);
}
this->var_str_1070 = this->var_str_384;
}
@@ -267,14 +267,14 @@ void FoolGame::sub_135_9ba() {
this->arr_i16_4338[this->var_i16_68a] = 1;
this->sub_135_a34();
}
- this->var_str_1070 = g_zbasic->index(1, 0);
+ this->var_str_1070 = _zbasic->index(1, 0);
this->sub_135_b16();
}
void FoolGame::sub_135_a34() {
// 135:0a34
- g_zbasic->text(0, 0xc, 0, kSrcOr);
- this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + g_zbasic->str(221);
+ _zbasic->text(0, 0xc, 0, kSrcOr);
+ this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + _zbasic->str(221);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->FillOval(_screenGrid[this->var_i16_68a], _patterns[0]);
g_toolbox->FrameOval(_screenGrid[this->var_i16_68a]);
@@ -284,7 +284,7 @@ void FoolGame::sub_135_a34() {
void FoolGame::sub_135_b16() {
// 135:0b16
- g_zbasic->text(0xfe, 0x18, 0, kSrcOr);
+ _zbasic->text(0xfe, 0x18, 0, kSrcOr);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1070);
if (this->var_i16_484 < this->arr_i16_1eb8[4]) {
this->var_i16_484 = this->arr_i16_1eb8[4];
@@ -310,13 +310,13 @@ void FoolGame::sub_135_c1c() {
// 135:0c44
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_4338[i]);
- this->var_str_384 = g_zbasic->rightStr(this->var_str_384, 1);
+ this->var_str_384 = _zbasic->rightStr(this->var_str_384, 1);
_activePuzzleBuffer += this->var_str_384;
}
// 135:0cba
Common::String temp = this->var_str_1070.encode(Common::kMacRoman);
this->var_i16_1372 = (int16)temp.size();
- _activePuzzleBuffer += g_zbasic->encodeInt(this->var_i16_1372) + temp;
+ _activePuzzleBuffer += _zbasic->encodeInt(this->var_i16_1372) + temp;
}
void FoolGame::sub_135_cee() {
@@ -325,7 +325,7 @@ void FoolGame::sub_135_cee() {
_activePuzzleStatus = 0x64;
this->var_i16_68a = 1;
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->sub_128_50e(g_zbasic->rndInt(1000) + 0x19, 0x28, 0);
+ this->sub_128_50e(_zbasic->rndInt(1000) + 0x19, 0x28, 0);
}
}
// 135:0d40
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index aae0d0a45ad..104f1ba8184 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -28,7 +28,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
void FoolGame::straightPathRun() {
@@ -50,8 +50,8 @@ void FoolGame::straightPathRun() {
var_i16_68a + arr_i16_1eb8[13] - 1,
var_i16_68c + arr_i16_1eb8[12] - 1
);
- } while (g_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
- } while (g_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
// 143:0128
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
@@ -65,14 +65,14 @@ void FoolGame::straightPathRun() {
for (int16 i = 1; i <= arr_i16_1eb8[15]; i++) {
var_i16_1a96 = puzzlesReadByte();
var_i16_1a98 = puzzlesReadByte();
- g_zbasic->indexRawSet(puzzlesReadString(), 1, i);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, i);
arr_i16_2f38[var_i16_1a96*32 + var_i16_1a98] = i;
- arr_i16_3b38[var_i16_1a96*32 + var_i16_1a98] = g_zbasic->asc(g_zbasic->leftStr(g_zbasic->index(1, i), 1));
- var_str_1272 += g_zbasic->index(1, i);
+ arr_i16_3b38[var_i16_1a96*32 + var_i16_1a98] = _zbasic->asc(_zbasic->leftStr(_zbasic->index(1, i), 1));
+ var_str_1272 += _zbasic->index(1, i);
// 143:0276
}
- g_zbasic->text(0xfb, arr_i16_1eb8[14], 0, kSrcOr);
- g_zbasic->unk_20();
+ _zbasic->text(0xfb, arr_i16_1eb8[14], 0, kSrcOr);
+ _zbasic->unk_20();
// 143:02b6
for (int16 j = 0; j <= arr_i16_1eb8[1]; j++) {
Common::Rect temp;
@@ -85,14 +85,14 @@ void FoolGame::straightPathRun() {
var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
if (arr_i16_3b38[i*32 + j] == 0) {
// 143:03c4
- arr_i16_3b38[i*32 + j] = g_zbasic->rndInt(0x1a) + 0x40;
+ arr_i16_3b38[i*32 + j] = _zbasic->rndInt(0x1a) + 0x40;
}
// 143:03f0
g_toolbox->MoveTo(
_screenGrid[var_i16_1574].left + arr_i16_1eb8[2] - 1,
_screenGrid[var_i16_1574].top + arr_i16_1eb8[3]
);
- var_str_384 = g_zbasic->chr(arr_i16_3b38[i*32 + j]);
+ var_str_384 = _zbasic->chr(arr_i16_3b38[i*32 + j]);
g_toolbox->DrawString(var_str_384);
}
}
@@ -144,10 +144,10 @@ void FoolGame::straightPathOnClick() {
// 143:066c
_activePuzzleStatus++;
if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] != _activePuzzleStatus) {
- _activePuzzleBuffer += g_zbasic->chr(arr_i16_3b38[var_i16_68a*32 + var_i16_68c]);
+ _activePuzzleBuffer += _zbasic->chr(arr_i16_3b38[var_i16_68a*32 + var_i16_68c]);
} else {
// 143:06d8
- _activePuzzleBuffer += g_zbasic->indexRaw(1, _activePuzzleStatus);
+ _activePuzzleBuffer += _zbasic->indexRaw(1, _activePuzzleStatus);
}
// 143:06fa
straightPathDrawText();
@@ -171,9 +171,9 @@ void FoolGame::straightPathReset() {
}
// 143:07a4
for (int16 i = 0; i <= 0x14; i++) {
- var_i16_1574 = g_zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
+ var_i16_1574 = _zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
- sub_128_50e(g_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
+ sub_128_50e(_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
// 143:0812
g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
@@ -187,7 +187,7 @@ void FoolGame::straightPathReset() {
void FoolGame::straightPathDrawText() {
// 143:0864
straightPathClearText();
- g_zbasic->text(0xfe, 0x18, 0x18, kSrcBic);
+ _zbasic->text(0xfe, 0x18, 0x18, kSrcBic);
var_i16_7a2 = 0x148;
sub_128_918(_activePuzzleBuffer);
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 51bcc351fd0..3708fca08c3 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// The Sun's map
@@ -78,11 +78,11 @@ void FoolGame::sunMapRun() {
// 137:02a2
this->fillRect(0x14, 0x67, 0x156, 0x1b1, 2);
for (int i = 1; i <= 0x51; i++) {
- g_zbasic->picture(_screenGrid[i].left, _screenGrid[i].top, this->arr_i32_192c0[_sunMapTileID[i]]);
+ _zbasic->picture(_screenGrid[i].left, _screenGrid[i].top, this->arr_i32_192c0[_sunMapTileID[i]]);
}
// 137:0336
_stateFlags = kStateNull;
- g_zbasic->menu(8, 3, 0, Common::U32String());
+ _zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->InitCursor();
this->sunMapCheckIfSolved();
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
@@ -115,13 +115,13 @@ void FoolGame::sunMapRun() {
_activePuzzle = 0;
_activePuzzleStatus = 0x64;
_sunMapRestored = 1;
- g_zbasic->menu(2, 7, 1, Common::U32String());
+ _zbasic->menu(2, 7, 1, Common::U32String());
for (int i = 1; i <= 0x50; i++) {
_puzzleFlags[i] = kFlagMenuEnabled;
}
for (int j = 3; j <= 7; j++) {
for (int i = 1; i <= 0x10; i++) {
- g_zbasic->menu(j, i, 1, Common::U32String());
+ _zbasic->menu(j, i, 1, Common::U32String());
}
}
}
@@ -135,7 +135,7 @@ void FoolGame::sunMapOnClick() {
}
// 137:0466
_menuDisabled = true;
- g_zbasic->menu(8, 3, 0, Common::U32String());
+ _zbasic->menu(8, 3, 0, Common::U32String());
g_toolbox->PenNormal();
g_toolbox->PenSize(3, 3);
g_toolbox->PenMode(kPatXor);
@@ -155,7 +155,7 @@ void FoolGame::sunMapOnClick() {
this->sunMapDropSelected();
this->sunMapCheckIfSolved();
this->sub_128_6186();
- g_zbasic->menu(8, 3, 1, Common::U32String());
+ _zbasic->menu(8, 3, 1, Common::U32String());
_menuDisabled = false;
}
@@ -254,10 +254,10 @@ void FoolGame::sunMapMoveSelected() {
void FoolGame::sunMapUndoMove() {
// 137:0d60
_stateFlags = kStateNull;
- g_zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
- g_zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
- g_zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
- g_zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
+ _zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
+ _zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
+ _zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
+ _zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
this->sunMapDropSelected();
}
@@ -285,7 +285,7 @@ void FoolGame::sunMapDropSelected() {
}
// 137:0f7c
_sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
- g_zbasic->picture(
+ _zbasic->picture(
_screenGrid[this->arr_i16_2f38[i*32 + j]].left,
_screenGrid[this->arr_i16_2f38[i*32 + j]].top,
this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
@@ -299,7 +299,7 @@ void FoolGame::sunMapDropSelected() {
// 137:1114
this->var_i16_1aa6++;
_sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
- g_zbasic->picture(
+ _zbasic->picture(
_screenGrid[this->arr_i16_2f38[i*32 + j]].left,
_screenGrid[this->arr_i16_2f38[i*32 + j]].top,
this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
@@ -363,7 +363,7 @@ void FoolGame::sunMapRevealPiece() {
this->sub_128_3da(1);
}
// 137:1550
- g_zbasic->picture(
+ _zbasic->picture(
_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left,
_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 26c341f7e70..ba1de99841b 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// high priestess challenge
@@ -72,8 +72,8 @@ void FoolGame::highPriestessRun() {
// is the humbug marked with the wadjet eye? if so, unmark
// 140:00ce
_puzzleCompletionStatus[0x17] = 0x64;
- this->var_str_384 = _puzzleName[0x17] + g_zbasic->str(301); // ' '
- g_zbasic->menu(0x4, 0x7, 0x1, this->var_str_384);
+ this->var_str_384 = _puzzleName[0x17] + _zbasic->str(301); // ' '
+ _zbasic->menu(0x4, 0x7, 0x1, this->var_str_384);
}
}
// 140:0116
@@ -86,8 +86,8 @@ void FoolGame::highPriestessRun() {
if (_puzzleCompletionStatus[0x3f] == 0x63) {
// is justice marked with the wadjet eye? if so, unmark
_puzzleCompletionStatus[0x3f] = 0x64;
- this->var_str_384 = _puzzleName[0x3f] + g_zbasic->str(302); // ' '
- g_zbasic->menu(6, 0xf, 1, this->var_str_384);
+ this->var_str_384 = _puzzleName[0x3f] + _zbasic->str(302); // ' '
+ _zbasic->menu(6, 0xf, 1, this->var_str_384);
}
}
// 140:019c
@@ -103,8 +103,8 @@ void FoolGame::highPriestessRun() {
if (_puzzleCompletionStatus[0x48] == 0x63) {
// is the hermit marked with the wadjet eye? if so, unmark
_puzzleCompletionStatus[0x48] = 0x64;
- this->var_str_384 = _puzzleName[0x48] + g_zbasic->str(303);
- g_zbasic->menu(7, 8, 1, this->var_str_384);
+ this->var_str_384 = _puzzleName[0x48] + _zbasic->str(303);
+ _zbasic->menu(7, 8, 1, this->var_str_384);
}
}
// 140:024c
@@ -112,7 +112,7 @@ void FoolGame::highPriestessRun() {
// show the fake puzzle picture
g_toolbox->PenNormal();
this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
- g_zbasic->picture(0, 0, this->arr_i32_192c0[0]);
+ _zbasic->picture(0, 0, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
this->sub_128_61c2();
}
@@ -125,8 +125,8 @@ void FoolGame::highPriestessRun() {
// 140:02b4
this->var_i16_68a = 1;
for (int16 i = 1; i <= 0x155; i++) {
- g_zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
- g_zbasic->put(g_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kSrcCopy);
+ _zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
+ _zbasic->put(_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kSrcCopy);
if (i % 2 == 0) {
g_toolbox->Delay(0);
}
@@ -151,20 +151,20 @@ void FoolGame::highPriestessRun() {
if (i > 0xf0) {
this->var_i16_484 += 3;
}
- g_toolbox->MoveTo(this->var_i16_484 + 0x5f - g_zbasic->rndInt(0x32), i);
- g_toolbox->LineTo(0x1a1 - this->var_i16_484 + g_zbasic->rndInt(0x32), i);
+ g_toolbox->MoveTo(this->var_i16_484 + 0x5f - _zbasic->rndInt(0x32), i);
+ g_toolbox->LineTo(0x1a1 - this->var_i16_484 + _zbasic->rndInt(0x32), i);
if (i % 2 == 0) {
g_toolbox->Delay(0);
}
}
// 140:03f0
- g_zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
+ _zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
this->var_i16_7a2 = 0x96;
- this->sub_128_918(g_zbasic->str(304)); // you cannot claim
+ this->sub_128_918(_zbasic->str(304)); // you cannot claim
this->var_i16_7a2 = 0xb9;
- this->sub_128_918(g_zbasic->str(305)); // the book of thoth
+ this->sub_128_918(_zbasic->str(305)); // the book of thoth
this->var_i16_7a2 = 0xdc;
- this->sub_128_918(g_zbasic->str(306)); // so easily
+ this->sub_128_918(_zbasic->str(306)); // so easily
g_toolbox->SetPort(this->var_i32_0);
this->sub_128_61c2();
}
@@ -180,18 +180,18 @@ void FoolGame::thoth99Enchantments() {
if (_activePuzzleBuffer.empty()) { // was: str(307)
this->arr_i16_1eb8[0] = 0x63;
} else {
- this->arr_i16_1eb8[0] = g_zbasic->decodeInt(_activePuzzleBuffer);
+ this->arr_i16_1eb8[0] = _zbasic->decodeInt(_activePuzzleBuffer);
}
// 140:04a2
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
if (this->arr_i16_1eb8[0] == 0x63) {
- g_zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
+ _zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
this->var_i16_7a2 = 0xaf;
- this->sub_128_918(g_zbasic->str(308)); // you dare to challenge
+ this->sub_128_918(_zbasic->str(308)); // you dare to challenge
this->var_i16_7a2 = 0xd2;
- this->sub_128_918(g_zbasic->str(309)); // the high priestess
+ this->sub_128_918(_zbasic->str(309)); // the high priestess
this->sub_128_3da(0xb4);
}
// 140:0532
@@ -202,7 +202,7 @@ void FoolGame::thoth99Enchantments() {
_screenGrid[i].right = _screenGrid[i].left + 0x28;
}
// 140:060c
- g_zbasic->picture(0, 0x14, this->var_pic_7c2);
+ _zbasic->picture(0, 0x14, this->var_pic_7c2);
this->copyScreen(0, this->arr_bmp_b3ec);
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
g_toolbox->PenSize(5, 5);
@@ -226,7 +226,7 @@ void FoolGame::thoth99Enchantments() {
this->arr_i16_4758[6] = SCREEN_HEIGHT;
this->arr_i16_4758[7] = SCREEN_WIDTH;
this->arr_i16_1eb8[1] = 0;
- g_zbasic->unk_20();
+ _zbasic->unk_20();
this->sub_128_4da(1);
_stateFlags = kStateNull;
_activePuzzleSolved = false;
@@ -264,7 +264,7 @@ void FoolGame::thoth99Enchantments() {
this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0];
} else {
// 140:0826
- this->arr_i16_1eb8[2] = g_zbasic->rndInt(this->arr_i16_1eb8[0]);
+ this->arr_i16_1eb8[2] = _zbasic->rndInt(this->arr_i16_1eb8[0]);
}
// 140:084a
this->thothDrawEnchantment();
@@ -309,7 +309,7 @@ void FoolGame::thoth99Enchantments() {
if (this->arr_i16_1eb8[0] < 1) {
this->arr_i16_1eb8[0] = 1;
}
- _activePuzzleBuffer = g_zbasic->encodeInt(this->arr_i16_1eb8[0]);
+ _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[0]);
}
// 140:09ee
}
@@ -317,8 +317,8 @@ void FoolGame::thoth99Enchantments() {
void FoolGame::thothMoveEnchantment() {
// 140:09f0
g_toolbox->FillRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14, _patterns[2]);
- _screenGrid[this->arr_i16_1eb8[2]].top = g_zbasic->rndInt(0x11a) + 0x14;
- _screenGrid[this->arr_i16_1eb8[2]].left = g_zbasic->rndInt(0x1da);
+ _screenGrid[this->arr_i16_1eb8[2]].top = _zbasic->rndInt(0x11a) + 0x14;
+ _screenGrid[this->arr_i16_1eb8[2]].left = _zbasic->rndInt(0x1da);
_screenGrid[this->arr_i16_1eb8[2]].bottom = _screenGrid[this->arr_i16_1eb8[2]].top + 0x28;
_screenGrid[this->arr_i16_1eb8[2]].right = _screenGrid[this->arr_i16_1eb8[2]].left + 0x28;
this->thothDrawEnchantment();
@@ -329,7 +329,7 @@ void FoolGame::thothDrawEnchantment() {
g_toolbox->PenNormal();
g_toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
g_toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
- g_zbasic->text(0, 0xc, 0, kSrcOr);
+ _zbasic->text(0, 0xc, 0, kSrcOr);
this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(311)
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
// 140:0bd2
@@ -391,19 +391,19 @@ void FoolGame::thothScrambleScreen() {
void FoolGame::sub_140_e3c() {
// 140:0e3c
if (this->arr_i16_1eb8[0] == 1) {
- g_zbasic->menu(8, 0, 1, g_zbasic->str(312)); // the last enchantment
- g_zbasic->menu(8, 1, 1, g_zbasic->str(313)); // run for your life
+ _zbasic->menu(8, 0, 1, _zbasic->str(312)); // the last enchantment
+ _zbasic->menu(8, 1, 1, _zbasic->str(313)); // run for your life
} else {
// 140:0e8a
this->var_str_384 = Common::U32String::format(" %d", this->arr_i16_1eb8[0]);
- this->var_str_9f4 = g_zbasic->str(314) + this->var_str_384 + g_zbasic->str(315); // the X enchantments
- g_zbasic->menu(8, 0, 1, this->var_str_9f4);
- g_zbasic->menu(8, 1, 1, g_zbasic->str(316)); // run for your life
- g_zbasic->menu(8, 2, 1, g_zbasic->str(317)); // -
- g_zbasic->menu(8, 3, 1, g_zbasic->str(318)); // or press each button
- g_zbasic->menu(8, 4, 1, g_zbasic->str(319)); // in descending order
- this->var_str_9f4 = g_zbasic->str(320) + this->var_str_384 + g_zbasic->str(321); // from X to 1
- g_zbasic->menu(8, 5, 1, this->var_str_9f4);
+ this->var_str_9f4 = _zbasic->str(314) + this->var_str_384 + _zbasic->str(315); // the X enchantments
+ _zbasic->menu(8, 0, 1, this->var_str_9f4);
+ _zbasic->menu(8, 1, 1, _zbasic->str(316)); // run for your life
+ _zbasic->menu(8, 2, 1, _zbasic->str(317)); // -
+ _zbasic->menu(8, 3, 1, _zbasic->str(318)); // or press each button
+ _zbasic->menu(8, 4, 1, _zbasic->str(319)); // in descending order
+ this->var_str_9f4 = _zbasic->str(320) + this->var_str_384 + _zbasic->str(321); // from X to 1
+ _zbasic->menu(8, 5, 1, this->var_str_9f4);
}
// 140:0f82
return;
@@ -449,7 +449,7 @@ void FoolGame::sub_140_f84() {
void FoolGame::thothKey1st() {
// 140:12fc
this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
- g_zbasic->picture(0, 0x14, this->var_pic_7c2);
+ _zbasic->picture(0, 0x14, this->var_pic_7c2);
if ((this->var_i16_7ce & 2) != 0) {
g_toolbox->SetCursor(_cursors[0x10]);
}
@@ -481,7 +481,7 @@ void FoolGame::thothKey1st() {
_activePuzzleSolved = false;
} else {
// 140:1446
- this->var_str_384 = g_zbasic->str(322); // behold ye the book of thoth
+ this->var_str_384 = _zbasic->str(322); // behold ye the book of thoth
this->sub_128_178a(0, 0);
this->sub_140_2f92();
this->var_i16_7ce ^= 2;
@@ -926,9 +926,9 @@ void FoolGame::thothKeyLast() {
this->copyScreen(1, this->arr_bmp_b3ec);
} else { // we're in the high priestess, show nothing but random filled squares
// 140:21fe
- this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
- this->var_i16_68a = g_zbasic->rndInt(0x14) - 1;
- this->var_i16_68c = g_zbasic->rndInt(0xe) - 1;
+ this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
+ this->var_i16_68a = _zbasic->rndInt(0x14) - 1;
+ this->var_i16_68c = _zbasic->rndInt(0xe) - 1;
// 140:2222
g_toolbox->FillRect(_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], _patterns[this->var_i16_484]);
this->getNextEvent(-1);
@@ -983,7 +983,7 @@ void FoolGame::thothBadSelect() {
while ((_event.modifiers & kModMouseButtonUp) == 0) {
// 140:24c4
this->getNextEvent(-1);
- this->var_i16_484 = g_zbasic->rndInt(0x50);
+ this->var_i16_484 = _zbasic->rndInt(0x50);
g_toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[this->var_i16_484]);
}
// 140:2520
@@ -991,7 +991,7 @@ void FoolGame::thothBadSelect() {
this->copyScreen(1, this->arr_bmp_b3ec);
} else {
for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[_hermitPathStage]; i--) {
- this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
+ this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
g_toolbox->FillRect(_screenGrid[this->arr_i16_3738[i]], _patterns[this->var_i16_484]);
}
}
@@ -1080,7 +1080,7 @@ void FoolGame::hermitScreenBehold() {
} else {
// 140:290c
this->zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
- this->var_str_384 = g_zbasic->str(323); // behold the last key of thoth
+ this->var_str_384 = _zbasic->str(323); // behold the last key of thoth
this->sub_128_178a(0x48, 2);
}
// 140:2966
@@ -1178,8 +1178,8 @@ void FoolGame::thothKeyLastSetup() {
this->var_i16_68c + this->arr_i16_1eb8[0xc]
);
// 140:2ce4
- } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
- } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
// 140:2d46
this->var_i16_484 = 0;
@@ -1204,7 +1204,7 @@ void FoolGame::thothKeyLastSetup() {
this->var_i16_68a = k;
for (int16 j = 0; j <= 0xd; j++) {
// 140:2e8c
- this->var_i16_484 = g_zbasic->rndInt(0x4e) + 2;
+ this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
g_toolbox->FillRect(
_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
_patterns[this->var_i16_484]
@@ -1219,28 +1219,28 @@ void FoolGame::thothKeyLastSetup() {
}
// 140:2f2e
if ((_hermitPathStage == 6) && (_activePuzzle != 0x34)) {
- g_zbasic->menu(8, 0, 1, g_zbasic->str(324)); // the last key of thoth
- g_zbasic->menu(8, 1, 1, g_zbasic->str(325)); // return to scroll
+ _zbasic->menu(8, 0, 1, _zbasic->str(324)); // the last key of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(325)); // return to scroll
}
this->copyScreen(0, this->arr_bmp_b3ec);
}
void FoolGame::sub_140_2f92() {
// 140:2f92
- g_zbasic->menu(8, 0, 1, g_zbasic->str(326)); // the book of thoth
- g_zbasic->menu(8, 1, 1, g_zbasic->str(327)); // return to scroll
- g_zbasic->menu(8, 2, 0, g_zbasic->str(328)); // -
- g_zbasic->menu(8, 3, 1, g_zbasic->str(329)); // be forewarned
- g_zbasic->menu(8, 4, 1, g_zbasic->str(330)); // the high priestess has corrupted
- g_zbasic->menu(8, 5, 1, g_zbasic->str(331)); // the book of thoth. you may need
- g_zbasic->menu(8, 6, 1, g_zbasic->str(332)); // the help of others to unlock its
- g_zbasic->menu(8, 7, 1, g_zbasic->str(333)); // secrets.
+ _zbasic->menu(8, 0, 1, _zbasic->str(326)); // the book of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(327)); // return to scroll
+ _zbasic->menu(8, 2, 0, _zbasic->str(328)); // -
+ _zbasic->menu(8, 3, 1, _zbasic->str(329)); // be forewarned
+ _zbasic->menu(8, 4, 1, _zbasic->str(330)); // the high priestess has corrupted
+ _zbasic->menu(8, 5, 1, _zbasic->str(331)); // the book of thoth. you may need
+ _zbasic->menu(8, 6, 1, _zbasic->str(332)); // the help of others to unlock its
+ _zbasic->menu(8, 7, 1, _zbasic->str(333)); // secrets.
}
Common::Rect FoolGame::thothRandomSquare() {
// 140:3050
- int16 x = g_zbasic->rndInt(0x19c);
- int16 y = 0x14 + g_zbasic->rndInt(0xde);
+ int16 x = _zbasic->rndInt(0x19c);
+ int16 y = 0x14 + _zbasic->rndInt(0xde);
return Common::Rect(
x,
y,
@@ -1251,22 +1251,22 @@ Common::Rect FoolGame::thothRandomSquare() {
Common::Rect FoolGame::thothRandomHRect() {
// 140:30da
- int16 y = 0x14 + g_zbasic->rndInt(0xde);
+ int16 y = 0x14 + _zbasic->rndInt(0xde);
return Common::Rect(
0,
y,
SCREEN_WIDTH,
- y + g_zbasic->rndInt(0x64)
+ y + _zbasic->rndInt(0x64)
);
}
Common::Rect FoolGame::thothRandomVRect() {
// 140:3148
- int16 x = g_zbasic->rndInt(0x19c);
+ int16 x = _zbasic->rndInt(0x19c);
return Common::Rect(
x,
0x14,
- x + g_zbasic->rndInt(0x64),
+ x + _zbasic->rndInt(0x64),
SCREEN_HEIGHT
);
}
@@ -1287,8 +1287,8 @@ void FoolGame::sub_140_32ac() {
g_toolbox->PenNormal();
for (int16 j = 0; j <= 0x22; j++) {
for (int16 i = -5; i <= 0x159; i += 0xa) {
- g_toolbox->MoveTo(0, g_zbasic->rndInt(0xa) + i);
- g_toolbox->LineTo(SCREEN_WIDTH, g_zbasic->rndInt(0xa) + i);
+ g_toolbox->MoveTo(0, _zbasic->rndInt(0xa) + i);
+ g_toolbox->LineTo(SCREEN_WIDTH, _zbasic->rndInt(0xa) + i);
}
}
// 140:3300
@@ -1309,9 +1309,9 @@ void FoolGame::thothAdjustPuzzleData() {
// change puzzle data pointer to use high priestess data
this->var_i16_484 = (_puzzleDataOffsets[0x34] - 1) / 1000;
this->var_i16_7e4 = (_puzzleDataOffsets[0x34] - 1) % 1000;
- g_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
+ _zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
//this->var_bytes_696 = this->arr_bytes_109dc;
- this->var_bytes_696 = g_zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
+ this->var_bytes_696 = _zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
this->var_ptr_696 = 0;
this->var_bytes_232a = this->var_bytes_696;
this->var_ptr_232a = this->var_ptr_696;
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 83b50c66363..a02e6f493c1 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -27,7 +27,7 @@
namespace Fool {
-extern ZBasic *g_zbasic;
+;
extern Toolbox *g_toolbox;
// word search game
@@ -53,8 +53,8 @@ void FoolGame::wordSearchRun() {
this->var_i16_68c + this->arr_i16_1eb8[0xc] - 1
);
// 131:00d4
- } while (g_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
- } while (g_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
// 131:0134
this->var_i16_484 = 0;
@@ -69,12 +69,12 @@ void FoolGame::wordSearchRun() {
// total hidden word count
this->var_i16_198e = puzzlesReadShort();
if (_activePuzzleBuffer.empty()) { // was: str(191)
- _activePuzzleBuffer = g_zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
+ _activePuzzleBuffer = _zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
} else {
// 131:01f2
- this->arr_i16_4758[0] = g_zbasic->decodeInt(g_zbasic->midStr(_activePuzzleBuffer, this->var_i16_198e + 1, 2));
+ this->arr_i16_4758[0] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_198e + 1, 2));
for (int i = 1; i <= this->arr_i16_4758[0]; i++) {
- this->arr_i16_4758[i] = g_zbasic->decodeInt(g_zbasic->midStr(
+ this->arr_i16_4758[i] = _zbasic->decodeInt(_zbasic->midStr(
_activePuzzleBuffer,
this->var_i16_198e + 1 + i*2,
2
@@ -107,7 +107,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_1990 = 0;
this->var_i16_68a = 1;
for (int i = 1; i <= this->var_i16_198e; i++) {
- this->arr_i16_3738[i] = g_zbasic->castInt(g_zbasic->midStr(_activePuzzleBuffer, i, 1));
+ this->arr_i16_3738[i] = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, i, 1));
if (this->arr_i16_3738[i] != 0) {
this->var_i16_1990++;
}
@@ -116,22 +116,22 @@ void FoolGame::wordSearchRun() {
// 131:039e
this->var_i16_1992 = 1;
do {
- g_zbasic->indexSet(puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
- g_zbasic->indexSet(g_zbasic->str(192), 1, this->var_i16_1992); // blank string
+ _zbasic->indexSet(puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
+ _zbasic->indexSet(_zbasic->str(192), 1, this->var_i16_1992); // blank string
this->var_i16_484 = 1;
do {
- this->var_str_384 = g_zbasic->midStr(
- g_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e),
+ this->var_str_384 = _zbasic->midStr(
+ _zbasic->index(1, this->var_i16_1992 + this->var_i16_198e),
this->var_i16_484,
1
);
// 131:0418
- if (this->var_str_384 != g_zbasic->str(193)) { // string
- g_zbasic->indexSet(g_zbasic->index(1, this->var_i16_1992) + this->var_str_384, 1, this->var_i16_1992);
+ if (this->var_str_384 != _zbasic->str(193)) { // string
+ _zbasic->indexSet(_zbasic->index(1, this->var_i16_1992) + this->var_str_384, 1, this->var_i16_1992);
}
// 131:045c
this->var_i16_484++;
- } while ((int16)(g_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e).size()) >= this->var_i16_484);
+ } while ((int16)(_zbasic->index(1, this->var_i16_1992 + this->var_i16_198e).size()) >= this->var_i16_484);
// 131:0480
this->var_i16_1992++;
@@ -141,10 +141,10 @@ void FoolGame::wordSearchRun() {
g_toolbox->PenNormal();
this->var_str_384 = this->var_str_188e;
this->wordSearchDrawFooter();
- g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenMode(kPatBic);
- g_zbasic->unk_20();
+ _zbasic->unk_20();
// 131:04e0
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
this->var_str_1994 = puzzlesReadString().decode(Common::kMacRoman);
@@ -159,8 +159,8 @@ void FoolGame::wordSearchRun() {
// 131:05b0
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->var_i16_1574 = i + (j - 1) * this->arr_i16_1eb8[0];
- this->var_str_384 = g_zbasic->midStr(this->var_str_1994, i, 1);
- this->arr_i16_3b38[i*32 + j] = g_zbasic->asc(this->var_str_384);
+ this->var_str_384 = _zbasic->midStr(this->var_str_1994, i, 1);
+ this->arr_i16_3b38[i*32 + j] = _zbasic->asc(this->var_str_384);
g_toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
@@ -179,21 +179,21 @@ void FoolGame::wordSearchRun() {
g_toolbox->PenNormal();
if ((this->var_i16_1990 > 0) && (this->var_i16_1990 < this->var_i16_198e)) {
// only X to go
- this->var_str_384 = g_zbasic->str(194) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + g_zbasic->str(195);
+ this->var_str_384 = _zbasic->str(194) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(195);
this->wordSearchDrawFooter();
}
// 131:077a
this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_198e);
if (_activePuzzle != 0x50) {
// There are X words hidden below
- this->var_str_384 = g_zbasic->str(196) + this->var_str_9f4 + g_zbasic->str(197);
- g_zbasic->menu(8, 3, 1, this->var_str_384);
- g_zbasic->menu(8, 4, 1, g_zbasic->str(198));
+ this->var_str_384 = _zbasic->str(196) + this->var_str_9f4 + _zbasic->str(197);
+ _zbasic->menu(8, 3, 1, this->var_str_384);
+ _zbasic->menu(8, 4, 1, _zbasic->str(198));
} else {
// 131:07f8
- this->var_str_384 = g_zbasic->str(199) + this->var_str_9f4 + g_zbasic->str(200);
- g_zbasic->menu(8, 3, 1, this->var_str_384);
- g_zbasic->menu(8, 4, 1, g_zbasic->str(201));
+ this->var_str_384 = _zbasic->str(199) + this->var_str_9f4 + _zbasic->str(200);
+ _zbasic->menu(8, 3, 1, this->var_str_384);
+ _zbasic->menu(8, 4, 1, _zbasic->str(201));
}
// 131:084c
_stateFlags = kStateNull;
@@ -220,7 +220,7 @@ void FoolGame::wordSearchRun() {
void FoolGame::wordSearchOnClick() {
// 131:08aa
this->var_i16_1a94 = 0; // length of word selected
- this->var_str_1070 = g_zbasic->str(202); // blank
+ this->var_str_1070 = _zbasic->str(202); // blank
this->var_i16_1a96 = -1;
this->var_i16_1a98 = -1;
@@ -234,7 +234,7 @@ void FoolGame::wordSearchOnClick() {
this->var_i16_1574 = this->var_i16_68a + (this->var_i16_68c - 1)*this->arr_i16_1eb8[0];
this->var_i16_1a96 = this->var_i16_68a;
this->var_i16_1a98 = this->var_i16_68c;
- this->var_str_1070 += g_zbasic->chr(this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]);
+ this->var_str_1070 += _zbasic->chr(this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]);
g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
this->var_i16_1a94++;
// 131:09c4
@@ -266,7 +266,7 @@ void FoolGame::wordSearchOnClick() {
// 131:0aa0
// check selected string against the remaining word list
for (int i = 1; i <= this->var_i16_198e; i++) {
- if ((this->var_str_1070 == g_zbasic->index(1, i)) && (this->arr_i16_3738[i] == 0)) {
+ if ((this->var_str_1070 == _zbasic->index(1, i)) && (this->arr_i16_3738[i] == 0)) {
// 131:0ae0
this->var_i16_1a9a = i;
this->arr_i16_3738[i] = 1;
@@ -284,7 +284,7 @@ void FoolGame::wordSearchOnClick() {
// for every letter in the word
for (int i = 1; i <= this->var_i16_1a94; i++) {
// play a tone
- this->sub_128_50e(0xa + g_zbasic->rndInt(0x3e8), 0x28, 1);
+ this->sub_128_50e(0xa + _zbasic->rndInt(0x3e8), 0x28, 1);
// 131:0b54
// remove the inverted square
g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
@@ -300,12 +300,12 @@ void FoolGame::wordSearchOnClick() {
g_toolbox->PenNormal();
this->var_i16_1990++;
if (this->var_i16_1990 == this->var_i16_198e) {
- this->var_str_384 = g_zbasic->str(203); // blank
+ this->var_str_384 = _zbasic->str(203); // blank
this->wordSearchDrawFooter();
return;
}
// 131:0c64
- this->var_str_384 = g_zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + g_zbasic->str(204) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + g_zbasic->str(205); // WORD... only X to go
+ this->var_str_384 = _zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + _zbasic->str(204) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(205); // WORD... only X to go
this->wordSearchDrawFooter();
this->sub_128_6186();
}
@@ -328,17 +328,17 @@ void FoolGame::wordSearchBadSelect() {
void FoolGame::wordSearchDrawFooter() {
// 131:0d22
this->fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- g_zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(0xfa, 0xc, 0, kSrcBic);
this->var_i16_7a2 = 0x152;
this->sub_128_918(this->var_str_384);
}
void FoolGame::wordSearchStoreState() {
// 131:0d66
- _activePuzzleBuffer = g_zbasic->str(206); // empty
+ _activePuzzleBuffer = _zbasic->str(206); // empty
for (int i = 1; i <= this->var_i16_198e; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_3738[i]);
- _activePuzzleBuffer += g_zbasic->rightStr(this->var_str_384, 1);
+ _activePuzzleBuffer += _zbasic->rightStr(this->var_str_384, 1);
}
// 131:0dd6
this->var_i16_484 = 0;
@@ -365,7 +365,7 @@ void FoolGame::wordSearchStoreState() {
debugC(5, kDebugLoading, "wordSearchStoreState:");
for (int i = 0; i <= this->arr_i16_4758[0]; i++) {
debugCN(5, kDebugLoading, "%04x ", this->arr_i16_4758[i]);
- _activePuzzleBuffer += g_zbasic->encodeInt(this->arr_i16_4758[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_4758[i]);
}
}
@@ -376,7 +376,7 @@ void FoolGame::wordSearchSuccess() {
}
// 131:0f52
this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
- g_zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
+ _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
if (this->arr_i16_2f38[i*32 + j] != 0) {
@@ -388,7 +388,7 @@ void FoolGame::wordSearchSuccess() {
_screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
// 131:107a
- this->var_str_384 = g_zbasic->chr(this->arr_i16_3b38[i*32 + j]);
+ this->var_str_384 = _zbasic->chr(this->arr_i16_3b38[i*32 + j]);
g_toolbox->DrawString(this->var_str_384);
}
// 131:10b0
Commit: 1df8eb89b6c493a5358de5c0ea29826af66fadc1
https://github.com/scummvm/scummvm/commit/1df8eb89b6c493a5358de5c0ea29826af66fadc1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:27+02:00
Commit Message:
FOOL: Fix Maze of Thorns sound bug
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index f22cfb332ee..8eb5265f8d6 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -213,13 +213,13 @@ void FoolGame::cardsOnClick() {
return;
// 139:0778
// player clicked the yield button (bad choice)
- this->sub_128_50e(0x19, 0x64, 0x0);
+ this->playTone(0x19, 0x64, 0x0);
this->var_i16_2012 = -CARDS_YIELD_PENALTY;
this->cardsDrawScores();
this->var_i16_2014 = 1;
} else {
// 139:079e
- this->sub_128_50e(0xf, 0x64, 0x1);
+ this->playTone(0xf, 0x64, 0x1);
for (int j = 0; j <= 1; j++) {
for (int16 i = 0; i <= 0x3; i++) {
this->drawTarotCard(i, 0, 3);
@@ -384,7 +384,7 @@ void FoolGame::sub_139_a22() {
void FoolGame::cardsOpponentYields() {
// 139:0da8
// ol' mate gives up
- this->sub_128_50e(0x19, 0x64, 0x1);
+ this->playTone(0x19, 0x64, 0x1);
this->var_i16_2012 = -CARDS_YIELD_PENALTY;
this->cardsDrawScores();
_zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index a5710ba0c66..f3a0963f33a 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -401,7 +401,7 @@ void FoolGame::sub_128_4da(int16 unk1) {
this->var_i16_7a0 = unk1;
}
-void FoolGame::sub_128_50e(int16 freq, int16 duration, int16 wait) {
+void FoolGame::playTone(int16 freq, int16 duration, int16 wait) {
// 128:050e
// audio tone
this->var_i16_34 = wait;
@@ -639,7 +639,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->InitCursor();
this->sub_128_4da(1);
if (this->var_i16_7b0 != 0) {
- this->sub_128_50e(0x19, 0x64, 0);
+ this->playTone(0x19, 0x64, 0);
}
// 128:0e46
this->copyScreen(0, this->arr_bmp_138bc);
@@ -2338,7 +2338,7 @@ void FoolGame::shipsRun() {
// 128:5396
if (_activePuzzleSolved) {
this->sub_128_6186();
- this->sub_128_50e(0x14, 0x64, 0);
+ this->playTone(0x14, 0x64, 0);
_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
_event.where.x += 5;
_event.where.y -= 5;
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 6a6dd09f049..7373dfd70a1 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -74,7 +74,7 @@ public:
int32 puzzlesReadLong(); // sub_128_462
Common::String puzzlesReadString(); // sub_128_49a
void sub_128_4da(int16 unk1);
- void sub_128_50e(int16 freq, int16 duration, int16 wait);
+ void playTone(int16 freq, int16 duration, int16 wait);
void sub_128_55c(const Common::U32String &unk1);
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
@@ -268,20 +268,20 @@ public:
void mazeHiddenDoorShut(); // sub_136_17a4
void sub_136_1806();
void sub_136_185a();
- void sub_136_1898();
+ void mazeThornsClearTrigger(); // sub_136_1898
void sub_136_18f4();
void sub_136_1932();
void sub_136_19d2();
void sub_136_1cf4();
void sub_136_1ddc();
void sub_136_1df4();
- void sub_136_1e4c();
+ void mazeThornsGetScroll(); // sub_136_1e4c
void sub_136_21fa();
void sub_136_2200();
void mazeMovementTrail(); // sub_136_2208
void sub_136_24ae();
- void sub_136_2538();
+ void mazePlayTone(); // sub_136_2538
void sub_136_2582();
void mazeDrawPlayer(); // sub_136_2664
@@ -653,7 +653,7 @@ private:
SourceMode var_src_1dee;
int16 var_i16_1df2;
- int16 var_i16_1df4;
+ int16 mazeToneFreq; // var_i16_1df4
int16 var_i16_1df6;
int16 var_i16_1df8;
int16 var_i16_1dfa;
@@ -661,7 +661,7 @@ private:
int16 var_i16_1dfe;
int16 var_i16_1e00;
- int16 var_i16_1e02;
+ int16 mazeToneFreqStep; // var_i16_1e02
int16 var_i16_1e04;
int16 var_i16_1e06;
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 6a9a147b2a4..ad121c397b4 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -303,7 +303,7 @@ void FoolGame::jumbleRun() {
}
// 130:09a4
for (int i = 1; i <= 3; i++) {
- this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
+ this->playTone(_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
}
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->var_i16_1576; i++) {
@@ -616,18 +616,18 @@ void FoolGame::sub_130_1476() {
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
// 130:14fa
if (_event.where.x > 0x14) {
- this->sub_128_50e(0xf, 0x42, 0x1);
+ this->playTone(0xf, 0x42, 0x1);
}
return;
}
// 130:1518
if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] < 1) {
- this->sub_128_50e(0xf, 0x42, 0x1);
+ this->playTone(0xf, 0x42, 0x1);
return;
}
// 130:1558
if ((_jumbleGameType == 6) && (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] >= 0x11)) {
- this->sub_128_50e(0xf, 0x42, 0x1);
+ this->playTone(0xf, 0x42, 0x1);
return;
}
// 130:15b0
@@ -759,7 +759,7 @@ void FoolGame::sub_130_19da() {
// 130:19da
// fixed tile
this->sub_130_19ac();
- this->sub_128_50e(0x19, 0x64, 0);
+ this->playTone(0x19, 0x64, 0);
for (int i = 0; i <= 0x19; i++) {
g_toolbox->InvertRect(_screenGrid[13]);
this->sub_128_3da(1);
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index a6a86775070..e898c499596 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -226,7 +226,7 @@ void FoolGame::justiceZoom() {
void FoolGame::justiceDrawBlock() {
// 142:0f96
this->arr_i16_3738[this->var_i16_484] = 1;
- this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
g_toolbox->PenNormal();
g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
@@ -244,7 +244,7 @@ void FoolGame::justiceDrawBlock() {
void FoolGame::justiceRemoveBlock() {
// 142:10bc
this->arr_i16_3738[this->var_i16_484] = 0;
- this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
g_toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[_zbasic->rndInt(0x4d)+3]);
}
@@ -268,7 +268,7 @@ void FoolGame::justiceResetGrid() {
this->sub_128_3da(0x28);
_activePuzzleBuffer.clear();
for (int16 i = 1; i <= 0x19; i++) {
- this->sub_128_50e(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
g_toolbox->FillRect(_screenGrid[i], _patterns[2]);
}
// 142:126e
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index c4b80a91edb..f82c0f205d3 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -451,7 +451,7 @@ void FoolGame::mazeHotspot() {
sub_136_185a();
break;
case 12: // Z
- sub_136_1898();
+ mazeThornsClearTrigger();
break;
case 13: // S
sub_136_18f4();
@@ -472,7 +472,7 @@ void FoolGame::mazeHotspot() {
sub_136_1df4();
break;
case 19: // J
- sub_136_1e4c();
+ mazeThornsGetScroll();
break;
case 20: // K
sub_136_21fa();
@@ -759,6 +759,7 @@ void FoolGame::mazeHiddenDoorShut() {
}
void FoolGame::sub_136_1806() {
+ warning(__func__);
// 136:1806
sub_136_2582();
if ((arr_i16_3738[var_i16_1574] & 0x1000) != 0) {
@@ -768,12 +769,13 @@ void FoolGame::sub_136_1806() {
}
void FoolGame::sub_136_185a() {
+ warning(__func__);
// 136:185a
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
arr_i16_3738[var_i16_484] |= 0x1000;
}
-void FoolGame::sub_136_1898() {
+void FoolGame::mazeThornsClearTrigger() {
warning(__func__);
// 136:1898
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
@@ -789,7 +791,7 @@ void FoolGame::sub_136_18f4() {
var_i16_484 = 3;
sub_136_24ae();
for (int16 i = 1; i <= var_i16_1de4; i++) {
- sub_136_2538();
+ mazePlayTone();
}
}
@@ -810,8 +812,8 @@ void FoolGame::sub_136_1932() {
temp.bottom = arr_i16_4758[2];
temp.right = arr_i16_4758[3];
g_toolbox->InvertRect(temp);
- if (var_i16_1df4 > 0) {
- sub_136_2538();
+ if (mazeToneFreq > 0) {
+ mazePlayTone();
}
temp.top = arr_i16_4758[0];
temp.left = arr_i16_4758[1];
@@ -822,6 +824,7 @@ void FoolGame::sub_136_1932() {
}
void FoolGame::sub_136_19d2() {
+ warning(__func__);
// 136:19d2
g_toolbox->PenNormal();
g_toolbox->PenMode(kPatXor);
@@ -859,13 +862,15 @@ void FoolGame::sub_136_19d2() {
g_toolbox->InvertOval(_screenGrid[var_i16_1de8]);
}
- if (var_i16_1df4 > 0) {
- sub_136_2538();
+ if (mazeToneFreq > 0) {
+ mazePlayTone();
}
+ g_toolbox->Delay(0);
}
}
void FoolGame::sub_136_1cf4() {
+ warning(__func__);
// 136:1cf4
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -874,8 +879,8 @@ void FoolGame::sub_136_1cf4() {
sub_136_24ae();
for (int16 i = 1; i <= var_i16_1de4; i++) {
// 136:1d4c
- if (var_i16_1df4 > 0) {
- sub_136_2538();
+ if (mazeToneFreq > 0) {
+ mazePlayTone();
}
if (var_i16_1dec == 1) {
g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
@@ -894,12 +899,14 @@ void FoolGame::sub_136_1cf4() {
}
void FoolGame::sub_136_1ddc() {
+ warning(__func__);
// 136:1ddc
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
g_toolbox->Delay(var_i16_484*60/1000);
}
void FoolGame::sub_136_1df4() {
+ warning(__func__);
// 136:1df4
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -909,7 +916,7 @@ void FoolGame::sub_136_1df4() {
mazeMovementTrail();
}
-void FoolGame::sub_136_1e4c() {
+void FoolGame::mazeThornsGetScroll() {
// 136:1e4c
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -953,7 +960,7 @@ void FoolGame::sub_136_1e4c() {
}
for (int16 j = 1; j < 0x19; j++) {
if (k == 1) {
- var_i16_1e02 *= -1;
+ mazeToneFreqStep *= -1;
}
// 136:20bc
for (int16 i = 0; i <= 3; i++) {
@@ -982,9 +989,10 @@ void FoolGame::sub_136_1e4c() {
g_toolbox->FrameOval(temp);
}
// 136:21d0
- if (var_i16_1df4 < 0) {
- sub_136_2538();
+ if (mazeToneFreq > 0) {
+ mazePlayTone();
}
+ g_toolbox->Delay(0);
}
}
}
@@ -1042,21 +1050,20 @@ void FoolGame::mazeMovementTrail() {
void FoolGame::sub_136_24ae() {
warning(__func__);
// 136:24ae
- var_i16_1df4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
- if (var_i16_1df4 > 0) {
- var_i16_1e02 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 2, 2));
+ mazeToneFreq = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
+ if (mazeToneFreq > 0) {
+ mazeToneFreqStep = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 2, 2));
var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 4, 2))*2;
var_i16_1e04 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 6, 2));
}
// 136:2536
}
-void FoolGame::sub_136_2538() {
- warning(__func__);
+void FoolGame::mazePlayTone() {
// 136:2538
- sub_128_50e(var_i16_1df4, var_i16_1372, 0);
- if ((var_i16_1df4 > 0xe) && (var_i16_1df4 < 0x7d00)) {
- var_i16_1df4 += var_i16_1e02;
+ playTone(mazeToneFreq, var_i16_1372, 0);
+ if ((mazeToneFreq > 0xe) && (mazeToneFreq < 0x7d00)) {
+ mazeToneFreq += mazeToneFreqStep;
}
}
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 3505c172785..f802c256095 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -334,7 +334,7 @@ void FoolGame::sub_138_9c4() {
void FoolGame::sub_138_a06() {
// 138:0a06
- sub_128_50e(0x19, 0x64, 1);
+ playTone(0x19, 0x64, 1);
if (_metapuzzleSecretCodeCount == 0)
return;
metapuzzleSecretCodeReset();
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 3e27a711685..0a6cef21693 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -389,7 +389,7 @@ void FoolGame::polyominoOnClick() {
void FoolGame::polyominoCancelMove() {
// 133:0eb2
- this->sub_128_50e(0x14, 0x64, 0);
+ this->playTone(0x14, 0x64, 0);
this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
@@ -433,7 +433,7 @@ void FoolGame::polyominoOnClickFixed() {
this->var_i16_484 = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
this->var_i16_7e4 = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
// play bass tone
- this->sub_128_50e(0x14, 0x64, 0);
+ this->playTone(0x14, 0x64, 0);
// why do this???
// best guess: flashing the shape a few times before knocking it back
// 133:1188
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 2f18e0f0cd1..0be61b7d4bf 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -83,7 +83,7 @@ void FoolGame::revealRun() {
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
- this->sub_128_50e(
+ this->playTone(
_zbasic->rndInt(0x3e8) + 0x19,
0x28,
1
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 73999daa2d2..5b85a376e87 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -93,7 +93,7 @@ void FoolGame::sentenceRun() {
}
// 135:0408
if (this->arr_i16_4338[this->var_i16_68a] == 1) {
- this->sub_128_50e(_zbasic->rndInt(1000) + 0x19, 0x28, 1);
+ this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, 1);
this->sub_135_a34();
}
// 135:044a
@@ -325,7 +325,7 @@ void FoolGame::sub_135_cee() {
_activePuzzleStatus = 0x64;
this->var_i16_68a = 1;
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->sub_128_50e(_zbasic->rndInt(1000) + 0x19, 0x28, 0);
+ this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, 0);
}
}
// 135:0d40
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index 104f1ba8184..a21cccba48e 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -173,7 +173,7 @@ void FoolGame::straightPathReset() {
for (int16 i = 0; i <= 0x14; i++) {
var_i16_1574 = _zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
- sub_128_50e(_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
+ playTone(_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
// 143:0812
g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index ba1de99841b..a8100eeb853 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -600,7 +600,7 @@ void FoolGame::sub_140_15fc() {
this->var_i16_103a++;
if (this->var_i16_7e4 != this->var_i16_103a) {
this->var_i16_103a = 0;
- this->sub_128_50e(0xf, 0x64, 0x1);
+ this->playTone(0xf, 0x64, 0x1);
for (int16 i = 0; i <= 9; i++) {
Common::Rect temp;
temp.top = this->arr_i16_4758[4];
@@ -858,7 +858,7 @@ void FoolGame::thothKey3rdOnClick() {
void FoolGame::sub_140_1f68() {
// 140:1f68
- this->sub_128_50e(0xf, 0x64, 1);
+ this->playTone(0xf, 0x64, 1);
this->var_i16_103a = 0;
g_toolbox->PenSize(0x14, 0x14);
g_toolbox->PenPat(_patterns[3]);
@@ -961,7 +961,7 @@ void FoolGame::thothKeyLastOnClick() {
}
// 140:23aa
this->arr_i16_1eb8[1] = this->arr_i16_1eb8[0];
- this->sub_128_50e(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
+ this->playTone(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
g_toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[2]);
this->var_i16_1de6++;
warning("thothKeyLastOnClick: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1));
@@ -979,7 +979,7 @@ void FoolGame::thothKeyLastOnClick() {
void FoolGame::thothBadSelect() {
// 140:24ae
- this->sub_128_50e(0x14, 0x64, 0x0);
+ this->playTone(0x14, 0x64, 0x0);
while ((_event.modifiers & kModMouseButtonUp) == 0) {
// 140:24c4
this->getNextEvent(-1);
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index a02e6f493c1..98be74145b8 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -284,7 +284,7 @@ void FoolGame::wordSearchOnClick() {
// for every letter in the word
for (int i = 1; i <= this->var_i16_1a94; i++) {
// play a tone
- this->sub_128_50e(0xa + _zbasic->rndInt(0x3e8), 0x28, 1);
+ this->playTone(0xa + _zbasic->rndInt(0x3e8), 0x28, 1);
// 131:0b54
// remove the inverted square
g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
@@ -313,7 +313,7 @@ void FoolGame::wordSearchOnClick() {
void FoolGame::wordSearchBadSelect() {
// 131:0cbe
// play failure noise
- this->sub_128_50e(0x14, 0x64, 0);
+ this->playTone(0x14, 0x64, 0);
// uninvert all highlighted boxes
for (int i = 1; i <= this->var_i16_1a94; i++) {
g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
Commit: 5dcdc0c6ee2f3899bb56fc8d030ce06cdba884f7
https://github.com/scummvm/scummvm/commit/5dcdc0c6ee2f3899bb56fc8d030ce06cdba884f7
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:27+02:00
Commit Message:
FOOL: Fix puzzle fade-in of hermit
Changed paths:
engines/fool/fool.cpp
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index f87dda84eb6..05843046ae1 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -66,7 +66,17 @@ Common::Error FoolEngine::run() {
_screen.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_wm.setScreen(&_screen);
- FoolGame fg;
+ Common::String versionStr(_gameDescription->desc.extra);
+ FoolVersion version = kFool20;
+ if (versionStr == "v1.1") {
+ version = kFool11;
+ } else if (versionStr == "v2.0") {
+ version = kFool20;
+ } else if (versionStr == "v3.0") {
+ version = kFool30;
+ }
+
+ FoolGame fg(version);
fg.run();
return Common::kNoError;
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 8eb5265f8d6..ee8fd2d337f 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -29,7 +29,9 @@ namespace Fool {
;
extern Toolbox *g_toolbox;
-#define CARDS_MAX_SCORE 700
+// v1.1 and v2.0 have the winning score set to 700.
+// v3.0 revises this to be 666, which I can't dispute is a much cooler score.
+#define CARDS_MAX_SCORE 666
#define CARDS_MIN_SCORE (-999)
#define CARDS_YIELD_PENALTY 27
@@ -405,7 +407,7 @@ void FoolGame::cardsRevealHands() {
_zbasic->indexSet(_zbasic->index(1, 0x27) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
// 139:0e70
for (int16 i = 1; i <= 2; i++) {
- _zbasic->indexSet(_zbasic->str(284), 1, i + 0x27);
+ _zbasic->indexSet(Common::U32String(), 1, i + 0x27); // was: str(284)
if ((this->arr_i16_1eb8[i] > 0) && (this->arr_i16_1eb8[i] < 9)) {
// 139:0ed6
_zbasic->indexSet(
@@ -429,7 +431,7 @@ void FoolGame::cardsRevealHands() {
i + 0x29
);
// 139:0fca
- if (_zbasic->index(1, i + 0x27) == _zbasic->str(287)) { // blank
+ if (_zbasic->index(1, i + 0x27).empty()) { // was: str(287)
// 139:0ff0
_zbasic->indexSet(
_zbasic->index(1, 0x29 + i),
@@ -610,9 +612,9 @@ void FoolGame::sub_139_17fc() {
for (int i = 1; i <= 2; i++) {
this->arr_i16_1eb8[i + 2] = 0;
this->arr_i16_1eb8[i] = 0;
- _zbasic->indexSet(_zbasic->str(296), 1, 0x25 + i); // blank
- _zbasic->indexSet(_zbasic->str(297), 1, 0x27 + i); // blank
- _zbasic->indexSet(_zbasic->str(298), 1, 0x29 + i); // blank
+ _zbasic->indexSet(Common::U32String(), 1, 0x25 + i); // was: str(296)
+ _zbasic->indexSet(Common::U32String(), 1, 0x27 + i); // was: str(297)
+ _zbasic->indexSet(Common::U32String(), 1, 0x29 + i); // was: str(298)
}
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index f3a0963f33a..55896165096 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -32,8 +32,8 @@ extern Toolbox *g_toolbox;
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
-// v1.0 - original release, single-density disks
-// v2.0 - fixes full-screen rendering on higher-resolution displays
+// v1.0 - original release, single-density disks, different about menu
+// v2.0 - fixes full-screen rendering on higher-resolution displays, new about menu, can disable sounds
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
void FoolGame::run() {
@@ -1714,7 +1714,7 @@ void FoolGame::puzzleRun() {
this->sub_128_41d8();
}
// 128:3a12
- this->sub_128_3fb6();
+ this->puzzleSetupMenu();
this->sub_128_26f6();
this->sub_128_61ec();
this->puzzleLoadContext();
@@ -1901,7 +1901,7 @@ void FoolGame::storyUnlockChapter() {
// 128:3fb4
}
-void FoolGame::sub_128_3fb6() {
+void FoolGame::puzzleSetupMenu() {
// 128:3fb6
// new: delete existing menu 8
this->var_menu_bf8 = g_toolbox->GetMHandle(8);
@@ -1927,6 +1927,14 @@ void FoolGame::sub_128_3fb6() {
// 128:40f6
this->var_i16_484++;
this->var_str_384 = _zbasic->index(0, i) + _zbasic->str(76);
+
+ // New: Override instructions for card game.
+ // v3 changed the score from 700 points to 666 points, but didn't change the puzzle data
+ // file (where the menu entries come from). We apply a similar bodge here.
+ if ((_activePuzzle == 7) &&(i == _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]+7)) {
+ this->var_str_384 = Common::U32String("⢠The first player to earn over 666 points wins the game. ");
+ }
+
_zbasic->menu(8, this->var_i16_484, 1, this->var_str_384);
}
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 7373dfd70a1..0ed5cb5b607 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -54,9 +54,26 @@ enum FoolPuzzleFlags : uint16 {
kFlagMapTile = 0x08,
};
+enum FoolVersion {
+ kFool11 = 1,
+ kFool20 = 2,
+ kFool30 = 3,
+};
+
+enum FoolStrOffset {
+ kOffsetWordSearch,
+ kOffsetJigsaw,
+ kOffsetPolyomino,
+ kOffsetReveal,
+ kOffsetMaze,
+ kOffsetMetapuzzle,
+ kOffsetCards,
+ kOffsetThoth,
+};
+
class FoolGame {
public:
- FoolGame() {}
+ FoolGame(FoolVersion version): _version(version) {}
~FoolGame() {}
void run();
@@ -127,7 +144,7 @@ public:
void sub_128_388a();
void puzzleRun(); // sub_128_39a0
void storyUnlockChapter(); // sub_128_3de6
- void sub_128_3fb6();
+ void puzzleSetupMenu(); // sub_128_3fb6
void puzzleLoadContext(); // sub_128_4168
void puzzleSaveContext(); // sub_128_41aa
@@ -417,6 +434,7 @@ public:
private:
+ FoolVersion _version;
ZBasic *_zbasic;
bool _quit = false;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index a2af15c6793..fba0b729a47 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -377,7 +377,7 @@ void FoolGame::jigsawDropSelected() {
void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
- _activePuzzleBuffer = _zbasic->str(208);
+ _activePuzzleBuffer.clear(); // was: str(208)
for (int i = 1; i <= this->var_i16_1a9e; i++) {
_activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_3738[i]);
}
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index f802c256095..446bd0ca314 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -139,7 +139,7 @@ void FoolGame::sub_138_21e() {
temp.right = arr_i16_4d20[offset*4+3];
g_toolbox->InvertRect(temp);
puzzleLoadContext();
- sub_128_3fb6();
+ puzzleSetupMenu();
sub_128_26f6();
sub_128_61ec();
if (_activePuzzle == 0x55) {
@@ -253,7 +253,7 @@ void FoolGame::metapuzzleSecretCode() {
_metapuzzleSecretCodeCount = 0;
var_i16_68a = 1;
for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
- if (_zbasic->midStr(var_str_1272, i, 1) != _zbasic->str(273)) {
+ if (_zbasic->midStr(var_str_1272, i, 1) != _zbasic->str(273)) { // ' '
_metapuzzleSecretCodeCount++;
}
// 138:07c2
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 0a6cef21693..bb6764ec045 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -516,7 +516,7 @@ void FoolGame::polyominoSuccess() {
void FoolGame::polyominoStoreState() {
// 133:1452
- _activePuzzleBuffer = _zbasic->str(212); // empty
+ _activePuzzleBuffer.clear(); // was: str(212)
this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
Common::String val1 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index a8100eeb853..9d11e99b396 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -1033,9 +1033,11 @@ void FoolGame::hermitNextStage() {
void FoolGame::hermitScreenFlash() {
// 140:2662
Common::Rect area(0x37, 0x29, 0x1c9, 0x142);
- for (int16 i = 0; i <= 0x10; i++) {
+ // limit the amount of continuous full-screen flashing to WCAG
+ // recommendation of 3/second
+ for (int16 i = 0; i <= 6; i++) { // was: 0x10
g_toolbox->InvertRect(area);
- this->sub_128_3da(1);
+ this->sub_128_3da(10); // was: 1
}
}
@@ -1196,6 +1198,8 @@ void FoolGame::thothKeyLastSetup() {
for (int16 i = 0; i <= 0xd; i++) {
g_toolbox->EraseRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
g_toolbox->FrameRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ if (((i + j*0xd) % 6) == 0)
+ g_toolbox->Delay(0);
}
}
} else {
@@ -1209,6 +1213,8 @@ void FoolGame::thothKeyLastSetup() {
_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
_patterns[this->var_i16_484]
);
+ if (((j + k*0xd) % 6) == 0)
+ g_toolbox->Delay(0);
this->var_i16_68a++;
if (this->var_i16_68a > 0x13) {
this->var_i16_68a = 0;
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 98be74145b8..d4be13f76cd 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -117,7 +117,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_1992 = 1;
do {
_zbasic->indexSet(puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
- _zbasic->indexSet(_zbasic->str(192), 1, this->var_i16_1992); // blank string
+ _zbasic->indexSet(Common::U32String(), 1, this->var_i16_1992); // was: str(192)
this->var_i16_484 = 1;
do {
this->var_str_384 = _zbasic->midStr(
@@ -126,7 +126,7 @@ void FoolGame::wordSearchRun() {
1
);
// 131:0418
- if (this->var_str_384 != _zbasic->str(193)) { // string
+ if (this->var_str_384 != _zbasic->str(193)) { // ' '
_zbasic->indexSet(_zbasic->index(1, this->var_i16_1992) + this->var_str_384, 1, this->var_i16_1992);
}
// 131:045c
@@ -220,7 +220,7 @@ void FoolGame::wordSearchRun() {
void FoolGame::wordSearchOnClick() {
// 131:08aa
this->var_i16_1a94 = 0; // length of word selected
- this->var_str_1070 = _zbasic->str(202); // blank
+ this->var_str_1070.clear(); // was: str(202)
this->var_i16_1a96 = -1;
this->var_i16_1a98 = -1;
@@ -300,7 +300,7 @@ void FoolGame::wordSearchOnClick() {
g_toolbox->PenNormal();
this->var_i16_1990++;
if (this->var_i16_1990 == this->var_i16_198e) {
- this->var_str_384 = _zbasic->str(203); // blank
+ this->var_str_384 = _zbasic->str(203); // ' '
this->wordSearchDrawFooter();
return;
}
@@ -335,7 +335,7 @@ void FoolGame::wordSearchDrawFooter() {
void FoolGame::wordSearchStoreState() {
// 131:0d66
- _activePuzzleBuffer = _zbasic->str(206); // empty
+ _activePuzzleBuffer.clear(); // was: str(206)
for (int i = 1; i <= this->var_i16_198e; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_3738[i]);
_activePuzzleBuffer += _zbasic->rightStr(this->var_str_384, 1);
Commit: 23999986fdf25d09cdfb1035f89e421412f42f74
https://github.com/scummvm/scummvm/commit/23999986fdf25d09cdfb1035f89e421412f42f74
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:27+02:00
Commit Message:
FOOL: First pass at version adaptation
Changed paths:
A engines/fool/fool_hermit.cpp
A engines/fool/fool_threeships.cpp
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/module.mk
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index ee8fd2d337f..d5dbe84fb41 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetCards] + (x))
+
extern Toolbox *g_toolbox;
// v1.1 and v2.0 have the winning score set to 700.
@@ -69,7 +70,7 @@ void FoolGame::cardsRun() {
this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
// illustration of the card game
_zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
- if (_activePuzzleBuffer.empty()) { // was: str(278)
+ if (_activePuzzleBuffer.empty()) {
// 139:01fa
_activePuzzleBuffer = _zbasic->encodeInt(0) + _zbasic->encodeInt(0) + _zbasic->encodeInt(0);
// card IDs
@@ -185,17 +186,17 @@ void FoolGame::cardsDrawTable() {
this->drawTarotCard(1, 4, 0);
this->drawTarotCard(2, 5, 0);
this->drawTarotCard(3, 6, 0);
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0xc3;
// 139:061a
- this->sub_128_918(_zbasic->str(279)); // Select a card above
+ this->sub_128_918(_zbasic->str(OFF(0))); // Select a card above
this->var_i16_7a2 = 0xd4;
- this->sub_128_918(_zbasic->str(280)); // or
+ this->sub_128_918(_zbasic->str(OFF(1))); // or
g_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
g_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0xe9;
- this->sub_128_918(_zbasic->str(281)); // Yield
+ this->sub_128_918(_zbasic->str(OFF(2))); // Yield
this->var_i16_2016 = 1;
this->var_i16_2010 = 1;
this->sub_128_6186();
@@ -279,8 +280,8 @@ void FoolGame::cardsOnClick() {
this->sub_128_61ec();
// original code has the font ID as 1... maybe there's a fallback?
// this was intended to be Small
- _zbasic->text(0xfc, 9, Graphics::kMacFontRegular, kSrcBic);
- this->sub_128_918(_zbasic->str(282)); // (click mouse to continue)
+ _zbasic->text(kFontSmall, 9, Graphics::kMacFontRegular, kSrcBic);
+ this->sub_128_918(_zbasic->str(OFF(3))); // (click mouse to continue)
this->var_i16_2014 = 0;
_stateFlags = 0;
while ((_stateFlags == 0) && (this->var_i16_2014 == 0)) {
@@ -389,9 +390,9 @@ void FoolGame::cardsOpponentYields() {
this->playTone(0x19, 0x64, 0x1);
this->var_i16_2012 = -CARDS_YIELD_PENALTY;
this->cardsDrawScores();
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0xc4;
- this->sub_128_918(_zbasic->str(283)); // The Old Man yields
+ this->sub_128_918(_zbasic->str(OFF(4))); // The Old Man yields
}
void FoolGame::cardsRevealHands() {
@@ -407,11 +408,11 @@ void FoolGame::cardsRevealHands() {
_zbasic->indexSet(_zbasic->index(1, 0x27) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
// 139:0e70
for (int16 i = 1; i <= 2; i++) {
- _zbasic->indexSet(Common::U32String(), 1, i + 0x27); // was: str(284)
+ _zbasic->indexSet(Common::U32String(), 1, i + 0x27); // was: str(OFF(5))
if ((this->arr_i16_1eb8[i] > 0) && (this->arr_i16_1eb8[i] < 9)) {
// 139:0ed6
_zbasic->indexSet(
- _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i]) + _zbasic->str(285), // X pair
+ _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i]) + _zbasic->str(OFF(6)), // X pair
1,
i + 0x27
);
@@ -419,7 +420,7 @@ void FoolGame::cardsRevealHands() {
// 139:0f1e
if (this->arr_i16_1eb8[i] > 8) {
_zbasic->indexSet(
- _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i] - 8) + _zbasic->str(286), // X triplet
+ _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i] - 8) + _zbasic->str(OFF(7)), // X triplet
1,
0x27 + i
);
@@ -431,7 +432,7 @@ void FoolGame::cardsRevealHands() {
i + 0x29
);
// 139:0fca
- if (_zbasic->index(1, i + 0x27).empty()) { // was: str(287)
+ if (_zbasic->index(1, i + 0x27).empty()) { // was: str(OFF(8))
// 139:0ff0
_zbasic->indexSet(
_zbasic->index(1, 0x29 + i),
@@ -464,7 +465,7 @@ void FoolGame::cardsRevealHands() {
if (this->arr_i16_1eb8[1] != 0) {
for (int i = 1; i <= 2; i++) {
_zbasic->indexSet(
- _zbasic->index(1, 0x27 + i) + _zbasic->str(288) + _zbasic->index(1, 0x29 + i) + _zbasic->str(289),
+ _zbasic->index(1, 0x27 + i) + _zbasic->str(OFF(9)) + _zbasic->index(1, 0x29 + i) + _zbasic->str(OFF(10)),
1,
0x27 + i
);
@@ -478,20 +479,20 @@ void FoolGame::cardsRevealHands() {
this->cardsDrawScores();
if (this->var_i16_2016 == 1) {
- this->var_str_384 = _zbasic->str(290); // The fool
+ this->var_str_384 = _zbasic->str(OFF(11)); // The fool
} else {
// 139:11ce
- this->var_str_384 = _zbasic->str(291); // The Old Man
+ this->var_str_384 = _zbasic->str(OFF(12)); // The Old Man
}
// 139:11e2
if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->var_str_9f4 = _zbasic->str(292); // the game!
+ this->var_str_9f4 = _zbasic->str(OFF(13)); // the game!
} else {
// 139:123e
- this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_2012) + _zbasic->str(293); // X points
+ this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_2012) + _zbasic->str(OFF(14)); // X points
}
// 139:1264
- this->var_str_384 += _zbasic->str(294) + this->var_str_9f4; // X wins Y
+ this->var_str_384 += _zbasic->str(OFF(15)) + this->var_str_9f4; // X wins Y
// winning hand
this->var_str_167c = _zbasic->index(1, 0x28);
// losing hand
@@ -516,13 +517,13 @@ void FoolGame::cardsRevealHands() {
// 139:1344
this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
this->fillRect(0x2e, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_i16_7a2 = 0x46;
this->sub_128_918(this->var_str_384);
this->var_i16_7a2 = 0x64;
this->sub_128_918(this->var_str_167c);
this->var_i16_7a2 = 0x78;
- this->sub_128_918(_zbasic->str(295)); // beats
+ this->sub_128_918(_zbasic->str(OFF(16))); // beats
this->var_i16_7a2 = 0x8c;
this->sub_128_918(this->var_str_2222);
if (this->arr_i16_1eb8[1] != 0) {
@@ -612,9 +613,9 @@ void FoolGame::sub_139_17fc() {
for (int i = 1; i <= 2; i++) {
this->arr_i16_1eb8[i + 2] = 0;
this->arr_i16_1eb8[i] = 0;
- _zbasic->indexSet(Common::U32String(), 1, 0x25 + i); // was: str(296)
- _zbasic->indexSet(Common::U32String(), 1, 0x27 + i); // was: str(297)
- _zbasic->indexSet(Common::U32String(), 1, 0x29 + i); // was: str(298)
+ _zbasic->indexSet(Common::U32String(), 1, 0x25 + i); // was: str(OFF(17))
+ _zbasic->indexSet(Common::U32String(), 1, 0x27 + i); // was: str(OFF(18))
+ _zbasic->indexSet(Common::U32String(), 1, 0x29 + i); // was: str(OFF(19))
}
}
@@ -663,7 +664,7 @@ void FoolGame::sub_139_19da() {
void FoolGame::cardsDrawScores() {
// 139:1b12
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->arr_i16_1eb8[this->var_i16_2016 + 4] += this->var_i16_2012;
if (this->arr_i16_1eb8[5] < CARDS_MIN_SCORE) {
this->arr_i16_1eb8[5] = CARDS_MIN_SCORE;
@@ -675,14 +676,14 @@ void FoolGame::cardsDrawScores() {
// 139:1bb2
this->fillRect(0x14, 0, 0x29, 0x5a, 2);
// Old Man
- this->var_str_384 = _zbasic->str(299) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
+ this->var_str_384 = _zbasic->str(OFF(20)) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(0x2d - (this->var_i16_484 / 2), 0x23);
g_toolbox->DrawString(this->var_str_384);
// 139:1c30
this->fillRect(0x14, 0x1a6, 0x29, 0x200, 2);
- this->var_str_384 = _zbasic->str(300) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
+ this->var_str_384 = _zbasic->str(OFF(21)) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->MoveTo(0x1d3 - (this->var_i16_484 / 2), 0x23);
g_toolbox->DrawString(this->var_str_384);
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 55896165096..2b4d285860c 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/ustr.h"
#include "common/util.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
@@ -36,7 +37,41 @@ extern Toolbox *g_toolbox;
// v2.0 - fixes full-screen rendering on higher-resolution displays, new about menu, can disable sounds
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
+
+// Offset adjustments for the ZBasic string table to align
+// across game versions
+static const int fool11ZStrOffset[] = {
+ 128, 59, 81, 170, 186, 188, 192, 194, 202, 239, 258, 280, 315, 324,
+};
+
+static const int fool20ZStrOffset[] = {
+ 102, 78, 103, 191, 207, 209, 213, 215, 223, 260, 279, 301, 336, 345,
+};
+
+static const int fool30ZStrOffset[] = {
+ 97, 73, 98, 161, 177, 179, 183, 185, 193, 230, 251, 273, 308, 317,
+};
+
void FoolGame::run() {
+ switch (_version) {
+ case kFool11:
+ _zstrOffset = fool11ZStrOffset;
+ // v1.1 and v2.0 provide overrides for "Chicago".
+ // v1.1 doesn't include a FOND chunk, so we have to manufacture one.
+ _fontChicago = 0;
+ break;
+ case kFool30:
+ _zstrOffset = fool30ZStrOffset;
+ // v3.0 calls the font "Foolish Chicago" and changes the index
+ _fontChicago = 255;
+ break;
+ case kFool20:
+ default:
+ _zstrOffset = fool20ZStrOffset;
+ _fontChicago = 0;
+ break;
+ }
+
_zbasic = new ZBasic(g_toolbox);
Common::MacFinderInfo finfo;
if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
@@ -47,6 +82,8 @@ void FoolGame::run() {
} else {
error("FoolGame::run: Fool's Errand program not found");
}
+ // Fool's Errand has an embedded version of Chicago with custom characters
+ _zbasic->setMenuFont(_fontChicago, 12, 0);
this->sub_128_004();
delete _zbasic;
}
@@ -58,7 +95,7 @@ void FoolGame::sub_128_004() {
_menuDisabled = false;
_menuHidesPlayfield = false;
_isAutoSaving = false;
- // zero out pattern buffer; sub_129_123a uses entry
+ // zero out pattern buffer; menuLoadingMessage uses entry
// 0 for filling the top bar
for (int i = 0; i <= 0x50; i++) {
Common::fill(_patterns[i].data, _patterns[i].data + 8, 0);
@@ -425,7 +462,7 @@ void FoolGame::sub_128_55c(const Common::U32String &unk1) {
g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
g_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133);
g_toolbox->DrawString(this->var_str_172);
@@ -570,7 +607,7 @@ void FoolGame::getNextEvent(uint32 unk1) {
this->var_i16_78a = g_toolbox->GetNextEvent(unk1, _event);
if ((_event.what == kMouseDown) && (_event.where.y < 0x14)) {
- this->sub_128_5b30();
+ this->onClickMenu();
}
// 128:0caa
g_toolbox->GlobalToLocal(_event.where);
@@ -628,25 +665,21 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
}
}
-void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount, bool beep) {
// 128:0dfe
- this->var_i16_7b0 = unk1;
- this->var_i16_7ae = unk2;
- this->var_i16_7ac = unk3;
- this->var_i16_7aa = unk4;
g_toolbox->SetPort(this->var_i32_4);
this->var_i16_7b2 = 0xa;
g_toolbox->InitCursor();
this->sub_128_4da(1);
- if (this->var_i16_7b0 != 0) {
+ if (beep) {
this->playTone(0x19, 0x64, 0);
}
// 128:0e46
this->copyScreen(0, this->arr_bmp_138bc);
- _zbasic->text(this->var_i16_7aa, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_i16_7b4 = this->var_i16_7ae*0x46;
+ _zbasic->text(font, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ this->var_i16_7b4 = buttonCount*0x46;
this->var_i16_7b6 = 0;
- for (int i = 0; i <= this->var_i16_7ac; i++) {
+ for (int i = 0; i <= lineCount; i++) {
// 128:0e86
this->var_i16_7ba = g_toolbox->StringWidth(_modalText[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
@@ -655,7 +688,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_7b6 += 0x11;
}
// 128:0ed6
- if (this->var_i16_7ae >= 0) {
+ if (buttonCount >= 0) {
this->var_i16_7bc = 0xa4 + (this->var_i16_7b6 / 2);
this->var_i16_7b6 += 0x28;
} else {
@@ -683,7 +716,7 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->PenNormal();
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
// 128:1056
- for (int i = 0; i <= this->var_i16_7ac; i++) {
+ for (int i = 0; i <= lineCount; i++) {
this->var_str_384 = _modalText[i];
this->sub_128_918(this->var_str_384);
// 128:1086
@@ -691,9 +724,9 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
this->var_i16_7a2 += 0x11;
}
// 128:10a0
- if (this->var_i16_7ae != 0) {
+ if (buttonCount != 0) {
g_toolbox->PenNormal();
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// 128:10c0
// loop to zero out three button rects
@@ -701,30 +734,30 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
Common::Rect button2 = Common::Rect(0, 0, 0, 0); // arr_rect_5b84
Common::Rect button3 = Common::Rect(0, 0, 0, 0); // arr_rect_5b8c
// 128:10e2
- if (this->var_i16_7ae == 1) {
+ if (buttonCount == 1) {
g_toolbox->SetRect(button1, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
// 128:1122
- } else if (this->var_i16_7ae == 2) {
+ } else if (buttonCount == 2) {
g_toolbox->SetRect(button1, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
g_toolbox->SetRect(button2, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
// 128:1182
- } else if (this->var_i16_7ae == 3) {
+ } else if (buttonCount == 3) {
g_toolbox->SetRect(button1, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
g_toolbox->SetRect(button2, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
g_toolbox->SetRect(button3, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
}
// 128:1208
- if (this->var_i16_7ae >= 1) {
+ if (buttonCount >= 1) {
g_toolbox->EraseRoundRect(button1, 0xa, 0xa);
g_toolbox->FrameRoundRect(button1, 0xa, 0xa);
- this->var_str_172 = _modalText[(this->var_i16_7ac + 1)];
+ this->var_str_172 = _modalText[(lineCount + 1)];
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
// 128:1274
this->var_i16_30 = button1.left + ((button1.right - button1.left) / 2) - (this->var_i16_30 / 2);
// 128:12d4
g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
g_toolbox->DrawString(this->var_str_172);
- if (this->var_i16_7ae > 1) {
+ if (buttonCount > 1) {
g_toolbox->InsetRect(button1, -2, -2);
g_toolbox->PenPat(_patterns[0]);
g_toolbox->FrameRoundRect(button1, 0xa, 0xa);
@@ -733,10 +766,10 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
}
}
// 128:134c
- if (this->var_i16_7ae >= 2) {
+ if (buttonCount >= 2) {
g_toolbox->EraseRoundRect(button2, 0xa, 0xa);
g_toolbox->FrameRoundRect(button2, 0xa, 0xa);
- this->var_str_172 = _modalText[(this->var_i16_7ac+2)];
+ this->var_str_172 = _modalText[(lineCount+2)];
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
this->var_i16_30 = button2.left + ((button2.right - button2.left)/2) - (this->var_i16_30 / 2);
// 128:1418
@@ -744,10 +777,10 @@ void FoolGame::sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
g_toolbox->DrawString(this->var_str_172);
}
// 128:1432
- if (this->var_i16_7ae == 3) {
+ if (buttonCount == 3) {
g_toolbox->EraseRoundRect(button3, 0xa, 0xa);
g_toolbox->FrameRoundRect(button3, 0xa, 0xa);
- this->var_str_172 = _modalText[this->var_i16_7ac+3];
+ this->var_str_172 = _modalText[lineCount+3];
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
this->var_i16_30 = (button3.left + ((button3.right - button3.left)/2)) - (this->var_i16_30/2);
@@ -851,7 +884,7 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
// 128:188a
this->sub_128_4da(0);
_zbasic->picture(0, 0x14, this->var_pic_7c2);
- _zbasic->text(0xfa, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
+ _zbasic->text(kFontFool, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
for (int j = 0; j <= 1; j++) {
// 128:18c4
for (int i = 0; i <= 0x64; i += 4) {
@@ -1071,36 +1104,37 @@ void FoolGame::storyRenderPage() {
}
// 128:235e
if (_puzzleType[_storyCurrentChapter] > 0) {
- this->var_str_384 = _zbasic->str(10); // ?
+ // set story button icon
+ this->var_str_384 = Common::U32String("?"); // was: str(10)
if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
- this->var_str_384 = _zbasic->str(11); // ~
+ this->var_str_384 = Common::U32String("~"); // wadjet eye, was: str(11)
}
// 128:23b8
if (_puzzleCompletionStatus[_storyCurrentChapter] >= 0x64) {
- this->var_str_384 = _zbasic->str(12); // *
+ this->var_str_384 = Common::U32String("*"); // was: str(12)
}
// 128:23e8
this->sub_128_55c(this->var_str_384);
// 128:23f0: CLR.W - -0x772(A5)
this->var_i16_7d6 = 1;
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x8a, 0x133);
g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->MoveTo(0x70, 0x133);
g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
}
// 128:2468
- if (_pageNumberText[_storyNextPage] != _zbasic->str(13)) { // blank
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ if (!_pageNumberText[_storyNextPage].empty()) { // was: str(13)
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
g_toolbox->DrawString(_pageNumberText[_storyNextPage]);
}
// 128:24be
if (_storyNextPage != _storyCurrentPage) {
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
if (this->var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
@@ -1112,7 +1146,7 @@ void FoolGame::storyRenderPage() {
debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", _storyNextPage, _pageLines[_storyNextPage]);
if (_pageLines[_storyNextPage] < 0xf) {
g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
- g_toolbox->DrawString(_zbasic->str(14)); // infinity symbol
+ g_toolbox->DrawString(Common::U32String("â")); // was: str(14)
this->var_i16_7de = this->var_i16_7a2 - 0x1e;
} else {
// 128:25a6
@@ -1143,7 +1177,7 @@ void FoolGame::sub_128_2664() {
// hide menu and replace with "click mouse to continue" message
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_str_172 = _zbasic->str(15); // click mouse to continue
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xf);
@@ -1228,7 +1262,7 @@ void FoolGame::sub_128_2808() {
if (this->var_i16_7e6 != 0) {
_modalText[0] = _zbasic->str(17) + this->var_str_588 + _zbasic->str(18);
_modalText[1] = _zbasic->str(19);
- this->sub_128_dfe(0, 0, 1, 1);
+ this->showChoiceModal(0, 0, 1, 1);
this->var_str_588 = _zbasic->str(20);
this->var_i16_7e6 = 0;
}
@@ -1329,7 +1363,7 @@ void FoolGame::newGame() {
this->clearStateBits(kStateNewGame);
this->cursorWatch();
this->sub_128_3744();
- _saveFileName = _zbasic->str(33);
+ _saveFileName.clear(); // was: str(33);
this->var_i16_9ec = 0;
// set up the initially visible story chapters
@@ -1461,21 +1495,21 @@ void FoolGame::sub_128_3032() {
this->var_i16_68c = 3;
// render chapter menu headings
for (int j = 3; j <= 7; j++) {
- this->var_str_384 = _zbasic->str(37) + _zbasic->chr(0x7d+j) + _zbasic->str(38);
+ this->var_str_384 = Common::U32String("-") + _zbasic->chr(0x7d+j) + Common::U32String("-"); // was: str(37)
_zbasic->menu(j, 0, 1, this->var_str_384);
for (int i = 1; i <= 0x10; i++) {
this->var_i16_484++;
this->var_i16_9f2 = _puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
if (_puzzleCompletionStatus[this->var_i16_484] == 0x63) {
- this->var_str_384 = _zbasic->str(39); // " ~ "
+ this->var_str_384 = Common::U32String(" ~ "); // wadjet eye for puzzles with enchantment
} else {
// 128:30e4
- this->var_str_384 = _zbasic->str(40); // " "
+ this->var_str_384 = Common::U32String(" "); // was: str(40)
}
// 128:30f8
this->var_str_9f4 = _puzzleName[this->var_i16_484] + this->var_str_384;
- if ((j == 3) && (i == 1)) {
- this->var_str_9f4 = _zbasic->str(41) + this->var_str_9f4;
+ if ((j == 3) && (i == 1)) { // add shortcut modifier for the sun's map
+ this->var_str_9f4 = Common::U32String("/M") + this->var_str_9f4;
}
// 128:315e
_zbasic->menu(j, i, this->var_i16_9f2, this->var_str_9f4);
@@ -1485,7 +1519,7 @@ void FoolGame::sub_128_3032() {
// 128:318e
fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0x3c;
this->var_i16_7de = 0x2d;
// draw the first page of text
@@ -1538,11 +1572,13 @@ void FoolGame::savePrompt() {
Common::U32String previous = _saveFileName;
_saveFileName.clear();
- _modalText[0] = _zbasic->str(43); // do you wish to save this game
- _modalText[1] = _zbasic->str(44); // yes
- _modalText[2] = _zbasic->str(45); // no
- _modalText[3] = _zbasic->str(46); // cancel
- this->sub_128_dfe(0, 0, 3, 0);
+ // v1.1 uses a full-screen modal without a cancel button, so we hardcode the strings from v2.0 here.
+ // was: str(43)
+ _modalText[0] = Common::U32String("Do you wish to save this game?");
+ _modalText[1] = Common::U32String("Yes");
+ _modalText[2] = Common::U32String("No");
+ _modalText[3] = Common::U32String("Cancel");
+ this->showChoiceModal(0, 0, 3, 0);
if (_savePromptChoice > 1) {
_saveFileName = previous;
return;
@@ -1909,28 +1945,28 @@ void FoolGame::puzzleSetupMenu() {
g_toolbox->DisposeMenu(this->var_menu_bf8);
_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
- this->var_str_384 = _zbasic->str(72); // return to scroll
+ this->var_str_384 = Common::U32String("/RReturn to Scroll "); // was: str(72)
if ((_activePuzzle == 0x34) || (_activePuzzle == 0x35)) {
- this->var_str_384 = _zbasic->str(73); // run for your life
+ this->var_str_384 = Common::U32String("/RRun for your life@ "); // was: str(73)
}
// 128:4024
if (_activePuzzle > 0x50) {
- this->var_str_384 = _zbasic->str(74); // return to map
+ this->var_str_384 = Common::U32String("/RReturn to Map "); // was: str(74)
}
_zbasic->menu(8, 1, 1, this->var_str_384);
// 128:4056
if (_puzzleMenuInstructions[_puzzleType[_activePuzzle]*2] <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]) {
- _zbasic->menu(8, 2, 0, _zbasic->str(75)); // line
+ _zbasic->menu(8, 2, 0, Common::U32String("-")); // was: str(75)
// 128:40c6
this->var_i16_484 = 2;
for (int i = _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]; i <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]; i++) {
// 128:40f6
this->var_i16_484++;
- this->var_str_384 = _zbasic->index(0, i) + _zbasic->str(76);
+ this->var_str_384 = _zbasic->index(0, i) + Common::U32String(" "); // was: str(76)
// New: Override instructions for card game.
// v3 changed the score from 700 points to 666 points, but didn't change the puzzle data
- // file (where the menu entries come from). We apply a similar bodge here.
+ // file (where the menu entries come from). V3 applies a bodge with a program string.
if ((_activePuzzle == 7) &&(i == _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]+7)) {
this->var_str_384 = Common::U32String("⢠The first player to earn over 666 points wins the game. ");
}
@@ -2130,16 +2166,18 @@ void FoolGame::sub_128_4472() {
// about screen
void FoolGame::menuAbout() {
+ int aboutOff = _zstrOffset[kOffsetAbout];
+
// 128:4a92
if (_saveFileName.empty()) { // was: str(77)
// untitled game in progress
- _modalText[0] = _zbasic->chr(0x22) + _zbasic->str(78) + _zbasic->chr(0x22) + _zbasic->str(79);
+ _modalText[0] = _zbasic->chr(0x22) + _zbasic->str(aboutOff+0) + _zbasic->chr(0x22) + Common::U32String(" in progress");
} else {
// 128:4aee
- _modalText[0] = _zbasic->chr(0x22) + _saveFileName + _zbasic->chr(0x22) + _zbasic->str(80);
+ _modalText[0] = _zbasic->chr(0x22) + _saveFileName + _zbasic->chr(0x22) + Common::U32String(" in progress");
}
// 128:4b28
- _modalText[1] = _zbasic->str(81);
+ _modalText[1] = _zbasic->str(aboutOff+3);
if (_sunMapRestored == 0) {
this->var_i16_68c = 0x51;
@@ -2152,14 +2190,14 @@ void FoolGame::menuAbout() {
// 128:4b88
if (this->var_i16_68c >= 0) {
// sun's map is incomplete
- _modalText[2] = _zbasic->str(82);
+ _modalText[2] = _zbasic->str(aboutOff+4);
if (this->var_i16_68c == 1) {
// there is 1 missing piece
- _modalText[3] = _zbasic->str(83);
+ _modalText[3] = _zbasic->str(aboutOff+5);
} else {
// 128:4bde
// there are N missing pieces
- _modalText[3] = Common::U32String::format("%s %d%s", _zbasic->str(84).encode().c_str(), this->var_i16_68c, _zbasic->str(85).encode().c_str());
+ _modalText[3] = Common::U32String::format("%s %d%s", _zbasic->str(aboutOff+6).encode().c_str(), this->var_i16_68c, _zbasic->str(aboutOff+7).encode().c_str());
}
// 128:4c1a
this->var_i16_68c = 0;
@@ -2170,15 +2208,14 @@ void FoolGame::menuAbout() {
}
}
// 128:4c74
- // blank
- _modalText[4] = _zbasic->str(86);
+ _modalText[4] = _zbasic->str(aboutOff+8); // ' '
if (this->var_i16_68c == 1) {
// There is 1 unsolved puzzle.
- _modalText[5] = _zbasic->str(87);
+ _modalText[5] = _zbasic->str(aboutOff+9);
} else {
// 128:4cc0
// There are X unsolved puzzles.
- _modalText[5] = Common::U32String::format("%s %d%s", _zbasic->str(88).encode().c_str(), this->var_i16_68c, _zbasic->str(89).encode().c_str());
+ _modalText[5] = Common::U32String::format("%s %d%s", _zbasic->str(aboutOff+10).encode().c_str(), this->var_i16_68c, _zbasic->str(aboutOff+11).encode().c_str());
}
// 128:4cfc
this->var_i16_d06 = 5;
@@ -2186,24 +2223,24 @@ void FoolGame::menuAbout() {
} else {
// 128:4d06
// You have all the map pieces, but they are not arranged in the correct order.
- _modalText[2] = _zbasic->str(90);
- _modalText[3] = _zbasic->str(91);
- _modalText[4] = _zbasic->str(92);
- _modalText[5] = _zbasic->str(93);
+ _modalText[2] = _zbasic->str(aboutOff+12);
+ _modalText[3] = _zbasic->str(aboutOff+13);
+ _modalText[4] = _zbasic->str(aboutOff+14);
+ _modalText[5] = _zbasic->str(aboutOff+15);
// Only the Book of Thoth remains unsolved.
- _modalText[6] = _zbasic->str(94);
- _modalText[7] = _zbasic->str(95);
+ _modalText[6] = _zbasic->str(aboutOff+16);
+ _modalText[7] = _zbasic->str(aboutOff+17);
this->var_i16_d06 = 7;
}
// 128:4dc0
} else {
// 128:4dc4
// The sun's map is restored.
- _modalText[2] = _zbasic->str(96);
- _modalText[3] = _zbasic->str(97);
+ _modalText[2] = _zbasic->str(aboutOff+18);
+ _modalText[3] = _zbasic->str(aboutOff+19);
// Only the Book of Thoth remains unsolved.
- _modalText[4] = _zbasic->str(98);
- _modalText[5] = _zbasic->str(99);
+ _modalText[4] = _zbasic->str(aboutOff+20);
+ _modalText[5] = _zbasic->str(aboutOff+21);
this->var_i16_d06 = 5;
}
// 128:4e42
@@ -2212,7 +2249,7 @@ void FoolGame::menuAbout() {
g_toolbox->InitCursor();
this->sub_128_4da(1);
this->copyScreen(0, this->arr_bmp_138bc);
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7b4 = 0;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
@@ -2261,12 +2298,11 @@ void FoolGame::menuAbout() {
0x82 - this->var_i16_7b6 + 0x20
);
g_toolbox->PlotIcon(bounds, this->var_i32_c);
- // the fool's errand
+ // These strings don't appear in the v1.1 about box
g_toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
- g_toolbox->DrawString(_zbasic->str(100));
- // by Cliff Johnson
+ g_toolbox->DrawString(Common::U32String("the fool's errand")); // was: str(100)
g_toolbox->MoveTo(0xee, 0x9b - this->var_i16_7b6);
- g_toolbox->DrawString(_zbasic->str(101));
+ g_toolbox->DrawString(Common::U32String("by Cliff Johnson")); // was: str(101)
// 128:509a
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
@@ -2276,9 +2312,9 @@ void FoolGame::menuAbout() {
this->var_i16_7a2 += 0x11;
}
// 128:50f4
- _zbasic->text(0xfc, 0x9, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 += 0xe;
- this->sub_128_918(_zbasic->str(102)); // version string
+ this->sub_128_918(_zbasic->str(_zstrOffset[kOffsetVersion])); // version string
this->sub_128_2664();
this->sub_128_61c2();
g_toolbox->DrawMenuBar();
@@ -2294,226 +2330,7 @@ void FoolGame::menuPrologue() {
this->copyScreen(1, this->arr_bmp_138bc);
}
-// three freakin' ships
-void FoolGame::shipsRun() {
- // 128:5140
- fillRect(0x127, 0x6c, 0x137, 0x84, 0);
- this->sub_128_6186();
- this->sub_128_55c(_zbasic->str(103)); // "?"
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
- //warning("sub_128_5140: b3ec surface");
- //byte fakePal[768];
- //Common::fill(fakePal, fakePal+3, 0xff);
- //Common::fill(fakePal+3, fakePal+768, 0x00);
- //this->arr_bmp_b3ec->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 160, fakePal);
-
- fillRect(0x127, 0x6c, 0x137, 0x84, 0);
-
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
- //warning("sub_128_5140: bbbc surface");
- //this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 160, fakePal);
- // 138:51f0
- this->var_i16_d08 = _zbasic->rndInt(5) + 5;
- this->var_i16_d0a = _zbasic->rndInt(5) - 0xa;
- for (int16 i = 0; i <= 5; i++) {
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
- this->sub_128_5a6c();
- }
- // 128:5274
- this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
- this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
- this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
- this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
- // 128:530c
- _activePuzzleSolved = false;
- _keyLastPressed = 0;
- while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
- this->getNextEvent(-1);
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_19114) != 0) {
- this->sub_128_55ac();
- }
- // 128:5348
- this->var_i16_d0e = _event.where.y;
- this->var_i16_d10 = _event.where.x;
- if (_keyLastPressed > 0) {
- this->sub_128_57a2();
- }
- if (_stateFlags == kStateSaveGame) {
- this->saveGame();
- }
- }
- // 128:5396
- if (_activePuzzleSolved) {
- this->sub_128_6186();
- this->playTone(0x14, 0x64, 0);
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- _event.where.x += 5;
- _event.where.y -= 5;
- if (_activePuzzleStatus < 0x64) {
- g_toolbox->SetCursor(_cursors[0x10]);
- }
- for (int16 i = 1; i <= 1; i++) {
- // 128:541c
- this->arr_i16_4758[0] = _event.where.y;
- this->arr_i16_4758[1] = _event.where.x;
- this->arr_i16_4758[2] = _event.where.y;
- this->arr_i16_4758[3] = _event.where.x;
- for (int16 j = 1; j <= 0x19; j++) {
- // 128:5462
- this->arr_i16_4758[0]--;
- this->arr_i16_4758[1]--;
- this->arr_i16_4758[2]++;
- this->arr_i16_4758[3]++;
- Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertOval(temp);
- }
- }
- // 128:5514
- this->sub_128_3da(0x3c);
- if (_activePuzzleStatus < 0x64) {
- // 128:5526
- this->sub_128_6186();
- _activePuzzleStatus = 0x64;
- this->var_i16_7ce |= 2;
- this->zoomRect(
- _event.where.y - 5,
- _event.where.x - 5,
- _event.where.y + 5,
- _event.where.x + 5,
- 0x14,
- 0,
- SCREEN_HEIGHT,
- SCREEN_WIDTH,
- 2,
- kPatCopy,
- 0x42
- );
- this->var_str_384 = _zbasic->str(104); // behold the 1st key of thoth
- this->sub_128_178a(0, 0);
- }
- // 128:55aa
- }
- // 128:55aa
- return;
-}
-
-void FoolGame::sub_128_55ac() {
- // 128:55ac
- if ((this->var_i16_d10 == _event.where.x) && (this->var_i16_d0e == _event.where.y)) {
- return;
- }
- this->var_i16_d08 = _zbasic->rndInt(5) + 5;
- this->var_i16_d0a = _zbasic->rndInt(5) + 5;
- if (_zbasic->maybe()) {
- this->var_i16_d08 *= -1;
- }
- // 128:560a
- if (_zbasic->maybe()) {
- this->var_i16_d0a *= -1;
- }
- // 128:5620
- if (this->arr_rect_1910c.top < 0x50) {
- this->var_i16_d0a = 0xa;
- }
- // 128:5640
- if (this->arr_rect_1910c.left < 0x3c) {
- this->var_i16_d08 = 0xa;
- }
- if (this->arr_rect_1910c.bottom > 0x104) {
- this->var_i16_d0a = -0xa;
- }
- if (this->arr_rect_1910c.right > 0x1a4) {
- this->var_i16_d08 = -0xa;
- }
- // 128:56a0
- for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
- this->sub_128_5a6c();
- }
- // 128:5708
- this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
- this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
- this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
- this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
-
-}
-
-void FoolGame::sub_128_57a2() {
- // 128:57a2
- this->var_str_d12 = _zbasic->ucase(_zbasic->chr(_keyLastPressed));
- if (_zbasic->instr(1, _zbasic->str(105), this->var_str_d12) > 0) { // NESW
- // 128:57e0
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- this->var_i16_d08 = 0;
- this->var_i16_d0a = 0;
- if (this->var_str_d12 == _zbasic->str(106)) { // N
- this->var_i16_d0a = -0x10;
- }
- if (this->var_str_d12 == _zbasic->str(107)) { // S
- this->var_i16_d0a = 0x10;
- }
- if (this->var_str_d12 == _zbasic->str(108)) { // W
- this->var_i16_d08 = -0x18;
- }
- if (this->var_str_d12 == _zbasic->str(109)) { // E
- this->var_i16_d08 = 0x18;
- }
- g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
- this->var_i16_d08 = 0;
- this->var_i16_d0a = 0;
- // 128:58c2
- if (this->arr_rect_1910c.top < 0x14) {
- this->arr_rect_1910c.top = 0x146;
- this->arr_rect_1910c.bottom = SCREEN_HEIGHT;
- }
- if (this->arr_rect_1910c.left < 0) {
- this->arr_rect_1910c.left = 0x1e8;
- this->arr_rect_1910c.right = SCREEN_WIDTH;
- }
- // 128:592e
- if (this->arr_rect_1910c.bottom > SCREEN_HEIGHT) {
- this->arr_rect_1910c.top = 0x14;
- this->arr_rect_1910c.bottom = 0x24;
- }
- if (this->arr_rect_1910c.right > SCREEN_WIDTH) {
- this->arr_rect_1910c.left = 0;
- this->arr_rect_1910c.right = 0x18;
- }
- this->sub_128_5a6c();
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
- _activePuzzleSolved = true;
- }
- }
- // 128:59cc
- _keyLastPressed = 0;
- this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
- this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
- this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
- this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
-
-}
-
-void FoolGame::sub_128_5a6c() {
- // 128:5a6c
- this->var_i32_692 = g_toolbox->TickCount();
- _zbasic->get(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_rect_1910c.right, this->arr_rect_1910c.bottom, this->arr_bmp_bbbc);
- //warning("sub_128_5a6c: bbbc surface");
- //byte fakePal[768];
- //Common::fill(fakePal, fakePal+3, 0xff);
- //Common::fill(fakePal+3, fakePal+768, 0x00);
- //this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
- g_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
- this->sub_128_406(0);
-}
-
-void FoolGame::sub_128_5b30() {
+void FoolGame::onClickMenu() {
// 128:5b30
if (_menuDisabled)
return;
@@ -2777,9 +2594,9 @@ void FoolGame::sub_129_004() {
// 129:000a: LEA - 0x3ea(A5),A0
// 129:000e: MOVE.L - A0,-0x8ee(A5)
// 129:0012: SF - 0x8,D0
- _zbasic->openR(1, _zbasic->str(110), 0x3e8, this->var_i16_e20); // fool's puzzles
+ _zbasic->openR(1, Common::U32String("Fool's Puzzles"), 0x3e8, this->var_i16_e20); // was: str(110)
if (this->var_i16_7e6 == 0) {
- this->var_str_e22 = _zbasic->str(111); // fool's puzzles
+ this->var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(111)
this->var_i16_f22 = this->var_i16_e20;
_zbasic->close(1);
this->var_i16_7e6 = 0;
@@ -2890,7 +2707,7 @@ void FoolGame::sub_129_068() {
_modalText[1] = _zbasic->str(114);
_modalText[2] = _zbasic->str(115);
_modalText[3] = _zbasic->str(116);
- this->sub_128_dfe(0, 2, 1, 0);
+ this->showChoiceModal(0, 2, 1, 0);
_zbasic->unk_4();
}
// 129:0390
@@ -2905,24 +2722,24 @@ void FoolGame::sub_129_068() {
_modalText[4] = _zbasic->str(121);
_modalText[5] = _zbasic->str(122);
_modalText[6] = _zbasic->str(123);
- this->sub_128_dfe(0, 5, 1, 1);
+ this->showChoiceModal(0, 5, 1, 1);
_zbasic->unk_4();
}
// 129:0496
this->var_i16_7e4 = 1;
- this->var_str_e22 = _zbasic->str(124);
- _saveFileName = _zbasic->str(125);
+ this->var_str_e22.clear(); // was: str(124);
+ _saveFileName.clear(); // was: str(125);
this->var_i16_484 = _zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
- if (this->var_str_588 != _zbasic->str(126)) {
- if (this->var_str_588 == _zbasic->str(127)) { // Fool's Puzzles
- this->var_str_e22 = _zbasic->str(128);
+ if (!this->var_str_588.empty()) { // was: str(126)
+ if (this->var_str_588 == Common::U32String("Fool's Puzzles")) { // was: str(127)
+ this->var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(128)
this->var_i16_f22 = this->var_i16_688;
} else {
// 129:052e
this->sub_128_2808();
- if (this->var_str_588 != _zbasic->str(129)) {
+ if (!this->var_str_588.empty()) { // was: str(129)
// 129:054c
_saveFileName = this->var_str_588;
this->var_i16_9ec = this->var_i16_688;
@@ -2932,27 +2749,27 @@ void FoolGame::sub_129_068() {
// 129:0562
this->var_i16_f2c = this->sub_128_5fe(); // volume ref num
this->var_i16_e20 = this->var_i16_f2c;
- if (this->var_str_e22 == _zbasic->str(130)) {
+ if (this->var_str_e22.empty()) { // was: str(130)
this->sub_129_004();
}
// 129:058c
- if (this->var_str_e22 == _zbasic->str(131)) {
+ if (this->var_str_e22.empty()) { // was: str(131)
for (this->var_i16_f2e = 1; this->var_i16_f2e < 0x3e8; this->var_i16_f2e++) {
- this->var_str_f30 = _zbasic->files(-this->var_i16_f2e, _zbasic->str(132), Common::U32String(), this->var_i16_e20);
- if ((this->var_i16_e20 == 0) || (this->var_str_f30 == _zbasic->str(133))) {
+ this->var_str_f30 = _zbasic->files(-this->var_i16_f2e, Common::U32String(), Common::U32String(), this->var_i16_e20); // was: str(132)
+ if ((this->var_i16_e20 == 0) || (this->var_str_f30.empty())) { // was: str(133)
this->var_i16_f2e = 0x3e8;
}
// 129:0606
this->sub_129_004();
- if (this->var_str_e22 != _zbasic->str(134)) {
+ if (!this->var_str_e22.empty()) { // was: str(134)
this->var_i16_f2e = 0x3e8;
}
}
}
// 129:0636
- if (this->var_str_e22 == _zbasic->str(135)) {
+ if (this->var_str_e22.empty()) { // was: str(135)
do {
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcBic);
fillRect(0x17, 0x92, 0x31, 0x16e, 2);
this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
@@ -2968,7 +2785,7 @@ void FoolGame::sub_129_068() {
}
this->var_str_e22 = this->var_str_588;
this->var_i16_f22 = this->var_i16_688;
- } while (this->var_str_e22 != _zbasic->str(139));
+ } while (this->var_str_e22 != Common::U32String("Fool's Puzzles")); // was: str(139)
}
// 129:0718
this->sub_128_64c(this->var_i16_f22);
@@ -3005,8 +2822,7 @@ void FoolGame::sub_129_068() {
// 129:091a
this->var_i32_692 = g_toolbox->TickCount();
- this->var_i16_68a = 0x28;
- this->sub_129_123a();
+ this->menuLoadingMessage(40);
// load sun's map tiles
//byte fakePal[768];
@@ -3020,8 +2836,7 @@ void FoolGame::sub_129_068() {
g_toolbox->DetachResource(_sunMapTilePic[i]);
}
// 129:097c
- this->var_i16_68a = 0x3c;
- this->sub_129_123a();
+ this->menuLoadingMessage(60);
// wadjet eye
this->var_pic_7c2 = g_toolbox->GetPicture(0x56);
@@ -3032,7 +2847,7 @@ void FoolGame::sub_129_068() {
this->var_i32_c = g_toolbox->GetIcon(0x101);
g_toolbox->DetachResource(this->var_i32_c);
// 129:09c2: SF - 0x8,D0
- _zbasic->openR(1, _zbasic->str(140), 1000, this->var_i16_f22);
+ _zbasic->openR(1, Common::U32String("Fool's Puzzles"), 1000, this->var_i16_f22); // was: str(140)
this->var_i32_1036 = _zbasic->readFileDblInt(1);
this->var_ptr_696 = 0;
@@ -3042,8 +2857,7 @@ void FoolGame::sub_129_068() {
this->var_bytes_696 = this->arr_bytes_5dfc;
// 129:0a0a
- this->var_i16_68a = 0x50;
- this->sub_129_123a();
+ this->menuLoadingMessage(80);
for (int i = 1; i <= 0x64; i++) {
_puzzleDataOffsets[i] = this->puzzlesReadLong();
}
@@ -3156,8 +2970,7 @@ void FoolGame::sub_129_068() {
// 129:0e6e
}
// 129:0e80
- this->var_i16_68a = 0x64;
- this->sub_129_123a();
+ this->menuLoadingMessage(100);
this->var_i16_103a = puzzlesReadShort();
for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
_zbasic->indexRawSet(puzzlesReadString(), 0, i);
@@ -3211,25 +3024,26 @@ void FoolGame::sub_129_068() {
this->var_i16_7b2 = 0xa;
g_toolbox->InitCursor();
this->sub_128_4da(1);
+ // The menus are so different between versions, it's easiest to hardcode the v2.0 ones.
// Apple menu
- _zbasic->menu(1, 0, 1, _zbasic->str(143)); // wadjet eye
- _zbasic->menu(1, 1, 0, _zbasic->str(144)); // sep
- _zbasic->menu(1, 2, 1, _zbasic->str(145)); // about fool's errand
+ _zbasic->menu(1, 0, 1, Common::U32String("~")); // wadjet eye, was: str(143)
+ _zbasic->menu(1, 1, 0, Common::U32String("-"));
+ _zbasic->menu(1, 2, 1, Common::U32String("/FAbout Fool's Errand"));
// this is brand new
_zbasic->menu(1, 3, 1, Common::U32String("Show Prologue"));
- _zbasic->menu(1, 4, 0, _zbasic->str(146)); // sep
+ _zbasic->menu(1, 4, 0, Common::U32String("-"));
// File menu
- _zbasic->menu(2, 0, 1, _zbasic->str(147)); // file
- _zbasic->menu(2, 1, 1, _zbasic->str(148)); // new
- _zbasic->menu(2, 2, 1, _zbasic->str(149)); // open
- _zbasic->menu(2, 3, 1, _zbasic->str(150)); // save
- _zbasic->menu(2, 4, 1, _zbasic->str(151)); // save as
- _zbasic->menu(2, 5, 0, _zbasic->str(152)); // sep
- _zbasic->menu(2, 6, 1, _zbasic->str(153)); // sound
- _zbasic->menu(2, 7, 1, _zbasic->str(154)); // print story
- _zbasic->menu(2, 8, 0, _zbasic->str(155)); // sep
- _zbasic->menu(2, 9, 1, _zbasic->str(156)); // quit
+ _zbasic->menu(2, 0, 1, Common::U32String("File"));
+ _zbasic->menu(2, 1, 1, Common::U32String("/NNew"));
+ _zbasic->menu(2, 2, 1, Common::U32String("/OOpen"));
+ _zbasic->menu(2, 3, 1, Common::U32String("/SSave"));
+ _zbasic->menu(2, 4, 1, Common::U32String("/ASave As"));
+ _zbasic->menu(2, 5, 0, Common::U32String("-"));
+ _zbasic->menu(2, 6, 1, Common::U32String("Sound"));
+ _zbasic->menu(2, 7, 1, Common::U32String("Print Story"));
+ _zbasic->menu(2, 8, 0, Common::U32String("-"));
+ _zbasic->menu(2, 9, 1, Common::U32String("/QQuit"));
this->sub_128_6244();
// 129:11f6
@@ -3247,13 +3061,14 @@ void FoolGame::sub_129_068() {
// SEGMENT_RETURN
}
-void FoolGame::sub_129_123a() {
+void FoolGame::menuLoadingMessage(int16 percent) {
+ // 129:123a
// draw the loading text on the menu bar
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
- this->var_str_172 = Common::U32String::format("%s %d%s", _zbasic->str(158).encode().c_str(), this->var_i16_68a, _zbasic->str(159).encode().c_str());
+ this->var_str_172 = Common::U32String::format("Loading Game - %d%%", percent); // was: str(158)
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xe);
g_toolbox->DrawString(this->var_str_172);
@@ -3263,57 +3078,6 @@ void FoolGame::sub_129_123a() {
}
-// hermit key trace
-void FoolGame::hermitRun() {
- // 142:12ac
- if (_puzzleCompletionStatus[0x34] < 5) {
- _zbasic->menu(8, 3, 1, _zbasic->str(362)); // to find a hidden secret
- _zbasic->menu(8, 4, 1, _zbasic->str(363));
- } else {
- // 142:12fc
- _zbasic->menu(8, 3, 1, _zbasic->str(364)); // to find the straight path
- _zbasic->menu(8, 4, 1, _zbasic->str(365));
- }
- // 142:132c
- if (_activePuzzleStatus == 0) {
- _hermitPathStage = 1;
- }
- if ((_activePuzzleStatus > 0) && (_activePuzzleStatus < 0x63)) {
- _hermitPathStage = _activePuzzleStatus;
- }
- // 142:1360
- if (_activePuzzleStatus == 0x63) {
- _hermitPathStage = 6;
- }
- if (_activePuzzleStatus == 0x64) {
- _hermitPathStage = 1;
- }
- if (_activePuzzleStatus > 0x64) {
- _hermitPathStage = _activePuzzleStatus - 0x64;
- }
- this->thothKeyLast();
- if (_hermitPathStage == 6) {
- _activePuzzleStatus = 0x63;
- } else {
- if (_activePuzzleStatus < 0x63) {
- // 142:13be
- _activePuzzleStatus = _hermitPathStage;
- if (_activePuzzleSolved) {
- _activePuzzleStatus = 0x64;
- }
- } else {
- // 142:13da
- if (_activePuzzleStatus >= 0x64) {
- _activePuzzleStatus = _hermitPathStage + 0x64;
- if (_activePuzzleSolved) {
- _activePuzzleStatus = 0x65;
- }
- }
- }
- }
- // 142:1404
-}
-
void FoolGame::sub_144_004() {
// 144:0004
g_toolbox->ReleaseResource(var_pic_7c2);
@@ -3376,18 +3140,20 @@ void FoolGame::sub_144_004() {
sub_128_406(1);
}
// 144:0268
- _modalText[0] = _zbasic->str(368); // what's this?
- _modalText[1] = _zbasic->str(369); // more evil treachery afoot?
- _modalText[2] = _zbasic->str(370); // has not the fool has gained the gift of wisdom?
- _modalText[3] = _zbasic->str(371); // -blank-
- _modalText[4] = _zbasic->str(372); // locate and double-click the show finale file
- _modalText[5] = _zbasic->str(373); // this will oepn the 'prologue - finale' once again
- _modalText[6] = _zbasic->str(374); // but now, you'll see the finale
- _modalText[7] = _zbasic->str(375); // -blank-
- _modalText[8] = _zbasic->str(376); // congratulations!
- _modalText[9] = _zbasic->str(377); // -blank-
- _modalText[10] = _zbasic->str(378); // quit
- sub_128_dfe(0xfa, 9, 1, 0);
+ // Every version has a slightly different end message, and all
+ // contain instructions for how to open up the "Show Finale" file.
+ // This also contains a typo which was fixed in the DOS edition.
+ // Easy option: just hardcode the message here
+ // was: str(368)
+ _modalText[0] = Common::U32String("What's this?");
+ _modalText[1] = Common::U32String("More evil treachery afoot?");
+ _modalText[2] = Common::U32String("Has not the fool gained the gift of wisdom?");
+ _modalText[3] = Common::U32String();
+ _modalText[4] = Common::U32String("Congratulations!");
+ _modalText[5] = Common::U32String("And now it is time to show the Finale for the Fool's Errand.");
+ _modalText[6] = Common::U32String();
+ _modalText[6] = Common::U32String("Continue");
+ showChoiceModal(0xfa, 6, 1, 0);
if (!_screenOversized) {
g_toolbox->ClearMenuBar();
g_toolbox->DrawMenuBar();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 0ed5cb5b607..fb7599e7c26 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -60,15 +60,29 @@ enum FoolVersion {
kFool30 = 3,
};
-enum FoolStrOffset {
+enum FoolZStrOffset : uint16 {
+ kOffsetVersion = 0,
+ kOffsetAbout,
+ kOffsetThreeShips,
kOffsetWordSearch,
kOffsetJigsaw,
kOffsetPolyomino,
kOffsetReveal,
+ kOffsetSentence,
kOffsetMaze,
kOffsetMetapuzzle,
kOffsetCards,
kOffsetThoth,
+ kOffsetHumbug,
+ kOffsetJustice,
+};
+
+enum FoolFontID : uint16 {
+ kFontChicago = 0,
+ kFontFool = 250,
+ kFontPuzzle = 251,
+ kFontSmall = 252,
+ kFontLarge = 254,
};
class FoolGame {
@@ -103,7 +117,7 @@ public:
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void getNextEvent(uint32 mask); // sub_128_c6a
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
- void sub_128_dfe(int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount, bool beep); // sub_128_dfe
void sub_128_178a(int16 unk2, int16 unk1);
void setStateBits(uint16 bits); // sub_128_1c2c
@@ -153,12 +167,13 @@ public:
void menuAbout(); // sub_128_4a92
void menuPrologue();
+ // fool_threeships.cpp
void shipsRun(); // sub_128_5140
void sub_128_55ac();
void sub_128_57a2();
void sub_128_5a6c();
- void sub_128_5b30();
+ void onClickMenu(); // sub_128_5b30
void sub_128_5baa();
void sub_128_5c20();
void thothHidePlayfield(); // sub_128_5ef0
@@ -174,7 +189,7 @@ public:
void sub_129_004();
void sub_129_068();
- void sub_129_123a();
+ void menuLoadingMessage(int16 percent); // sub_129_123a
// fool_jumble.cpp:
void jumbleRun();
@@ -272,7 +287,6 @@ public:
void mazeMovePlayer(); // sub_136_a22
void sub_136_ade();
void mazeHotspot(); // sub_136_b00
-
void mazePrintMessage(); // sub_136_d64
void sub_136_e4c();
void sub_136_ed8();
@@ -343,7 +357,6 @@ public:
void metapuzzleOnOption(); // sub_138_b06
void metapuzzleOnShift(); // sub_138_b6a
-
// fool_cards.cpp
void cardsRun(); // sub_139_004
void sub_139_4de();
@@ -435,6 +448,8 @@ public:
private:
FoolVersion _version;
+ const int *_zstrOffset;
+ int _fontChicago;
ZBasic *_zbasic;
bool _quit = false;
@@ -486,8 +501,6 @@ private:
int16 var_i16_7a2;
int16 var_i16_7a8;
int16 var_i16_7aa;
- int16 var_i16_7ac;
- int16 var_i16_7ae;
int16 var_i16_7b0;
int16 var_i16_7b2;
int16 var_i16_7b4;
diff --git a/engines/fool/fool_hermit.cpp b/engines/fool/fool_hermit.cpp
new file mode 100644
index 00000000000..0664937e47a
--- /dev/null
+++ b/engines/fool/fool_hermit.cpp
@@ -0,0 +1,84 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+#define OFF(x) (_zstrOffset[kOffsetHermit] + (x))
+
+extern Toolbox *g_toolbox;
+
+// hermit key trace
+void FoolGame::hermitRun() {
+ // 142:12ac
+ if (_puzzleCompletionStatus[0x34] < 5) {
+ _zbasic->menu(8, 3, 1, _zbasic->str(362)); // to find a hidden secret
+ _zbasic->menu(8, 4, 1, _zbasic->str(363)); // follow each line, correct and true
+ } else {
+ // 142:12fc
+ _zbasic->menu(8, 3, 1, _zbasic->str(364)); // to find the straight path
+ _zbasic->menu(8, 4, 1, _zbasic->str(365)); // follow each line, correct and true
+ }
+ // 142:132c
+ if (_activePuzzleStatus == 0) {
+ _hermitPathStage = 1;
+ }
+ if ((_activePuzzleStatus > 0) && (_activePuzzleStatus < 0x63)) {
+ _hermitPathStage = _activePuzzleStatus;
+ }
+ // 142:1360
+ if (_activePuzzleStatus == 0x63) {
+ _hermitPathStage = 6;
+ }
+ if (_activePuzzleStatus == 0x64) {
+ _hermitPathStage = 1;
+ }
+ if (_activePuzzleStatus > 0x64) {
+ _hermitPathStage = _activePuzzleStatus - 0x64;
+ }
+ this->thothKeyLast();
+ if (_hermitPathStage == 6) {
+ _activePuzzleStatus = 0x63;
+ } else {
+ if (_activePuzzleStatus < 0x63) {
+ // 142:13be
+ _activePuzzleStatus = _hermitPathStage;
+ if (_activePuzzleSolved) {
+ _activePuzzleStatus = 0x64;
+ }
+ } else {
+ // 142:13da
+ if (_activePuzzleStatus >= 0x64) {
+ _activePuzzleStatus = _hermitPathStage + 0x64;
+ if (_activePuzzleSolved) {
+ _activePuzzleStatus = 0x65;
+ }
+ }
+ }
+ }
+ // 142:1404
+}
+
+}
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 16ddbf404f7..f445f3fa7d1 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetHumbug] + (x))
+
extern Toolbox *g_toolbox;
// the humbug - "irritating stick" style challenge
@@ -45,7 +46,7 @@ void FoolGame::humbugRun() {
// 142:004e
_activePuzzleStatus = 0x63;
this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- this->var_str_384 = _zbasic->str(336); // behold the 2nd key of thoth
+ this->var_str_384 = _zbasic->str(OFF(0)); // behold the 2nd key of thoth
this->sub_128_178a(0x17, 0);
}
// 142:00b2
@@ -65,18 +66,18 @@ void FoolGame::humbugRun() {
void FoolGame::humbugTrail() {
// 142:00e6
if (_puzzleCompletionStatus[0x34] < 3) {
- _zbasic->menu(8, 3, 1, _zbasic->str(337)); // A secret is undone
- _zbasic->menu(8, 4, 1, _zbasic->str(338)); // if the two become one.
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(1))); // A secret is undone
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(2))); // if the two become one.
} else {
// 142:0136
- _zbasic->menu(8, 3, 1, _zbasic->str(339)); // A puzzle is undone
- _zbasic->menu(8, 4, 1, _zbasic->str(340)); // if the two become one.
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(3))); // A puzzle is undone
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(4))); // if the two become one.
}
// 142:0166
this->sub_128_271a();
this->sub_128_4da(0);
- _zbasic->text(0, 0xc, 0, kSrcOr);
- this->sub_128_55c(_zbasic->str(341)); // ~
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ this->sub_128_55c(_zbasic->str(OFF(5))); // ~
// eye button
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
for (int16 i = 1; i <= 0xa42; i++) {
@@ -194,13 +195,13 @@ void FoolGame::sub_142_5f2() {
void FoolGame::sub_142_630() {
// 142:0630
- _zbasic->menu(8, 0, 1, _zbasic->str(342)); // the 2nd key of thoth
- _zbasic->menu(8, 1, 1, _zbasic->str(343)); // return to scroll
+ _zbasic->menu(8, 0, 1, _zbasic->str(OFF(6))); // the 2nd key of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(7))); // return to scroll
this->thothKey2nd();
if (_activePuzzleSolved) {
// 142:066e
g_toolbox->PenNormal();
- _zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
for (int16 i = 1; i <= 4; i++) {
Common::Rect temp;
temp.top = this->arr_i16_2f38[i*32];
@@ -220,7 +221,7 @@ void FoolGame::sub_142_630() {
g_toolbox->DrawString(this->var_str_384);
}
// 142:07ca
- _zbasic->text(0, 0xc, 0, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->sub_128_6186();
this->sub_128_2664();
this->var_i16_484 = 0;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index fba0b729a47..784590b5fff 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -28,7 +28,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetJigsaw] + (x))
+
extern Toolbox *g_toolbox;
// jigsaw puzzle game
@@ -97,7 +98,7 @@ void FoolGame::jigsawRun() {
}
// 132:0376
// rearrange picture tiles to match state
- if (!_activePuzzleBuffer.empty()) { // was: str(207)
+ if (!_activePuzzleBuffer.empty()) { // was: str(OFF(0))
for (int i = 1; i <= this->var_i16_1a9e; i++) {
Common::String tileData = _zbasic->midStr(_activePuzzleBuffer, i*2 - 1, 2);
this->arr_i16_3738[i] = _zbasic->decodeInt(tileData);
@@ -377,7 +378,7 @@ void FoolGame::jigsawDropSelected() {
void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
- _activePuzzleBuffer.clear(); // was: str(208)
+ _activePuzzleBuffer.clear(); // was: str(OFF(1))
for (int i = 1; i <= this->var_i16_1a9e; i++) {
_activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_3738[i]);
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index ad121c397b4..56ff0f8b7c6 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -27,7 +27,6 @@
namespace Fool {
-;
extern Toolbox *g_toolbox;
// word jumble/substitute puzzle
@@ -148,8 +147,8 @@ void FoolGame::jumbleRun() {
// 130:03fe
//if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle)
this->var_i16_106e = 0;
- this->var_str_1070 = _zbasic->str(168); // empty
- this->var_str_1170 = _zbasic->str(169); // empty
+ this->var_str_1070.clear(); // was: str(168)
+ this->var_str_1170.clear(); // was: str(169)
this->var_i16_1270 = puzzlesReadShort();
for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
@@ -246,7 +245,7 @@ void FoolGame::jumbleRun() {
this->var_i16_484 = puzzlesReadShort();
this->var_i16_7e4 = puzzlesReadShort();
this->var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
- _zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcOr);
if (this->var_i16_7e4 > 0) {
g_toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
g_toolbox->DrawString(this->var_str_1578);
@@ -257,7 +256,7 @@ void FoolGame::jumbleRun() {
}
// 130:086a
this->var_i16_1678 = 0;
- this->var_str_1578 = _zbasic->str(171);
+ this->var_str_1578.clear(); // was: str(171);
if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
// all puzzles done, load the success animation list
this->arr_i16_4338[0] = puzzlesReadShort();
@@ -296,9 +295,9 @@ void FoolGame::jumbleRun() {
} else {
// 130:0956
if (_activePuzzle <= 0x50) {
- if ((this->var_i16_1678 > 0) && (this->var_str_1578 != _zbasic->str(172))) {
+ if ((this->var_i16_1678 > 0) && (!this->var_str_1578.empty())) { // was: str(172)
// 130:098c
- this->var_str_1578 = _zbasic->str(173);
+ this->var_str_1578.clear(); // was: str(173)
this->sub_130_2226();
}
// 130:09a4
@@ -402,7 +401,7 @@ void FoolGame::sub_130_c66() {
// 130:0c98
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = _jumbleCurrentSubPuzzle;
- if ((_jumbleGameType == 2) && (this->var_str_1578 != _zbasic->str(175))) {
+ if ((_jumbleGameType == 2) && (!this->var_str_1578.empty())) { // was: str(175)
_activePuzzleBuffer = this->var_str_1070 + _zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
} else {
// 130:0cfe
@@ -438,7 +437,7 @@ void FoolGame::sub_130_d2e() {
void FoolGame::sub_130_d90() {
// 130:0d90
// substitution cipher
- if (_zbasic->index(1, 1) != _zbasic->str(177)) {
+ if (!_zbasic->index(1, 1).empty()) { // was: str(177)
if (this->var_str_1070.size() == this->var_str_1170.size()) {
this->var_i16_1372 = _zbasic->index(1, 1).size();
this->var_str_1578 = _zbasic->space(this->var_i16_1372);
@@ -464,12 +463,12 @@ void FoolGame::sub_130_d90() {
}
// 130:0f24
- this->var_str_1578 += _zbasic->str(178) + _zbasic->index(1, 1); // ABC = XYZ
- this->var_i16_167a = _zbasic->instr(1, this->var_str_1578, _zbasic->str(179));
+ this->var_str_1578 += Common::U32String(" = ") + _zbasic->index(1, 1); // ABC = XYZ
+ this->var_i16_167a = _zbasic->instr(1, this->var_str_1578, Common::U32String("=")); // was: str(179)
this->sub_130_2226();
} else {
// 130:0f72
- this->var_str_1578 = _zbasic->str(180);
+ this->var_str_1578.clear(); // was: str(180);
}
// 130:0f86
this->var_i16_106e = 1;
@@ -497,7 +496,7 @@ void FoolGame::sub_130_d90() {
void FoolGame::sub_130_1004() {
// 130:1004
- this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, _zbasic->str(181));
+ this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(181)
if (this->var_i16_106e == 0) {
this->var_i16_106e = 1;
}
@@ -552,7 +551,7 @@ void FoolGame::sub_130_10a6() {
void FoolGame::sub_130_1282() {
// 130:1282
// hidden message, change the mouse cursor
- this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, _zbasic->str(182));
+ this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(182)
if (this->var_i16_106e == 0) {
this->var_i16_106e = 1;
}
@@ -602,7 +601,7 @@ void FoolGame::sub_130_1426() {
// 130:1426
this->var_i16_187e = 0;
this->var_i16_1880 = 0;
- if (_zbasic->index(1, 1) != _zbasic->str(183)) {
+ if (!_zbasic->index(1, 1).empty()) { // was: str(183)
this->var_i16_1678 = 1;
this->var_str_1578 = _zbasic->index(1, 1);
this->sub_130_2226();
@@ -793,7 +792,7 @@ void FoolGame::sub_130_1a16() {
// 130:1b2e
}
// 130:1b40
- if (this->var_str_1578 != _zbasic->str(184)) { // blank
+ if (!this->var_str_1578.empty()) { // was: str(184)
for (int16 i = 1; i <= this->var_i16_167a - 2; i++) {
this->var_str_d12 = _zbasic->midStr(this->var_str_1578, i, 1);
if ((this->var_str_d12 == this->var_str_1374) || (this->var_str_d12 == this->var_str_1474)) {
@@ -852,7 +851,7 @@ void FoolGame::sub_130_1c6c() {
void FoolGame::sub_130_1dcc() {
// 130:1dcc
- _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ _zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
g_toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
_screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
@@ -879,7 +878,7 @@ void FoolGame::sub_130_1e76() {
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
g_toolbox->FillRect(temp, _patterns[this->var_i16_105e]);
- _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ _zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
// 130:1f70
g_toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
@@ -955,7 +954,7 @@ void FoolGame::sub_130_2178() {
return;
this->var_i16_1678 = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
- if (_zbasic->index(1, this->var_i16_1678) != _zbasic->str(185)) { // empty
+ if (!_zbasic->index(1, this->var_i16_1678).empty()) { // was: str(185)
this->var_str_1578 = _zbasic->index(1, this->var_i16_1678);
this->sub_130_2226();
}
@@ -982,10 +981,10 @@ void FoolGame::sub_130_2226() {
}
// 130:2266
this->fillRect(0x124, 0x64, 0x139, 0x1ef, 0);
- if (this->var_str_1578 == _zbasic->str(186)) // blank
+ if (this->var_str_1578.empty()) // was: str(186)
return;
// 130:22a0
- _zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcOr);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1578);
g_toolbox->MoveTo(0x127 - (this->var_i16_484 / 2), 0x133);
g_toolbox->DrawString(this->var_str_1578);
@@ -994,9 +993,9 @@ void FoolGame::sub_130_2226() {
void FoolGame::sub_130_22ee() {
// 130:22ee
this->fillRect(0x131, 0x84, 0x156, 0x17e, this->var_i16_1060);
- if (this->var_str_1578 == _zbasic->str(187)) // blank
+ if (this->var_str_1578.empty()) // was: str(187)
return;
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x13c, 0xf6 - (this->var_i16_7ba / 2), 0x150, 0x10a + (this->var_i16_7ba / 2), 2);
g_toolbox->MoveTo(0x100 - (this->var_i16_7ba / 2), 0x14a);
@@ -1006,9 +1005,9 @@ void FoolGame::sub_130_22ee() {
void FoolGame::sub_130_23cc() {
// 130:23cc
this->fillRect(0x12c, 0x8c, 0x156, 0x186, this->var_i16_1060);
- if (this->var_str_1578 == _zbasic->str(188))
+ if (this->var_str_1578.empty()) // was: str(188)
return;
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x130, 0x100 - (this->var_i16_7ba / 2), 0x144, 0x114 + (this->var_i16_7ba / 2), 2);
g_toolbox->MoveTo(0x10a - (this->var_i16_7ba / 2), 0x13e);
@@ -1018,9 +1017,9 @@ void FoolGame::sub_130_23cc() {
void FoolGame::sub_130_24aa() {
// 130:24aa
this->fillRect(0x125, 0x20, 0x136, 0x15e, 2);
- if (this->var_str_1578 == _zbasic->str(189)) // blank
+ if (this->var_str_1578.empty()) // was: str(189)
return;
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
g_toolbox->MoveTo(0xc4 - (this->var_i16_7ba / 2), 0x131);
g_toolbox->DrawString(this->var_str_1578);
@@ -1028,9 +1027,9 @@ void FoolGame::sub_130_24aa() {
void FoolGame::sub_130_2548() {
// 130:2548
- _zbasic->text(0xfa, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcOr);
this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
- if (this->var_str_1578 == _zbasic->str(190)) // blank
+ if (this->var_str_1578.empty()) // was: str(190)
return;
this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index e898c499596..3f58d2240ca 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetJustice] + (x))
+
extern Toolbox *g_toolbox;
// justice - lights on
@@ -47,14 +48,14 @@ void FoolGame::justiceRun() {
// 142:08a2
this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
_activePuzzleStatus = 0x63;
- this->var_str_384 = _zbasic->str(345); // behold the 3rd key of thoth
+ this->var_str_384 = _zbasic->str(OFF(0)); // behold the 3rd key of thoth
this->sub_128_178a(0x3f, 1);
}
}
// 142:0906
if (_activePuzzleStatus == 0x63) {
- _zbasic->menu(8, 0, 1, _zbasic->str(346)); // the 3rd key of thoth
- _zbasic->menu(8, 1, 1, _zbasic->str(347)); // return to scroll
+ _zbasic->menu(8, 0, 1, _zbasic->str(OFF(1))); // the 3rd key of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(2))); // return to scroll
this->thothKey3rd();
if (_activePuzzleSolved) {
this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
@@ -83,12 +84,12 @@ void FoolGame::sub_142_9be() {
}
// 142:09ea
if (_puzzleCompletionStatus[0x34] < 4) {
- _zbasic->menu(8, 3, 1, _zbasic->str(348)); // a secret hides here
- _zbasic->menu(8, 4, 1, _zbasic->str(349)); // if twenty-five appear
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(3))); // a secret hides here
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(4))); // if twenty-five appear
} else {
// 142:0a3a
- _zbasic->menu(8, 3, 1, _zbasic->str(350)); // you will remain here
- _zbasic->menu(8, 4, 1, _zbasic->str(351)); // unless twenty-five appear
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(5))); // you will remain here
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(6))); // unless twenty-five appear
}
// 142:0a6a
this->justiceZoom();
@@ -108,8 +109,8 @@ void FoolGame::sub_142_9be() {
// 142:0adc
this->justiceZoom();
this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
- if (_activePuzzleBuffer.empty()) { // was: str(352)
- _activePuzzleBuffer = (_zbasic->space(0xc) + _zbasic->str(353) + _zbasic->space(0xc)).encode(Common::kMacRoman); // 1
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(7))
+ _activePuzzleBuffer = (_zbasic->space(0xc) + _zbasic->str(OFF(8)) + _zbasic->space(0xc)).encode(Common::kMacRoman); // 1
this->var_i16_233e = 1;
} else {
// 142:0b4c
@@ -120,10 +121,10 @@ void FoolGame::sub_142_9be() {
for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
this->var_i16_103a = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_484, 1));
if ((this->var_i16_103a & 2) == 0) {
- _zbasic->indexSet(_zbasic->str(354), 1, (this->var_i16_484 + 0x19));
+ _zbasic->indexSet(_zbasic->str(OFF(9)), 1, (this->var_i16_484 + 0x19)); // bullet
} else {
// 142:0be0
- _zbasic->indexSet(_zbasic->str(355), 1, (this->var_i16_484 + 0x19));
+ _zbasic->indexSet(_zbasic->str(OFF(10)), 1, (this->var_i16_484 + 0x19)); // wadjet
}
// 142:0c06
if ((this->var_i16_103a & 1) != 0) {
@@ -166,14 +167,14 @@ void FoolGame::justiceOnClick() {
}
// 142:0d56
g_toolbox->InvertRoundRect(_screenGrid[this->var_i16_103a], 0x1e, 0x1e);
- if (_zbasic->index(1, this->var_i16_103a + 0x19) == _zbasic->str(356)) { // \xa5
- _zbasic->indexSet(_zbasic->str(357), 1, this->var_i16_103a + 0x19); // ~
+ if (_zbasic->index(1, this->var_i16_103a + 0x19) == _zbasic->str(OFF(11))) { // bullet
+ _zbasic->indexSet(_zbasic->str(OFF(12)), 1, this->var_i16_103a + 0x19); // wadjet
}
// 142:0dc6
if (this->var_i16_103a == 0xd) { // center button
if (this->var_i16_233e == 0) {
for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- _zbasic->indexSet(_zbasic->str(358), 1, this->var_i16_484 + 0x19); // \xa5
+ _zbasic->indexSet(_zbasic->str(OFF(13)), 1, this->var_i16_484 + 0x19); // bullet
this->arr_i16_3738[this->var_i16_484] = 0;
this->justiceRemoveBlock();
}
@@ -188,7 +189,7 @@ void FoolGame::justiceOnClick() {
}
// 142:0e44
Common::String buffer = _zbasic->indexRaw(1, this->var_i16_103a);
- if (_zbasic->leftStr(buffer, 1) == _zbasic->str(359).encode(Common::kMacRoman)) { // M
+ if (_zbasic->leftStr(buffer, 1) == _zbasic->str(OFF(14)).encode(Common::kMacRoman)) { // M
this->var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(buffer, 2, 2));
this->justiceDrawBlock();
this->var_i16_2340 = 5;
@@ -230,7 +231,7 @@ void FoolGame::justiceDrawBlock() {
g_toolbox->PenNormal();
g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
- _zbasic->text(0, 0xc, 0, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->var_str_384 = _zbasic->index(1, this->var_i16_484 + 0x19);
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
// 142:1056
@@ -254,7 +255,7 @@ void FoolGame::justiceStoreState() {
_activePuzzleBuffer = _zbasic->rightStr(this->var_str_384, 1);
for (int16 i = 1; i <= 0x19; i++) {
this->var_i16_484 = this->arr_i16_3738[i];
- if (_zbasic->index(1, i + 0x19) == _zbasic->str(360)) { // ~
+ if (_zbasic->index(1, i + 0x19) == _zbasic->str(OFF(15))) { // wadjet
this->var_i16_484 |= 2;
this->var_str_384 = _zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
_activePuzzleBuffer += this->var_str_384;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index f82c0f205d3..8ce509abe3b 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetMaze] + (x))
+
extern Toolbox *g_toolbox;
void FoolGame::mazeRun() {
@@ -121,7 +122,7 @@ void FoolGame::mazeRun() {
// 136:05d0
}
// 136:05ec
- if (_activePuzzleBuffer.empty()) { // was: str(223)
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(0))
for (int16 j = 1; j <= arr_i16_1eb8[23]; j++) {
var_str_1ac8 = _zbasic->indexRaw(1, j);
var_i16_1bc8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ac8, 3, 2));
@@ -141,7 +142,7 @@ void FoolGame::mazeRun() {
mazeLoadState();
}
// 136:06b4
- var_str_1578.clear(); // was str(224)
+ var_str_1578.clear(); // was str(OFF(1))
mazeSetupMenu();
sub_136_ade();
_stateFlags = kStateNull;
@@ -375,7 +376,7 @@ void FoolGame::mazeHotspot() {
if (arr_i16_1eb8[22] || var_i16_1bdc) {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
var_i16_1bdc = 0;
- var_str_1578.clear(); // was: str(225)
+ var_str_1578.clear(); // was: str(OFF(2))
}
// 136:0b5e
if ((arr_i16_3738[var_i16_1574] & 0x1000) == 0) { // cell doesn't have hotspot flag
@@ -387,13 +388,13 @@ void FoolGame::mazeHotspot() {
if (debugChannelSet(5, kDebugLoading)) {
Common::hexdump((const byte *)var_str_1ac8.c_str(), var_str_1ac8.size());
}
- var_str_1bde = _zbasic->strRaw(226); // CILTDABRPXMOZSFQGWEJKV
+ var_str_1bde = _zbasic->strRaw(OFF(3)); // CILTDABRPXMOZSFQGWEJKV
// 136:0bd0
var_i16_1cde = 1;
_zbasic->unk_20();
while (var_i16_1cde > 0) {
// 136:0bde
- var_i16_1cde = _zbasic->instr(var_i16_1cde, var_str_1ac8, _zbasic->strRaw(227)); // \xa5\xa5
+ var_i16_1cde = _zbasic->instr(var_i16_1cde, var_str_1ac8, _zbasic->strRaw(OFF(4))); // \xa5\xa5
if (var_i16_1cde > 0) {
// get command ID
for (int16 i = 1; i <= (int16)var_str_1bde.size(); i++) {
@@ -404,9 +405,9 @@ void FoolGame::mazeHotspot() {
}
// 136:0c5e
- var_i16_1ce0 = _zbasic->instr(var_i16_1cde, var_str_1ac8, _zbasic->strRaw(228)); // <<
+ var_i16_1ce0 = _zbasic->instr(var_i16_1cde, var_str_1ac8, _zbasic->strRaw(OFF(5))); // <<
var_str_1ce2 = _zbasic->midStr(var_str_1ac8, var_i16_1cde + 3, var_i16_1ce0 - var_i16_1cde - 3);
- if (_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == _zbasic->strRaw(229)) { // ||
+ if (_zbasic->midStr(var_str_1ac8, var_i16_1ce0 + 2, 2) == _zbasic->strRaw(OFF(6))) { // ||
// 136:0cdc
var_i16_1cde = 0;
} else {
@@ -497,8 +498,8 @@ void FoolGame::mazePrintMessage() {
return;
}
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
- if (!var_str_1ce2.empty()) { // was: str(230)
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ if (!var_str_1ce2.empty()) { // was: str(OFF(7))
+ _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
var_i16_484 = g_toolbox->StringWidth(var_str_1ce2);
fillRect(0x13b, 0xf1 - (var_i16_484 / 2), 0x14f, 0x10f + (var_i16_484 / 2), 2);
var_i16_7a2 = 0x149;
@@ -536,7 +537,7 @@ void FoolGame::sub_136_ed8() {
void FoolGame::mazeWanderingWinds() {
// 136:0f74
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(231)) { // L
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(8))) { // L
var_i16_1de6 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_1de4 = _zbasic->rndInt(var_i16_1de6);
var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_1de4 * 2 + 2, 2));
@@ -544,7 +545,7 @@ void FoolGame::mazeWanderingWinds() {
sub_136_24ae();
}
// 136:0ffc
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(232)) { // A
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(9))) { // A
var_i16_68a = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_68c = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
var_i16_1a96 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 6, 2));
@@ -575,7 +576,7 @@ void FoolGame::mazeWanderingWinds() {
void FoolGame::sub_136_115a() {
warning(__func__);
// 136:115a
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(233)) { // P
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(10))) { // P
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
if (var_i16_1dea == var_i16_1574) {
@@ -587,7 +588,7 @@ void FoolGame::sub_136_115a() {
arr_i16_4338[var_i16_1dea] = var_i16_106e;
}
// 136:11e0
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(234)) { // E
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(11))) { // E
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1dea < 0) {
var_i16_1dea = var_i16_1574;
@@ -602,7 +603,7 @@ void FoolGame::sub_136_115a() {
}
}
// 136:1270
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(235)) { // C
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(12))) { // C
var_i16_1dea = var_i16_1574;
var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1dea == var_i16_1574) {
@@ -615,7 +616,7 @@ void FoolGame::sub_136_115a() {
arr_i16_4338[var_i16_1dea] = var_i16_106e;
}
// 136:12e4
- _zbasic->text(0xfb, 0xc, 0, var_src_1dee);
+ _zbasic->text(kFontPuzzle, 0xc, 0, var_src_1dee);
g_toolbox->MoveTo(
_screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
_screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
@@ -628,14 +629,14 @@ void FoolGame::sub_136_137c() {
warning(__func__);
// 136:137c
var_i16_1df0 = 0;
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(236)) { // I
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(13))) { // I
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (arr_i16_5cbc[var_i16_484] == 0) {
var_i16_1df0 = 1;
}
}
// 136:13d8
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(237)) { // M
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(14))) { // M
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_1de2 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
if (arr_i16_5cbc[var_i16_1de2] < var_i16_1de4) {
@@ -643,14 +644,14 @@ void FoolGame::sub_136_137c() {
}
}
// 136:144e
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(238)) { // B
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(15))) { // B
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df0 = 1;
}
}
// 136:14b2
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(239)) { // L
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(16))) { // L
// 136:14d6
var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (arr_i16_4338[var_i16_484] != var_i16_7e4) {
@@ -658,7 +659,7 @@ void FoolGame::sub_136_137c() {
}
}
// 136:1528
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(240)) { // S
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(17))) { // S
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
for (int16 i = 4; i <= (2*var_i16_484 + 2); i += 2) {
var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, i, 2));
@@ -668,7 +669,7 @@ void FoolGame::sub_136_137c() {
}
}
// 136:15c0
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(241)) { // P
+ if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(18))) { // P
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1bd0 != var_i16_484) {
var_i16_1df0 = 1;
@@ -676,7 +677,7 @@ void FoolGame::sub_136_137c() {
}
// 136:1612
if (var_i16_1df0 != 0) {
- var_i16_1cde = _zbasic->instr(1, var_str_1ac8, _zbasic->strRaw(242)); // ||
+ var_i16_1cde = _zbasic->instr(1, var_str_1ac8, _zbasic->strRaw(OFF(19))); // ||
}
// 136:163a
return;
@@ -1109,16 +1110,16 @@ void FoolGame::mazeSetupMenu() {
// 136:274e
_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
if (_activePuzzle < 0x50) {
- _zbasic->menu(8, 1, 1, _zbasic->str(243)); // return to scroll
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(20))); // return to scroll
} else {
// 136:279a
- _zbasic->menu(8, 1, 1, _zbasic->str(244)); // return to map
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(21))); // return to map
}
// 136:27b2
- _zbasic->menu(8, 2, 0, _zbasic->str(245)); // -
- _zbasic->menu(8, 3, 1, _zbasic->str(246)); // to escape from the maze
- _zbasic->menu(8, 4, 1, _zbasic->str(247)); // use the mouse to maneuver
- _zbasic->menu(8, 5, 1, _zbasic->str(248)); // the white dot to the exit
+ _zbasic->menu(8, 2, 0, _zbasic->str(OFF(22))); // -
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(23))); // to escape from the maze
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(24))); // use the mouse to maneuver
+ _zbasic->menu(8, 5, 1, _zbasic->str(OFF(25))); // the white dot to the exit
if (_activePuzzle == 0x57) {
// 136:281c
var_i16_103a = 7;
@@ -1126,28 +1127,28 @@ void FoolGame::mazeSetupMenu() {
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
if ((arr_i16_5cbc[i] > 0) &&
- (_zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(249)) > 0)) {
+ (_zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(OFF(26))) > 0)) {
if (var_i16_103a == 7) {
- _zbasic->menu(8, 6, 0, _zbasic->str(250)); // -
- _zbasic->menu(8, 7, 1, _zbasic->str(251)); // you have acquired
+ _zbasic->menu(8, 6, 0, _zbasic->str(OFF(27))); // -
+ _zbasic->menu(8, 7, 1, _zbasic->str(OFF(28))); // you have acquired
}
// 136:28b4
- var_i16_1dea = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(252)); // ++
- var_i16_1de8 = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(253)); // \xa5\xa5
+ var_i16_1dea = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(OFF(29))); // ++
+ var_i16_1de8 = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(OFF(30))); // \xa5\xa5
var_str_1e08 = _zbasic->midStr(_zbasic->index(1, i), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
- if (_zbasic->leftStr(var_str_1e08, 1) == _zbasic->str(254)) { // +
+ if (_zbasic->leftStr(var_str_1e08, 1) == _zbasic->str(OFF(31))) { // +
// 136:2964
var_i16_484 = var_str_1e08.size();
var_str_1e08 = _zbasic->rightStr(var_str_1e08, var_i16_484 - 1);
}
// 136:298e
var_str_384 = Common::U32String::format(" %d", arr_i16_5cbc[i]);
- var_str_384 = _zbasic->space(4 - var_str_384.size()) + var_str_384 + _zbasic->str(255) + var_str_1e08; // ' '
+ var_str_384 = _zbasic->space(4 - var_str_384.size()) + var_str_384 + _zbasic->str(OFF(32)) + var_str_1e08; // ' '
if (arr_i16_5cbc[i] > 1) {
- var_str_384 += _zbasic->str(256); // s
+ var_str_384 += _zbasic->str(OFF(33)); // s
}
// 136:2a2a
- var_str_384 += _zbasic->str(257); // ' '
+ var_str_384 += _zbasic->str(OFF(34)); // ' '
var_i16_103a++;
_zbasic->menu(8, var_i16_103a, 1, var_str_384);
}
@@ -1262,7 +1263,7 @@ void FoolGame::mazeStoreState() {
// 136:2f5c
// for the endgame maze, there's specific code to not save the puzzle state
if (!((_activePuzzle != 0x57) && (!_activePuzzleSolved))) {
- _activePuzzleBuffer.clear(); // was: str(258)
+ _activePuzzleBuffer.clear(); // was: str(OFF(35))
return;
}
_activePuzzleBuffer = _zbasic->encodeInt(_mazePlayerX) +
@@ -1424,7 +1425,7 @@ void FoolGame::mazeLoadState() {
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
if (var_i16_1de4 > 0) {
- _zbasic->text(0xfb, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontPuzzle, 0xc, 0, kSrcBic);
for (int16 i = 1; i <= var_i16_1de4; i++) {
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 446bd0ca314..8a32d6f7a94 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -28,7 +28,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetMetapuzzle] + (x))
+
extern Toolbox *g_toolbox;
// sun's map metapuzzle
@@ -183,13 +184,13 @@ void FoolGame::sub_138_21e() {
void FoolGame::metapuzzleSetupMenu() {
// 138:03e0
- _zbasic->menu(8, 0, 1, _zbasic->str(260)); // the sun's map
- _zbasic->menu(8, 1, 1, _zbasic->str(261)); // return to scroll
- _zbasic->menu(8, 2, 0, _zbasic->str(262)); // -
+ _zbasic->menu(8, 0, 1, _zbasic->str(OFF(0))); // the sun's map
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(1))); // return to scroll
+ _zbasic->menu(8, 2, 0, _zbasic->str(OFF(2))); // -
var_i16_484 = 2;
for (int16 i = _puzzleMenuInstructions[0x30]; i <= _puzzleMenuInstructions[0x30+1]; i++) {
var_i16_484++;
- var_str_384 = _zbasic->index(0, i) + _zbasic->str(263); // ' '
+ var_str_384 = _zbasic->index(0, i) + _zbasic->str(OFF(3)); // ' '
_zbasic->menu(8, var_i16_484, 1, var_str_384);
}
}
@@ -212,27 +213,27 @@ void FoolGame::metapuzzleSecretCode() {
zoomRect(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
}
if (_activePuzzle == 0x58) {
- var_str_1170 = _zbasic->str(264); // treasure name
+ var_str_1170 = _zbasic->str(OFF(4)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 8;
- _metapuzzleSecretCodeCipher = _zbasic->str(265); // CQHXBMLGPTWIFRYASUVJZNKDOE
+ _metapuzzleSecretCodeCipher = _zbasic->str(OFF(5)); // CQHXBMLGPTWIFRYASUVJZNKDOE
}
// 138:0650
if (_activePuzzle == 0x59) {
- var_str_1170 = _zbasic->str(266); // treasure name
+ var_str_1170 = _zbasic->str(OFF(6)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 0;
- _metapuzzleSecretCodeCipher = _zbasic->str(267); // IEGADHFBCPLNRKQOJMZWTYVUSX
+ _metapuzzleSecretCodeCipher = _zbasic->str(OFF(7)); // IEGADHFBCPLNRKQOJMZWTYVUSX
}
// 138:068a
if (_activePuzzle == 0x5a) {
- var_str_1170 = _zbasic->str(268); // treasure name
+ var_str_1170 = _zbasic->str(OFF(8)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 5;
- _metapuzzleSecretCodeCipher = _zbasic->str(269); // ISDXMRCLHQYWBVPKGOUZTFNJAE
+ _metapuzzleSecretCodeCipher = _zbasic->str(OFF(9)); // ISDXMRCLHQYWBVPKGOUZTFNJAE
}
// 138:06c4
if (_activePuzzle == 0x5b) {
- var_str_1170 = _zbasic->str(270); // treasure name
+ var_str_1170 = _zbasic->str(OFF(10)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 9;
- _metapuzzleSecretCodeCipher = _zbasic->str(271); // ZYXWVUTSRQPONMLKJIHGFEDCBA
+ _metapuzzleSecretCodeCipher = _zbasic->str(OFF(11)); // ZYXWVUTSRQPONMLKJIHGFEDCBA
}
// 138:06fe
arr_i16_1eb8[0] = 0x122;
@@ -245,7 +246,7 @@ void FoolGame::metapuzzleSecretCode() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
g_toolbox->FillRect(temp, _patterns[2]);
- if (_activePuzzleBuffer.empty()) { // was: str(272)
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(11))
metapuzzleSecretCodeReset();
} else {
// 138:0778
@@ -253,7 +254,7 @@ void FoolGame::metapuzzleSecretCode() {
_metapuzzleSecretCodeCount = 0;
var_i16_68a = 1;
for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
- if (_zbasic->midStr(var_str_1272, i, 1) != _zbasic->str(273)) { // ' '
+ if (_zbasic->midStr(var_str_1272, i, 1) != _zbasic->str(OFF(12))) { // ' '
_metapuzzleSecretCodeCount++;
}
// 138:07c2
@@ -300,11 +301,11 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
if (!((_keyLastPressed >= 0x41) && (_keyLastPressed <= 0x5a))) {
return;
}
- _zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
_metapuzzleSecretCodeCount++;
if (_metapuzzleSecretCodeSpaceOffset == _metapuzzleSecretCodeCount) {
if (_zbasic->leftStr(var_str_1170, _metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
- var_str_1272 += _zbasic->str(274); // ' '
+ var_str_1272 += _zbasic->str(OFF(14)); // ' '
}
}
// 138:0946
@@ -321,7 +322,7 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
void FoolGame::sub_138_9c4() {
// 138:09c4
- _zbasic->text(0xfe, 0x18, 0x19, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
Common::Rect temp;
temp.top = arr_i16_1eb8[0];
temp.left = arr_i16_1eb8[1];
@@ -348,11 +349,11 @@ void FoolGame::metapuzzleSecretCodeReset() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
g_toolbox->FillRect(temp, _patterns[2]);
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
var_i16_7a2 = 0x140;
- var_str_384 = _zbasic->str(275); // if you know which is which, enter the letters you wish to switch
+ var_str_384 = _zbasic->str(OFF(15)); // if you know which is which, enter the letters you wish to switch
sub_128_918(var_str_384);
- var_str_1272.clear(); // was: str(276)
+ var_str_1272.clear(); // was: str(OFF(16))
_metapuzzleSecretCodeCount = 0;
}
@@ -423,10 +424,10 @@ void FoolGame::metapuzzleOnShift() {
var_str_384 = _puzzleName[_selectedMenuChapter];
} else {
// 138:0d8a
- var_str_384 = _zbasic->str(277); // the book of thoth
+ var_str_384 = _zbasic->str(OFF(17)); // the book of thoth
}
// 138:0d9e
- _zbasic->text(0, 0xc, 0, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
var_i16_30 = g_toolbox->StringWidth(var_str_384);
g_toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
g_toolbox->DrawString(var_str_384);
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index bb6764ec045..2961239629e 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetPolyomino] + (x))
+
extern Toolbox *g_toolbox;
// polyomino puzzle
@@ -40,7 +41,7 @@ void FoolGame::polyominoRun() {
// 133:003c
this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
// "the completed puzzle will reveal..."
- this->var_str_384 = _zbasic->str(209) + this->var_str_384 + _zbasic->str(210);
+ this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1));
_zbasic->menu(8, 0xf, 1, this->var_str_384);
this->var_i16_484 = 0;
this->var_i16_68c = this->arr_i16_1eb8[8];
@@ -87,7 +88,7 @@ void FoolGame::polyominoRun() {
}
// 133:0228
g_toolbox->SetPort(this->var_i32_f24);
- _zbasic->text(0xfb, 0x18, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontPuzzle, 0x18, Graphics::kMacFontRegular, kSrcOr);
// for each polyomino
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
@@ -117,7 +118,7 @@ void FoolGame::polyominoRun() {
this->arr_i16_47d8[j*8 + 4]
);
// 133:02de
- if (!_activePuzzleBuffer.empty()) { // was: str(211)
+ if (!_activePuzzleBuffer.empty()) { // was: str(OFF(2))
if (j == 1) {
this->var_i16_1aa8 = 1;
}
@@ -516,7 +517,7 @@ void FoolGame::polyominoSuccess() {
void FoolGame::polyominoStoreState() {
// 133:1452
- _activePuzzleBuffer.clear(); // was: str(212)
+ _activePuzzleBuffer.clear(); // was: str(OFF(3))
this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
Common::String val1 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 15188935d25..0142a697145 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -388,14 +388,14 @@ void FoolPrologue::shuffleScanlines() {
void FoolPrologue::sub_128_de2() {
// 128:0de2
- _zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
this->var_str_76 = _zbasic->str(3);
this->drawText(0x151, 0x5);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
- _zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
this->var_str_76 = _zbasic->str(4);
this->drawTextRightAlign(0x154, 0x1fb);
}
@@ -724,7 +724,7 @@ void FoolPrologue::prologueRun() {
g_toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
- _zbasic->text(0xfb, 0x9, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = _zbasic->str(18);
this->drawTextCenterAlign(0x10d, 0x103);
g_toolbox->SetPortBits(this->var_i32_32);
@@ -1192,7 +1192,7 @@ void FoolPrologue::prologueRenderNextText() {
}
}
// 130:0fc8
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->drawText(this->var_i16_180, this->var_i16_176);
}
}
@@ -1310,7 +1310,7 @@ void FoolPrologue::finaleRun() {
// 131:03c0
this->delay(0x1e);
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(22));
_zbasic->bufferFlush(this->var_str_76);
@@ -1506,7 +1506,7 @@ void FoolPrologue::finaleRun() {
this->delay(0x3c);
// 131:0e08
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(23));
_zbasic->bufferFlush(this->var_str_76);
this->drawText(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
@@ -1583,7 +1583,7 @@ void FoolPrologue::finaleRun() {
g_toolbox->MoveTo(0x172, 0x33);
g_toolbox->LineTo(i, 0x14a);
if (i == 0x43) {
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str());
_zbasic->bufferFlush(this->var_str_76);
this->drawTextRightAlign(0x1f4, 0xd2);
@@ -1692,7 +1692,7 @@ void FoolPrologue::finaleRun() {
}
this->delayFromMarker(0x3c);
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(25).c_str());
_zbasic->bufferFlush(this->var_str_76);
this->drawTextRightAlign(0x181, 0x3c);
@@ -1710,7 +1710,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
delay(1);
_zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
var_str_76 = _zbasic->chr(0x22) + _zbasic->str(26); // high priestess!
drawTextRightAlign(0x181, 0x3c);
var_str_76 = _zbasic->str(27); // am I to suffer this fate merely for uncovering
@@ -1735,7 +1735,7 @@ void FoolPrologue::finaleRun() {
sub_128_e1c();
fillRect(0, 0, 0x96, 0x18b, 2);
_zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
var_str_76 = _zbasic->chr(0x22) + _zbasic->str(29); // for if that be true
drawTextRightAlign(0x181, 0x3c);
var_str_76 = _zbasic->str(30); // I wish you had made the challenge more difficult
@@ -1852,7 +1852,7 @@ void FoolPrologue::finaleRun() {
var_str_76 = _zbasic->str(33); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
var_i32_2 = g_toolbox->TickCount();
- _zbasic->text(0xfa, i, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
var_i16_1b6 += i;
drawText(5 + i*2, var_i16_1b6);
delayFromMarker(3);
@@ -1898,7 +1898,7 @@ void FoolPrologue::sub_131_4dc0() {
void FoolPrologue::sub_131_4e48() {
// 131:4e48
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Uh oh . . .
this->var_str_76 += Common::U32String::format("\"%s\"", _zbasic->str(80).c_str());
@@ -1909,7 +1909,7 @@ void FoolPrologue::sub_131_4e48() {
void FoolPrologue::sub_131_4e98() {
// 131:4e98
- _zbasic->text(0xfa, 0xc, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcXor);
this->var_i16_3fc = 0xa0;
// "And so the fool heeded the advice of the magician..."
this->var_str_76 += _zbasic->str(81);
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index a05e58aa294..22d7a8c2e5f 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -33,6 +33,11 @@ namespace Fool {
class ZBasic;
+enum FoolPrologueFontID : uint16 {
+ kPrologueFontFool = 250,
+ kPrologueFontSmall = 251,
+};
+
class FoolPrologue {
public:
FoolPrologue() {}
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 0be61b7d4bf..879ff26f094 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetReveal] + (x))
+
extern Toolbox *g_toolbox;
// mask reveal puzzle
@@ -39,7 +40,7 @@ void FoolGame::revealRun() {
this->arr_i16_1eb8[21] = puzzlesReadShort();
debugC(5, kDebugLoading, "%d, %d, %04x", this->arr_i16_1eb8[15], this->arr_i16_1eb8[16], this->arr_i16_1eb8[21]);
this->var_str_384 = puzzlesReadString();
- this->var_str_384 = _zbasic->str(213) + this->var_str_384 + _zbasic->str(214);
+ this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1));
_zbasic->menu(8, 6, 1, this->var_str_384);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
this->arr_i16_3738[i] = puzzlesReadByte();
@@ -80,7 +81,7 @@ void FoolGame::revealRun() {
// 134:02f0
this->arr_i16_1eb8[19] = _zbasic->decodeInt(_activePuzzleBuffer);
this->var_i16_1aba = this->arr_i16_1eb8[18];
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
this->playTone(
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 5b85a376e87..4507df288a5 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -27,7 +27,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetSentence] + (x))
+
extern Toolbox *g_toolbox;
// sentence join game
@@ -55,7 +56,7 @@ void FoolGame::sentenceRun() {
_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
- this->var_str_384 = _zbasic->str(215) + this->var_str_384 + _zbasic->str(216); // to reveal XXXXX
+ this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1)); // to reveal XXXXX
// 135:0152
_zbasic->menu(8, 7, 1, this->var_str_384);
this->arr_i16_1eb8[1] = 0x1c2 / this->arr_i16_1eb8[0];
@@ -84,7 +85,7 @@ void FoolGame::sentenceRun() {
this->arr_i16_1eb8[4] = 0;
for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
// 135:03a4
- if (_activePuzzleBuffer.empty()) { // was: str(217)
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(2))
this->arr_i16_4338[this->var_i16_68a] = 1;
} else {
// 135:03d4
@@ -99,7 +100,7 @@ void FoolGame::sentenceRun() {
// 135:044a
}
// 135:0466
- if (_activePuzzleBuffer.empty()) { // was: str(218)
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(3))
this->var_str_1070 = _zbasic->index(1, 0);
} else {
// 135:049a
@@ -194,9 +195,9 @@ void FoolGame::sub_135_5b6() {
if (this->var_i16_484 != 0) {
return;
}
- _zbasic->text(0, 0xc, 0, kSrcBic);
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcBic);
this->var_i16_7a2 = 0x124;
- this->sub_128_918(_zbasic->str(219)); // click mouse to reset puzzle
+ this->sub_128_918(_zbasic->str(OFF(4))); // click mouse to reset puzzle
this->sub_128_6186();
this->var_i16_1abc = 1;
@@ -251,7 +252,7 @@ void FoolGame::sub_135_86a() {
void FoolGame::sub_135_94c() {
// 135:094c
this->var_i16_484 = this->var_str_1070.size();
- this->var_str_384.clear(); // was: str(220)
+ this->var_str_384.clear(); // was: str(OFF(5))
for (int16 i = this->var_i16_484; i >= 1; i--) {
this->var_str_384 += _zbasic->midStr(this->var_str_1070, i, 1);
}
@@ -273,8 +274,8 @@ void FoolGame::sub_135_9ba() {
void FoolGame::sub_135_a34() {
// 135:0a34
- _zbasic->text(0, 0xc, 0, kSrcOr);
- this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + _zbasic->str(221);
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + _zbasic->str(OFF(6)); // ' '
this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
g_toolbox->FillOval(_screenGrid[this->var_i16_68a], _patterns[0]);
g_toolbox->FrameOval(_screenGrid[this->var_i16_68a]);
@@ -284,7 +285,7 @@ void FoolGame::sub_135_a34() {
void FoolGame::sub_135_b16() {
// 135:0b16
- _zbasic->text(0xfe, 0x18, 0, kSrcOr);
+ _zbasic->text(kFontLarge, 0x18, 0, kSrcOr);
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1070);
if (this->var_i16_484 < this->arr_i16_1eb8[4]) {
this->var_i16_484 = this->arr_i16_1eb8[4];
@@ -302,7 +303,7 @@ void FoolGame::sub_135_b16() {
void FoolGame::sub_135_c1c() {
// 135:0c1c
- _activePuzzleBuffer.clear(); // was: str(222)
+ _activePuzzleBuffer.clear(); // was: str(OFF(7))
if (this->var_i16_1abc != 0) {
this->var_i16_1abc = 0;
return;
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index a21cccba48e..4b789551df5 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -28,7 +28,6 @@
namespace Fool {
-;
extern Toolbox *g_toolbox;
void FoolGame::straightPathRun() {
@@ -71,7 +70,7 @@ void FoolGame::straightPathRun() {
var_str_1272 += _zbasic->index(1, i);
// 143:0276
}
- _zbasic->text(0xfb, arr_i16_1eb8[14], 0, kSrcOr);
+ _zbasic->text(kFontPuzzle, arr_i16_1eb8[14], 0, kSrcOr);
_zbasic->unk_20();
// 143:02b6
for (int16 j = 0; j <= arr_i16_1eb8[1]; j++) {
@@ -187,7 +186,7 @@ void FoolGame::straightPathReset() {
void FoolGame::straightPathDrawText() {
// 143:0864
straightPathClearText();
- _zbasic->text(0xfe, 0x18, 0x18, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x18, kSrcBic);
var_i16_7a2 = 0x148;
sub_128_918(_activePuzzleBuffer);
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 3708fca08c3..cde6c732da9 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -26,7 +26,6 @@
namespace Fool {
-;
extern Toolbox *g_toolbox;
// The Sun's map
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 9d11e99b396..c949d20540a 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -26,7 +26,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetThoth] + (x))
+
extern Toolbox *g_toolbox;
// high priestess challenge
@@ -72,7 +73,7 @@ void FoolGame::highPriestessRun() {
// is the humbug marked with the wadjet eye? if so, unmark
// 140:00ce
_puzzleCompletionStatus[0x17] = 0x64;
- this->var_str_384 = _puzzleName[0x17] + _zbasic->str(301); // ' '
+ this->var_str_384 = _puzzleName[0x17] + _zbasic->str(OFF(0)); // ' '
_zbasic->menu(0x4, 0x7, 0x1, this->var_str_384);
}
}
@@ -86,7 +87,7 @@ void FoolGame::highPriestessRun() {
if (_puzzleCompletionStatus[0x3f] == 0x63) {
// is justice marked with the wadjet eye? if so, unmark
_puzzleCompletionStatus[0x3f] = 0x64;
- this->var_str_384 = _puzzleName[0x3f] + _zbasic->str(302); // ' '
+ this->var_str_384 = _puzzleName[0x3f] + _zbasic->str(OFF(1)); // ' '
_zbasic->menu(6, 0xf, 1, this->var_str_384);
}
}
@@ -103,7 +104,7 @@ void FoolGame::highPriestessRun() {
if (_puzzleCompletionStatus[0x48] == 0x63) {
// is the hermit marked with the wadjet eye? if so, unmark
_puzzleCompletionStatus[0x48] = 0x64;
- this->var_str_384 = _puzzleName[0x48] + _zbasic->str(303);
+ this->var_str_384 = _puzzleName[0x48] + _zbasic->str(OFF(2)); // ' '
_zbasic->menu(7, 8, 1, this->var_str_384);
}
}
@@ -158,13 +159,13 @@ void FoolGame::highPriestessRun() {
}
}
// 140:03f0
- _zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
this->var_i16_7a2 = 0x96;
- this->sub_128_918(_zbasic->str(304)); // you cannot claim
+ this->sub_128_918(_zbasic->str(OFF(3))); // you cannot claim
this->var_i16_7a2 = 0xb9;
- this->sub_128_918(_zbasic->str(305)); // the book of thoth
+ this->sub_128_918(_zbasic->str(OFF(4))); // the book of thoth
this->var_i16_7a2 = 0xdc;
- this->sub_128_918(_zbasic->str(306)); // so easily
+ this->sub_128_918(_zbasic->str(OFF(5))); // so easily
g_toolbox->SetPort(this->var_i32_0);
this->sub_128_61c2();
}
@@ -177,7 +178,7 @@ void FoolGame::highPriestessRun() {
void FoolGame::thoth99Enchantments() {
// 140:0458
this->sub_128_4da(0);
- if (_activePuzzleBuffer.empty()) { // was: str(307)
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(6))
this->arr_i16_1eb8[0] = 0x63;
} else {
this->arr_i16_1eb8[0] = _zbasic->decodeInt(_activePuzzleBuffer);
@@ -187,11 +188,11 @@ void FoolGame::thoth99Enchantments() {
this->arr_i16_1eb8[0] = 1;
}
if (this->arr_i16_1eb8[0] == 0x63) {
- _zbasic->text(0xfe, 0x18, 0x10, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
this->var_i16_7a2 = 0xaf;
- this->sub_128_918(_zbasic->str(308)); // you dare to challenge
+ this->sub_128_918(_zbasic->str(OFF(7))); // you dare to challenge
this->var_i16_7a2 = 0xd2;
- this->sub_128_918(_zbasic->str(309)); // the high priestess
+ this->sub_128_918(_zbasic->str(OFF(8))); // the high priestess
this->sub_128_3da(0xb4);
}
// 140:0532
@@ -303,7 +304,7 @@ void FoolGame::thoth99Enchantments() {
// 140:097a
if (_activePuzzleSolved) {
this->sub_140_f84();
- _activePuzzleBuffer.clear(); // was: 310
+ _activePuzzleBuffer.clear(); // was: str(OFF(9))
} else {
// 140:09a4
if (this->arr_i16_1eb8[0] < 1) {
@@ -329,8 +330,8 @@ void FoolGame::thothDrawEnchantment() {
g_toolbox->PenNormal();
g_toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
g_toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
- _zbasic->text(0, 0xc, 0, kSrcOr);
- this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(311)
+ _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(OFF(10))
this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
// 140:0bd2
g_toolbox->MoveTo(
@@ -391,18 +392,18 @@ void FoolGame::thothScrambleScreen() {
void FoolGame::sub_140_e3c() {
// 140:0e3c
if (this->arr_i16_1eb8[0] == 1) {
- _zbasic->menu(8, 0, 1, _zbasic->str(312)); // the last enchantment
- _zbasic->menu(8, 1, 1, _zbasic->str(313)); // run for your life
+ _zbasic->menu(8, 0, 1, _zbasic->str(OFF(11))); // the last enchantment
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(12))); // run for your life
} else {
// 140:0e8a
this->var_str_384 = Common::U32String::format(" %d", this->arr_i16_1eb8[0]);
- this->var_str_9f4 = _zbasic->str(314) + this->var_str_384 + _zbasic->str(315); // the X enchantments
+ this->var_str_9f4 = _zbasic->str(OFF(13)) + this->var_str_384 + _zbasic->str(OFF(14)); // the X enchantments
_zbasic->menu(8, 0, 1, this->var_str_9f4);
- _zbasic->menu(8, 1, 1, _zbasic->str(316)); // run for your life
- _zbasic->menu(8, 2, 1, _zbasic->str(317)); // -
- _zbasic->menu(8, 3, 1, _zbasic->str(318)); // or press each button
- _zbasic->menu(8, 4, 1, _zbasic->str(319)); // in descending order
- this->var_str_9f4 = _zbasic->str(320) + this->var_str_384 + _zbasic->str(321); // from X to 1
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(15))); // run for your life
+ _zbasic->menu(8, 2, 1, _zbasic->str(OFF(16))); // -
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(17))); // or press each button
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(18))); // in descending order
+ this->var_str_9f4 = _zbasic->str(OFF(19)) + this->var_str_384 + _zbasic->str(OFF(20)); // from X to 1
_zbasic->menu(8, 5, 1, this->var_str_9f4);
}
// 140:0f82
@@ -481,7 +482,7 @@ void FoolGame::thothKey1st() {
_activePuzzleSolved = false;
} else {
// 140:1446
- this->var_str_384 = _zbasic->str(322); // behold ye the book of thoth
+ this->var_str_384 = _zbasic->str(OFF(21)); // behold ye the book of thoth
this->sub_128_178a(0, 0);
this->sub_140_2f92();
this->var_i16_7ce ^= 2;
@@ -1082,7 +1083,7 @@ void FoolGame::hermitScreenBehold() {
} else {
// 140:290c
this->zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
- this->var_str_384 = _zbasic->str(323); // behold the last key of thoth
+ this->var_str_384 = _zbasic->str(OFF(22)); // behold the last key of thoth
this->sub_128_178a(0x48, 2);
}
// 140:2966
@@ -1225,22 +1226,22 @@ void FoolGame::thothKeyLastSetup() {
}
// 140:2f2e
if ((_hermitPathStage == 6) && (_activePuzzle != 0x34)) {
- _zbasic->menu(8, 0, 1, _zbasic->str(324)); // the last key of thoth
- _zbasic->menu(8, 1, 1, _zbasic->str(325)); // return to scroll
+ _zbasic->menu(8, 0, 1, _zbasic->str(OFF(23))); // the last key of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(24))); // return to scroll
}
this->copyScreen(0, this->arr_bmp_b3ec);
}
void FoolGame::sub_140_2f92() {
// 140:2f92
- _zbasic->menu(8, 0, 1, _zbasic->str(326)); // the book of thoth
- _zbasic->menu(8, 1, 1, _zbasic->str(327)); // return to scroll
- _zbasic->menu(8, 2, 0, _zbasic->str(328)); // -
- _zbasic->menu(8, 3, 1, _zbasic->str(329)); // be forewarned
- _zbasic->menu(8, 4, 1, _zbasic->str(330)); // the high priestess has corrupted
- _zbasic->menu(8, 5, 1, _zbasic->str(331)); // the book of thoth. you may need
- _zbasic->menu(8, 6, 1, _zbasic->str(332)); // the help of others to unlock its
- _zbasic->menu(8, 7, 1, _zbasic->str(333)); // secrets.
+ _zbasic->menu(8, 0, 1, _zbasic->str(OFF(25))); // the book of thoth
+ _zbasic->menu(8, 1, 1, _zbasic->str(OFF(26))); // return to scroll
+ _zbasic->menu(8, 2, 0, _zbasic->str(OFF(27))); // -
+ _zbasic->menu(8, 3, 1, _zbasic->str(OFF(28))); // be forewarned
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(29))); // the high priestess has corrupted
+ _zbasic->menu(8, 5, 1, _zbasic->str(OFF(30))); // the book of thoth. you may need
+ _zbasic->menu(8, 6, 1, _zbasic->str(OFF(31))); // the help of others to unlock its
+ _zbasic->menu(8, 7, 1, _zbasic->str(OFF(32))); // secrets.
}
Common::Rect FoolGame::thothRandomSquare() {
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
new file mode 100644
index 00000000000..c2346a8ff97
--- /dev/null
+++ b/engines/fool/fool_threeships.cpp
@@ -0,0 +1,245 @@
+/* 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 "fool/fool.h"
+#include "fool/fool_game.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+#define OFF(x) (_zstrOffset[kOffsetThreeShips] + (x))
+
+extern Toolbox *g_toolbox;
+
+// three freakin' ships
+void FoolGame::shipsRun() {
+ // 128:5140
+ fillRect(0x127, 0x6c, 0x137, 0x84, 0);
+ this->sub_128_6186();
+ this->sub_128_55c(_zbasic->str(OFF(0))); // "?"
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+
+ fillRect(0x127, 0x6c, 0x137, 0x84, 0);
+
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
+ // 138:51f0
+ this->var_i16_d08 = _zbasic->rndInt(5) + 5;
+ this->var_i16_d0a = _zbasic->rndInt(5) - 0xa;
+ for (int16 i = 0; i <= 5; i++) {
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ this->sub_128_5a6c();
+ }
+ // 128:5274
+ this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
+ this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
+ this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
+ this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+ // 128:530c
+ _activePuzzleSolved = false;
+ _keyLastPressed = 0;
+ while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
+ this->getNextEvent(-1);
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_19114) != 0) {
+ this->sub_128_55ac();
+ }
+ // 128:5348
+ this->var_i16_d0e = _event.where.y;
+ this->var_i16_d10 = _event.where.x;
+ if (_keyLastPressed > 0) {
+ this->sub_128_57a2();
+ }
+ if (_stateFlags == kStateSaveGame) {
+ this->saveGame();
+ }
+ }
+ // 128:5396
+ if (_activePuzzleSolved) {
+ this->sub_128_6186();
+ this->playTone(0x14, 0x64, 0);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ _event.where.x += 5;
+ _event.where.y -= 5;
+ if (_activePuzzleStatus < 0x64) {
+ g_toolbox->SetCursor(_cursors[0x10]);
+ }
+ for (int16 i = 1; i <= 1; i++) {
+ // 128:541c
+ this->arr_i16_4758[0] = _event.where.y;
+ this->arr_i16_4758[1] = _event.where.x;
+ this->arr_i16_4758[2] = _event.where.y;
+ this->arr_i16_4758[3] = _event.where.x;
+ for (int16 j = 1; j <= 0x19; j++) {
+ // 128:5462
+ this->arr_i16_4758[0]--;
+ this->arr_i16_4758[1]--;
+ this->arr_i16_4758[2]++;
+ this->arr_i16_4758[3]++;
+ Common::Rect temp;
+ temp.top = this->arr_i16_4758[0];
+ temp.left = this->arr_i16_4758[1];
+ temp.bottom = this->arr_i16_4758[2];
+ temp.right = this->arr_i16_4758[3];
+ g_toolbox->InvertOval(temp);
+ }
+ }
+ // 128:5514
+ this->sub_128_3da(0x3c);
+ if (_activePuzzleStatus < 0x64) {
+ // 128:5526
+ this->sub_128_6186();
+ _activePuzzleStatus = 0x64;
+ this->var_i16_7ce |= 2;
+ this->zoomRect(
+ _event.where.y - 5,
+ _event.where.x - 5,
+ _event.where.y + 5,
+ _event.where.x + 5,
+ 0x14,
+ 0,
+ SCREEN_HEIGHT,
+ SCREEN_WIDTH,
+ 2,
+ kPatCopy,
+ 0x42
+ );
+ this->var_str_384 = _zbasic->str(OFF(1)); // behold the 1st key of thoth
+ this->sub_128_178a(0, 0);
+ }
+ // 128:55aa
+ }
+ // 128:55aa
+ return;
+}
+
+void FoolGame::sub_128_55ac() {
+ // 128:55ac
+ if ((this->var_i16_d10 == _event.where.x) && (this->var_i16_d0e == _event.where.y)) {
+ return;
+ }
+ this->var_i16_d08 = _zbasic->rndInt(5) + 5;
+ this->var_i16_d0a = _zbasic->rndInt(5) + 5;
+ if (_zbasic->maybe()) {
+ this->var_i16_d08 *= -1;
+ }
+ // 128:560a
+ if (_zbasic->maybe()) {
+ this->var_i16_d0a *= -1;
+ }
+ // 128:5620
+ if (this->arr_rect_1910c.top < 0x50) {
+ this->var_i16_d0a = 0xa;
+ }
+ // 128:5640
+ if (this->arr_rect_1910c.left < 0x3c) {
+ this->var_i16_d08 = 0xa;
+ }
+ if (this->arr_rect_1910c.bottom > 0x104) {
+ this->var_i16_d0a = -0xa;
+ }
+ if (this->arr_rect_1910c.right > 0x1a4) {
+ this->var_i16_d08 = -0xa;
+ }
+ // 128:56a0
+ for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ this->sub_128_5a6c();
+ }
+ // 128:5708
+ this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
+ this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
+ this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
+ this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+
+}
+
+void FoolGame::sub_128_57a2() {
+ // 128:57a2
+ this->var_str_d12 = _zbasic->ucase(_zbasic->chr(_keyLastPressed));
+ if (_zbasic->instr(1, _zbasic->str(OFF(2)), this->var_str_d12) > 0) { // NESW
+ // 128:57e0
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ this->var_i16_d08 = 0;
+ this->var_i16_d0a = 0;
+ if (this->var_str_d12 == _zbasic->str(OFF(3))) { // N
+ this->var_i16_d0a = -0x10;
+ }
+ if (this->var_str_d12 == _zbasic->str(OFF(4))) { // S
+ this->var_i16_d0a = 0x10;
+ }
+ if (this->var_str_d12 == _zbasic->str(OFF(5))) { // W
+ this->var_i16_d08 = -0x18;
+ }
+ if (this->var_str_d12 == _zbasic->str(OFF(6))) { // E
+ this->var_i16_d08 = 0x18;
+ }
+ g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ this->var_i16_d08 = 0;
+ this->var_i16_d0a = 0;
+ // 128:58c2
+ if (this->arr_rect_1910c.top < 0x14) {
+ this->arr_rect_1910c.top = 0x146;
+ this->arr_rect_1910c.bottom = SCREEN_HEIGHT;
+ }
+ if (this->arr_rect_1910c.left < 0) {
+ this->arr_rect_1910c.left = 0x1e8;
+ this->arr_rect_1910c.right = SCREEN_WIDTH;
+ }
+ // 128:592e
+ if (this->arr_rect_1910c.bottom > SCREEN_HEIGHT) {
+ this->arr_rect_1910c.top = 0x14;
+ this->arr_rect_1910c.bottom = 0x24;
+ }
+ if (this->arr_rect_1910c.right > SCREEN_WIDTH) {
+ this->arr_rect_1910c.left = 0;
+ this->arr_rect_1910c.right = 0x18;
+ }
+ this->sub_128_5a6c();
+ if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ _activePuzzleSolved = true;
+ }
+ }
+ // 128:59cc
+ _keyLastPressed = 0;
+ this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
+ this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
+ this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
+ this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+
+}
+
+void FoolGame::sub_128_5a6c() {
+ // 128:5a6c
+ this->var_i32_692 = g_toolbox->TickCount();
+ _zbasic->get(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_rect_1910c.right, this->arr_rect_1910c.bottom, this->arr_bmp_bbbc);
+ //warning("sub_128_5a6c: bbbc surface");
+ //byte fakePal[768];
+ //Common::fill(fakePal, fakePal+3, 0xff);
+ //Common::fill(fakePal+3, fakePal+768, 0x00);
+ //this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
+ g_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
+ _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
+ this->sub_128_406(0);
+}
+
+}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index d4be13f76cd..dcbadc083ee 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -27,7 +27,8 @@
namespace Fool {
-;
+#define OFF(x) (_zstrOffset[kOffsetWordSearch] + (x))
+
extern Toolbox *g_toolbox;
// word search game
@@ -68,7 +69,7 @@ void FoolGame::wordSearchRun() {
// 131:01b6
// total hidden word count
this->var_i16_198e = puzzlesReadShort();
- if (_activePuzzleBuffer.empty()) { // was: str(191)
+ if (_activePuzzleBuffer.empty()) { // was: str(OFF(0))
_activePuzzleBuffer = _zbasic->space(this->var_i16_198e).encode(Common::kMacRoman);
} else {
// 131:01f2
@@ -117,7 +118,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_1992 = 1;
do {
_zbasic->indexSet(puzzlesReadString(), 1, this->var_i16_1992 + this->var_i16_198e);
- _zbasic->indexSet(Common::U32String(), 1, this->var_i16_1992); // was: str(192)
+ _zbasic->indexSet(Common::U32String(), 1, this->var_i16_1992); // was: str(OFF(1))
this->var_i16_484 = 1;
do {
this->var_str_384 = _zbasic->midStr(
@@ -126,7 +127,7 @@ void FoolGame::wordSearchRun() {
1
);
// 131:0418
- if (this->var_str_384 != _zbasic->str(193)) { // ' '
+ if (this->var_str_384 != _zbasic->str(OFF(2))) { // ' '
_zbasic->indexSet(_zbasic->index(1, this->var_i16_1992) + this->var_str_384, 1, this->var_i16_1992);
}
// 131:045c
@@ -141,7 +142,7 @@ void FoolGame::wordSearchRun() {
g_toolbox->PenNormal();
this->var_str_384 = this->var_str_188e;
this->wordSearchDrawFooter();
- _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenMode(kPatBic);
_zbasic->unk_20();
@@ -179,21 +180,21 @@ void FoolGame::wordSearchRun() {
g_toolbox->PenNormal();
if ((this->var_i16_1990 > 0) && (this->var_i16_1990 < this->var_i16_198e)) {
// only X to go
- this->var_str_384 = _zbasic->str(194) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(195);
+ this->var_str_384 = _zbasic->str(OFF(3)) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(OFF(4));
this->wordSearchDrawFooter();
}
// 131:077a
this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_198e);
if (_activePuzzle != 0x50) {
// There are X words hidden below
- this->var_str_384 = _zbasic->str(196) + this->var_str_9f4 + _zbasic->str(197);
+ this->var_str_384 = _zbasic->str(OFF(5)) + this->var_str_9f4 + _zbasic->str(OFF(6));
_zbasic->menu(8, 3, 1, this->var_str_384);
- _zbasic->menu(8, 4, 1, _zbasic->str(198));
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(7)));
} else {
// 131:07f8
- this->var_str_384 = _zbasic->str(199) + this->var_str_9f4 + _zbasic->str(200);
+ this->var_str_384 = _zbasic->str(OFF(8)) + this->var_str_9f4 + _zbasic->str(OFF(9));
_zbasic->menu(8, 3, 1, this->var_str_384);
- _zbasic->menu(8, 4, 1, _zbasic->str(201));
+ _zbasic->menu(8, 4, 1, _zbasic->str(OFF(10)));
}
// 131:084c
_stateFlags = kStateNull;
@@ -220,7 +221,7 @@ void FoolGame::wordSearchRun() {
void FoolGame::wordSearchOnClick() {
// 131:08aa
this->var_i16_1a94 = 0; // length of word selected
- this->var_str_1070.clear(); // was: str(202)
+ this->var_str_1070.clear(); // was: str(OFF(11))
this->var_i16_1a96 = -1;
this->var_i16_1a98 = -1;
@@ -300,12 +301,12 @@ void FoolGame::wordSearchOnClick() {
g_toolbox->PenNormal();
this->var_i16_1990++;
if (this->var_i16_1990 == this->var_i16_198e) {
- this->var_str_384 = _zbasic->str(203); // ' '
+ this->var_str_384 = _zbasic->str(OFF(12)); // ' '
this->wordSearchDrawFooter();
return;
}
// 131:0c64
- this->var_str_384 = _zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + _zbasic->str(204) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(205); // WORD... only X to go
+ this->var_str_384 = _zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + _zbasic->str(OFF(13)) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(OFF(14)); // WORD... only X to go
this->wordSearchDrawFooter();
this->sub_128_6186();
}
@@ -328,14 +329,14 @@ void FoolGame::wordSearchBadSelect() {
void FoolGame::wordSearchDrawFooter() {
// 131:0d22
this->fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->text(0xfa, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
this->var_i16_7a2 = 0x152;
this->sub_128_918(this->var_str_384);
}
void FoolGame::wordSearchStoreState() {
// 131:0d66
- _activePuzzleBuffer.clear(); // was: str(206)
+ _activePuzzleBuffer.clear(); // was: str(OFF(15))
for (int i = 1; i <= this->var_i16_198e; i++) {
this->var_str_384 = Common::U32String::format("%d", this->arr_i16_3738[i]);
_activePuzzleBuffer += _zbasic->rightStr(this->var_str_384, 1);
@@ -376,7 +377,7 @@ void FoolGame::wordSearchSuccess() {
}
// 131:0f52
this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
- _zbasic->text(0xfb, this->arr_i16_1eb8[0xe], 0, kSrcOr);
+ _zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, kSrcOr);
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
if (this->arr_i16_2f38[i*32 + j] != 0) {
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index c99cecececf..f53261aba9b 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
fool_cards.o \
fool_death.o \
fool_game.o \
+ fool_hermit.o \
fool_humbug.o \
fool_jigsaw.o \
fool_jumble.o \
@@ -19,6 +20,7 @@ MODULE_OBJS = \
fool_straightpath.o \
fool_sun.o \
fool_thoth.o \
+ fool_threeships.o \
fool_wordsearch.o \
toolbox.o \
toolbox_fileman.o \
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index c29ea3bde26..d03ae720427 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -79,9 +79,7 @@ void ZBasic::loadProgram(const Common::Path &path) {
warning("ZBasic::loadProgram: could not find SCOT chunk");
return;
}
- // Fool's Errand has an embedded version of Chicago with custom characters
- Graphics::MacFont macFont = Graphics::MacFont(g_engine->_wm._fontMan->getFontIdByName("Chicago"), 12, 0);
- _menu->setFont(g_engine->_wm._fontMan->getFont(&macFont));
+
Common::MemoryReadStream *scot = new Common::MemoryReadStream(scotRes->data(), scotRes->size());
@@ -803,4 +801,9 @@ Common::String ZBasic::indexRaw(int16 table, int16 index) {
return _index[table][index];
}
+void ZBasic::setMenuFont(uint16 font, uint16 size, uint16 slant) {
+ Graphics::MacFont macFont = Graphics::MacFont(font, size, slant);
+ _menu->setFont(g_engine->_wm._fontMan->getFont(&macFont));
+}
+
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 76d6ba1ad55..ff19f9734af 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -305,6 +305,8 @@ public:
void indexRawSet(const Common::String &value, int16 table, int16 index);
Common::U32String index(int16 table, int16 index);
Common::String indexRaw(int16 table, int16 index);
+
+ void setMenuFont(uint16 font, uint16 size, uint16 slant);
};
} // namespace Fool
Commit: 8d60be8474cd30c40f645913b0fd6c9ec4e0a4ac
https://github.com/scummvm/scummvm/commit/8d60be8474cd30c40f645913b0fd6c9ec4e0a4ac
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:28+02:00
Commit Message:
FOOL: Naming cleanup
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jumble.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_sentence.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index d5dbe84fb41..158a63b4905 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -133,8 +133,8 @@ void FoolGame::cardsRun() {
}
}
// 139:04a4
- if (_stateFlags == 2) {
- this->sub_139_4de();
+ if (_stateFlags == kStateUndo) {
+ this->cardsReset();
}
if (_stateFlags == kStateSaveGame) {
this->cardsStoreState();
@@ -151,7 +151,7 @@ void FoolGame::cardsRun() {
}
}
-void FoolGame::sub_139_4de() {
+void FoolGame::cardsReset() {
this->arr_i16_1eb8[5] = 0;
this->arr_i16_1eb8[6] = 0;
this->var_i16_2012 = 0;
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 2b4d285860c..5d986712ead 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -3152,7 +3152,7 @@ void FoolGame::sub_144_004() {
_modalText[4] = Common::U32String("Congratulations!");
_modalText[5] = Common::U32String("And now it is time to show the Finale for the Fool's Errand.");
_modalText[6] = Common::U32String();
- _modalText[6] = Common::U32String("Continue");
+ _modalText[7] = Common::U32String("Continue");
showChoiceModal(0xfa, 6, 1, 0);
if (!_screenOversized) {
g_toolbox->ClearMenuBar();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index fb7599e7c26..1a9db387f50 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -194,7 +194,7 @@ public:
// fool_jumble.cpp:
void jumbleRun();
void sub_130_c56();
- void sub_130_c66();
+ void jumbleStoreState(); // sub_130_c66
void sub_130_d2e();
void sub_130_d90();
void sub_130_1004();
@@ -268,17 +268,17 @@ public:
// fool_sentence.cpp
void sentenceRun(); // sub_135_004
- void sub_135_5b6();
+ void sentenceOnClick(); // sub_135_5b6
void sentenceAddLeft(); // sub_135_7d6
void sentenceAddRight(); // sub_135_7fa
- void sub_135_81e();
- void sub_135_86a();
- void sub_135_94c();
- void sub_135_9ba();
- void sub_135_a34();
- void sub_135_b16();
- void sub_135_c1c();
- void sub_135_cee();
+ void sentenceAddLeftRight(); // sub_135_81e
+ void sentenceReplace(); // sub_135_86a
+ void sentenceReverse(); // sub_135_94c
+ void sentenceUndo(); // sub_135_9ba
+ void sentenceDrawButton(); // sub_135_a34
+ void sentenceDrawBuffer(); // sub_135_b16
+ void sentenceStoreState(); // sub_135_c1c
+ void sentenceSuccess(); // sub_135_cee
// fool_maze.cpp
void mazeRun(); // sub_136_004
@@ -288,43 +288,43 @@ public:
void sub_136_ade();
void mazeHotspot(); // sub_136_b00
void mazePrintMessage(); // sub_136_d64
- void sub_136_e4c();
- void sub_136_ed8();
+ void mazePickUpItem(); // sub_136_e4c
+ void mazeUseItem(); // sub_136_ed8
void mazeWanderingWinds(); // sub_136_f74
- void sub_136_115a();
+ void mazeDrawLetter(); // sub_136_115a
void sub_136_137c();
void sub_136_163c();
void sub_136_1650();
void mazeHiddenDoorOpen(); // sub_136_1756
void mazeHiddenDoorShut(); // sub_136_17a4
void sub_136_1806();
- void sub_136_185a();
- void mazeThornsClearTrigger(); // sub_136_1898
- void sub_136_18f4();
- void sub_136_1932();
+ void mazeSetTrigger(); // sub_136_185a
+ void mazeClearTrigger(); // sub_136_1898
+ void mazePickUpTone(); // sub_136_18f4
+ void mazeFireDemon(); // sub_136_1932
void sub_136_19d2();
- void sub_136_1cf4();
- void sub_136_1ddc();
- void sub_136_1df4();
+ void mazeNoisySprite(); // sub_136_1cf4
+ void mazeDelay(); // sub_136_1ddc
+ void mazeYeetObject(); // sub_136_1df4
void mazeThornsGetScroll(); // sub_136_1e4c
void sub_136_21fa();
void sub_136_2200();
void mazeMovementTrail(); // sub_136_2208
- void sub_136_24ae();
+ void mazeLoadTone(int16 offset); // sub_136_24ae
void mazePlayTone(); // sub_136_2538
- void sub_136_2582();
+ void sub_136_2582(); // sub_136_2582
void mazeDrawPlayer(); // sub_136_2664
void mazeSetupMenu(); // sub_136_274e
- void sub_136_2a7c();
- void sub_136_2b30();
- void sub_136_2be2();
- void sub_136_2c96();
- void sub_136_2d4c(); // sub_136_2d4c
- void sub_136_2dd0();
- void sub_136_2e52();
- void sub_136_2ed6();
+ void mazeAddWallLeft(); // sub_136_2a7c
+ void mazeAddWallTop(); // sub_136_2b30
+ void mazeAddWallRight(); // sub_136_2be2
+ void mazeAddWallBottom(); // sub_136_2c96
+ void mazeDrawWallLeft(); // sub_136_2d4c
+ void mazeDrawWallTop(); // sub_136_2dd0
+ void mazeDrawWallRight(); // sub_136_2e52
+ void mazeDrawWallBottom(); // sub_136_2ed6
void mazeStoreState(); // sub_136_2f5c
void sub_136_3408();
void sub_136_342a();
@@ -359,7 +359,7 @@ public:
// fool_cards.cpp
void cardsRun(); // sub_139_004
- void sub_139_4de();
+ void cardsReset(); // sub_139_4de
void sub_139_50e();
void cardsShuffleDeck(); // sub_139_51e
void cardsDrawTable(); // sub_139_582
@@ -591,9 +591,11 @@ private:
SourceMode var_i16_106c;
int16 var_i16_106e;
Common::U32String var_str_1070;
+ Common::U32String _sentenceBuffer; // var_str_1070
Common::U32String var_str_1170;
int16 var_i16_1270;
Common::U32String var_str_1272;
+ Common::U32String _sentenceGoal; // var_str_1272
int16 var_i16_1372;
Common::U32String var_str_1374;
@@ -697,8 +699,6 @@ private:
int16 var_i16_1e06;
- Common::U32String var_str_1e08;
-
uint16 var_i16_1f08;
int16 var_i16_1f0a;
Common::U32String _metapuzzleSecretCodeCipher; // var_str_1f0c
@@ -772,8 +772,9 @@ private:
int16 arr_i16_4d20[52];
Common::SharedPtr<Cursor> _cursors[0x2b]; // arr_curs_4d88, 0x44
Pattern _patterns[0x51]; // arr_pat_58f4
- int16 arr_i16_5bbc[64];
- int16 arr_i16_5cbc[64];
+ int16 arr_i16_5bbc[128];
+ int16 arr_i16_5cbc[128];
+ int16 _mazeInvItemCount[128]; // arr_i16_5cbc
float arr_bcd_5dbc[8];
Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 56ff0f8b7c6..b03dc844c31 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -290,7 +290,7 @@ void FoolGame::jumbleRun() {
break;
}
if ((_stateFlags & kStateReturn) != 0) {
- this->sub_130_c66();
+ this->jumbleStoreState();
_jumbleCurrentSubPuzzle = _jumbleSubPuzzleCount;
} else {
// 130:0956
@@ -381,17 +381,17 @@ void FoolGame::jumbleRun() {
} while (!((_activePuzzleSolved) && (this->var_i16_bfc == 1)));
}
// 130:0c4e
- this->sub_130_c66();
+ this->jumbleStoreState();
}
void FoolGame::sub_130_c56() {
// 130:0c56
- this->sub_130_c66();
+ this->jumbleStoreState();
this->saveGame();
_stateFlags = kStateNull;
}
-void FoolGame::sub_130_c66() {
+void FoolGame::jumbleStoreState() {
// 130:0c66
if (_activePuzzleSolved) {
_activePuzzleStatus = 0x64;
@@ -425,7 +425,7 @@ void FoolGame::sub_130_d2e() {
_stateFlags = kStateNull;
while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->getNextEvent(-1);
- if (_event.what == 1) {
+ if (_event.what == kMouseDown) {
this->sub_130_1476();
}
if (_stateFlags == kStateSaveGame) {
@@ -483,7 +483,7 @@ void FoolGame::sub_130_d90() {
if (_keyLastPressed != 0) {
this->sub_130_15da();
}
- if (_event.what == 1) {
+ if (_event.what == kMouseDown) {
this->sub_130_1476();
}
if (_stateFlags == kStateSaveGame) {
@@ -510,7 +510,7 @@ void FoolGame::sub_130_1004() {
if (_keyLastPressed != 0) {
this->sub_130_15da();
}
- if (_event.what == 1) {
+ if (_event.what == kMouseDown) {
this->sub_130_1476();
}
if (_stateFlags == kStateSaveGame) {
@@ -539,7 +539,7 @@ void FoolGame::sub_130_10a6() {
// 130:121c
while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
this->getNextEvent(-1);
- if (_event.what == 1) {
+ if (_event.what == kMouseDown) {
this->sub_130_1476();
}
if (_stateFlags == kStateSaveGame) {
@@ -568,7 +568,7 @@ void FoolGame::sub_130_1282() {
this->sub_130_15da();
}
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
- if (_event.what == 1) {
+ if (_event.what == kMouseDown) {
this->sub_130_1476();
}
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 8ce509abe3b..fdef4ba9b41 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -60,7 +60,7 @@ void FoolGame::mazeRun() {
// 136:018c
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
_zbasic->indexRawSet(puzzlesReadString(), 1, i);
- arr_i16_5cbc[i] = 0;
+ _mazeInvItemCount[i] = 0;
}
// 136:01d2
var_i16_484 = 0;
@@ -98,17 +98,17 @@ void FoolGame::mazeRun() {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
var_i16_1574++;
if ((arr_i16_3738[var_i16_1574] & 0x10) != 0) {
- sub_136_2a7c();
+ mazeAddWallLeft();
}
if ((arr_i16_3738[var_i16_1574] & 0x20) != 0) {
- sub_136_2b30();
+ mazeAddWallTop();
}
if ((arr_i16_3738[var_i16_1574] & 0x40) != 0) {
- sub_136_2be2();
+ mazeAddWallRight();
}
// 136:04b6
if ((arr_i16_3738[var_i16_1574] & 0x80) != 0) {
- sub_136_2c96();
+ mazeAddWallBottom();
}
}
if ((arr_i16_3738[var_i16_1574 - 1] & 4) == 0) {
@@ -243,16 +243,16 @@ void FoolGame::mazeFlashWall() {
g_toolbox->PenMode(kPatXor);
switch (_mazePlayerDirection-1) {
case 0:
- sub_136_2a7c();
+ mazeAddWallLeft();
break;
case 1:
- sub_136_2b30();
+ mazeAddWallTop();
break;
case 2:
- sub_136_2be2();
+ mazeAddWallRight();
break;
case 3:
- sub_136_2c96();
+ mazeAddWallBottom();
break;
default:
warning("mazeFlashWall: breaking out of switch");
@@ -266,16 +266,16 @@ void FoolGame::mazeFlashWall() {
// 136:0a00
switch (_mazePlayerDirection-1) {
case 0:
- sub_136_2a7c();
+ mazeAddWallLeft();
break;
case 1:
- sub_136_2b30();
+ mazeAddWallTop();
break;
case 2:
- sub_136_2be2();
+ mazeAddWallRight();
break;
case 3:
- sub_136_2c96();
+ mazeAddWallBottom();
break;
default:
warning("mazeFlashWall: breaking out of switch");
@@ -292,16 +292,16 @@ void FoolGame::mazeMovePlayer() {
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd6 - 1) {
case 0:
- sub_136_2d4c();
+ mazeDrawWallLeft();
break;
case 1:
- sub_136_2dd0();
+ mazeDrawWallTop();
break;
case 2:
- sub_136_2e52();
+ mazeDrawWallRight();
break;
case 3:
- sub_136_2ed6();
+ mazeDrawWallBottom();
break;
default:
warning("mazeMovePlayer: breaking out of switch");
@@ -315,16 +315,16 @@ void FoolGame::mazeMovePlayer() {
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd4 - 1) {
case 0:
- sub_136_2d4c();
+ mazeDrawWallLeft();
break;
case 1:
- sub_136_2dd0();
+ mazeDrawWallTop();
break;
case 2:
- sub_136_2e52();
+ mazeDrawWallRight();
break;
case 3:
- sub_136_2ed6();
+ mazeDrawWallBottom();
break;
default:
warning("mazeMovePlayer: breaking out of switch");
@@ -419,16 +419,16 @@ void FoolGame::mazeHotspot() {
mazePrintMessage();
break;
case 1: // I
- sub_136_e4c();
+ mazePickUpItem();
break;
case 2: // L
- sub_136_ed8();
+ mazeUseItem();
break;
case 3: // T
mazeWanderingWinds();
break;
case 4: // D
- sub_136_115a();
+ mazeDrawLetter();
break;
case 5: // A
sub_136_137c();
@@ -449,28 +449,28 @@ void FoolGame::mazeHotspot() {
sub_136_1806();
break;
case 11: // O
- sub_136_185a();
+ mazeSetTrigger();
break;
case 12: // Z
- mazeThornsClearTrigger();
+ mazeClearTrigger();
break;
case 13: // S
- sub_136_18f4();
+ mazePickUpTone();
break;
case 14: // F
- sub_136_1932();
+ mazeFireDemon();
break;
case 15: // Q
sub_136_19d2();
break;
case 16: // G
- sub_136_1cf4();
+ mazeNoisySprite();
break;
case 17: // W
- sub_136_1ddc();
+ mazeDelay();
break;
case 18: // E
- sub_136_1df4();
+ mazeYeetObject();
break;
case 19: // J
mazeThornsGetScroll();
@@ -500,8 +500,8 @@ void FoolGame::mazePrintMessage() {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
if (!var_str_1ce2.empty()) { // was: str(OFF(7))
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- var_i16_484 = g_toolbox->StringWidth(var_str_1ce2);
- fillRect(0x13b, 0xf1 - (var_i16_484 / 2), 0x14f, 0x10f + (var_i16_484 / 2), 2);
+ int16 width = g_toolbox->StringWidth(var_str_1ce2);
+ fillRect(0x13b, 0xf1 - (width / 2), 0x14f, 0x10f + (width / 2), 2);
var_i16_7a2 = 0x149;
sub_128_918(var_str_1ce2.decode(Common::kMacRoman));
}
@@ -509,11 +509,11 @@ void FoolGame::mazePrintMessage() {
var_str_1578 = var_str_1ce2.decode(Common::kMacRoman);
}
-void FoolGame::sub_136_e4c() {
+void FoolGame::mazePickUpItem() {
// 136:0e4c
warning(__func__);
- var_i16_1de2 = _zbasic->decodeInt(var_str_1ce2);
- arr_i16_5cbc[var_i16_1de2]++;
+ int16 itemID = _zbasic->decodeInt(var_str_1ce2);
+ _mazeInvItemCount[itemID]++;
if (arr_i16_3738[var_i16_1574] & 0x1000) {
arr_i16_3738[var_i16_1574] ^= 0x1000;
}
@@ -521,16 +521,16 @@ void FoolGame::sub_136_e4c() {
mazeSetupMenu();
}
-void FoolGame::sub_136_ed8() {
+void FoolGame::mazeUseItem() {
warning(__func__);
// 136:0ed8
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_1de2 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
+ int16 itemID = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
for (int16 i = 1; i <= var_i16_1de4; i++) {
- arr_i16_5cbc[var_i16_1de2]--;
+ _mazeInvItemCount[itemID]--;
}
- if (arr_i16_5cbc[var_i16_1de2] < 0) {
- arr_i16_5cbc[var_i16_1de2] = 0;
+ if (_mazeInvItemCount[itemID] < 0) {
+ _mazeInvItemCount[itemID] = 0;
}
mazeSetupMenu();
}
@@ -541,8 +541,8 @@ void FoolGame::mazeWanderingWinds() {
var_i16_1de6 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_1de4 = _zbasic->rndInt(var_i16_1de6);
var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_1de4 * 2 + 2, 2));
- var_i16_484 = var_i16_1de6 * 2 + 4;
- sub_136_24ae();
+ int16 offset = var_i16_1de6 * 2 + 4;
+ mazeLoadTone(offset);
}
// 136:0ffc
if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(9))) { // A
@@ -554,8 +554,7 @@ void FoolGame::mazeWanderingWinds() {
var_i16_68c += _zbasic->rndInt(var_i16_1a98 + 1) - 1;
// 136:10bc
var_i16_1de8 = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
- var_i16_484 = 0xa;
- sub_136_24ae();
+ mazeLoadTone(0xa);
}
// 136:10ea
Common::Rect temp;
@@ -573,7 +572,7 @@ void FoolGame::mazeWanderingWinds() {
mazeDrawPlayer();
}
-void FoolGame::sub_136_115a() {
+void FoolGame::mazeDrawLetter() {
warning(__func__);
// 136:115a
if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(10))) { // P
@@ -626,32 +625,33 @@ void FoolGame::sub_136_115a() {
}
void FoolGame::sub_136_137c() {
- warning(__func__);
+ Common::String op = _zbasic->leftStr(var_str_1ce2, 1);
+ warning("%s: op %s", __func__, op.c_str());
// 136:137c
var_i16_1df0 = 0;
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(13))) { // I
+ if (op == _zbasic->strRaw(OFF(13))) { // I
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
- if (arr_i16_5cbc[var_i16_484] == 0) {
+ if (_mazeInvItemCount[var_i16_484] == 0) {
var_i16_1df0 = 1;
}
}
// 136:13d8
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(14))) { // M
+ if (op == _zbasic->strRaw(OFF(14))) { // M
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_1de2 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
- if (arr_i16_5cbc[var_i16_1de2] < var_i16_1de4) {
+ if (_mazeInvItemCount[var_i16_1de2] < var_i16_1de4) {
var_i16_1df0 = 1;
}
}
// 136:144e
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(15))) { // B
+ if (op == _zbasic->strRaw(OFF(15))) { // B
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df0 = 1;
}
}
// 136:14b2
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(16))) { // L
+ if (op == _zbasic->strRaw(OFF(16))) { // L
// 136:14d6
var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (arr_i16_4338[var_i16_484] != var_i16_7e4) {
@@ -659,7 +659,7 @@ void FoolGame::sub_136_137c() {
}
}
// 136:1528
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(17))) { // S
+ if (op == _zbasic->strRaw(OFF(17))) { // S
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
for (int16 i = 4; i <= (2*var_i16_484 + 2); i += 2) {
var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, i, 2));
@@ -669,7 +669,7 @@ void FoolGame::sub_136_137c() {
}
}
// 136:15c0
- if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(18))) { // P
+ if (op == _zbasic->strRaw(OFF(18))) { // P
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1bd0 != var_i16_484) {
var_i16_1df0 = 1;
@@ -684,20 +684,23 @@ void FoolGame::sub_136_137c() {
}
void FoolGame::sub_136_163c() {
+ warning(__func__);
// 136:163c
var_i16_1bd8 = var_i16_1574;
var_i16_1bd6 = _zbasic->decodeInt(var_str_1ce2);
}
void FoolGame::sub_136_1650() {
+ warning(__func__);
// 136:1650
- var_i16_105a = _zbasic->decodeInt(var_str_1ce2);
- var_i16_103a = _zbasic->decodeInt(_zbasic->leftStr(_zbasic->indexRaw(1, var_i16_105a), 2));
+ int16 index = _zbasic->decodeInt(var_str_1ce2);
+ Common::String data = _zbasic->indexRaw(1, index);
+ var_i16_103a = _zbasic->decodeInt(_zbasic->leftStr(data, 2));
var_i16_1df2 = 0;
for (int16 i = 1; i <= var_i16_103a; i++) {
- var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(_zbasic->indexRaw(1, var_i16_105a), i*2 + 3, 2));
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(data, i*2 + 3, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
- var_i16_1df2 = 1;
+ var_i16_1df2++;
arr_i16_5bbc[var_i16_1df2] = var_i16_484;
}
// 136:16f4
@@ -716,16 +719,16 @@ void FoolGame::mazeHiddenDoorOpen() {
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd4-1) {
case 0:
- sub_136_2d4c();
+ mazeDrawWallLeft();
break;
case 1:
- sub_136_2dd0();
+ mazeDrawWallTop();
break;
case 2:
- sub_136_2e52();
+ mazeDrawWallRight();
break;
case 3:
- sub_136_2ed6();
+ mazeDrawWallBottom();
break;
default:
warning("mazeHiddenDoorOpen: broke out of switch statement");
@@ -742,16 +745,16 @@ void FoolGame::mazeHiddenDoorShut() {
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd6-1) {
case 0:
- sub_136_2d4c();
+ mazeDrawWallLeft();
break;
case 1:
- sub_136_2dd0();
+ mazeDrawWallTop();
break;
case 2:
- sub_136_2e52();
+ mazeDrawWallRight();
break;
case 3:
- sub_136_2ed6();
+ mazeDrawWallBottom();
break;
default:
warning("mazeHiddenDoorShut: broke out of switch statement");
@@ -769,14 +772,14 @@ void FoolGame::sub_136_1806() {
// 136:1858
}
-void FoolGame::sub_136_185a() {
+void FoolGame::mazeSetTrigger() {
warning(__func__);
// 136:185a
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
arr_i16_3738[var_i16_484] |= 0x1000;
}
-void FoolGame::mazeThornsClearTrigger() {
+void FoolGame::mazeClearTrigger() {
warning(__func__);
// 136:1898
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
@@ -785,42 +788,38 @@ void FoolGame::mazeThornsClearTrigger() {
}
}
-void FoolGame::sub_136_18f4() {
+void FoolGame::mazePickUpTone() {
warning(__func__);
// 136:18f4
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_484 = 3;
- sub_136_24ae();
+ mazeLoadTone(3);
for (int16 i = 1; i <= var_i16_1de4; i++) {
mazePlayTone();
}
}
-void FoolGame::sub_136_1932() {
+void FoolGame::mazeFireDemon() {
warning(__func__);
// 136:1932
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
- var_i16_484 = 3;
- sub_136_24ae();
+ mazeLoadTone(3);
arr_i16_4758[0] = 0x14;
arr_i16_4758[1] = 0;
arr_i16_4758[2] = SCREEN_HEIGHT;
arr_i16_4758[3] = SCREEN_WIDTH;
- for (var_i16_68a = 1; var_i16_68a <= var_i16_1de4; var_i16_68a++) {
- Common::Rect temp;
- temp.top = arr_i16_4758[0];
- temp.left = arr_i16_4758[1];
- temp.bottom = arr_i16_4758[2];
- temp.right = arr_i16_4758[3];
+ Common::Rect temp;
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
+ for (int16 i = 1; i <= var_i16_1de4; i++) {
g_toolbox->InvertRect(temp);
+ g_toolbox->Delay(0);
if (mazeToneFreq > 0) {
mazePlayTone();
}
- temp.top = arr_i16_4758[0];
- temp.left = arr_i16_4758[1];
- temp.bottom = arr_i16_4758[2];
- temp.right = arr_i16_4758[3];
g_toolbox->InvertRect(temp);
+ g_toolbox->Delay(0);
}
}
@@ -836,8 +835,7 @@ void FoolGame::sub_136_19d2() {
var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 7, 2));
var_i16_1df6 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 9, 2));
- var_i16_484 = 0xb;
- sub_136_24ae();
+ mazeLoadTone(0xb);
// 136:1a7a
var_i16_1df8 = _screenGrid[var_i16_1dea].left + ((_screenGrid[var_i16_1dea].right - _screenGrid[var_i16_1dea].left) / 2) - 3;
var_i16_1dfa = _screenGrid[var_i16_1dea].top + ((_screenGrid[var_i16_1dea].bottom - _screenGrid[var_i16_1dea].top) / 2) - 3;
@@ -870,14 +868,13 @@ void FoolGame::sub_136_19d2() {
}
}
-void FoolGame::sub_136_1cf4() {
+void FoolGame::mazeNoisySprite() {
warning(__func__);
// 136:1cf4
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
- var_i16_484 = 7;
- sub_136_24ae();
+ mazeLoadTone(7);
for (int16 i = 1; i <= var_i16_1de4; i++) {
// 136:1d4c
if (mazeToneFreq > 0) {
@@ -899,21 +896,20 @@ void FoolGame::sub_136_1cf4() {
}
}
-void FoolGame::sub_136_1ddc() {
+void FoolGame::mazeDelay() {
warning(__func__);
// 136:1ddc
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
g_toolbox->Delay(var_i16_484*60/1000);
}
-void FoolGame::sub_136_1df4() {
+void FoolGame::mazeYeetObject() {
warning(__func__);
// 136:1df4
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
- var_i16_484 = 7;
- sub_136_24ae();
+ mazeLoadTone(7);
mazeMovementTrail();
}
@@ -922,8 +918,7 @@ void FoolGame::mazeThornsGetScroll() {
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
var_i16_1e00 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
- var_i16_484 = 7;
- sub_136_24ae();
+ mazeLoadTone(7);
g_toolbox->PenNormal();
g_toolbox->PenSize(4, 4);
g_toolbox->PenMode(kPatXor);
@@ -999,11 +994,13 @@ void FoolGame::mazeThornsGetScroll() {
}
void FoolGame::sub_136_21fa() {
+ warning(__func__);
// 136:21fa
sub_128_6186();
}
void FoolGame::sub_136_2200() {
+ warning(__func__);
// 136:2200
var_i16_1bdc = 1;
}
@@ -1048,14 +1045,14 @@ void FoolGame::mazeMovementTrail() {
}
}
-void FoolGame::sub_136_24ae() {
+void FoolGame::mazeLoadTone(int16 offset) {
warning(__func__);
// 136:24ae
- mazeToneFreq = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484, 2));
+ mazeToneFreq = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, offset, 2));
if (mazeToneFreq > 0) {
- mazeToneFreqStep = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 2, 2));
- var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 4, 2))*2;
- var_i16_1e04 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, var_i16_484 + 6, 2));
+ mazeToneFreqStep = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, offset + 2, 2));
+ var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, offset + 4, 2))*2;
+ var_i16_1e04 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, offset + 6, 2));
}
// 136:2536
}
@@ -1122,35 +1119,34 @@ void FoolGame::mazeSetupMenu() {
_zbasic->menu(8, 5, 1, _zbasic->str(OFF(25))); // the white dot to the exit
if (_activePuzzle == 0x57) {
// 136:281c
- var_i16_103a = 7;
- var_i16_68a = 1;
+ int16 menuItem = 7;
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- if ((arr_i16_5cbc[i] > 0) &&
+ if ((_mazeInvItemCount[i] > 0) &&
(_zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(OFF(26))) > 0)) {
- if (var_i16_103a == 7) {
+ if (menuItem == 7) {
_zbasic->menu(8, 6, 0, _zbasic->str(OFF(27))); // -
_zbasic->menu(8, 7, 1, _zbasic->str(OFF(28))); // you have acquired
}
// 136:28b4
var_i16_1dea = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(OFF(29))); // ++
var_i16_1de8 = _zbasic->instr(1, _zbasic->index(1, i), _zbasic->str(OFF(30))); // \xa5\xa5
- var_str_1e08 = _zbasic->midStr(_zbasic->index(1, i), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2);
- if (_zbasic->leftStr(var_str_1e08, 1) == _zbasic->str(OFF(31))) { // +
+ Common::U32String invItemName = _zbasic->midStr(_zbasic->index(1, i), var_i16_1dea + 2, var_i16_1de8 - var_i16_1dea - 2); // var_str_1e08
+ if (_zbasic->leftStr(invItemName, 1) == _zbasic->str(OFF(31))) { // +
// 136:2964
- var_i16_484 = var_str_1e08.size();
- var_str_1e08 = _zbasic->rightStr(var_str_1e08, var_i16_484 - 1);
+ var_i16_484 = invItemName.size();
+ invItemName = _zbasic->rightStr(invItemName, var_i16_484 - 1);
}
// 136:298e
- var_str_384 = Common::U32String::format(" %d", arr_i16_5cbc[i]);
- var_str_384 = _zbasic->space(4 - var_str_384.size()) + var_str_384 + _zbasic->str(OFF(32)) + var_str_1e08; // ' '
- if (arr_i16_5cbc[i] > 1) {
- var_str_384 += _zbasic->str(OFF(33)); // s
+ Common::U32String menuStr = Common::U32String::format(" %d", _mazeInvItemCount[i]);
+ menuStr = _zbasic->space(4 - menuStr.size()) + menuStr + _zbasic->str(OFF(32)) + invItemName; // ' '
+ if (_mazeInvItemCount[i] > 1) {
+ menuStr += _zbasic->str(OFF(33)); // s
}
// 136:2a2a
- var_str_384 += _zbasic->str(OFF(34)); // ' '
- var_i16_103a++;
- _zbasic->menu(8, var_i16_103a, 1, var_str_384);
+ menuStr += _zbasic->str(OFF(34)); // ' '
+ menuItem++;
+ _zbasic->menu(8, menuItem, 1, menuStr);
}
// 136:2a5e
}
@@ -1159,7 +1155,8 @@ void FoolGame::mazeSetupMenu() {
return;
}
-void FoolGame::sub_136_2a7c() {
+void FoolGame::mazeAddWallLeft() {
+ warning(__func__);
// 136:2a7c
arr_i16_3738[var_i16_1574] |= 0x100;
g_toolbox->MoveTo(
@@ -1172,7 +1169,8 @@ void FoolGame::sub_136_2a7c() {
);
}
-void FoolGame::sub_136_2b30() {
+void FoolGame::mazeAddWallTop() {
+ warning(__func__);
// 136:2b30
arr_i16_3738[var_i16_1574] |= 0x200;
g_toolbox->MoveTo(
@@ -1185,7 +1183,8 @@ void FoolGame::sub_136_2b30() {
);
}
-void FoolGame::sub_136_2be2() {
+void FoolGame::mazeAddWallRight() {
+ warning(__func__);
// 136:2be2
arr_i16_3738[var_i16_1574] |= 0x400;
g_toolbox->MoveTo(
@@ -1198,7 +1197,8 @@ void FoolGame::sub_136_2be2() {
);
}
-void FoolGame::sub_136_2c96() {
+void FoolGame::mazeAddWallBottom() {
+ warning(__func__);
// 136:2c96
arr_i16_3738[var_i16_1574] |= 0x800;
g_toolbox->MoveTo(
@@ -1211,7 +1211,8 @@ void FoolGame::sub_136_2c96() {
);
}
-void FoolGame::sub_136_2d4c() {
+void FoolGame::mazeDrawWallLeft() {
+ warning(__func__);
// 136:2d4c
g_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left - 2,
@@ -1223,7 +1224,8 @@ void FoolGame::sub_136_2d4c() {
);
}
-void FoolGame::sub_136_2dd0() {
+void FoolGame::mazeDrawWallTop() {
+ warning(__func__);
// 136:2dd0
g_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left + 3,
@@ -1235,7 +1237,8 @@ void FoolGame::sub_136_2dd0() {
);
}
-void FoolGame::sub_136_2e52() {
+void FoolGame::mazeDrawWallRight() {
+ warning(__func__);
// 136:2e52
g_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].right - 3,
@@ -1247,7 +1250,8 @@ void FoolGame::sub_136_2e52() {
);
}
-void FoolGame::sub_136_2ed6() {
+void FoolGame::mazeDrawWallBottom() {
+ warning(__func__);
// 136:2ed6
g_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left + 3,
@@ -1274,7 +1278,7 @@ void FoolGame::mazeStoreState() {
_zbasic->encodeInt(var_i16_1bd8);
// 136:300a
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- _activePuzzleBuffer += _zbasic->encodeInt(arr_i16_5cbc[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(_mazeInvItemCount[i]);
}
// 136:3054
var_i16_484 = 0;
@@ -1345,11 +1349,13 @@ void FoolGame::mazeStoreState() {
}
void FoolGame::sub_136_3408() {
+ warning(__func__);
// 136:3408
var_i16_1f08 |= _bitLUT[var_i16_1de6];
}
void FoolGame::sub_136_342a() {
+ warning(__func__);
// 136:342a
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
@@ -1376,16 +1382,16 @@ void FoolGame::mazeLoadState() {
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd6 - 1) {
case 0:
- sub_136_2d4c();
+ mazeDrawWallLeft();
break;
case 1:
- sub_136_2dd0();
+ mazeDrawWallTop();
break;
case 2:
- sub_136_2e52();
+ mazeDrawWallRight();
break;
case 3:
- sub_136_2ed6();
+ mazeDrawWallBottom();
break;
default:
warning("mazeLoadState: breaking out of switch");
@@ -1399,16 +1405,16 @@ void FoolGame::mazeLoadState() {
g_toolbox->PenSize(5, 5);
switch (var_i16_1bd4 - 1) {
case 0:
- sub_136_2d4c();
+ mazeDrawWallLeft();
break;
case 1:
- sub_136_2dd0();
+ mazeDrawWallTop();
break;
case 2:
- sub_136_2e52();
+ mazeDrawWallRight();
break;
case 3:
- sub_136_2ed6();
+ mazeDrawWallBottom();
break;
default:
warning("mazeLoadState: breaking out of switch");
@@ -1418,7 +1424,7 @@ void FoolGame::mazeLoadState() {
// 136:3592
var_i16_1f0a = 0xd;
for (int16 i = 1; i <= arr_i16_1eb8[23]; i++) {
- arr_i16_5cbc[i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
+ _mazeInvItemCount[i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
}
// 136:35ec
@@ -1462,28 +1468,28 @@ void FoolGame::mazeLoadState() {
if (arr_i16_1eb8[21] != 0) {
if (((arr_i16_3738[var_i16_1574] & 1) == 1) && ((arr_i16_3738[var_i16_1574] & 0x10) == 0)) {
if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
- sub_136_2a7c();
+ mazeAddWallLeft();
}
sub_136_3a30();
}
// 136:380c
if (((arr_i16_3738[var_i16_1574] & 2) == 2) && ((arr_i16_3738[var_i16_1574] & 0x20) == 0)) {
if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
- sub_136_2b30();
+ mazeAddWallTop();
}
sub_136_3a30();
}
// 136:3886
if (((arr_i16_3738[var_i16_1574] & 4) == 4) && ((arr_i16_3738[var_i16_1574] & 0x40) == 0)) {
if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
- sub_136_2be2();
+ mazeAddWallRight();
}
sub_136_3a30();
}
// 136:3900
if (((arr_i16_3738[var_i16_1574] & 8) == 8) && ((arr_i16_3738[var_i16_1574] & 0x80) == 0)) {
if ((var_i16_1f08 & _bitLUT[var_i16_1de6]) != 0) {
- sub_136_2c96();
+ mazeAddWallBottom();
}
sub_136_3a30();
}
@@ -1502,6 +1508,7 @@ void FoolGame::mazeLoadState() {
}
void FoolGame::sub_136_3a30() {
+ warning(__func__);
// 136:3a30
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
@@ -1516,6 +1523,7 @@ void FoolGame::sub_136_3a30() {
}
void FoolGame::sub_136_3a70() {
+ warning(__func__);
// 136:3a70
if (_activePuzzle == 0x57) {
_activePuzzleStatus = 0x64;
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 4507df288a5..921f394addd 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -54,7 +54,7 @@ void FoolGame::sentenceRun() {
this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
this->arr_i16_1eb8[0] = puzzlesReadShort();
_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
- this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
+ _sentenceGoal = puzzlesReadString().decode(Common::kMacRoman);
this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1)); // to reveal XXXXX
// 135:0152
@@ -95,57 +95,53 @@ void FoolGame::sentenceRun() {
// 135:0408
if (this->arr_i16_4338[this->var_i16_68a] == 1) {
this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, 1);
- this->sub_135_a34();
+ this->sentenceDrawButton();
}
// 135:044a
}
// 135:0466
if (_activePuzzleBuffer.empty()) { // was: str(OFF(3))
- this->var_str_1070 = _zbasic->index(1, 0);
+ _sentenceBuffer = _zbasic->index(1, 0);
} else {
// 135:049a
this->var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
- this->var_str_1070 = _zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372);
+ _sentenceBuffer = _zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372).decode(Common::kMacRoman);
}
// 135:04f2
- this->sub_135_b16();
+ this->sentenceDrawBuffer();
_stateFlags = kStateNull;
- if (this->var_str_1070 == this->var_str_1272) {
- _activePuzzleSolved = true;
- } else {
- _activePuzzleSolved = false;
- }
+ _activePuzzleSolved = _sentenceBuffer == _sentenceGoal;
// 135:0520
do {
this->getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->sub_135_5b6();
+ this->sentenceOnClick();
}
// 135:0538
- if (this->var_str_1070 == this->var_str_1272) {
+ if (_sentenceBuffer == _sentenceGoal) {
_activePuzzleSolved = true;
}
// 135:0552
if (_stateFlags == kStateUndo) {
- this->sub_135_9ba();
+ sentenceUndo();
_stateFlags = kStateNull;
}
// 135:0566
if (_stateFlags == kStateSaveGame) {
- this->sub_135_c1c();
+ sentenceStoreState();
this->saveGame();
}
// 135:0578
} while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved));
// 135:05a0
if (_activePuzzleSolved) {
- this->sub_135_cee();
+ sentenceSuccess();
}
- this->sub_135_c1c();
+ sentenceStoreState();
// JMP 0xd9c
}
-void FoolGame::sub_135_5b6() {
+void FoolGame::sentenceOnClick() {
// 135:05b6
this->var_i16_1abc = 0;
if ((_event.where.x < this->arr_i16_1eb8[2]) || (_event.where.y < 0xf2))
@@ -161,27 +157,27 @@ void FoolGame::sub_135_5b6() {
// 135:06aa
switch (this->arr_i16_4338[this->var_i16_103a + this->arr_i16_1eb8[0]]-1) {
case 0:
- this->sentenceAddLeft();
+ sentenceAddLeft();
break;
case 1:
- this->sentenceAddRight();
+ sentenceAddRight();
break;
case 2:
- this->sub_135_81e();
+ sentenceAddLeftRight();
break;
case 3:
- this->sub_135_86a();
+ sentenceReplace();
break;
case 4:
- this->sub_135_94c();
+ sentenceReverse();
break;
default:
- warning("sub_135_5b6: breaking out of switch");
+ warning("sentenceOnClick: breaking out of switch");
break;
}
- this->sub_135_b16();
+ this->sentenceDrawBuffer();
this->sub_128_6186();
- if (this->var_str_1070 == this->var_str_1272) {
+ if (_sentenceBuffer == _sentenceGoal) {
return;
}
// 135:0714
@@ -208,71 +204,70 @@ void FoolGame::sub_135_5b6() {
}
// 135:07c8
if (_stateFlags == kNullEvent) {
- this->sub_135_9ba();
+ sentenceUndo();
}
}
void FoolGame::sentenceAddLeft() {
// 135:07d6
- this->var_str_1070 = _zbasic->index(1, this->var_i16_103a) + this->var_str_1070;
+ _sentenceBuffer = _zbasic->index(1, this->var_i16_103a) + _sentenceBuffer;
}
void FoolGame::sentenceAddRight() {
// 135:07fa
- this->var_str_1070 += _zbasic->index(1, this->var_i16_103a);
+ _sentenceBuffer += _zbasic->index(1, this->var_i16_103a);
}
-void FoolGame::sub_135_81e() {
+void FoolGame::sentenceAddLeftRight() {
// 135:0813
- this->var_str_1070 = _zbasic->index(1, this->var_i16_103a)
- + this->var_str_1070
+ _sentenceBuffer = _zbasic->index(1, this->var_i16_103a)
+ + _sentenceBuffer
+ _zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0]);
}
-void FoolGame::sub_135_86a() {
+void FoolGame::sentenceReplace() {
// 135:086a
this->var_i16_9f2 = _zbasic->index(1, this->var_i16_103a).size();
while (true) {
// 135:0884
- this->var_i16_484 = this->var_str_1070.size();
- this->var_i16_1abe = _zbasic->instr(1, this->var_str_1070, _zbasic->index(1, this->var_i16_103a));
+ this->var_i16_484 = _sentenceBuffer.size();
+ this->var_i16_1abe = _zbasic->instr(1, _sentenceBuffer, _zbasic->index(1, this->var_i16_103a));
if (this->var_i16_1abe == 0)
return;
// 135:08bc
if ((this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2) < 0)
return;
- this->var_str_1070 = _zbasic->leftStr(this->var_str_1070, this->var_i16_1abe - 1)
+ _sentenceBuffer = _zbasic->leftStr(_sentenceBuffer, this->var_i16_1abe - 1)
+ _zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0])
- + _zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2);
+ + _zbasic->rightStr(_sentenceBuffer, this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2);
}
// should never reach here
- this->sub_135_94c();
}
-void FoolGame::sub_135_94c() {
+void FoolGame::sentenceReverse() {
// 135:094c
- this->var_i16_484 = this->var_str_1070.size();
- this->var_str_384.clear(); // was: str(OFF(5))
+ this->var_i16_484 = _sentenceBuffer.size();
+ Common::U32String buffer; // was: str(OFF(5))
for (int16 i = this->var_i16_484; i >= 1; i--) {
- this->var_str_384 += _zbasic->midStr(this->var_str_1070, i, 1);
+ buffer += _zbasic->midStr(_sentenceBuffer, i, 1);
}
- this->var_str_1070 = this->var_str_384;
+ _sentenceBuffer = buffer;
}
-void FoolGame::sub_135_9ba() {
+void FoolGame::sentenceUndo() {
// 135:09ba
this->arr_i16_1eb8[4] = 0;
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
g_toolbox->FillRect(temp, _patterns[2]);
for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
this->arr_i16_4338[this->var_i16_68a] = 1;
- this->sub_135_a34();
+ this->sentenceDrawButton();
}
- this->var_str_1070 = _zbasic->index(1, 0);
- this->sub_135_b16();
+ _sentenceBuffer = _zbasic->index(1, 0);
+ this->sentenceDrawBuffer();
}
-void FoolGame::sub_135_a34() {
+void FoolGame::sentenceDrawButton() {
// 135:0a34
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + _zbasic->str(OFF(6)); // ' '
@@ -283,10 +278,10 @@ void FoolGame::sub_135_a34() {
g_toolbox->DrawString(this->var_str_384);
}
-void FoolGame::sub_135_b16() {
+void FoolGame::sentenceDrawBuffer() {
// 135:0b16
_zbasic->text(kFontLarge, 0x18, 0, kSrcOr);
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1070);
+ this->var_i16_484 = g_toolbox->StringWidth(_sentenceBuffer);
if (this->var_i16_484 < this->arr_i16_1eb8[4]) {
this->var_i16_484 = this->arr_i16_1eb8[4];
} else {
@@ -298,10 +293,10 @@ void FoolGame::sub_135_b16() {
Common::Rect temp(this->arr_i16_3738[1], this->arr_i16_3738[0], this->arr_i16_3738[3], this->arr_i16_3738[2]);
g_toolbox->FillRect(temp, _patterns[0]);
g_toolbox->MoveTo(0x100 - (this->var_i16_484 / 2), 0xd9);
- g_toolbox->DrawString(this->var_str_1070);
+ g_toolbox->DrawString(_sentenceBuffer);
}
-void FoolGame::sub_135_c1c() {
+void FoolGame::sentenceStoreState() {
// 135:0c1c
_activePuzzleBuffer.clear(); // was: str(OFF(7))
if (this->var_i16_1abc != 0) {
@@ -315,16 +310,15 @@ void FoolGame::sub_135_c1c() {
_activePuzzleBuffer += this->var_str_384;
}
// 135:0cba
- Common::String temp = this->var_str_1070.encode(Common::kMacRoman);
+ Common::String temp = _sentenceBuffer.encode(Common::kMacRoman);
this->var_i16_1372 = (int16)temp.size();
_activePuzzleBuffer += _zbasic->encodeInt(this->var_i16_1372) + temp;
}
-void FoolGame::sub_135_cee() {
+void FoolGame::sentenceSuccess() {
// 135:0cee
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
- this->var_i16_68a = 1;
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, 0);
}
Commit: ba8ce93cd7d703bd3e4c801fedf2e02adc9a7333
https://github.com/scummvm/scummvm/commit/ba8ce93cd7d703bd3e4c801fedf2e02adc9a7333
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:28+02:00
Commit Message:
FOOL: More naming cleanup
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_threeships.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 158a63b4905..c93fab864c7 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -42,7 +42,7 @@ void FoolGame::cardsRun() {
var_i16_2016 = 0;
// 139:0004
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->var_i16_c00 = 1;
// set up card bounding boxes
g_toolbox->SetRect(_screenGrid[1], 0x78, 0x19, 0xd1, 0xae);
@@ -199,7 +199,7 @@ void FoolGame::cardsDrawTable() {
this->sub_128_918(_zbasic->str(OFF(2))); // Yield
this->var_i16_2016 = 1;
this->var_i16_2010 = 1;
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::cardsOnClick() {
@@ -210,7 +210,7 @@ void FoolGame::cardsOnClick() {
// didn't click in the three cards area
if (g_toolbox->PtInRect(_event.where, this->arr_rect_4338)) {
g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
- this->sub_128_6186();
+ this->waitForMouseUp();
g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
if (!g_toolbox->PtInRect(_event.where, this->arr_rect_4338))
return;
@@ -706,7 +706,7 @@ void FoolGame::sub_139_1d3e() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_2664();
this->sub_128_d34(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
}
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index ca5ebe3b15e..cc58c26dd0b 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -32,7 +32,7 @@ extern Toolbox *g_toolbox;
void FoolGame::deathRun() {
// 141:0004
_zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
- this->sub_128_55c(_zbasic->str(334));
+ this->drawPuzzleButton(Common::U32String("~")); // was: str(334)
g_toolbox->InvertRect(this->arr_rect_1910c);
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
@@ -62,8 +62,8 @@ void FoolGame::deathRun() {
return;
}
// 141:0200
- if (_stateFlags == 2) {
- _stateFlags = 0;
+ if (_stateFlags == kStateUndo) {
+ _stateFlags = kStateNull;
}
if (_stateFlags == kStateSaveGame) {
this->saveGame();
@@ -76,7 +76,7 @@ void FoolGame::deathRun() {
}
// 141:023a
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
- this->sub_128_55c(_zbasic->str(335)); // "~"
+ this->drawPuzzleButton(Common::U32String("~")); // was: str(335))
this->var_i16_233a = 1;
// JMP 0x2be
while (_event.where.y < 0x14) {
@@ -84,8 +84,8 @@ void FoolGame::deathRun() {
// 141:0282
this->deathMoveBlackEye();
this->getNextEvent(-1);
- if (_stateFlags == 2) {
- _stateFlags = 0;
+ if (_stateFlags == kStateUndo) {
+ _stateFlags = kStateNull;
}
if (_stateFlags == kStateSaveGame) {
this->saveGame();
@@ -187,7 +187,7 @@ void FoolGame::deathMoveBlackEye() {
this->arr_rect_1eb8 = this->arr_rect_1ec0;
_zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
_zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
- this->sub_128_3da(1);
+ this->delay(1);
}
// 141:0880
}
@@ -214,7 +214,7 @@ void FoolGame::deathDrawZoom() {
for (int i = 1; i <= 2; i++) {
this->zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
- this->sub_128_69c(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 5d986712ead..84cf9114b8d 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -84,11 +84,12 @@ void FoolGame::run() {
}
// Fool's Errand has an embedded version of Chicago with custom characters
_zbasic->setMenuFont(_fontChicago, 12, 0);
- this->sub_128_004();
+ foolRun();
delete _zbasic;
}
-void FoolGame::sub_128_004() {
+void FoolGame::foolRun() {
+ // 128:0004
// zero out variables
_storyCurrentChapter = 0;
_sunMapRestored = 0;
@@ -142,7 +143,7 @@ void FoolGame::sub_128_004() {
// 128:0442: JMP - [0x45e]
// 128:045e: JMP - [0x478]
// 128:0478
- this->var_str_69a = _zbasic->str(6);
+ //this->var_str_69a.clear(); // was: str(6);
//this->var_i32_79a = &this->var_str_69a;
// 128:0496: JMP - [0x4d6]
// 128:04d6: JMP - [0x50a]
@@ -249,7 +250,7 @@ void FoolGame::sub_128_004() {
this->metapuzzleRun();
}
if (_stateFlags & kStatePrintStory) {
- this->sub_128_2b0a();
+ this->printStory();
}
if (_stateFlags & kStateMetapuzzleComplete) {
this->sub_144_004();
@@ -369,13 +370,13 @@ void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
}
}
-void FoolGame::sub_128_3da(int16 unk1) {
+void FoolGame::delay(int16 ticks) {
// 128:03da
this->var_i32_68e = g_toolbox->TickCount();
do {
g_toolbox->Delay(0);
- } while (g_toolbox->TickCount() < (this->var_i32_68e + unk1));
+ } while (g_toolbox->TickCount() < (this->var_i32_68e + ticks));
}
void FoolGame::sub_128_406(int16 unk1) {
@@ -388,9 +389,9 @@ void FoolGame::sub_128_406(int16 unk1) {
int16 FoolGame::puzzlesReadByte() {
// 128:0428
// read a byte
- this->var_i16_30 = *(byte *)(&var_bytes_696->data()[this->var_ptr_696]);
- debugC(8, kDebugLoading, "Read[%04x]: %02x", this->var_ptr_696, this->var_i16_30);
- this->var_ptr_696 += 1;
+ this->var_i16_30 = *(byte *)(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %02x", this->_puzzleDataPtr, this->var_i16_30);
+ this->_puzzleDataPtr += 1;
return this->var_i16_30;
return 0;
}
@@ -398,29 +399,29 @@ int16 FoolGame::puzzlesReadByte() {
int16 FoolGame::puzzlesReadShort() {
// 128:0446
// read a short
- this->var_i16_30 = READ_BE_INT16(&var_bytes_696->data()[this->var_ptr_696]);
- debugC(8, kDebugLoading, "Read[%04x]: %04x", this->var_ptr_696, this->var_i16_30);
- this->var_ptr_696 += 2;
+ this->var_i16_30 = READ_BE_INT16(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %04x", this->_puzzleDataPtr, this->var_i16_30);
+ this->_puzzleDataPtr += 2;
return this->var_i16_30;
}
int32 FoolGame::puzzlesReadLong() {
// 128:0462
// read a long
- this->var_i32_68e = READ_BE_INT32(&var_bytes_696->data()[this->var_ptr_696]);
- debugC(8, kDebugLoading, "Read[%04x]: %08x", this->var_ptr_696, this->var_i32_68e);
- this->var_ptr_696 += 4;
+ this->var_i32_68e = READ_BE_INT32(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %08x", this->_puzzleDataPtr, this->var_i32_68e);
+ this->_puzzleDataPtr += 4;
return this->var_i32_68e;
}
Common::String FoolGame::puzzlesReadString() {
// 128:049a
// read a pascal string
- this->var_i16_79e = *(byte *)(&var_bytes_696->data()[this->var_ptr_696]);
- this->var_str_69a = Common::String((const char *)&var_bytes_696->data()[this->var_ptr_696+1], this->var_i16_79e);
- debugC(8, kDebugLoading, "Read[%04x]: %s", this->var_ptr_696, this->var_str_69a.c_str());
- this->var_ptr_696 += this->var_i16_79e + 1;
- return this->var_str_69a;
+ this->var_i16_79e = *(byte *)(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ Common::String result((const char *)&_puzzleDataBuffer->data()[this->_puzzleDataPtr+1], this->var_i16_79e);
+ debugC(8, kDebugLoading, "Read[%04x]: %s", this->_puzzleDataPtr, result.c_str());
+ this->_puzzleDataPtr += this->var_i16_79e + 1;
+ return result;
}
void FoolGame::sub_128_4da(int16 unk1) {
@@ -455,17 +456,16 @@ void FoolGame::playTone(int16 freq, int16 duration, int16 wait) {
}
}
-void FoolGame::sub_128_55c(const Common::U32String &unk1) {
+void FoolGame::drawPuzzleButton(const Common::U32String &symbol) {
// 128:055c
- _zbasic->stringCopy(this->var_str_172, unk1);
g_toolbox->PenNormal();
g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
g_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo(0x78 - (this->var_i16_30 / 2), 0x133);
- g_toolbox->DrawString(this->var_str_172);
+ int16 width = g_toolbox->StringWidth(symbol);
+ g_toolbox->MoveTo(0x78 - (width / 2), 0x133);
+ g_toolbox->DrawString(symbol);
}
int16 FoolGame::sub_128_5fe() {
@@ -483,13 +483,13 @@ OSErr FoolGame::sub_128_64c(int16 unk1) {
return g_toolbox->PBSetVol(pb);
}
-void FoolGame::sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::fillRect(int16 patternID, PatternMode mode, int16 top, int16 left, int16 bottom, int16 right) {
// 128:069c
g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[unk6]);
- g_toolbox->PenMode(unk5);
+ g_toolbox->PenPat(_patterns[patternID]);
+ g_toolbox->PenMode(mode);
Common::Rect bounds; // arr_rect_5b7c
- g_toolbox->SetRect(bounds, unk3, unk4, unk1, unk2);
+ g_toolbox->SetRect(bounds, left, top, right, bottom);
g_toolbox->PaintRect(bounds);
g_toolbox->PenNormal();
}
@@ -534,7 +534,7 @@ void FoolGame::sub_128_918(const Common::U32String &unk1) {
// 128:0918
_zbasic->stringCopy(this->var_str_172, unk1);
this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo(0x100 - (this->var_i16_30 / 2), this->var_i16_7a2);
+ g_toolbox->MoveTo((SCREEN_WIDTH / 2) - (this->var_i16_30 / 2), this->var_i16_7a2);
g_toolbox->DrawString(this->var_str_172);
}
@@ -865,7 +865,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
}
-void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
+void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &message) {
// behold the Nth key of thoth animation
this->var_i16_32 = unk1;
this->var_i16_30 = unk2;
@@ -875,11 +875,10 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
_puzzleFlags[this->var_i16_30] |= kFlagMenuEnabled;
}
// 128:1818
- this->var_i16_34 = 3 + ((this->var_i16_30 - 1) / 0x10);
- this->var_i16_36 = 1 + ((this->var_i16_30 - 1) % 0x10);
- this->var_str_172 = _puzzleName[this->var_i16_30] + _zbasic->str(9);
+ int menuNo = 3 + ((this->var_i16_30 - 1) / 0x10);
+ int itemNo = 1 + ((this->var_i16_30 - 1) % 0x10);
// add the wadjet eye next to the chapter name
- _zbasic->menu(this->var_i16_34, this->var_i16_36, 1, this->var_str_172);
+ _zbasic->menu(menuNo, itemNo, 1, _puzzleName[this->var_i16_30] + _zbasic->str(9));
}
// 128:188a
this->sub_128_4da(0);
@@ -908,10 +907,10 @@ void FoolGame::sub_128_178a(int16 unk2, int16 unk1) {
g_toolbox->PenMode(kPatXor);
g_toolbox->FrameRect(this->arr_rect_4338);
g_toolbox->PenMode(kPatCopy);
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_484 = g_toolbox->StringWidth(message);
// 128:19ec
g_toolbox->MoveTo(0x105 - (this->var_i16_484/2), 0x12e);
- g_toolbox->DrawString(this->var_str_384);
+ g_toolbox->DrawString(message);
// loop count was 0x4d
for (int i = 0; i <= 0x24; i++) {
this->var_i32_692 = g_toolbox->TickCount();
@@ -1021,7 +1020,7 @@ void FoolGame::sub_128_2078() {
// clicking the story button
// 128:2078
g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- this->sub_128_6186();
+ this->waitForMouseUp();
g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
this->sub_128_21c8();
@@ -1082,7 +1081,7 @@ void FoolGame::storyRenderPage() {
// 128:2202
if (_storyNextPage != _storyCurrentPage) {
if ((_pageLines[_storyNextPage] < 0xe) && (this->var_i16_7de > 0)) {
- this->sub_128_69c(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
+ this->fillRect(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
// 128:226e
// grab the last N-1 lines of text from the screen
_zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
@@ -1114,7 +1113,7 @@ void FoolGame::storyRenderPage() {
this->var_str_384 = Common::U32String("*"); // was: str(12)
}
// 128:23e8
- this->sub_128_55c(this->var_str_384);
+ this->drawPuzzleButton(this->var_str_384);
// 128:23f0: CLR.W - -0x772(A5)
this->var_i16_7d6 = 1;
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
@@ -1178,10 +1177,10 @@ void FoolGame::sub_128_2664() {
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_str_172 = _zbasic->str(15); // click mouse to continue
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xf);
- g_toolbox->DrawString(this->var_str_172);
+ Common::U32String message = _zbasic->str(15); // click mouse to continue
+ int16 width = g_toolbox->StringWidth(message);
+ g_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
+ g_toolbox->DrawString(message);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
}
@@ -1193,16 +1192,16 @@ void FoolGame::sub_128_26f6() {
}
}
-void FoolGame::sub_128_271a() {
+void FoolGame::fetchPuzzleData() {
int position = _puzzleDataOffsets[_activePuzzle] - 1;
// record index
this->var_i16_484 = (int16)(position / 1000);
// offset at record
this->var_i16_7e4 = (int16)(position % 1000);
_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
- this->var_ptr_696 = 0;
+ this->_puzzleDataPtr = 0;
int length = _puzzleDataOffsets[_activePuzzle + 1] - _puzzleDataOffsets[_activePuzzle];
- debugC(8, kDebugLoading, "sub_128_271a: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
+ debugC(8, kDebugLoading, "fetchPuzzleData: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
_activePuzzle,
position,
this->var_i16_484,
@@ -1210,7 +1209,7 @@ void FoolGame::sub_128_271a() {
length
);
this->arr_bytes_109dc = _zbasic->readFile(1, length);
- this->var_bytes_696 = this->arr_bytes_109dc;
+ this->_puzzleDataBuffer = this->arr_bytes_109dc;
}
@@ -1351,7 +1350,7 @@ void FoolGame::menuPrintStory() {
-void FoolGame::sub_128_2b0a() {
+void FoolGame::printStory() {
// 128:2b0a
_stateFlags = kStateNull;
// printing the story
@@ -1705,13 +1704,13 @@ void FoolGame::cursorExplodingWatch() {
for (int j = 0; j <= 1; j++) {
for (int i = 3; i <= 6; i++) {
g_toolbox->SetCursor(_cursors[i]);
- this->sub_128_3da(3);
+ this->delay(3);
}
// 128:37c2
}
for (int i = 7; i <= 0xf; i++) {
g_toolbox->SetCursor(_cursors[i]);
- this->sub_128_3da(4);
+ this->delay(4);
}
this->var_i16_7b2 = 0xa;
@@ -1721,7 +1720,7 @@ void FoolGame::cursorExplodingWatchShort() {
// 128:37ce
for (int i = 7; i <= 0xf; i++) {
g_toolbox->SetCursor(_cursors[i]);
- this->sub_128_3da(4);
+ this->delay(4);
}
this->var_i16_7b2 = 0xa;
}
@@ -2177,48 +2176,47 @@ void FoolGame::menuAbout() {
_modalText[0] = _zbasic->chr(0x22) + _saveFileName + _zbasic->chr(0x22) + Common::U32String(" in progress");
}
// 128:4b28
+ int16 modalLines = -1;
_modalText[1] = _zbasic->str(aboutOff+3);
if (_sunMapRestored == 0) {
- this->var_i16_68c = 0x51;
- this->var_i16_68a = 1;
+ int16 mapPiecesRemaining = 0x51;
for (int i = 1; i <= 0x51; i++) {
- if ((_puzzleFlags[i] & 3) != 0) {
- this->var_i16_68c--;
+ if ((_puzzleFlags[i] & (kFlagMenuEnabled | kFlagMenuDiamond)) != 0) {
+ mapPiecesRemaining--;
}
}
// 128:4b88
- if (this->var_i16_68c >= 0) {
+ if (mapPiecesRemaining >= 0) {
// sun's map is incomplete
_modalText[2] = _zbasic->str(aboutOff+4);
- if (this->var_i16_68c == 1) {
+ if (mapPiecesRemaining == 1) {
// there is 1 missing piece
_modalText[3] = _zbasic->str(aboutOff+5);
} else {
// 128:4bde
// there are N missing pieces
- _modalText[3] = Common::U32String::format("%s %d%s", _zbasic->str(aboutOff+6).encode().c_str(), this->var_i16_68c, _zbasic->str(aboutOff+7).encode().c_str());
+ _modalText[3] = Common::U32String::format("%s %d%s", _zbasic->str(aboutOff+6).encode().c_str(), mapPiecesRemaining, _zbasic->str(aboutOff+7).encode().c_str());
}
// 128:4c1a
- this->var_i16_68c = 0;
+ int16 unsolvedPuzzles = 0;
for (int i = 2; i <= 0x50; i++) {
- this->var_i16_68a = 2;
if ((_puzzleCompletionStatus[i] < 0x63) && (_puzzleType[i] > 0)) {
- this->var_i16_68c++;
+ unsolvedPuzzles++;
}
}
// 128:4c74
_modalText[4] = _zbasic->str(aboutOff+8); // ' '
- if (this->var_i16_68c == 1) {
+ if (unsolvedPuzzles == 1) {
// There is 1 unsolved puzzle.
_modalText[5] = _zbasic->str(aboutOff+9);
} else {
// 128:4cc0
// There are X unsolved puzzles.
- _modalText[5] = Common::U32String::format("%s %d%s", _zbasic->str(aboutOff+10).encode().c_str(), this->var_i16_68c, _zbasic->str(aboutOff+11).encode().c_str());
+ _modalText[5] = Common::U32String::format("%s %d%s", _zbasic->str(aboutOff+10).encode().c_str(), unsolvedPuzzles, _zbasic->str(aboutOff+11).encode().c_str());
}
// 128:4cfc
- this->var_i16_d06 = 5;
+ modalLines = 5;
} else {
// 128:4d06
@@ -2230,7 +2228,7 @@ void FoolGame::menuAbout() {
// Only the Book of Thoth remains unsolved.
_modalText[6] = _zbasic->str(aboutOff+16);
_modalText[7] = _zbasic->str(aboutOff+17);
- this->var_i16_d06 = 7;
+ modalLines = 7;
}
// 128:4dc0
} else {
@@ -2241,7 +2239,7 @@ void FoolGame::menuAbout() {
// Only the Book of Thoth remains unsolved.
_modalText[4] = _zbasic->str(aboutOff+20);
_modalText[5] = _zbasic->str(aboutOff+21);
- this->var_i16_d06 = 5;
+ modalLines = 5;
}
// 128:4e42
g_toolbox->SetPort(this->var_i32_4);
@@ -2253,7 +2251,7 @@ void FoolGame::menuAbout() {
this->var_i16_7b4 = 0;
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
- for (int i = 0; i <= this->var_i16_d06 ; i++) {
+ for (int i = 0; i <= modalLines; i++) {
this->var_i16_7ba = g_toolbox->StringWidth(_modalText[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
@@ -2306,7 +2304,7 @@ void FoolGame::menuAbout() {
// 128:509a
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
- for (int i = 0; i <= this->var_i16_d06; i++) {
+ for (int i = 0; i <= modalLines; i++) {
this->var_str_384 = _modalText[i];
this->sub_128_918(this->var_str_384);
this->var_i16_7a2 += 0x11;
@@ -2316,7 +2314,7 @@ void FoolGame::menuAbout() {
this->var_i16_7a2 += 0xe;
this->sub_128_918(_zbasic->str(_zstrOffset[kOffsetVersion])); // version string
this->sub_128_2664();
- this->sub_128_61c2();
+ this->waitForClick();
g_toolbox->DrawMenuBar();
this->copyScreen(0x1, this->arr_bmp_138bc);
g_toolbox->SetPort(this->var_i32_0);
@@ -2476,7 +2474,7 @@ void FoolGame::thothShowPlayfield() {
}
// 128:5f70
if ((_stateFlags & kStateReturn) == 0) {
- this->sub_128_6186();
+ this->waitForMouseUp();
this->copyScreen(1, this->arr_bmp_b3ec);
}
}
@@ -2528,7 +2526,7 @@ void FoolGame::sub_128_6154() {
}
-void FoolGame::sub_128_6186() {
+void FoolGame::waitForMouseUp() {
// 128:6186
// wait until mouse button is up
do {
@@ -2540,9 +2538,9 @@ void FoolGame::sub_128_6186() {
} while ((_event.modifiers & kModMouseButtonUp) == 0);
}
-void FoolGame::sub_128_61c2() {
+void FoolGame::waitForClick() {
// 128:61c2
- this->sub_128_6186();
+ this->waitForMouseUp();
do {
// was originally a mask of 2
this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
@@ -2550,7 +2548,7 @@ void FoolGame::sub_128_61c2() {
if (_event.what == kNullEvent)
g_toolbox->Delay(0);
} while ((_event.what != kMouseDown));
- this->sub_128_6186();
+ this->waitForMouseUp();
}
@@ -2808,7 +2806,7 @@ void FoolGame::sub_129_068() {
for (int i = 0; i <= 0x15; i++) {
this->var_i16_484 = _zbasic->readDataInt();
_zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kSrcCopy);
- this->sub_128_3da(2);
+ this->delay(2);
}
// 129:0888
_zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kSrcCopy);
@@ -2850,16 +2848,15 @@ void FoolGame::sub_129_068() {
_zbasic->openR(1, Common::U32String("Fool's Puzzles"), 1000, this->var_i16_f22); // was: str(140)
this->var_i32_1036 = _zbasic->readFileDblInt(1);
- this->var_ptr_696 = 0;
+ this->_puzzleDataPtr = 0;
// read into pointer
- this->arr_bytes_5dfc = _zbasic->readFile(1, this->var_i32_1036);
- this->var_bytes_696 = this->arr_bytes_5dfc;
+ this->_puzzleDataBuffer = _zbasic->readFile(1, this->var_i32_1036);
// 129:0a0a
this->menuLoadingMessage(80);
for (int i = 1; i <= 0x64; i++) {
- _puzzleDataOffsets[i] = this->puzzlesReadLong();
+ _puzzleDataOffsets[i] = puzzlesReadLong();
}
// 129:0a4e
// quickdraw patterns
@@ -3068,10 +3065,10 @@ void FoolGame::menuLoadingMessage(int16 percent) {
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
- this->var_str_172 = Common::U32String::format("Loading Game - %d%%", percent); // was: str(158)
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo((_windowWidth / 2) - (this->var_i16_30 / 2), 0xe);
- g_toolbox->DrawString(this->var_str_172);
+ Common::U32String message = Common::U32String::format("Loading Game - %d%%", percent); // was: str(158)
+ int16 width = g_toolbox->StringWidth(message);
+ g_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xe);
+ g_toolbox->DrawString(message);
g_toolbox->_defaultMenu->setOverlayDirty(true);
g_toolbox->SetPort(this->var_i32_0);
g_toolbox->Delay(0);
@@ -3118,7 +3115,7 @@ void FoolGame::sub_144_004() {
sub_128_406(0xf);
}
// 144:0170
- sub_128_3da(0x3c);
+ delay(0x3c);
Common::Rect temp;
for (int16 i = 1; i <= 0x100; i++) {
var_i32_692 = g_toolbox->TickCount();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 1a9db387f50..a88aca3403f 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -92,13 +92,13 @@ public:
void run();
- void sub_128_004();
+ void foolRun(); // sub_128_004
void copyScreen(int16 put, BitMap &bmp); // sub_128_0a2
void openSaveFileDialog(const Common::U32String &title, const Common::U32String &filename); // sub_128_11c
void sub_128_1e4(const Common::U32String &unk1);
void sub_128_2be(int16 unk2, int16 unk1);
void sub_128_342(int16 unk2, int16 unk1);
- void sub_128_3da(int16 unk1);
+ void delay(int16 ticks); // sub_128_3da
void sub_128_406(int16 unk1);
int16 puzzlesReadByte(); // sub_128_428
int16 puzzlesReadShort(); // sub_128_446
@@ -106,10 +106,10 @@ public:
Common::String puzzlesReadString(); // sub_128_49a
void sub_128_4da(int16 unk1);
void playTone(int16 freq, int16 duration, int16 wait);
- void sub_128_55c(const Common::U32String &unk1);
+ void drawPuzzleButton(const Common::U32String &symbol); // sub_128_55c
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
- void sub_128_69c(int16 unk6, PatternMode unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void fillRect(int16 patternID, PatternMode mode, int16 top, int16 left, int16 bottom, int16 right); // sub_128_69c
void drawTarotCard(int16 rectID, int16 deckPos, int16 type); // sub_128_712
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
void sub_128_918(const Common::U32String &unk1);
@@ -119,7 +119,7 @@ public:
void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount, bool beep); // sub_128_dfe
- void sub_128_178a(int16 unk2, int16 unk1);
+ void showBehold(int16 unk2, int16 unk1, const Common::U32String &message); // sub_128_178a
void setStateBits(uint16 bits); // sub_128_1c2c
void clearStateBits(uint16 bits); // sub_128_1c4a
void sub_128_1ef8();
@@ -133,7 +133,7 @@ public:
void storyRenderPage(); // sub_128_2202
void sub_128_2664();
void sub_128_26f6();
- void sub_128_271a();
+ void fetchPuzzleData(); // sub_128_271a
void menuNewGame(); // sub_128_27d6
void sub_128_2808();
void menuOpenGame(); // sub_128_2988
@@ -142,7 +142,7 @@ public:
void menuSaveGameAs(); // sub_128_2a92
void menuQuit(); // sub_128_2ab6
void menuPrintStory(); // sub_128_2ae8
- void sub_128_2b0a();
+ void printStory(); // sub_128_2b0a
void newGame(); // sub_128_2bc6
void openGame(); // sub_128_2e3e
@@ -182,8 +182,8 @@ public:
void sub_128_5fb4();
void sub_128_5fea();
void sub_128_6154();
- void sub_128_6186();
- void sub_128_61c2();
+ void waitForMouseUp(); // sub_128_6186
+ void waitForClick(); // sub_128_61c2
void sub_128_61ec(); // sub_128_61ec
void sub_128_6244();
@@ -196,26 +196,26 @@ public:
void sub_130_c56();
void jumbleStoreState(); // sub_130_c66
void sub_130_d2e();
- void sub_130_d90();
+ void jumbleRunSubstitution(); // sub_130_d90
void sub_130_1004();
- void sub_130_10a6();
- void sub_130_1282();
+ void jumbleRunWordSquare(); // sub_130_10a6
+ void jumbleRunHiddenMessage(); // sub_130_1282
void sub_130_1426();
- void sub_130_1476();
- void sub_130_15da();
+ void jumbleOnClick(); // sub_130_1476
+ void jumbleOnKey(); // sub_130_15da
void sub_130_172c();
void sub_130_19ac();
- void sub_130_19da();
+ void jumbleClickFixedSquare(); // sub_130_19da
void sub_130_1a16();
void sub_130_1c1a();
- void sub_130_1c52();
+ void jumbleSelectSquare(); // sub_130_1c52
void sub_130_1c6c();
- void sub_130_1dcc();
+ void jumbleDrawLetter(); // sub_130_1dcc
void sub_130_1e5c();
void sub_130_1e76();
void sub_130_201a();
- void sub_130_2078();
- void sub_130_2094();
+ void jumbleNextPosition(); // sub_130_2078
+ void jumblePreviousPosition(); // sub_130_2094
void sub_130_20aa();
void sub_130_20d2();
void sub_130_20fe();
@@ -420,7 +420,7 @@ public:
void humbugRun(); // sub_142_004
void humbugTrail(); // sub_142_0e6
void sub_142_370();
- void sub_142_5f2();
+ void humbugSuccess(); // sub_142_5f2
void sub_142_630();
// fool_justice.cpp
@@ -492,9 +492,8 @@ private:
uint32 var_i32_692;
// this is normally a raw pointer to some memory,
// instead we track it as a handle + offset
- uint32 var_ptr_696;
- Handle var_bytes_696;
- Common::String var_str_69a;
+ uint32 _puzzleDataPtr; // var_ptr_696
+ Handle _puzzleDataBuffer; // var_bytes_696
int16 var_i16_78a;
int16 var_i16_79e;
int16 var_i16_7a0;
@@ -548,7 +547,6 @@ private:
int16 _activePuzzleStatus; // var_i16_c04
Common::String _activePuzzleBuffer; // var_str_c06
- int16 var_i16_d06;
int16 var_i16_d08;
int16 var_i16_d0a;
bool _activePuzzleSolved; // var_i16_d0c
@@ -590,6 +588,7 @@ private:
int16 var_i16_106a;
SourceMode var_i16_106c;
int16 var_i16_106e;
+ int16 _jumblePosition; // var_i16_106e
Common::U32String var_str_1070;
Common::U32String _sentenceBuffer; // var_str_1070
Common::U32String var_str_1170;
@@ -601,6 +600,7 @@ private:
Common::U32String var_str_1374;
Common::U32String var_str_1474;
int16 var_i16_1574;
+ int16 _jumbleSelected; // var_i16_1574
int16 var_i16_1576;
Common::U32String var_str_1578;
@@ -634,14 +634,14 @@ private:
int16 var_i16_1a98;
int16 var_i16_1a9a;
uint16 var_i16_1a9c;
- int16 var_i16_1a9e;
+ int16 _jigsawPieceCount; // var_i16_1a9e
int16 var_i16_1aa0;
int16 _metapuzzleSecretCodeSpaceOffset; // var_i16_1aa2
int16 var_i16_1aa4;
int16 var_i16_1aa6;
int16 var_i16_1aa8;
int16 var_i16_1aaa;
- PolyHandle var_poly_1aac;
+
int16 var_i16_1ab0;
int16 var_i16_1ab2;
int16 var_i16_1ab4;
@@ -776,7 +776,6 @@ private:
int16 arr_i16_5cbc[128];
int16 _mazeInvItemCount[128]; // arr_i16_5cbc
float arr_bcd_5dbc[8];
- Handle arr_bytes_5dfc; // used for data buffering
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap _jigsawPieces[128];
int16 arr_i16_9894[0xa43]; // inside 5dfc, used for humbug
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index f445f3fa7d1..ffe25c49ce1 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -38,7 +38,7 @@ void FoolGame::humbugRun() {
if (!_activePuzzleSolved) {
return;
}
- this->sub_142_5f2();
+ this->humbugSuccess();
if (_puzzleCompletionStatus[0x34] > 2) {
_activePuzzleStatus = 0x64;
return;
@@ -46,8 +46,8 @@ void FoolGame::humbugRun() {
// 142:004e
_activePuzzleStatus = 0x63;
this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- this->var_str_384 = _zbasic->str(OFF(0)); // behold the 2nd key of thoth
- this->sub_128_178a(0x17, 0);
+ // behold the 2nd key of thoth
+ this->showBehold(0x17, 0, _zbasic->str(OFF(0)));
}
// 142:00b2
if (_activePuzzleStatus == 0x63) {
@@ -56,7 +56,7 @@ void FoolGame::humbugRun() {
if (_activePuzzleStatus >= 0x64) {
this->humbugTrail();
if (_activePuzzleSolved) {
- this->sub_142_5f2();
+ this->humbugSuccess();
}
}
// 142:00e2
@@ -74,10 +74,10 @@ void FoolGame::humbugTrail() {
_zbasic->menu(8, 4, 1, _zbasic->str(OFF(4))); // if the two become one.
}
// 142:0166
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->sub_128_4da(0);
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
- this->sub_128_55c(_zbasic->str(OFF(5))); // ~
+ this->drawPuzzleButton(_zbasic->str(OFF(5))); // ~
// eye button
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
for (int16 i = 1; i <= 0xa42; i++) {
@@ -188,7 +188,7 @@ void FoolGame::sub_142_370() {
// 142:05f0
}
-void FoolGame::sub_142_5f2() {
+void FoolGame::humbugSuccess() {
// 142:05f2
this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
}
@@ -222,7 +222,7 @@ void FoolGame::sub_142_630() {
}
// 142:07ca
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_2664();
this->var_i16_484 = 0;
this->var_i16_7e4 = 0;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 784590b5fff..bf4998abc3a 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -36,19 +36,19 @@ extern Toolbox *g_toolbox;
void FoolGame::jigsawRun() {
// 132:0004
this->var_i16_c00 = 1;
- this->sub_128_271a();
- this->var_i16_1066 = puzzlesReadShort();
+ this->fetchPuzzleData();
+ int16 picID = puzzlesReadShort();
for (int i = 0; i <= 0xe; i++) {
this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 132:0044
// puzzle dimensions
- this->var_i16_1a9e = this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1];
- for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ this->_jigsawPieceCount = this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1];
+ for (int i = 1; i <= this->_jigsawPieceCount; i++) {
this->arr_i16_3738[i] = puzzlesReadByte();
}
// 132:00a2
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(picID);
_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
this->var_i16_1aa0 = 4 + ((this->arr_i16_1eb8[12] + 1)*2) * ((this->arr_i16_1eb8[13]+0x10)/0x10);
@@ -99,7 +99,7 @@ void FoolGame::jigsawRun() {
// 132:0376
// rearrange picture tiles to match state
if (!_activePuzzleBuffer.empty()) { // was: str(OFF(0))
- for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ for (int i = 1; i <= this->_jigsawPieceCount; i++) {
Common::String tileData = _zbasic->midStr(_activePuzzleBuffer, i*2 - 1, 2);
this->arr_i16_3738[i] = _zbasic->decodeInt(tileData);
_zbasic->put(
@@ -181,7 +181,7 @@ void FoolGame::jigsawOnClick() {
this->jigsawDropSelected();
this->jigsawCheckIfSolved();
- this->sub_128_6186();
+ this->waitForMouseUp();
_zbasic->menu(8, 3, 1, Common::U32String());
_menuDisabled = false;
}
@@ -218,9 +218,9 @@ void FoolGame::jigsawDragSelect() {
Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
// 132:092e
g_toolbox->FrameRect(temp);
- this->sub_128_3da(2);
+ this->delay(2);
g_toolbox->FrameRect(temp);
- this->sub_128_3da(1);
+ this->delay(1);
} while (_event.what != kMouseUp);
}
@@ -277,9 +277,9 @@ void FoolGame::jigsawMoveSelected() {
this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
// 132:0e0e
g_toolbox->FrameRect(this->arr_rect_4776);
- this->sub_128_3da(2);
+ this->delay(2);
g_toolbox->FrameRect(this->arr_rect_4776);
- this->sub_128_3da(1);
+ this->delay(1);
}
while (!((_event.what == kMouseDown) && (_event.where.y > 0x14)));
}
@@ -297,7 +297,7 @@ void FoolGame::jigsawCancelSelect() {
void FoolGame::jigsawDropSelected() {
// 132:0ed8
// skip the tile pointer to past the end of the list
- this->var_i16_1aa4 = this->var_i16_1a9e;
+ this->var_i16_1aa4 = this->_jigsawPieceCount;
// arr_i16_4758[2]: src_left
// arr_i16_4758[3]: src_right
@@ -323,7 +323,7 @@ void FoolGame::jigsawDropSelected() {
// 132:0fbc
// tile pointer to buffer 2
this->var_i16_1aa6 = this->var_i16_1aa4;
- this->var_i16_1aa4 = this->var_i16_1a9e;
+ this->var_i16_1aa4 = this->_jigsawPieceCount;
// 132:0fc8
// iterate through dest tile positions
@@ -379,7 +379,7 @@ void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
_activePuzzleBuffer.clear(); // was: str(OFF(1))
- for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ for (int i = 1; i <= this->_jigsawPieceCount; i++) {
_activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_3738[i]);
}
}
@@ -389,10 +389,10 @@ void FoolGame::jigsawCheckIfSolved() {
// check if puzzle is solved
// 132:13ea
_activePuzzleSolved = true;
- for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ for (int i = 1; i <= this->_jigsawPieceCount; i++) {
if (this->arr_i16_3738[i] != i) {
_activePuzzleSolved = false;
- i = this->var_i16_1a9e;
+ i = this->_jigsawPieceCount;
}
// 132:1420
}
@@ -407,15 +407,15 @@ void FoolGame::jigsawSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
for (int j = 0; j <= 1; j++) {
- for (int i = 1; i <= this->var_i16_1a9e; i++) {
+ for (int i = 1; i <= this->_jigsawPieceCount; i++) {
g_toolbox->InvertRect(_screenGrid[i]);
- this->sub_128_3da(1);
+ this->delay(1);
}
}
}
// 132:149c
this->sub_128_2664();
- this->sub_128_61c2();
+ this->waitForClick();
}
};
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index b03dc844c31..fe9c9d05362 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -33,7 +33,7 @@ extern Toolbox *g_toolbox;
void FoolGame::jumbleRun() {
// 130:0004
_activePuzzleSolved = false;
- this->sub_128_271a();
+ this->fetchPuzzleData();
_jumbleSubPuzzleCount = puzzlesReadShort();
debugC(5, kDebugLoading, "FoolGame::jumbleRun: racking %d subpuzzles", _jumbleSubPuzzleCount);
@@ -83,12 +83,12 @@ void FoolGame::jumbleRun() {
this->var_i16_105c = puzzlesReadShort();
this->var_i16_105e = puzzlesReadShort();
this->var_i16_1060 = puzzlesReadShort();
- this->var_i16_1062 = puzzlesReadShort();
- this->var_i16_1064 = puzzlesReadShort();
- this->var_i16_1066 = puzzlesReadShort();
- if (this->var_i16_1066 > 0) {
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_i32_192c0[0]);
+ int16 picX = puzzlesReadShort();
+ int16 picY = puzzlesReadShort();
+ int16 picID = puzzlesReadShort();
+ if (picID > 0) {
+ this->arr_i32_192c0[0] = g_toolbox->GetPicture(picID);
+ _zbasic->picture(picX, picY, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
}
}
@@ -146,7 +146,7 @@ void FoolGame::jumbleRun() {
}
// 130:03fe
//if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle)
- this->var_i16_106e = 0;
+ this->_jumblePosition = 0;
this->var_str_1070.clear(); // was: str(168)
this->var_str_1170.clear(); // was: str(169)
this->var_i16_1270 = puzzlesReadShort();
@@ -195,17 +195,17 @@ void FoolGame::jumbleRun() {
}
// 130:0628
for (this->var_i16_484 = 1; this->var_i16_484 <= this->var_i16_1372; this->var_i16_484++) {
- this->var_i16_106e++;
- this->arr_i16_3738[this->var_i16_106e] = puzzlesReadShort();
- this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
+ this->_jumblePosition++;
+ this->arr_i16_3738[this->_jumblePosition] = puzzlesReadShort();
+ this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
this->sub_130_20fe();
this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_103a;
- this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_106e;
+ this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] = this->_jumblePosition;
this->sub_130_1c6c();
- this->var_str_d12 = _zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
+ this->var_str_d12 = _zbasic->midStr(this->var_str_1070, this->_jumblePosition, 1);
// 130:06d4
if ((_activePuzzle <= 0x50) || (_activePuzzle == 0x55)) {
- this->sub_130_1dcc();
+ this->jumbleDrawLetter();
} else {
// 130:0700
this->sub_130_1e76();
@@ -274,17 +274,17 @@ void FoolGame::jumbleRun() {
this->sub_130_d2e();
break;
case 1:
- this->sub_130_d90();
+ this->jumbleRunSubstitution();
break;
case 2:
this->sub_130_1004();
break;
case 3:
case 4: // word square
- this->sub_130_10a6();
+ jumbleRunWordSquare();
break;
case 5: // hidden message
- this->sub_130_1282();
+ jumbleRunHiddenMessage();
break;
default:
break;
@@ -325,7 +325,7 @@ void FoolGame::jumbleRun() {
// if we're here, the puzzle is solved
g_toolbox->PenNormal();
this->sub_128_2664();
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_61ec();
// 130:0a90
if (_activePuzzle != 0x55) {
@@ -385,6 +385,7 @@ void FoolGame::jumbleRun() {
}
void FoolGame::sub_130_c56() {
+ warning(__func__);
// 130:0c56
this->jumbleStoreState();
this->saveGame();
@@ -419,6 +420,7 @@ void FoolGame::jumbleStoreState() {
}
void FoolGame::sub_130_d2e() {
+ warning(__func__);
// 130:0d2e
this->sub_130_1426();
this->sub_128_61ec();
@@ -426,7 +428,7 @@ void FoolGame::sub_130_d2e() {
while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->sub_130_1476();
+ this->jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
@@ -434,7 +436,8 @@ void FoolGame::sub_130_d2e() {
}
}
-void FoolGame::sub_130_d90() {
+void FoolGame::jumbleRunSubstitution() {
+ warning(__func__);
// 130:0d90
// substitution cipher
if (!_zbasic->index(1, 1).empty()) { // was: str(177)
@@ -471,7 +474,7 @@ void FoolGame::sub_130_d90() {
this->var_str_1578.clear(); // was: str(180);
}
// 130:0f86
- this->var_i16_106e = 1;
+ this->_jumblePosition = 1;
this->sub_130_1c1a();
this->sub_128_61ec();
_stateFlags = kStateNull;
@@ -481,24 +484,25 @@ void FoolGame::sub_130_d90() {
// 130:0fa4
this->getNextEvent(-1);
if (_keyLastPressed != 0) {
- this->sub_130_15da();
+ this->jumbleOnKey();
}
if (_event.what == kMouseDown) {
- this->sub_130_1476();
+ this->jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
// 130:0ffe
- this->sub_130_1c52();
+ this->jumbleSelectSquare();
}
void FoolGame::sub_130_1004() {
+ warning(__func__);
// 130:1004
- this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(181)
- if (this->var_i16_106e == 0) {
- this->var_i16_106e = 1;
+ this->_jumblePosition = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(181)
+ if (this->_jumblePosition == 0) {
+ this->_jumblePosition = 1;
}
this->sub_130_20d2();
this->sub_128_61ec();
@@ -508,19 +512,20 @@ void FoolGame::sub_130_1004() {
while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
this->getNextEvent(-1);
if (_keyLastPressed != 0) {
- this->sub_130_15da();
+ this->jumbleOnKey();
}
if (_event.what == kMouseDown) {
- this->sub_130_1476();
+ this->jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
}
}
- this->sub_130_1c52();
+ this->jumbleSelectSquare();
}
-void FoolGame::sub_130_10a6() {
+void FoolGame::jumbleRunWordSquare() {
+ warning(__func__);
// 130:10a6
// word square
this->sub_130_1426();
@@ -540,7 +545,7 @@ void FoolGame::sub_130_10a6() {
while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
this->getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->sub_130_1476();
+ this->jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
this->sub_130_c56();
@@ -548,12 +553,13 @@ void FoolGame::sub_130_10a6() {
}
}
-void FoolGame::sub_130_1282() {
+void FoolGame::jumbleRunHiddenMessage() {
+ warning(__func__);
// 130:1282
// hidden message, change the mouse cursor
- this->var_i16_106e = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(182)
- if (this->var_i16_106e == 0) {
- this->var_i16_106e = 1;
+ this->_jumblePosition = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(182)
+ if (this->_jumblePosition == 0) {
+ this->_jumblePosition = 1;
}
this->sub_130_20d2();
this->sub_128_61ec();
@@ -565,11 +571,11 @@ void FoolGame::sub_130_1282() {
// 130:12cc
this->getNextEvent(-1);
if (_keyLastPressed != 0) {
- this->sub_130_15da();
+ this->jumbleOnKey();
}
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if (_event.what == kMouseDown) {
- this->sub_130_1476();
+ this->jumbleOnClick();
}
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
this->var_i16_187c = 0;
@@ -593,11 +599,12 @@ void FoolGame::sub_130_1282() {
}
}
// 130:141e
- this->sub_130_1c52();
+ this->jumbleSelectSquare();
g_toolbox->InitCursor();
}
void FoolGame::sub_130_1426() {
+ warning(__func__);
// 130:1426
this->var_i16_187e = 0;
this->var_i16_1880 = 0;
@@ -609,7 +616,8 @@ void FoolGame::sub_130_1426() {
// 130:1474
}
-void FoolGame::sub_130_1476() {
+void FoolGame::jumbleOnClick() {
+ warning(__func__);
// 130:1476
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
@@ -644,23 +652,24 @@ void FoolGame::sub_130_1476() {
this->sub_130_172c();
break;
default:
- warning("sub_130_1476: unhandled case %d", _jumbleGameType-1);
+ warning("jumbleOnClick: unhandled case %d", _jumbleGameType-1);
break;
}
}
-void FoolGame::sub_130_15da() {
+void FoolGame::jumbleOnKey() {
+ warning(__func__);
// 130:15da
if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
- this->sub_130_1c52();
- this->sub_130_2078();
+ this->jumbleSelectSquare();
+ this->jumbleNextPosition();
this->sub_130_20d2();
_keyLastPressed = 0;
return;
}
if (_keyLastPressed == 8) {
- this->sub_130_1c52();
- this->sub_130_2094();
+ this->jumbleSelectSquare();
+ this->jumblePreviousPosition();
this->sub_130_20d2();
_keyLastPressed = 0;
return;
@@ -702,10 +711,11 @@ void FoolGame::sub_130_15da() {
}
void FoolGame::sub_130_172c() {
+ warning(__func__);
// 130:172c
// word square, disallow clicking the centre tile
if ((_jumbleGameType == 4) && (this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] == 5)) {
- this->sub_130_19da();
+ this->jumbleClickFixedSquare();
return;
}
// 130:1776
@@ -731,21 +741,22 @@ void FoolGame::sub_130_172c() {
this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
_zbasic->midStrSet(this->var_str_1070, this->var_i16_1884, 1, this->var_str_1474);
_zbasic->midStrSet(this->var_str_1070, this->var_i16_1886, 1, this->var_str_1374);
- this->var_i16_1574 = this->var_i16_187e;
- this->var_i16_106e = this->var_i16_1884;
+ this->_jumbleSelected = this->var_i16_187e;
+ this->_jumblePosition = this->var_i16_1884;
this->var_str_d12 = this->var_str_1474;
this->sub_130_1c6c();
- this->sub_130_1dcc();
- this->var_i16_1574 = this->var_i16_1880;
- this->var_i16_106e = this->var_i16_1886;
+ this->jumbleDrawLetter();
+ this->_jumbleSelected = this->var_i16_1880;
+ this->_jumblePosition = this->var_i16_1886;
this->var_str_d12 = this->var_str_1374;
this->sub_130_1c6c();
- this->sub_130_1dcc();
+ this->jumbleDrawLetter();
this->var_i16_187e = 0;
this->var_i16_1880 = 0;
}
void FoolGame::sub_130_19ac() {
+ warning(__func__);
// 130:19ac
if (this->var_i16_187e > 0) {
g_toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
@@ -754,25 +765,27 @@ void FoolGame::sub_130_19ac() {
this->var_i16_1880 = 0;
}
-void FoolGame::sub_130_19da() {
+void FoolGame::jumbleClickFixedSquare() {
+ warning(__func__);
// 130:19da
// fixed tile
this->sub_130_19ac();
this->playTone(0x19, 0x64, 0);
for (int i = 0; i <= 0x19; i++) {
g_toolbox->InvertRect(_screenGrid[13]);
- this->sub_128_3da(1);
+ this->delay(1);
}
}
void FoolGame::sub_130_1a16() {
+ warning(__func__);
// 130:1a16
this->var_str_1374 = this->var_str_d12;
- this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->var_i16_106e, 1);
+ this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->_jumblePosition, 1);
if (this->var_str_1374 == this->var_str_1474)
return;
// 130:1a5c
- this->sub_130_1c52();
+ this->jumbleSelectSquare();
for (int16 i = 1; i <= this->var_i16_1576; i++) {
// 130:1a66
this->var_str_384 = _zbasic->midStr(this->var_str_1070, i, 1);
@@ -785,9 +798,9 @@ void FoolGame::sub_130_1a16() {
}
// 130:1ae8
_zbasic->midStrSet(this->var_str_1070, i, 1, this->var_str_d12);
- this->var_i16_1574 = ABS(this->arr_i16_3738[i]);
+ this->_jumbleSelected = ABS(this->arr_i16_3738[i]);
this->sub_130_1c6c();
- this->sub_130_1dcc();
+ this->jumbleDrawLetter();
}
// 130:1b2e
}
@@ -815,32 +828,35 @@ void FoolGame::sub_130_1a16() {
}
void FoolGame::sub_130_1c1a() {
+ warning(__func__);
// 130:1c1a
- this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
- g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
+ this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
+ g_toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
}
-void FoolGame::sub_130_1c52() {
+void FoolGame::jumbleSelectSquare() {
+ warning(__func__);
// 130:1c52
- g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
}
void FoolGame::sub_130_1c6c() {
+ warning(__func__);
g_toolbox->PenNormal();
- g_toolbox->FillRect(_screenGrid[this->var_i16_1574], _patterns[this->var_i16_105e]);
+ g_toolbox->FillRect(_screenGrid[this->_jumbleSelected], _patterns[this->var_i16_105e]);
g_toolbox->PenPat(_patterns[this->var_i16_105c]);
- g_toolbox->FrameRect(_screenGrid[this->var_i16_1574]);
- if (this->arr_i16_3738[this->var_i16_106e] >= 0) {
+ g_toolbox->FrameRect(_screenGrid[this->_jumbleSelected]);
+ if (this->arr_i16_3738[this->_jumblePosition] >= 0) {
return;
}
// 130:1ce2
if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
return;
}
- this->arr_i16_4758[0] = _screenGrid[this->var_i16_1574].top + 2;
- this->arr_i16_4758[1] = _screenGrid[this->var_i16_1574].left + 2;
- this->arr_i16_4758[2] = _screenGrid[this->var_i16_1574].bottom - 2;
- this->arr_i16_4758[3] = _screenGrid[this->var_i16_1574].right - 2;
+ this->arr_i16_4758[0] = _screenGrid[this->_jumbleSelected].top + 2;
+ this->arr_i16_4758[1] = _screenGrid[this->_jumbleSelected].left + 2;
+ this->arr_i16_4758[2] = _screenGrid[this->_jumbleSelected].bottom - 2;
+ this->arr_i16_4758[3] = _screenGrid[this->_jumbleSelected].right - 2;
Common::Rect temp;
temp.top = this->arr_i16_4758[0];
temp.left = this->arr_i16_4758[1];
@@ -849,29 +865,32 @@ void FoolGame::sub_130_1c6c() {
g_toolbox->FrameRect(temp);
}
-void FoolGame::sub_130_1dcc() {
+void FoolGame::jumbleDrawLetter() {
+ warning(__func__);
// 130:1dcc
_zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
g_toolbox->MoveTo(
- _screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
- _screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ _screenGrid[this->_jumbleSelected].left + this->arr_i16_1eb8[2],
+ _screenGrid[this->_jumbleSelected].top + this->arr_i16_1eb8[3]
);
g_toolbox->DrawString(this->var_str_d12);
}
void FoolGame::sub_130_1e5c() {
+ warning(__func__);
// 130:1e5c
g_toolbox->PenNormal();
- g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
+ g_toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
this->sub_130_1e76();
}
void FoolGame::sub_130_1e76() {
+ warning(__func__);
// 130:1e76
- this->arr_i16_4758[0] = _screenGrid[this->var_i16_1574].top + 3;
- this->arr_i16_4758[1] = _screenGrid[this->var_i16_1574].left + 3;
- this->arr_i16_4758[2] = _screenGrid[this->var_i16_1574].bottom - 3;
- this->arr_i16_4758[3] = _screenGrid[this->var_i16_1574].right - 3;
+ this->arr_i16_4758[0] = _screenGrid[this->_jumbleSelected].top + 3;
+ this->arr_i16_4758[1] = _screenGrid[this->_jumbleSelected].left + 3;
+ this->arr_i16_4758[2] = _screenGrid[this->_jumbleSelected].bottom - 3;
+ this->arr_i16_4758[3] = _screenGrid[this->_jumbleSelected].right - 3;
Common::Rect temp;
temp.top = this->arr_i16_4758[0];
temp.left = this->arr_i16_4758[1];
@@ -881,11 +900,11 @@ void FoolGame::sub_130_1e76() {
_zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
// 130:1f70
g_toolbox->MoveTo(
- _screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2],
- _screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
+ _screenGrid[this->_jumbleSelected].left + this->arr_i16_1eb8[2],
+ _screenGrid[this->_jumbleSelected].top + this->arr_i16_1eb8[3]
);
g_toolbox->DrawString(this->var_str_d12);
- if (this->arr_i16_3738[this->var_i16_106e] < 0)
+ if (this->arr_i16_3738[this->_jumblePosition] < 0)
return;
// 130:1ff4
g_toolbox->PenNormal();
@@ -895,60 +914,67 @@ void FoolGame::sub_130_1e76() {
}
void FoolGame::sub_130_201a() {
+ warning(__func__);
// 130:201a
- _zbasic->midStrSet(this->var_str_1070, this->var_i16_106e, 1, this->var_str_d12);
+ _zbasic->midStrSet(this->var_str_1070, this->_jumblePosition, 1, this->var_str_d12);
if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
this->sub_130_1e5c();
} else {
// 130:2066
this->sub_130_1c6c();
- this->sub_130_1dcc();
+ this->jumbleDrawLetter();
}
// 130:206e
- this->sub_130_2078();
+ this->jumbleNextPosition();
this->sub_130_20d2();
}
-void FoolGame::sub_130_2078() {
+void FoolGame::jumbleNextPosition() {
+ warning(__func__);
// 130:2078
- this->var_i16_106e++;
- if (this->var_i16_106e > this->var_i16_1576) {
- this->var_i16_106e = 1;
+ this->_jumblePosition++;
+ if (this->_jumblePosition > this->var_i16_1576) {
+ this->_jumblePosition = 1;
}
}
-void FoolGame::sub_130_2094() {
+void FoolGame::jumblePreviousPosition() {
+ warning(__func__);
// 130:2094
- this->var_i16_106e--;
- if (this->var_i16_106e < 1) {
- this->var_i16_106e = this->var_i16_1576;
+ this->_jumblePosition--;
+ if (this->_jumblePosition < 1) {
+ this->_jumblePosition = this->var_i16_1576;
}
}
void FoolGame::sub_130_20aa() {
+ warning(__func__);
// 130:20aa
- this->sub_130_1c52();
- this->var_i16_106e = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
+ this->jumbleSelectSquare();
+ this->_jumblePosition = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
this->sub_130_20d2();
}
void FoolGame::sub_130_20d2() {
+ warning(__func__);
// 130:20d2
- this->var_i16_1574 = ABS(this->arr_i16_3738[this->var_i16_106e]);
- this->sub_130_1c52();
+ this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
+ this->jumbleSelectSquare();
this->sub_130_20fe();
this->sub_130_2178();
}
void FoolGame::sub_130_20fe() {
+ warning(__func__);
// 130:20fe
- this->var_i16_1888 = ABS(this->arr_i16_3738[this->var_i16_106e]) - 1;
+ this->var_i16_1888 = ABS(this->arr_i16_3738[this->_jumblePosition]) - 1;
this->var_i16_68a = (this->var_i16_1888 % this->arr_i16_1eb8[0]) + 1;
this->var_i16_68c = (this->var_i16_1888 / this->arr_i16_1eb8[0]) + 1;
}
void FoolGame::sub_130_2178() {
+ warning(__func__);
// 130:2178
if ((this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == this->var_i16_1678) || (_jumbleGameType == 2))
return;
@@ -962,20 +988,21 @@ void FoolGame::sub_130_2178() {
}
void FoolGame::sub_130_2226() {
+ warning(__func__);
// 130:2226
- if (_activePuzzle == 0x14) {
+ if (_activePuzzle == 0x14) { // the blacksmith
this->sub_130_23cc();
return;
}
- if (_activePuzzle == 0x3c) {
+ if (_activePuzzle == 0x3c) { // the boat
this->sub_130_22ee();
return;
}
- if (_activePuzzle == 0x35) {
+ if (_activePuzzle == 0x35) { // the sentry
this->sub_130_24aa();
return;
}
- if (_activePuzzle == 0x55) {
+ if (_activePuzzle == 0x55) { // final puzzle
this->sub_130_2548();
return;
}
@@ -991,6 +1018,7 @@ void FoolGame::sub_130_2226() {
}
void FoolGame::sub_130_22ee() {
+ warning(__func__);
// 130:22ee
this->fillRect(0x131, 0x84, 0x156, 0x17e, this->var_i16_1060);
if (this->var_str_1578.empty()) // was: str(187)
@@ -1003,6 +1031,7 @@ void FoolGame::sub_130_22ee() {
}
void FoolGame::sub_130_23cc() {
+ warning(__func__);
// 130:23cc
this->fillRect(0x12c, 0x8c, 0x156, 0x186, this->var_i16_1060);
if (this->var_str_1578.empty()) // was: str(188)
@@ -1015,6 +1044,7 @@ void FoolGame::sub_130_23cc() {
}
void FoolGame::sub_130_24aa() {
+ warning(__func__);
// 130:24aa
this->fillRect(0x125, 0x20, 0x136, 0x15e, 2);
if (this->var_str_1578.empty()) // was: str(189)
@@ -1026,6 +1056,7 @@ void FoolGame::sub_130_24aa() {
}
void FoolGame::sub_130_2548() {
+ warning(__func__);
// 130:2548
_zbasic->text(kFontFool, 0xc, 0, kSrcOr);
this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
@@ -1039,6 +1070,7 @@ void FoolGame::sub_130_2548() {
}
void FoolGame::sub_130_25d8() {
+ warning(__func__);
// 130:25d8
_zbasic->unk_20();
this->var_i16_188a = this->var_str_384.size();
@@ -1078,6 +1110,7 @@ void FoolGame::sub_130_25d8() {
}
void FoolGame::sub_130_2790() {
+ warning(__func__);
_zbasic->unk_20();
for (int16 i = 1; i <= 0x1a; i++) {
this->arr_i16_5bbc[i] = i;
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index 3f58d2240ca..38ecc1f6df6 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -48,8 +48,8 @@ void FoolGame::justiceRun() {
// 142:08a2
this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
_activePuzzleStatus = 0x63;
- this->var_str_384 = _zbasic->str(OFF(0)); // behold the 3rd key of thoth
- this->sub_128_178a(0x3f, 1);
+ // behold the 3rd key of thoth
+ this->showBehold(0x3f, 1, _zbasic->str(OFF(0)));
}
}
// 142:0906
@@ -78,7 +78,7 @@ void FoolGame::justiceRun() {
void FoolGame::sub_142_9be() {
// 142:09be
- this->sub_128_271a();
+ this->fetchPuzzleData();
for (int16 i = 1; i <= 0x19; i++) {
_zbasic->indexRawSet(puzzlesReadString(), 1, i);
}
@@ -216,7 +216,7 @@ void FoolGame::justiceOnClick() {
_activePuzzleSolved = false;
}
}
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::justiceZoom() {
@@ -266,7 +266,7 @@ void FoolGame::justiceStoreState() {
void FoolGame::justiceResetGrid() {
// 142:11fe
- this->sub_128_3da(0x28);
+ this->delay(0x28);
_activePuzzleBuffer.clear();
for (int16 i = 1; i <= 0x19; i++) {
this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index fdef4ba9b41..9d04de525bc 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -32,7 +32,7 @@ extern Toolbox *g_toolbox;
void FoolGame::mazeRun() {
// 136:0004
- sub_128_271a();
+ fetchPuzzleData();
sub_128_4da(0);
for (int16 i = 0; i <= 0x17; i++) {
arr_i16_1eb8[i] = puzzlesReadShort();
@@ -996,7 +996,7 @@ void FoolGame::mazeThornsGetScroll() {
void FoolGame::sub_136_21fa() {
warning(__func__);
// 136:21fa
- sub_128_6186();
+ waitForMouseUp();
}
void FoolGame::sub_136_2200() {
@@ -1528,7 +1528,7 @@ void FoolGame::sub_136_3a70() {
if (_activePuzzle == 0x57) {
_activePuzzleStatus = 0x64;
sub_128_2664();
- sub_128_61c2();
+ waitForClick();
} else {
// 136:3a8e
if (_activePuzzleStatus < 0x64) {
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 8a32d6f7a94..326630f93eb 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -43,7 +43,7 @@ void FoolGame::metapuzzleRun() {
var_i16_7ce |= 1;
copyScreen(0, arr_bmp_5dfc);
fillRect(0x127, 0x69, 0x138, 0x190, 0);
- sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
fillRect(0x14, 0x67, SCREEN_HEIGHT, 0x1b1, 2);
var_i16_484 = 0;
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
@@ -202,7 +202,7 @@ void FoolGame::metapuzzleWheel() {
}
_zbasic->picture(6, 0x6d, _metapuzzleWheelPic);
sub_128_2664();
- sub_128_61c2();
+ waitForClick();
}
void FoolGame::metapuzzleSecretCode() {
@@ -362,7 +362,7 @@ void FoolGame::sub_138_a90() {
_stateFlags = kStateReturn;
_activePuzzleBuffer = var_str_1272;
sub_128_2664();
- sub_128_6186();
+ waitForMouseUp();
sub_128_d34(arr_i16_1eb8[0], arr_i16_1eb8[1], arr_i16_1eb8[2], arr_i16_1eb8[3], 0xc8);
}
@@ -378,7 +378,7 @@ void FoolGame::metapuzzleOnOption() {
temp.bottom = arr_i16_4d20[var_i16_bfc*4+2];
temp.right = arr_i16_4d20[var_i16_bfc*4+3];
g_toolbox->InvertRect(temp);
- sub_128_3da(3);
+ delay(3);
g_toolbox->InvertRect(temp);
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 2961239629e..23e2d2047f8 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -33,16 +33,16 @@ extern Toolbox *g_toolbox;
// polyomino puzzle
void FoolGame::polyominoRun() {
// 133:0004
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->var_i16_c00 = 1;
for (int i = 0; i <= 0x11; i++) {
this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 133:003c
- this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
+ Common::U32String hint = puzzlesReadString().decode(Common::kMacRoman);
// "the completed puzzle will reveal..."
- this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1));
- _zbasic->menu(8, 0xf, 1, this->var_str_384);
+ hint = _zbasic->str(OFF(0)) + hint + _zbasic->str(OFF(1));
+ _zbasic->menu(8, 0xf, 1, hint);
this->var_i16_484 = 0;
this->var_i16_68c = this->arr_i16_1eb8[8];
do {
@@ -101,22 +101,24 @@ void FoolGame::polyominoRun() {
for (int i = 5; i <= 6; i++) {
this->arr_i16_47d8[j*8 + i] = this->arr_i16_47d8[j*8 + i - 2];
}
- debug(5,"FoolGame::polyominoRun: adding polyomino %d:", j);
- for (int i = 0; i < 4; i++) {
- uint16 data =(this->arr_i16_47d8[j*8] >> (i*4)) & 0xf;
- debug(5, "%s%s%s%s",
- data & 0x1 ? "#" : " ",
- data & 0x2 ? "#" : " ",
- data & 0x4 ? "#" : " ",
- data & 0x8 ? "#" : " "
- );
- }
- debug(5, "%d, %d, start position %d, %d",
+ if (debugLevelSet(5)) {
+ debug(5,"FoolGame::polyominoRun: adding polyomino %d:", j);
+ for (int i = 0; i < 4; i++) {
+ uint16 data = (this->arr_i16_47d8[j*8] >> (i*4)) & 0xf;
+ debug(5, "%s%s%s%s",
+ data & 0x1 ? "#" : " ",
+ data & 0x2 ? "#" : " ",
+ data & 0x4 ? "#" : " ",
+ data & 0x8 ? "#" : " "
+ );
+ }
+ debug(5, "%d, %d, start position %d, %d",
this->arr_i16_47d8[j*8 + 1],
this->arr_i16_47d8[j*8 + 2],
this->arr_i16_47d8[j*8 + 3],
this->arr_i16_47d8[j*8 + 4]
- );
+ );
+ }
// 133:02de
if (!_activePuzzleBuffer.empty()) { // was: str(OFF(2))
if (j == 1) {
@@ -135,7 +137,7 @@ void FoolGame::polyominoRun() {
// 133:0388
// create polyomino polygons from coordinates
- this->var_poly_1aac = g_toolbox->OpenPoly();
+ PolyHandle poly = g_toolbox->OpenPoly(); // var_poly_1aac
g_toolbox->MoveTo(this->arr_i16_4338[1], this->arr_i16_4338[0]);
for (int i = 2; i <= this->var_i16_103a; i += 2) {
g_toolbox->LineTo(this->arr_i16_4338[i+1], this->arr_i16_4338[i]);
@@ -168,7 +170,7 @@ void FoolGame::polyominoRun() {
}
}
// 133:050a
- g_toolbox->InvertPoly(this->var_poly_1aac);
+ g_toolbox->InvertPoly(poly);
g_toolbox->ClosePicture();
this->arr_pic_49d8[j*4] = handle;
g_toolbox->PenNormal();
@@ -176,9 +178,9 @@ void FoolGame::polyominoRun() {
// 133:0530: JSR - "PICTURE_ON"
// picture handle 1:
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- g_toolbox->FillPoly(this->var_poly_1aac, _patterns[this->arr_i16_1eb8[0x1a]]);
+ g_toolbox->FillPoly(poly, _patterns[this->arr_i16_1eb8[0x1a]]);
g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
- g_toolbox->FramePoly(this->var_poly_1aac);
+ g_toolbox->FramePoly(poly);
// 133:0582
if (this->var_i16_103a >= 3) {
g_toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
@@ -189,7 +191,7 @@ void FoolGame::polyominoRun() {
}
}
// 133:061a
- g_toolbox->FramePoly(this->var_poly_1aac);
+ g_toolbox->FramePoly(poly);
g_toolbox->ClosePicture();
// 133:0622
this->arr_pic_49d8[j*4 + 1] = handle;
@@ -199,13 +201,13 @@ void FoolGame::polyominoRun() {
// picture handle 2: draw the shape without letters
handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
- g_toolbox->FramePoly(this->var_poly_1aac);
- g_toolbox->PaintPoly(this->var_poly_1aac);
+ g_toolbox->FramePoly(poly);
+ g_toolbox->PaintPoly(poly);
g_toolbox->ClosePicture();
this->arr_pic_49d8[j*4 + 2] = handle;
// clear polygon data
- g_toolbox->KillPoly(this->var_poly_1aac);
+ g_toolbox->KillPoly(poly);
// 133:0698
}
// 133:06b4
@@ -266,7 +268,7 @@ void FoolGame::polyominoOnClick() {
this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
debug(5, "FoolGame::polyominoOnClick: grid pos: (%d, %d)", this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
- this->sub_128_6186();
+ this->waitForMouseUp();
return;
}
// 133:0904
@@ -275,7 +277,7 @@ void FoolGame::polyominoOnClick() {
debug(5, "FoolGame::polyominoOnClick: selected polyomino: %d", this->var_i16_7cc);
// if no polyomino, ignore
if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == 0) {
- this->sub_128_6186();
+ this->waitForMouseUp();
return;
}
// 133:0950
@@ -431,21 +433,21 @@ void FoolGame::polyominoMove() {
void FoolGame::polyominoOnClickFixed() {
// 133:10a0
- this->var_i16_484 = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
- this->var_i16_7e4 = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
+ int16 posX = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
+ int16 posY = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
// play bass tone
this->playTone(0x14, 0x64, 0);
// why do this???
// best guess: flashing the shape a few times before knocking it back
// 133:1188
- debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", this->var_i16_484, this->var_i16_7e4);
+ debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", posX, posY);
for (int i = 0; i <= 9; i++) {
- _zbasic->picture(this->var_i16_484, this->var_i16_7e4, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(posX, posY, this->arr_pic_49d8[this->var_i16_7cc*4]);
g_toolbox->Delay(0);
}
// 133:11c2
this->polyominoDrawFrame();
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::polyominoReset() {
@@ -486,11 +488,11 @@ void FoolGame::polyominoDrawFrame() {
void FoolGame::polyominoCheckIfSolved() {
// 133:12f2
_activePuzzleSolved = true;
- this->var_i16_484 = 0;
+ int16 index = 0;
for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
- this->var_i16_484++;
- if (this->arr_i16_2f38[i*32 + j] != this->arr_i16_4338[this->var_i16_484]) {
+ index++;
+ if (this->arr_i16_2f38[i*32 + j] != this->arr_i16_4338[index]) {
// 133:1368
_activePuzzleSolved = false;
j = this->arr_i16_1eb8[0x17];
@@ -511,14 +513,13 @@ void FoolGame::polyominoSuccess() {
_activePuzzleStatus = 0x64;
}
this->sub_128_2664();
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_d34(this->arr_i16_1eb8[0x12], this->arr_i16_1eb8[0x13], this->arr_i16_1eb8[0x14], this->arr_i16_1eb8[0x15], 0x96);
}
void FoolGame::polyominoStoreState() {
// 133:1452
_activePuzzleBuffer.clear(); // was: str(OFF(3))
- this->var_i16_68a = 1;
for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
Common::String val1 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
Common::String val2 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 4]);
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 879ff26f094..fc2f3bbf6e6 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -33,7 +33,7 @@ extern Toolbox *g_toolbox;
// mask reveal puzzle
void FoolGame::revealRun() {
// 134:0004
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->var_i16_c00 = 1;
this->arr_i16_1eb8[15] = puzzlesReadShort();
this->arr_i16_1eb8[16] = puzzlesReadShort();
@@ -174,7 +174,7 @@ void FoolGame::revealOnClick() {
this->revealSelectButton();
this->arr_i16_1eb8[19] ^= _bitLUT[this->arr_i16_3738[this->var_i16_7be]-1];
debugC(5, kDebugLoading, "reveal: %d, %04x, %04x", this->var_i16_7be, this->arr_i16_1eb8[19], this->arr_i16_1eb8[20]);
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::revealSelectButton() {
@@ -207,7 +207,7 @@ void FoolGame::revealSuccess() {
_activePuzzleStatus = 0x64;
}
this->sub_128_2664();
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_d34(0x37, 0x13, 0xff, 0x1ee, 0xc8);
}
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 921f394addd..7e6cba90632 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -34,7 +34,7 @@ extern Toolbox *g_toolbox;
// sentence join game
void FoolGame::sentenceRun() {
// 135:0004
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->var_i16_c00 = 1;
this->arr_i16_3738[0] = 0xbf;
this->arr_i16_3738[2] = 0xe1;
@@ -176,7 +176,7 @@ void FoolGame::sentenceOnClick() {
break;
}
this->sentenceDrawBuffer();
- this->sub_128_6186();
+ this->waitForMouseUp();
if (_sentenceBuffer == _sentenceGoal) {
return;
}
@@ -195,7 +195,7 @@ void FoolGame::sentenceOnClick() {
this->var_i16_7a2 = 0x124;
this->sub_128_918(_zbasic->str(OFF(4))); // click mouse to reset puzzle
- this->sub_128_6186();
+ this->waitForMouseUp();
this->var_i16_1abc = 1;
_stateFlags = kNullEvent;
// 135:07a0
@@ -325,7 +325,7 @@ void FoolGame::sentenceSuccess() {
}
// 135:0d40
this->sub_128_2664();
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_d34(this->arr_i16_3738[0], this->arr_i16_3738[1], this->arr_i16_3738[2], this->arr_i16_3738[3], 0x64);
}
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index 4b789551df5..d701448d07b 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -32,7 +32,7 @@ extern Toolbox *g_toolbox;
void FoolGame::straightPathRun() {
// 143:0004
- sub_128_271a();
+ fetchPuzzleData();
for (int16 i = 0; i <= 0xe; i++) {
arr_i16_1eb8[i] = puzzlesReadShort();
}
@@ -160,7 +160,7 @@ void FoolGame::straightPathOnClick() {
}
}
// 143:077e
- sub_128_6186();
+ waitForMouseUp();
}
void FoolGame::straightPathReset() {
@@ -211,7 +211,7 @@ void FoolGame::straightPathSuccess() {
}
g_toolbox->PenNormal();
sub_128_2664();
- sub_128_61c2();
+ waitForClick();
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index cde6c732da9..90290fb2631 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -32,7 +32,7 @@ extern Toolbox *g_toolbox;
void FoolGame::sunMapRun() {
// 137:0004
this->var_i16_c00 = 1;
- this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
this->arr_i16_1eb8[0] = 9;
this->arr_i16_1eb8[1] = 9;
this->arr_i16_1eb8[4] = 0x4b;
@@ -153,7 +153,7 @@ void FoolGame::sunMapOnClick() {
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->sunMapDropSelected();
this->sunMapCheckIfSolved();
- this->sub_128_6186();
+ this->waitForMouseUp();
_zbasic->menu(8, 3, 1, Common::U32String());
_menuDisabled = false;
}
@@ -188,9 +188,9 @@ void FoolGame::sunMapDragSelect() {
this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
// 137:084c
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->sub_128_3da(2);
+ this->delay(2);
g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->sub_128_3da(1);
+ this->delay(1);
} while (_event.what != kMouseUp);
// 137:087e
}
@@ -244,9 +244,9 @@ void FoolGame::sunMapMoveSelected() {
this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
g_toolbox->FrameRect(this->arr_rect_4776);
- this->sub_128_3da(2);
+ this->delay(2);
g_toolbox->FrameRect(this->arr_rect_4776);
- this->sub_128_3da(1);
+ this->delay(1);
} while (_event.what != kMouseDown);
}
@@ -359,7 +359,7 @@ void FoolGame::sunMapRevealPiece() {
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
g_toolbox->FrameRect(temp);
- this->sub_128_3da(1);
+ this->delay(1);
}
// 137:1550
_zbasic->picture(
@@ -367,7 +367,7 @@ void FoolGame::sunMapRevealPiece() {
_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
);
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sunMapCheckIfSolved();
_menuDisabled = false;
}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index c949d20540a..20dc1f39174 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -115,7 +115,7 @@ void FoolGame::highPriestessRun() {
this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
_zbasic->picture(0, 0, this->arr_i32_192c0[0]);
g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
- this->sub_128_61c2();
+ this->waitForClick();
}
// 140:02a2
if (!_screenOversized) {
@@ -167,7 +167,7 @@ void FoolGame::highPriestessRun() {
this->var_i16_7a2 = 0xdc;
this->sub_128_918(_zbasic->str(OFF(5))); // so easily
g_toolbox->SetPort(this->var_i32_0);
- this->sub_128_61c2();
+ this->waitForClick();
}
// 140:0450
this->sub_140_32ac();
@@ -193,7 +193,7 @@ void FoolGame::thoth99Enchantments() {
this->sub_128_918(_zbasic->str(OFF(7))); // you dare to challenge
this->var_i16_7a2 = 0xd2;
this->sub_128_918(_zbasic->str(OFF(8))); // the high priestess
- this->sub_128_3da(0xb4);
+ this->delay(0xb4);
}
// 140:0532
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
@@ -429,7 +429,7 @@ void FoolGame::sub_140_f84() {
area.bottom += this->arr_i16_4758[6];
area.right += this->arr_i16_4758[7];
g_toolbox->FrameRect(area);
- this->sub_128_3da(1);
+ this->delay(1);
}
// 140:11ae
// unrolled loop
@@ -441,7 +441,7 @@ void FoolGame::sub_140_f84() {
area.bottom += this->arr_i16_4758[6];
area.right += this->arr_i16_4758[7];
g_toolbox->InvertRect(area);
- this->sub_128_3da(1);
+ this->delay(1);
}
// 140:12f6
this->sub_140_3296();
@@ -469,7 +469,7 @@ void FoolGame::thothKey1st() {
this->getNextEvent(-1); // was: 0
g_toolbox->MoveTo(0x105, 0xa2);
g_toolbox->LineTo(_event.where.x, _event.where.y);
- this->sub_128_3da(2);
+ this->delay(2);
g_toolbox->MoveTo(0x105, 0xa2);
g_toolbox->LineTo(_event.where.x, _event.where.y);
}
@@ -478,12 +478,11 @@ void FoolGame::thothKey1st() {
if ((this->var_i16_7ce & 2) == 0) {
_stateFlags = kStateReturn;
this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
- this->sub_128_3da(0x3c);
+ this->delay(0x3c);
_activePuzzleSolved = false;
} else {
// 140:1446
- this->var_str_384 = _zbasic->str(OFF(21)); // behold ye the book of thoth
- this->sub_128_178a(0, 0);
+ showBehold(0, 0, _zbasic->str(OFF(21)));
this->sub_140_2f92();
this->var_i16_7ce ^= 2;
this->var_i16_7b2 = 0xa;
@@ -501,8 +500,8 @@ void FoolGame::thothKey2nd() {
// 140:1494: MOVE.L - var_i32_232a,D0
// 140:1498: ADDI.L - 0x0000018c,D0
// 140:149e: MOVE.L - D0,var_i32_696
- this->var_bytes_696 = this->var_bytes_232a;
- this->var_ptr_696 = this->var_ptr_232a + 0x18c;
+ this->_puzzleDataBuffer = this->var_bytes_232a;
+ this->_puzzleDataPtr = this->var_ptr_232a + 0x18c;
for (int16 j = 1; j <= 7; j++) {
for (int16 i = 0; i <= 3; i++) {
this->arr_i16_2f38[j*32+i] = puzzlesReadShort();
@@ -631,7 +630,7 @@ void FoolGame::sub_140_15fc() {
temp.right = this->arr_i16_2f38[32*j+3];
g_toolbox->InvertRect(temp);
}
- this->sub_128_3da(2);
+ this->delay(2);
}
// 140:1710
Common::Rect temp;
@@ -694,8 +693,8 @@ void FoolGame::thothKey3rd() {
// 140:1908: MOVE.L - var_i32_232a,D0
// 140:190c: ADDI.L - 0x000001c4,D0
// 140:1912: MOVE.L - D0,var_i32_696
- this->var_bytes_696 = this->var_bytes_232a;
- this->var_ptr_696 = this->var_ptr_232a + 0x1c4;
+ this->_puzzleDataBuffer = this->var_bytes_232a;
+ this->_puzzleDataPtr = this->var_ptr_232a + 0x1c4;
for (int16 i = 0; i <= 3; i++) {
for (int16 j = 0; j <= 3; j++) {
this->arr_i16_2f38[i*32 + j] = puzzlesReadShort();
@@ -874,13 +873,13 @@ void FoolGame::sub_140_1f68() {
}
// 140:2056
g_toolbox->PenNormal();
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::sub_140_205e() {
// 140:205e
this->var_i16_103a++;
- this->sub_128_6186();
+ this->waitForMouseUp();
g_toolbox->PenNormal();
}
@@ -1038,7 +1037,7 @@ void FoolGame::hermitScreenFlash() {
// recommendation of 3/second
for (int16 i = 0; i <= 6; i++) { // was: 0x10
g_toolbox->InvertRect(area);
- this->sub_128_3da(10); // was: 1
+ this->delay(10); // was: 1
}
}
@@ -1056,7 +1055,7 @@ void FoolGame::hermitScreenZoom() {
area.bottom -= 7;
area.right -= 0xa;
g_toolbox->InvertRect(area);
- this->sub_128_3da(1);
+ this->delay(1);
}
for (int16 i = 0; i <= 0x13; i++) {
area.top -= 7;
@@ -1064,7 +1063,7 @@ void FoolGame::hermitScreenZoom() {
area.bottom += 7;
area.right += 0xa;
g_toolbox->InvertRect(area);
- this->sub_128_3da(1);
+ this->delay(1);
}
}
g_toolbox->PenNormal();
@@ -1076,15 +1075,15 @@ void FoolGame::hermitScreenZoom() {
void FoolGame::hermitScreenBehold() {
// 140:28bc
if (_puzzleCompletionStatus[0x68] > 4) {
- this->sub_128_6186();
+ this->waitForMouseUp();
this->sub_128_2664();
this->sub_128_d34(0x29, 0x37, 0x142, 0x1c9, 0x96);
_activePuzzleSolved = true;
} else {
// 140:290c
this->zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
- this->var_str_384 = _zbasic->str(OFF(22)); // behold the last key of thoth
- this->sub_128_178a(0x48, 2);
+ // behold the last key of thoth
+ showBehold(0x48, 2, _zbasic->str(OFF(22)));
}
// 140:2966
}
@@ -1092,13 +1091,13 @@ void FoolGame::hermitScreenBehold() {
void FoolGame::sub_140_2968() {
// 140:2968
this->sub_128_2664();
- this->sub_128_61c2();
+ this->waitForClick();
_activePuzzleSolved = true;
}
void FoolGame::sub_140_2978() {
// 140:2978
- this->sub_128_6186();
+ this->waitForMouseUp();
if (_hermitPathStage < 6) {
this->var_i16_2338 = 1;
} else {
@@ -1109,7 +1108,7 @@ void FoolGame::sub_140_2978() {
void FoolGame::thothKeyLastSetup() {
// 140:2998
if (_hermitPathStage != 6) {
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->arr_i16_1eb8[4] = 0x37;
this->arr_i16_1eb8[5] = 0x29;
this->arr_i16_1eb8[6] = 0x14;
@@ -1148,8 +1147,8 @@ void FoolGame::thothKeyLastSetup() {
// 140:2b66: MOVE.L - var_i32_232a,D0
// 140:2b6a: ADDI.L - 0x000001e4,D0
// 140:2b70: MOVE.L - D0,var_i32_696
- this->var_bytes_696 = this->var_bytes_232a;
- this->var_ptr_696 = this->var_ptr_232a + 0x1e4;
+ this->_puzzleDataBuffer = this->var_bytes_232a;
+ this->_puzzleDataPtr = this->var_ptr_232a + 0x1e4;
for (int16 i = 0; i <= 0xe; i++) {
this->arr_i16_1eb8[i] = puzzlesReadShort();
}
@@ -1317,11 +1316,11 @@ void FoolGame::thothAdjustPuzzleData() {
this->var_i16_484 = (_puzzleDataOffsets[0x34] - 1) / 1000;
this->var_i16_7e4 = (_puzzleDataOffsets[0x34] - 1) % 1000;
_zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
- //this->var_bytes_696 = this->arr_bytes_109dc;
- this->var_bytes_696 = _zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
- this->var_ptr_696 = 0;
- this->var_bytes_232a = this->var_bytes_696;
- this->var_ptr_232a = this->var_ptr_696;
+ //this->_puzzleDataBuffer = this->arr_bytes_109dc;
+ this->_puzzleDataBuffer = _zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
+ this->_puzzleDataPtr = 0;
+ this->var_bytes_232a = this->_puzzleDataBuffer;
+ this->var_ptr_232a = this->_puzzleDataPtr;
}
void FoolGame::sub_140_3412() {
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
index c2346a8ff97..5dea6864366 100644
--- a/engines/fool/fool_threeships.cpp
+++ b/engines/fool/fool_threeships.cpp
@@ -34,8 +34,8 @@ extern Toolbox *g_toolbox;
void FoolGame::shipsRun() {
// 128:5140
fillRect(0x127, 0x6c, 0x137, 0x84, 0);
- this->sub_128_6186();
- this->sub_128_55c(_zbasic->str(OFF(0))); // "?"
+ this->waitForMouseUp();
+ this->drawPuzzleButton(_zbasic->str(OFF(0))); // "?"
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
fillRect(0x127, 0x6c, 0x137, 0x84, 0);
@@ -74,7 +74,7 @@ void FoolGame::shipsRun() {
}
// 128:5396
if (_activePuzzleSolved) {
- this->sub_128_6186();
+ this->waitForMouseUp();
this->playTone(0x14, 0x64, 0);
_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
_event.where.x += 5;
@@ -103,10 +103,10 @@ void FoolGame::shipsRun() {
}
}
// 128:5514
- this->sub_128_3da(0x3c);
+ this->delay(0x3c);
if (_activePuzzleStatus < 0x64) {
// 128:5526
- this->sub_128_6186();
+ this->waitForMouseUp();
_activePuzzleStatus = 0x64;
this->var_i16_7ce |= 2;
this->zoomRect(
@@ -122,8 +122,8 @@ void FoolGame::shipsRun() {
kPatCopy,
0x42
);
- this->var_str_384 = _zbasic->str(OFF(1)); // behold the 1st key of thoth
- this->sub_128_178a(0, 0);
+ // behold the 1st key of thoth
+ this->showBehold(0, 0, _zbasic->str(OFF(1)));
}
// 128:55aa
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index dcbadc083ee..53517d94356 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -34,7 +34,7 @@ extern Toolbox *g_toolbox;
// word search game
void FoolGame::wordSearchRun() {
// 131:0004
- this->sub_128_271a();
+ this->fetchPuzzleData();
this->var_str_188e = puzzlesReadString().decode(Common::kMacRoman);
for (int i = 0; i <= 0xe; i++) {
this->arr_i16_1eb8[i] = puzzlesReadShort();
@@ -308,7 +308,7 @@ void FoolGame::wordSearchOnClick() {
// 131:0c64
this->var_str_384 = _zbasic->index(1, this->var_i16_1a9a + this->var_i16_198e) + _zbasic->str(OFF(13)) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(OFF(14)); // WORD... only X to go
this->wordSearchDrawFooter();
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::wordSearchBadSelect() {
@@ -323,7 +323,7 @@ void FoolGame::wordSearchBadSelect() {
this->var_i16_1a96 = -1;
this->var_i16_1a98 = -1;
this->var_i16_1a94 = 0;
- this->sub_128_6186();
+ this->waitForMouseUp();
}
void FoolGame::wordSearchDrawFooter() {
@@ -376,7 +376,7 @@ void FoolGame::wordSearchSuccess() {
_activePuzzleStatus = 0x64;
}
// 131:0f52
- this->sub_128_69c(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ this->fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
_zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, kSrcOr);
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
@@ -398,7 +398,7 @@ void FoolGame::wordSearchSuccess() {
// 131:10e8
this->fillRect(0x1eb, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
this->sub_128_2664();
- this->sub_128_61c2();
+ this->waitForClick();
_stateFlags = kStateReturn;
}
Commit: 62000233187b25b6c54ceff538efd431143f978c
https://github.com/scummvm/scummvm/commit/62000233187b25b6c54ceff538efd431143f978c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:28+02:00
Commit Message:
FOOL: More naming cleanup
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index c93fab864c7..8cbb4f45878 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -707,8 +707,8 @@ void FoolGame::sub_139_1d3e() {
_activePuzzleStatus = 0x64;
}
this->waitForMouseUp();
- this->sub_128_2664();
- this->sub_128_d34(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
+ this->menuClickMessage();
+ this->flashRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
}
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index cc58c26dd0b..5b046796c83 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -39,13 +39,13 @@ void FoolGame::deathRun() {
this->deathDrawZoom();
this->fillRect(0x14f, 0, 0x156, 0x7, 0x2);
this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
- this->arr_rect_1eb8.top = 0x1e;
- this->arr_rect_1eb8.left = 0x190;
- this->arr_rect_1eb8.bottom = 0x2e;
- this->arr_rect_1eb8.right = 0x1a8;
+ _deathBlackEye.top = 0x1e;
+ _deathBlackEye.left = 0x190;
+ _deathBlackEye.bottom = 0x2e;
+ _deathBlackEye.right = 0x1a8;
// 141:0122
- _zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, this->arr_bmp_bbbc);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
_event.where.y = 0x14;
// JMP 0x3c2
while (true) {
@@ -55,7 +55,7 @@ void FoolGame::deathRun() {
// 141:01cc
this->getNextEvent(-1);
this->deathMoveBlackEye();
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_1eb8)) {
+ if (g_toolbox->PtInRect(_event.where, _deathBlackEye)) {
this->deathCaught();
// 141:09f6
this->deathDrawWhiteEye();
@@ -77,7 +77,7 @@ void FoolGame::deathRun() {
// 141:023a
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
this->drawPuzzleButton(Common::U32String("~")); // was: str(335))
- this->var_i16_233a = 1;
+ _deathWhiteEyeNeedsDraw = true;
// JMP 0x2be
while (_event.where.y < 0x14) {
// cursor is over the top menu, safe
@@ -103,7 +103,7 @@ void FoolGame::deathRun() {
// JMP 0x9a2
// 141:09a2
this->deathDrawWhiteEye();
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_bbbc, kSrcCopy);
this->deathDrawZoom();
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
@@ -121,7 +121,7 @@ void FoolGame::deathRun() {
g_toolbox->PenPat(_patterns[1]);
g_toolbox->PenSize(0x17, 0x10);
for (int i = 0; i <= 5; i++) {
- g_toolbox->MoveTo(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top);
+ g_toolbox->MoveTo(_deathBlackEye.left, _deathBlackEye.top);
g_toolbox->LineTo(0x6c, 0x127);
g_toolbox->Delay(0);
}
@@ -135,9 +135,9 @@ void FoolGame::deathRun() {
void FoolGame::deathMoveBlackEye() {
// 141:03ca
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
- this->var_i16_68a = _event.where.x - 0xc - this->arr_rect_1eb8.left;
- this->var_i16_68c = _event.where.y - 8 - this->arr_rect_1eb8.top;
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
+ this->var_i16_68a = _event.where.x - 0xc - _deathBlackEye.left;
+ this->var_i16_68c = _event.where.y - 8 - _deathBlackEye.top;
// 141:0452
if (this->var_i16_68c < -4) {
this->var_i16_68c = -4;
@@ -151,42 +151,43 @@ void FoolGame::deathMoveBlackEye() {
if (this->var_i16_68a > 6) {
this->var_i16_68a = 6;
}
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:04ce
- this->arr_rect_1ec0.top = this->arr_rect_1eb8.top + this->var_i16_68c;
- this->arr_rect_1ec0.left = this->arr_rect_1eb8.left + this->var_i16_68a;
- this->arr_rect_1ec0.bottom = this->arr_rect_1eb8.bottom + this->var_i16_68c;
- this->arr_rect_1ec0.right = this->arr_rect_1eb8.right + this->var_i16_68a;
+ Common::Rect newPos; // arr_rect_1ec0
+ newPos.top = _deathBlackEye.top + this->var_i16_68c;
+ newPos.left = _deathBlackEye.left + this->var_i16_68a;
+ newPos.bottom = _deathBlackEye.bottom + this->var_i16_68c;
+ newPos.right = _deathBlackEye.right + this->var_i16_68a;
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:05a2
- if (this->arr_rect_1ec0.top < 0x14) {
- this->arr_rect_1ec0.top = 0x14;
- this->arr_rect_1ec0.bottom = 0x24;
+ if (newPos.top < 0x14) {
+ newPos.top = 0x14;
+ newPos.bottom = 0x24;
}
// 141:05dc
- if (this->arr_rect_1ec0.left < 0) {
- this->arr_rect_1ec0.left = 0;
- this->arr_rect_1ec0.right = 0x18;
+ if (newPos.left < 0) {
+ newPos.left = 0;
+ newPos.right = 0x18;
}
// 141:060c
- if (this->arr_rect_1ec0.bottom > SCREEN_HEIGHT) {
- this->arr_rect_1ec0.top = 0x146;
- this->arr_rect_1ec0.bottom = 0x156;
+ if (newPos.bottom > SCREEN_HEIGHT) {
+ newPos.top = 0x146;
+ newPos.bottom = 0x156;
}
- if (this->arr_rect_1ec0.right > SCREEN_WIDTH) {
- this->arr_rect_1ec0.left = 0x1e8;
- this->arr_rect_1ec0.right = 0x200;
+ if (newPos.right > SCREEN_WIDTH) {
+ newPos.left = 0x1e8;
+ newPos.right = 0x200;
}
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
// 141:06bc
- if (!((this->arr_rect_1eb8.top == this->arr_rect_1ec0.top) &&
- ((this->arr_rect_1eb8.left == this->arr_rect_1ec0.left)))) {
+ if (!((_deathBlackEye.top == newPos.top) &&
+ ((_deathBlackEye.left == newPos.left)))) {
// 141:0722
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_bbbc, kSrcCopy);
- this->arr_rect_1eb8 = this->arr_rect_1ec0;
- _zbasic->get(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_rect_1eb8.right, this->arr_rect_1eb8.bottom, this->arr_bmp_bbbc);
- _zbasic->put(this->arr_rect_1eb8.left, this->arr_rect_1eb8.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_bbbc, kSrcCopy);
+ _deathBlackEye = newPos;
+ _zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, this->arr_bmp_bbbc);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
this->delay(1);
}
// 141:0880
@@ -194,18 +195,18 @@ void FoolGame::deathMoveBlackEye() {
void FoolGame::deathDrawWhiteEye() {
// 141:0882
- if (this->var_i16_233a != 0) {
+ if (_deathWhiteEyeNeedsDraw) {
_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
}
// 141:08b0
- this->var_i16_233a = 0;
+ _deathWhiteEyeNeedsDraw = false;
}
void FoolGame::deathCaught() {
// 141:08b8
this->deathDrawWhiteEye();
this->sub_128_4da(0);
- this->zoomRect(this->arr_rect_1eb8.top, this->arr_rect_1eb8.left, this->arr_rect_1eb8.bottom, this->arr_rect_1eb8.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ this->zoomRect(_deathBlackEye.top, _deathBlackEye.left, _deathBlackEye.bottom, _deathBlackEye.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
this->sub_128_4da(1);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 84cf9114b8d..9baae06cea3 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -635,20 +635,20 @@ void FoolGame::getNextEvent(uint32 unk1) {
}
}
-void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
+void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16 millis) {
// flash a rectangle on the screen until we get a click
// 128:0d34
Common::Rect bounds; // arr_rect_5b7c
- bounds.top = unk5;
- bounds.left = unk4;
- bounds.bottom = unk3;
- bounds.right = unk2;
+ bounds.top = top;
+ bounds.left = left;
+ bounds.bottom = bottom;
+ bounds.right = right;
while (_event.modifiers & kModMouseButtonUp) {
// 128:0d94
do {
// FIXME: Flashing far too intense
g_toolbox->InvertRect(bounds);
- this->var_i16_3a = 0;
+ int ticks = 0;
do {
// originally this used getNextEvent, but we avoid that here
// so that menu events don't get intercepted.
@@ -658,9 +658,9 @@ void FoolGame::sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16
this->var_i16_78a = g_toolbox->GetNextEvent(-1, _event);
if (_event.what == kNullEvent) {
g_toolbox->Delay(0);
- this->var_i16_3a += 1;
+ ticks += 1;
}
- } while (!((this->var_i16_3a >= (unk1*60/1000)) || ((_event.modifiers & kModMouseButtonUp) == 0)));
+ } while (!((ticks >= (millis*60/1000)) || ((_event.modifiers & kModMouseButtonUp) == 0)));
} while ((_event.modifiers & kModMouseButtonUp) != 0);
}
}
@@ -1171,7 +1171,7 @@ void FoolGame::storyRenderPage() {
// 128:2662
}
-void FoolGame::sub_128_2664() {
+void FoolGame::menuClickMessage() {
// 128:2664
// hide menu and replace with "click mouse to continue" message
g_toolbox->SetPort(this->var_i32_8);
@@ -2313,7 +2313,7 @@ void FoolGame::menuAbout() {
_zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 += 0xe;
this->sub_128_918(_zbasic->str(_zstrOffset[kOffsetVersion])); // version string
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForClick();
g_toolbox->DrawMenuBar();
this->copyScreen(0x1, this->arr_bmp_138bc);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index a88aca3403f..0913309f604 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -116,7 +116,7 @@ public:
void zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps); // sub_128_962
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void getNextEvent(uint32 mask); // sub_128_c6a
- void sub_128_d34(int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
+ void flashRect(int16 top, int16 left, int16 bottom, int16 right, int16 millis); // sub_128_d34
void showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount, bool beep); // sub_128_dfe
void showBehold(int16 unk2, int16 unk1, const Common::U32String &message); // sub_128_178a
@@ -131,7 +131,7 @@ public:
void menuChapterSelect(); // sub_128_2126
void sub_128_21c8();
void storyRenderPage(); // sub_128_2202
- void sub_128_2664();
+ void menuClickMessage(); // sub_128_2664
void sub_128_26f6();
void fetchPuzzleData(); // sub_128_271a
void menuNewGame(); // sub_128_27d6
@@ -251,7 +251,7 @@ public:
void polyominoRun(); // sub_133_004
void polyominoOnClick(); // sub_133_87c
void polyominoCancelMove(); // sub_133_eb2
- void polyominoMove(); // sub_133_f04
+ void polyominoMove(int16 x, int16 y); // sub_133_f04
void polyominoOnClickFixed(); // sub_133_10a0
void polyominoReset(); // sub_133_11cc
void polyominoDrawFrame(); // sub_133_12d4
@@ -463,7 +463,6 @@ private:
int16 var_i16_34;
int16 var_i16_36;
int16 var_i16_38;
- int16 var_i16_3a;
int16 var_i16_42;
int16 var_i16_44;
EventRecord _event; // var_ev_46
@@ -581,8 +580,8 @@ private:
int16 var_i16_105c;
int16 var_i16_105e;
int16 var_i16_1060;
- int16 var_i16_1062;
- int16 var_i16_1064;
+ int16 _polyominoPosX; // var_i16_1062
+ int16 _polyominoPosY; // var_i16_1064
int16 var_i16_1066;
int16 _jumbleGameType; // var_i16_1068
int16 var_i16_106a;
@@ -642,7 +641,7 @@ private:
int16 var_i16_1aa8;
int16 var_i16_1aaa;
- int16 var_i16_1ab0;
+ int16 var_i16_1ab0; // var_i16_1ab0
int16 var_i16_1ab2;
int16 var_i16_1ab4;
int16 var_i16_1ab6;
@@ -730,7 +729,7 @@ private:
int16 var_i16_2332;
int16 var_i16_2338;
- int16 var_i16_233a;
+ bool _deathWhiteEyeNeedsDraw; // var_i16_233a
int16 var_i16_233e;
int16 var_i16_233c;
@@ -753,8 +752,7 @@ private:
int16 _pageLines[202]; // arr_i16_1dee
int16 arr_i16_1eb8[0x29];
// used just for death?
- Common::Rect arr_rect_1eb8;
- Common::Rect arr_rect_1ec0;
+ Common::Rect _deathBlackEye; // arr_rect_1eb8
Common::Rect _screenGrid[0x200]; // arr_rect_1f38
int16 arr_i16_2f38[0x400]; // arr_i16_2f38, 96x32?
int16 arr_i16_3738[0x200];
@@ -766,7 +764,7 @@ private:
int16 arr_i16_4758[15];
Common::Rect arr_rect_4776;
int16 arr_i16_47d8[0x100];
- PicHandle arr_pic_49d8[0x80];
+ PicHandle _polyominoPics[0x80]; // arr_pic_49d8
int16 _sunMapTileID[0x52]; // arr_i16_4bd8
int16 arr_i16_4c7c[0x52];
int16 arr_i16_4d20[52];
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index ffe25c49ce1..3952f9e8e8f 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -223,7 +223,7 @@ void FoolGame::sub_142_630() {
// 142:07ca
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->waitForMouseUp();
- this->sub_128_2664();
+ this->menuClickMessage();
this->var_i16_484 = 0;
this->var_i16_7e4 = 0;
this->var_i16_9f2 = 0;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index bf4998abc3a..c71ecf1c384 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -414,7 +414,7 @@ void FoolGame::jigsawSuccess() {
}
}
// 132:149c
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForClick();
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index fe9c9d05362..bdc9ee58570 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -324,7 +324,7 @@ void FoolGame::jumbleRun() {
}
// if we're here, the puzzle is solved
g_toolbox->PenNormal();
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForMouseUp();
this->sub_128_61ec();
// 130:0a90
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 9d04de525bc..696500a6ec8 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -1527,7 +1527,7 @@ void FoolGame::sub_136_3a70() {
// 136:3a70
if (_activePuzzle == 0x57) {
_activePuzzleStatus = 0x64;
- sub_128_2664();
+ menuClickMessage();
waitForClick();
} else {
// 136:3a8e
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 326630f93eb..9b486879780 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -201,7 +201,7 @@ void FoolGame::metapuzzleWheel() {
zoomRect(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
}
_zbasic->picture(6, 0x6d, _metapuzzleWheelPic);
- sub_128_2664();
+ menuClickMessage();
waitForClick();
}
@@ -361,9 +361,9 @@ void FoolGame::sub_138_a90() {
// 138:0a90
_stateFlags = kStateReturn;
_activePuzzleBuffer = var_str_1272;
- sub_128_2664();
+ menuClickMessage();
waitForMouseUp();
- sub_128_d34(arr_i16_1eb8[0], arr_i16_1eb8[1], arr_i16_1eb8[2], arr_i16_1eb8[3], 0xc8);
+ flashRect(arr_i16_1eb8[0], arr_i16_1eb8[1], arr_i16_1eb8[2], arr_i16_1eb8[3], 0xc8);
}
void FoolGame::metapuzzleOnOption() {
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 23e2d2047f8..5c8b0db3416 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -172,7 +172,7 @@ void FoolGame::polyominoRun() {
// 133:050a
g_toolbox->InvertPoly(poly);
g_toolbox->ClosePicture();
- this->arr_pic_49d8[j*4] = handle;
+ this->_polyominoPics[j*4] = handle;
g_toolbox->PenNormal();
// 133:0530: JSR - "PICTURE_ON"
@@ -194,7 +194,7 @@ void FoolGame::polyominoRun() {
g_toolbox->FramePoly(poly);
g_toolbox->ClosePicture();
// 133:0622
- this->arr_pic_49d8[j*4 + 1] = handle;
+ this->_polyominoPics[j*4 + 1] = handle;
g_toolbox->PenNormal();
// 133:0642: JSR - "PICTURE_ON"
@@ -204,7 +204,7 @@ void FoolGame::polyominoRun() {
g_toolbox->FramePoly(poly);
g_toolbox->PaintPoly(poly);
g_toolbox->ClosePicture();
- this->arr_pic_49d8[j*4 + 2] = handle;
+ this->_polyominoPics[j*4 + 2] = handle;
// clear polygon data
g_toolbox->KillPoly(poly);
@@ -223,9 +223,10 @@ void FoolGame::polyominoRun() {
this->sub_128_bde(1, this->arr_i16_1eb8[0xf], 0, 1, 1, 1);
this->var_i16_1ab0 = 0;
for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
- this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
- this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
- this->polyominoMove();
+ this->polyominoMove(
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 3],
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 4]
+ );
}
this->var_i16_1ab0 = 1;
this->polyominoDrawFrame();
@@ -258,7 +259,7 @@ void FoolGame::polyominoRun() {
// exiting game, delete picture handles
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
for (int i = 0; i <= 2; i++) {
- g_toolbox->KillPicture(this->arr_pic_49d8[j*4 + i]);
+ g_toolbox->KillPicture(this->_polyominoPics[j*4 + i]);
}
}
}
@@ -288,13 +289,13 @@ void FoolGame::polyominoOnClick() {
}
// 133:0990
this->var_i16_106a = 0;
- this->var_i16_1a96 = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
- this->var_i16_1a98 = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
- debug(5, "FoolGame::polyominoOnClick: 1a96: %d, 1a98: %d", this->var_i16_1a96, this->var_i16_1a98);
+ int16 polyGridPosX = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
+ int16 polyGridPosY = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
+ debug(5, "FoolGame::polyominoOnClick: polyGridPosX: %d, polyGridPosY: %d", polyGridPosX, polyGridPosY);
- for (int j = this->var_i16_1a98; j <= this->var_i16_1a98 + 3; j++) {
+ for (int j = polyGridPosY; j <= polyGridPosY + 3; j++) {
// 133:09dc
- for (int i = this->var_i16_1a96; i <= this->var_i16_1a96 + 3; i++) {
+ for (int i = polyGridPosX; i <= polyGridPosX + 3; i++) {
if (this->arr_i16_47d8[this->var_i16_7cc*8] & _bitLUT[this->var_i16_106a]) {
// erase grabbed polyomino from collision map
this->arr_i16_2f38[i*32 + j] = 0;
@@ -304,24 +305,24 @@ void FoolGame::polyominoOnClick() {
}
}
// 133:0a60
- this->var_i16_1ab2 = this->var_i16_1a96 - this->var_i16_68a;
- this->var_i16_1ab4 = this->var_i16_1a98 - this->var_i16_68c;
- this->var_i16_1062 = _screenGrid[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].left;
- this->var_i16_1064 = _screenGrid[this->arr_i16_3b38[this->var_i16_1a96*32 + this->var_i16_1a98]].top;
- debug(5, "FoolGame::polyominoOnClick: Draw pic 2 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 2]);
+ this->var_i16_1ab2 = polyGridPosX - this->var_i16_68a;
+ this->var_i16_1ab4 = polyGridPosY - this->var_i16_68c;
+ this->_polyominoPosX = _screenGrid[this->arr_i16_3b38[polyGridPosX*32 + polyGridPosY]].left;
+ this->_polyominoPosY = _screenGrid[this->arr_i16_3b38[polyGridPosX*32 + polyGridPosY]].top;
+ debug(5, "FoolGame::polyominoOnClick: Unblit solid and blit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
+ _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4 + 2]);
// 133:0b1c
this->polyominoDrawFrame();
this->sub_128_4da(0);
- this->var_i16_1ab6 = this->var_i16_1062;
- this->var_i16_1ab8 = this->var_i16_1064;
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ this->var_i16_1ab6 = this->_polyominoPosX;
+ this->var_i16_1ab8 = this->_polyominoPosY;
+ _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
// 133:0b5a: JMP - [0xde0]
while (_event.what != 2) {
// 133:0b5e
// 133:0d3a
- while ((this->var_i16_1ab6 == this->var_i16_1062) && (this->var_i16_1ab8 == this->var_i16_1064) && (_event.what != 2)) {
+ while ((this->var_i16_1ab6 == this->_polyominoPosX) && (this->var_i16_1ab8 == this->_polyominoPosY) && (_event.what != 2)) {
// 133:0b62
this->getNextEvent(4);
@@ -351,15 +352,15 @@ void FoolGame::polyominoOnClick() {
}
// 133:0d78
if (_event.what != 2) {
- debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
+ debug(5, "FoolGame::polyominoOnClick: Unblit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
// XOR out original position
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
// drag to cursor position
- this->var_i16_1062 = this->var_i16_1ab6;
- this->var_i16_1064 = this->var_i16_1ab8;
+ this->_polyominoPosX = this->var_i16_1ab6;
+ this->_polyominoPosY = this->var_i16_1ab8;
// XOR out new position
- debug(5, "FoolGame::polyominoOnClick: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ debug(5, "FoolGame::polyominoOnClick: Blit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
+ _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
}
// 133:0de0
@@ -382,7 +383,7 @@ void FoolGame::polyominoOnClick() {
if ((this->var_i16_1a9c & this->arr_i16_47d8[this->var_i16_7cc*8]) != 0) {
this->polyominoCancelMove();
} else {
- this->polyominoMove();
+ this->polyominoMove(this->var_i16_68a, this->var_i16_68c);
}
// 133:0ea2
this->polyominoDrawFrame();
@@ -393,19 +394,20 @@ void FoolGame::polyominoOnClick() {
void FoolGame::polyominoCancelMove() {
// 133:0eb2
this->playTone(0x14, 0x64, 0);
- this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
- this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
- polyominoMove();
+ polyominoMove(
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 3],
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 4]
+ );
}
-void FoolGame::polyominoMove() {
+void FoolGame::polyominoMove(int16 x, int16 y) {
// 133:0f04
this->var_i16_106a = 0;
// polyominos are max 4x4
// add the polyomino to the collision map
- for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
- for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
+ for (int j = y; j <= y + 3; j++) {
+ for (int i = x; i <= x + 3; i++) {
if ((this->arr_i16_47d8[this->var_i16_7cc*8] & _bitLUT[this->var_i16_106a]) != 0) {
this->arr_i16_2f38[i*32 + j] = this->var_i16_7cc;
}
@@ -415,19 +417,19 @@ void FoolGame::polyominoMove() {
}
// 133:0f96
// set the polyomino position
- this->arr_i16_47d8[this->var_i16_7cc*8 + 3] = this->var_i16_68a;
- this->arr_i16_47d8[this->var_i16_7cc*8 + 4] = this->var_i16_68c;
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 3] = x;
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 4] = y;
// 133:0fce
if (this->var_i16_1ab0 != 0) {
- debug(5, "FoolGame::polyominoMove: Draw pic 0 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ debug(5, "FoolGame::polyominoMove: Blit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
+ _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
}
// 133:1002
- this->var_i16_1062 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
- this->var_i16_1064 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
- debug(5, "FoolGame::polyominoMove: Draw pic 1 (%d, %d)", this->var_i16_1062, this->var_i16_1064);
- _zbasic->picture(this->var_i16_1062, this->var_i16_1064, this->arr_pic_49d8[this->var_i16_7cc*4 + 1]);
+ this->_polyominoPosX = _screenGrid[this->arr_i16_3b38[x*32 + y]].left;
+ this->_polyominoPosY = _screenGrid[this->arr_i16_3b38[x*32 + y]].top;
+ debug(5, "FoolGame::polyominoMove: Blit solid (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
+ _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4 + 1]);
}
@@ -442,7 +444,7 @@ void FoolGame::polyominoOnClickFixed() {
// 133:1188
debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", posX, posY);
for (int i = 0; i <= 9; i++) {
- _zbasic->picture(posX, posY, this->arr_pic_49d8[this->var_i16_7cc*4]);
+ _zbasic->picture(posX, posY, this->_polyominoPics[this->var_i16_7cc*4]);
g_toolbox->Delay(0);
}
// 133:11c2
@@ -462,9 +464,10 @@ void FoolGame::polyominoReset() {
this->fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_1eb8[0xf]);
this->var_i16_1ab0 = 0;
for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
- this->var_i16_68a = this->arr_i16_47d8[this->var_i16_7cc*8 + 5];
- this->var_i16_68c = this->arr_i16_47d8[this->var_i16_7cc*8 + 6];
- this->polyominoMove();
+ this->polyominoMove(
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 5],
+ this->arr_i16_47d8[this->var_i16_7cc*8 + 6]
+ );
}
// 133:12c2
this->var_i16_1ab0 = 1;
@@ -512,9 +515,9 @@ void FoolGame::polyominoSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForMouseUp();
- this->sub_128_d34(this->arr_i16_1eb8[0x12], this->arr_i16_1eb8[0x13], this->arr_i16_1eb8[0x14], this->arr_i16_1eb8[0x15], 0x96);
+ this->flashRect(this->arr_i16_1eb8[0x12], this->arr_i16_1eb8[0x13], this->arr_i16_1eb8[0x14], this->arr_i16_1eb8[0x15], 0x96);
}
void FoolGame::polyominoStoreState() {
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index fc2f3bbf6e6..717925c603d 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -206,9 +206,9 @@ void FoolGame::revealSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForMouseUp();
- this->sub_128_d34(0x37, 0x13, 0xff, 0x1ee, 0xc8);
+ this->flashRect(0x37, 0x13, 0xff, 0x1ee, 0xc8);
}
}
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 7e6cba90632..91b689e002d 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -324,9 +324,9 @@ void FoolGame::sentenceSuccess() {
}
}
// 135:0d40
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForMouseUp();
- this->sub_128_d34(this->arr_i16_3738[0], this->arr_i16_3738[1], this->arr_i16_3738[2], this->arr_i16_3738[3], 0x64);
+ this->flashRect(this->arr_i16_3738[0], this->arr_i16_3738[1], this->arr_i16_3738[2], this->arr_i16_3738[3], 0x64);
}
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index d701448d07b..aea0a4872f1 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -210,7 +210,7 @@ void FoolGame::straightPathSuccess() {
}
}
g_toolbox->PenNormal();
- sub_128_2664();
+ menuClickMessage();
waitForClick();
}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 20dc1f39174..3db5d018683 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -1076,8 +1076,8 @@ void FoolGame::hermitScreenBehold() {
// 140:28bc
if (_puzzleCompletionStatus[0x68] > 4) {
this->waitForMouseUp();
- this->sub_128_2664();
- this->sub_128_d34(0x29, 0x37, 0x142, 0x1c9, 0x96);
+ this->menuClickMessage();
+ this->flashRect(0x29, 0x37, 0x142, 0x1c9, 0x96);
_activePuzzleSolved = true;
} else {
// 140:290c
@@ -1090,7 +1090,7 @@ void FoolGame::hermitScreenBehold() {
void FoolGame::sub_140_2968() {
// 140:2968
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForClick();
_activePuzzleSolved = true;
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 53517d94356..ec7f2a4628a 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -397,7 +397,7 @@ void FoolGame::wordSearchSuccess() {
}
// 131:10e8
this->fillRect(0x1eb, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
- this->sub_128_2664();
+ this->menuClickMessage();
this->waitForClick();
_stateFlags = kStateReturn;
}
Commit: 7414a69c7e233a52bc9e6e58057d987999992220
https://github.com/scummvm/scummvm/commit/7414a69c7e233a52bc9e6e58057d987999992220
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:29+02:00
Commit Message:
MACGUI: Add MacMenu::setFont
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index c528269a3e0..afd0273f686 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -84,8 +84,7 @@ void MacMenuSubMenu::enableAllItems() {
MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
: BaseMacWindow(id, false, wm) {
_loadedFont = NULL;
-
- _font = getMenuFont();
+ setFont(kMacFontSystem, 12);
_align = kTextAlignLeft;
@@ -264,6 +263,12 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources *exe, MacWindowManager
return menu;
}
+void MacMenu::setFont(uint16 fontID, uint16 fontSize) {
+ _fontID = fontID;
+ _fontSize = fontSize;
+ _font = getMenuFont();
+}
+
void MacMenu::printMenu(int level, MacMenuSubMenu *submenu) {
if (!level) {
for (uint i = 0; i < _items.size(); i++) {
@@ -804,7 +809,7 @@ const Font *MacMenu::getMenuFont(int slant) {
}
#endif
- return _wm->_fontMan->getFont(Graphics::MacFont(kMacFontSystem, 12, slant));
+ return _wm->_fontMan->getFont(Graphics::MacFont(_fontID, _fontSize, slant));
}
Common::CodePage MacMenu::getMenuEncoding() const {
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 07b0a58fd1e..814d6e5b642 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -150,7 +150,7 @@ public:
bool isVisible() { return _isVisible; }
void setVisible(bool visible, bool silent = false) override { _isVisible = visible; _contentIsDirty = true; }
- void setFont(const Font *font) { _font = font; }
+ void setFont(uint16 fontID, uint16 fontSize);
void printMenu(int level = 0, MacMenuSubMenu *submenu = nullptr);
@@ -231,6 +231,8 @@ private:
MacMenuItem *findMenuItem(int menuId, int itemId);
+ uint16 _fontID;
+ uint16 _fontSize;
const Font *_font;
Font *_loadedFont;
Commit: b7d039aff5bb2152292aa78ea59c65b6c230a271
https://github.com/scummvm/scummvm/commit/b7d039aff5bb2152292aa78ea59c65b6c230a271
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:29+02:00
Commit Message:
FOOL: Fix ZBasic::setMenuFont
Changed paths:
engines/fool/fool_game.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 9baae06cea3..eea802f7995 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -83,7 +83,7 @@ void FoolGame::run() {
error("FoolGame::run: Fool's Errand program not found");
}
// Fool's Errand has an embedded version of Chicago with custom characters
- _zbasic->setMenuFont(_fontChicago, 12, 0);
+ _zbasic->setMenuFont(_fontChicago, 12);
foolRun();
delete _zbasic;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index d03ae720427..cce32007474 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -801,9 +801,8 @@ Common::String ZBasic::indexRaw(int16 table, int16 index) {
return _index[table][index];
}
-void ZBasic::setMenuFont(uint16 font, uint16 size, uint16 slant) {
- Graphics::MacFont macFont = Graphics::MacFont(font, size, slant);
- _menu->setFont(g_engine->_wm._fontMan->getFont(&macFont));
+void ZBasic::setMenuFont(uint16 font, uint16 size) {
+ _menu->setFont(font, size);
}
} // namespace Fool
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index ff19f9734af..629c0be4080 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -306,7 +306,7 @@ public:
Common::U32String index(int16 table, int16 index);
Common::String indexRaw(int16 table, int16 index);
- void setMenuFont(uint16 font, uint16 size, uint16 slant);
+ void setMenuFont(uint16 font, uint16 size);
};
} // namespace Fool
Commit: 23068b708ad88faa7b9e4a3fc75bd55398097102
https://github.com/scummvm/scummvm/commit/23068b708ad88faa7b9e4a3fc75bd55398097102
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:29+02:00
Commit Message:
MACGUI: Allow injection of custom FOND information
Changed paths:
graphics/macgui/macfontmanager.cpp
graphics/macgui/macfontmanager.h
diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 22b17fdb455..533e3e81cb8 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -361,103 +361,106 @@ void MacFontManager::loadFonts(const Common::Path &fileName) {
loadFonts(&fontFile);
}
-void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
- Common::MacResIDArray fonts = fontFile->getResIDArray(MKTAG('F','O','N','D'));
- if (fonts.size() > 0) {
- for (auto &curFont : fonts) {
- Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), curFont);
-
- Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), curFont);
- int familySlant = parseSlant(familyName);
+void MacFontManager::loadMacFont(Common::MacResManager *fontFile, const Common::String &family, Common::SeekableReadStream *fond) {
+ int familySlant = parseSlant(family);
- familyName = cleanFontName(familyName);
+ Common::String familyName = cleanFontName(family);
- Graphics::MacFontFamily *fontFamily = new MacFontFamily(familyName);
- fontFamily->load(*fond);
+ Graphics::MacFontFamily *fontFamily = new MacFontFamily(familyName);
+ fontFamily->load(*fond);
- Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily->getAssocTable();
+ Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily->getAssocTable();
- bool fontFamilyUsed = false;
+ bool fontFamilyUsed = false;
- for (uint i = 0; i < assoc->size(); i++) {
- debugC(5, kDebugLevelMacGUI, "size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant,
- (*assoc)[i]._fontID);
+ for (uint i = 0; i < assoc->size(); i++) {
+ debugC(5, kDebugLevelMacGUI, "size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant,
+ (*assoc)[i]._fontID);
- Common::SeekableReadStream *fontstream;
- MacFont *macfont;
- Graphics::MacFONTFont *font;
+ Common::SeekableReadStream *fontstream;
+ MacFont *macfont;
+ Graphics::MacFONTFont *font;
- fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
+ fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID);
- if (!fontstream)
- fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
+ if (!fontstream)
+ fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID);
#ifdef USE_FREETYPE2
- if (!fontstream) {
- // The sfnt resource should be just a copy of a TTF
- fontstream = fontFile->getResource(MKTAG('s', 'f', 'n', 't'), (*assoc)[i]._fontID);
- Common::String fontName = Common::String::format("%s-%d-0", familyName.c_str(), (*assoc)[i]._fontStyle | familySlant);
- _ttfData[fontName] = fontstream;
- continue;
- }
+ if (!fontstream) {
+ // The sfnt resource should be just a copy of a TTF
+ fontstream = fontFile->getResource(MKTAG('s', 'f', 'n', 't'), (*assoc)[i]._fontID);
+ Common::String fontName = Common::String::format("%s-%d-0", familyName.c_str(), (*assoc)[i]._fontStyle | familySlant);
+ _ttfData[fontName] = fontstream;
+ continue;
+ }
#endif
- if (!fontstream) {
- if ((*assoc)[i]._fontSize == 0) {
- warning("MacFontManager: Detected possible TrueType FontID %d, but no TrueType support detected", (*assoc)[i]._fontID);
- } else {
- warning("MacFontManager: Unknown FontId: %d", (*assoc)[i]._fontID);
- }
- continue;
- }
+ if (!fontstream) {
+ if ((*assoc)[i]._fontSize == 0) {
+ warning("MacFontManager: Detected possible TrueType FontID %d, but no TrueType support detected", (*assoc)[i]._fontID);
+ } else {
+ warning("MacFontManager: Unknown FontId: %d", (*assoc)[i]._fontID);
+ }
+ continue;
+ }
- fontFamilyUsed = true;
+ fontFamilyUsed = true;
- font = new Graphics::MacFONTFont;
- font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
+ font = new Graphics::MacFONTFont;
+ font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
- delete fontstream;
+ delete fontstream;
- Common::String name = fontFamily->getName();
+ Common::String name = fontFamily->getName();
- if (!_fontIds.contains(name)) {
- int id = fontFamily->getFontFamilyId();
+ if (!_fontIds.contains(name)) {
+ int id = fontFamily->getFontFamilyId();
- FontInfo *info = new FontInfo;
- info->name = fontFamily->getName();
- if (id >= 0x4000) {
- info->lang = Common::JA_JPN;
- info->encoding = Common::kWindows932;
- } else {
- info->encoding = Common::kMacRoman;
- }
+ FontInfo *info = new FontInfo;
+ info->name = fontFamily->getName();
+ if (id >= 0x4000) {
+ info->lang = Common::JA_JPN;
+ info->encoding = Common::kWindows932;
+ } else {
+ info->encoding = Common::kMacRoman;
+ }
- _fontIds[name] = id;
- _fontInfo[id] = info;
- }
+ _fontIds[name] = id;
+ _fontInfo[id] = info;
+ }
- Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle | familySlant, (*assoc)[i]._fontSize);
+ Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle | familySlant, (*assoc)[i]._fontSize);
- macfont = new MacFont(_fontIds.getValOrDefault(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
- macfont->setName(fontName);
+ macfont = new MacFont(_fontIds.getValOrDefault(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle | familySlant);
+ macfont->setName(fontName);
- FontMan.assignFontToName(fontName, font);
- macfont->setFont(font, false);
- if (_fontRegistry.contains(fontName)) {
- warning("MacFontManager: Overwriting font %s", fontName.c_str());
- delete _fontRegistry.getVal(fontName);
- }
- _fontRegistry.setVal(fontName, macfont);
+ FontMan.assignFontToName(fontName, font);
+ macfont->setFont(font, false);
+ if (_fontRegistry.contains(fontName)) {
+ warning("MacFontManager: Overwriting font %s", fontName.c_str());
+ delete _fontRegistry.getVal(fontName);
+ }
+ _fontRegistry.setVal(fontName, macfont);
- debugC(5, kDebugLevelMacGUI, " %s", fontName.c_str());
- }
+ debugC(5, kDebugLevelMacGUI, " %s", fontName.c_str());
+ }
- delete fond;
+ if (fontFamilyUsed)
+ _fontFamilies.push_back(fontFamily);
+ else
+ delete fontFamily;
+}
+
+void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
+ Common::MacResIDArray fonts = fontFile->getResIDArray(MKTAG('F', 'O', 'N', 'D'));
+ if (fonts.size() > 0) {
+ for (auto &curFont : fonts) {
+ Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), curFont);
- if (fontFamilyUsed)
- _fontFamilies.push_back(fontFamily);
- else
- delete fontFamily;
+ Common::String family = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), curFont);
+ loadMacFont(fontFile, family, fond);
+ delete fond;
}
}
}
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index 6ee6490fc40..e56fcf2e155 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -187,6 +187,7 @@ public:
void loadFonts(Common::SeekableReadStream *stream);
void loadFonts(const Common::Path &fileName);
+ void loadMacFont(Common::MacResManager *fontFile, const Common::String &family, Common::SeekableReadStream *fond);
void loadFonts(Common::MacResManager *fontFile);
void loadWindowsFont(const Common::Path &fileName);
Commit: 5426c7bd8a0e998b20137ed5f7365f820d068c17
https://github.com/scummvm/scummvm/commit/5426c7bd8a0e998b20137ed5f7365f820d068c17
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:30+02:00
Commit Message:
FOOL: Fix font rendering on Fool's Errand v1.1
Changed paths:
engines/fool/fool_game.cpp
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index eea802f7995..a0384d34844 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/memstream.h"
#include "common/ustr.h"
#include "common/util.h"
#include "fool/fool.h"
@@ -33,7 +34,7 @@ extern Toolbox *g_toolbox;
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
-// v1.0 - original release, single-density disks, different about menu
+// v1.1 - original release, single-density disks, different about menu
// v2.0 - fixes full-screen rendering on higher-resolution displays, new about menu, can disable sounds
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
@@ -52,13 +53,66 @@ static const int fool30ZStrOffset[] = {
97, 73, 98, 161, 177, 179, 183, 185, 193, 230, 251, 273, 308, 317,
};
+// Fool's Errand v1.1 is missing FOND data, below is taken from 2.0
+static const byte fondChicago[] = {
+ 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 12
+};
+static const byte fondFool[] = {
+ 96, 0, 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 1, 0, 12, 0, 0, 125, 12, 0, 24, 0, 0,
+ 125, 24
+};
+static const byte fondLarge[] = {
+ 96, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 24, 0, 0, 127, 24
+};
+static const byte fondPuzzle[] = {
+ 96, 0, 0, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 2, 0, 12, 0, 0, 125, 140, 0, 24, 0, 0,
+ 125, 152, 0, 48, 0, 0, 125, 176
+};
+
+// v1.1 includes all fonts except Small
+static const byte fondSmall[] = {
+ 96, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 126, 9
+};
+
void FoolGame::run() {
+ _zbasic = new ZBasic(g_toolbox);
+
+ Common::MacFinderInfo finfo;
+ if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
+ _zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
+ // v1.0 filename ends with "tm"
+ } else if (g_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
+ _zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
+ } else {
+ error("FoolGame::run: Fool's Errand program not found");
+ return;
+ }
+
switch (_version) {
case kFool11:
_zstrOffset = fool11ZStrOffset;
- // v1.1 and v2.0 provide overrides for "Chicago".
- // v1.1 doesn't include a FOND chunk, so we have to manufacture one.
+ // v1.1 and v2.0 provide direct overrides for "Chicago".
+ // v1.1 doesn't include any FOND chunks, so we have to provide them here.
_fontChicago = 0;
+ _zbasic->injectFOND(fondChicago, sizeof(fondChicago), Common::String("Chicago"));
+ _zbasic->injectFOND(fondFool, sizeof(fondFool), Common::String("fool"));
+ _zbasic->injectFOND(fondLarge, sizeof(fondLarge), Common::String("Large"));
+ _zbasic->injectFOND(fondPuzzle, sizeof(fondPuzzle), Common::String("Puzzle"));
break;
case kFool30:
_zstrOffset = fool30ZStrOffset;
@@ -72,18 +126,10 @@ void FoolGame::run() {
break;
}
- _zbasic = new ZBasic(g_toolbox);
- Common::MacFinderInfo finfo;
- if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
- _zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
- // v1.0 filename ends with "tm"
- } else if (g_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
- _zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
- } else {
- error("FoolGame::run: Fool's Errand program not found");
- }
// Fool's Errand has an embedded version of Chicago with custom characters
_zbasic->setMenuFont(_fontChicago, 12);
+
+ // Start the game
foolRun();
delete _zbasic;
}
@@ -878,7 +924,7 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
int menuNo = 3 + ((this->var_i16_30 - 1) / 0x10);
int itemNo = 1 + ((this->var_i16_30 - 1) % 0x10);
// add the wadjet eye next to the chapter name
- _zbasic->menu(menuNo, itemNo, 1, _puzzleName[this->var_i16_30] + _zbasic->str(9));
+ _zbasic->menu(menuNo, itemNo, 1, _puzzleName[this->var_i16_30] + Common::U32String(" ~ ")); // was: str(9)
}
// 128:188a
this->sub_128_4da(0);
@@ -1177,7 +1223,7 @@ void FoolGame::menuClickMessage() {
g_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- Common::U32String message = _zbasic->str(15); // click mouse to continue
+ Common::U32String message = Common::U32String("Click Mouse to Continue"); // was: str(15)
int16 width = g_toolbox->StringWidth(message);
g_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
g_toolbox->DrawString(message);
@@ -1234,7 +1280,7 @@ void FoolGame::sub_128_2808() {
// 128:2812: MOVE.L - A0,-0x8ee(A5)
_zbasic->openR(2, this->var_str_588, 0x400, this->var_i16_688);
this->var_str_7e8 = _zbasic->readFileStr(2, 0x11);
- if (this->var_str_7e8 == _zbasic->str(16)) { // The Fool's Errand
+ if (this->var_str_7e8 == Common::U32String("The Fool's Errand")) { // str(16)
this->var_i16_8e8 = _zbasic->readFileInt(2);
this->var_i16_8e8 = _zbasic->readFileInt(2);
this->var_i16_8e8 = _zbasic->readFileInt(2);
@@ -1259,10 +1305,10 @@ void FoolGame::sub_128_2808() {
// 128:28f8: LEA - [0x3818],A0
// 128:28fc: MOVE.L - A0,-0x8ee(A5)
if (this->var_i16_7e6 != 0) {
- _modalText[0] = _zbasic->str(17) + this->var_str_588 + _zbasic->str(18);
- _modalText[1] = _zbasic->str(19);
+ _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", this->var_str_588.c_str()); // was: str(17), str(18)
+ _modalText[1] = Common::U32String("Okay"); // was: str(19)
this->showChoiceModal(0, 0, 1, 1);
- this->var_str_588 = _zbasic->str(20);
+ this->var_str_588.clear(); // was: str(20)
this->var_i16_7e6 = 0;
}
}
@@ -1270,7 +1316,7 @@ void FoolGame::sub_128_2808() {
void FoolGame::menuOpenGame() {
// 128:2988
// File -> Open
- this->sub_128_1e4(_zbasic->str(21)); // FOOL
+ this->sub_128_1e4(Common::U32String("FOOL")); // was: str(21)
if (this->var_str_588.empty()) { // was: str(22)
return;
}
@@ -1301,10 +1347,10 @@ void FoolGame::saveGameAs() {
// 128:2a0e
if (_saveFileName.empty()) { // was: str(24)
// 128:2a28
- this->openSaveFileDialog(_zbasic->str(25), _zbasic->str(26)); // name of game, blank
+ this->openSaveFileDialog(Common::U32String("Name of game?"), Common::U32String()); // was: str(25), str(26)
} else {
// 128:2a48
- this->openSaveFileDialog(_zbasic->str(27), _saveFileName); // New Name?, old filename
+ this->openSaveFileDialog(Common::U32String("New Name?"), _saveFileName); // was: str(27)
}
// 128:2a60
if (!this->var_str_486.empty()) { // was: str(28)
@@ -1472,8 +1518,8 @@ void FoolGame::openGame() {
// 128:2f84
_zbasic->close(2);
if (this->var_i16_7e6 != 0) {
- _modalText[0] = _zbasic->str(34) + _saveFileName + _zbasic->str(35); // file cannot be opened
- _modalText[1] = _zbasic->str(36);
+ _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", _saveFileName.c_str()); // was: str(34), str(35)
+ _modalText[1] = Common::U32String("Okay"); // was: str(36)
this->var_i16_7e6 = 0;
if ((this->var_i16_7ce & 1) == 0) {
setStateBits(kStateNewGame | kStateReturn);
@@ -1634,11 +1680,11 @@ void FoolGame::saveGame() {
this->var_i16_7e6 = 0;
// 128:359e: LEA - [0x3808],A0
// 128:35a2: MOVE.L - A0,-0x8ee(A5)
- _zbasic->defOpen(_zbasic->str(59)); // FOOLgf87
+ _zbasic->defOpen(Common::U32String("FOOLgf87")); // str(59)
_zbasic->openW(2, _saveFileName, 0x400, this->var_i16_9ec);
if (this->var_i16_7e6 != 0xa) {
- this->var_str_af4 = _zbasic->str(60); // The Fool's Errand
+ this->var_str_af4 = Common::U32String("The Fool's Errand"); // str(60)
_zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
_zbasic->writeFileInt(2, _storyNextPage);
_zbasic->writeFileInt(2, _activePuzzle);
@@ -2637,7 +2683,7 @@ void FoolGame::sub_129_068() {
_screenOversized = true;
}
// 129:0166
- _zbasic->window(1, _zbasic->str(112), 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
+ _zbasic->window(1, Common::String(), 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
_zbasic->coordinateWindow();
g_toolbox->ClearMenuBar();
g_toolbox->DrawMenuBar();
@@ -2700,11 +2746,13 @@ void FoolGame::sub_129_068() {
if (false) {
//if (this->var_i16_372.red + this->var_i16_372.blue + this->var_i16_372.green != 0) {
- // we're in colour mode, chide the user
- _modalText[0] = _zbasic->str(113);
- _modalText[1] = _zbasic->str(114);
- _modalText[2] = _zbasic->str(115);
- _modalText[3] = _zbasic->str(116);
+ // we're in colour mode, chide the user.
+ // removed in v3.0
+ // was: str(113) to str(116)
+ _modalText[0] =Common::U32String("Set your monitor to");
+ _modalText[1] = Common::U32String("2 color black and white");
+ _modalText[2] = Common::U32String("and start the game again.");
+ _modalText[3] = Common::U32String("Okay");
this->showChoiceModal(0, 2, 1, 0);
_zbasic->unk_4();
}
@@ -2713,13 +2761,14 @@ void FoolGame::sub_129_068() {
this->var_i32_37c = _zbasic->mem(-1);
if (this->var_i32_37c < 0x1d4c0) {
// not enough memory, chide the user
- _modalText[0] = _zbasic->str(117);
- _modalText[1] = _zbasic->str(118);
- _modalText[2] = _zbasic->str(119);
- _modalText[3] = _zbasic->str(120);
- _modalText[4] = _zbasic->str(121);
- _modalText[5] = _zbasic->str(122);
- _modalText[6] = _zbasic->str(123);
+ // was: str(117) to str(123)
+ _modalText[0] = Common::U32String("There is not enough available memory");
+ _modalText[1] = Common::U32String("to run the program at this time.");
+ _modalText[2] = Common::U32String();
+ _modalText[3] = Common::U32String("Check your instruction manual for");
+ _modalText[4] = Common::U32String("for possible solutions.");
+ _modalText[5] = Common::U32String();
+ _modalText[6] = Common::U32String("Quit");
this->showChoiceModal(0, 5, 1, 1);
_zbasic->unk_4();
}
@@ -2773,12 +2822,11 @@ void FoolGame::sub_129_068() {
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
this->sub_128_4da(1);
- Common::U32String PUZZ = _zbasic->str(137);
- this->sub_128_1e4(PUZZ);
+ this->sub_128_1e4(Common::U32String("PUZZ")); // was: str(137)
// 129:06a6: CLR.W - -0x772(A5)
fillRect(0x17, 0x92, 0x31, 0x16e, 1);
this->sub_128_4da(0);
- if (this->var_str_588 == _zbasic->str(138)) {
+ if (this->var_str_588.empty()) { // was: str(138)
_zbasic->unk_4();
}
this->var_str_e22 = this->var_str_588;
@@ -2991,7 +3039,7 @@ void FoolGame::sub_129_068() {
if (_pageToChapter[i] == j) {
this->var_i16_484++;
// - X of N
- _pageNumberText[i] = Common::U32String::format("%s %d%s %d", _zbasic->str(141).encode().c_str(), this->var_i16_484, _zbasic->str(142).encode().c_str(), this->var_i16_1040);
+ _pageNumberText[i] = Common::U32String::format(" - %d of %d", this->var_i16_484, this->var_i16_1040); // was: str(141), str(142)
}
// 129:0fb6
if (_pageToChapter[i] > j) {
@@ -3147,9 +3195,8 @@ void FoolGame::sub_144_004() {
_modalText[2] = Common::U32String("Has not the fool gained the gift of wisdom?");
_modalText[3] = Common::U32String();
_modalText[4] = Common::U32String("Congratulations!");
- _modalText[5] = Common::U32String("And now it is time to show the Finale for the Fool's Errand.");
- _modalText[6] = Common::U32String();
- _modalText[7] = Common::U32String("Continue");
+ _modalText[5] = Common::U32String("You may now view the finale.");
+ _modalText[7] = Common::U32String("Okay");
showChoiceModal(0xfa, 6, 1, 0);
if (!_screenOversized) {
g_toolbox->ClearMenuBar();
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index b4aa8a73862..c63b8a1ac9e 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -183,6 +183,7 @@ Toolbox::~Toolbox() {
_swSynth = nullptr;
}
+
void Toolbox::_pumpEvents() {
Common::Event event;
Common::EventManager *manager = g_system->getEventManager();
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index b9e80fd5bc2..d9c2e662e8f 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -1303,6 +1303,8 @@ public:
// the speciï¬ed number of points.
void TextSize(uint16 size);
+ void _injectFOND(int16 resID, const byte *data, const size_t size, const Common::String &name);
+
private:
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
Common::Array<int16> _resOrder;
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index 78310461573..91756cccba3 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/memstream.h"
#include "common/system.h"
#include "fool/fool.h"
@@ -26,6 +27,13 @@
namespace Fool {
+void Toolbox::_injectFOND(int16 resID, const byte *data, const size_t size, const Common::String &name) {
+ if (_resMap.contains(resID)) {
+ Common::MemoryReadStream stream(data, size);
+ g_engine->_wm._fontMan->loadMacFont(_resMap[resID].get(), name, &stream);
+ }
+}
+
int16 Toolbox::CurResFile() {
// Return whatever the first resource file is
if (_resOrder.empty())
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index cce32007474..d7902c0df26 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -801,6 +801,10 @@ Common::String ZBasic::indexRaw(int16 table, int16 index) {
return _index[table][index];
}
+void ZBasic::injectFOND(const byte *data, const size_t size, const Common::String &name) {
+ _toolbox->_injectFOND(_fileId, data, size, name);
+}
+
void ZBasic::setMenuFont(uint16 font, uint16 size) {
_menu->setFont(font, size);
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 629c0be4080..e83ac034bf0 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -28,7 +28,6 @@
#include "common/stream.h"
#include "common/ustr.h"
#include "graphics/macgui/macwindow.h"
-#include "graphics/surface.h"
#include "fool/toolbox.h"
@@ -306,6 +305,7 @@ public:
Common::U32String index(int16 table, int16 index);
Common::String indexRaw(int16 table, int16 index);
+ void injectFOND(const byte *data, const size_t size, const Common::String &name);
void setMenuFont(uint16 font, uint16 size);
};
Commit: dc2c1549ad55b555b48fa1308dfe481001cd7484
https://github.com/scummvm/scummvm/commit/dc2c1549ad55b555b48fa1308dfe481001cd7484
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:30+02:00
Commit Message:
FOOL: Make prologue accessible from about menu
Changed paths:
engines/fool/fool.cpp
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_hermit.cpp
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_threeships.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/module.mk
engines/fool/toolbox.h
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index 05843046ae1..dfd539a60c1 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -37,16 +37,13 @@
namespace Fool {
FoolEngine *g_engine;
-Toolbox *g_toolbox;
FoolEngine::FoolEngine(OSystem *syst, const FOOLGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Fool") {
g_engine = this;
- g_toolbox = new Toolbox();
}
FoolEngine::~FoolEngine() {
- delete g_toolbox;
}
uint32 FoolEngine::getFeatures() const {
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 8cbb4f45878..fdda4ed773c 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetCards] + (x))
-extern Toolbox *g_toolbox;
+
// v1.1 and v2.0 have the winning score set to 700.
// v3.0 revises this to be 666, which I can't dispute is a much cooler score.
@@ -45,15 +45,15 @@ void FoolGame::cardsRun() {
this->fetchPuzzleData();
this->var_i16_c00 = 1;
// set up card bounding boxes
- g_toolbox->SetRect(_screenGrid[1], 0x78, 0x19, 0xd1, 0xae);
- g_toolbox->SetRect(_screenGrid[2], 0xd3, 0x19, 0x12c, 0xae);
- g_toolbox->SetRect(_screenGrid[3], 0x12e, 0x19, 0x187, 0xae);
- g_toolbox->SetRect(_screenGrid[4],1, 0x2a, 0x5a, 0xbf);
- g_toolbox->SetRect(_screenGrid[5],0x1a6, 0x2a, 0x1ff, 0xbf);
- g_toolbox->SetRect(_screenGrid[6], 0x1, 0xc0, 0x5a, 0x155);
- g_toolbox->SetRect(_screenGrid[7],0x1a6, 0xc0, 0x1ff, 0x155);
- g_toolbox->SetRect(_screenGrid[8],0x5b, 0xc0, 0xb4, 0x155);
- g_toolbox->SetRect(_screenGrid[9],0x14c, 0xc0, 0x1a5, 0x155);
+ _toolbox->SetRect(_screenGrid[1], 0x78, 0x19, 0xd1, 0xae);
+ _toolbox->SetRect(_screenGrid[2], 0xd3, 0x19, 0x12c, 0xae);
+ _toolbox->SetRect(_screenGrid[3], 0x12e, 0x19, 0x187, 0xae);
+ _toolbox->SetRect(_screenGrid[4],1, 0x2a, 0x5a, 0xbf);
+ _toolbox->SetRect(_screenGrid[5],0x1a6, 0x2a, 0x1ff, 0xbf);
+ _toolbox->SetRect(_screenGrid[6], 0x1, 0xc0, 0x5a, 0x155);
+ _toolbox->SetRect(_screenGrid[7],0x1a6, 0xc0, 0x1ff, 0x155);
+ _toolbox->SetRect(_screenGrid[8],0x5b, 0xc0, 0xb4, 0x155);
+ _toolbox->SetRect(_screenGrid[9],0x14c, 0xc0, 0x1a5, 0x155);
// 139:011c
for (int i = 0; i <= 0x25; i++) {
@@ -63,7 +63,7 @@ void FoolGame::cardsRun() {
this->var_i16_484 = 0x5e;
for (int i = 0x17; i >= 0; i--) {
this->var_i16_484++;
- this->arr_i32_192c0[i] = g_toolbox->GetPicture(this->var_i16_484);
+ this->arr_i32_192c0[i] = _toolbox->GetPicture(this->var_i16_484);
}
// 139:0184
this->sub_128_bde(1, 1, 0, 1, 1, 1);
@@ -147,7 +147,7 @@ void FoolGame::cardsRun() {
// JMP 1d7e
// 139:1d7e
for (int i = 0; i <= 0x17; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_192c0[i]);
+ _toolbox->ReleaseResource(this->arr_i32_192c0[i]);
}
}
@@ -192,8 +192,8 @@ void FoolGame::cardsDrawTable() {
this->sub_128_918(_zbasic->str(OFF(0))); // Select a card above
this->var_i16_7a2 = 0xd4;
this->sub_128_918(_zbasic->str(OFF(1))); // or
- g_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
- g_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ _toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
+ _toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7a2 = 0xe9;
this->sub_128_918(_zbasic->str(OFF(2))); // Yield
@@ -208,11 +208,11 @@ void FoolGame::cardsOnClick() {
if (!((_event.where.x >= 0x78) && (_event.where.y >= 0x19) && (_event.where.x <= 0x187) && (_event.where.y <= 0xae))) {
// 139:06fc
// didn't click in the three cards area
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_4338)) {
- g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ if (_toolbox->PtInRect(_event.where, this->arr_rect_4338)) {
+ _toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
this->waitForMouseUp();
- g_toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
- if (!g_toolbox->PtInRect(_event.where, this->arr_rect_4338))
+ _toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ if (!_toolbox->PtInRect(_event.where, this->arr_rect_4338))
return;
// 139:0778
// player clicked the yield button (bad choice)
@@ -500,9 +500,9 @@ void FoolGame::cardsRevealHands() {
if (this->var_i16_2016 == 2) {
_zbasic->swapStr(this->var_str_167c, this->var_str_2222);
}
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
- this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_167c);
- this->var_i16_9f2 = g_toolbox->StringWidth(this->var_str_2222);
+ this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
+ this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_167c);
+ this->var_i16_9f2 = _toolbox->StringWidth(this->var_str_2222);
this->var_i16_2322 = 0;
if (this->var_i16_484 > this->var_i16_2322) {
this->var_i16_2322 = this->var_i16_484;
@@ -677,16 +677,16 @@ void FoolGame::cardsDrawScores() {
this->fillRect(0x14, 0, 0x29, 0x5a, 2);
// Old Man
this->var_str_384 = _zbasic->str(OFF(20)) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
- g_toolbox->MoveTo(0x2d - (this->var_i16_484 / 2), 0x23);
- g_toolbox->DrawString(this->var_str_384);
+ this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
+ _toolbox->MoveTo(0x2d - (this->var_i16_484 / 2), 0x23);
+ _toolbox->DrawString(this->var_str_384);
// 139:1c30
this->fillRect(0x14, 0x1a6, 0x29, 0x200, 2);
this->var_str_384 = _zbasic->str(OFF(21)) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
- g_toolbox->MoveTo(0x1d3 - (this->var_i16_484 / 2), 0x23);
- g_toolbox->DrawString(this->var_str_384);
+ this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
+ _toolbox->MoveTo(0x1d3 - (this->var_i16_484 / 2), 0x23);
+ _toolbox->DrawString(this->var_str_384);
}
void FoolGame::cardsStoreState() {
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 5b046796c83..c6dacd315c0 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -26,14 +26,14 @@
namespace Fool {
-extern Toolbox *g_toolbox;
+
// Death challenge
void FoolGame::deathRun() {
// 141:0004
_zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
this->drawPuzzleButton(Common::U32String("~")); // was: str(334)
- g_toolbox->InvertRect(this->arr_rect_1910c);
+ _toolbox->InvertRect(this->arr_rect_1910c);
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
_zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
this->deathDrawZoom();
@@ -55,7 +55,7 @@ void FoolGame::deathRun() {
// 141:01cc
this->getNextEvent(-1);
this->deathMoveBlackEye();
- if (g_toolbox->PtInRect(_event.where, _deathBlackEye)) {
+ if (_toolbox->PtInRect(_event.where, _deathBlackEye)) {
this->deathCaught();
// 141:09f6
this->deathDrawWhiteEye();
@@ -93,13 +93,13 @@ void FoolGame::deathRun() {
}
// 141:02c6
this->getNextEvent(0);
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
- this->var_i32_692 = g_toolbox->TickCount();
+ if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ this->var_i32_692 = _toolbox->TickCount();
// 141:02fa
do {
this->getNextEvent(0);
if (((_event.modifiers & kModMouseButtonUp) == 0) &&
- g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ _toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
// JMP 0x9a2
// 141:09a2
this->deathDrawWhiteEye();
@@ -112,22 +112,22 @@ void FoolGame::deathRun() {
return;
}
// 141:0342
- } while (g_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
+ } while (_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
}
// 141:035a
// mouse moved out from menu, zap the white eye
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kNotPatXor);
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PenSize(0x17, 0x10);
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kNotPatXor);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PenSize(0x17, 0x10);
for (int i = 0; i <= 5; i++) {
- g_toolbox->MoveTo(_deathBlackEye.left, _deathBlackEye.top);
- g_toolbox->LineTo(0x6c, 0x127);
- g_toolbox->Delay(0);
+ _toolbox->MoveTo(_deathBlackEye.left, _deathBlackEye.top);
+ _toolbox->LineTo(0x6c, 0x127);
+ _toolbox->Delay(0);
}
// 141:03bc
this->deathDrawWhiteEye();
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
// 141:03c2
this->deathMoveBlackEye();
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index a0384d34844..63c0e4ab6ae 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -30,7 +30,7 @@
namespace Fool {
-extern Toolbox *g_toolbox;
+
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
@@ -90,19 +90,22 @@ static const byte fondSmall[] = {
};
void FoolGame::run() {
- _zbasic = new ZBasic(g_toolbox);
+ _toolbox = new Toolbox();
+ _zbasic = new ZBasic(_toolbox);
Common::MacFinderInfo finfo;
- if (g_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
+ if (_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
_zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
// v1.0 filename ends with "tm"
- } else if (g_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
+ } else if (_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
_zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
} else {
error("FoolGame::run: Fool's Errand program not found");
return;
}
+ _zbasic->loadFonts();
+
switch (_version) {
case kFool11:
_zstrOffset = fool11ZStrOffset;
@@ -132,6 +135,9 @@ void FoolGame::run() {
// Start the game
foolRun();
delete _zbasic;
+ _zbasic = nullptr;
+ delete _toolbox;
+ _toolbox = nullptr;
}
void FoolGame::foolRun() {
@@ -162,7 +168,7 @@ void FoolGame::foolRun() {
_zbasic->unk_331(0x1b58, 1);
_zbasic->unk_331(0x1b58, 2);
- g_toolbox->SetRect(_screenClipRect, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(_screenClipRect, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
this->var_str_384 = _zbasic->str(0);
@@ -236,21 +242,21 @@ void FoolGame::foolRun() {
this->var_i16_7b2 = this->var_i16_7cc;
if (this->var_i16_7b2 == 0) {
if ((this->var_i16_7ce & 2) == 0) {
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
} else {
- g_toolbox->SetCursor(_cursors[0x10]);
+ _toolbox->SetCursor(_cursors[0x10]);
}
// 128:1d42
} else {
// 128:1d46
if (this->var_i16_7b2 == -1) {
// arrow pointing up
- g_toolbox->SetCursor(_cursors[0x2]);
+ _toolbox->SetCursor(_cursors[0x2]);
}
// 128:1d5e
if (this->var_i16_7b2 == 1) {
// arrow pointing down
- g_toolbox->SetCursor(_cursors[0x1]);
+ _toolbox->SetCursor(_cursors[0x1]);
}
}
}
@@ -307,10 +313,10 @@ void FoolGame::foolRun() {
this->sub_128_1f1e();
_zbasic->unk_158();
_zbasic->unk_4();
- g_toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(this->var_i32_8);
fillRect(0, 0, 0x14, _windowWidth, 2);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_0);
}
void FoolGame::copyScreen(int16 put, BitMap &bmp) {
@@ -343,7 +349,7 @@ void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::
this->var_i32_16e = 0;
// 128:017e
- g_toolbox->SFPutFile(_event.where, title, filename, this->var_i32_16e, this->var_sfr_5e);
+ _toolbox->SFPutFile(_event.where, title, filename, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -377,7 +383,7 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
typeList.types[0] += this->var_str_172.at(2) << 8;
typeList.types[0] += this->var_str_172.at(3) << 0;
- g_toolbox->SFGetFile(_event.where, _zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
+ _toolbox->SFGetFile(_event.where, _zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -418,18 +424,18 @@ void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
void FoolGame::delay(int16 ticks) {
// 128:03da
- this->var_i32_68e = g_toolbox->TickCount();
+ this->var_i32_68e = _toolbox->TickCount();
do {
- g_toolbox->Delay(0);
- } while (g_toolbox->TickCount() < (this->var_i32_68e + ticks));
+ _toolbox->Delay(0);
+ } while (_toolbox->TickCount() < (this->var_i32_68e + ticks));
}
void FoolGame::sub_128_406(int16 unk1) {
// 128:0402
do {
- g_toolbox->Delay(0);
- } while (g_toolbox->TickCount() < (this->var_i32_692 + unk1));
+ _toolbox->Delay(0);
+ } while (_toolbox->TickCount() < (this->var_i32_692 + unk1));
}
int16 FoolGame::puzzlesReadByte() {
@@ -475,11 +481,11 @@ void FoolGame::sub_128_4da(int16 unk1) {
// 128:04da
if (unk1 == 0) {
if (this->var_i16_7a0 == 1) {
- g_toolbox->HideCursor();
+ _toolbox->HideCursor();
}
} else {
if (this->var_i16_7a0 == 0) {
- g_toolbox->ShowCursor();
+ _toolbox->ShowCursor();
}
}
this->var_i16_7a0 = unk1;
@@ -496,7 +502,7 @@ void FoolGame::playTone(int16 freq, int16 duration, int16 wait) {
_zbasic->sound(this->var_i16_30, this->var_i16_32, 20, 0);
if (this->var_i16_34 == 1) {
while (_zbasic->soundBusy()) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
}
@@ -504,20 +510,20 @@ void FoolGame::playTone(int16 freq, int16 duration, int16 wait) {
void FoolGame::drawPuzzleButton(const Common::U32String &symbol) {
// 128:055c
- g_toolbox->PenNormal();
- g_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
- g_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- g_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ _toolbox->PenNormal();
+ _toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
+ _toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ _toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- int16 width = g_toolbox->StringWidth(symbol);
- g_toolbox->MoveTo(0x78 - (width / 2), 0x133);
- g_toolbox->DrawString(symbol);
+ int16 width = _toolbox->StringWidth(symbol);
+ _toolbox->MoveTo(0x78 - (width / 2), 0x133);
+ _toolbox->DrawString(symbol);
}
int16 FoolGame::sub_128_5fe() {
// 128:05fe
ParamBlockRec pb;
- g_toolbox->PBGetVol(pb);
+ _toolbox->PBGetVol(pb);
this->var_i16_30 = pb.ioVRefNum;
return this->var_i16_30;
}
@@ -526,62 +532,62 @@ OSErr FoolGame::sub_128_64c(int16 unk1) {
// 128:064c
ParamBlockRec pb;
pb.ioVRefNum = unk1;
- return g_toolbox->PBSetVol(pb);
+ return _toolbox->PBSetVol(pb);
}
void FoolGame::fillRect(int16 patternID, PatternMode mode, int16 top, int16 left, int16 bottom, int16 right) {
// 128:069c
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[patternID]);
- g_toolbox->PenMode(mode);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[patternID]);
+ _toolbox->PenMode(mode);
Common::Rect bounds; // arr_rect_5b7c
- g_toolbox->SetRect(bounds, left, top, right, bottom);
- g_toolbox->PaintRect(bounds);
- g_toolbox->PenNormal();
+ _toolbox->SetRect(bounds, left, top, right, bottom);
+ _toolbox->PaintRect(bounds);
+ _toolbox->PenNormal();
}
void FoolGame::drawTarotCard(int16 rectID, int16 deckPos, int16 type) {
// 128:0712
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
if (type == 0) {
- g_toolbox->PenSize(0x3, 0x3);
- g_toolbox->PenPat(_patterns[0]);
- g_toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
- g_toolbox->PenSize(1, 1);
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
+ _toolbox->PenSize(0x3, 0x3);
+ _toolbox->PenPat(_patterns[0]);
+ _toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
+ _toolbox->PenSize(1, 1);
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
// 128:079e
_zbasic->picture(_screenGrid[rectID].left + 3, _screenGrid[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
}
// 128:0806
if (type == 1) {
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
if (type == 2) {
- g_toolbox->PenMode(kPatOr);
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
+ _toolbox->PenMode(kPatOr);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
if (type == 3) {
- g_toolbox->InvertRoundRect(_screenGrid[rectID], 0xc, 0xc);
+ _toolbox->InvertRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:08b4
Common::Rect bounds; // arr_rect_5b7c
- g_toolbox->SetRect(bounds, left, top, right, bottom);
- g_toolbox->FillRect(bounds, _patterns[patternID]);
+ _toolbox->SetRect(bounds, left, top, right, bottom);
+ _toolbox->FillRect(bounds, _patterns[patternID]);
}
void FoolGame::sub_128_918(const Common::U32String &unk1) {
// 128:0918
_zbasic->stringCopy(this->var_str_172, unk1);
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
- g_toolbox->MoveTo((SCREEN_WIDTH / 2) - (this->var_i16_30 / 2), this->var_i16_7a2);
- g_toolbox->DrawString(this->var_str_172);
+ this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
+ _toolbox->MoveTo((SCREEN_WIDTH / 2) - (this->var_i16_30 / 2), this->var_i16_7a2);
+ _toolbox->DrawString(this->var_str_172);
}
void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps) {
@@ -598,9 +604,9 @@ void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int1
end.left = endLeft;
end.bottom = endBottom;
end.right = endRight;
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[patternID]);
- g_toolbox->PenMode(mode);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[patternID]);
+ _toolbox->PenMode(mode);
// 128:0a42
// unrolled loop
this->arr_bcd_5dbc[0] = (float)(start.top);
@@ -612,7 +618,7 @@ void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int1
this->arr_bcd_5dbc[6] = (float)((end.bottom) - (start.bottom))/(float)(steps);
this->arr_bcd_5dbc[7] = (float)((end.right) - (start.right))/(float)(steps);
// 128:0af0
- g_toolbox->PaintRect(start);
+ _toolbox->PaintRect(start);
for (int i = 1; i < steps-1; i++) {
for (int j = 0; j <= 3; j++) {
this->arr_bcd_5dbc[j] = (float)this->arr_bcd_5dbc[j] + (float)this->arr_bcd_5dbc[j+4];
@@ -623,13 +629,13 @@ void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int1
temp.bottom = (int)this->arr_bcd_5dbc[2];
temp.right = (int)this->arr_bcd_5dbc[3];
// 128:0ba6
- g_toolbox->PaintRect(temp);
+ _toolbox->PaintRect(temp);
// new: force a redraw delay
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
// 128:0bc8
- g_toolbox->PaintRect(end);
- g_toolbox->PenNormal();
+ _toolbox->PaintRect(end);
+ _toolbox->PenNormal();
}
void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
@@ -649,14 +655,14 @@ void FoolGame::getNextEvent(uint32 unk1) {
// This function is usually called at the start of an event processing loop,
// so yield to the event pump/display update when necessary.
if (_event.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
- this->var_i16_78a = g_toolbox->GetNextEvent(unk1, _event);
+ this->var_i16_78a = _toolbox->GetNextEvent(unk1, _event);
if ((_event.what == kMouseDown) && (_event.where.y < 0x14)) {
this->onClickMenu();
}
// 128:0caa
- g_toolbox->GlobalToLocal(_event.where);
+ _toolbox->GlobalToLocal(_event.where);
if (_event.what == kKeyDown) {
// the original just checked the command key,
// non-mac PCs expect the control key to work
@@ -693,7 +699,7 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
// 128:0d94
do {
// FIXME: Flashing far too intense
- g_toolbox->InvertRect(bounds);
+ _toolbox->InvertRect(bounds);
int ticks = 0;
do {
// originally this used getNextEvent, but we avoid that here
@@ -701,9 +707,9 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
// originally this mask was 0, but we change it here to
// intercept all events, and fall back to NullEvent +
// wait for vsync if no events were received.
- this->var_i16_78a = g_toolbox->GetNextEvent(-1, _event);
+ this->var_i16_78a = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kNullEvent) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
ticks += 1;
}
} while (!((ticks >= (millis*60/1000)) || ((_event.modifiers & kModMouseButtonUp) == 0)));
@@ -713,9 +719,9 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount, bool beep) {
// 128:0dfe
- g_toolbox->SetPort(this->var_i32_4);
+ _toolbox->SetPort(this->var_i32_4);
this->var_i16_7b2 = 0xa;
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->sub_128_4da(1);
if (beep) {
this->playTone(0x19, 0x64, 0);
@@ -727,7 +733,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
this->var_i16_7b6 = 0;
for (int i = 0; i <= lineCount; i++) {
// 128:0e86
- this->var_i16_7ba = g_toolbox->StringWidth(_modalText[i]);
+ this->var_i16_7ba = _toolbox->StringWidth(_modalText[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
}
@@ -743,23 +749,23 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
// 128:0f08
this->var_i16_7b4 = (this->var_i16_7b4 / 2) + 0xf;
this->var_i16_7b6 = (this->var_i16_7b6 / 2);
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
Common::Rect bounds; // arr_rect_5b7c
- g_toolbox->SetRect(bounds, 0xf5-this->var_i16_7b4, 0xa0-this->var_i16_7b6, 0x10b+this->var_i16_7b4, 0xb6+this->var_i16_7b6);
- g_toolbox->PenPat(_patterns[0]);
- g_toolbox->FrameRect(bounds);
- g_toolbox->InsetRect(bounds, 1, 1);
- g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->FrameRect(bounds);
- g_toolbox->InsetRect(bounds, 5, 5);
- g_toolbox->PenSize(5, 5);
+ _toolbox->SetRect(bounds, 0xf5-this->var_i16_7b4, 0xa0-this->var_i16_7b6, 0x10b+this->var_i16_7b4, 0xb6+this->var_i16_7b6);
+ _toolbox->PenPat(_patterns[0]);
+ _toolbox->FrameRect(bounds);
+ _toolbox->InsetRect(bounds, 1, 1);
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->FrameRect(bounds);
+ _toolbox->InsetRect(bounds, 5, 5);
+ _toolbox->PenSize(5, 5);
// 128:0ff8
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->FrameRect(bounds);
- g_toolbox->InsetRect(bounds, 5, 5);
- g_toolbox->FillRect(bounds, _patterns[2]);
- g_toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->FrameRect(bounds);
+ _toolbox->InsetRect(bounds, 5, 5);
+ _toolbox->FillRect(bounds, _patterns[2]);
+ _toolbox->PenNormal();
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
// 128:1056
for (int i = 0; i <= lineCount; i++) {
@@ -771,7 +777,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
}
// 128:10a0
if (buttonCount != 0) {
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// 128:10c0
@@ -781,78 +787,78 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
Common::Rect button3 = Common::Rect(0, 0, 0, 0); // arr_rect_5b8c
// 128:10e2
if (buttonCount == 1) {
- g_toolbox->SetRect(button1, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button1, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
// 128:1122
} else if (buttonCount == 2) {
- g_toolbox->SetRect(button1, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
- g_toolbox->SetRect(button2, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button1, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button2, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
// 128:1182
} else if (buttonCount == 3) {
- g_toolbox->SetRect(button1, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
- g_toolbox->SetRect(button2, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
- g_toolbox->SetRect(button3, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button1, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button2, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button3, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
}
// 128:1208
if (buttonCount >= 1) {
- g_toolbox->EraseRoundRect(button1, 0xa, 0xa);
- g_toolbox->FrameRoundRect(button1, 0xa, 0xa);
+ _toolbox->EraseRoundRect(button1, 0xa, 0xa);
+ _toolbox->FrameRoundRect(button1, 0xa, 0xa);
this->var_str_172 = _modalText[(lineCount + 1)];
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
// 128:1274
this->var_i16_30 = button1.left + ((button1.right - button1.left) / 2) - (this->var_i16_30 / 2);
// 128:12d4
- g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
- g_toolbox->DrawString(this->var_str_172);
+ _toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
+ _toolbox->DrawString(this->var_str_172);
if (buttonCount > 1) {
- g_toolbox->InsetRect(button1, -2, -2);
- g_toolbox->PenPat(_patterns[0]);
- g_toolbox->FrameRoundRect(button1, 0xa, 0xa);
- g_toolbox->PenNormal();
- g_toolbox->InsetRect(button1, 2, 2);
+ _toolbox->InsetRect(button1, -2, -2);
+ _toolbox->PenPat(_patterns[0]);
+ _toolbox->FrameRoundRect(button1, 0xa, 0xa);
+ _toolbox->PenNormal();
+ _toolbox->InsetRect(button1, 2, 2);
}
}
// 128:134c
if (buttonCount >= 2) {
- g_toolbox->EraseRoundRect(button2, 0xa, 0xa);
- g_toolbox->FrameRoundRect(button2, 0xa, 0xa);
+ _toolbox->EraseRoundRect(button2, 0xa, 0xa);
+ _toolbox->FrameRoundRect(button2, 0xa, 0xa);
this->var_str_172 = _modalText[(lineCount+2)];
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
this->var_i16_30 = button2.left + ((button2.right - button2.left)/2) - (this->var_i16_30 / 2);
// 128:1418
- g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
- g_toolbox->DrawString(this->var_str_172);
+ _toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
+ _toolbox->DrawString(this->var_str_172);
}
// 128:1432
if (buttonCount == 3) {
- g_toolbox->EraseRoundRect(button3, 0xa, 0xa);
- g_toolbox->FrameRoundRect(button3, 0xa, 0xa);
+ _toolbox->EraseRoundRect(button3, 0xa, 0xa);
+ _toolbox->FrameRoundRect(button3, 0xa, 0xa);
this->var_str_172 = _modalText[lineCount+3];
- this->var_i16_30 = g_toolbox->StringWidth(this->var_str_172);
+ this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
this->var_i16_30 = (button3.left + ((button3.right - button3.left)/2)) - (this->var_i16_30/2);
- g_toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
- g_toolbox->DrawString(this->var_str_172);
+ _toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
+ _toolbox->DrawString(this->var_str_172);
}
// 128:1518
this->sub_128_61ec();
_savePromptChoice = 0;
// 128:1522
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(0xa, _event);
- g_toolbox->GlobalToLocal(_event.where);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(0xa, _event);
+ _toolbox->GlobalToLocal(_event.where);
if (_event.what == kMouseDown) {
// 128:154a
_savePromptChoice = 0;
Common::Rect target;
- if (g_toolbox->PtInRect(_event.where, button1)) {
+ if (_toolbox->PtInRect(_event.where, button1)) {
_savePromptChoice = 1;
target = button1;
}
- if (g_toolbox->PtInRect(_event.where, button2)) {
+ if (_toolbox->PtInRect(_event.where, button2)) {
_savePromptChoice = 2;
target = button2;
}
- if (g_toolbox->PtInRect(_event.where, button3)) {
+ if (_toolbox->PtInRect(_event.where, button3)) {
_savePromptChoice = 3;
target = button3;
}
@@ -861,31 +867,31 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
// 128:15d2
this->var_i16_30 = (_savePromptChoice - 1)*4;
do {
- g_toolbox->InvertRoundRect(target, 0xa, 0xa);
+ _toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1624
- while ((_event.what != kMouseUp) && (g_toolbox->PtInRect(_event.where, target))) {
+ while ((_event.what != kMouseUp) && (_toolbox->PtInRect(_event.where, target))) {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
- g_toolbox->GlobalToLocal(_event.where);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ _toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
- g_toolbox->InvertRoundRect(target, 0xa, 0xa);
+ _toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
- while ((_event.what != kMouseUp) && (!g_toolbox->PtInRect(_event.where, target))) {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
- g_toolbox->GlobalToLocal(_event.where);
+ while ((_event.what != kMouseUp) && (!_toolbox->PtInRect(_event.where, target))) {
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ _toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
// 128:16ea
} while (_event.what != kMouseUp);
- if (!g_toolbox->PtInRect(_event.where, target)) {
+ if (!_toolbox->PtInRect(_event.where, target)) {
_savePromptChoice = 0;
}
this->sub_128_61ec();
@@ -899,13 +905,13 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
}
}
if (_event.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
// 128:175c
} while (_savePromptChoice == 0);
this->sub_128_61ec();
this->copyScreen(1, this->arr_bmp_138bc);
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
}
// 128:1784
@@ -933,8 +939,8 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
for (int j = 0; j <= 1; j++) {
// 128:18c4
for (int i = 0; i <= 0x64; i += 4) {
- this->var_i32_692 = g_toolbox->TickCount();
- g_toolbox->SetRect(
+ this->var_i32_692 = _toolbox->TickCount();
+ _toolbox->SetRect(
this->arr_rect_4338,
(0x105 - (int)(i*2.2f)),
i + 0xa5,
@@ -942,31 +948,31 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
(0xa6 + (int)(i*1.6f))
);
// 128:1982
- g_toolbox->InvertRect(this->arr_rect_4338);
+ _toolbox->InvertRect(this->arr_rect_4338);
this->sub_128_406(0);
}
// 128:19a4
}
// 128:19b2
- g_toolbox->PenNormal();
- g_toolbox->PaintRect(this->arr_rect_4338);
- g_toolbox->PenMode(kPatXor);
- g_toolbox->FrameRect(this->arr_rect_4338);
- g_toolbox->PenMode(kPatCopy);
- this->var_i16_484 = g_toolbox->StringWidth(message);
+ _toolbox->PenNormal();
+ _toolbox->PaintRect(this->arr_rect_4338);
+ _toolbox->PenMode(kPatXor);
+ _toolbox->FrameRect(this->arr_rect_4338);
+ _toolbox->PenMode(kPatCopy);
+ this->var_i16_484 = _toolbox->StringWidth(message);
// 128:19ec
- g_toolbox->MoveTo(0x105 - (this->var_i16_484/2), 0x12e);
- g_toolbox->DrawString(message);
+ _toolbox->MoveTo(0x105 - (this->var_i16_484/2), 0x12e);
+ _toolbox->DrawString(message);
// loop count was 0x4d
for (int i = 0; i <= 0x24; i++) {
- this->var_i32_692 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_rect_4338);
+ this->var_i32_692 = _toolbox->TickCount();
+ _toolbox->InvertRect(this->arr_rect_4338);
// this was 1, however the flashing was far too intense
this->sub_128_406(8);
}
for (int i = 1; i <= 0x24; i++) {
// 128:1a4c
- this->var_i32_692 = g_toolbox->TickCount();
+ this->var_i32_692 = _toolbox->TickCount();
this->arr_rect_4338.top -= (int)(i*0.4f);
this->arr_rect_4338.left -= (int)(i*0.1f);
this->arr_rect_4338.bottom += (int)(i*0.05f);
@@ -977,22 +983,22 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
}
// 128:1bac
if (this->var_i16_32 == 0) {
- g_toolbox->InvertRect(this->arr_rect_4338);
+ _toolbox->InvertRect(this->arr_rect_4338);
}
// 128:1bc2
if (this->var_i16_32 == 1) {
- g_toolbox->FillRect(this->arr_rect_4338, _patterns[3]);
+ _toolbox->FillRect(this->arr_rect_4338, _patterns[3]);
}
// 128:1be6
if (this->var_i16_32 == 2) {
- g_toolbox->FillRect(this->arr_rect_4338, _patterns[0x47]);
+ _toolbox->FillRect(this->arr_rect_4338, _patterns[0x47]);
}
// 128:1c0a
// was 1
this->sub_128_406(2);
}
this->sub_128_4da(1);
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
void FoolGame::setStateBits(uint16 bits) {
@@ -1010,14 +1016,14 @@ void FoolGame::clearStateBits(uint16 bits) {
void FoolGame::sub_128_1ef8() {
// 128:1ef8
- g_toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(this->var_i32_8);
fillRect(0, 0, 0x14, _windowWidth, 2);
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_128_1f1e() {
// 128:1f1e
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->sub_128_4da(0);
this->sub_128_bde(1, 1, kSrcCopy, 1, 1, 1);
}
@@ -1030,7 +1036,7 @@ void FoolGame::sub_128_1f44() {
this->sub_128_5fea();
this->copyScreen(1, this->arr_bmp_5dfc);
this->storyRenderPage();
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_128_1f76() {
@@ -1038,13 +1044,13 @@ void FoolGame::sub_128_1f76() {
// hold down mouse on scroll
if (this->var_i16_7cc != 0) {
do {
- this->var_i32_692 = g_toolbox->TickCount();
+ this->var_i32_692 = _toolbox->TickCount();
this->sub_128_20d0();
// original was 5 ticks
this->sub_128_406(10);
// new: empty the event queue, so feedback is instant
- g_toolbox->FlushEvents(-1, 0);
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ _toolbox->FlushEvents(-1, 0);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
} while ((_event.modifiers & kModMouseButtonUp) == 0);
} else {
// 128:1fee
@@ -1053,7 +1059,7 @@ void FoolGame::sub_128_1f76() {
}
// 128:2042
if (this->var_i16_7d6 != 0) {
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
this->sub_128_2078();
}
}
@@ -1065,10 +1071,10 @@ void FoolGame::sub_128_1f76() {
void FoolGame::sub_128_2078() {
// clicking the story button
// 128:2078
- g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ _toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
this->waitForMouseUp();
- g_toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ _toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
this->sub_128_21c8();
}
}
@@ -1163,19 +1169,19 @@ void FoolGame::storyRenderPage() {
// 128:23f0: CLR.W - -0x772(A5)
this->var_i16_7d6 = 1;
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- g_toolbox->MoveTo(0x8a, 0x133);
- g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
+ _toolbox->MoveTo(0x8a, 0x133);
+ _toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- g_toolbox->MoveTo(0x70, 0x133);
- g_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
+ _toolbox->MoveTo(0x70, 0x133);
+ _toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
}
// 128:2468
if (!_pageNumberText[_storyNextPage].empty()) { // was: str(13)
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- g_toolbox->DrawString(_pageNumberText[_storyNextPage]);
+ _toolbox->DrawString(_pageNumberText[_storyNextPage]);
}
// 128:24be
if (_storyNextPage != _storyCurrentPage) {
@@ -1190,8 +1196,8 @@ void FoolGame::storyRenderPage() {
this->var_i16_7a2 = 0x11d - (_pageLines[_storyNextPage] * 0xf);
debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", _storyNextPage, _pageLines[_storyNextPage]);
if (_pageLines[_storyNextPage] < 0xf) {
- g_toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
- g_toolbox->DrawString(Common::U32String("â")); // was: str(14)
+ _toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
+ _toolbox->DrawString(Common::U32String("â")); // was: str(14)
this->var_i16_7de = this->var_i16_7a2 - 0x1e;
} else {
// 128:25a6
@@ -1199,15 +1205,15 @@ void FoolGame::storyRenderPage() {
}
// 128:25b6
// printing the story to the screen
- g_toolbox->MoveTo(0x41, this->var_i16_7a2);
+ _toolbox->MoveTo(0x41, this->var_i16_7a2);
for (int i = _pageLineRanges[_storyNextPage*2]; i <= _pageLineRanges[_storyNextPage*2+1]; i++) {
- g_toolbox->TextFace(_pageLineFace[i]);
+ _toolbox->TextFace(_pageLineFace[i]);
this->var_str_384 = _zbasic->index(0, i);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
if (_pageLineBreak[i] != 0) {
// 128:262a
this->var_i16_7a2 += 0xf;
- g_toolbox->MoveTo(0x41, this->var_i16_7a2);
+ _toolbox->MoveTo(0x41, this->var_i16_7a2);
}
// 128:263a
}
@@ -1220,15 +1226,15 @@ void FoolGame::storyRenderPage() {
void FoolGame::menuClickMessage() {
// 128:2664
// hide menu and replace with "click mouse to continue" message
- g_toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
Common::U32String message = Common::U32String("Click Mouse to Continue"); // was: str(15)
- int16 width = g_toolbox->StringWidth(message);
- g_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
- g_toolbox->DrawString(message);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_0);
+ int16 width = _toolbox->StringWidth(message);
+ _toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
+ _toolbox->DrawString(message);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_128_26f6() {
@@ -1305,7 +1311,7 @@ void FoolGame::sub_128_2808() {
// 128:28f8: LEA - [0x3818],A0
// 128:28fc: MOVE.L - A0,-0x8ee(A5)
if (this->var_i16_7e6 != 0) {
- _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", this->var_str_588.c_str()); // was: str(17), str(18)
+ _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", this->var_str_588.encode().c_str()); // was: str(17), str(18)
_modalText[1] = Common::U32String("Okay"); // was: str(19)
this->showChoiceModal(0, 0, 1, 1);
this->var_str_588.clear(); // was: str(20)
@@ -1518,7 +1524,7 @@ void FoolGame::openGame() {
// 128:2f84
_zbasic->close(2);
if (this->var_i16_7e6 != 0) {
- _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", _saveFileName.c_str()); // was: str(34), str(35)
+ _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", _saveFileName.encode().c_str()); // was: str(34), str(35)
_modalText[1] = Common::U32String("Okay"); // was: str(36)
this->var_i16_7e6 = 0;
if ((this->var_i16_7ce & 1) == 0) {
@@ -1570,9 +1576,9 @@ void FoolGame::sub_128_3032() {
// draw the first page of text
for (int i = 1; i <= 0xf; i++) {
// 128:31ec
- g_toolbox->MoveTo(0x41, this->var_i16_7a2);
+ _toolbox->MoveTo(0x41, this->var_i16_7a2);
this->var_str_384 = _zbasic->index(0, i);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
this->var_i16_7a2 += 0xf;
}
// 128:3228
@@ -1724,24 +1730,24 @@ void FoolGame::saveGame() {
if (!_isAutoSaving) {
this->cursorExplodingWatchShort();
}
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
}
}
void FoolGame::sub_128_3744() {
// 128:3744
for (int i = 3; i <= 7; i++) {
- this->var_menu_bf8 = g_toolbox->GetMHandle(i);
- g_toolbox->DeleteMenu(i);
- g_toolbox->DisposeMenu(this->var_menu_bf8);
+ this->var_menu_bf8 = _toolbox->GetMHandle(i);
+ _toolbox->DeleteMenu(i);
+ _toolbox->DisposeMenu(this->var_menu_bf8);
}
- g_toolbox->DrawMenuBar();
+ _toolbox->DrawMenuBar();
}
// watch cursor
void FoolGame::cursorWatch() {
// 128:3774
- g_toolbox->SetCursor(_cursors[3]);
+ _toolbox->SetCursor(_cursors[3]);
this->var_i16_7b2 = 0xa;
}
@@ -1749,13 +1755,13 @@ void FoolGame::cursorExplodingWatch() {
// 128:378a
for (int j = 0; j <= 1; j++) {
for (int i = 3; i <= 6; i++) {
- g_toolbox->SetCursor(_cursors[i]);
+ _toolbox->SetCursor(_cursors[i]);
this->delay(3);
}
// 128:37c2
}
for (int i = 7; i <= 0xf; i++) {
- g_toolbox->SetCursor(_cursors[i]);
+ _toolbox->SetCursor(_cursors[i]);
this->delay(4);
}
@@ -1765,7 +1771,7 @@ void FoolGame::cursorExplodingWatch() {
void FoolGame::cursorExplodingWatchShort() {
// 128:37ce
for (int i = 7; i <= 0xf; i++) {
- g_toolbox->SetCursor(_cursors[i]);
+ _toolbox->SetCursor(_cursors[i]);
this->delay(4);
}
this->var_i16_7b2 = 0xa;
@@ -1788,7 +1794,7 @@ void FoolGame::puzzleRun() {
this->var_i16_7b2 = 0xa;
_activePuzzle = _storyCurrentChapter;
this->var_i16_7ce |= 1;
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->copyScreen(0, this->arr_bmp_5dfc);
// 128:39fa
if (this->arr_i16_15e8[_storyCurrentChapter] > 0) {
@@ -1867,12 +1873,12 @@ void FoolGame::puzzleRun() {
// 128:3aa4
this->puzzleSaveContext();
if ((_stateFlags & kStateQuit) == 0) {
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
this->copyScreen(1, this->arr_bmp_5dfc);
- this->var_menu_bf8 = g_toolbox->GetMHandle(8);
- g_toolbox->DeleteMenu(8);
- g_toolbox->DisposeMenu(this->var_menu_bf8);
- g_toolbox->DrawMenuBar();
+ this->var_menu_bf8 = _toolbox->GetMHandle(8);
+ _toolbox->DeleteMenu(8);
+ _toolbox->DisposeMenu(this->var_menu_bf8);
+ _toolbox->DrawMenuBar();
}
// 128:3aea
_zbasic->indexClear(1);
@@ -1931,7 +1937,7 @@ void FoolGame::puzzleRun() {
// 128:3d82
this->var_i16_c02 = 0;
this->var_i16_c00 = 0;
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
if ((_stateFlags & (kStateQuit | kStateOpenGame | kStateNewGame)) == 0) {
if ((this->var_i16_7ce & 1) == 0) {
this->var_i16_7ce ^= 1;
@@ -1985,9 +1991,9 @@ void FoolGame::storyUnlockChapter() {
void FoolGame::puzzleSetupMenu() {
// 128:3fb6
// new: delete existing menu 8
- this->var_menu_bf8 = g_toolbox->GetMHandle(8);
- g_toolbox->DeleteMenu(8);
- g_toolbox->DisposeMenu(this->var_menu_bf8);
+ this->var_menu_bf8 = _toolbox->GetMHandle(8);
+ _toolbox->DeleteMenu(8);
+ _toolbox->DisposeMenu(this->var_menu_bf8);
_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
this->var_str_384 = Common::U32String("/RReturn to Scroll "); // was: str(72)
@@ -2119,9 +2125,9 @@ void FoolGame::sub_128_4472() {
return;
}
// 128:4520
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
- g_toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
+ _toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
if (this->arr_i16_4758[5] == 0) {
// 128:456a
this->arr_i16_4758[12] = 0x1d;
@@ -2135,7 +2141,7 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[7] = 0x6;
}
// 128:45e4
- g_toolbox->PenSize(this->arr_i16_4758[7], this->arr_i16_4758[6]);
+ _toolbox->PenSize(this->arr_i16_4758[7], this->arr_i16_4758[6]);
if ((this->arr_i16_4758[4] == 0) && (this->arr_i16_4758[5] == 0)) {
this->arr_i16_4758[8] = 0xa7;
this->arr_i16_4758[9] = 0x109;
@@ -2189,7 +2195,7 @@ void FoolGame::sub_128_4472() {
this->arr_i16_4758[1] = 1;
}
// 128:4a42
- g_toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
+ _toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
}
// 128:4a64
// FIXME: These can sometimes be invalid.
@@ -2199,14 +2205,14 @@ void FoolGame::sub_128_4472() {
temp.top = this->arr_i16_4758[8];
temp.right = this->arr_i16_4758[11];
temp.bottom = this->arr_i16_4758[10];
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
// add fake delay for drawing visibility
if ((i % 4) == 0) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
// 128:4a8e
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
// about screen
@@ -2288,9 +2294,9 @@ void FoolGame::menuAbout() {
modalLines = 5;
}
// 128:4e42
- g_toolbox->SetPort(this->var_i32_4);
+ _toolbox->SetPort(this->var_i32_4);
this->var_i16_7b2 = 0xa;
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->sub_128_4da(1);
this->copyScreen(0, this->arr_bmp_138bc);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
@@ -2298,7 +2304,7 @@ void FoolGame::menuAbout() {
this->var_i16_7b6 = 0;
this->var_i16_7b8 = 0;
for (int i = 0; i <= modalLines; i++) {
- this->var_i16_7ba = g_toolbox->StringWidth(_modalText[i]);
+ this->var_i16_7ba = _toolbox->StringWidth(_modalText[i]);
if (this->var_i16_7ba > this->var_i16_7b4) {
this->var_i16_7b4 = this->var_i16_7ba;
}
@@ -2310,43 +2316,43 @@ void FoolGame::menuAbout() {
this->var_i16_7b4 = (this->var_i16_7b4/2) + 0xf;
this->var_i16_7b6 = (this->var_i16_7b6/2);
Common::Rect bounds; // arr_rect_5b7c
- g_toolbox->SetRect(
+ _toolbox->SetRect(
bounds,
0xf5 - this->var_i16_7b4,
0x6e - this->var_i16_7b6,
0x10b + this->var_i16_7b4,
0xcf + this->var_i16_7b6
);
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[0]);
- g_toolbox->FrameRect(bounds);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[0]);
+ _toolbox->FrameRect(bounds);
// 128:4f6a
- g_toolbox->InsetRect(bounds, 1, 1);
- g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->FrameRect(bounds);
- g_toolbox->InsetRect(bounds, 5, 5);
- g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->FrameRect(bounds);
+ _toolbox->InsetRect(bounds, 1, 1);
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->FrameRect(bounds);
+ _toolbox->InsetRect(bounds, 5, 5);
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->FrameRect(bounds);
// 128:4fe2
- g_toolbox->InsetRect(bounds, 5, 5);
- g_toolbox->FillRect(bounds, _patterns[0]);
- g_toolbox->PenNormal();
+ _toolbox->InsetRect(bounds, 5, 5);
+ _toolbox->FillRect(bounds, _patterns[0]);
+ _toolbox->PenNormal();
// 128:5014
- g_toolbox->SetRect(
+ _toolbox->SetRect(
bounds,
0xb5,
0x82 - this->var_i16_7b6,
0xd5,
0x82 - this->var_i16_7b6 + 0x20
);
- g_toolbox->PlotIcon(bounds, this->var_i32_c);
+ _toolbox->PlotIcon(bounds, this->var_i32_c);
// These strings don't appear in the v1.1 about box
- g_toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
- g_toolbox->DrawString(Common::U32String("the fool's errand")); // was: str(100)
- g_toolbox->MoveTo(0xee, 0x9b - this->var_i16_7b6);
- g_toolbox->DrawString(Common::U32String("by Cliff Johnson")); // was: str(101)
+ _toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
+ _toolbox->DrawString(Common::U32String("the fool's errand")); // was: str(100)
+ _toolbox->MoveTo(0xee, 0x9b - this->var_i16_7b6);
+ _toolbox->DrawString(Common::U32String("by Cliff Johnson")); // was: str(101)
// 128:509a
this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
@@ -2361,9 +2367,9 @@ void FoolGame::menuAbout() {
this->sub_128_918(_zbasic->str(_zstrOffset[kOffsetVersion])); // version string
this->menuClickMessage();
this->waitForClick();
- g_toolbox->DrawMenuBar();
+ _toolbox->DrawMenuBar();
this->copyScreen(0x1, this->arr_bmp_138bc);
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
}
void FoolGame::menuPrologue() {
@@ -2372,6 +2378,7 @@ void FoolGame::menuPrologue() {
FoolPrologue fp;
fp.run();
this->copyScreen(1, this->arr_bmp_138bc);
+ _toolbox->DrawMenuBar();
}
void FoolGame::onClickMenu() {
@@ -2382,13 +2389,13 @@ void FoolGame::onClickMenu() {
if (_menuHidesPlayfield) {
this->thothHidePlayfield();
}
- this->var_i32_bf8 = g_toolbox->MenuSelect(_event.where);
+ this->var_i32_bf8 = _toolbox->MenuSelect(_event.where);
_selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
_selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
if (_selectedMenuID > 0) {
// 128:5b8c
this->sub_128_5c20();
- g_toolbox->HiliteMenu(0);
+ _toolbox->HiliteMenu(0);
}
// 128:5b94
if (_menuHidesPlayfield) {
@@ -2400,8 +2407,8 @@ void FoolGame::onClickMenu() {
void FoolGame::sub_128_5baa() {
if (_menuDisabled)
return;
- this->var_i32_bf8 = g_toolbox->MenuKey((char)(_event.message & 0xff));
- g_toolbox->Delay(0);
+ this->var_i32_bf8 = _toolbox->MenuKey((char)(_event.message & 0xff));
+ _toolbox->Delay(0);
_selectedMenuID = this->var_i32_bf8 >> 16;
_selectedMenuItem = this->var_i32_bf8 & 0xffff;
if (_selectedMenuID > 0) {
@@ -2412,7 +2419,7 @@ void FoolGame::sub_128_5baa() {
if (_menuHidesPlayfield) {
this->thothShowPlayfield();
}
- g_toolbox->HiliteMenu(0);
+ _toolbox->HiliteMenu(0);
}
// 128:5c1a
this->sub_128_61ec();
@@ -2462,8 +2469,8 @@ void FoolGame::sub_128_5c20() {
} else {
// 128:5d74
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(1 << kKeyDown, _event);
- g_toolbox->GlobalToLocal(_event.where);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(1 << kKeyDown, _event);
+ _toolbox->GlobalToLocal(_event.where);
if ((_event.modifiers & kModLOptionKeyDown) != 0) {
this->var_i16_e1a = 1;
}
@@ -2532,8 +2539,8 @@ void FoolGame::sub_128_5f9e() {
void FoolGame::sub_128_5fb4() {
// 128:5fb4
- g_toolbox->BeginUpdate(*_event.windowPtr);
- g_toolbox->EndUpdate(*_event.windowPtr);
+ _toolbox->BeginUpdate(*_event.windowPtr);
+ _toolbox->EndUpdate(*_event.windowPtr);
if ((this->var_i16_7ce & 1) != 0) {
setStateBits(0x200 | kStateReturn);
} else {
@@ -2543,21 +2550,21 @@ void FoolGame::sub_128_5fb4() {
void FoolGame::sub_128_5fea() {
if (_screenOversized) {
- g_toolbox->SetPort(this->var_i32_8);
- g_toolbox->PenNormal();
+ _toolbox->SetPort(this->var_i32_8);
+ _toolbox->PenNormal();
fillRect(0x14, 0, _windowHeight, this->var_i16_56-3, 2);
fillRect(0x14, 0, this->var_i16_58+0x11, _windowWidth, 2);
fillRect(0x14, this->var_i16_56+0x203, _windowHeight, _windowWidth, 2);
fillRect(this->var_i16_58 + 0x159, 0, _windowHeight, _windowWidth, 2);
Common::Rect bounds; // arr_rect_5b7c
- g_toolbox->SetRect(bounds, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->FrameRect(bounds);
- g_toolbox->SetRect(bounds, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->FrameRect(bounds);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetRect(bounds, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->FrameRect(bounds);
+ _toolbox->SetRect(bounds, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->FrameRect(bounds);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_0);
}
// 128:6152
}
@@ -2577,10 +2584,10 @@ void FoolGame::waitForMouseUp() {
// wait until mouse button is up
do {
// was originally a mask of 6
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
- g_toolbox->GlobalToLocal(_event.where);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ _toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
} while ((_event.modifiers & kModMouseButtonUp) == 0);
}
@@ -2589,10 +2596,10 @@ void FoolGame::waitForClick() {
this->waitForMouseUp();
do {
// was originally a mask of 2
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
- g_toolbox->GlobalToLocal(_event.where);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ _toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
} while ((_event.what != kMouseDown));
this->waitForMouseUp();
}
@@ -2601,7 +2608,7 @@ void FoolGame::waitForClick() {
void FoolGame::sub_128_61ec() {
// 128:61ec
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
this->sub_128_5fb4();
}
@@ -2609,23 +2616,23 @@ void FoolGame::sub_128_61ec() {
this->sub_128_6154();
}
if (_event.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
} while (!((_event.what == kNullEvent) && (_event.modifiers & kModMouseButtonUp)));
_keyLastPressed = 0;
}
void FoolGame::sub_128_6244() {
do {
- this->var_i16_7a8 = g_toolbox->GetNextEvent(-1, _event);
+ this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
- g_toolbox->BeginUpdate(*_event.windowPtr);
- g_toolbox->EndUpdate(*_event.windowPtr);
+ _toolbox->BeginUpdate(*_event.windowPtr);
+ _toolbox->EndUpdate(*_event.windowPtr);
}
// 128:6272
if (_event.what == kDiskEvt) {
this->sub_128_6154();
}
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
} while ((_event.what == kNullEvent) && ((_event.modifiers & kModMouseButtonUp) == 0));
// SEGMENT_RETURN
}
@@ -2685,8 +2692,8 @@ void FoolGame::sub_129_068() {
// 129:0166
_zbasic->window(1, Common::String(), 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
_zbasic->coordinateWindow();
- g_toolbox->ClearMenuBar();
- g_toolbox->DrawMenuBar();
+ _toolbox->ClearMenuBar();
+ _toolbox->DrawMenuBar();
// very cursed check for the ROM85 flag
// 129:0196: MOVE.L - 0x28e,D0
@@ -2696,8 +2703,8 @@ void FoolGame::sub_129_068() {
// 129:01a8: CMPI.L - 0x3fff,D0
if (true) {
this->var_i16_372 = { 0x4e20, 0x4e20, 0x4e20 };
- g_toolbox->SetCPixel(0x64, 0x64, this->var_i16_372);
- g_toolbox->GetCPixel(0x64, 0x64, this->var_i16_372);
+ _toolbox->SetCPixel(0x64, 0x64, this->var_i16_372);
+ _toolbox->GetCPixel(0x64, 0x64, this->var_i16_372);
}
@@ -2708,37 +2715,37 @@ void FoolGame::sub_129_068() {
fillRect(0, 0, _windowHeight, _windowWidth, 1);
}
// 129:023e
- g_toolbox->GetPort(this->var_i32_f24);
+ _toolbox->GetPort(this->var_i32_f24);
this->var_i32_8 = &this->arr_grafport_19042;
- g_toolbox->OpenPort(this->var_i32_8);
+ _toolbox->OpenPort(this->var_i32_8);
// this grafport is used for drawing on the menu bar area;
// on normal hardware this isn't a problem, as the changes are
// made directly to the screen framebuffer.
// in ScummVM, the window and the menu bar are widgets, with surfaces
// that are composed to the screen framebuffer.
// as such, to avoid a clash, we need to draw onto the menu bar widget.
- this->var_i32_8->portBits = g_toolbox->_defaultMenuBits;
- this->var_i32_8->portRect = g_toolbox->_defaultMenuBits->getBounds();
+ this->var_i32_8->portBits = _toolbox->_defaultMenuBits;
+ this->var_i32_8->portRect = _toolbox->_defaultMenuBits->getBounds();
// Thoth, on the other hand, expects to be able to draw to the screen.
this->var_i32_8_thoth = &this->arr_grafport_19042_thoth;
- g_toolbox->OpenPort(this->var_i32_8_thoth);
- g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
- g_toolbox->ClipRect(_screenClipRect);
+ _toolbox->OpenPort(this->var_i32_8_thoth);
+ _toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ _toolbox->ClipRect(_screenClipRect);
this->var_i32_4 = &this->arr_grafport_18f78;
- g_toolbox->OpenPort(this->var_i32_4);
- g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
- g_toolbox->ClipRect(_screenClipRect);
+ _toolbox->OpenPort(this->var_i32_4);
+ _toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ _toolbox->ClipRect(_screenClipRect);
this->var_i32_0 = &this->arr_grafport_18eae;
- g_toolbox->OpenPort(this->var_i32_0);
- g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
- g_toolbox->ClipRect(_screenClipRect);
+ _toolbox->OpenPort(this->var_i32_0);
+ _toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ _toolbox->ClipRect(_screenClipRect);
this->sub_128_5fea();
// 129:02c8
@@ -2835,14 +2842,14 @@ void FoolGame::sub_129_068() {
}
// 129:0718
this->sub_128_64c(this->var_i16_f22);
- this->var_i16_1030 = g_toolbox->OpenResFile(Common::Path(this->var_str_e22, ':'));
- g_toolbox->UseResFile(this->var_i16_1030);
+ this->var_i16_1030 = _toolbox->OpenResFile(Common::Path(this->var_str_e22, ':'));
+ _toolbox->UseResFile(this->var_i16_1030);
this->var_i16_484 = this->sub_128_64c(this->var_i16_f2c);
for (int i = 0; i <= 1; i++) {
// scroll background
- this->arr_i32_192c0[i] = g_toolbox->GetPicture(i + 0x54);
+ this->arr_i32_192c0[i] = _toolbox->GetPicture(i + 0x54);
PicHandle h = this->arr_i32_192c0[i];
- g_toolbox->DetachResource(h);
+ _toolbox->DetachResource(h);
}
// 129:07a2
_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
@@ -2863,11 +2870,11 @@ void FoolGame::sub_129_068() {
// 129:08ee
for (int i = 0; i <= 1; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_192c0[i]);
+ _toolbox->ReleaseResource(this->arr_i32_192c0[i]);
}
// 129:091a
- this->var_i32_692 = g_toolbox->TickCount();
+ this->var_i32_692 = _toolbox->TickCount();
this->menuLoadingMessage(40);
// load sun's map tiles
@@ -2876,22 +2883,22 @@ void FoolGame::sub_129_068() {
//Common::fill(fakePal+3, fakePal+768, 0x00);
for (int i = 1; i <= 0x53; i++) {
- _sunMapTilePic[i] = g_toolbox->GetPicture(i);
+ _sunMapTilePic[i] = _toolbox->GetPicture(i);
//_sunMapTilePic[i]->getSurface()->debugPrint(0, 0, 0, 0, 0, -1, 160, fakePal);
- g_toolbox->DetachResource(_sunMapTilePic[i]);
+ _toolbox->DetachResource(_sunMapTilePic[i]);
}
// 129:097c
this->menuLoadingMessage(60);
// wadjet eye
- this->var_pic_7c2 = g_toolbox->GetPicture(0x56);
- g_toolbox->DetachResource(this->var_pic_7c2);
- _metapuzzleWheelPic = g_toolbox->GetPicture(0xac);
- g_toolbox->DetachResource(_metapuzzleWheelPic);
+ this->var_pic_7c2 = _toolbox->GetPicture(0x56);
+ _toolbox->DetachResource(this->var_pic_7c2);
+ _metapuzzleWheelPic = _toolbox->GetPicture(0xac);
+ _toolbox->DetachResource(_metapuzzleWheelPic);
// icon of a scroll
- this->var_i32_c = g_toolbox->GetIcon(0x101);
- g_toolbox->DetachResource(this->var_i32_c);
+ this->var_i32_c = _toolbox->GetIcon(0x101);
+ _toolbox->DetachResource(this->var_i32_c);
// 129:09c2: SF - 0x8,D0
_zbasic->openR(1, Common::U32String("Fool's Puzzles"), 1000, this->var_i16_f22); // was: str(140)
this->var_i32_1036 = _zbasic->readFileDblInt(1);
@@ -3063,11 +3070,11 @@ void FoolGame::sub_129_068() {
// 129:107a
}
// 129:108c
- g_toolbox->UseResFile(this->var_i16_1030);
+ _toolbox->UseResFile(this->var_i16_1030);
this->sub_128_406(0xc8);
this->var_i16_7ce = 0;
this->var_i16_7b2 = 0xa;
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->sub_128_4da(1);
// The menus are so different between versions, it's easiest to hardcode the v2.0 ones.
// Apple menu
@@ -3109,36 +3116,36 @@ void FoolGame::sub_129_068() {
void FoolGame::menuLoadingMessage(int16 percent) {
// 129:123a
// draw the loading text on the menu bar
- g_toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
Common::U32String message = Common::U32String::format("Loading Game - %d%%", percent); // was: str(158)
- int16 width = g_toolbox->StringWidth(message);
- g_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xe);
- g_toolbox->DrawString(message);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_0);
- g_toolbox->Delay(0);
+ int16 width = _toolbox->StringWidth(message);
+ _toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xe);
+ _toolbox->DrawString(message);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_0);
+ _toolbox->Delay(0);
}
void FoolGame::sub_144_004() {
// 144:0004
- g_toolbox->ReleaseResource(var_pic_7c2);
+ _toolbox->ReleaseResource(var_pic_7c2);
var_i32_7c8 = _zbasic->mem(-1);
_stateFlags = kStateQuit;
if (!_screenOversized) {
- g_toolbox->SetPort(var_i32_8);
+ _toolbox->SetPort(var_i32_8);
fillRect(0, 0, 0x14, SCREEN_WIDTH, 0x47);
- g_toolbox->SetPort(var_i32_0);
+ _toolbox->SetPort(var_i32_0);
} else {
// 144:0046
sub_128_1ef8();
}
// 144:004a
autoSaveGame(); // was: saveGame
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
sub_128_4da(0);
if (!_screenOversized) {
var_i16_42 = 0;
@@ -3147,12 +3154,12 @@ void FoolGame::sub_144_004() {
// 144:0070
var_i16_42 = 0x14;
var_i16_44 = 0xb5;
- g_toolbox->SetPort(var_i32_0);
+ _toolbox->SetPort(var_i32_0);
}
// 144:0082
_zbasic->get(1, var_i16_42+1, SCREEN_WIDTH, SCREEN_HEIGHT-1, arr_bmp_5dfc);
for (int16 i = 0xa; i <= 0xf0; i += 0xa) {
- var_i32_692 = g_toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
_zbasic->put(
i,
var_i16_42 + (int16)(i*0.6f),
@@ -3166,22 +3173,22 @@ void FoolGame::sub_144_004() {
delay(0x3c);
Common::Rect temp;
for (int16 i = 1; i <= 0x100; i++) {
- var_i32_692 = g_toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
- g_toolbox->SetRect(
+ _toolbox->SetRect(
temp,
0x100 - i,
var_i16_44 - (int16)(i*0.7f),
0x100 + i,
var_i16_44 + (int16)(i*0.7f)
);
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
sub_128_406(1);
}
// 144:0238
for (int16 i = 0; i <= 0xe; i++) {
- var_i32_692 = g_toolbox->TickCount();
- g_toolbox->InvertRect(temp);
+ var_i32_692 = _toolbox->TickCount();
+ _toolbox->InvertRect(temp);
sub_128_406(1);
}
// 144:0268
@@ -3199,8 +3206,8 @@ void FoolGame::sub_144_004() {
_modalText[7] = Common::U32String("Okay");
showChoiceModal(0xfa, 6, 1, 0);
if (!_screenOversized) {
- g_toolbox->ClearMenuBar();
- g_toolbox->DrawMenuBar();
+ _toolbox->ClearMenuBar();
+ _toolbox->DrawMenuBar();
}
sub_128_1f1e();
sub_128_4da(1);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 0913309f604..a5eab46114d 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -450,6 +450,7 @@ private:
FoolVersion _version;
const int *_zstrOffset;
int _fontChicago;
+ Toolbox *_toolbox;
ZBasic *_zbasic;
bool _quit = false;
diff --git a/engines/fool/fool_hermit.cpp b/engines/fool/fool_hermit.cpp
index 0664937e47a..053043d2335 100644
--- a/engines/fool/fool_hermit.cpp
+++ b/engines/fool/fool_hermit.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetHermit] + (x))
-extern Toolbox *g_toolbox;
+
// hermit key trace
void FoolGame::hermitRun() {
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 3952f9e8e8f..0b40a01ce39 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetHumbug] + (x))
-extern Toolbox *g_toolbox;
+
// the humbug - "irritating stick" style challenge
void FoolGame::humbugRun() {
@@ -91,7 +91,7 @@ void FoolGame::humbugTrail() {
);
// Simulate slow draw speed
if ((i % 42) == 0)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
// 142:026e
this->sub_128_4da(1);
@@ -200,7 +200,7 @@ void FoolGame::sub_142_630() {
this->thothKey2nd();
if (_activePuzzleSolved) {
// 142:066e
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
_zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
for (int16 i = 1; i <= 4; i++) {
Common::Rect temp;
@@ -208,17 +208,17 @@ void FoolGame::sub_142_630() {
temp.left = this->arr_i16_2f38[i*32+1];
temp.bottom = this->arr_i16_2f38[i*32+2];
temp.right = this->arr_i16_2f38[i*32+3];
- g_toolbox->FillRect(temp, _patterns[2]);
- g_toolbox->FrameRect(temp);
+ _toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FrameRect(temp);
this->var_str_384 = Common::U32String::format(" %d ", i);
- this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_384);
this->var_i16_9f2 = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
// 142:0756
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
this->arr_i16_2f38[i*32+1] + this->var_i16_9f2 - (this->var_i16_7e4 / 2),
this->arr_i16_2f38[i*32 + 2] - 0x1e
);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
}
// 142:07ca
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
@@ -242,7 +242,7 @@ void FoolGame::sub_142_630() {
temp.left = this->arr_i16_2f38[this->var_i16_9f2*32+1];
temp.bottom = this->arr_i16_2f38[this->var_i16_9f2*32+2];
temp.right = this->arr_i16_2f38[this->var_i16_9f2*32+3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
}
}
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index c71ecf1c384..1428fa379a1 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -30,7 +30,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetJigsaw] + (x))
-extern Toolbox *g_toolbox;
+
// jigsaw puzzle game
void FoolGame::jigsawRun() {
@@ -48,9 +48,9 @@ void FoolGame::jigsawRun() {
this->arr_i16_3738[i] = puzzlesReadByte();
}
// 132:00a2
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(picID);
+ this->arr_i32_192c0[0] = _toolbox->GetPicture(picID);
_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
- g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
this->var_i16_1aa0 = 4 + ((this->arr_i16_1eb8[12] + 1)*2) * ((this->arr_i16_1eb8[13]+0x10)/0x10);
// 132:0136
this->var_i16_1aa0 = (this->var_i16_1aa0 / 2) + 1;
@@ -60,7 +60,7 @@ void FoolGame::jigsawRun() {
this->var_i16_68a = this->arr_i16_1eb8[10];
do {
this->var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[this->var_i16_484],
this->var_i16_68a + 1,
this->var_i16_68c + 1,
@@ -114,7 +114,7 @@ void FoolGame::jigsawRun() {
// 132:0464
_stateFlags = kStateNull;
_zbasic->menu(8, 3, 0, Common::U32String());
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->jigsawCheckIfSolved();
// JMP 0x4d8
@@ -157,9 +157,9 @@ void FoolGame::jigsawOnClick() {
// 132:059c
_menuDisabled = true;
_zbasic->menu(8, 3, 0, Common::U32String());
- g_toolbox->PenNormal();
- g_toolbox->PenSize(3, 3);
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(3, 3);
+ _toolbox->PenMode(kPatXor);
// 132:05c4
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
@@ -168,7 +168,7 @@ void FoolGame::jigsawOnClick() {
this->jigsawDragSelect();
// leave an XOR outline on the page for the selected block
Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
this->arr_i16_4758[0] -= this->var_i16_68a;
this->arr_i16_4758[1] -= this->var_i16_68c;
@@ -177,7 +177,7 @@ void FoolGame::jigsawOnClick() {
this->jigsawMoveSelected();
// remove XOR outline
temp = Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
this->jigsawDropSelected();
this->jigsawCheckIfSolved();
@@ -217,9 +217,9 @@ void FoolGame::jigsawDragSelect() {
this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
// 132:092e
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
this->delay(2);
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
this->delay(1);
} while (_event.what != kMouseUp);
}
@@ -276,9 +276,9 @@ void FoolGame::jigsawMoveSelected() {
this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
// 132:0e0e
- g_toolbox->FrameRect(this->arr_rect_4776);
+ _toolbox->FrameRect(this->arr_rect_4776);
this->delay(2);
- g_toolbox->FrameRect(this->arr_rect_4776);
+ _toolbox->FrameRect(this->arr_rect_4776);
this->delay(1);
}
while (!((_event.what == kMouseDown) && (_event.where.y > 0x14)));
@@ -408,7 +408,7 @@ void FoolGame::jigsawSuccess() {
_activePuzzleStatus = 0x64;
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->_jigsawPieceCount; i++) {
- g_toolbox->InvertRect(_screenGrid[i]);
+ _toolbox->InvertRect(_screenGrid[i]);
this->delay(1);
}
}
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index bdc9ee58570..c353e8b946e 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -27,7 +27,7 @@
namespace Fool {
-extern Toolbox *g_toolbox;
+
// word jumble/substitute puzzle
void FoolGame::jumbleRun() {
@@ -67,7 +67,7 @@ void FoolGame::jumbleRun() {
this->var_i16_68a = this->arr_i16_1eb8[10];
do {
this->var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
@@ -87,9 +87,9 @@ void FoolGame::jumbleRun() {
int16 picY = puzzlesReadShort();
int16 picID = puzzlesReadShort();
if (picID > 0) {
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(picID);
+ this->arr_i32_192c0[0] = _toolbox->GetPicture(picID);
_zbasic->picture(picX, picY, this->arr_i32_192c0[0]);
- g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
}
}
// 130:01f0
@@ -113,8 +113,8 @@ void FoolGame::jumbleRun() {
// 130:0306
this->var_i16_103a = puzzlesReadShort();
if (this->var_i16_103a > 0) {
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[this->var_i16_1060]);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[this->var_i16_1060]);
this->var_i16_484 = 0;
for (int j = 1; j <= this->var_i16_103a; j++) {
this->var_i16_106a = puzzlesReadShort();
@@ -125,7 +125,7 @@ void FoolGame::jumbleRun() {
for (int i = 0; i <= 0xf; i++) {
this->var_i16_484++;
if (this->var_i16_106a & _bitLUT[i]) {
- g_toolbox->PaintRect(_screenGrid[this->var_i16_484]);
+ _toolbox->PaintRect(_screenGrid[this->var_i16_484]);
}
}
// 130:039e
@@ -218,25 +218,25 @@ void FoolGame::jumbleRun() {
this->var_i16_1576 = this->var_str_1170.size();
if ((_activePuzzle == 0x51) || (_activePuzzle == 0x54)) {
// 130:076e
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PenSize(3, 3);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PenSize(3, 3);
if (_activePuzzle == 0x51) {
// 130:0794
- g_toolbox->MoveTo(0xf3, 0x6f);
- g_toolbox->LineTo(0xf3, 0xe4);
- g_toolbox->MoveTo(0x9b, 0xa9);
- g_toolbox->LineTo(0x14c, 0xa9);
+ _toolbox->MoveTo(0xf3, 0x6f);
+ _toolbox->LineTo(0xf3, 0xe4);
+ _toolbox->MoveTo(0x9b, 0xa9);
+ _toolbox->LineTo(0x14c, 0xa9);
}
// 130:07bc
if (_activePuzzle == 0x54) {
- g_toolbox->MoveTo(0xe9, 0x81);
- g_toolbox->LineTo(0x17d, 0x81);
- g_toolbox->MoveTo(0x124, 0x47);
- g_toolbox->LineTo(0x124, 0xda);
+ _toolbox->MoveTo(0xe9, 0x81);
+ _toolbox->LineTo(0x17d, 0x81);
+ _toolbox->MoveTo(0x124, 0x47);
+ _toolbox->LineTo(0x124, 0xda);
}
// 130:07f0
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
// 130:07f2
this->var_i16_103a = puzzlesReadShort();
@@ -247,8 +247,8 @@ void FoolGame::jumbleRun() {
this->var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
_zbasic->text(kFontFool, 0xc, 0, kSrcOr);
if (this->var_i16_7e4 > 0) {
- g_toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
- g_toolbox->DrawString(this->var_str_1578);
+ _toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
+ _toolbox->DrawString(this->var_str_1578);
} else {
this->sub_130_2226();
}
@@ -306,8 +306,8 @@ void FoolGame::jumbleRun() {
}
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= this->var_i16_1576; i++) {
- g_toolbox->Delay((0xc - (this->var_i16_1576 / 0xa))*60/1000);
- g_toolbox->InvertRect(_screenGrid[ABS(this->arr_i16_3738[i])]);
+ _toolbox->Delay((0xc - (this->var_i16_1576 / 0xa))*60/1000);
+ _toolbox->InvertRect(_screenGrid[ABS(this->arr_i16_3738[i])]);
}
}
if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
@@ -323,7 +323,7 @@ void FoolGame::jumbleRun() {
return;
}
// if we're here, the puzzle is solved
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
this->menuClickMessage();
this->waitForMouseUp();
this->sub_128_61ec();
@@ -343,13 +343,13 @@ void FoolGame::jumbleRun() {
}
this->var_i16_68a = 0;
do {
- int ticks = (int)g_toolbox->TickCount();
+ int ticks = (int)_toolbox->TickCount();
this->var_i16_68a++;
- g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[this->var_i16_68a]]);
+ _toolbox->InvertRect(_screenGrid[this->arr_i16_4338[this->var_i16_68a]]);
// mask was originally 0
this->getNextEvent(-1);
- int delta = MAX(0, this->var_i16_7e4*60/1000 - ((int)g_toolbox->TickCount() - ticks));
- g_toolbox->Delay(delta);
+ int delta = MAX(0, this->var_i16_7e4*60/1000 - ((int)_toolbox->TickCount() - ticks));
+ _toolbox->Delay(delta);
} while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((_event.modifiers & kModMouseButtonUp) == 0)));
} else {
// 130:0b62
@@ -365,8 +365,8 @@ void FoolGame::jumbleRun() {
this->var_i16_bfc = 0;
do {
for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
- g_toolbox->Delay(0xd*60/1000);
- g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
+ _toolbox->Delay(0xd*60/1000);
+ _toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
this->getNextEvent(0);
if ((_event.modifiers & kModMouseButtonUp) == 0) {
_activePuzzleSolved = true;
@@ -566,7 +566,7 @@ void FoolGame::jumbleRunHiddenMessage() {
this->var_i16_7b2 = 0;
_stateFlags = kStateNull;
_keyLastPressed = 0;
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
// 130:12cc
this->getNextEvent(-1);
@@ -585,9 +585,9 @@ void FoolGame::jumbleRunHiddenMessage() {
// 130:139e
if (this->var_i16_187c != this->var_i16_7b2) {
if (this->var_i16_187c < 0x11) {
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
} else {
- g_toolbox->SetCursor(_cursors[this->var_i16_187c]);
+ _toolbox->SetCursor(_cursors[this->var_i16_187c]);
}
// 130:13dc
this->var_i16_7b2 = this->var_i16_187c;
@@ -600,7 +600,7 @@ void FoolGame::jumbleRunHiddenMessage() {
}
// 130:141e
this->jumbleSelectSquare();
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
}
void FoolGame::sub_130_1426() {
@@ -724,7 +724,7 @@ void FoolGame::sub_130_172c() {
this->sub_130_19ac();
this->var_i16_187e = ABS(this->arr_i16_3738[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]]);
this->var_i16_1884 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
- g_toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
+ _toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
this->sub_130_2178();
return;
}
@@ -735,7 +735,7 @@ void FoolGame::sub_130_172c() {
return;
}
// 130:189a
- g_toolbox->InvertRect(_screenGrid[this->var_i16_1880]);
+ _toolbox->InvertRect(_screenGrid[this->var_i16_1880]);
this->var_i16_1886 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
this->var_str_1374 = _zbasic->midStr(this->var_str_1070, this->var_i16_1884, 1);
this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
@@ -759,7 +759,7 @@ void FoolGame::sub_130_19ac() {
warning(__func__);
// 130:19ac
if (this->var_i16_187e > 0) {
- g_toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
+ _toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
}
this->var_i16_187e = 0;
this->var_i16_1880 = 0;
@@ -772,7 +772,7 @@ void FoolGame::jumbleClickFixedSquare() {
this->sub_130_19ac();
this->playTone(0x19, 0x64, 0);
for (int i = 0; i <= 0x19; i++) {
- g_toolbox->InvertRect(_screenGrid[13]);
+ _toolbox->InvertRect(_screenGrid[13]);
this->delay(1);
}
}
@@ -831,21 +831,21 @@ void FoolGame::sub_130_1c1a() {
warning(__func__);
// 130:1c1a
this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
- g_toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
+ _toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
}
void FoolGame::jumbleSelectSquare() {
warning(__func__);
// 130:1c52
- g_toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
+ _toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
}
void FoolGame::sub_130_1c6c() {
warning(__func__);
- g_toolbox->PenNormal();
- g_toolbox->FillRect(_screenGrid[this->_jumbleSelected], _patterns[this->var_i16_105e]);
- g_toolbox->PenPat(_patterns[this->var_i16_105c]);
- g_toolbox->FrameRect(_screenGrid[this->_jumbleSelected]);
+ _toolbox->PenNormal();
+ _toolbox->FillRect(_screenGrid[this->_jumbleSelected], _patterns[this->var_i16_105e]);
+ _toolbox->PenPat(_patterns[this->var_i16_105c]);
+ _toolbox->FrameRect(_screenGrid[this->_jumbleSelected]);
if (this->arr_i16_3738[this->_jumblePosition] >= 0) {
return;
}
@@ -862,25 +862,25 @@ void FoolGame::sub_130_1c6c() {
temp.left = this->arr_i16_4758[1];
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
}
void FoolGame::jumbleDrawLetter() {
warning(__func__);
// 130:1dcc
_zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[this->_jumbleSelected].left + this->arr_i16_1eb8[2],
_screenGrid[this->_jumbleSelected].top + this->arr_i16_1eb8[3]
);
- g_toolbox->DrawString(this->var_str_d12);
+ _toolbox->DrawString(this->var_str_d12);
}
void FoolGame::sub_130_1e5c() {
warning(__func__);
// 130:1e5c
- g_toolbox->PenNormal();
- g_toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
+ _toolbox->PenNormal();
+ _toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
this->sub_130_1e76();
}
@@ -896,21 +896,21 @@ void FoolGame::sub_130_1e76() {
temp.left = this->arr_i16_4758[1];
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
- g_toolbox->FillRect(temp, _patterns[this->var_i16_105e]);
+ _toolbox->FillRect(temp, _patterns[this->var_i16_105e]);
_zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
// 130:1f70
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[this->_jumbleSelected].left + this->arr_i16_1eb8[2],
_screenGrid[this->_jumbleSelected].top + this->arr_i16_1eb8[3]
);
- g_toolbox->DrawString(this->var_str_d12);
+ _toolbox->DrawString(this->var_str_d12);
if (this->arr_i16_3738[this->_jumblePosition] < 0)
return;
// 130:1ff4
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PenMode(kPatBic);
- g_toolbox->PaintRect(temp);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PenMode(kPatBic);
+ _toolbox->PaintRect(temp);
}
void FoolGame::sub_130_201a() {
@@ -1012,9 +1012,9 @@ void FoolGame::sub_130_2226() {
return;
// 130:22a0
_zbasic->text(kFontFool, 0xc, 0, kSrcOr);
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_1578);
- g_toolbox->MoveTo(0x127 - (this->var_i16_484 / 2), 0x133);
- g_toolbox->DrawString(this->var_str_1578);
+ this->var_i16_484 = _toolbox->StringWidth(this->var_str_1578);
+ _toolbox->MoveTo(0x127 - (this->var_i16_484 / 2), 0x133);
+ _toolbox->DrawString(this->var_str_1578);
}
void FoolGame::sub_130_22ee() {
@@ -1024,10 +1024,10 @@ void FoolGame::sub_130_22ee() {
if (this->var_str_1578.empty()) // was: str(187)
return;
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x13c, 0xf6 - (this->var_i16_7ba / 2), 0x150, 0x10a + (this->var_i16_7ba / 2), 2);
- g_toolbox->MoveTo(0x100 - (this->var_i16_7ba / 2), 0x14a);
- g_toolbox->DrawString(this->var_str_1578);
+ _toolbox->MoveTo(0x100 - (this->var_i16_7ba / 2), 0x14a);
+ _toolbox->DrawString(this->var_str_1578);
}
void FoolGame::sub_130_23cc() {
@@ -1037,10 +1037,10 @@ void FoolGame::sub_130_23cc() {
if (this->var_str_1578.empty()) // was: str(188)
return;
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x130, 0x100 - (this->var_i16_7ba / 2), 0x144, 0x114 + (this->var_i16_7ba / 2), 2);
- g_toolbox->MoveTo(0x10a - (this->var_i16_7ba / 2), 0x13e);
- g_toolbox->DrawString(this->var_str_1578);
+ _toolbox->MoveTo(0x10a - (this->var_i16_7ba / 2), 0x13e);
+ _toolbox->DrawString(this->var_str_1578);
}
void FoolGame::sub_130_24aa() {
@@ -1050,9 +1050,9 @@ void FoolGame::sub_130_24aa() {
if (this->var_str_1578.empty()) // was: str(189)
return;
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
- g_toolbox->MoveTo(0xc4 - (this->var_i16_7ba / 2), 0x131);
- g_toolbox->DrawString(this->var_str_1578);
+ this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
+ _toolbox->MoveTo(0xc4 - (this->var_i16_7ba / 2), 0x131);
+ _toolbox->DrawString(this->var_str_1578);
}
void FoolGame::sub_130_2548() {
@@ -1063,10 +1063,10 @@ void FoolGame::sub_130_2548() {
if (this->var_str_1578.empty()) // was: str(190)
return;
- this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_1578);
+ this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
this->fillRect(0x13e, 0xc, 0x14e, 0x16 + this->var_i16_7ba, 0);
- g_toolbox->MoveTo(0x16, 0x14a);
- g_toolbox->DrawString(this->var_str_1578);
+ _toolbox->MoveTo(0x16, 0x14a);
+ _toolbox->DrawString(this->var_str_1578);
}
void FoolGame::sub_130_25d8() {
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index 38ecc1f6df6..02928f9f5db 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetJustice] + (x))
-extern Toolbox *g_toolbox;
+
// justice - lights on
void FoolGame::justiceRun() {
@@ -97,7 +97,7 @@ void FoolGame::sub_142_9be() {
for (int16 i = 0x24; i <= 0x11d; i += 0x32) {
for (int16 j = 0x8c; j <= 0x185; j += 0x32) {
this->var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[this->var_i16_484],
j,
i,
@@ -166,7 +166,7 @@ void FoolGame::justiceOnClick() {
return;
}
// 142:0d56
- g_toolbox->InvertRoundRect(_screenGrid[this->var_i16_103a], 0x1e, 0x1e);
+ _toolbox->InvertRoundRect(_screenGrid[this->var_i16_103a], 0x1e, 0x1e);
if (_zbasic->index(1, this->var_i16_103a + 0x19) == _zbasic->str(OFF(11))) { // bullet
_zbasic->indexSet(_zbasic->str(OFF(12)), 1, this->var_i16_103a + 0x19); // wadjet
}
@@ -228,25 +228,25 @@ void FoolGame::justiceDrawBlock() {
// 142:0f96
this->arr_i16_3738[this->var_i16_484] = 1;
this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->PenNormal();
- g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
- g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
+ _toolbox->PenNormal();
+ _toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
+ _toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->var_str_384 = _zbasic->index(1, this->var_i16_484 + 0x19);
- this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_384);
// 142:1056
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
_screenGrid[this->var_i16_484].top + 0x1e
);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
}
void FoolGame::justiceRemoveBlock() {
// 142:10bc
this->arr_i16_3738[this->var_i16_484] = 0;
this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[_zbasic->rndInt(0x4d)+3]);
+ _toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[_zbasic->rndInt(0x4d)+3]);
}
void FoolGame::justiceStoreState() {
@@ -270,7 +270,7 @@ void FoolGame::justiceResetGrid() {
_activePuzzleBuffer.clear();
for (int16 i = 1; i <= 0x19; i++) {
this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- g_toolbox->FillRect(_screenGrid[i], _patterns[2]);
+ _toolbox->FillRect(_screenGrid[i], _patterns[2]);
}
// 142:126e
this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 696500a6ec8..a7ee9a61d9c 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetMaze] + (x))
-extern Toolbox *g_toolbox;
+
void FoolGame::mazeRun() {
// 136:0004
@@ -43,7 +43,7 @@ void FoolGame::mazeRun() {
var_i16_68a = arr_i16_1eb8[10];
do {
var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[var_i16_484],
var_i16_68a,
var_i16_68c,
@@ -54,7 +54,7 @@ void FoolGame::mazeRun() {
} while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
} while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
if (this->arr_i16_1eb8[20] != 0) {
- var_i32_1ac0 = g_toolbox->GetPicture(arr_i16_1eb8[20]);
+ var_i32_1ac0 = _toolbox->GetPicture(arr_i16_1eb8[20]);
_zbasic->picture(arr_i16_1eb8[18], arr_i16_1eb8[19], var_i32_1ac0);
}
// 136:018c
@@ -86,10 +86,10 @@ void FoolGame::mazeRun() {
playArea.left = _screenGrid[1].left + 3;
playArea.bottom = _screenGrid[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].bottom - 3;
playArea.right = _screenGrid[arr_i16_1eb8[0] * arr_i16_1eb8[1] - 1].right - 3;
- g_toolbox->FillRect(playArea, _patterns[2]);
- g_toolbox->PenNormal();
- g_toolbox->PenSize(5, 5);
- g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
+ _toolbox->FillRect(playArea, _patterns[2]);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
// 136:042c
var_i16_1ac4 = arr_i16_1eb8[17];
var_i16_1574 = 0;
@@ -117,7 +117,7 @@ void FoolGame::mazeRun() {
temp.left = _screenGrid[var_i16_1574].left - 3;
temp.bottom = _screenGrid[var_i16_1574].bottom - 3;
temp.right = SCREEN_WIDTH;
- g_toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FillRect(temp, _patterns[2]);
}
// 136:05d0
}
@@ -237,10 +237,10 @@ void FoolGame::mazeOnClick() {
void FoolGame::mazeFlashWall() {
// 136:0994
- g_toolbox->PenNormal();
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(5, 5);
if (arr_i16_1eb8[21] == 0) {
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(kPatXor);
switch (_mazePlayerDirection-1) {
case 0:
mazeAddWallLeft();
@@ -258,10 +258,10 @@ void FoolGame::mazeFlashWall() {
warning("mazeFlashWall: breaking out of switch");
break;
}
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
} else {
// 136:09de
- g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
}
// 136:0a00
switch (_mazePlayerDirection-1) {
@@ -281,15 +281,15 @@ void FoolGame::mazeFlashWall() {
warning("mazeFlashWall: breaking out of switch");
break;
}
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
void FoolGame::mazeMovePlayer() {
// 136:0a22
if (var_i16_1bd6 != 0) {
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->PenSize(5, 5);
switch (var_i16_1bd6 - 1) {
case 0:
mazeDrawWallLeft();
@@ -310,9 +310,9 @@ void FoolGame::mazeMovePlayer() {
}
// 136:0a66
if (var_i16_1bd4 != 0) {
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
+ _toolbox->PenSize(5, 5);
switch (var_i16_1bd4 - 1) {
case 0:
mazeDrawWallLeft();
@@ -341,7 +341,7 @@ void FoolGame::mazeMovePlayer() {
temp.left = arr_i16_1eb8[25];
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
- g_toolbox->InvertOval(temp); // erase current spot
+ _toolbox->InvertOval(temp); // erase current spot
mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
mazeHotspot();
@@ -364,7 +364,7 @@ void FoolGame::sub_136_ade() {
temp.left = arr_i16_1eb8[25];
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
- g_toolbox->InvertOval(temp);
+ _toolbox->InvertOval(temp);
mazeDrawPlayer();
var_i16_1bda = var_i16_1574;
mazeHotspot();
@@ -500,7 +500,7 @@ void FoolGame::mazePrintMessage() {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
if (!var_str_1ce2.empty()) { // was: str(OFF(7))
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- int16 width = g_toolbox->StringWidth(var_str_1ce2);
+ int16 width = _toolbox->StringWidth(var_str_1ce2);
fillRect(0x13b, 0xf1 - (width / 2), 0x14f, 0x10f + (width / 2), 2);
var_i16_7a2 = 0x149;
sub_128_918(var_str_1ce2.decode(Common::kMacRoman));
@@ -562,7 +562,7 @@ void FoolGame::mazeWanderingWinds() {
temp.left = arr_i16_1eb8[25];
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
- g_toolbox->InvertOval(temp);
+ _toolbox->InvertOval(temp);
var_i16_1dea = var_i16_1574;
var_i16_1dec = 2;
mazeMovementTrail();
@@ -616,12 +616,12 @@ void FoolGame::mazeDrawLetter() {
}
// 136:12e4
_zbasic->text(kFontPuzzle, 0xc, 0, var_src_1dee);
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
_screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
);
var_str_384 = _zbasic->chr(var_i16_106e);
- g_toolbox->DrawString(var_str_384);
+ _toolbox->DrawString(var_str_384);
}
void FoolGame::sub_136_137c() {
@@ -714,9 +714,9 @@ void FoolGame::mazeHiddenDoorOpen() {
// 136:1756
var_i16_1bd8 = var_i16_1574;
var_i16_1bd4 = _zbasic->decodeInt(var_str_1ce2);
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->PenSize(5, 5);
switch (var_i16_1bd4-1) {
case 0:
mazeDrawWallLeft();
@@ -740,9 +740,9 @@ void FoolGame::mazeHiddenDoorShut() {
// 136:17a4
var_i16_1bd8 = var_i16_1574;
var_i16_1bd6 = _zbasic->decodeInt(var_str_1ce2);
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
+ _toolbox->PenSize(5, 5);
switch (var_i16_1bd6-1) {
case 0:
mazeDrawWallLeft();
@@ -813,22 +813,22 @@ void FoolGame::mazeFireDemon() {
temp.bottom = arr_i16_4758[2];
temp.right = arr_i16_4758[3];
for (int16 i = 1; i <= var_i16_1de4; i++) {
- g_toolbox->InvertRect(temp);
- g_toolbox->Delay(0);
+ _toolbox->InvertRect(temp);
+ _toolbox->Delay(0);
if (mazeToneFreq > 0) {
mazePlayTone();
}
- g_toolbox->InvertRect(temp);
- g_toolbox->Delay(0);
+ _toolbox->InvertRect(temp);
+ _toolbox->Delay(0);
}
}
void FoolGame::sub_136_19d2() {
warning(__func__);
// 136:19d2
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kPatXor);
- g_toolbox->PenSize(6, 6);
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
+ _toolbox->PenSize(6, 6);
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1de4 = var_i16_1de4 * 2 - 1;
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -845,26 +845,26 @@ void FoolGame::sub_136_19d2() {
// 136:1c32
for (int16 i = 0; i <= var_i16_1de4; i++) {
if (var_i16_1dec == 1) {
- g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1dea]);
}
// 136:1c5a
if (var_i16_1dec == 2) {
- g_toolbox->InvertOval(_screenGrid[var_i16_1dea]);
+ _toolbox->InvertOval(_screenGrid[var_i16_1dea]);
}
- g_toolbox->MoveTo(var_i16_1df8, var_i16_1dfa);
- g_toolbox->LineTo(var_i16_1dfc, var_i16_1dfe);
+ _toolbox->MoveTo(var_i16_1df8, var_i16_1dfa);
+ _toolbox->LineTo(var_i16_1dfc, var_i16_1dfe);
if (var_i16_1df6 == 1) {
- g_toolbox->InvertRect(_screenGrid[var_i16_1de8]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1de8]);
}
// 136:1cb2
if (var_i16_1df6 == 2) {
- g_toolbox->InvertOval(_screenGrid[var_i16_1de8]);
+ _toolbox->InvertOval(_screenGrid[var_i16_1de8]);
}
if (mazeToneFreq > 0) {
mazePlayTone();
}
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
@@ -881,16 +881,16 @@ void FoolGame::mazeNoisySprite() {
mazePlayTone();
}
if (var_i16_1dec == 1) {
- g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
- g_toolbox->Delay(0);
- g_toolbox->InvertRect(_screenGrid[var_i16_1dea]);
- g_toolbox->Delay(0);
+ _toolbox->InvertRect(_screenGrid[var_i16_1dea]);
+ _toolbox->Delay(0);
+ _toolbox->InvertRect(_screenGrid[var_i16_1dea]);
+ _toolbox->Delay(0);
} else {
// 136:1d98
- g_toolbox->InvertOval(_screenGrid[var_i16_1dea]);
- g_toolbox->Delay(0);
- g_toolbox->InvertOval(_screenGrid[var_i16_1dea]);
- g_toolbox->Delay(0);
+ _toolbox->InvertOval(_screenGrid[var_i16_1dea]);
+ _toolbox->Delay(0);
+ _toolbox->InvertOval(_screenGrid[var_i16_1dea]);
+ _toolbox->Delay(0);
}
// 136:1dc8
}
@@ -900,7 +900,7 @@ void FoolGame::mazeDelay() {
warning(__func__);
// 136:1ddc
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
- g_toolbox->Delay(var_i16_484*60/1000);
+ _toolbox->Delay(var_i16_484*60/1000);
}
void FoolGame::mazeYeetObject() {
@@ -919,9 +919,9 @@ void FoolGame::mazeThornsGetScroll() {
var_i16_1dec = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
var_i16_1e00 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 5, 2));
mazeLoadTone(7);
- g_toolbox->PenNormal();
- g_toolbox->PenSize(4, 4);
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(4, 4);
+ _toolbox->PenMode(kPatXor);
// 136:1eb0
if (var_i16_1e00 == 1) {
arr_i16_4758[0] = 0x14;
@@ -978,17 +978,17 @@ void FoolGame::mazeThornsGetScroll() {
temp.bottom = arr_i16_4758[2];
temp.right = arr_i16_4758[3];
if (var_i16_1dec == 1) {
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
}
// 136:21b8
if (var_i16_1dec == 2) {
- g_toolbox->FrameOval(temp);
+ _toolbox->FrameOval(temp);
}
// 136:21d0
if (mazeToneFreq > 0) {
mazePlayTone();
}
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
}
@@ -1020,7 +1020,7 @@ void FoolGame::mazeMovementTrail() {
arr_bcd_5dbc[2] = _screenGrid[var_i16_1dea].bottom - 4.0f;
arr_bcd_5dbc[3] = _screenGrid[var_i16_1dea].right - 4.0f;
for (int16 j = 1; j <= 0x19; j++) {
- var_i32_692 = g_toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
for (int16 i = 0; i <= 3; i++) {
// 136:23c4
arr_bcd_5dbc[i] += arr_bcd_5dbc[i + 4];
@@ -1034,11 +1034,11 @@ void FoolGame::mazeMovementTrail() {
temp.right = arr_i16_4758[3];
if (var_i16_1dec == 1) {
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
// 136:2472
if (var_i16_1dec == 2) {
- g_toolbox->InvertOval(temp);
+ _toolbox->InvertOval(temp);
}
sub_128_406(0);
}
@@ -1096,13 +1096,13 @@ void FoolGame::mazeDrawPlayer() {
temp.left = arr_i16_1eb8[25];
temp.bottom = arr_i16_1eb8[26];
temp.right = arr_i16_1eb8[27];
- g_toolbox->InvertOval(temp); // draw new player pos
+ _toolbox->InvertOval(temp); // draw new player pos
}
void FoolGame::mazeSetupMenu() {
- this->var_menu_bf8 = g_toolbox->GetMHandle(8);
- g_toolbox->DeleteMenu(8);
- g_toolbox->DisposeMenu(this->var_menu_bf8);
+ this->var_menu_bf8 = _toolbox->GetMHandle(8);
+ _toolbox->DeleteMenu(8);
+ _toolbox->DisposeMenu(this->var_menu_bf8);
// 136:274e
_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
@@ -1159,11 +1159,11 @@ void FoolGame::mazeAddWallLeft() {
warning(__func__);
// 136:2a7c
arr_i16_3738[var_i16_1574] |= 0x100;
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1574].left - 2,
_screenGrid[var_i16_1574].top - 2
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1574].left - 2,
_screenGrid[var_i16_1574].bottom - 3
);
@@ -1173,11 +1173,11 @@ void FoolGame::mazeAddWallTop() {
warning(__func__);
// 136:2b30
arr_i16_3738[var_i16_1574] |= 0x200;
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1574].left - 2,
_screenGrid[var_i16_1574].top - 2
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1574].right - 3,
_screenGrid[var_i16_1574].top - 2
);
@@ -1187,11 +1187,11 @@ void FoolGame::mazeAddWallRight() {
warning(__func__);
// 136:2be2
arr_i16_3738[var_i16_1574] |= 0x400;
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1574].right - 3,
_screenGrid[var_i16_1574].top - 2
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1574].right - 3,
_screenGrid[var_i16_1574].bottom - 3
);
@@ -1201,11 +1201,11 @@ void FoolGame::mazeAddWallBottom() {
warning(__func__);
// 136:2c96
arr_i16_3738[var_i16_1574] |= 0x800;
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1574].left - 2,
_screenGrid[var_i16_1574].bottom - 3
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1574].right - 3,
_screenGrid[var_i16_1574].bottom - 3
);
@@ -1214,11 +1214,11 @@ void FoolGame::mazeAddWallBottom() {
void FoolGame::mazeDrawWallLeft() {
warning(__func__);
// 136:2d4c
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left - 2,
_screenGrid[var_i16_1bd8].top + 3
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1bd8].left - 2,
_screenGrid[var_i16_1bd8].bottom - 8
);
@@ -1227,11 +1227,11 @@ void FoolGame::mazeDrawWallLeft() {
void FoolGame::mazeDrawWallTop() {
warning(__func__);
// 136:2dd0
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left + 3,
_screenGrid[var_i16_1bd8].top - 2
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1bd8].right - 8,
_screenGrid[var_i16_1bd8].top - 2
);
@@ -1240,11 +1240,11 @@ void FoolGame::mazeDrawWallTop() {
void FoolGame::mazeDrawWallRight() {
warning(__func__);
// 136:2e52
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1bd8].right - 3,
_screenGrid[var_i16_1bd8].top + 3
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1bd8].right - 3,
_screenGrid[var_i16_1bd8].bottom - 8
);
@@ -1253,11 +1253,11 @@ void FoolGame::mazeDrawWallRight() {
void FoolGame::mazeDrawWallBottom() {
warning(__func__);
// 136:2ed6
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left + 3,
_screenGrid[var_i16_1bd8].bottom - 3
);
- g_toolbox->LineTo(
+ _toolbox->LineTo(
_screenGrid[var_i16_1bd8].right - 8,
_screenGrid[var_i16_1bd8].bottom - 3
);
@@ -1377,9 +1377,9 @@ void FoolGame::mazeLoadState() {
var_i16_1bd8 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 0xb, 2));
if (var_i16_1bd6 > 0) {
// 136:3500
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
+ _toolbox->PenSize(5, 5);
switch (var_i16_1bd6 - 1) {
case 0:
mazeDrawWallLeft();
@@ -1400,9 +1400,9 @@ void FoolGame::mazeLoadState() {
}
// 136:354e
if (var_i16_1bd4 > 0) {
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[2]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[2]);
+ _toolbox->PenSize(5, 5);
switch (var_i16_1bd4 - 1) {
case 0:
mazeDrawWallLeft();
@@ -1438,14 +1438,14 @@ void FoolGame::mazeLoadState() {
var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
// 136:366e
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1dea].left + arr_i16_1eb8[2],
_screenGrid[var_i16_1dea].top + arr_i16_1eb8[3]
);
_zbasic->unk_8();
// the one place that used ZBasic's print API,
// easier to cut out the middleman and use DrawString
- g_toolbox->DrawString(_zbasic->chr(var_i16_106e));
+ _toolbox->DrawString(_zbasic->chr(var_i16_106e));
//_zbasic->print(_zbasic->chr(var_i16_106e));
//_zbasic->printNewline();
arr_i16_4338[var_i16_1dea] = var_i16_106e;
@@ -1453,9 +1453,9 @@ void FoolGame::mazeLoadState() {
}
// 136:3710
// draw walls that are added by the visibility mask
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[17]]);
+ _toolbox->PenSize(5, 5);
var_i16_1574 = 0;
var_i16_1de6 = 0;
var_i16_1f08 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
@@ -1537,12 +1537,12 @@ void FoolGame::sub_136_3a70() {
var_i16_484 = 1 + (arr_i16_1eb8[24] - 0x14) / 0x23;
var_i16_7e4 = 1 + (arr_i16_1eb8[25]) / 0x23;
var_i16_9f2 = 1 + (SCREEN_HEIGHT - arr_i16_1eb8[26]) / 0x23;
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
// 136:3b0e
for (int16 j = 0; j <= 1; j++) {
if (j == 1) {
- g_toolbox->PenMode(kNotPatOr);
- g_toolbox->PenPat(_patterns[1]);
+ _toolbox->PenMode(kNotPatOr);
+ _toolbox->PenPat(_patterns[1]);
}
// 136:3b32
for (int16 i = 4; i <= 7; i++) {
@@ -1564,13 +1564,13 @@ void FoolGame::sub_136_3a70() {
}
if (j == 0) {
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
} else {
// 136:3c48
- g_toolbox->PaintRect(temp);
+ _toolbox->PaintRect(temp);
}
// 136:3c56
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
// 136:3c64
}
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 9b486879780..8a3968d5fa1 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -30,7 +30,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetMetapuzzle] + (x))
-extern Toolbox *g_toolbox;
+
// sun's map metapuzzle
void FoolGame::metapuzzleRun() {
@@ -54,8 +54,8 @@ void FoolGame::metapuzzleRun() {
}
}
// 138:00f6
- g_toolbox->PenNormal();
- g_toolbox->InitCursor();
+ _toolbox->PenNormal();
+ _toolbox->InitCursor();
copyScreen(0, arr_bmp_b3ec);
if (_activePuzzle == 0) {
metapuzzleSetupMenu();
@@ -89,10 +89,10 @@ void FoolGame::metapuzzleRun() {
// 138:0e7c
var_i16_c00 = 0;
if ((_stateFlags & kStateMetapuzzleComplete) == 0) {
- var_menu_bf8 = g_toolbox->GetMHandle(8);
- g_toolbox->DeleteMenu(8);
- g_toolbox->DisposeMenu(var_menu_bf8);
- g_toolbox->DrawMenuBar();
+ var_menu_bf8 = _toolbox->GetMHandle(8);
+ _toolbox->DeleteMenu(8);
+ _toolbox->DisposeMenu(var_menu_bf8);
+ _toolbox->DrawMenuBar();
copyScreen(1, arr_bmp_5dfc);
if ((_stateFlags & (kStateNewGame | kStateOpenGame | kStateQuit)) == 0) {
if ((var_i16_7ce & 1) != 0) {
@@ -120,7 +120,7 @@ void FoolGame::metapuzzleOnClick() {
temp.left = arr_i16_4d20[i*4+1];
temp.bottom = arr_i16_4d20[i*4+2];
temp.right = arr_i16_4d20[i*4+3];
- if (g_toolbox->PtInRect(_event.where, temp) != 0) {
+ if (_toolbox->PtInRect(_event.where, temp) != 0) {
var_i16_7e4 = i;
}
// 138:01f8
@@ -138,7 +138,7 @@ void FoolGame::sub_138_21e() {
temp.left = arr_i16_4d20[offset*4+1];
temp.bottom = arr_i16_4d20[offset*4+2];
temp.right = arr_i16_4d20[offset*4+3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
puzzleLoadContext();
puzzleSetupMenu();
sub_128_26f6();
@@ -174,7 +174,7 @@ void FoolGame::sub_138_21e() {
_stateFlags = kStateNull;
_activePuzzle = 0;
var_i16_c00 = 0;
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
copyScreen(1, arr_bmp_b3ec);
metapuzzleSetupMenu();
}
@@ -245,7 +245,7 @@ void FoolGame::metapuzzleSecretCode() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FillRect(temp, _patterns[2]);
if (_activePuzzleBuffer.empty()) { // was: str(OFF(11))
metapuzzleSecretCodeReset();
} else {
@@ -311,8 +311,8 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
// 138:0946
var_str_d12 = _zbasic->midStr(_metapuzzleSecretCodeCipher, _keyLastPressed - 0x40, 1);
var_str_1272 += var_str_d12;
- var_i16_484 = g_toolbox->StringWidth(var_str_1272);
- var_i16_7e4 = g_toolbox->StringWidth(var_str_1170);
+ var_i16_484 = _toolbox->StringWidth(var_str_1272);
+ var_i16_7e4 = _toolbox->StringWidth(var_str_1170);
if (var_i16_484 > var_i16_7e4) {
sub_138_a06();
} else {
@@ -328,7 +328,7 @@ void FoolGame::sub_138_9c4() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FillRect(temp, _patterns[2]);
var_i16_7a2 = 0x146;
sub_128_918(var_str_1272);
}
@@ -348,7 +348,7 @@ void FoolGame::metapuzzleSecretCodeReset() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FillRect(temp, _patterns[2]);
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
var_i16_7a2 = 0x140;
var_str_384 = _zbasic->str(OFF(15)); // if you know which is which, enter the letters you wish to switch
@@ -377,9 +377,9 @@ void FoolGame::metapuzzleOnOption() {
temp.left = arr_i16_4d20[var_i16_bfc*4+1];
temp.bottom = arr_i16_4d20[var_i16_bfc*4+2];
temp.right = arr_i16_4d20[var_i16_bfc*4+3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
delay(3);
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
void FoolGame::metapuzzleOnShift() {
@@ -403,7 +403,7 @@ void FoolGame::metapuzzleOnShift() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
// 138:0c8c
arr_i16_1eb8[0] = 0x1a + var_i16_68c * 0x23;
@@ -415,10 +415,10 @@ void FoolGame::metapuzzleOnShift() {
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
// 138:0d36
- g_toolbox->SetPort(var_i32_8);
+ _toolbox->SetPort(var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
if (_selectedMenuChapter != 0x51) {
var_str_384 = _puzzleName[_selectedMenuChapter];
@@ -428,11 +428,11 @@ void FoolGame::metapuzzleOnShift() {
}
// 138:0d9e
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
- var_i16_30 = g_toolbox->StringWidth(var_str_384);
- g_toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
- g_toolbox->DrawString(var_str_384);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(var_i32_0);
+ var_i16_30 = _toolbox->StringWidth(var_str_384);
+ _toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
+ _toolbox->DrawString(var_str_384);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(var_i32_0);
var_i16_200e = _selectedMenuChapter;
}
// 138:0dfc
@@ -454,17 +454,17 @@ void FoolGame::metapuzzleOnShift() {
}
// 138:0e50
if (var_i16_200e > 0) {
- g_toolbox->DrawMenuBar();
+ _toolbox->DrawMenuBar();
Common::Rect temp;
temp.top = arr_i16_1eb8[0];
temp.left = arr_i16_1eb8[1];
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
var_i16_200e = 0;
}
// 138:0e70
- g_toolbox->SetPort(var_i32_0);
+ _toolbox->SetPort(var_i32_0);
sub_128_61ec();
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 5c8b0db3416..0d15fbf5762 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetPolyomino] + (x))
-extern Toolbox *g_toolbox;
+
// polyomino puzzle
void FoolGame::polyominoRun() {
@@ -51,7 +51,7 @@ void FoolGame::polyominoRun() {
do {
// 133:00b2
this->var_i16_484 += 1;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
@@ -87,7 +87,7 @@ void FoolGame::polyominoRun() {
this->arr_i16_1eb8[i] = puzzlesReadShort();
}
// 133:0228
- g_toolbox->SetPort(this->var_i32_f24);
+ _toolbox->SetPort(this->var_i32_f24);
_zbasic->text(kFontPuzzle, 0x18, Graphics::kMacFontRegular, kSrcOr);
// for each polyomino
@@ -137,12 +137,12 @@ void FoolGame::polyominoRun() {
// 133:0388
// create polyomino polygons from coordinates
- PolyHandle poly = g_toolbox->OpenPoly(); // var_poly_1aac
- g_toolbox->MoveTo(this->arr_i16_4338[1], this->arr_i16_4338[0]);
+ PolyHandle poly = _toolbox->OpenPoly(); // var_poly_1aac
+ _toolbox->MoveTo(this->arr_i16_4338[1], this->arr_i16_4338[0]);
for (int i = 2; i <= this->var_i16_103a; i += 2) {
- g_toolbox->LineTo(this->arr_i16_4338[i+1], this->arr_i16_4338[i]);
+ _toolbox->LineTo(this->arr_i16_4338[i+1], this->arr_i16_4338[i]);
}
- g_toolbox->ClosePoly();
+ _toolbox->ClosePoly();
// 133:0408
// load in letter placement information
@@ -155,63 +155,63 @@ void FoolGame::polyominoRun() {
// 133:044a
this->arr_i16_1eb8[0x1a] = puzzlesReadShort(); // polygon fill pattern index
this->arr_i16_1eb8[0x1b] = puzzlesReadShort(); // text source mode
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
// 133:0476: JSR - "PICTURE_ON"
// picture handle 0: XOR text + polyomino
- PicHandle handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- g_toolbox->PenMode(kPatXor);
+ PicHandle handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ _toolbox->PenMode(kPatXor);
if (this->var_i16_103a >= 3) {
- g_toolbox->TextMode(kSrcXor);
+ _toolbox->TextMode(kSrcXor);
for (int i = 1; i <= this->var_i16_103a; i += 3) {
- g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
+ _toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
this->var_str_384 = _zbasic->chr(this->arr_i16_3738[i+2]);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
}
}
// 133:050a
- g_toolbox->InvertPoly(poly);
- g_toolbox->ClosePicture();
+ _toolbox->InvertPoly(poly);
+ _toolbox->ClosePicture();
this->_polyominoPics[j*4] = handle;
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
// 133:0530: JSR - "PICTURE_ON"
// picture handle 1:
- handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- g_toolbox->FillPoly(poly, _patterns[this->arr_i16_1eb8[0x1a]]);
- g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
- g_toolbox->FramePoly(poly);
+ handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ _toolbox->FillPoly(poly, _patterns[this->arr_i16_1eb8[0x1a]]);
+ _toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
+ _toolbox->FramePoly(poly);
// 133:0582
if (this->var_i16_103a >= 3) {
- g_toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
+ _toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
for (int i = 1; i <= this->var_i16_103a; i += 3) {
- g_toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
+ _toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
this->var_str_384 = _zbasic->chr(this->arr_i16_3738[i+2]);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
}
}
// 133:061a
- g_toolbox->FramePoly(poly);
- g_toolbox->ClosePicture();
+ _toolbox->FramePoly(poly);
+ _toolbox->ClosePicture();
// 133:0622
this->_polyominoPics[j*4 + 1] = handle;
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
// 133:0642: JSR - "PICTURE_ON"
// picture handle 2: draw the shape without letters
- handle = g_toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
- g_toolbox->FramePoly(poly);
- g_toolbox->PaintPoly(poly);
- g_toolbox->ClosePicture();
+ handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ _toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
+ _toolbox->FramePoly(poly);
+ _toolbox->PaintPoly(poly);
+ _toolbox->ClosePicture();
this->_polyominoPics[j*4 + 2] = handle;
// clear polygon data
- g_toolbox->KillPoly(poly);
+ _toolbox->KillPoly(poly);
// 133:0698
}
// 133:06b4
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
this->var_i16_484 = 0;
for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
@@ -259,7 +259,7 @@ void FoolGame::polyominoRun() {
// exiting game, delete picture handles
for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
for (int i = 0; i <= 2; i++) {
- g_toolbox->KillPicture(this->_polyominoPics[j*4 + i]);
+ _toolbox->KillPicture(this->_polyominoPics[j*4 + i]);
}
}
}
@@ -445,7 +445,7 @@ void FoolGame::polyominoOnClickFixed() {
debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", posX, posY);
for (int i = 0; i <= 9; i++) {
_zbasic->picture(posX, posY, this->_polyominoPics[this->var_i16_7cc*4]);
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
// 133:11c2
this->polyominoDrawFrame();
@@ -477,15 +477,15 @@ void FoolGame::polyominoReset() {
void FoolGame::polyominoDrawFrame() {
// 133:12d4
- g_toolbox->PenNormal();
- g_toolbox->PenSize(3, 3);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(3, 3);
Common::Rect temp;
temp.top = this->arr_i16_1eb8[0x12];
temp.left = this->arr_i16_1eb8[0x13];
temp.bottom = this->arr_i16_1eb8[0x14];
temp.right = this->arr_i16_1eb8[0x15];
- g_toolbox->FrameRect(temp);
- g_toolbox->PenNormal();
+ _toolbox->FrameRect(temp);
+ _toolbox->PenNormal();
}
void FoolGame::polyominoCheckIfSolved() {
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 0142a697145..16071977218 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -31,7 +31,7 @@
namespace Fool {
-extern Toolbox *g_toolbox;
+
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
@@ -40,10 +40,14 @@ extern Toolbox *g_toolbox;
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
void FoolPrologue::run() {
- _zbasic = new ZBasic(g_toolbox);
+ _toolbox = new Toolbox();
+ _zbasic = new ZBasic(_toolbox);
_zbasic->loadProgram(Common::Path("Prologue - Finale"));
- this->sub_128_004(true);
+ this->sub_128_004(false);
delete _zbasic;
+ _zbasic = nullptr;
+ delete _toolbox;
+ _toolbox = nullptr;
}
void FoolPrologue::sub_128_004(bool finale) {
@@ -51,18 +55,25 @@ void FoolPrologue::sub_128_004(bool finale) {
// 128:0004
_zbasic->coordinateWindow();
- g_toolbox->ClearMenuBar();
- g_toolbox->HideCursor();
- g_toolbox->UseResFile(g_toolbox->CurResFile());
+ _toolbox->ClearMenuBar();
+ _toolbox->HideCursor();
+ _toolbox->UseResFile(_toolbox->CurResFile());
// 128:001e
// b54 must be the 1-bit screen buffer
// 41296 is an array of pointers to screen pages within the buffer
+ for (int i = 0; i < 16; i++) {
+ this->arr_i32_1e3fc[i] = BitMap(new Graphics::ManagedSurface());
+ this->arr_i32_1e3fc[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ }
for (int i = 0; i < 12; i++) {
//this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
this->arr_i32_41296[i] = BitMap(new Graphics::ManagedSurface());
this->arr_i32_41296[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
+ this->arr_i32_3bca4 = BitMap(new Graphics::ManagedSurface());
+ this->arr_i32_3bca4->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+
// 128:0066
this->var_i32_4e = this->arr_i32_41296[11];
// 128:0078
@@ -79,11 +90,8 @@ void FoolPrologue::sub_128_004(bool finale) {
// 128:017a
// about message
this->var_str_76 = _zbasic->str(0);
- _zbasic->bufferFlush(this->var_str_76);
this->var_str_76 = _zbasic->str(1);
- _zbasic->bufferFlush(this->var_str_76);
this->var_str_76 = _zbasic->str(2);
- _zbasic->bufferFlush(this->var_str_76);
// 128:01b6
// JMP 0x1f0
@@ -118,72 +126,73 @@ void FoolPrologue::sub_128_004(bool finale) {
}
// 128:0cc8
//_zbasic->unk4(); // exit command?
+ _toolbox->ShowCursor();
}
void FoolPrologue::sub_128_1ba(int16 screenPage) {
// 128:01ba
this->var_i32_40 = this->arr_i32_41296[screenPage];
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::setPortBitsToPage(int16 screenPage) {
// 128:01f4
this->var_i32_40 = this->arr_i32_41296[screenPage];
- g_toolbox->SetPortBits(this->var_i32_40);
+ _toolbox->SetPortBits(this->var_i32_40);
}
void FoolPrologue::delay(int16 numTicks) {
// 128:021e
// original code would poll TickCount in a loop,
// effectively the same as Delay
- g_toolbox->Delay(numTicks);
+ _toolbox->Delay(numTicks);
}
void FoolPrologue::delayFromMarker(int16 numTicks) {
// 128:024a
- uint32 delay = (uint32)MAX<int>(this->var_i32_2 + numTicks + 1 - g_toolbox->TickCount(), 0);
+ uint32 delay = (uint32)MAX<int>(this->var_i32_2 + numTicks + 1 - _toolbox->TickCount(), 0);
// again, polling TickCount in a loop.
- g_toolbox->Delay(delay);
+ _toolbox->Delay(delay);
}
-void FoolPrologue::drawTextRightAlign(int16 y, int16 x) {
+void FoolPrologue::drawTextRightAlign(int16 x, int16 y) {
// 128:026c
- this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
- g_toolbox->MoveTo(x - this->var_i32_182, y);
- g_toolbox->DrawString(this->var_str_76);
+ this->var_i32_182 = _toolbox->StringWidth(this->var_str_76);
+ _toolbox->MoveTo(x - this->var_i32_182, y);
+ _toolbox->DrawString(this->var_str_76);
}
-void FoolPrologue::drawTextCenterAlign(int16 y, int16 x) {
+void FoolPrologue::drawTextCenterAlign(int16 x, int16 y) {
// 128:02a6
- this->var_i32_182 = g_toolbox->StringWidth(this->var_str_76);
- g_toolbox->MoveTo(x - (this->var_i32_182 / 2), y);
- g_toolbox->DrawString(this->var_str_76);
+ this->var_i32_182 = _toolbox->StringWidth(this->var_str_76);
+ _toolbox->MoveTo(x - (this->var_i32_182 / 2), y);
+ _toolbox->DrawString(this->var_str_76);
}
void FoolPrologue::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:02f0
- g_toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
- g_toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[patternID]);
+ _toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
+ _toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[patternID]);
}
-void FoolPrologue::sub_128_354(PatternMode mode, uint16 unk2) {
+void FoolPrologue::zoomClose(int16 patternID, PatternMode mode) {
// 128:0354
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenPat(this->arr_pat_194[unk2]);
- g_toolbox->PenMode(mode);
- g_toolbox->PenSize(6, 4);
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->PenPat(this->arr_pat_194[patternID]);
+ _toolbox->PenMode(mode);
+ _toolbox->PenSize(6, 4);
for (int i = 0; i <= 130; i += 3) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
- g_toolbox->FrameRect(this->arr_i16_1bc);
- g_toolbox->InsetRect(this->arr_i16_1bc, 6, 4);
+ _toolbox->FrameRect(this->arr_i16_1bc);
+ _toolbox->InsetRect(this->arr_i16_1bc, 6, 4);
this->delayFromMarker(1);
}
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
-void FoolPrologue::sub_128_3ee(int16 unk1) {
+void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
// 128:03ee
this->var_i16_18c = 0x5;
if (this->var_i16_18e > 0x28) {
@@ -196,15 +205,15 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
this->var_i16_18c = 0xe;
}
// 128:0428
- for (int i = 1; i <= this->var_i16_18e + 1; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->MoveTo(
- unk1 - this->arr_i16_1e8[i],
- unk1 - this->arr_i16_1e8[i + 0x1f6]
+ for (int i = 1; i <= this->var_i16_18e; i++) {
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->MoveTo(
+ this->arr_i16_1e8[i] - unk1,
+ this->arr_i16_1e8[i + 0x1f6] - unk1
);
- g_toolbox->LineTo(
- unk1 + this->arr_i16_1e8[i + 0xfb],
- unk1 - this->arr_i16_1e8[i + 0x1f6]
+ _toolbox->LineTo(
+ this->arr_i16_1e8[i + 0xfb] + unk1,
+ this->arr_i16_1e8[i + 0x1f6] - unk1
);
if (i % this->var_i16_18c == 0) {
this->delayFromMarker(0);
@@ -213,11 +222,11 @@ void FoolPrologue::sub_128_3ee(int16 unk1) {
}
-void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage) {
+void FoolPrologue::sub_128_50a(int16 unk1, int16 left, int16 right, int16 screenPage) {
// 128:050a
this->var_i32_40 = this->arr_i32_41296[screenPage];
- this->var_i16_5c.left = unk2;
- this->var_i16_5c.right = unk3;
+ this->var_i16_5c.left = left;
+ this->var_i16_5c.right = right;
if (unk1 == 0) {
unk1 = 0x14;
}
@@ -232,10 +241,10 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
}
// 128:0584
for (int i = 0; i < SCREEN_HEIGHT; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i16_5c.top = this->arr_i16_412ea[i];
this->var_i16_5c.bottom = this->arr_i16_412ea[i] + 1;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
if (i % unk1 == 0) {
this->delayFromMarker(0);
}
@@ -245,39 +254,39 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenP
void FoolPrologue::blitPageToScreen(int16 screenPage) {
// 128:0610
this->var_i32_40 = this->arr_i32_41296[screenPage];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::scanlineTransition(int16 patternID) {
// 128:064a
- g_toolbox->PenNormal();
- g_toolbox->PenPat(this->arr_pat_194[patternID]);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(this->arr_pat_194[patternID]);
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->MoveTo(0, this->arr_i16_412ea[i]);
- g_toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i]);
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->MoveTo(0, this->arr_i16_412ea[i]);
+ _toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i]);
if (i % 5 == 0) {
this->delayFromMarker(0);
}
}
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
this->var_i32_40 = this->arr_i32_41296[screenPage];
for (int i = 1; i <= 0x36; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
- g_toolbox->Delay(0);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ _toolbox->Delay(0);
}
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
- g_toolbox->Delay(0);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ _toolbox->Delay(0);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
@@ -290,8 +299,8 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_i16_41afc.left = unk4;
this->arr_i16_41afc.bottom = unk3;
this->arr_i16_41afc.right = unk2;
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
// 128:08bc
this->arr_f64_41bbe[0] = (double)this->arr_i16_41af4.top;
@@ -304,9 +313,9 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_f64_41bbe[7] = (double)(this->arr_i16_41af4.right - this->arr_i16_41afc.right)/(double)(this->var_i32_182);
// 128:096e
- g_toolbox->PaintRect(this->arr_i16_41af4);
+ _toolbox->PaintRect(this->arr_i16_41af4);
for (int i = 1; i < unk1 + 1; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
for (int j = 0; j < 4; j++) {
this->arr_f64_41bbe[j] = this->arr_f64_41bbe[j] + this->arr_f64_41bbe[j+4];
@@ -315,23 +324,23 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_i16_41b0a.left = (int16_t)this->arr_f64_41bbe[1];
this->arr_i16_41b0a.bottom = (int16_t)this->arr_f64_41bbe[2];
this->arr_i16_41b0a.right = (int16_t)this->arr_f64_41bbe[3];
- g_toolbox->PaintRect(this->arr_i16_41b0a);
+ _toolbox->PaintRect(this->arr_i16_41b0a);
this->delayFromMarker(0);
}
- g_toolbox->PaintRect(this->arr_i16_41afc);
- g_toolbox->PenNormal();
+ _toolbox->PaintRect(this->arr_i16_41afc);
+ _toolbox->PenNormal();
}
-void FoolPrologue::drawText(int16_t y, int16_t x) {
+void FoolPrologue::drawText(int16_t x, int16_t y) {
// 128:0a6c
- g_toolbox->MoveTo(x, y);
- g_toolbox->DrawString(this->var_str_76);
+ _toolbox->MoveTo(x, y);
+ _toolbox->DrawString(this->var_str_76);
}
void FoolPrologue::drawRainRecycle(int16_t unk) {
// 128:0a8c
this->var_i16_1a4 = unk;
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(kPatXor);
do {
// 128:0a96
this->drawRainDrop();
@@ -357,10 +366,10 @@ void FoolPrologue::drawRainRecycle(int16_t unk) {
this->var_i16_6 += 1;
if (this->var_i16_6 > 0xb5) {
this->var_i16_6 = 0;
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
- } while (this->var_i32_2 + this->var_i16_1a4 > g_toolbox->TickCount());
- g_toolbox->Delay(0);
+ } while (this->var_i32_2 + this->var_i16_1a4 > _toolbox->TickCount());
+ _toolbox->Delay(0);
}
void FoolPrologue::sub_128_c8a() {
@@ -386,18 +395,18 @@ void FoolPrologue::shuffleScanlines() {
}
}
-void FoolPrologue::sub_128_de2() {
+void FoolPrologue::drawClickMessage() {
// 128:0de2
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
this->var_str_76 = _zbasic->str(3);
- this->drawText(0x151, 0x5);
+ this->drawText(5, 0x151);
}
void FoolPrologue::sub_128_e1c() {
// 128:0e1c
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
this->var_str_76 = _zbasic->str(4);
- this->drawTextRightAlign(0x154, 0x1fb);
+ this->drawTextRightAlign(0x1fb, 0x154);
}
void FoolPrologue::sub_128_e58() {
@@ -405,7 +414,7 @@ void FoolPrologue::sub_128_e58() {
this->sub_128_e80();
while (true) {
// was: 2
- this->var_i16_1ba = g_toolbox->GetNextEvent(-1, this->var_ev_22);
+ this->var_i16_1ba = _toolbox->GetNextEvent(-1, this->var_ev_22);
if (this->var_ev_22.what == kMouseDown)
break;
if ((this->var_ev_22.what == kScummVMQuitEvt) || (this->var_ev_22.what == kScummVMReturnToLauncherEvt)) {
@@ -414,7 +423,7 @@ void FoolPrologue::sub_128_e58() {
}
// wait until next redraw
if (this->var_ev_22.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
this->sub_128_e80();
}
@@ -422,7 +431,7 @@ void FoolPrologue::sub_128_e58() {
void FoolPrologue::sub_128_e80() {
// 128:0e80
while (true) {
- this->var_i16_1ba = (int)g_toolbox->GetNextEvent(-1, this->var_ev_22);
+ this->var_i16_1ba = (int)_toolbox->GetNextEvent(-1, this->var_ev_22);
if (this->var_ev_22.what == kUpdateEvt) {
this->sub_128_ed2();
}
@@ -440,14 +449,14 @@ void FoolPrologue::sub_128_e80() {
}
// wait until next redraw
if (this->var_ev_22.what == kNullEvent)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
void FoolPrologue::sub_128_ed2() {
// 128:0ed2
- g_toolbox->BeginUpdate(this->var_window_24);
- g_toolbox->EndUpdate(this->var_window_24);
+ _toolbox->BeginUpdate(this->var_window_24);
+ _toolbox->EndUpdate(this->var_window_24);
}
void FoolPrologue::sub_128_ee0() {
@@ -508,42 +517,42 @@ void FoolPrologue::sub_129_004() {
// 129:00a2
if (false) {
this->var_i16_1c = { 0x4e20, 0x4e20, 0x4e20 };
- g_toolbox->SetCPixel(0x64, 0x64, this->var_i16_1c);
- g_toolbox->GetCPixel(0x64, 0x64, this->var_i16_1c);
+ _toolbox->SetCPixel(0x64, 0x64, this->var_i16_1c);
+ _toolbox->GetCPixel(0x64, 0x64, this->var_i16_1c);
}
// 129:00ee
// used for drawing on the menu bar
this->var_i32_c = &this->arr_grafport_a8a;
- g_toolbox->OpenPort(this->var_i32_c);
- this->var_i32_c->portBits = g_toolbox->_defaultMenuBits;
- this->var_i32_c->portRect = g_toolbox->_defaultMenuBits->getBounds();
+ _toolbox->OpenPort(this->var_i32_c);
+ //this->var_i32_c->portBits = _toolbox->_defaultMenuBits;
+ //this->var_i32_c->portRect = _toolbox->_defaultMenuBits->getBounds();
this->var_i32_8 = &this->arr_grafport_9c0;
- g_toolbox->OpenPort(this->var_i32_8);
+ _toolbox->OpenPort(this->var_i32_8);
if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
// 129:013a
this->fillRect(0x14, 0, this->var_i16_12, this->var_i16_10, 2);
- g_toolbox->SetRect(this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
- g_toolbox->PenPat(this->arr_pat_194[1]);
- g_toolbox->FrameRect(this->arr_i16_1bc);
+ _toolbox->SetRect(this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
+ _toolbox->PenPat(this->arr_pat_194[1]);
+ _toolbox->FrameRect(this->arr_i16_1bc);
}
// 129:01b0
- g_toolbox->SetPort(this->var_i32_8);
- g_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->MovePortTo(this->var_i16_14, this->var_i16_16);
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->ClipRect(this->arr_i16_1bc);
+ _toolbox->SetPort(this->var_i32_8);
+ _toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->MovePortTo(this->var_i16_14, this->var_i16_16);
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->ClipRect(this->arr_i16_1bc);
// 129:01f2
if (this->var_i16_12 == SCREEN_HEIGHT) {
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
} else {
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
}
// 129:026c
@@ -568,7 +577,7 @@ void FoolPrologue::sub_129_004() {
// 129:02fe
if (this->var_i32_1c0 < 0xd6d8) {
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x0);
this->fillRect(0x46, 0x64, 0xdc, 0x19c, 2);
@@ -579,15 +588,15 @@ void FoolPrologue::sub_129_004() {
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "not enough memory" message
this->var_str_76 = _zbasic->str(6);
- this->drawTextCenterAlign(0x64, 0x100);
+ this->drawTextCenterAlign(0x100, 0x64);
this->var_str_76 = _zbasic->str(7);
- this->drawTextCenterAlign(0x78, 0x100);
+ this->drawTextCenterAlign(0x100, 0x78);
this->var_str_76 = _zbasic->str(8);
- this->drawTextCenterAlign(0x96, 0x100);
+ this->drawTextCenterAlign(0x100, 0x96);
this->var_str_76 = _zbasic->str(9);
- this->drawTextCenterAlign(0xaa, 0x100);
+ this->drawTextCenterAlign(0x100, 0xaa);
this->var_str_76 = _zbasic->str(10);
- this->drawTextCenterAlign(0xcb, 0x100);
+ this->drawTextCenterAlign(0x100, 0xcb);
this->sub_128_e58();
if (_quit)
return;
@@ -616,11 +625,9 @@ void FoolPrologue::sub_129_004() {
// 129:04de
// "and now it is time to show the finale" message
this->var_str_76 = _zbasic->str(12);
- _zbasic->bufferFlush(this->var_str_76);
for (int i = 1; i <= 0xa; i++) {
this->var_str_76 += _zbasic->chr(i);
- _zbasic->bufferFlush(this->var_str_76);
}
// 129:0522
@@ -648,7 +655,7 @@ void FoolPrologue::sub_129_004() {
*/
// 129:05a6
if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x00);
this->fillRect(0x64, 0x82, 0xdc, 0x17e, 2);
@@ -658,19 +665,19 @@ void FoolPrologue::sub_129_004() {
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "set your monitor to black and white" message"
this->var_str_76 = _zbasic->str(13);
- this->drawTextCenterAlign(0x82, 0x100);
+ this->drawTextCenterAlign(0x100, 0x82);
this->var_str_76 = _zbasic->str(14);
- this->drawTextCenterAlign(0x96, 0x100);
+ this->drawTextCenterAlign(0x100, 0x96);
this->var_str_76 = _zbasic->str(15);
// if this is the finale
if (this->var_i16_1aa == 2) {
this->var_str_76 = _zbasic->str(16);
}
- this->drawTextCenterAlign(0xaa, 0x100);
+ this->drawTextCenterAlign(0x100, 0xaa);
this->var_str_76 = _zbasic->str(17);
- this->drawTextCenterAlign(0xcb, 0xfc);
+ this->drawTextCenterAlign(0x100, 0xcb);
// 129:0730
this->sub_128_e58();
if (_quit)
@@ -682,8 +689,6 @@ void FoolPrologue::sub_129_004() {
this->sub_128_e80();
}
// 129:0772
- // _zbasic->pushOldCodeResource(0x81);
- this->prologueRun();
}
}
@@ -715,19 +720,19 @@ void FoolPrologue::prologueRun() {
// - Release the resource
// "The Fool's Errand" title card
- this->glob_i32_2ce = g_toolbox->GetPicture(0x47);
+ this->glob_i32_2ce = _toolbox->GetPicture(0x47);
this->var_i16_3ce = 10;
this->prologueDrawLoadingMsg();
this->setPortBitsToPage(0xb);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
- g_toolbox->ReleaseResource(this->glob_i32_2ce);
+ _toolbox->ReleaseResource(this->glob_i32_2ce);
// 130:007a
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcBic);
this->var_str_76 = _zbasic->str(18);
- this->drawTextCenterAlign(0x10d, 0x103);
- g_toolbox->SetPortBits(this->var_i32_32);
+ this->drawTextCenterAlign(0x103, 0x10d);
+ _toolbox->SetPortBits(this->var_i32_32);
// cliffside images with lightning
for (int i = 1; i <= 5; i++) {
this->prologueBufferNextPicture();
@@ -737,13 +742,13 @@ void FoolPrologue::prologueRun() {
// 130:00d6
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->picture(0, 0x96, this->arr_i32_0[1]);
- g_toolbox->ReleaseResource(this->arr_i32_0[1]);
+ _toolbox->ReleaseResource(this->arr_i32_0[1]);
this->setPortBitsToPage(8);
// 130:011c
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->picture(0, 0x96, this->arr_i32_0[2]);
- g_toolbox->ReleaseResource(this->arr_i32_0[2]);
+ _toolbox->ReleaseResource(this->arr_i32_0[2]);
// 130:015c
for (int i = 3; i <= 5; i++) {
@@ -756,7 +761,7 @@ void FoolPrologue::prologueRun() {
// 130:01aa
_zbasic->picture(0, 0, this->arr_i32_0[6]);
- g_toolbox->ReleaseResource(this->arr_i32_0[6]);
+ _toolbox->ReleaseResource(this->arr_i32_0[6]);
// high priestess face
this->prologueBufferNextPicture();
@@ -766,7 +771,7 @@ void FoolPrologue::prologueRun() {
// 130:0202
_zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
- g_toolbox->ReleaseResource(this->arr_i32_0[7]);
+ _toolbox->ReleaseResource(this->arr_i32_0[7]);
// priestess on mountain
this->prologueBufferNextPicture();
this->setPortBitsToPage(2);
@@ -774,7 +779,7 @@ void FoolPrologue::prologueRun() {
// 130:0234
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
- g_toolbox->ReleaseResource(this->arr_i32_0[8]);
+ _toolbox->ReleaseResource(this->arr_i32_0[8]);
// 130:0276
for (int j = 9; j <= 0xb; j++) {
@@ -791,8 +796,8 @@ void FoolPrologue::prologueRun() {
this->setPortBitsToPage(j - 6);
_zbasic->picture(0, 0, this->arr_i32_0[j]);
_zbasic->picture(this->var_i16_74, 0x96, this->arr_i32_0[j - 6]);
- g_toolbox->ReleaseResource(this->arr_i32_0[j]);
- g_toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
+ _toolbox->ReleaseResource(this->arr_i32_0[j]);
+ _toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
}
// priestess lightning closeup
this->prologueBufferNextPicture();
@@ -800,7 +805,7 @@ void FoolPrologue::prologueRun() {
// 130:0320
this->setPortBitsToPage(6);
_zbasic->picture(0, 0, this->arr_i32_0[0xc]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0xc]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0xc]);
// 130:034a
for (int i = 0xd; i <= 0x12; i++) {
@@ -809,17 +814,18 @@ void FoolPrologue::prologueRun() {
}
// fool looking up at sun
- this->arr_i32_0[0x48] = g_toolbox->GetPicture(0x48);
- g_toolbox->SetPortBits(this->var_i32_32);
+ this->arr_i32_0[0x48] = _toolbox->GetPicture(0x48);
+ _toolbox->SetPortBits(this->var_i32_32);
// 130:0380
if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
} else {
- g_toolbox->SetPort(this->var_i32_c);
+ // FIXME: menu draw code not used
+ /*_toolbox->SetPort(this->var_i32_c);
this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_8);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_8);*/
}
// We're done loading, start the intro.
@@ -837,49 +843,49 @@ void FoolPrologue::prologueRun() {
// animate rain
this->drawRain();
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
// 130:043c
for (int i = 1; i <= 2; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->drawRainRecycle(0xb4);
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i16_1bc);
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(this->arr_i16_1bc);
this->delayFromMarker(1);
- g_toolbox->InvertRect(this->arr_i16_1bc);
+ _toolbox->InvertRect(this->arr_i16_1bc);
// 130:04ca
for (int j = 0; j <= 3; j++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[8];
// 130:049e
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->drawRainRecycle(4);
this->var_i16_192 = 0;
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[3];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->drawRainRecycle(5);
// 130:0518
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[4];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->drawRainRecycle(5);
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[5];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->drawRainRecycle(5);
}
// 130:05b6
this->var_i32_40 = this->arr_i32_41296[7];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
}
// 130:05fc
this->blitPageToScreen(0);
this->drawRain();
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->drawRainRecycle(0xb4);
this->var_i32_40 = this->arr_i32_41296[1];
@@ -889,7 +895,7 @@ void FoolPrologue::prologueRun() {
int y = 0;
while (y != SCREEN_HEIGHT) {
this->var_i16_5c.right = SCREEN_WIDTH;
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
this->var_i16_192 = 1;
if (y < SCREEN_HEIGHT) {
@@ -898,7 +904,7 @@ void FoolPrologue::prologueRun() {
this->var_i16_5c.top = this->arr_i16_412ea[y];
this->var_i16_5c.bottom = this->arr_i16_412ea[y] + 1;
// 130:068e
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
}
// 130:06b0
this->drawRainRecycle(1);
@@ -906,22 +912,22 @@ void FoolPrologue::prologueRun() {
// lightning flash over priestess face
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->drawRainRecycle(0xa);
this->blitPageToScreen(1);
// 130:06d4
for (int i = 1; i <= 4; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i16_1bc);
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(this->arr_i16_1bc);
this->drawRainRecycle(0x2);
}
// 130:0704
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i16_1bc);
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(this->arr_i16_1bc);
this->drawRainRecycle(0xf);
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i16_1bc);
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(this->arr_i16_1bc);
this->drawRainRecycle(0x78);
// cut to shot of cliff
@@ -929,18 +935,18 @@ void FoolPrologue::prologueRun() {
// 130:0740
this->drawRain();
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->drawRainRecycle(0xb4);
- g_toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
+ _toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
// priestess zap
// 130:0778
for (int j = 0; j <= 8; j++) {
for (int i = 3; i <= 5; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i32_40 = this->arr_i32_41296[i];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
this->drawRainRecycle(3);
}
}
@@ -948,11 +954,11 @@ void FoolPrologue::prologueRun() {
// cut to closeup of priestess mid-zap
// 130:07ec
this->blitPageToScreen(6);
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i <= 0x2d; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
// seizure warning
- g_toolbox->InvertRect(this->arr_i16_1bc);
+ _toolbox->InvertRect(this->arr_i16_1bc);
this->delayFromMarker(1);
}
@@ -973,26 +979,26 @@ void FoolPrologue::prologueRun() {
this->arr_i32_0[0xe]->_opsPerTick = 32;
_zbasic->picture(5, 0, this->arr_i32_0[0xe]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0xd]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0xe]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0xd]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0xe]);
// start loading some new resources from the floppy disk into the screen buffers
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
// 130:0890
- // _zbasic->52(0);
+ _zbasic->restore(0);
this->setPortBitsToPage(0);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0xf]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0xf]);
// 130:08dc
this->prologueRenderNextText();
- this->sub_128_de2();
+ this->drawClickMessage();
this->setPortBitsToPage(1);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0x10]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x10]);
this->prologueRenderNextText();
- this->sub_128_de2();
+ this->drawClickMessage();
// 130:0934
for (int i = 2; i <= 5; i++) {
//_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
@@ -1002,38 +1008,38 @@ void FoolPrologue::prologueRun() {
// draw the sun pulsing to pages 1-5
for (int i = 1; i <= 5; i++) {
this->setPortBitsToPage(i);
- g_toolbox->PenPat(this->arr_pat_194[1]);
- g_toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
- g_toolbox->FrameOval(this->arr_i16_1bc);
- g_toolbox->PenPat(this->arr_pat_194[4]);
+ _toolbox->PenPat(this->arr_pat_194[1]);
+ _toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
+ _toolbox->FrameOval(this->arr_i16_1bc);
+ _toolbox->PenPat(this->arr_pat_194[4]);
// 130:09d0
- g_toolbox->InsetRect(this->arr_i16_1bc, -i, -i);
+ _toolbox->InsetRect(this->arr_i16_1bc, -i, -i);
for (int j = 2; j <= 0xd; j++) {
- g_toolbox->InsetRect(this->arr_i16_1bc, -j, -j);
- g_toolbox->FrameOval(this->arr_i16_1bc);
+ _toolbox->InsetRect(this->arr_i16_1bc, -j, -j);
+ _toolbox->FrameOval(this->arr_i16_1bc);
}
}
// 130:0a42
this->setPortBitsToPage(6);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
- this->sub_128_de2();
+ this->drawClickMessage();
//_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
this->arr_i32_41296[7]->copyFrom(*this->arr_i32_41296[6]);
this->prologueRenderNextText();
- g_toolbox->ReleaseResource(this->arr_i32_0[0x11]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x11]);
this->setPortBitsToPage(7);
// 130:0ac2
_zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
this->prologueRenderNextText();
- g_toolbox->ReleaseResource(this->arr_i32_0[0x12]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x12]);
this->setPortBitsToPage(8);
//_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
this->fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
_zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0x48]);
- g_toolbox->SetPortBits(this->var_i32_32);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x48]);
+ _toolbox->SetPortBits(this->var_i32_32);
// 130:0b74
this->delayFromMarker(0xd2);
@@ -1056,7 +1062,7 @@ void FoolPrologue::prologueRun() {
this->var_i16_192 = 1;
while (this->var_ev_22.what != kMouseDown) {
// 130:0ba4
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i16_74 += this->var_i16_192;
// 130:0bbe
if (this->var_i16_74 == 0x5) {
@@ -1068,11 +1074,11 @@ void FoolPrologue::prologueRun() {
this->blitPageToScreen(this->var_i16_74);
this->delayFromMarker(0xa);
// 130:0bee
- this->var_i16_1ba = g_toolbox->GetNextEvent(2, this->var_ev_22);
+ this->var_i16_1ba = _toolbox->GetNextEvent(2, this->var_ev_22);
}
while (!((this->var_ev_22.what == kNullEvent) && (this->var_ev_22.modifiers & kModMouseButtonUp))) {
// 130:0c0c
- this->var_i32_2 = g_toolbox->TickCount();
+ this->var_i32_2 = _toolbox->TickCount();
this->var_i16_74 += this->var_i16_192;
// 130:0c26
if (this->var_i16_74 == 0x5) {
@@ -1084,7 +1090,7 @@ void FoolPrologue::prologueRun() {
this->blitPageToScreen(this->var_i16_74);
this->delayFromMarker(0xa);
// 130:0c56
- this->var_i16_1ba = g_toolbox->GetNextEvent(-1, this->var_ev_22);
+ this->var_i16_1ba = _toolbox->GetNextEvent(-1, this->var_ev_22);
if (this->var_ev_22.what == kUpdateEvt) {
this->sub_128_ed2();
}
@@ -1099,7 +1105,7 @@ void FoolPrologue::prologueRun() {
if (_quit)
return;
- this->sub_128_50a(0x0, 0, SCREEN_HEIGHT, 7);
+ this->sub_128_50a(0x0, 0, SCREEN_WIDTH, 7);
this->delay(0xa);
// "I dare"
this->blitPageToScreen(0x8);
@@ -1109,7 +1115,7 @@ void FoolPrologue::prologueRun() {
// zoom to close
- this->sub_128_354(kPatCopy, 1);
+ zoomClose(1, kPatCopy);
// 130:0ce6
// JMP 1002
// _zbasic->pushOldCodeResource(0x82);
@@ -1119,15 +1125,17 @@ void FoolPrologue::prologueRun() {
void FoolPrologue::prologueBufferNextPicture() {
// 130:0cea
this->var_i16_3d4 += 1;
- this->arr_i32_0[this->var_i16_3d4] = g_toolbox->GetPicture(this->var_i16_3d4);
+ this->arr_i32_0[this->var_i16_3d4] = _toolbox->GetPicture(this->var_i16_3d4);
// 130:0d0a
this->var_i16_3ce = this->var_i16_3d4 * 5 + 10;
this->prologueDrawLoadingMsg();
}
void FoolPrologue::prologueDrawLoadingMsg() {
+ // FIXME: we don't share the menu surface here yet
+ return
// 130:0d28
- g_toolbox->SetPort(this->var_i32_c);
+ _toolbox->SetPort(this->var_i32_c);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// "loading prologue" message
this->var_str_76 = _zbasic->str(19);
@@ -1137,16 +1145,16 @@ void FoolPrologue::prologueDrawLoadingMsg() {
// white out the contents of the top menu bar.
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
this->fillRect(0, 0x7, 0x13, this->var_i16_10 - 7, 0);
- this->drawTextCenterAlign(0xe, this->var_i16_10/2);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_8);
- g_toolbox->Delay(0);
+ this->drawTextCenterAlign(this->var_i16_10/2, 0xe);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_8);
+ _toolbox->Delay(0);
}
void FoolPrologue::drawRain() {
// 130:0db0
_zbasic->unk_20();
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(kPatXor);
this->var_i16_6 = 0x1;
while (this->var_i16_6 <= 0xb5) {
// 130:0dc0
@@ -1159,14 +1167,14 @@ void FoolPrologue::drawRain() {
this->var_i16_6 += 1;
}
this->var_i16_6 = 1;
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
void FoolPrologue::drawRainDrop() {
// 130:0e82
- g_toolbox->MoveTo(this->arr_i16_1e8[this->var_i16_6], this->arr_i16_1e8[this->var_i16_6 + 0xfb]);
+ _toolbox->MoveTo(this->arr_i16_1e8[this->var_i16_6], this->arr_i16_1e8[this->var_i16_6 + 0xfb]);
// 130:0ec0
- g_toolbox->LineTo(
+ _toolbox->LineTo(
this->arr_i16_1e8[this->var_i16_6] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
this->arr_i16_1e8[this->var_i16_6 + 0xfb] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6]
);
@@ -1193,760 +1201,9 @@ void FoolPrologue::prologueRenderNextText() {
}
// 130:0fc8
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->drawText(this->var_i16_180, this->var_i16_176);
+ this->drawText(this->var_i16_176, this->var_i16_180);
}
}
-// run finale
-void FoolPrologue::finaleRun() {
- // 131:0004
- this->var_i16_3ce = 0x2d;
- this->sub_131_4dc0();
- this->var_i32_3d6 = g_toolbox->OpenPoly();
- g_toolbox->MoveTo(0xc8, 0x8d);
- g_toolbox->LineTo(0x1df, 0xc8);
- g_toolbox->LineTo(0x1d2, 0x11b);
- g_toolbox->LineTo(0xcd, 0x93);
- g_toolbox->LineTo(0xc8, 0x8d);
- g_toolbox->ClosePoly();
- // 131:004c
- this->arr_i32_0[0x1f] = g_toolbox->GetPicture(0x1f);
- this->setPortBitsToPage(0x4);
- _zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
- this->sub_131_4dc0();
- for (int i = 0x14; i < 0x1e; i++) {
- // 131:009c
- this->arr_i32_0[i] = g_toolbox->GetPicture(i);
- if ((i % 3) == 0) {
- this->var_i16_3ce += 5;
- this->sub_131_4dc0();
- }
- }
- // 131:00e6
- for (int i = 6; i <= 9; i++) {
- this->setPortBitsToPage(i);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- // 131:0110
- if (i < 8) {
- _zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
- }
- if (i == 8) {
- _zbasic->picture(0, 0, this->arr_i32_0[0x1a]);
- }
- if (i == 9) {
- _zbasic->picture(0x60, 0x4c, this->arr_i32_0[0x1b]);
- }
- }
- // 131:0184
- for (int i = 0x19; i <= 0x1b; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_0[i]);
- }
- // 131:01aa
- this->arr_i32_0[0x13] = g_toolbox->GetPicture(0x13);
- this->setPortBitsToPage(0x5);
- _zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
- _zbasic->picture(0, 0, this->arr_i32_0[0x18]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0x13]);
- g_toolbox->ReleaseResource(this->arr_i32_0[0x18]);
- this->sub_131_4e98();
- this->var_i16_3ce = 0x4b;
- this->sub_131_4dc0();
- // 131:021e
- for (int i = 0x20; i <= 0x2f; i++) {
- this->arr_i32_0[i] = g_toolbox->GetPicture(i);
- if (i % 3) {
- this->var_i16_3ce += 5;
- this->sub_131_4dc0();
- }
- }
- // 131:026e
- this->var_i16_18e = SCREEN_HEIGHT;
- this->shuffleScanlines();
- this->var_i32_1a6 = _zbasic->mem(-1);
- g_toolbox->SetPortBits(this->var_i32_32);
- if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
- // 131:02ac
- this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
- } else {
- g_toolbox->SetPort(this->var_i32_c);
- this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_8);
- }
- // 131:02ec
- this->delay(0x3c);
- this->zoomTransition(0x5);
- this->sub_128_e58();
- if (_quit)
- return;
-
- this->sub_131_4e98();
- // _zbasic->52(0x4c);
- for (int j = 1; j < 0xe; j++) {
- this->var_i16_3da = 1;
-
- // 131:030c
- this->var_i16_18e = _zbasic->readDataInt();
- for (int i = 1; i < this->var_i16_18e; i++) {
- // 131:031a
- this->arr_i16_1e8[i] = _zbasic->readDataInt();
- this->arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
- this->arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
- }
-
- // 131:0380
- g_toolbox->PenMode(kPatXor);
- this->sub_128_3ee(0x14);
- this->sub_128_3ee(0xa);
- this->sub_128_3ee(0x14);
- this->sub_128_3ee(0x5);
- this->sub_128_3ee(0xa);
- this->sub_128_3ee(0x5);
- g_toolbox->PenNormal();
- this->sub_128_3ee(0x0);
- }
-
- // 131:03c0
- this->delay(0x1e);
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(22));
- _zbasic->bufferFlush(this->var_str_76);
-
- // 131:0400
- this->drawText(0x17c, 0xb4);
- this->delay(0x1e);
-
- // 131:041a
- _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
- this->delay(0x2);
- _zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
- this->delay(0x3c);
- _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
- this->delay(0x6);
- _zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
- this->delay(0x6);
- _zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
-
- // 131:04b4
- for (int i = 0x14; i < 0x17; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_0[i]);
- }
-
- // 131:04da
- this->var_i32_2 = g_toolbox->TickCount();
-
- this->var_i32_40 = this->arr_i32_41296[5];
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- this->sub_131_4e48();
-
- // 131:0538
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
- g_toolbox->SetPortBits(this->var_i32_4e);
-
- // 131:0554
- this->fillRect(0, 0, 0xa0, 0x15e, 0);
- this->fillRect(0xa0, 0x5a, 0xd2, 0xaa, 0);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
-
- // 131:05b0
- this->setPortBitsToPage(6);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->setPortBitsToPage(7);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->setPortBitsToPage(8);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->setPortBitsToPage(9);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
-
- // 131:0630
- g_toolbox->SetPortBits(this->var_i32_32);
- _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
- this->delayFromMarker(0x3c);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- this->sub_128_50a(0x6, 0, 0x200, 0x3);
- this->sub_131_4e48();
-
- // 131:06aa
- this->sub_128_50a(5, 0, 0x200, 2);
- this->sub_128_50a(7, 0, 0x200, 2);
- this->sub_128_50a(8, 0, 0x200, 1);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- this->sub_128_50a(0x9, 0, 0x200, 1);
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kPatXor);
- _zbasic->unk_20();
-
- // 131:0730
- this->var_i16_3dc = 0;
- this->var_i16_18e = 0;
- for (int j = 1; j < 0x63; j++) {
- if (this->var_i16_3dc > SCREEN_HEIGHT) {
- // 131:074e
- this->var_i16_3dc += _zbasic->maybe() ? 0x4 : 0x5;
- }
- if (this->var_i16_18e > 0x41) {
- // 131:0770
- this->var_i16_18e += 1;
- this->arr_i16_1e8[this->var_i16_18e] = _zbasic->rndInt(32);
- this->arr_i16_1e8[this->var_i16_18e+0xfb] = _zbasic->rndInt(this->var_i16_3dc);
- this->arr_i16_1e8[this->var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
- this->sub_131_4f96();
- }
- // 131:07ea
- for (int i = 1; i < this->var_i16_18e; i++) {
- this->sub_131_4f96();
- this->arr_i16_1e8[i] = ((this->arr_i16_1e8[i] + this->arr_i16_1e8[0x1f6+i]) + this->arr_i16_1e8[0x1f6+i]);
-
- // 131:0870
- if (this->arr_i16_1e8[i] < SCREEN_WIDTH) {
- this->arr_i16_1e8[i] = 1;
- this->arr_i16_1e8[0xfb+i] = _zbasic->rndInt(this->var_i16_3dc);
- this->arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
- }
-
- // 131:0902
- this->sub_131_4f96();
- }
- }
-
-
- // 131:0926
- g_toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenPat(this->arr_pat_194[3]);
- _zbasic->picture(0x6d, 0x49, this->arr_i32_0[0x1c]);
- _zbasic->picture(0x65, 0x48, this->arr_i32_0[0x1d]);
- _zbasic->picture(0x64, 0x54, this->arr_i32_0[0x1e]);
- // 131:099c
-
- g_toolbox->PaintPoly(this->var_i32_3d6);
- for (int i = 0; i < 0x21; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->InvertRect(this->arr_i16_1bc);
- this->delayFromMarker(1);
- }
-
- // 131:09d2
- this->sub_128_800(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- this->sub_128_800(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- this->sub_128_800(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- this->sub_128_800(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
-
- // 131:0a7a
- for (int i = 1; i < 0x63; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_74 = _zbasic->rndInt(0x1ca);
- this->var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
- g_toolbox->InvertRect(this->arr_i16_1bc);
- this->delayFromMarker(1);
- }
-
- // 131:0aec
- this->var_i32_2 = g_toolbox->TickCount();
-
- // 131:0af6
- while (g_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
- this->var_i16_74 = _zbasic->rndInt(0x1ca);
- this->var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_i16_192 + 0x5a, this->arr_i32_3bca4);
-
- // 131:0b54
- this->var_i16_74 = _zbasic->rndInt(0x1ca);
- this->var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
- }
-
- // 131:0bb0
- this->sub_128_50a(4, 0, SCREEN_WIDTH, 3);
- this->sub_128_1ba(5);
- _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
- g_toolbox->SetPortBits(this->var_i32_32);
- this->delay(0x3c);
- this->sub_128_50a(5, 0, SCREEN_WIDTH, 0);
- _zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
-
- // 131:0c36
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->KillPoly(this->var_i32_3d6);
- for (int i = 0x1c; i < 0x1e; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_0[i]);
- }
-
- // 131:0c6c
- for (int i = 0x6; i < 0xa; i++) {
- //_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[5]);
- }
- this->setPortBitsToPage(0x6);
- _zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
- this->setPortBitsToPage(0x7);
- _zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
- this->setPortBitsToPage(0x8);
- _zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
- this->setPortBitsToPage(0x9);
- _zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
- this->setPortBitsToPage(0xa);
- _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
-
- // 131:0d64
- for (int i = 0x20; i < 0x23; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_0[i]);
- }
- g_toolbox->SetPortBits(this->var_i32_32);
- this->delayFromMarker(0x64);
- _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
- for (int i = 0x6; i < 0xa; i++) {
- this->delay(0xf);
- this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
- }
- _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
- this->delay(0x3c);
-
- // 131:0e08
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(23));
- _zbasic->bufferFlush(this->var_str_76);
- this->drawText(0x1f4 - g_toolbox->StringWidth(this->var_str_76), 0xd2);
- this->var_i32_2 = g_toolbox->TickCount();
-
- // 131:0e76
- //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
- this->arr_i32_41296[5]->copyFrom(*this->arr_i32_41296[4]);
- this->setPortBitsToPage(0x5);
- _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
- _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
- _zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
- this->setPortBitsToPage(0x6);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
- this->setPortBitsToPage(0x7);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
- //_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
- this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
- this->setPortBitsToPage(0x8);
- _zbasic->picture(0x18f, 0xc0, -1, 0, this->arr_i32_0[0x2b]);
- //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
- this->arr_i32_41296[9]->copyFrom(*this->arr_i32_41296[4]);
- this->setPortBitsToPage(0x9);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
- this->setPortBitsToPage(0xa);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
-
- // 131:1056
- g_toolbox->ReleaseResource(this->arr_i32_0[0x24]);
- g_toolbox->SetPortBits(this->var_i32_32);
- this->delayFromMarker(0x78);
- this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- this->sub_128_50a(0x5, 0x64, 0x19c, 0x0);
- this->delay(0x28);
-
- this->var_i16_5c.left = 0x118;
- this->var_i16_5c.right = 0x1d1;
- this->var_i16_5c.top = 0x19;
- this->var_i16_64.left = 0x118;
- this->var_i16_64.right = 0x1d1;
- this->var_i16_64.bottom = 0xdf;
-
- for (int i = 0xdc; i > 0x19; i -= 5) {
- // 131:10de
- this->var_i32_2 = g_toolbox->TickCount();
- //_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
- this->var_i32_4e->copyFrom(*this->arr_i32_41296[5]);
- this->var_i16_64.top = i;
- this->var_i16_5c.bottom = 0x19 + (i - 0xdf);
- this->var_i32_40 = this->arr_i32_41296[6];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcBic, nullptr);
- this->var_i32_40 = this->arr_i32_41296[7];
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcOr, nullptr);
- this->delayFromMarker(0x2);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, kSrcCopy, nullptr);
- }
-
- // 131:11a4
- this->sub_128_1ba(0x5);
- this->setPortBitsToPage(0x5);
- this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
- g_toolbox->SetPortBits(this->var_i32_32);
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kPatXor);
- g_toolbox->PenSize(0x5, 0x5);
-
- // 131:1208
- for (int i = 0; i < 0x1b8; i += 6) {
- this->var_i32_2 = g_toolbox->TickCount();
- g_toolbox->MoveTo(0x172, 0x33);
- g_toolbox->LineTo(i, 0x14a);
- if (i == 0x43) {
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str());
- _zbasic->bufferFlush(this->var_str_76);
- this->drawTextRightAlign(0x1f4, 0xd2);
- _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
- }
- this->delayFromMarker(0x2);
- g_toolbox->MoveTo(0x172, 0x33);
- g_toolbox->LineTo(i, 0x14a);
- }
-
- // 131:12cc
- this->sub_128_800(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
- this->sub_128_50a(0x5, 0x12c, SCREEN_WIDTH, 0x1);
- this->delay(0xec);
- for (int i = 8; i < 0xa; i++) {
- this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
- }
-
- this->var_i32_2 = g_toolbox->TickCount();
- this->setPortBitsToPage(0x5);
-
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
- g_toolbox->SetPortBits(this->var_i32_32);
- this->delayFromMarker(0xa);
- this->var_i16_5c.left = 0x18b;
- this->var_i16_5c.right = 0x1ef;
- this->var_i16_64.left = 0x18b;
- this->var_i16_64.right = 0x1ef;
-
- // 131:13b8
- for (int i = 0xc0; i > 0x15; i--) {
- this->var_i32_2 = g_toolbox->TickCount();
- this->var_i16_5c.top = i;
- this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
- this->var_i16_64.top = i - 1;
- this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
- g_toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, kSrcCopy, nullptr);
- this->delayFromMarker(0x1);
- }
-
- // 131:1424
- _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
- this->delay(0x1);
- _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
- this->delay(0x1);
- _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
- this->sub_128_1ba(0x6);
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kPatXor);
- g_toolbox->PenSize(0x3, 0x3);
- this->var_i16_6c.left = 0x190;
- this->var_i16_6c.right = SCREEN_WIDTH;
- this->var_i16_6c.top = 0x50;
- this->var_i16_6c.bottom = SCREEN_HEIGHT;
- this->var_i16_5c.left = 0;
- this->var_i16_5c.right = 0x32;
- this->var_i16_5c.top = 0;
- this->var_i16_5c.bottom = 0x32;
- this->var_i16_3e0 = 0x64;
-
- // 131:14d8
- this->var_i32_40 = this->arr_i32_41296[5];
- g_toolbox->SetPortBits(this->var_i32_4e);
- for (int i = 1; i < 0xf; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
- //_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
- this->var_i32_4e->copyFrom(*this->arr_i32_41296[6]);
- this->var_i16_3e0 += 5 + i*2;
- this->var_i16_64.left = 0x1e0;
- this->var_i16_64.right = this->var_i16_64.left + 0x32;
- this->var_i16_64.top = this->var_i16_3e0;
- this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
- g_toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcXor, nullptr);
- // 131:1582
- g_toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
- g_toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
- this->delayFromMarker(0x1);
- g_toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, kSrcCopy, nullptr);
- }
-
- g_toolbox->SetPortBits(this->var_i32_32);
- g_toolbox->PenNormal();
- g_toolbox->PenMode(kPatXor);
- for (int j = 0; j < 1; j++) {
-
- for (int i = 1; i < 0xfa; i++) {
- this->var_i32_2 = g_toolbox->TickCount();
-
- if (j == 0) {
- this->arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
- this->arr_i16_1e8[i+0xfb] = _zbasic->rndInt(i)- SCREEN_HEIGHT;
- }
- // 131:1692
- g_toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
- g_toolbox->LineTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
- if (i % 0x19 == 0) {
- this->delayFromMarker(0x1);
- }
- }
- }
- // 131:1748
- this->var_i32_2 = g_toolbox->TickCount();
- for (int i = 0x25; i < 0x2f; i++) {
- g_toolbox->ReleaseResource(this->arr_i32_0[i]);
- }
-
- this->delayFromMarker(0x3c);
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(25).c_str());
- _zbasic->bufferFlush(this->var_str_76);
- this->drawTextRightAlign(0x181, 0x3c);
-
- // 131:17c8
- var_i32_2 = g_toolbox->TickCount();
- for (int16 i = 0x30; i <= 0x31; i++) {
- arr_i32_0[i] = g_toolbox->GetPicture(i);
- }
- for (int16 i = 0x4b; i <= 0x52; i++) {
- arr_i32_0[i] = g_toolbox->GetPicture(i);
- }
- delayFromMarker(0xd2);
- fillRect(0, 0, 0x96, 0x18b, 2);
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
- delay(1);
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
- var_str_76 = _zbasic->chr(0x22) + _zbasic->str(26); // high priestess!
- drawTextRightAlign(0x181, 0x3c);
- var_str_76 = _zbasic->str(27); // am I to suffer this fate merely for uncovering
- drawTextRightAlign(0x181, 0x4d);
- var_str_76 = _zbasic->chr(0x22) + _zbasic->str(28); // the fourteen lost treasures of the land?
- drawTextRightAlign(0x181, 0x5e);
- for (int16 i = 0x30; i <= 0x31; i++) {
- g_toolbox->ReleaseResource(arr_i32_0[i]);
- }
- for (int16 i = 0x32; i <= 0x38; i++) {
- arr_i32_0[i] = g_toolbox->GetPicture(i);
- if (i == 0x37) {
- setPortBitsToPage(5);
- _zbasic->picture(0, 0, arr_i32_0[0x37]);
- g_toolbox->ReleaseResource(arr_i32_0[0x37]);
- g_toolbox->SetPortBits(var_i32_32);
- }
- }
- // 131:19be
- sub_128_e1c();
- sub_128_e58();
- sub_128_e1c();
- fillRect(0, 0, 0x96, 0x18b, 2);
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
- var_str_76 = _zbasic->chr(0x22) + _zbasic->str(29); // for if that be true
- drawTextRightAlign(0x181, 0x3c);
- var_str_76 = _zbasic->str(30); // I wish you had made the challenge more difficult
- drawTextRightAlign(0x181, 0x4d);
- var_str_76 = _zbasic->str(31); // after all, I am just a fool and I should not
- drawTextRightAlign(0x181, 0x5e);
- var_str_76 = _zbasic->str(32) + _zbasic->chr(0x22); // have been able to find them so easily
- drawTextRightAlign(0x181, 0x6f);
- arr_i16_41af4.top = 6;
- arr_i16_41af4.left = 0xd0;
- arr_i16_41af4.bottom = 0x6c;
- arr_i16_41af4.right = 0x133;
- arr_i16_41afc.top = 0xa;
- arr_i16_41afc.left = 0xb4;
- arr_i16_41afc.bottom = 0x1fc;
- arr_i16_41afc.right = 0x1f6;
- arr_i16_41b04[0] = 2;
- arr_i16_41b04[1] = 0xa;
- arr_i16_41b04[2] = 0xd;
-
- // 131:1b6e
- // unroll loops
- arr_f64_41bbe[0] = (float)arr_i16_41af4.top;
- arr_f64_41bbe[0+4] = (float)(arr_i16_41afc.top - arr_i16_41af4.top) / arr_i16_41b04[2];
- arr_f64_41bbe[1] = (float)arr_i16_41af4.left;
- arr_f64_41bbe[1+4] = (float)(arr_i16_41afc.left - arr_i16_41af4.left) / arr_i16_41b04[2];
- arr_f64_41bbe[2] = (float)arr_i16_41af4.bottom;
- arr_f64_41bbe[2+4] = (float)(arr_i16_41afc.bottom - arr_i16_41af4.bottom) / arr_i16_41b04[2];
- arr_f64_41bbe[3] = (float)arr_i16_41af4.right;
- arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_i16_41af4.right) / arr_i16_41b04[2];
- // 131:1c24
- g_toolbox->PenPat(arr_pat_194[1]);
- g_toolbox->PenMode(kPatXor);
- for (int16 j = 6; j <= 9; j++) {
- arr_i32_41296[j]->copyFrom(*arr_i32_41296[j - 1]);
- // 131:1c7a
- setPortBitsToPage(j);
- if (j == 6) {
- g_toolbox->PaintOval(arr_i16_41af4);
- }
- // 131:1c9c
- for (int16 i = 0; i <= 2; i++) {
- // unrolled loop
- arr_f64_41bbe[0] += arr_f64_41bbe[0+4];
- arr_i16_41b0a.top = (int16)arr_f64_41bbe[0];
- arr_f64_41bbe[1] += arr_f64_41bbe[1+4];
- arr_i16_41b0a.left = (int16)arr_f64_41bbe[1];
- arr_f64_41bbe[2] += arr_f64_41bbe[2+4];
- arr_i16_41b0a.bottom = (int16)arr_f64_41bbe[2];
- arr_f64_41bbe[3] += arr_f64_41bbe[3+4];
- arr_i16_41b0a.right = (int16)arr_f64_41bbe[3];
- // 131:1d44
- g_toolbox->PaintOval(arr_i16_41b0a);
- }
- }
- arr_i32_41296[10]->copyFrom(*arr_i32_41296[9]);
- // 131:1d98
- setPortBitsToPage(0xa);
- g_toolbox->PaintOval(arr_i16_41afc);
- setPortBitsToPage(5);
- g_toolbox->SetRect(arr_i16_1bc, 0xae, 0x8c, 0xb6, 0x94);
- g_toolbox->InvertOval(arr_i16_1bc);
- g_toolbox->SetRect(arr_i16_1bc, 0x151, 0x86, 0x159, 0x8e);
- g_toolbox->InvertOval(arr_i16_1bc);
- g_toolbox->SetPortBits(var_i32_32);
- sub_128_e1c();
- sub_128_e58();
- // 131:1e18
- fillRect(0, 0, 0x96, 0x18b, 2);
- fillRect(0x12c, 0x15e, 0x156, 0x200, 2);
- var_i16_18e = 0;
- for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- _zbasic->get(
- 0x190,
- i + 0xa,
- 0x1ea,
- i + 0x14,
- arr_i32_1e3fc[i/0xa]
- );
- arr_i16_1e8[i + 0] = 0x190;
- var_i16_18e++;
- if (var_i16_18e > 4) {
- var_i16_18e = 1;
- }
- arr_i16_1e8[i + 0xfb] = var_i16_18e;
- }
- // 131:1f1a
- for (int16 j = 1; j <= 0xf; j++) {
- if (j < 9) {
- g_toolbox->InvertRect(var_i16_38);
- }
- var_i32_2 = g_toolbox->TickCount();
- for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
- arr_i16_1e8[i] -= arr_i16_1e8[0xfb + i]*j;
- _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
- // 131:2062
- }
- // 131:2072
- delayFromMarker(2);
- }
- for (int16 j = 1; j <= 0xf; j++) {
- var_i32_2 = g_toolbox->TickCount();
- for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
- arr_i16_1e8[i] += arr_i16_1e8[0xfb + i]*j;
- _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
- }
- delayFromMarker(2);
- }
- // 131:21e0
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x33]);
- var_i16_1b6 = 0x14;
- var_str_76 = _zbasic->str(33); // be content that you still live
- for (int16 i = 1; i <= 0x18; i++) {
- var_i32_2 = g_toolbox->TickCount();
- _zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
- var_i16_1b6 += i;
- drawText(5 + i*2, var_i16_1b6);
- delayFromMarker(3);
- }
- // 131:2282
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x34]);
- var_i32_2 = g_toolbox->TickCount();
- setPortBitsToPage(4);
- g_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
- g_toolbox->InvertRect(arr_i16_1bc);
- g_toolbox->SetRect(arr_i16_1bc, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
- g_toolbox->PenMode(kPatOr);
- g_toolbox->PenPat(arr_pat_194[1]);
- g_toolbox->PaintRect(arr_i16_1bc);
- // 131:2316
- // 131:2316: MOVE.L - HEAP(0x412a6),D0
- // 131:2320: MOVEA.L - D0,A0
- // 131:2322: MOVE.L - (A0),D0
- // 131:2324: PUSH.L - D0
- // 131:2326: MOVE.L - HEAP(0x412c2),D0
- // 131:2330: MOVEA.L - D0,A0
- // 131:2332: MOVE.L - (A0),D0
- // 131:2334: PUSH.L - D0
- // 131:2336: MOVE.L - 0x5580,D0
- setPortBitsToPage(0xb);
-}
-
-void FoolPrologue::sub_131_4dc0() {
- // 131:4dc0
- g_toolbox->SetPort(this->var_i32_c);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
- // Loading Finale
- this->var_str_76 += _zbasic->str(78);
- this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
- _zbasic->bufferFlush(this->var_str_76);
- // 131:4e08
- this->fillRect(0, 0, 7, 0x13, this->var_i16_10 - 7);
-
- this->drawTextCenterAlign(this->var_i16_10 / 2, 0xe);
- g_toolbox->_defaultMenu->setOverlayDirty(true);
- g_toolbox->SetPort(this->var_i32_8);
-}
-
-void FoolPrologue::sub_131_4e48() {
- // 131:4e48
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
-
- // Uh oh . . .
- this->var_str_76 += Common::U32String::format("\"%s\"", _zbasic->str(80).c_str());
- _zbasic->bufferFlush(this->var_str_76);
-
- this->drawText(0x1aa, 0xb4);
-}
-
-void FoolPrologue::sub_131_4e98() {
- // 131:4e98
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcXor);
- this->var_i16_3fc = 0xa0;
- // "And so the fool heeded the advice of the magician..."
- this->var_str_76 += _zbasic->str(81);
- _zbasic->bufferFlush(this->var_str_76);
- this->drawText(0x92, this->var_i16_3fc);
-
- this->var_str_76 += _zbasic->str(82);
- _zbasic->bufferFlush(this->var_str_76);
- this->drawText(0x9c, this->var_i16_3fc + 0xf);
-
- this->var_str_76 += _zbasic->str(83);
- _zbasic->bufferFlush(this->var_str_76);
- this->drawText(0xa6, this->var_i16_3fc + 0x1e);
-
- this->var_str_76 += _zbasic->str(84);
- _zbasic->bufferFlush(this->var_str_76);
- this->drawText(0xc4, this->var_i16_3fc + 0x2d);
-
- this->var_str_76 += _zbasic->str(85);
- _zbasic->bufferFlush(this->var_str_76);
- this->drawText(0xe2, this->var_i16_3fc + 0x3c);
-
- this->sub_128_de2();
-}
-
-void FoolPrologue::sub_131_4f96() {
- // 131:4f96
- g_toolbox->MoveTo(
- this->arr_i16_1e8[this->var_i16_74],
- this->arr_i16_1e8[this->var_i16_74+0xfb]
- );
-
- // 131:4fd4
- g_toolbox->LineTo(
- this->arr_i16_1e8[this->var_i16_74] + this->arr_i16_1e8[this->var_i16_74+0x1f6],
- this->arr_i16_1e8[this->var_i16_74+0xfb]
- );
-}
-
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 22d7a8c2e5f..a05b3cf0c67 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -35,7 +35,9 @@ class ZBasic;
enum FoolPrologueFontID : uint16 {
kPrologueFontFool = 250,
- kPrologueFontSmall = 251,
+ // The original prologue uses 251 for Small,
+ // however we need this to be the same as the main game.
+ kPrologueFontSmall = 252,
};
class FoolPrologue {
@@ -50,21 +52,21 @@ public:
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
void delayFromMarker(int16 numTicks); // sub_128_24a
- void drawTextRightAlign(int16 y, int16 x); // sub_128_26c
- void drawTextCenterAlign(int16 unk1, int16 unk2); // sub_128_2a6
+ void drawTextRightAlign(int16 x, int16 y); // sub_128_26c
+ void drawTextCenterAlign(int16 x, int16 y); // sub_128_2a6
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_2f0
- void sub_128_354(PatternMode mode, uint16 unk2);
- void sub_128_3ee(int16 unk1);
- void sub_128_50a(int16 unk1, int16 unk2, int16 unk3, int16 screenPage);
+ void zoomClose(int16 patternID, PatternMode mode); // sub_128_354
+ void drawTreasurePhaseIn(int16 unk1); // sub_128_3ee
+ void sub_128_50a(int16 unk1, int16 left, int16 right, int16 screenPage);
void blitPageToScreen(int16 screenPage); // sub_128_610
void scanlineTransition(int16 patternID); // sub_128_64a
void zoomTransition(int16 screenPage); // sub_128_6e4
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
- void drawText(int16_t y, int16_t x); // sub_128_a6c
+ void drawText(int16_t x, int16_t y); // sub_128_a6c
void drawRainRecycle(int16_t unk); // sub_128_a8c
void sub_128_c8a();
void shuffleScanlines(); // sub_128_ccc
- void sub_128_de2();
+ void drawClickMessage(); // sub_128_de2
void sub_128_e1c();
void sub_128_e58();
void sub_128_e80();
@@ -83,14 +85,15 @@ public:
void drawRainDrop(); // sub_130_e82
void prologueRenderNextText(); // sub_130_f48
+ // fool_finale.cpp
void finaleRun(); // sub_131_004
-
void sub_131_4dc0();
void sub_131_4e48();
- void sub_131_4e98();
+ void finaleStartText(); // sub_131_4e98
void sub_131_4f96();
private:
+ Toolbox *_toolbox;
ZBasic *_zbasic;
bool _quit = false;
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 717925c603d..019f2541908 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetReveal] + (x))
-extern Toolbox *g_toolbox;
+
// mask reveal puzzle
void FoolGame::revealRun() {
@@ -47,31 +47,31 @@ void FoolGame::revealRun() {
}
// 134:00ce
// rack up polygon information
- g_toolbox->SetPort(this->var_i32_f24);
+ _toolbox->SetPort(this->var_i32_f24);
this->arr_i16_1eb8[20] = 0;
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
this->var_i16_103a = puzzlesReadShort();
- _revealPoly[i] = g_toolbox->OpenPoly();
+ _revealPoly[i] = _toolbox->OpenPoly();
// 134:010e
for (int j = 5; j <= this->var_i16_103a - 1; j += 2) {
this->var_i16_484 = puzzlesReadShort();
this->var_i16_7e4 = puzzlesReadShort();
if (j == 5) {
- g_toolbox->MoveTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
+ _toolbox->MoveTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
} else {
- g_toolbox->LineTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
+ _toolbox->LineTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
}
// 134:015c
}
- g_toolbox->ClosePoly();
+ _toolbox->ClosePoly();
if (i <= this->arr_i16_1eb8[16]) {
this->arr_i16_1eb8[20] |= _bitLUT[i - 1];
}
// 134:01ce
}
// 134:01ea
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
this->arr_i16_1eb8[17] = (0x1c2 / this->arr_i16_1eb8[15]);
this->arr_i16_1eb8[18] = 0x100 - ((this->arr_i16_1eb8[15] * this->arr_i16_1eb8[17]) / 2);
@@ -97,16 +97,16 @@ void FoolGame::revealRun() {
this->var_i16_1aba += this->arr_i16_1eb8[17];
// 134:03fc
- g_toolbox->FillRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19, _patterns[0]);
- g_toolbox->FrameRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
+ _toolbox->FillRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19, _patterns[0]);
+ _toolbox->FrameRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
// 134:0448
this->var_str_384 = _zbasic->midStr(this->var_str_1272, this->var_i16_7be, 1);
- this->var_i16_7ba = g_toolbox->StringWidth(this->var_str_384);
- g_toolbox->MoveTo(
+ this->var_i16_7ba = _toolbox->StringWidth(this->var_str_384);
+ _toolbox->MoveTo(
_screenGrid[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
0x127
);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
// 134:04d6
if (this->arr_i16_1eb8[19] & _bitLUT[this->arr_i16_3738[this->var_i16_7be] - 1]) {
this->revealSelectButton();
@@ -120,7 +120,7 @@ void FoolGame::revealRun() {
// 134:0572
_activePuzzleSolved = false;
}
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
// 134:057a
// 134:057a: JMP - [0x61e]
// main event loop
@@ -153,7 +153,7 @@ void FoolGame::revealRun() {
_activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- g_toolbox->KillPoly(_revealPoly[i]);
+ _toolbox->KillPoly(_revealPoly[i]);
}
}
@@ -161,7 +161,7 @@ void FoolGame::revealOnClick() {
// 134:067c
this->var_i16_7be = 0;
for (int j = 1; j <= this->arr_i16_1eb8[15]; j++) {
- if (g_toolbox->PtInRect(_event.where, _screenGrid[j])) {
+ if (_toolbox->PtInRect(_event.where, _screenGrid[j])) {
this->var_i16_7be = j;
j = this->arr_i16_1eb8[15];
}
@@ -180,12 +180,12 @@ void FoolGame::revealOnClick() {
void FoolGame::revealSelectButton() {
// 134:074a
// invert the button
- g_toolbox->InvertRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
- g_toolbox->PenPat(_patterns[this->arr_i16_1eb8[21]]);
+ _toolbox->InvertRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
+ _toolbox->PenPat(_patterns[this->arr_i16_1eb8[21]]);
// fill the polygon
- g_toolbox->PenMode(kPatXor);
- g_toolbox->PaintPoly(_revealPoly[this->arr_i16_3738[this->var_i16_7be]]);
- g_toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
+ _toolbox->PaintPoly(_revealPoly[this->arr_i16_3738[this->var_i16_7be]]);
+ _toolbox->PenNormal();
}
void FoolGame::revealReset() {
@@ -193,7 +193,7 @@ void FoolGame::revealReset() {
this->fillRect(0x37, 0x13, 0xff, 0x1ee, 0);
for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
if (this->arr_i16_1eb8[19] & _bitLUT[this->arr_i16_3738[i]-1]) {
- g_toolbox->InvertRoundRect(_screenGrid[i], 0x19, 0x19);
+ _toolbox->InvertRoundRect(_screenGrid[i], 0x19, 0x19);
}
}
// 134:085c
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 91b689e002d..4c8a20abd36 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -29,7 +29,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetSentence] + (x))
-extern Toolbox *g_toolbox;
+
// sentence join game
void FoolGame::sentenceRun() {
@@ -51,7 +51,7 @@ void FoolGame::sentenceRun() {
// 135:00ce
this->var_i16_1066 = puzzlesReadShort();
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(this->var_i16_1066);
+ this->arr_i32_192c0[0] = _toolbox->GetPicture(this->var_i16_1066);
this->arr_i16_1eb8[0] = puzzlesReadShort();
_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
_sentenceGoal = puzzlesReadString().decode(Common::kMacRoman);
@@ -79,9 +79,9 @@ void FoolGame::sentenceRun() {
}
// 135:0348
_zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
- g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
- g_toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FillRect(temp, _patterns[2]);
this->arr_i16_1eb8[4] = 0;
for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
// 135:03a4
@@ -153,7 +153,7 @@ void FoolGame::sentenceOnClick() {
return;
// 135:0676
this->arr_i16_4338[this->var_i16_103a] = 0;
- g_toolbox->FillOval(_screenGrid[this->var_i16_103a], _patterns[2]);
+ _toolbox->FillOval(_screenGrid[this->var_i16_103a], _patterns[2]);
// 135:06aa
switch (this->arr_i16_4338[this->var_i16_103a + this->arr_i16_1eb8[0]]-1) {
case 0:
@@ -258,7 +258,7 @@ void FoolGame::sentenceUndo() {
// 135:09ba
this->arr_i16_1eb8[4] = 0;
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
- g_toolbox->FillRect(temp, _patterns[2]);
+ _toolbox->FillRect(temp, _patterns[2]);
for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
this->arr_i16_4338[this->var_i16_68a] = 1;
this->sentenceDrawButton();
@@ -271,17 +271,17 @@ void FoolGame::sentenceDrawButton() {
// 135:0a34
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + _zbasic->str(OFF(6)); // ' '
- this->var_i16_7e4 = g_toolbox->StringWidth(this->var_str_384);
- g_toolbox->FillOval(_screenGrid[this->var_i16_68a], _patterns[0]);
- g_toolbox->FrameOval(_screenGrid[this->var_i16_68a]);
- g_toolbox->MoveTo(_screenGrid[this->var_i16_68a].left + (this->arr_i16_1eb8[1] / 2) - (this->var_i16_7e4 / 2), 0x129);
- g_toolbox->DrawString(this->var_str_384);
+ this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_384);
+ _toolbox->FillOval(_screenGrid[this->var_i16_68a], _patterns[0]);
+ _toolbox->FrameOval(_screenGrid[this->var_i16_68a]);
+ _toolbox->MoveTo(_screenGrid[this->var_i16_68a].left + (this->arr_i16_1eb8[1] / 2) - (this->var_i16_7e4 / 2), 0x129);
+ _toolbox->DrawString(this->var_str_384);
}
void FoolGame::sentenceDrawBuffer() {
// 135:0b16
_zbasic->text(kFontLarge, 0x18, 0, kSrcOr);
- this->var_i16_484 = g_toolbox->StringWidth(_sentenceBuffer);
+ this->var_i16_484 = _toolbox->StringWidth(_sentenceBuffer);
if (this->var_i16_484 < this->arr_i16_1eb8[4]) {
this->var_i16_484 = this->arr_i16_1eb8[4];
} else {
@@ -291,9 +291,9 @@ void FoolGame::sentenceDrawBuffer() {
this->arr_i16_3738[1] = 0xf6 - (this->var_i16_484 / 2);
this->arr_i16_3738[3] = 0x109 + (this->var_i16_484 / 2);
Common::Rect temp(this->arr_i16_3738[1], this->arr_i16_3738[0], this->arr_i16_3738[3], this->arr_i16_3738[2]);
- g_toolbox->FillRect(temp, _patterns[0]);
- g_toolbox->MoveTo(0x100 - (this->var_i16_484 / 2), 0xd9);
- g_toolbox->DrawString(_sentenceBuffer);
+ _toolbox->FillRect(temp, _patterns[0]);
+ _toolbox->MoveTo(0x100 - (this->var_i16_484 / 2), 0xd9);
+ _toolbox->DrawString(_sentenceBuffer);
}
void FoolGame::sentenceStoreState() {
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index aea0a4872f1..fc4c119652b 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -28,7 +28,7 @@
namespace Fool {
-extern Toolbox *g_toolbox;
+
void FoolGame::straightPathRun() {
// 143:0004
@@ -42,7 +42,7 @@ void FoolGame::straightPathRun() {
var_i16_68a = arr_i16_1eb8[10];
do {
var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[var_i16_484],
var_i16_68a,
var_i16_68c,
@@ -79,7 +79,7 @@ void FoolGame::straightPathRun() {
temp.left = 0;
temp.bottom = temp.top + arr_i16_1eb8[7] + 2;
temp.right = SCREEN_WIDTH;
- g_toolbox->FillRect(temp, _patterns[0]);
+ _toolbox->FillRect(temp, _patterns[0]);
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
if (arr_i16_3b38[i*32 + j] == 0) {
@@ -87,12 +87,12 @@ void FoolGame::straightPathRun() {
arr_i16_3b38[i*32 + j] = _zbasic->rndInt(0x1a) + 0x40;
}
// 143:03f0
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[var_i16_1574].left + arr_i16_1eb8[2] - 1,
_screenGrid[var_i16_1574].top + arr_i16_1eb8[3]
);
var_str_384 = _zbasic->chr(arr_i16_3b38[i*32 + j]);
- g_toolbox->DrawString(var_str_384);
+ _toolbox->DrawString(var_str_384);
}
}
straightPathDrawText();
@@ -134,7 +134,7 @@ void FoolGame::straightPathOnClick() {
// 143:05c0
sub_128_2be(var_i16_68a, var_i16_68c);
if (var_i16_1574 > 0) {
- g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1574]);
var_i16_1574 = 0;
}
// 143:05fc
@@ -152,7 +152,7 @@ void FoolGame::straightPathOnClick() {
straightPathDrawText();
if (_activePuzzleStatus < arr_i16_1eb8[15]) {
var_i16_1574 = (var_i16_68c - 1)*arr_i16_1eb8[0] + var_i16_68a;
- g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1574]);
} else {
// 143:0766
if (_activePuzzleBuffer != var_str_1272.encode(Common::kMacRoman)) {
@@ -166,15 +166,15 @@ void FoolGame::straightPathOnClick() {
void FoolGame::straightPathReset() {
// 143:0784
if (var_i16_1574 > 0) {
- g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
// 143:07a4
for (int16 i = 0; i <= 0x14; i++) {
var_i16_1574 = _zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
- g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1574]);
playTone(_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
// 143:0812
- g_toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
_activePuzzleStatus = 0;
_activePuzzleBuffer.clear(); // was: str(367)
@@ -198,18 +198,18 @@ void FoolGame::straightPathClearText() {
void FoolGame::straightPathSuccess() {
// 143:08b0
- g_toolbox->PenMode(kPatBic);
- g_toolbox->PenPat(_patterns[1]);
+ _toolbox->PenMode(kPatBic);
+ _toolbox->PenPat(_patterns[1]);
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
if (arr_i16_2f38[i*32 + j] == 0) {
var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
- g_toolbox->PaintRect(_screenGrid[var_i16_1574]);
+ _toolbox->PaintRect(_screenGrid[var_i16_1574]);
}
// 143:0936
}
}
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
menuClickMessage();
waitForClick();
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 90290fb2631..4132a02102d 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -26,7 +26,7 @@
namespace Fool {
-extern Toolbox *g_toolbox;
+
// The Sun's map
void FoolGame::sunMapRun() {
@@ -43,7 +43,7 @@ void FoolGame::sunMapRun() {
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
this->var_i16_484++;
- g_toolbox->SetRect(_screenGrid[this->var_i16_484], i, j, i+0x24, j+0x24);
+ _toolbox->SetRect(_screenGrid[this->var_i16_484], i, j, i+0x24, j+0x24);
}
}
// 137:00fa
@@ -82,7 +82,7 @@ void FoolGame::sunMapRun() {
// 137:0336
_stateFlags = kStateNull;
_zbasic->menu(8, 3, 0, Common::U32String());
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
this->sunMapCheckIfSolved();
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
@@ -107,7 +107,7 @@ void FoolGame::sunMapRun() {
this->var_i16_68c = 0;
for (int j = 0; j <= 5; j++) {
for (int i = 1; i <= 0x51; i++) {
- g_toolbox->InvertRect(_screenGrid[i]);
+ _toolbox->InvertRect(_screenGrid[i]);
}
}
// 137:1654
@@ -135,9 +135,9 @@ void FoolGame::sunMapOnClick() {
// 137:0466
_menuDisabled = true;
_zbasic->menu(8, 3, 0, Common::U32String());
- g_toolbox->PenNormal();
- g_toolbox->PenSize(3, 3);
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(3, 3);
+ _toolbox->PenMode(kPatXor);
this->arr_i16_4758[0] = this->var_i16_68a;
this->arr_i16_4758[1] = this->var_i16_68c;
if (_puzzleFlags[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & kFlagMapTile) {
@@ -146,11 +146,11 @@ void FoolGame::sunMapOnClick() {
}
this->sunMapDragSelect();
// 137:0506
- g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->arr_i16_4758[0] -= this->var_i16_68a;
this->arr_i16_4758[1] -= this->var_i16_68c;
this->sunMapMoveSelected();
- g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->sunMapDropSelected();
this->sunMapCheckIfSolved();
this->waitForMouseUp();
@@ -187,9 +187,9 @@ void FoolGame::sunMapDragSelect() {
this->arr_i16_4758[13] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
// 137:084c
- g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->delay(2);
- g_toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
+ _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
this->delay(1);
} while (_event.what != kMouseUp);
// 137:087e
@@ -243,9 +243,9 @@ void FoolGame::sunMapMoveSelected() {
this->arr_rect_4776.left = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
- g_toolbox->FrameRect(this->arr_rect_4776);
+ _toolbox->FrameRect(this->arr_rect_4776);
this->delay(2);
- g_toolbox->FrameRect(this->arr_rect_4776);
+ _toolbox->FrameRect(this->arr_rect_4776);
this->delay(1);
} while (_event.what != kMouseDown);
}
@@ -358,7 +358,7 @@ void FoolGame::sunMapRevealPiece() {
temp.left = this->arr_i16_4758[1];
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
- g_toolbox->FrameRect(temp);
+ _toolbox->FrameRect(temp);
this->delay(1);
}
// 137:1550
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 3db5d018683..08350f21823 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetThoth] + (x))
-extern Toolbox *g_toolbox;
+
// high priestess challenge
void FoolGame::highPriestessRun() {
@@ -37,7 +37,7 @@ void FoolGame::highPriestessRun() {
this->thothAdjustPuzzleData();
}
if ((this->var_i16_7ce & 2) != 0) {
- g_toolbox->SetCursor(_cursors[0x10]);
+ _toolbox->SetCursor(_cursors[0x10]);
}
if (_activePuzzleStatus == 0) {
_menuHidesPlayfield = true;
@@ -60,7 +60,7 @@ void FoolGame::highPriestessRun() {
_activePuzzleStatus = 2;
}
// 140:007e
- g_toolbox->SetCursor(_cursors[0x10]);
+ _toolbox->SetCursor(_cursors[0x10]);
this->sub_140_2f92();
if (_activePuzzleStatus == 2) {
this->thothKey2nd();
@@ -111,15 +111,15 @@ void FoolGame::highPriestessRun() {
// 140:024c
if (_sunMapRestored == 0) {
// show the fake puzzle picture
- g_toolbox->PenNormal();
- this->arr_i32_192c0[0] = g_toolbox->GetPicture(0x78);
+ _toolbox->PenNormal();
+ this->arr_i32_192c0[0] = _toolbox->GetPicture(0x78);
_zbasic->picture(0, 0, this->arr_i32_192c0[0]);
- g_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
this->waitForClick();
}
// 140:02a2
if (!_screenOversized) {
- g_toolbox->SetPort(this->var_i32_8_thoth);
+ _toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
}
@@ -129,17 +129,17 @@ void FoolGame::highPriestessRun() {
_zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
_zbasic->put(_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kSrcCopy);
if (i % 2 == 0) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
// 140:0328
if (_sunMapRestored == 0) {
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x22; i++) {
- this->var_i32_692 = g_toolbox->TickCount();
- g_toolbox->InvertRect(area);
+ this->var_i32_692 = _toolbox->TickCount();
+ _toolbox->InvertRect(area);
this->sub_128_406(1);
}
// 140:037e
@@ -152,10 +152,10 @@ void FoolGame::highPriestessRun() {
if (i > 0xf0) {
this->var_i16_484 += 3;
}
- g_toolbox->MoveTo(this->var_i16_484 + 0x5f - _zbasic->rndInt(0x32), i);
- g_toolbox->LineTo(0x1a1 - this->var_i16_484 + _zbasic->rndInt(0x32), i);
+ _toolbox->MoveTo(this->var_i16_484 + 0x5f - _zbasic->rndInt(0x32), i);
+ _toolbox->LineTo(0x1a1 - this->var_i16_484 + _zbasic->rndInt(0x32), i);
if (i % 2 == 0) {
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
// 140:03f0
@@ -166,7 +166,7 @@ void FoolGame::highPriestessRun() {
this->sub_128_918(_zbasic->str(OFF(4))); // the book of thoth
this->var_i16_7a2 = 0xdc;
this->sub_128_918(_zbasic->str(OFF(5))); // so easily
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
this->waitForClick();
}
// 140:0450
@@ -206,21 +206,21 @@ void FoolGame::thoth99Enchantments() {
_zbasic->picture(0, 0x14, this->var_pic_7c2);
this->copyScreen(0, this->arr_bmp_b3ec);
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- g_toolbox->PenSize(5, 5);
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenMode(kPatXor);
for (int16 j = 0; j <= 1; j++) {
- g_toolbox->MoveTo(0x104, 0xa2);
- g_toolbox->LineTo(_screenGrid[i].left + 0x14, _screenGrid[i].top + 0x14);
- g_toolbox->InvertRoundRect(_screenGrid[i], 0x14, 0x14);
- g_toolbox->Delay(0);
+ _toolbox->MoveTo(0x104, 0xa2);
+ _toolbox->LineTo(_screenGrid[i].left + 0x14, _screenGrid[i].top + 0x14);
+ _toolbox->InvertRoundRect(_screenGrid[i], 0x14, 0x14);
+ _toolbox->Delay(0);
}
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
// 140:06cc
this->arr_i16_1eb8[2] = i;
this->thothDrawEnchantment();
}
// 140:06fc
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
this->sub_140_e3c();
this->arr_i16_4758[4] = 0x14;
this->arr_i16_4758[5] = 0;
@@ -239,7 +239,7 @@ void FoolGame::thoth99Enchantments() {
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:0752
- this->var_i32_692 = g_toolbox->TickCount();
+ this->var_i32_692 = _toolbox->TickCount();
this->arr_i16_1eb8[1]++;
this->arr_i16_1eb8[3]++;
if (this->arr_i16_1eb8[1] >= this->arr_i16_1eb8[0]) {
@@ -256,7 +256,7 @@ void FoolGame::thoth99Enchantments() {
temp.left = this->arr_i16_4758[5];
temp.bottom = this->arr_i16_4758[6];
temp.right = this->arr_i16_4758[7];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
// 140:07c4
// Phase 1: enchantments 99 to 34 are inverting and don't move
@@ -274,11 +274,11 @@ void FoolGame::thoth99Enchantments() {
// 140:0852
this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0] - this->arr_i16_1eb8[1];
if (this->arr_i16_1eb8[2] == this->arr_i16_1eb8[0]) {
- if ((this->var_i16_2328 == 1) && (g_toolbox->TickCount() > (this->var_i32_68e + 0x28))) {
+ if ((this->var_i16_2328 == 1) && (_toolbox->TickCount() > (this->var_i32_68e + 0x28))) {
this->var_i16_2328 = 0;
}
if (this->var_i16_2328 == 0) {
- this->var_i32_68e = g_toolbox->TickCount();
+ this->var_i32_68e = _toolbox->TickCount();
this->var_i16_2328 = 1;
this->thothMoveEnchantment();
}
@@ -317,7 +317,7 @@ void FoolGame::thoth99Enchantments() {
void FoolGame::thothMoveEnchantment() {
// 140:09f0
- g_toolbox->FillRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14, _patterns[2]);
+ _toolbox->FillRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14, _patterns[2]);
_screenGrid[this->arr_i16_1eb8[2]].top = _zbasic->rndInt(0x11a) + 0x14;
_screenGrid[this->arr_i16_1eb8[2]].left = _zbasic->rndInt(0x1da);
_screenGrid[this->arr_i16_1eb8[2]].bottom = _screenGrid[this->arr_i16_1eb8[2]].top + 0x28;
@@ -327,32 +327,32 @@ void FoolGame::thothMoveEnchantment() {
void FoolGame::thothDrawEnchantment() {
// 140:0b2c
- g_toolbox->PenNormal();
- g_toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
- g_toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ _toolbox->PenNormal();
+ _toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ _toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(OFF(10))
- this->var_i16_484 = g_toolbox->StringWidth(this->var_str_384);
+ this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
// 140:0bd2
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[this->arr_i16_1eb8[2]].left + 0x14 - (this->var_i16_484 / 2),
_screenGrid[this->arr_i16_1eb8[2]].top + 0x18
);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
}
void FoolGame::sub_140_c4c() {
// 140:0c4c
if (_activePuzzleSolved)
return;
- if (g_toolbox->PtInRect(_event.where, _screenGrid[this->arr_i16_1eb8[0]])) {
+ if (_toolbox->PtInRect(_event.where, _screenGrid[this->arr_i16_1eb8[0]])) {
this->arr_i16_1eb8[0]--;
if (this->arr_i16_1eb8[0] <= 0) {
_activePuzzleSolved = true;
return;
}
this->var_i16_484 = this->arr_i16_1eb8[0] + 1;
- g_toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x14, 0x14, _patterns[2]);
+ _toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x14, 0x14, _patterns[2]);
this->zoomRect(
_screenGrid[this->var_i16_484].top,
_screenGrid[this->var_i16_484].left,
@@ -375,15 +375,15 @@ void FoolGame::thothScrambleScreen() {
if (this->var_i16_2326 < 0) {
this->var_i16_2326 = 0;
}
- g_toolbox->InvertRect(this->thothRandomSquare());
- g_toolbox->InvertRect(this->thothRandomHRect());
- g_toolbox->InvertRect(this->thothRandomVRect());
+ _toolbox->InvertRect(this->thothRandomSquare());
+ _toolbox->InvertRect(this->thothRandomHRect());
+ _toolbox->InvertRect(this->thothRandomVRect());
Common::Rect temp;
temp.top = this->arr_i16_4758[4];
temp.left = this->arr_i16_4758[5];
temp.bottom = this->arr_i16_4758[6];
temp.right = this->arr_i16_4758[7];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
this->var_i16_2326++;
if (this->var_i16_2326 >= 4)
this->var_i16_2326 = 0;
@@ -412,8 +412,8 @@ void FoolGame::sub_140_e3c() {
void FoolGame::sub_140_f84() {
// 140:0f84
- g_toolbox->PenNormal();
- g_toolbox->PenSize(5, 5);
+ _toolbox->PenNormal();
+ _toolbox->PenSize(5, 5);
this->arr_i16_4758[4] = (_screenGrid[1].top / 0x19) + 1;
this->arr_i16_4758[5] = (_screenGrid[1].left / 0x19) + 1;
// 140:0fea
@@ -428,7 +428,7 @@ void FoolGame::sub_140_f84() {
area.left -= this->arr_i16_4758[5];
area.bottom += this->arr_i16_4758[6];
area.right += this->arr_i16_4758[7];
- g_toolbox->FrameRect(area);
+ _toolbox->FrameRect(area);
this->delay(1);
}
// 140:11ae
@@ -440,7 +440,7 @@ void FoolGame::sub_140_f84() {
area.left -= this->arr_i16_4758[5];
area.bottom += this->arr_i16_4758[6];
area.right += this->arr_i16_4758[7];
- g_toolbox->InvertRect(area);
+ _toolbox->InvertRect(area);
this->delay(1);
}
// 140:12f6
@@ -452,11 +452,11 @@ void FoolGame::thothKey1st() {
this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
_zbasic->picture(0, 0x14, this->var_pic_7c2);
if ((this->var_i16_7ce & 2) != 0) {
- g_toolbox->SetCursor(_cursors[0x10]);
+ _toolbox->SetCursor(_cursors[0x10]);
}
// 140:1346
- g_toolbox->PenSize(5, 5);
- g_toolbox->PenMode(kPatXor);
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenMode(kPatXor);
_event.where = Common::Point(0, 0);
// 140:139a
while (!(
@@ -467,14 +467,14 @@ void FoolGame::thothKey1st() {
)) {
// 140:1366
this->getNextEvent(-1); // was: 0
- g_toolbox->MoveTo(0x105, 0xa2);
- g_toolbox->LineTo(_event.where.x, _event.where.y);
+ _toolbox->MoveTo(0x105, 0xa2);
+ _toolbox->LineTo(_event.where.x, _event.where.y);
this->delay(2);
- g_toolbox->MoveTo(0x105, 0xa2);
- g_toolbox->LineTo(_event.where.x, _event.where.y);
+ _toolbox->MoveTo(0x105, 0xa2);
+ _toolbox->LineTo(_event.where.x, _event.where.y);
}
// 140:13dc
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
if ((this->var_i16_7ce & 2) == 0) {
_stateFlags = kStateReturn;
this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
@@ -531,28 +531,28 @@ void FoolGame::thothKey2nd() {
switch (this->var_i16_232e-1) {
case 0:
// 140:31b0
- g_toolbox->InvertRect(this->thothRandomSquare());
+ _toolbox->InvertRect(this->thothRandomSquare());
break;
case 1:
// 140:31c4
- g_toolbox->InvertRect(this->thothRandomHRect());
+ _toolbox->InvertRect(this->thothRandomHRect());
break;
case 2:
// 140:31d8
- g_toolbox->InvertRect(this->thothRandomVRect());
- g_toolbox->InvertRect(playArea);
+ _toolbox->InvertRect(this->thothRandomVRect());
+ _toolbox->InvertRect(playArea);
break;
case 3:
// 140:31fa
- g_toolbox->FillRect(this->thothRandomSquare(), _patterns[2]);
+ _toolbox->FillRect(this->thothRandomSquare(), _patterns[2]);
break;
case 4:
// 140:321a
- g_toolbox->FillRect(this->thothRandomHRect(), _patterns[2]);
+ _toolbox->FillRect(this->thothRandomHRect(), _patterns[2]);
break;
case 5:
// 140:323a
- g_toolbox->FillRect(this->thothRandomVRect(), _patterns[2]);
+ _toolbox->FillRect(this->thothRandomVRect(), _patterns[2]);
break;
default:
warning("thothKey2nd: breaking out of switch statement");
@@ -564,7 +564,7 @@ void FoolGame::thothKey2nd() {
temp.left = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+1];
temp.bottom = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+2];
temp.right = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+3];
- g_toolbox->FillRect(temp, _patterns[1]);
+ _toolbox->FillRect(temp, _patterns[1]);
}
// 140:159e
this->getNextEvent(-1);
@@ -593,7 +593,7 @@ void FoolGame::sub_140_15fc() {
temp.bottom = this->arr_i16_2f38[i*32+2];
temp.right = this->arr_i16_2f38[i*32+3];
- if (g_toolbox->PtInRect(_event.where, temp)) {
+ if (_toolbox->PtInRect(_event.where, temp)) {
this->var_i16_7e4 = i;
}
}
@@ -607,7 +607,7 @@ void FoolGame::sub_140_15fc() {
temp.left = this->arr_i16_4758[5];
temp.bottom = this->arr_i16_4758[6];
temp.right = this->arr_i16_4758[7];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
} else {
// 140:1698
@@ -618,7 +618,7 @@ void FoolGame::sub_140_15fc() {
temp.left = this->arr_i16_2f38[32*i+1];
temp.bottom = this->arr_i16_2f38[32*i+2];
temp.right = this->arr_i16_2f38[32*i+3];
- g_toolbox->EraseRect(temp);
+ _toolbox->EraseRect(temp);
}
// 140:16ce
for (int16 i = 1; i <= 0xc; i++) {
@@ -628,7 +628,7 @@ void FoolGame::sub_140_15fc() {
temp.left = this->arr_i16_2f38[32*j+1];
temp.bottom = this->arr_i16_2f38[32*j+2];
temp.right = this->arr_i16_2f38[32*j+3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
this->delay(2);
}
@@ -639,7 +639,7 @@ void FoolGame::sub_140_15fc() {
temp.bottom = this->arr_i16_2f38[32*this->var_i16_7e4+2];
temp.right = this->arr_i16_2f38[32*this->var_i16_7e4+3];
for (int16 i = 1; i <= 0x19; i++) {
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
// 140:173a
@@ -676,7 +676,7 @@ void FoolGame::sub_140_15fc() {
temp.left = this->arr_i16_4758[1];
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertRect(temp);
+ _toolbox->InvertRect(temp);
}
}
}
@@ -737,15 +737,15 @@ void FoolGame::thothKey3rd() {
switch (this->var_i16_232e-1) {
case 0:
// 140:325a
- g_toolbox->InvertRect(this->thothRandomSquare());
+ _toolbox->InvertRect(this->thothRandomSquare());
break;
case 1:
// 140:326e
- g_toolbox->InvertRect(this->thothRandomHRect());
+ _toolbox->InvertRect(this->thothRandomHRect());
break;
case 2:
// 140:3282
- g_toolbox->InvertRect(this->thothRandomVRect());
+ _toolbox->InvertRect(this->thothRandomVRect());
break;
default:
warning("thothKey3rd: broke out of switch");
@@ -760,7 +760,7 @@ void FoolGame::thothKey3rd() {
if (this->var_i16_232e > 0x10) {
this->var_i16_232e = 1;
}
- g_toolbox->FillRect(_screenGrid[this->var_i16_103a], _patterns[this->arr_i16_4338[this->var_i16_232e]]);
+ _toolbox->FillRect(_screenGrid[this->var_i16_103a], _patterns[this->arr_i16_4338[this->var_i16_232e]]);
}
// 140:1b66
this->getNextEvent(-1);
@@ -787,7 +787,7 @@ void FoolGame::thothKey3rdOnClick() {
}
} else {
// 140:1c22
- if (g_toolbox->PtInRect(_event.where, _screenGrid[this->var_i16_103a]) == 0) {
+ if (_toolbox->PtInRect(_event.where, _screenGrid[this->var_i16_103a]) == 0) {
this->var_i16_2332 = 0;
}
}
@@ -838,7 +838,7 @@ void FoolGame::thothKey3rdOnClick() {
if (area.top < 0x14) {
area.top = 0x14;
}
- g_toolbox->FillRect(area, _patterns[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
+ _toolbox->FillRect(area, _patterns[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
// 140:1e2e
if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
_event.modifiers = kModMouseButtonUp;
@@ -860,19 +860,19 @@ void FoolGame::sub_140_1f68() {
// 140:1f68
this->playTone(0xf, 0x64, 1);
this->var_i16_103a = 0;
- g_toolbox->PenSize(0x14, 0x14);
- g_toolbox->PenPat(_patterns[3]);
+ _toolbox->PenSize(0x14, 0x14);
+ _toolbox->PenPat(_patterns[3]);
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x104; i += 0x14) {
area.top = 0x14 + i;
area.left = i;
area.bottom = SCREEN_HEIGHT - i;
area.right = SCREEN_WIDTH - i;
- g_toolbox->FrameRect(area);
- g_toolbox->Delay(0);
+ _toolbox->FrameRect(area);
+ _toolbox->Delay(0);
}
// 140:2056
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
this->waitForMouseUp();
}
@@ -880,7 +880,7 @@ void FoolGame::sub_140_205e() {
// 140:205e
this->var_i16_103a++;
this->waitForMouseUp();
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
}
void FoolGame::thothKeyLast() {
@@ -902,24 +902,24 @@ void FoolGame::thothKeyLast() {
int hermitPathEndIndex = this->arr_i16_3b38[_hermitPathStage + 0x20]; // var_i16_2336
do {
this->getNextEvent(-1);
- g_toolbox->FillRect(_screenGrid[this->arr_i16_3738[hermitPathStartIndex]], _patterns[this->var_i16_2338]);
+ _toolbox->FillRect(_screenGrid[this->arr_i16_3738[hermitPathStartIndex]], _patterns[this->var_i16_2338]);
hermitPathStartIndex++;
// we're updating the screen in the event handler, this has no effect
/*if (_hermitPathStage == 5) {
if (hermitPathStartIndex % 4 == 0)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
} else {
if (hermitPathStartIndex % 8 == 0)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}*/
// 140:2168
} while (!((_event.what == 1) || (hermitPathStartIndex > hermitPathEndIndex) || ((_stateFlags & kStateReturn) != 0)));
// 140:219e
if ((_event.what == 0) && ((_stateFlags & kStateReturn) == 0)) {
if (_hermitPathStage != 5) {
- g_toolbox->Delay(0x7d*60/1000);
+ _toolbox->Delay(0x7d*60/1000);
} else {
- g_toolbox->Delay(0xfa*60/1000);
+ _toolbox->Delay(0xfa*60/1000);
}
}
// 140:21e8
@@ -930,7 +930,7 @@ void FoolGame::thothKeyLast() {
this->var_i16_68a = _zbasic->rndInt(0x14) - 1;
this->var_i16_68c = _zbasic->rndInt(0xe) - 1;
// 140:2222
- g_toolbox->FillRect(_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], _patterns[this->var_i16_484]);
+ _toolbox->FillRect(_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], _patterns[this->var_i16_484]);
this->getNextEvent(-1);
}
if (_event.what == 1) {
@@ -962,7 +962,7 @@ void FoolGame::thothKeyLastOnClick() {
// 140:23aa
this->arr_i16_1eb8[1] = this->arr_i16_1eb8[0];
this->playTone(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
- g_toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[2]);
+ _toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[2]);
this->var_i16_1de6++;
warning("thothKeyLastOnClick: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1));
}
@@ -984,7 +984,7 @@ void FoolGame::thothBadSelect() {
// 140:24c4
this->getNextEvent(-1);
this->var_i16_484 = _zbasic->rndInt(0x50);
- g_toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[this->var_i16_484]);
+ _toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[this->var_i16_484]);
}
// 140:2520
if (_activePuzzle != 0x34) {
@@ -992,7 +992,7 @@ void FoolGame::thothBadSelect() {
} else {
for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[_hermitPathStage]; i--) {
this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
- g_toolbox->FillRect(_screenGrid[this->arr_i16_3738[i]], _patterns[this->var_i16_484]);
+ _toolbox->FillRect(_screenGrid[this->arr_i16_3738[i]], _patterns[this->var_i16_484]);
}
}
// 140:25b4
@@ -1036,7 +1036,7 @@ void FoolGame::hermitScreenFlash() {
// limit the amount of continuous full-screen flashing to WCAG
// recommendation of 3/second
for (int16 i = 0; i <= 6; i++) { // was: 0x10
- g_toolbox->InvertRect(area);
+ _toolbox->InvertRect(area);
this->delay(10); // was: 1
}
}
@@ -1044,7 +1044,7 @@ void FoolGame::hermitScreenFlash() {
void FoolGame::hermitScreenZoom() {
// 140:26ca
this->sub_128_4da(0);
- g_toolbox->PenSize(0xa, 0x7);
+ _toolbox->PenSize(0xa, 0x7);
for (int16 j = 0; j <= 2; j++) {
// 140:26e0
@@ -1054,7 +1054,7 @@ void FoolGame::hermitScreenZoom() {
area.left += 0xa;
area.bottom -= 7;
area.right -= 0xa;
- g_toolbox->InvertRect(area);
+ _toolbox->InvertRect(area);
this->delay(1);
}
for (int16 i = 0; i <= 0x13; i++) {
@@ -1062,12 +1062,12 @@ void FoolGame::hermitScreenZoom() {
area.left -= 0xa;
area.bottom += 7;
area.right += 0xa;
- g_toolbox->InvertRect(area);
+ _toolbox->InvertRect(area);
this->delay(1);
}
}
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[1]);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[1]);
this->var_i16_1de6 = 0;
this->sub_128_4da(1);
}
@@ -1172,7 +1172,7 @@ void FoolGame::thothKeyLastSetup() {
this->var_i16_68a = this->arr_i16_1eb8[0xa];
do {
this->var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
@@ -1193,13 +1193,13 @@ void FoolGame::thothKeyLastSetup() {
}
// 140:2d94
if (_hermitPathStage != 6) {
- g_toolbox->PenPat(_patterns[1]);
+ _toolbox->PenPat(_patterns[1]);
for (int16 j = 0; j <= 0x13; j++) {
for (int16 i = 0; i <= 0xd; i++) {
- g_toolbox->EraseRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
- g_toolbox->FrameRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ _toolbox->EraseRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ _toolbox->FrameRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
if (((i + j*0xd) % 6) == 0)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
}
} else {
@@ -1209,12 +1209,12 @@ void FoolGame::thothKeyLastSetup() {
for (int16 j = 0; j <= 0xd; j++) {
// 140:2e8c
this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
- g_toolbox->FillRect(
+ _toolbox->FillRect(
_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
_patterns[this->var_i16_484]
);
if (((j + k*0xd) % 6) == 0)
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
this->var_i16_68a++;
if (this->var_i16_68a > 0x13) {
this->var_i16_68a = 0;
@@ -1280,7 +1280,7 @@ Common::Rect FoolGame::thothRandomVRect() {
void FoolGame::sub_140_3296() {
// 140:3296
if (!_screenOversized) {
- g_toolbox->SetPort(this->var_i32_8_thoth);
+ _toolbox->SetPort(this->var_i32_8_thoth);
} else {
this->sub_128_1ef8();
}
@@ -1290,24 +1290,24 @@ void FoolGame::sub_140_3296() {
void FoolGame::sub_140_32ac() {
// 140:33ac
this->sub_128_4da(0);
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
for (int16 j = 0; j <= 0x22; j++) {
for (int16 i = -5; i <= 0x159; i += 0xa) {
- g_toolbox->MoveTo(0, _zbasic->rndInt(0xa) + i);
- g_toolbox->LineTo(SCREEN_WIDTH, _zbasic->rndInt(0xa) + i);
+ _toolbox->MoveTo(0, _zbasic->rndInt(0xa) + i);
+ _toolbox->LineTo(SCREEN_WIDTH, _zbasic->rndInt(0xa) + i);
}
}
// 140:3300
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 1; i <= 0xd; i++) {
- this->var_i32_692 = g_toolbox->TickCount();
- g_toolbox->InvertRect(area);
+ this->var_i32_692 = _toolbox->TickCount();
+ _toolbox->InvertRect(area);
this->sub_128_406(1);
}
// 140:334a
- g_toolbox->FillRect(area, _patterns[2]);
+ _toolbox->FillRect(area, _patterns[2]);
this->sub_128_4da(1);
- g_toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(this->var_i32_0);
}
void FoolGame::thothAdjustPuzzleData() {
@@ -1325,9 +1325,9 @@ void FoolGame::thothAdjustPuzzleData() {
void FoolGame::sub_140_3412() {
// 140:3412
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
if ((this->var_i16_7ce & 2) == 0) {
- g_toolbox->InitCursor();
+ _toolbox->InitCursor();
}
}
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
index 5dea6864366..4601a28e3fa 100644
--- a/engines/fool/fool_threeships.cpp
+++ b/engines/fool/fool_threeships.cpp
@@ -28,7 +28,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetThreeShips] + (x))
-extern Toolbox *g_toolbox;
+
// three freakin' ships
void FoolGame::shipsRun() {
@@ -46,7 +46,7 @@ void FoolGame::shipsRun() {
this->var_i16_d0a = _zbasic->rndInt(5) - 0xa;
for (int16 i = 0; i <= 5; i++) {
_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ _toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->sub_128_5a6c();
}
// 128:5274
@@ -59,7 +59,7 @@ void FoolGame::shipsRun() {
_keyLastPressed = 0;
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
this->getNextEvent(-1);
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_19114) != 0) {
+ if (_toolbox->PtInRect(_event.where, this->arr_rect_19114) != 0) {
this->sub_128_55ac();
}
// 128:5348
@@ -80,7 +80,7 @@ void FoolGame::shipsRun() {
_event.where.x += 5;
_event.where.y -= 5;
if (_activePuzzleStatus < 0x64) {
- g_toolbox->SetCursor(_cursors[0x10]);
+ _toolbox->SetCursor(_cursors[0x10]);
}
for (int16 i = 1; i <= 1; i++) {
// 128:541c
@@ -99,7 +99,7 @@ void FoolGame::shipsRun() {
temp.left = this->arr_i16_4758[1];
temp.bottom = this->arr_i16_4758[2];
temp.right = this->arr_i16_4758[3];
- g_toolbox->InvertOval(temp);
+ _toolbox->InvertOval(temp);
}
}
// 128:5514
@@ -162,7 +162,7 @@ void FoolGame::sub_128_55ac() {
// 128:56a0
for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ _toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->sub_128_5a6c();
}
// 128:5708
@@ -193,7 +193,7 @@ void FoolGame::sub_128_57a2() {
if (this->var_str_d12 == _zbasic->str(OFF(6))) { // E
this->var_i16_d08 = 0x18;
}
- g_toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
+ _toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
this->var_i16_d08 = 0;
this->var_i16_d0a = 0;
// 128:58c2
@@ -215,7 +215,7 @@ void FoolGame::sub_128_57a2() {
this->arr_rect_1910c.right = 0x18;
}
this->sub_128_5a6c();
- if (g_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
_activePuzzleSolved = true;
}
}
@@ -230,14 +230,14 @@ void FoolGame::sub_128_57a2() {
void FoolGame::sub_128_5a6c() {
// 128:5a6c
- this->var_i32_692 = g_toolbox->TickCount();
+ this->var_i32_692 = _toolbox->TickCount();
_zbasic->get(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_rect_1910c.right, this->arr_rect_1910c.bottom, this->arr_bmp_bbbc);
//warning("sub_128_5a6c: bbbc surface");
//byte fakePal[768];
//Common::fill(fakePal, fakePal+3, 0xff);
//Common::fill(fakePal+3, fakePal+768, 0x00);
//this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
- g_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
+ _toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
this->sub_128_406(0);
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index ec7f2a4628a..2152a48dc37 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -29,7 +29,7 @@ namespace Fool {
#define OFF(x) (_zstrOffset[kOffsetWordSearch] + (x))
-extern Toolbox *g_toolbox;
+
// word search game
void FoolGame::wordSearchRun() {
@@ -46,7 +46,7 @@ void FoolGame::wordSearchRun() {
this->var_i16_68a = this->arr_i16_1eb8[0xa];
do {
this->var_i16_484++;
- g_toolbox->SetRect(
+ _toolbox->SetRect(
_screenGrid[this->var_i16_484],
this->var_i16_68a,
this->var_i16_68c,
@@ -139,12 +139,12 @@ void FoolGame::wordSearchRun() {
} while (this->var_i16_198e >= this->var_i16_1992);
// 131:0492
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
this->var_str_384 = this->var_str_188e;
this->wordSearchDrawFooter();
_zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PenMode(kPatBic);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PenMode(kPatBic);
_zbasic->unk_20();
// 131:04e0
for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
@@ -156,28 +156,28 @@ void FoolGame::wordSearchRun() {
temp.left = 0;
temp.bottom = _screenGrid[this->var_i16_1574].bottom + 1;
temp.right = SCREEN_WIDTH;
- g_toolbox->FillRect(temp, _patterns[0]);
+ _toolbox->FillRect(temp, _patterns[0]);
// 131:05b0
for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->var_i16_1574 = i + (j - 1) * this->arr_i16_1eb8[0];
this->var_str_384 = _zbasic->midStr(this->var_str_1994, i, 1);
this->arr_i16_3b38[i*32 + j] = _zbasic->asc(this->var_str_384);
- g_toolbox->MoveTo(
+ _toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
_screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
// 131:069e
if (this->arr_i16_2f38[i*32 + j] != 0) {
- g_toolbox->PaintRect(_screenGrid[this->var_i16_1574]);
+ _toolbox->PaintRect(_screenGrid[this->var_i16_1574]);
}
// 131:06dc
}
// 131:06f8
}
// 131:0714
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
if ((this->var_i16_1990 > 0) && (this->var_i16_1990 < this->var_i16_198e)) {
// only X to go
this->var_str_384 = _zbasic->str(OFF(3)) + Common::U32String::format(" %d", this->var_i16_198e - this->var_i16_1990) + _zbasic->str(OFF(4));
@@ -236,7 +236,7 @@ void FoolGame::wordSearchOnClick() {
this->var_i16_1a96 = this->var_i16_68a;
this->var_i16_1a98 = this->var_i16_68c;
this->var_str_1070 += _zbasic->chr(this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]);
- g_toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[this->var_i16_1574]);
this->var_i16_1a94++;
// 131:09c4
this->arr_i16_4338[this->var_i16_1a94] = this->var_i16_1574;
@@ -246,7 +246,7 @@ void FoolGame::wordSearchOnClick() {
}
}
// 131:09ec
- g_toolbox->Delay(0);
+ _toolbox->Delay(0);
}
debugC(5, kDebugLoading, "wordSearchOnClick: pos (%d, %d)", this->var_i16_1a96, this->var_i16_1a98);
// 131:09fc
@@ -279,18 +279,18 @@ void FoolGame::wordSearchOnClick() {
return;
}
// found a word, update the screen
- g_toolbox->PenNormal();
- g_toolbox->PenPat(_patterns[1]);
- g_toolbox->PenMode(kPatBic);
+ _toolbox->PenNormal();
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->PenMode(kPatBic);
// for every letter in the word
for (int i = 1; i <= this->var_i16_1a94; i++) {
// play a tone
this->playTone(0xa + _zbasic->rndInt(0x3e8), 0x28, 1);
// 131:0b54
// remove the inverted square
- g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
+ _toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
// paint the square with white checkerboard
- g_toolbox->PaintRect(_screenGrid[this->arr_i16_4338[i]]);
+ _toolbox->PaintRect(_screenGrid[this->arr_i16_4338[i]]);
this->var_i16_484 = ((this->arr_i16_4338[i] - 1) % this->arr_i16_1eb8[0]) + 1;
// 131:0bce
this->var_i16_7e4 = ((this->arr_i16_4338[i] - 1) / this->arr_i16_1eb8[0]) + 1;
@@ -298,7 +298,7 @@ void FoolGame::wordSearchOnClick() {
this->arr_i16_2f38[this->var_i16_484*32 + this->var_i16_7e4] = 1;
}
// 131:0c32
- g_toolbox->PenNormal();
+ _toolbox->PenNormal();
this->var_i16_1990++;
if (this->var_i16_1990 == this->var_i16_198e) {
this->var_str_384 = _zbasic->str(OFF(12)); // ' '
@@ -317,7 +317,7 @@ void FoolGame::wordSearchBadSelect() {
this->playTone(0x14, 0x64, 0);
// uninvert all highlighted boxes
for (int i = 1; i <= this->var_i16_1a94; i++) {
- g_toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
+ _toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
}
// 131:0d0a
this->var_i16_1a96 = -1;
@@ -383,14 +383,14 @@ void FoolGame::wordSearchSuccess() {
if (this->arr_i16_2f38[i*32 + j] != 0) {
// 131:0fc8
this->var_i16_1574 = i + (j - 1)* this->arr_i16_1eb8[0];
- g_toolbox->EraseRect(_screenGrid[this->var_i16_1574]);
- g_toolbox->MoveTo(
+ _toolbox->EraseRect(_screenGrid[this->var_i16_1574]);
+ _toolbox->MoveTo(
_screenGrid[this->var_i16_1574].left + this->arr_i16_1eb8[2] - 1,
_screenGrid[this->var_i16_1574].top + this->arr_i16_1eb8[3]
);
// 131:107a
this->var_str_384 = _zbasic->chr(this->arr_i16_3b38[i*32 + j]);
- g_toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(this->var_str_384);
}
// 131:10b0
}
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index f53261aba9b..cde2852cc2a 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS = \
fool.o \
fool_cards.o \
fool_death.o \
+ fool_finale.o \
fool_game.o \
fool_hermit.o \
fool_humbug.o \
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index d9c2e662e8f..2ff3375bc41 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -1305,6 +1305,8 @@ public:
void _injectFOND(int16 resID, const byte *data, const size_t size, const Common::String &name);
+ void _loadFonts(int16 resID);
+
private:
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
Common::Array<int16> _resOrder;
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index 91756cccba3..781cd1dbcee 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -34,6 +34,12 @@ void Toolbox::_injectFOND(int16 resID, const byte *data, const size_t size, cons
}
}
+void Toolbox::_loadFonts(int16 resID) {
+ if (_resMap.contains(resID)) {
+ g_engine->_wm._fontMan->loadFonts(_resMap[resID].get());
+ }
+}
+
int16 Toolbox::CurResFile() {
// Return whatever the first resource file is
if (_resOrder.empty())
@@ -145,7 +151,6 @@ int16 Toolbox::OpenResFile(const Common::Path &fileName) {
_resOrder.insert_at(0, result);
_nextResId++;
_resIndexStart = 0;
- g_engine->_wm._fontMan->loadFonts(res.get());
return result;
}
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index d7902c0df26..0ccf8391e87 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -42,21 +42,31 @@ void menuCommandsCallback(int action, Common::String &text, void *data) {
ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_memPool = new Common::MemoryPool(sizeof(int));
+
_window = g_engine->_wm.addWindow(false, false, false);
_window->disableBorder();
_window->resize(SCREEN_WIDTH, SCREEN_HEIGHT);
- g_engine->_wm.setBackgroundWindow(_window);
- _menu = g_engine->_wm.addMenu();
- _menu->setCommandsCallback(menuCommandsCallback, nullptr);
-
_toolbox->_defaultWindow = _window;
- _toolbox->_defaultMenu = _menu;
_toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
_window->setSurface(_toolbox->_defaultBits.get(), DisposeAfterUse::NO);
- _toolbox->_defaultMenuBits = BitMap(new Graphics::ManagedSurface());
- _toolbox->_defaultMenuBits->copyFrom(*_menu->getWindowSurface());
- _menu->setSurface(_toolbox->_defaultMenuBits.get(), DisposeAfterUse::NO);
+
+ g_engine->_wm.setBackgroundWindow(_window);
+ if (!g_engine->_wm.getMenu()) {
+ // no menu defined, create one for the first time
+ _menu = g_engine->_wm.addMenu();
+ _menu->setCommandsCallback(menuCommandsCallback, nullptr);
+
+ _toolbox->_defaultMenu = _menu;
+ _toolbox->_defaultMenuBits = BitMap(new Graphics::ManagedSurface());
+ _toolbox->_defaultMenuBits->copyFrom(*_menu->getWindowSurface());
+ _menu->setSurface(_toolbox->_defaultMenuBits.get(), DisposeAfterUse::NO);
+ } else {
+ // menu already exists
+ _menu = g_engine->_wm.getMenu();
+ _toolbox->_defaultMenu = _menu;
+ // we don't get the surface for directly manipulating the menu, but so far we don't need it
+ }
GrafPtr port(new GrafPort);
_toolbox->OpenPort(port);
_toolbox->SetPort(port);
@@ -64,6 +74,9 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
}
ZBasic::~ZBasic() {
+ g_engine->_wm.removeWindow(_window);
+ _window = nullptr;
+ _toolbox->_defaultWindow = nullptr;
delete _memPool;
_memPool = nullptr;
}
@@ -178,6 +191,11 @@ void ZBasic::loadProgram(const Common::Path &path) {
}
+void ZBasic::loadFonts() {
+ // tell ScummVM to load in the font information from this file
+ _toolbox->_loadFonts(_fileId);
+}
+
int16 ZBasic::asc(const Common::U32String &str) {
if (str.empty())
return 0;
@@ -569,6 +587,10 @@ Common::String ZBasic::rightStr(const Common::String &str, int16 expression) {
return str.substr(str.size() - expression, expression);
}
+void ZBasic::restore(uint32 index) {
+ _dataPtr = index;
+}
+
int16 ZBasic::rndInt(int16 max) {
if (max == 0)
return 0;
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index e83ac034bf0..de2874e1622 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -228,6 +228,7 @@ public:
void loadProgram(const Common::Path &path);
void loadSCOT();
+ void loadFonts();
int16 asc(const Common::U32String &str);
void bufferFlush(const Common::U32String &str);
@@ -269,6 +270,7 @@ public:
int16 readFileInt(int16 fileNo);
Common::String readFileStr(int16 fileNo, int16 length);
void record(int16 fileNo, int16 recordNo, int16 location);
+ void restore(uint32 index);
int16 rndInt(int16 max);
Common::U32String space(int16 count);
void swapInt(int16 &a, int16 &b);
Commit: 91f4ca6fcc4f63ec6fecd6b0721592d455d72e46
https://github.com/scummvm/scummvm/commit/91f4ca6fcc4f63ec6fecd6b0721592d455d72e46
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:30+02:00
Commit Message:
FOOL: Add more finale
Changed paths:
A engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
new file mode 100644
index 00000000000..e2502ecbb6d
--- /dev/null
+++ b/engines/fool/fool_finale.cpp
@@ -0,0 +1,919 @@
+/* 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/str.h"
+#include "common/str-enc.h"
+
+#include "common/ustr.h"
+#include "fool/fool.h"
+#include "fool/fool_prologue.h"
+#include "fool/toolbox.h"
+#include "fool/zbasic.h"
+
+namespace Fool {
+
+// run finale
+void FoolPrologue::finaleRun() {
+ // 131:0004
+ this->var_i16_3ce = 0x2d;
+ this->finaleDrawLoadingMsg();
+ this->var_i32_3d6 = _toolbox->OpenPoly();
+ _toolbox->MoveTo(0xc8, 0x8d);
+ _toolbox->LineTo(0x1df, 0xc8);
+ _toolbox->LineTo(0x1d2, 0x11b);
+ _toolbox->LineTo(0xcd, 0x93);
+ _toolbox->LineTo(0xc8, 0x8d);
+ _toolbox->ClosePoly();
+ // 131:004c
+ this->arr_i32_0[0x1f] = _toolbox->GetPicture(0x1f);
+ this->setPortBitsToPage(0x4);
+ _zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
+ this->finaleDrawLoadingMsg();
+ for (int i = 0x14; i <= 0x1e; i++) {
+ // 131:009c
+ this->arr_i32_0[i] = _toolbox->GetPicture(i);
+ if ((i % 3) == 0) {
+ this->var_i16_3ce += 5;
+ this->finaleDrawLoadingMsg();
+ }
+ }
+ // 131:00e6
+ for (int i = 6; i <= 9; i++) {
+ this->setPortBitsToPage(i);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ // 131:0110
+ if (i < 8) {
+ _zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
+ }
+ if (i == 8) {
+ _zbasic->picture(0, 0, this->arr_i32_0[0x1a]);
+ }
+ if (i == 9) {
+ _zbasic->picture(0x60, 0x4c, this->arr_i32_0[0x1b]);
+ }
+ }
+ // 131:0184
+ for (int i = 0x19; i <= 0x1b; i++) {
+ _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+ // 131:01aa
+ this->arr_i32_0[0x13] = _toolbox->GetPicture(0x13);
+ this->setPortBitsToPage(0x5);
+ _zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
+ _zbasic->picture(0, 0, this->arr_i32_0[0x18]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x13]);
+ _toolbox->ReleaseResource(this->arr_i32_0[0x18]);
+ this->finaleStartText();
+ this->var_i16_3ce = 0x4b;
+ this->finaleDrawLoadingMsg();
+ // 131:021e
+ for (int i = 0x20; i <= 0x2f; i++) {
+ this->arr_i32_0[i] = _toolbox->GetPicture(i);
+ if (i % 3) {
+ this->var_i16_3ce += 5;
+ this->finaleDrawLoadingMsg();
+ }
+ }
+ // 131:026e
+ this->var_i16_18e = SCREEN_HEIGHT;
+ this->shuffleScanlines();
+ this->var_i32_1a6 = _zbasic->mem(-1);
+ _toolbox->SetPortBits(this->var_i32_32);
+ if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
+ // 131:02ac
+ this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
+ } else {
+ _toolbox->SetPort(this->var_i32_c);
+ this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_8);
+ }
+ // 131:02ec
+ this->delay(0x3c);
+ this->zoomTransition(0x5);
+ this->sub_128_e58();
+ if (_quit)
+ return;
+
+ // xor out the start text
+ this->finaleStartText();
+ _zbasic->restore(0x4c);
+ for (int j = 1; j <= 0xe; j++) {
+ this->var_i16_3da = 1;
+
+ // 131:030c
+ this->var_i16_18e = _zbasic->readDataInt();
+ for (int i = 1; i <= this->var_i16_18e; i++) {
+ // 131:031a
+ this->arr_i16_1e8[i] = _zbasic->readDataInt();
+ this->arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
+ this->arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
+ }
+
+ // 131:0380
+ _toolbox->PenMode(kPatXor);
+ this->drawTreasurePhaseIn(0x14);
+ this->drawTreasurePhaseIn(0xa);
+ this->drawTreasurePhaseIn(0x14);
+ this->drawTreasurePhaseIn(0x5);
+ this->drawTreasurePhaseIn(0xa);
+ this->drawTreasurePhaseIn(0x5);
+ _toolbox->PenNormal();
+ this->drawTreasurePhaseIn(0x0);
+ }
+
+ // 131:03c0
+ this->delay(0x1e);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ // well, that's that!
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(22).encode().c_str());
+
+ // 131:0400
+ this->drawText(0x17c, 0xb4);
+ this->delay(0x1e);
+
+ // 131:041a
+ // fool nods and puts away map
+ _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
+ this->delay(0x2);
+ _zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
+ this->delay(0x3c);
+ _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
+ this->delay(0x6);
+ _zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
+ this->delay(0x6);
+ _zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
+ this->delay(0);
+
+ // 131:04b4
+ for (int i = 0x14; i <= 0x17; i++) {
+ _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+
+ // 131:04da
+ this->var_i32_2 = _toolbox->TickCount();
+
+ this->var_i32_40 = this->arr_i32_41296[5];
+ _toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ setPortBitsToPage(5);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ this->finaleDrawFoolUhOh();
+
+ // 131:0538
+ _toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ _toolbox->SetPortBits(this->var_i32_4e);
+
+ // 131:0554
+ this->fillRect(0, 0, 0xa0, 0x15e, 0);
+ this->fillRect(0xa0, 0x5a, 0xd2, 0xaa, 0);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+
+ // 131:05b0
+ this->setPortBitsToPage(6);
+ _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
+ this->setPortBitsToPage(7);
+ _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
+ this->setPortBitsToPage(8);
+ _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
+ this->setPortBitsToPage(9);
+ _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
+
+ // 131:0630
+ // tree morphing into priestess
+ _toolbox->SetPortBits(this->var_i32_32);
+ _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
+ this->delayFromMarker(0x3c);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ sub_128_50a(0x6, 0, SCREEN_WIDTH, 0x3);
+ this->finaleDrawFoolUhOh();
+
+ // 131:06aa
+ this->sub_128_50a(5, 0, SCREEN_WIDTH, 2);
+ this->sub_128_50a(7, 0, SCREEN_WIDTH, 2);
+ this->sub_128_50a(8, 0, SCREEN_WIDTH, 1);
+ this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ this->sub_128_50a(0x9, 0, SCREEN_WIDTH, 1);
+
+ // the wind picks up
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
+ _zbasic->unk_20();
+
+ // 131:0730
+ this->var_i16_3dc = 0;
+ this->var_i16_18e = 0;
+ for (int j = 1; j <= 0x63; j++) {
+ if (this->var_i16_3dc < SCREEN_HEIGHT) {
+ // 131:074e
+ this->var_i16_3dc += _zbasic->maybe() ? 0x4 : 0x5;
+ }
+ if (this->var_i16_18e < 0x41) {
+ // 131:0770
+ this->var_i16_18e += 1;
+ this->arr_i16_1e8[this->var_i16_18e] = _zbasic->rndInt(32);
+ this->arr_i16_1e8[this->var_i16_18e+0xfb] = _zbasic->rndInt(this->var_i16_3dc);
+ this->arr_i16_1e8[this->var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
+ this->sub_131_4f96(this->var_i16_18e);
+ }
+ // 131:07ea
+ for (int i = 1; i <= this->var_i16_18e; i++) {
+ this->sub_131_4f96(i);
+ this->arr_i16_1e8[i] += this->arr_i16_1e8[0x1f6+i]*2;
+
+ // 131:0870
+ if (this->arr_i16_1e8[i] > SCREEN_WIDTH) {
+ this->arr_i16_1e8[i] = 1;
+ this->arr_i16_1e8[0xfb+i] = _zbasic->rndInt(this->var_i16_3dc);
+ this->arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
+ }
+
+ // 131:0902
+ this->sub_131_4f96(i);
+ }
+ // Simulate slow redraw
+ _toolbox->Delay(0);
+ }
+
+
+ // 131:0926
+ _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->PenPat(this->arr_pat_194[3]);
+ _zbasic->picture(0x6d, 0x49, this->arr_i32_0[0x1c]);
+ _zbasic->picture(0x65, 0x48, this->arr_i32_0[0x1d]);
+ _zbasic->picture(0x64, 0x54, this->arr_i32_0[0x1e]);
+ // 131:099c
+
+ // zzzzap
+ _toolbox->PaintPoly(this->var_i32_3d6);
+ for (int i = 0; i <= 0x21; i++) {
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(this->arr_i16_1bc);
+ this->delayFromMarker(0);
+ }
+
+ // 131:09d2
+ this->sub_128_800(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ this->sub_128_800(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ this->sub_128_800(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ this->sub_128_800(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+
+ // 131:0a7a
+ // horrible flashing fool duplication spree
+ for (int i = 1; i <= 0x63; i++) {
+ this->var_i32_2 = _toolbox->TickCount();
+ this->var_i16_74 = _zbasic->rndInt(0x1ca);
+ this->var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, (i % 2) ? kSrcCopy : kNotSrcCopy);
+ // limit flashing to WCAG recommendation
+ if ((i % 10) == 0) {
+ _toolbox->InvertRect(this->arr_i16_1bc);
+ }
+ this->delayFromMarker(0);
+ }
+
+ // 131:0aec
+ // scrumble the contents of the screen for a few seconds
+ this->var_i32_2 = _toolbox->TickCount();
+
+ // 131:0af6
+ while (_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
+ this->var_i16_74 = _zbasic->rndInt(0x1ca);
+ this->var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_i16_192 + 0x5a, this->arr_i32_3bca4);
+
+ // 131:0b54
+ this->var_i16_74 = _zbasic->rndInt(0x1ca);
+ this->var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
+ _toolbox->Delay(0);
+ }
+
+ // 131:0bb0
+ // fade in to seascape
+ this->sub_128_50a(4, 0, SCREEN_WIDTH, 3);
+ this->setPortBitsToPage(5);
+ this->copyScreenToPage(5);
+ // fade in the fool
+ _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ _toolbox->SetPortBits(this->var_i32_32);
+ this->delay(0x3c);
+ this->sub_128_50a(5, 0, SCREEN_WIDTH, 0);
+
+ // fool looks around
+ _zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
+
+ // 131:0c36
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->KillPoly(this->var_i32_3d6);
+ for (int i = 0x1c; i < 0x1e; i++) {
+ _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+
+ // 131:0c6c
+ // high priestess becomes giant
+ for (int i = 0x6; i <= 0xa; i++) {
+ //_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
+ this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[5]);
+ }
+ this->setPortBitsToPage(0x6);
+ _zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
+ this->setPortBitsToPage(0x7);
+ _zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
+ this->setPortBitsToPage(0x8);
+ _zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
+ this->setPortBitsToPage(0x9);
+ _zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
+ this->setPortBitsToPage(0xa);
+ _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
+
+ // 131:0d64
+ for (int i = 0x20; i <= 0x23; i++) {
+ _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+ _toolbox->SetPortBits(this->var_i32_32);
+ this->delayFromMarker(0x64);
+ _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ for (int i = 0x6; i <= 0xa; i++) {
+ this->delay(0xf);
+ this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
+ }
+ _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
+ this->delay(0x3c);
+
+ // 131:0e08
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ // Are you still angry with me?
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(23).encode().c_str());
+ this->drawText(0x1f4 - _toolbox->StringWidth(this->var_str_76), 0xd2);
+ this->var_i32_2 = _toolbox->TickCount();
+
+ // 131:0e76
+ //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
+ this->arr_i32_41296[5]->copyFrom(*this->arr_i32_41296[4]);
+ this->setPortBitsToPage(0x5);
+ _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
+ _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
+ _zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
+ this->setPortBitsToPage(0x6);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
+ this->setPortBitsToPage(0x7);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
+ //_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
+ this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
+ this->setPortBitsToPage(0x8);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
+ this->arr_i32_41296[9]->copyFrom(*this->arr_i32_41296[4]);
+ this->setPortBitsToPage(0x9);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ this->setPortBitsToPage(0xa);
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+
+ // 131:1056
+ _toolbox->ReleaseResource(this->arr_i32_0[0x24]);
+ _toolbox->SetPortBits(this->var_i32_32);
+ this->delayFromMarker(0x78);
+ this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
+ this->sub_128_50a(0x5, 0x64, 0x19c, 0x0);
+ this->delay(0x28);
+
+ this->var_i16_5c.left = 0x118;
+ this->var_i16_5c.right = 0x1d1;
+ this->var_i16_5c.top = 0x19;
+ this->var_i16_64.left = 0x118;
+ this->var_i16_64.right = 0x1d1;
+ this->var_i16_64.bottom = 0xdf;
+
+ // wadjet eye appears from horizon
+ for (int i = 0xdc; i >= 0x19; i -= 5) {
+ // 131:10de
+ this->var_i32_2 = _toolbox->TickCount();
+ //_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
+ this->var_i32_4e->copyFrom(*this->arr_i32_41296[5]);
+ this->var_i16_64.top = i;
+ this->var_i16_5c.bottom = 0x19 + (0xdf - i);
+ // 131:1124
+ this->var_i32_40 = this->arr_i32_41296[6];
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcBic, nullptr);
+ this->var_i32_40 = this->arr_i32_41296[7];
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcOr, nullptr);
+ this->delayFromMarker(0x2);
+ _toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, kSrcCopy, nullptr);
+ }
+ _toolbox->Delay(0);
+
+ // 131:11a4
+ this->copyScreenToPage(0x5);
+ this->setPortBitsToPage(0x5);
+ this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ _toolbox->SetPortBits(this->var_i32_32);
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
+ _toolbox->PenSize(0x5, 0x5);
+
+ // 131:1208
+ for (int i = 0; i <= 0x1b8; i += 6) {
+ this->var_i32_2 = _toolbox->TickCount();
+ _toolbox->MoveTo(0x172, 0x33);
+ _toolbox->LineTo(i, 0x14a);
+ if (i == 0x4e) {
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ // yes, apparently so
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str());
+ this->drawTextRightAlign(0x1f4, 0xd2);
+ _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ }
+ this->delayFromMarker(0x2);
+ _toolbox->MoveTo(0x172, 0x33);
+ _toolbox->LineTo(i, 0x14a);
+ }
+
+ // 131:12cc
+ this->sub_128_800(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
+ // get turned into card
+ this->sub_128_50a(0x5, 0x12c, SCREEN_WIDTH, 0x1);
+ this->delay(0xec);
+
+ // fade out eye, then priestess, then seascape
+ for (int i = 8; i <= 0xa; i++) {
+ this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
+ }
+
+ this->var_i32_2 = _toolbox->TickCount();
+ this->setPortBitsToPage(0x5);
+
+ this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
+ _toolbox->SetPortBits(this->var_i32_32);
+ this->delayFromMarker(0xa);
+ this->var_i16_5c.left = 0x18b;
+ this->var_i16_5c.right = 0x1ef;
+ this->var_i16_64.left = 0x18b;
+ this->var_i16_64.right = 0x1ef;
+
+ // 131:13b8
+ // move the fool card up the screen
+ for (int i = 0xc0; i >= 0x15; i--) {
+ this->var_i32_2 = _toolbox->TickCount();
+ this->var_i16_5c.top = i;
+ this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
+ this->var_i16_64.top = i - 1;
+ this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
+ _toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, kSrcCopy, nullptr);
+ this->delayFromMarker(0);
+ }
+
+ // 131:1424
+ // fool turns
+ _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
+ this->delay(0x1);
+ _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
+ this->delay(0x1);
+ _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
+ this->copyScreenToPage(0x6);
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
+ _toolbox->PenSize(0x3, 0x3);
+ this->var_i16_6c.left = 0x190;
+ this->var_i16_6c.right = SCREEN_WIDTH;
+ this->var_i16_6c.top = 0x50;
+ this->var_i16_6c.bottom = SCREEN_HEIGHT;
+ this->var_i16_5c.left = 0;
+ this->var_i16_5c.right = 0x32;
+ this->var_i16_5c.top = 0;
+ this->var_i16_5c.bottom = 0x32;
+ this->var_i16_3e0 = 0x64;
+
+ // 131:14d8
+ // fool drops bindle
+ this->var_i32_40 = this->arr_i32_41296[5];
+ _toolbox->SetPortBits(this->var_i32_4e);
+ for (int i = 1; i <= 0xf; i++) {
+ this->var_i32_2 = _toolbox->TickCount();
+ //_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
+ this->var_i32_4e->copyFrom(*this->arr_i32_41296[6]);
+ this->var_i16_3e0 += 5 + i*2;
+ this->var_i16_64.left = 0x1e0;
+ this->var_i16_64.right = this->var_i16_64.left + 0x32;
+ this->var_i16_64.top = this->var_i16_3e0;
+ this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
+ _toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcXor, nullptr);
+ // 131:1582
+ _toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
+ _toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
+ _toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, kSrcCopy, nullptr);
+ this->delayFromMarker(0x1);
+ }
+
+ _toolbox->SetPortBits(this->var_i32_32);
+ _toolbox->PenNormal();
+ _toolbox->PenMode(kPatXor);
+ // 131:1606
+ for (int j = 0; j <= 1; j++) {
+
+ for (int i = 1; i <= 0xfa; i++) {
+ this->var_i32_2 = _toolbox->TickCount();
+
+ if (j == 0) {
+ this->arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
+ this->arr_i16_1e8[i+0xfb] = SCREEN_HEIGHT - _zbasic->rndInt(i);
+ }
+ // 131:1692
+ _toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
+ _toolbox->LineTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
+ if (i % 0x19 == 0) {
+ this->delayFromMarker(0x1);
+ }
+ }
+ }
+ // 131:1748
+ this->var_i32_2 = _toolbox->TickCount();
+ for (int i = 0x25; i <= 0x2f; i++) {
+ _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ }
+
+ this->delayFromMarker(0x3c);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ // well, this won't do
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(25).encode().c_str());
+ this->drawTextRightAlign(0x181, 0x3c);
+
+ // 131:17c8
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 0x30; i <= 0x31; i++) {
+ arr_i32_0[i] = _toolbox->GetPicture(i);
+ }
+ for (int16 i = 0x4b; i <= 0x52; i++) {
+ arr_i32_0[i] = _toolbox->GetPicture(i);
+ }
+ delayFromMarker(0xd2);
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
+ delay(1);
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ var_str_76 = _zbasic->chr(0x22) + _zbasic->str(26); // high priestess!
+ drawTextRightAlign(0x181, 0x3c);
+ var_str_76 = _zbasic->str(27); // am I to suffer this fate merely for uncovering
+ drawTextRightAlign(0x181, 0x4d);
+ var_str_76 = _zbasic->str(28) + _zbasic->chr(0x22); // the fourteen lost treasures of the land?
+ drawTextRightAlign(0x181, 0x5e);
+ for (int16 i = 0x30; i <= 0x31; i++) {
+ _toolbox->ReleaseResource(arr_i32_0[i]);
+ }
+ for (int16 i = 0x32; i <= 0x38; i++) {
+ arr_i32_0[i] = _toolbox->GetPicture(i);
+ if (i == 0x37) {
+ setPortBitsToPage(5);
+ _zbasic->picture(0, 0, arr_i32_0[0x37]);
+ _toolbox->ReleaseResource(arr_i32_0[0x37]);
+ _toolbox->SetPortBits(var_i32_32);
+ }
+ }
+ // 131:19be
+ sub_128_e1c();
+ sub_128_e58();
+ sub_128_e1c();
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ var_str_76 = _zbasic->chr(0x22) + _zbasic->str(29); // for if that be true
+ drawTextRightAlign(0x181, 0x3c);
+ var_str_76 = _zbasic->str(30); // I wish you had made the challenge more difficult
+ drawTextRightAlign(0x181, 0x4d);
+ var_str_76 = _zbasic->str(31); // after all, I am just a fool and I should not
+ drawTextRightAlign(0x181, 0x5e);
+ var_str_76 = _zbasic->str(32) + _zbasic->chr(0x22); // have been able to find them so easily
+ drawTextRightAlign(0x181, 0x6f);
+ arr_i16_41af4.top = 6;
+ arr_i16_41af4.left = 0xd0;
+ arr_i16_41af4.bottom = 0x6c;
+ arr_i16_41af4.right = 0x133;
+ arr_i16_41afc.top = 0xa;
+ arr_i16_41afc.left = 0xb4;
+ arr_i16_41afc.bottom = 0x1fc;
+ arr_i16_41afc.right = 0x1f6;
+ arr_i16_41b04[0] = 2;
+ arr_i16_41b04[1] = 0xa;
+ arr_i16_41b04[2] = 0xd;
+
+ // 131:1b6e
+ // unroll loops
+ arr_f64_41bbe[0] = (float)arr_i16_41af4.top;
+ arr_f64_41bbe[0+4] = (float)(arr_i16_41afc.top - arr_i16_41af4.top) / arr_i16_41b04[2];
+ arr_f64_41bbe[1] = (float)arr_i16_41af4.left;
+ arr_f64_41bbe[1+4] = (float)(arr_i16_41afc.left - arr_i16_41af4.left) / arr_i16_41b04[2];
+ arr_f64_41bbe[2] = (float)arr_i16_41af4.bottom;
+ arr_f64_41bbe[2+4] = (float)(arr_i16_41afc.bottom - arr_i16_41af4.bottom) / arr_i16_41b04[2];
+ arr_f64_41bbe[3] = (float)arr_i16_41af4.right;
+ arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_i16_41af4.right) / arr_i16_41b04[2];
+ // 131:1c24
+ _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenMode(kPatXor);
+ for (int16 j = 6; j <= 9; j++) {
+ arr_i32_41296[j]->copyFrom(*arr_i32_41296[j - 1]);
+ // 131:1c7a
+ setPortBitsToPage(j);
+ if (j == 6) {
+ _toolbox->PaintOval(arr_i16_41af4);
+ }
+ // 131:1c9c
+ for (int16 i = 0; i <= 2; i++) {
+ // unrolled loop
+ arr_f64_41bbe[0] += arr_f64_41bbe[0+4];
+ arr_i16_41b0a.top = (int16)arr_f64_41bbe[0];
+ arr_f64_41bbe[1] += arr_f64_41bbe[1+4];
+ arr_i16_41b0a.left = (int16)arr_f64_41bbe[1];
+ arr_f64_41bbe[2] += arr_f64_41bbe[2+4];
+ arr_i16_41b0a.bottom = (int16)arr_f64_41bbe[2];
+ arr_f64_41bbe[3] += arr_f64_41bbe[3+4];
+ arr_i16_41b0a.right = (int16)arr_f64_41bbe[3];
+ // 131:1d44
+ _toolbox->PaintOval(arr_i16_41b0a);
+ }
+ }
+ arr_i32_41296[10]->copyFrom(*arr_i32_41296[9]);
+ // 131:1d98
+ setPortBitsToPage(0xa);
+ _toolbox->PaintOval(arr_i16_41afc);
+ setPortBitsToPage(5);
+ _toolbox->SetRect(arr_i16_1bc, 0xae, 0x8c, 0xb6, 0x94);
+ _toolbox->InvertOval(arr_i16_1bc);
+ _toolbox->SetRect(arr_i16_1bc, 0x151, 0x86, 0x159, 0x8e);
+ _toolbox->InvertOval(arr_i16_1bc);
+ _toolbox->SetPortBits(var_i32_32);
+ sub_128_e1c();
+ sub_128_e58();
+
+ // 131:1e18
+ // card gets vivisected
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ fillRect(0x12c, 0x15e, 0x156, 0x200, 2);
+ var_i16_18e = 0;
+ for (int16 i = 0xa; i <= 0x96; i += 0xa) {
+ _zbasic->get(
+ 0x190,
+ i + 0xa,
+ 0x1ea,
+ i + 0x14,
+ arr_i32_1e3fc[i/0xa]
+ );
+ arr_i16_1e8[i + 0] = 0x190;
+ var_i16_18e++;
+ if (var_i16_18e > 4) {
+ var_i16_18e = 1;
+ }
+ arr_i16_1e8[i + 0xfb] = var_i16_18e;
+ }
+ // 131:1f1a
+ for (int16 j = 1; j <= 0xf; j++) {
+ if (j < 9) {
+ _toolbox->InvertRect(var_i16_38);
+ }
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 0xa; i <= 0x96; i += 0xa) {
+ _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
+ arr_i16_1e8[i] -= arr_i16_1e8[0xfb + i]*j;
+ _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ // 131:2062
+ }
+ // 131:2072
+ delayFromMarker(2);
+ }
+ for (int16 j = 1; j <= 0xf; j++) {
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 0xa; i <= 0x96; i += 0xa) {
+ _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
+ arr_i16_1e8[i] += arr_i16_1e8[0xfb + i]*j;
+ _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ }
+ delayFromMarker(2);
+ }
+
+ // 131:21e0
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x33]);
+ var_i16_1b6 = 0x14;
+ var_str_76 = _zbasic->str(33); // be content that you still live
+ for (int16 i = 1; i <= 0x18; i++) {
+ var_i32_2 = _toolbox->TickCount();
+ _zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
+ var_i16_1b6 += i;
+ drawText(5 + i*2, var_i16_1b6);
+ delayFromMarker(3);
+ }
+ // 131:2282
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x34]);
+ var_i32_2 = _toolbox->TickCount();
+ setPortBitsToPage(4);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
+ _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->PenMode(kPatOr);
+ _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PaintRect(arr_i16_1bc);
+ // 131:2316
+ arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0x4].get());
+ setPortBitsToPage(0xb);
+ _zbasic->picture(0xb5, 0xa, arr_i32_0[0x38]);
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0x1e);
+ _toolbox->PenNormal();
+ var_i16_3e6 = 0x17c;
+ for (int16 j = 0; j <= 0x14a; j++) {
+ var_i32_2 = _toolbox->TickCount();
+ if (j > 0xb4) {
+ var_i16_3e6 = SCREEN_WIDTH;
+ }
+ // 131:2398
+ for (int16 i = 0xa; i <= 0x14; i += 5) {
+ _toolbox->MoveTo(0, j + _zbasic->rndInt(i));
+ _toolbox->LineTo(var_i16_3e6, j + _zbasic->rndInt(i));
+ // 131:23d8
+ }
+ _toolbox->MoveTo(0, j);
+ _toolbox->LineTo(var_i16_3e6, j);
+ if ((var_i16_192 % 4) == 0) {
+ delayFromMarker(0);
+ }
+ // 131:2414
+ }
+
+ // 131:2422
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x35]);
+ delay(0x1e);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ // well I for one am not content
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(34).encode().c_str());
+ drawTextRightAlign(0x181, 0x3c);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(35).encode().c_str());
+ drawTextRightAlign(0x181, 0x4d);
+ sub_128_e1c();
+ sub_128_e58();
+ _zbasic->picture(0x193, 0x2d, arr_i32_0[0x36]);
+
+ // 131:24da
+ fillRect(0, 0, 0x96, 0x18b, 2);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ // show me one last puzzle if you dare
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(36).encode().c_str());
+ drawTextRightAlign(0x181, 0x3c);
+ var_str_76 = _zbasic->str(37);
+ drawTextRightAlign(0x181, 0x4d);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(38).encode().c_str());
+ drawTextRightAlign(0x181, 0x5e);
+ sub_128_e58();
+
+ // 131:258a
+ var_i32_40 = arr_i32_41296[5];
+
+ for (int16 i = 1; i <= 0x1a; i++) {
+ var_i16_5c.top = 0xab - (int16)(i*6.66f);
+ var_i16_5c.left = 0x100 - i*0xa;
+ var_i16_5c.bottom = 0xab + (int16)(i*6.66f);
+ var_i16_5c.right = 0x100 + i*0xa;
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
+ _toolbox->Delay(0);
+ }
+ // 131:266e
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
+ _toolbox->SetRect(arr_i16_1bc, 0xae, 0x8c, 0xb6, 0x94);
+ _toolbox->SetRect(arr_i32_1c4, 0x151, 0x86, 0x159, 0x8e);
+ _toolbox->InsetRect(arr_i16_1bc, 3, 3);
+ _toolbox->InsetRect(arr_i32_1c4, 3, 3);
+ _toolbox->FillOval(arr_i16_1bc, arr_pat_194[0]);
+ _toolbox->FillOval(arr_i32_1c4, arr_pat_194[0]);
+ _toolbox->Delay(0);
+ // 131:2720
+ for (int i = 1; i <= 3; i++) {
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InsetRect(arr_i16_1bc, -1, -1);
+ _toolbox->InsetRect(arr_i32_1c4, -1, -1);
+ _toolbox->FillOval(arr_i16_1bc, arr_pat_194[0]);
+ _toolbox->FillOval(arr_i32_1c4, arr_pat_194[0]);
+ delayFromMarker(1);
+ }
+ // 131:27a2
+ copyScreenToPage(5);
+ _toolbox->SetRect(arr_i16_1bc, 0xd0, 6, 0x133, 0x6c);
+ _toolbox->PenMode(kPatXor);
+ _toolbox->PenSize(3, 3);
+ var_i16_18e = 10;
+ for (int16 i = 355; i >= 180; i -= 5) {
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->FrameArc(arr_i16_1bc, i, var_i16_18e);
+ var_i16_18e += 10;
+ delayFromMarker(1);
+ }
+ // 131:281c
+ for (int16 i = 0; i <= 6; i++) {
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->FrameOval(arr_i16_1bc);
+ delayFromMarker(1);
+ }
+ // 131:284c
+ for (int16 i = 5; i <= 0xa; i++) {
+ var_i32_2 = _toolbox->TickCount();
+ blitPageToScreen(i);
+ delayFromMarker(1);
+ }
+ // 131:2878
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ for (int16 i = 0; i <= 0x1e; i++) {
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(arr_i16_1bc);
+ delayFromMarker(1);
+ }
+ // 131:28c2
+
+}
+
+void FoolPrologue::finaleDrawLoadingMsg() {
+ // FIXME: we don't share the menu surface here yet
+ return;
+ // 131:4dc0
+ _toolbox->SetPort(this->var_i32_c);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ // Loading Finale
+ this->var_str_76 = _zbasic->str(78);
+ this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
+ // 131:4e08
+ this->fillRect(0, 0, 7, 0x13, this->var_i16_10 - 7);
+
+ this->drawTextCenterAlign(this->var_i16_10 / 2, 0xe);
+ _toolbox->_defaultMenu->setOverlayDirty(true);
+ _toolbox->SetPort(this->var_i32_8);
+}
+
+void FoolPrologue::finaleDrawFoolUhOh() {
+ // 131:4e48
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+
+ // Uh oh . . .
+ this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(80).encode().c_str());
+
+ this->drawText(0x1ae, 0xb4);
+}
+
+void FoolPrologue::finaleStartText() {
+ // 131:4e98
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcXor);
+ this->var_i16_3fc = 0xa0;
+ // "And so the fool heeded the advice of the magician..."
+ this->var_str_76 = _zbasic->str(81);
+ this->drawText(0x96, this->var_i16_3fc);
+
+ this->var_str_76 = _zbasic->str(82);
+ this->drawText(0xa0, this->var_i16_3fc + 0xf);
+
+ this->var_str_76 = _zbasic->str(83);
+ this->drawText(0xaa, this->var_i16_3fc + 0x1e);
+
+ this->var_str_76 = _zbasic->str(84);
+ this->drawText(0xc8, this->var_i16_3fc + 0x2d);
+
+ this->var_str_76 = _zbasic->str(85);
+ this->drawText(0xe6, this->var_i16_3fc + 0x3c);
+
+ this->drawClickMessage();
+}
+
+void FoolPrologue::sub_131_4f96(int16 offset) {
+ // 131:4f96
+ _toolbox->MoveTo(
+ this->arr_i16_1e8[offset],
+ this->arr_i16_1e8[offset+0xfb]
+ );
+
+ // 131:4fd4
+ _toolbox->LineTo(
+ this->arr_i16_1e8[offset] + this->arr_i16_1e8[offset+0x1f6],
+ this->arr_i16_1e8[offset+0xfb]
+ );
+}
+
+
+} // End of namespace Fool
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 63c0e4ab6ae..4b2cf14d677 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -2376,7 +2376,7 @@ void FoolGame::menuPrologue() {
// this is brand new
this->copyScreen(0, this->arr_bmp_138bc);
FoolPrologue fp;
- fp.run();
+ fp.run(true);
this->copyScreen(1, this->arr_bmp_138bc);
_toolbox->DrawMenuBar();
}
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 16071977218..4503cdfcfe6 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -39,11 +39,11 @@ namespace Fool {
// v2.0 - fixes full-screen rendering on higher-resolution displays
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
-void FoolPrologue::run() {
+void FoolPrologue::run(bool finale) {
_toolbox = new Toolbox();
_zbasic = new ZBasic(_toolbox);
_zbasic->loadProgram(Common::Path("Prologue - Finale"));
- this->sub_128_004(false);
+ this->sub_128_004(finale);
delete _zbasic;
_zbasic = nullptr;
delete _toolbox;
@@ -93,6 +93,12 @@ void FoolPrologue::sub_128_004(bool finale) {
this->var_str_76 = _zbasic->str(1);
this->var_str_76 = _zbasic->str(2);
+ // fill graphics pages with white
+ for (int16 i = 0; i < 12; i++) {
+ setPortBitsToPage(i);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ }
+
// 128:01b6
// JMP 0x1f0
// JMP 0x21a
@@ -129,7 +135,7 @@ void FoolPrologue::sub_128_004(bool finale) {
_toolbox->ShowCursor();
}
-void FoolPrologue::sub_128_1ba(int16 screenPage) {
+void FoolPrologue::copyScreenToPage(int16 screenPage) {
// 128:01ba
this->var_i32_40 = this->arr_i32_41296[screenPage];
_toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
@@ -183,11 +189,9 @@ void FoolPrologue::zoomClose(int16 patternID, PatternMode mode) {
_toolbox->PenSize(6, 4);
for (int i = 0; i <= 130; i += 3) {
- this->var_i32_2 = _toolbox->TickCount();
-
_toolbox->FrameRect(this->arr_i16_1bc);
_toolbox->InsetRect(this->arr_i16_1bc, 6, 4);
- this->delayFromMarker(1);
+ this->delay(0);
}
_toolbox->PenNormal();
}
@@ -222,22 +226,22 @@ void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
}
-void FoolPrologue::sub_128_50a(int16 unk1, int16 left, int16 right, int16 screenPage) {
+void FoolPrologue::sub_128_50a(int16 screenPage, int16 left, int16 right, int16 updatePeriod) {
// 128:050a
this->var_i32_40 = this->arr_i32_41296[screenPage];
this->var_i16_5c.left = left;
this->var_i16_5c.right = right;
- if (unk1 == 0) {
- unk1 = 0x14;
+ if (updatePeriod == 0) {
+ updatePeriod = 0x14;
}
- if (unk1 == 1) {
- unk1 = 0x8;
+ if (updatePeriod == 1) {
+ updatePeriod = 0x8;
}
- if (unk1 == 2) {
- unk1 = 0x6;
+ if (updatePeriod == 2) {
+ updatePeriod = 0x6;
}
- if (unk1 == 3) {
- unk1 = 0x5;
+ if (updatePeriod == 3) {
+ updatePeriod = 0x5;
}
// 128:0584
for (int i = 0; i < SCREEN_HEIGHT; i++) {
@@ -245,7 +249,7 @@ void FoolPrologue::sub_128_50a(int16 unk1, int16 left, int16 right, int16 screen
this->var_i16_5c.top = this->arr_i16_412ea[i];
this->var_i16_5c.bottom = this->arr_i16_412ea[i] + 1;
_toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
- if (i % unk1 == 0) {
+ if (i % updatePeriod == 0) {
this->delayFromMarker(0);
}
}
@@ -291,14 +295,14 @@ void FoolPrologue::zoomTransition(int16 screenPage) {
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
// 128:0800
- this->arr_i16_41af4.top = unk9;
- this->arr_i16_41af4.left = unk8;
- this->arr_i16_41af4.bottom = unk7;
- this->arr_i16_41af4.right = unk6;
+ this->arr_i16_41af4.top = unk1;
+ this->arr_i16_41af4.left = unk2;
+ this->arr_i16_41af4.bottom = unk3;
+ this->arr_i16_41af4.right = unk4;
this->arr_i16_41afc.top = unk5;
- this->arr_i16_41afc.left = unk4;
- this->arr_i16_41afc.bottom = unk3;
- this->arr_i16_41afc.right = unk2;
+ this->arr_i16_41afc.left = unk6;
+ this->arr_i16_41afc.bottom = unk7;
+ this->arr_i16_41afc.right = unk8;
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
@@ -307,23 +311,25 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
this->arr_f64_41bbe[1] = (double)this->arr_i16_41af4.left;
this->arr_f64_41bbe[2] = (double)this->arr_i16_41af4.bottom;
this->arr_f64_41bbe[3] = (double)this->arr_i16_41af4.right;
- this->arr_f64_41bbe[4] = (double)(this->arr_i16_41af4.top - this->arr_i16_41afc.top)/(double)(this->var_i32_182);
- this->arr_f64_41bbe[5] = (double)(this->arr_i16_41af4.left - this->arr_i16_41afc.left)/(double)(this->var_i32_182);
- this->arr_f64_41bbe[6] = (double)(this->arr_i16_41af4.bottom - this->arr_i16_41afc.bottom)/(double)(this->var_i32_182);
- this->arr_f64_41bbe[7] = (double)(this->arr_i16_41af4.right - this->arr_i16_41afc.right)/(double)(this->var_i32_182);
+ this->arr_f64_41bbe[4] = (double)(this->arr_i16_41afc.top - this->arr_i16_41af4.top)/(double)(unk9);
+ this->arr_f64_41bbe[5] = (double)(this->arr_i16_41afc.left - this->arr_i16_41af4.left)/(double)(unk9);
+ this->arr_f64_41bbe[6] = (double)(this->arr_i16_41afc.bottom - this->arr_i16_41af4.bottom)/(double)(unk9);
+ this->arr_f64_41bbe[7] = (double)(this->arr_i16_41afc.right - this->arr_i16_41af4.right)/(double)(unk9);
// 128:096e
_toolbox->PaintRect(this->arr_i16_41af4);
- for (int i = 1; i < unk1 + 1; i++) {
+ for (int i = 1; i <= (unk9 - 1); i++) {
this->var_i32_2 = _toolbox->TickCount();
- for (int j = 0; j < 4; j++) {
- this->arr_f64_41bbe[j] = this->arr_f64_41bbe[j] + this->arr_f64_41bbe[j+4];
+ // 128:098c
+ for (int j = 0; j <= 3; j++) {
+ this->arr_f64_41bbe[j] += this->arr_f64_41bbe[j+4];
}
- this->arr_i16_41b0a.top = (int16_t)this->arr_f64_41bbe[0];
- this->arr_i16_41b0a.left = (int16_t)this->arr_f64_41bbe[1];
- this->arr_i16_41b0a.bottom = (int16_t)this->arr_f64_41bbe[2];
- this->arr_i16_41b0a.right = (int16_t)this->arr_f64_41bbe[3];
+ this->arr_i16_41b0a.top = (int16)this->arr_f64_41bbe[0];
+ this->arr_i16_41b0a.left = (int16)this->arr_f64_41bbe[1];
+ this->arr_i16_41b0a.bottom = (int16)this->arr_f64_41bbe[2];
+ this->arr_i16_41b0a.right = (int16)this->arr_f64_41bbe[3];
+ // 128:0a2e
_toolbox->PaintRect(this->arr_i16_41b0a);
this->delayFromMarker(0);
}
@@ -1105,7 +1111,7 @@ void FoolPrologue::prologueRun() {
if (_quit)
return;
- this->sub_128_50a(0x0, 0, SCREEN_WIDTH, 7);
+ this->sub_128_50a(7, 0, SCREEN_WIDTH, 0);
this->delay(0xa);
// "I dare"
this->blitPageToScreen(0x8);
@@ -1133,7 +1139,7 @@ void FoolPrologue::prologueBufferNextPicture() {
void FoolPrologue::prologueDrawLoadingMsg() {
// FIXME: we don't share the menu surface here yet
- return
+ return;
// 130:0d28
_toolbox->SetPort(this->var_i32_c);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index a05b3cf0c67..0a449b7720a 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -45,10 +45,10 @@ public:
FoolPrologue() {}
~FoolPrologue() {}
- void run();
+ void run(bool finale);
void sub_128_004(bool finale);
- void sub_128_1ba(int16 screenPage);
+ void copyScreenToPage(int16 screenPage); // sub_128_1ba
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
void delayFromMarker(int16 numTicks); // sub_128_24a
@@ -57,7 +57,7 @@ public:
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_2f0
void zoomClose(int16 patternID, PatternMode mode); // sub_128_354
void drawTreasurePhaseIn(int16 unk1); // sub_128_3ee
- void sub_128_50a(int16 unk1, int16 left, int16 right, int16 screenPage);
+ void sub_128_50a(int16 screenPage, int16 left, int16 right, int16 updatePeriod);
void blitPageToScreen(int16 screenPage); // sub_128_610
void scanlineTransition(int16 patternID); // sub_128_64a
void zoomTransition(int16 screenPage); // sub_128_6e4
@@ -87,10 +87,10 @@ public:
// fool_finale.cpp
void finaleRun(); // sub_131_004
- void sub_131_4dc0();
- void sub_131_4e48();
+ void finaleDrawLoadingMsg(); // sub_131_4dc0
+ void finaleDrawFoolUhOh(); // sub_131_4e48
void finaleStartText(); // sub_131_4e98
- void sub_131_4f96();
+ void sub_131_4f96(int16 offset);
private:
Toolbox *_toolbox;
@@ -172,6 +172,7 @@ private:
int16 var_i16_3dc;
int16 var_i16_3e0;
int16 var_i16_3e2;
+ int16 var_i16_3e6;
int16 var_i16_3fc;
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 2ff3375bc41..5a7be6dc568 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -1336,7 +1336,7 @@ private:
void _drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight);
void _drawBitsRect(Common::SeekableReadStream &stream, const Common::Rect &picFrame, bool compressed);
void _copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn);
- void _addDirtyRect(const Common::Rect &rect);
+ void _addDirtyRect(const BitMap &dest, const Common::Rect &rect);
};
} // namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 58572ccd0ce..6e191024b31 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -94,6 +94,15 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
if (maskRgn) {
warning("Toolbox::_copyBits: maskRgn unimplemented");
}
+ if (!srcRect.isValidRect()) {
+ warning("Toolbox::_copyBits: invalid src rectangle");
+ return;
+ }
+ if (!dstRect.isValidRect()) {
+ warning("Toolbox::_copyBits: invalid dst rectangle");
+ return;
+ }
+
Common::Rect clipSrcRect = srcRect;
Common::Rect clipDstRect = dstRect;
@@ -132,7 +141,7 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
}
}
Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(clipDstRect.left, clipDstRect.top), mode);
- _addDirtyRect(result);
+ _addDirtyRect(dstBits, result);
}
// maybe the better way of refactoring this would be to fork the Primitives
@@ -191,12 +200,12 @@ void Toolbox::EndUpdate(WindowRecord &theWindow) {
warning("STUB: Toolbox::EndUpdate");
}
-void Toolbox::_addDirtyRect(const Common::Rect &rect) {
- if (_port->portBits == _defaultBits) {
+void Toolbox::_addDirtyRect(const BitMap &dest, const Common::Rect &rect) {
+ if (dest == _defaultBits) {
_defaultWindow->addDirtyRect(rect);
_defaultWindow->setDirty(true);
}
- if (_port->portBits == _defaultMenuBits) {
+ if (dest == _defaultMenuBits) {
// _defaultMenu->addDirtyRect(dstRect);
_defaultMenu->setDirty(true);
}
@@ -234,7 +243,7 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
//mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
- _addDirtyRect(dstRect);
+ _addDirtyRect(_port->portBits, dstRect);
}
}
@@ -298,7 +307,7 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
debugC(5, kDebugGraphics, "Toolbox::_drawPoly: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
- _addDirtyRect(dstRect);
+ _addDirtyRect(_port->portBits, dstRect);
}
}
@@ -342,7 +351,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
debugC(5, kDebugGraphics, "Toolbox::_drawRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
- _addDirtyRect(dstRect);
+ _addDirtyRect(_port->portBits, dstRect);
}
}
@@ -381,7 +390,7 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
debugC(5, kDebugGraphics, "Toolbox::_drawRoundRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x, ovalWidth %d, ovalHeight %d", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor, ovalWidth, ovalHeight);
}
- _addDirtyRect(dstRect);
+ _addDirtyRect(_port->portBits, dstRect);
}
}
@@ -607,7 +616,7 @@ void Toolbox::LineTo(int16 h, int16 v) {
pm.drawLine(startPos.x, startPos.y, endPos.x, endPos.y, _port->fgColor, &pd);
Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
- _addDirtyRect(dstRect);
+ _addDirtyRect(_port->portBits, dstRect);
if (debugChannelSet(5, kDebugGraphics)) {
debugC(5, kDebugGraphics, "Toolbox::LineTo: startPos(%d, %d), endPos(%d, %d), dstRect (%d, %d) %dx%d, pattern %s, mode %d, fgColor %08x, bkColor %08x", _port->pnLoc.x, _port->pnLoc.y, h, v, dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), _port->pnPat.format().c_str(), _port->pnMode, _port->fgColor, _port->bkColor);
Commit: 0b60d052b3ce5693c09c56dfb0d677f84202e2a3
https://github.com/scummvm/scummvm/commit/0b60d052b3ce5693c09c56dfb0d677f84202e2a3
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:31+02:00
Commit Message:
FOOL: More finale
Changed paths:
engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.h
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index e2502ecbb6d..74d6c470acb 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -756,7 +756,7 @@ void FoolPrologue::finaleRun() {
}
_toolbox->MoveTo(0, j);
_toolbox->LineTo(var_i16_3e6, j);
- if ((var_i16_192 % 4) == 0) {
+ if ((j % 4) == 0) {
delayFromMarker(0);
}
// 131:2414
@@ -848,6 +848,251 @@ void FoolPrologue::finaleRun() {
delayFromMarker(1);
}
// 131:28c2
+ sub_128_50a(0xb, 0, SCREEN_WIDTH, 1);
+ arr_i32_41296[5]->copyFrom(*arr_i32_41296[11]);
+ setPortBitsToPage(5);
+ _zbasic->picture(0x16, 0xde, arr_i32_0[0x4b]);
+ // 131:2926
+ for (int16 i = 6; i <= 7; i++) {
+ arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
+ }
+ setPortBitsToPage(6);
+ _zbasic->picture(0x10, 0x54, arr_i32_0[0x4c]);
+ setPortBitsToPage(7);
+ _zbasic->picture(0x10, 0x54, arr_i32_0[0x4c]);
+ _zbasic->picture(0x2, 0x50, arr_i32_0[0x52]);
+ _toolbox->SetPortBits(var_i32_32);
+ delay(0x1e);
+ sub_128_50a(0x6, 0, SCREEN_WIDTH, 1);
+ delay(0x1e);
+ blitPageToScreen(7);
+ delay(0x48);
+ blitPageToScreen(6);
+ delay(0x1e);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ // 131:2a22
+ // now what have I gotten myself into?
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(39).encode().c_str());
+ drawText(0x3c, 0x2d);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(40).encode().c_str());
+ drawText(0x46, 0x3e);
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 6; i <= 0xa; i++) {
+ arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
+ }
+ setPortBitsToPage(6);
+ _zbasic->picture(0x15, 0x55, arr_i32_0[0x4d]);
+ setPortBitsToPage(7);
+ _zbasic->picture(0x1c, 0x57, arr_i32_0[0x4e]);
+ setPortBitsToPage(8);
+ _zbasic->picture(0x1c, 0x57, arr_i32_0[0x4f]);
+ setPortBitsToPage(9);
+ _zbasic->picture(0x1d, 0x58, arr_i32_0[0x50]);
+ setPortBitsToPage(0xa);
+ _zbasic->picture(0x1d, 0x58, arr_i32_0[0x51]);
+ // 131:2b7c
+ for (int16 i = 1; i <= 0xe; i++) {
+ arr_i16_1e8[i] = _zbasic->readDataInt();
+ arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
+ arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
+ arr_i16_1e8[i + 0x2f1] = _zbasic->readDataInt();
+ }
+ // 131:2c02
+ _zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcOr);
+ for (int16 i = 1; i <= 0xe; i++) {
+ // THEBOOKOFTHOTH
+ var_str_76 = _zbasic->midStr(_zbasic->str(41), i, 1);
+ drawText(arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ }
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ // that's it! the answer is the book of thoth
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(42).encode().c_str());
+ drawText(0x32, 0x2d);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(43).encode().c_str());
+ drawText(0x3c, 0x3e);
+ // 131:2cf6
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0xd2);
+ sub_128_e1c();
+ sub_128_e58();
+ sub_128_e1c();
+ blitPageToScreen(6);
+ delay(3);
+ blitPageToScreen(7);
+ delay(3);
+ blitPageToScreen(8);
+ var_i32_2 = _toolbox->TickCount();
+ // 131:2d3a
+ for (int16 i = 0x30; i <= 0x36; i++) {
+ _toolbox->ReleaseResource(arr_i32_0[i]);
+ }
+ _toolbox->ReleaseResource(arr_i32_0[0x38]);
+ for (int16 i = 0x4b; i <= 0x52; i++) {
+ _toolbox->ReleaseResource(arr_i32_0[i]);
+ }
+ for (int16 i = 0x29; i <= 0x2a; i++) {
+ arr_i32_0[i] = _toolbox->GetPicture(i);
+ }
+ for (int16 i = 0x53; i <= 0x5b; i++) {
+ arr_i32_0[i] = _toolbox->GetPicture(i);
+ }
+ delayFromMarker(0x96);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ // 131:2e1a
+ // wait, what's this?
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(44).encode().c_str());
+ _toolbox->MoveTo(0x46, 0x3e);
+ _toolbox->DrawString(var_str_76);
+ delay(0x96);
+ blitPageToScreen(0x9);
+ // 131:2e58
+ for (int16 i = 1; i <= 0xe; i++) {
+ var_str_76 = _zbasic->midStr(_zbasic->str(45), i, 1);
+ for (int16 l = 0; l <= 1; l++) {
+ var_i16_18e = 0x21;
+ for (int16 j = 0; j <= 1; j++) {
+ arr_f64_41bbe[j] = arr_i16_1e8[j*0xfb + i];
+ arr_f64_41bbe[j + 2] = (arr_i16_1e8[(j+2)*0xfb + i] - arr_i16_1e8[j*0xfb + i]) / var_i16_18e;
+ }
+ // 131:2f66
+ if (l == 0) {
+ _zbasic->text(kPrologueFontSmall, 9, 0, kSrcOr);
+ drawText(arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ }
+ // 131:2fc4
+ _zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcXor);
+ for (int16 k = 1; k <= var_i16_18e-1; k++) {
+ arr_f64_41bbe[0] += arr_f64_41bbe[0 + 2];
+ int16 x = (int16)arr_f64_41bbe[0];
+ arr_f64_41bbe[1] += arr_f64_41bbe[1 + 2];
+ int16 y = (int16)arr_f64_41bbe[1];
+ // 131:3078
+ drawText(x, y);
+ }
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ drawText(arr_i16_1e8[0x1f6 + i], arr_i16_1e8[0x2f1 + i]);
+ delay(1);
+ }
+ }
+ // 131:3130
+ delay(0x1e);
+ blitPageToScreen(0xa);
+ var_i32_2 = _toolbox->TickCount();
+ copyScreenToPage(0xa);
+ setPortBitsToPage(0xa);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ // that's it! the answer is the book of thoth
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(46).encode().c_str());
+ drawText(0x32, 0x2d);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(47).encode().c_str());
+ drawText(0x3c, 0x3e);
+ arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0xa]);
+ setPortBitsToPage(0xb);
+ arr_i16_41af4.top = 0xa;
+ arr_i16_41af4.left = 0xb4;
+ arr_i16_41af4.bottom = 0x14c;
+ arr_i16_41af4.right = 0x1f6;
+ _toolbox->InvertOval(arr_i16_41af4);
+ for (int16 i = 5; i <= 0x9; i++) {
+ arr_i32_41296[i]->copyFrom(*arr_i32_41296[4]);
+ }
+ // 131:327e
+ setPortBitsToPage(4);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, 0xdf);
+ _toolbox->InvertRect(arr_i16_1bc);
+ _zbasic->picture(0xd, 0xf0, arr_i32_0[0x58]);
+ _zbasic->picture(0x186, 0xc, arr_i32_0[0x59]);
+ setPortBitsToPage(5);
+ _zbasic->picture(0xf, 0x68, arr_i32_0[0x53]);
+ setPortBitsToPage(6);
+ _zbasic->picture(0x11, 0x8a, arr_i32_0[0x54]);
+ setPortBitsToPage(7);
+ _zbasic->picture(0x13, 0xa9, arr_i32_0[0x55]);
+ setPortBitsToPage(8);
+ _zbasic->picture(0x11, 0xcd, arr_i32_0[0x56]);
+ setPortBitsToPage(9);
+ _zbasic->picture(0xf, 0xf3, arr_i32_0[0x57]);
+ // 131:339c
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0x96);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ // that's it! the answer is the book of thoth
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(48).encode().c_str());
+ drawText(0x32, 0x2d);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(49).encode().c_str());
+ drawText(0x3c, 0x3e);
+ // 131:341c
+ sub_128_50a(0xb, 0xb0, 0x1f6, 0);
+ sub_128_50a(0x5, 0xb0, 0x1f6, 0);
+ delay(0xa);
+ for (int16 i = 5; i <= 9; i++) {
+ blitPageToScreen(i);
+ delay(3);
+ }
+ _zbasic->picture(0xd, 0xf0, arr_i32_0[0x58]);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, 0xdf);
+ // lightning flash in sky
+ for (int16 i = 0x1b; i >= 0; i--) {
+ _toolbox->InvertRect(arr_i16_1bc);
+ // this is fudged considerably
+ // 131:34c4
+ _toolbox->Delay(i/4);
+ }
+ // 131:34dc
+ blitPageToScreen(4);
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_3ec = 0x8c;
+ var_i16_3ee = 0x3c;
+ setPortBitsToPage(9);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x29]);
+ setPortBitsToPage(0xa);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x2a]);
+ _toolbox->SetPortBits(var_i32_32);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ // the book of thoth?
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(50).encode().c_str());
+ drawTextRightAlign(0x1a4, 0x2d);
+ var_i32_2 = _toolbox->TickCount();
+ arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
+ setPortBitsToPage(5);
+ _zbasic->picture(0x171, 0xb, arr_i32_0[0x5b]);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ // here is the book of thoth
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(51).encode().c_str());
+ drawTextRightAlign(0x1a4, 0x2d);
+ var_i16_5c.top = var_i16_3ee;
+ var_i16_5c.left = var_i16_3ec;
+
+ // 131:366e
+ var_i16_5c.bottom = var_i16_3ee + 100;
+ var_i16_5c.right = var_i16_3ec + 200;
+ var_i32_4e->copyFrom(*arr_i32_41296[4]);
+ var_i32_40 = arr_i32_41296[9];
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_5c, kSrcBic, 0);
+ var_i32_40 = arr_i32_41296[0xa];
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_5c, kSrcOr, 0);
+ for (int16 i = 6; i <= 8; i++) {
+ arr_i32_41296[i]->copyFrom(*var_i32_4e);
+ }
+ setPortBitsToPage(6);
+ _zbasic->picture(0x171, 0xb, arr_i32_0[0x5b]);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+
+ // here is the book of thoth
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(52).encode().c_str());
+ drawTextRightAlign(0x1a4, 0x2d);
+ setPortBitsToPage(7);
+ _zbasic->picture(0x181, 0xf, arr_i32_0[0x5a]);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ // and your answer is incorrect
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(53).encode().c_str());
+ drawTextRightAlign(0x1a4, 0x2d);
+ setPortBitsToPage(8);
+
+ // 131:3806
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 4b2cf14d677..a7bc0cad967 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -2373,6 +2373,15 @@ void FoolGame::menuAbout() {
}
void FoolGame::menuPrologue() {
+ // this is brand new
+ this->copyScreen(0, this->arr_bmp_138bc);
+ FoolPrologue fp;
+ fp.run(false);
+ this->copyScreen(1, this->arr_bmp_138bc);
+ _toolbox->DrawMenuBar();
+}
+
+void FoolGame::menuFinale() {
// this is brand new
this->copyScreen(0, this->arr_bmp_138bc);
FoolPrologue fp;
@@ -2432,6 +2441,8 @@ void FoolGame::sub_128_5c20() {
this->menuAbout();
} else if (_selectedMenuItem == 3) {
this->menuPrologue();
+ } else if (_selectedMenuItem == 4) {
+ this->menuFinale();
}
}
if (_selectedMenuID == 2) { // File menu
@@ -3083,7 +3094,8 @@ void FoolGame::sub_129_068() {
_zbasic->menu(1, 2, 1, Common::U32String("/FAbout Fool's Errand"));
// this is brand new
_zbasic->menu(1, 3, 1, Common::U32String("Show Prologue"));
- _zbasic->menu(1, 4, 0, Common::U32String("-"));
+ _zbasic->menu(1, 4, 1, Common::U32String("Show Finale"));
+ _zbasic->menu(1, 5, 0, Common::U32String("-"));
// File menu
_zbasic->menu(2, 0, 1, Common::U32String("File"));
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index a5eab46114d..b51d94fb18a 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -166,6 +166,7 @@ public:
void sub_128_4472();
void menuAbout(); // sub_128_4a92
void menuPrologue();
+ void menuFinale();
// fool_threeships.cpp
void shipsRun(); // sub_128_5140
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 0a449b7720a..fd5ea1a63d3 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -174,6 +174,9 @@ private:
int16 var_i16_3e2;
int16 var_i16_3e6;
+ int16 var_i16_3ec;
+ int16 var_i16_3ee;
+
int16 var_i16_3fc;
// picture resource handles
Commit: 4c674d9a08fd54291479835c1282b3510b150b3c
https://github.com/scummvm/scummvm/commit/4c674d9a08fd54291479835c1282b3510b150b3c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:31+02:00
Commit Message:
FOOL: Fix memory leak
Changed paths:
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 0ccf8391e87..843114f3ee7 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -67,9 +67,9 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_toolbox->_defaultMenu = _menu;
// we don't get the surface for directly manipulating the menu, but so far we don't need it
}
- GrafPtr port(new GrafPort);
- _toolbox->OpenPort(port);
- _toolbox->SetPort(port);
+ _defaultPort = new GrafPort;
+ _toolbox->OpenPort(_defaultPort);
+ _toolbox->SetPort(_defaultPort);
}
@@ -77,6 +77,15 @@ ZBasic::~ZBasic() {
g_engine->_wm.removeWindow(_window);
_window = nullptr;
_toolbox->_defaultWindow = nullptr;
+
+ GrafPtr test;
+ _toolbox->GetPort(test);
+ if (test == _defaultPort) {
+ _toolbox->SetPort(nullptr);
+ }
+ delete _defaultPort;
+ _defaultPort = nullptr;
+
delete _memPool;
_memPool = nullptr;
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index de2874e1622..3e983bb3474 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -213,6 +213,8 @@ private:
Graphics::MacWindow *_window;
Graphics::MacMenu *_menu;
+ GrafPtr _defaultPort;
+
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableWriteStream>> _fileWriteStreams;
Common::HashMap<int16, uint32> _fileLineSize;
Commit: 940a9a49673b1fd17daab8d9e179ad396731cb95
https://github.com/scummvm/scummvm/commit/940a9a49673b1fd17daab8d9e179ad396731cb95
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:31+02:00
Commit Message:
FOOL: Light refactoring
Changed paths:
engines/fool/fool.h
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_threeships.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
index 9f534b6b22e..74295a73c89 100644
--- a/engines/fool/fool.h
+++ b/engines/fool/fool.h
@@ -39,6 +39,7 @@
#define SCREEN_WIDTH 0x200
#define SCREEN_HEIGHT 0x156
+#define MENU_HEIGHT 0x14
#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8) // 0x5580
namespace Fool {
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index fdda4ed773c..4b22781239e 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -187,16 +187,13 @@ void FoolGame::cardsDrawTable() {
this->drawTarotCard(2, 5, 0);
this->drawTarotCard(3, 6, 0);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_i16_7a2 = 0xc3;
// 139:061a
- this->sub_128_918(_zbasic->str(OFF(0))); // Select a card above
- this->var_i16_7a2 = 0xd4;
- this->sub_128_918(_zbasic->str(OFF(1))); // or
+ this->drawStringCenter(_zbasic->str(OFF(0)), 0xc3); // Select a card above
+ this->drawStringCenter(_zbasic->str(OFF(1)), 0xd4); // or
_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_i16_7a2 = 0xe9;
- this->sub_128_918(_zbasic->str(OFF(2))); // Yield
+ this->drawStringCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
this->var_i16_2016 = 1;
this->var_i16_2010 = 1;
this->waitForMouseUp();
@@ -260,15 +257,16 @@ void FoolGame::cardsOnClick() {
this->sub_139_19da();
this->sub_139_191c();
this->sub_139_a22();
+ int16 strY = 0;
if (this->var_i16_2018 == 0) {
// 139:0920
this->cardsRevealHands();
- this->var_i16_7a2 = 0xc3;
+ strY = 0xc3;
} else {
// 139:092e
this->cardsOpponentYields();
- this->var_i16_7a2 = 0xd7;
+ strY = 0xd7;
}
// 139:0938
this->var_i16_2010 = 0;
@@ -281,7 +279,7 @@ void FoolGame::cardsOnClick() {
// original code has the font ID as 1... maybe there's a fallback?
// this was intended to be Small
_zbasic->text(kFontSmall, 9, Graphics::kMacFontRegular, kSrcBic);
- this->sub_128_918(_zbasic->str(OFF(3))); // (click mouse to continue)
+ this->drawStringCenter(_zbasic->str(OFF(3)), strY); // (click mouse to continue)
this->var_i16_2014 = 0;
_stateFlags = 0;
while ((_stateFlags == 0) && (this->var_i16_2014 == 0)) {
@@ -391,8 +389,7 @@ void FoolGame::cardsOpponentYields() {
this->var_i16_2012 = -CARDS_YIELD_PENALTY;
this->cardsDrawScores();
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_i16_7a2 = 0xc4;
- this->sub_128_918(_zbasic->str(OFF(4))); // The Old Man yields
+ this->drawStringCenter(_zbasic->str(OFF(4)), 0xc4); // The Old Man yields
}
void FoolGame::cardsRevealHands() {
@@ -518,14 +515,10 @@ void FoolGame::cardsRevealHands() {
this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
this->fillRect(0x2e, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_i16_7a2 = 0x46;
- this->sub_128_918(this->var_str_384);
- this->var_i16_7a2 = 0x64;
- this->sub_128_918(this->var_str_167c);
- this->var_i16_7a2 = 0x78;
- this->sub_128_918(_zbasic->str(OFF(16))); // beats
- this->var_i16_7a2 = 0x8c;
- this->sub_128_918(this->var_str_2222);
+ this->drawStringCenter(this->var_str_384, 0x46);
+ this->drawStringCenter(this->var_str_167c, 0x64);
+ this->drawStringCenter(_zbasic->str(OFF(16)), 0x78); // beats
+ this->drawStringCenter(this->var_str_2222, 0x8c);
if (this->arr_i16_1eb8[1] != 0) {
this->var_i16_68a = this->arr_i16_1eb8[1];
if (this->var_i16_68a > 8) {
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index c6dacd315c0..96f5c1f5a98 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -205,9 +205,9 @@ void FoolGame::deathDrawWhiteEye() {
void FoolGame::deathCaught() {
// 141:08b8
this->deathDrawWhiteEye();
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
this->zoomRect(_deathBlackEye.top, _deathBlackEye.left, _deathBlackEye.bottom, _deathBlackEye.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
}
void FoolGame::deathDrawZoom() {
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index a7bc0cad967..3f411af9cd5 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -168,7 +168,7 @@ void FoolGame::foolRun() {
_zbasic->unk_331(0x1b58, 1);
_zbasic->unk_331(0x1b58, 2);
- _toolbox->SetRect(_screenClipRect, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(_screenClipRect, 0, MENU_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
this->var_str_384 = _zbasic->str(0);
@@ -314,7 +314,7 @@ void FoolGame::foolRun() {
_zbasic->unk_158();
_zbasic->unk_4();
_toolbox->SetPort(this->var_i32_8);
- fillRect(0, 0, 0x14, _windowWidth, 2);
+ fillRect(0, 0, MENU_HEIGHT, _windowWidth, 2);
_toolbox->_defaultMenu->setOverlayDirty(true);
_toolbox->SetPort(this->var_i32_0);
}
@@ -422,48 +422,47 @@ void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
}
}
-void FoolGame::delay(int16 ticks) {
+void FoolGame::delay(int16 numTicks) {
// 128:03da
- this->var_i32_68e = _toolbox->TickCount();
+ uint32 prev = _toolbox->TickCount();
do {
_toolbox->Delay(0);
- } while (_toolbox->TickCount() < (this->var_i32_68e + ticks));
+ } while (_toolbox->TickCount() < (prev + numTicks));
}
-void FoolGame::sub_128_406(int16 unk1) {
+void FoolGame::delayFromMarker(int16 numTicks) {
// 128:0402
do {
_toolbox->Delay(0);
- } while (_toolbox->TickCount() < (this->var_i32_692 + unk1));
+ } while (_toolbox->TickCount() < (this->var_i32_692 + numTicks));
}
int16 FoolGame::puzzlesReadByte() {
// 128:0428
// read a byte
- this->var_i16_30 = *(byte *)(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- debugC(8, kDebugLoading, "Read[%04x]: %02x", this->_puzzleDataPtr, this->var_i16_30);
+ int16 data = *(byte *)(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %02x", this->_puzzleDataPtr, data);
this->_puzzleDataPtr += 1;
- return this->var_i16_30;
- return 0;
+ return data;
}
int16 FoolGame::puzzlesReadShort() {
// 128:0446
// read a short
- this->var_i16_30 = READ_BE_INT16(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- debugC(8, kDebugLoading, "Read[%04x]: %04x", this->_puzzleDataPtr, this->var_i16_30);
+ int16 data = READ_BE_INT16(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %04x", this->_puzzleDataPtr, data);
this->_puzzleDataPtr += 2;
- return this->var_i16_30;
+ return data;
}
int32 FoolGame::puzzlesReadLong() {
// 128:0462
// read a long
- this->var_i32_68e = READ_BE_INT32(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- debugC(8, kDebugLoading, "Read[%04x]: %08x", this->_puzzleDataPtr, this->var_i32_68e);
+ int32 data = READ_BE_INT32(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %08x", this->_puzzleDataPtr, data);
this->_puzzleDataPtr += 4;
- return this->var_i32_68e;
+ return data;
}
Common::String FoolGame::puzzlesReadString() {
@@ -476,31 +475,28 @@ Common::String FoolGame::puzzlesReadString() {
return result;
}
-void FoolGame::sub_128_4da(int16 unk1) {
+void FoolGame::toggleMouseCursor(bool visible) {
// toggle the mouse cursor off or on
// 128:04da
- if (unk1 == 0) {
- if (this->var_i16_7a0 == 1) {
+ if (!visible) {
+ if (this->_mouseVisible) {
_toolbox->HideCursor();
}
} else {
- if (this->var_i16_7a0 == 0) {
+ if (!this->_mouseVisible) {
_toolbox->ShowCursor();
}
}
- this->var_i16_7a0 = unk1;
+ this->_mouseVisible = visible;
}
-void FoolGame::playTone(int16 freq, int16 duration, int16 wait) {
+void FoolGame::playTone(int16 freq, int16 duration, bool wait) {
// 128:050e
// audio tone
- this->var_i16_34 = wait;
- this->var_i16_32 = duration;
- this->var_i16_30 = freq;
if (_soundEnabled) {
// the volume was originally 150, this is crazy loud.
- _zbasic->sound(this->var_i16_30, this->var_i16_32, 20, 0);
- if (this->var_i16_34 == 1) {
+ _zbasic->sound(freq, duration, 20, 0);
+ if (wait) {
while (_zbasic->soundBusy()) {
_toolbox->Delay(0);
}
@@ -582,12 +578,11 @@ void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16
_toolbox->FillRect(bounds, _patterns[patternID]);
}
-void FoolGame::sub_128_918(const Common::U32String &unk1) {
+void FoolGame::drawStringCenter(const Common::U32String &str, int16 yPos) {
// 128:0918
- _zbasic->stringCopy(this->var_str_172, unk1);
- this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
- _toolbox->MoveTo((SCREEN_WIDTH / 2) - (this->var_i16_30 / 2), this->var_i16_7a2);
- _toolbox->DrawString(this->var_str_172);
+ int16 width = _toolbox->StringWidth(str);
+ _toolbox->MoveTo((SCREEN_WIDTH / 2) - (width / 2), yPos);
+ _toolbox->DrawString(str);
}
void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps) {
@@ -658,7 +653,7 @@ void FoolGame::getNextEvent(uint32 unk1) {
_toolbox->Delay(0);
this->var_i16_78a = _toolbox->GetNextEvent(unk1, _event);
- if ((_event.what == kMouseDown) && (_event.where.y < 0x14)) {
+ if ((_event.what == kMouseDown) && (_event.where.y < MENU_HEIGHT)) {
this->onClickMenu();
}
// 128:0caa
@@ -722,9 +717,9 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
_toolbox->SetPort(this->var_i32_4);
this->var_i16_7b2 = 0xa;
_toolbox->InitCursor();
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
if (beep) {
- this->playTone(0x19, 0x64, 0);
+ this->playTone(0x19, 0x64, false);
}
// 128:0e46
this->copyScreen(0, this->arr_bmp_138bc);
@@ -766,14 +761,14 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
_toolbox->InsetRect(bounds, 5, 5);
_toolbox->FillRect(bounds, _patterns[2]);
_toolbox->PenNormal();
- this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
+ int16 strY = 0xbe - this->var_i16_7b6;
// 128:1056
for (int i = 0; i <= lineCount; i++) {
this->var_str_384 = _modalText[i];
- this->sub_128_918(this->var_str_384);
+ this->drawStringCenter(this->var_str_384, strY);
// 128:1086
// 128:1086: CLR.W - -0x772(A5)
- this->var_i16_7a2 += 0x11;
+ strY += 0x11;
}
// 128:10a0
if (buttonCount != 0) {
@@ -933,8 +928,8 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
_zbasic->menu(menuNo, itemNo, 1, _puzzleName[this->var_i16_30] + Common::U32String(" ~ ")); // was: str(9)
}
// 128:188a
- this->sub_128_4da(0);
- _zbasic->picture(0, 0x14, this->var_pic_7c2);
+ this->toggleMouseCursor(false);
+ _zbasic->picture(0, MENU_HEIGHT, this->var_pic_7c2);
_zbasic->text(kFontFool, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
for (int j = 0; j <= 1; j++) {
// 128:18c4
@@ -949,7 +944,7 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
);
// 128:1982
_toolbox->InvertRect(this->arr_rect_4338);
- this->sub_128_406(0);
+ this->delayFromMarker(0);
}
// 128:19a4
}
@@ -968,7 +963,7 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
this->var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(this->arr_rect_4338);
// this was 1, however the flashing was far too intense
- this->sub_128_406(8);
+ this->delayFromMarker(8);
}
for (int i = 1; i <= 0x24; i++) {
// 128:1a4c
@@ -978,8 +973,8 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
this->arr_rect_4338.bottom += (int)(i*0.05f);
this->arr_rect_4338.right += (int)(i*0.1f);
// 128:1b82
- if (this->arr_rect_4338.top < 0x14) {
- this->arr_rect_4338.top = 0x14;
+ if (this->arr_rect_4338.top < MENU_HEIGHT) {
+ this->arr_rect_4338.top = MENU_HEIGHT;
}
// 128:1bac
if (this->var_i16_32 == 0) {
@@ -995,9 +990,9 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
}
// 128:1c0a
// was 1
- this->sub_128_406(2);
+ this->delayFromMarker(2);
}
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
_toolbox->PenNormal();
}
@@ -1017,14 +1012,14 @@ void FoolGame::clearStateBits(uint16 bits) {
void FoolGame::sub_128_1ef8() {
// 128:1ef8
_toolbox->SetPort(this->var_i32_8);
- fillRect(0, 0, 0x14, _windowWidth, 2);
+ fillRect(0, 0, MENU_HEIGHT, _windowWidth, 2);
_toolbox->SetPort(this->var_i32_0);
}
void FoolGame::sub_128_1f1e() {
// 128:1f1e
_toolbox->InitCursor();
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
this->sub_128_bde(1, 1, kSrcCopy, 1, 1, 1);
}
@@ -1047,7 +1042,7 @@ void FoolGame::sub_128_1f76() {
this->var_i32_692 = _toolbox->TickCount();
this->sub_128_20d0();
// original was 5 ticks
- this->sub_128_406(10);
+ this->delayFromMarker(10);
// new: empty the event queue, so feedback is instant
_toolbox->FlushEvents(-1, 0);
this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
@@ -1193,27 +1188,27 @@ void FoolGame::storyRenderPage() {
}
// 128:252a
// y-position where the story text should start
- this->var_i16_7a2 = 0x11d - (_pageLines[_storyNextPage] * 0xf);
+ int16 strY = 0x11d - (_pageLines[_storyNextPage] * 0xf);
debugC(5, kDebugLoading, "FoolGame::storyRenderPage: storyNextPage %d, lines %d", _storyNextPage, _pageLines[_storyNextPage]);
if (_pageLines[_storyNextPage] < 0xf) {
- _toolbox->MoveTo(0xfa, this->var_i16_7a2-0xf);
+ _toolbox->MoveTo(0xfa, strY-0xf);
_toolbox->DrawString(Common::U32String("â")); // was: str(14)
- this->var_i16_7de = this->var_i16_7a2 - 0x1e;
+ this->var_i16_7de = strY - 0x1e;
} else {
// 128:25a6
- this->var_i16_7de = this->var_i16_7a2 - 0xf;
+ this->var_i16_7de = strY - 0xf;
}
// 128:25b6
// printing the story to the screen
- _toolbox->MoveTo(0x41, this->var_i16_7a2);
+ _toolbox->MoveTo(0x41, strY);
for (int i = _pageLineRanges[_storyNextPage*2]; i <= _pageLineRanges[_storyNextPage*2+1]; i++) {
_toolbox->TextFace(_pageLineFace[i]);
this->var_str_384 = _zbasic->index(0, i);
_toolbox->DrawString(this->var_str_384);
if (_pageLineBreak[i] != 0) {
// 128:262a
- this->var_i16_7a2 += 0xf;
- _toolbox->MoveTo(0x41, this->var_i16_7a2);
+ strY += 0xf;
+ _toolbox->MoveTo(0x41, strY);
}
// 128:263a
}
@@ -1571,15 +1566,15 @@ void FoolGame::sub_128_3032() {
fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_i16_7a2 = 0x3c;
+ int16 strY = 0x3c;
this->var_i16_7de = 0x2d;
// draw the first page of text
for (int i = 1; i <= 0xf; i++) {
// 128:31ec
- _toolbox->MoveTo(0x41, this->var_i16_7a2);
+ _toolbox->MoveTo(0x41, strY);
this->var_str_384 = _zbasic->index(0, i);
_toolbox->DrawString(this->var_str_384);
- this->var_i16_7a2 += 0xf;
+ strY += 0xf;
}
// 128:3228
this->copyScreen(0, this->arr_bmp_5dfc);
@@ -2121,7 +2116,7 @@ void FoolGame::sub_128_4472() {
}
if (this->arr_i16_4758[0] == 0) {
// user clicked the puzzle button, zoom-fill with pattern
- zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
+ zoomRect(0x130, 0x76, 0x130, 0x76, MENU_HEIGHT, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
return;
}
// 128:4520
@@ -2297,7 +2292,7 @@ void FoolGame::menuAbout() {
_toolbox->SetPort(this->var_i32_4);
this->var_i16_7b2 = 0xa;
_toolbox->InitCursor();
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
this->copyScreen(0, this->arr_bmp_138bc);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->var_i16_7b4 = 0;
@@ -2355,16 +2350,16 @@ void FoolGame::menuAbout() {
_toolbox->DrawString(Common::U32String("by Cliff Johnson")); // was: str(101)
// 128:509a
- this->var_i16_7a2 = 0xbe - this->var_i16_7b6;
+ int16 strY = 0xbe - this->var_i16_7b6;
for (int i = 0; i <= modalLines; i++) {
this->var_str_384 = _modalText[i];
- this->sub_128_918(this->var_str_384);
- this->var_i16_7a2 += 0x11;
+ this->drawStringCenter(this->var_str_384, strY);
+ strY += 0x11;
}
// 128:50f4
_zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, kSrcOr);
- this->var_i16_7a2 += 0xe;
- this->sub_128_918(_zbasic->str(_zstrOffset[kOffsetVersion])); // version string
+ strY += 0xe;
+ this->drawStringCenter(_zbasic->str(_zstrOffset[kOffsetVersion]), strY); // version string
this->menuClickMessage();
this->waitForClick();
_toolbox->DrawMenuBar();
@@ -2523,7 +2518,7 @@ void FoolGame::sub_128_5c20() {
void FoolGame::thothHidePlayfield() {
// 128:5ef0
this->copyScreen(0, this->arr_bmp_b3ec);
- _zbasic->picture(0, 0x14, this->var_pic_7c2);
+ _zbasic->picture(0, MENU_HEIGHT, this->var_pic_7c2);
}
void FoolGame::thothShowPlayfield() {
@@ -2563,9 +2558,9 @@ void FoolGame::sub_128_5fea() {
if (_screenOversized) {
_toolbox->SetPort(this->var_i32_8);
_toolbox->PenNormal();
- fillRect(0x14, 0, _windowHeight, this->var_i16_56-3, 2);
- fillRect(0x14, 0, this->var_i16_58+0x11, _windowWidth, 2);
- fillRect(0x14, this->var_i16_56+0x203, _windowHeight, _windowWidth, 2);
+ fillRect(MENU_HEIGHT, 0, _windowHeight, this->var_i16_56-3, 2);
+ fillRect(MENU_HEIGHT, 0, this->var_i16_58+0x11, _windowWidth, 2);
+ fillRect(MENU_HEIGHT, this->var_i16_56+0x203, _windowHeight, _windowWidth, 2);
fillRect(this->var_i16_58 + 0x159, 0, _windowHeight, _windowWidth, 2);
Common::Rect bounds; // arr_rect_5b7c
_toolbox->SetRect(bounds, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
@@ -2672,8 +2667,8 @@ void FoolGame::sub_129_068() {
this->var_i16_7ce = 666;
this->var_i16_372 = { 0, 0, 0 };
_soundEnabled = true;
- this->var_i16_7a0 = 1;
- this->sub_128_4da(0);
+ this->_mouseVisible = true;
+ this->toggleMouseCursor(false);
for (size_t i = 0; i <= 3; i++) {
_patterns[1].data[2*i] = 0xaa;
_patterns[1].data[2*i+1] = 0x55;
@@ -2836,14 +2831,14 @@ void FoolGame::sub_129_068() {
do {
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcBic);
fillRect(0x17, 0x92, 0x31, 0x16e, 2);
- this->var_i16_7a2 = 0x28;
+ //this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
this->sub_128_1e4(Common::U32String("PUZZ")); // was: str(137)
// 129:06a6: CLR.W - -0x772(A5)
fillRect(0x17, 0x92, 0x31, 0x16e, 1);
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
if (this->var_str_588.empty()) { // was: str(138)
_zbasic->unk_4();
}
@@ -2863,7 +2858,7 @@ void FoolGame::sub_129_068() {
_toolbox->DetachResource(h);
}
// 129:07a2
- _zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ _zbasic->picture(0, MENU_HEIGHT, this->arr_i32_192c0[0]);
_zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, this->arr_bmp_5dfc);
_zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, this->arr_bmp_b3ec);
_zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
@@ -3082,11 +3077,11 @@ void FoolGame::sub_129_068() {
}
// 129:108c
_toolbox->UseResFile(this->var_i16_1030);
- this->sub_128_406(0xc8);
+ this->delayFromMarker(0xc8);
this->var_i16_7ce = 0;
this->var_i16_7b2 = 0xa;
_toolbox->InitCursor();
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
// The menus are so different between versions, it's easiest to hardcode the v2.0 ones.
// Apple menu
_zbasic->menu(1, 0, 1, Common::U32String("~")); // wadjet eye, was: str(143)
@@ -3149,7 +3144,7 @@ void FoolGame::sub_144_004() {
_stateFlags = kStateQuit;
if (!_screenOversized) {
_toolbox->SetPort(var_i32_8);
- fillRect(0, 0, 0x14, SCREEN_WIDTH, 0x47);
+ fillRect(0, 0, MENU_HEIGHT, SCREEN_WIDTH, 0x47);
_toolbox->SetPort(var_i32_0);
} else {
// 144:0046
@@ -3158,7 +3153,7 @@ void FoolGame::sub_144_004() {
// 144:004a
autoSaveGame(); // was: saveGame
_toolbox->InitCursor();
- sub_128_4da(0);
+ toggleMouseCursor(false);
if (!_screenOversized) {
var_i16_42 = 0;
var_i16_44 = 0xab;
@@ -3179,7 +3174,7 @@ void FoolGame::sub_144_004() {
SCREEN_HEIGHT - (int16)(i*0.6f),
arr_bmp_5dfc, kSrcCopy);
// 144:015a
- sub_128_406(0xf);
+ delayFromMarker(0xf);
}
// 144:0170
delay(0x3c);
@@ -3195,13 +3190,13 @@ void FoolGame::sub_144_004() {
var_i16_44 + (int16)(i*0.7f)
);
_toolbox->InvertRect(temp);
- sub_128_406(1);
+ delayFromMarker(1);
}
// 144:0238
for (int16 i = 0; i <= 0xe; i++) {
var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(temp);
- sub_128_406(1);
+ delayFromMarker(1);
}
// 144:0268
// Every version has a slightly different end message, and all
@@ -3222,7 +3217,7 @@ void FoolGame::sub_144_004() {
_toolbox->DrawMenuBar();
}
sub_128_1f1e();
- sub_128_4da(1);
+ toggleMouseCursor(true);
// 144:03e2
// write the finale file to the disk. we don't need to do this
//if (_saveFileName.empty()) {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index b51d94fb18a..9cceb98f439 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -98,21 +98,21 @@ public:
void sub_128_1e4(const Common::U32String &unk1);
void sub_128_2be(int16 unk2, int16 unk1);
void sub_128_342(int16 unk2, int16 unk1);
- void delay(int16 ticks); // sub_128_3da
- void sub_128_406(int16 unk1);
+ void delay(int16 numTicks); // sub_128_3da
+ void delayFromMarker(int16 numTicks); // sub_128_406
int16 puzzlesReadByte(); // sub_128_428
int16 puzzlesReadShort(); // sub_128_446
int32 puzzlesReadLong(); // sub_128_462
Common::String puzzlesReadString(); // sub_128_49a
- void sub_128_4da(int16 unk1);
- void playTone(int16 freq, int16 duration, int16 wait);
+ void toggleMouseCursor(bool visible); // sub_128_4da
+ void playTone(int16 freq, int16 duration, bool wait);
void drawPuzzleButton(const Common::U32String &symbol); // sub_128_55c
int16 sub_128_5fe();
OSErr sub_128_64c(int16 unk1);
void fillRect(int16 patternID, PatternMode mode, int16 top, int16 left, int16 bottom, int16 right); // sub_128_69c
void drawTarotCard(int16 rectID, int16 deckPos, int16 type); // sub_128_712
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
- void sub_128_918(const Common::U32String &unk1);
+ void drawStringCenter(const Common::U32String &str, int16 yPos); // sub_128_918
void zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps); // sub_128_962
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void getNextEvent(uint32 mask); // sub_128_c6a
@@ -270,13 +270,13 @@ public:
// fool_sentence.cpp
void sentenceRun(); // sub_135_004
void sentenceOnClick(); // sub_135_5b6
- void sentenceAddLeft(); // sub_135_7d6
- void sentenceAddRight(); // sub_135_7fa
- void sentenceAddLeftRight(); // sub_135_81e
- void sentenceReplace(); // sub_135_86a
+ void sentenceAddLeft(int16 index); // sub_135_7d6
+ void sentenceAddRight(int16 index); // sub_135_7fa
+ void sentenceAddLeftRight(int16 index); // sub_135_81e
+ void sentenceReplace(int16 index); // sub_135_86a
void sentenceReverse(); // sub_135_94c
void sentenceUndo(); // sub_135_9ba
- void sentenceDrawButton(); // sub_135_a34
+ void sentenceDrawButton(int16 gridIndex); // sub_135_a34
void sentenceDrawBuffer(); // sub_135_b16
void sentenceStoreState(); // sub_135_c1c
void sentenceSuccess(); // sub_135_cee
@@ -419,7 +419,7 @@ public:
// fool_humbug.cpp
void humbugRun(); // sub_142_004
- void humbugTrail(); // sub_142_0e6
+ void humbugPlayTrail(); // sub_142_0e6
void sub_142_370();
void humbugSuccess(); // sub_142_5f2
void sub_142_630();
@@ -489,7 +489,6 @@ private:
int16 var_i16_688;
int16 var_i16_68a;
int16 var_i16_68c;
- uint32 var_i32_68e;
uint32 var_i32_692;
// this is normally a raw pointer to some memory,
// instead we track it as a handle + offset
@@ -497,8 +496,7 @@ private:
Handle _puzzleDataBuffer; // var_bytes_696
int16 var_i16_78a;
int16 var_i16_79e;
- int16 var_i16_7a0;
- int16 var_i16_7a2;
+ bool _mouseVisible; // var_i16_7a0
int16 var_i16_7a8;
int16 var_i16_7aa;
int16 var_i16_7b0;
@@ -584,7 +582,6 @@ private:
int16 var_i16_1060;
int16 _polyominoPosX; // var_i16_1062
int16 _polyominoPosY; // var_i16_1064
- int16 var_i16_1066;
int16 _jumbleGameType; // var_i16_1068
int16 var_i16_106a;
SourceMode var_i16_106c;
@@ -733,7 +730,7 @@ private:
int16 var_i16_2338;
bool _deathWhiteEyeNeedsDraw; // var_i16_233a
int16 var_i16_233e;
- int16 var_i16_233c;
+ int16 _humbugTrailIndex; // var_i16_233c
int16 var_i16_2340;
int16 var_i16_2342;
@@ -778,8 +775,7 @@ private:
float arr_bcd_5dbc[8];
BitMap arr_bmp_5dfc; // 22000, close to a screen page
BitMap _jigsawPieces[128];
- int16 arr_i16_9894[0xa43]; // inside 5dfc, used for humbug
- int16 arr_i16_ac1c[0xa43]; // inside 5dfc, used for humbug
+ Common::Point _humbugTrail[0xa43];
BitMap arr_bmp_b3ec;
BitMap arr_bmp_bbbc; // used by death
BitMap arr_bmp_c38c; // used by death
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 0b40a01ce39..6d02faf8497 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -34,7 +34,7 @@ namespace Fool {
void FoolGame::humbugRun() {
// 142:0004
if (_activePuzzleStatus < 0x63) {
- this->humbugTrail();
+ this->humbugPlayTrail();
if (!_activePuzzleSolved) {
return;
}
@@ -54,7 +54,7 @@ void FoolGame::humbugRun() {
this->sub_142_630();
}
if (_activePuzzleStatus >= 0x64) {
- this->humbugTrail();
+ this->humbugPlayTrail();
if (_activePuzzleSolved) {
this->humbugSuccess();
}
@@ -63,7 +63,7 @@ void FoolGame::humbugRun() {
return;
}
-void FoolGame::humbugTrail() {
+void FoolGame::humbugPlayTrail() {
// 142:00e6
if (_puzzleCompletionStatus[0x34] < 3) {
_zbasic->menu(8, 3, 1, _zbasic->str(OFF(1))); // A secret is undone
@@ -75,17 +75,17 @@ void FoolGame::humbugTrail() {
}
// 142:0166
this->fetchPuzzleData();
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->drawPuzzleButton(_zbasic->str(OFF(5))); // ~
// eye button
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
for (int16 i = 1; i <= 0xa42; i++) {
- this->arr_i16_9894[i] = puzzlesReadShort();
- this->arr_i16_ac1c[i] = puzzlesReadShort();
+ _humbugTrail[i].x = puzzlesReadShort();
+ _humbugTrail[i].y = puzzlesReadShort();
_zbasic->put(
- this->arr_i16_9894[i],
- this->arr_i16_ac1c[i],
+ _humbugTrail[i].x,
+ _humbugTrail[i].y,
this->arr_bmp_b3ec,
kSrcCopy
);
@@ -94,14 +94,14 @@ void FoolGame::humbugTrail() {
_toolbox->Delay(0);
}
// 142:026e
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
_zbasic->put(
- this->arr_i16_9894[this->var_i16_233c],
- this->arr_i16_ac1c[this->var_i16_233c],
+ _humbugTrail[this->_humbugTrailIndex].x,
+ _humbugTrail[this->_humbugTrailIndex].y,
this->arr_bmp_b3ec,
kSrcCopy
);
- this->var_i16_233c = 1;
+ this->_humbugTrailIndex = 1;
_stateFlags = kStateNull;
_activePuzzleSolved = false;
this->var_i16_1ab6 = 0;
@@ -113,7 +113,7 @@ void FoolGame::humbugTrail() {
if (!((this->var_i16_1ab6 == _event.where.x) && (this->var_i16_1ab8 == _event.where.y))) {
this->sub_142_370();
}
- if (this->var_i16_233c >= 0xa42) {
+ if (this->_humbugTrailIndex >= 0xa42) {
_activePuzzleSolved = true;
}
if (_stateFlags == kStateSaveGame) {
@@ -125,19 +125,19 @@ void FoolGame::humbugTrail() {
void FoolGame::sub_142_370() {
// 142:0370
- this->var_i16_7e4 = this->var_i16_233c + 0x19;
- if (this->var_i16_7e4 > 0xa42) {
- this->var_i16_7e4 = 0xa42;
+ int16 trailMax = this->_humbugTrailIndex + 0x19;
+ if (trailMax > 0xa42) {
+ trailMax = 0xa42;
}
- this->var_i16_9f2 = this->var_i16_233c - 0x19;
- if (this->var_i16_9f2 < 1) {
- this->var_i16_9f2 = 1;
+ int16 trailMin = this->_humbugTrailIndex - 0x19;
+ if (trailMin < 1) {
+ trailMin = 1;
}
this->var_i16_1a9c = 0;
- for (int16 i = this->var_i16_7e4; i >= this->var_i16_9f2; i--) {
- this->var_i16_1a96 = _event.where.x - this->arr_i16_9894[i];
- this->var_i16_1a98 = _event.where.y - this->arr_i16_ac1c[i];
- if ((this->var_i16_1a96 >= -5) && (this->var_i16_1a96 <= 0x1e) && (this->var_i16_1a98 >= -5) && (this->var_i16_1a98 <= 0x19)) {
+ for (int16 i = trailMax; i >= trailMin; i--) {
+ int16 dx = _event.where.x - _humbugTrail[i].x;
+ int16 dy = _event.where.y - _humbugTrail[i].y;
+ if ((dx >= -5) && (dx <= 0x1e) && (dy >= -5) && (dy <= 0x19)) {
this->var_i16_1a9c = i + 0xa;
}
// 142:0470
@@ -147,42 +147,38 @@ void FoolGame::sub_142_370() {
this->var_i16_1a9c = 0xa42;
}
if (this->var_i16_1a9c != 0) {
- if (this->var_i16_233c < this->var_i16_1a9c) {
- this->var_i16_484 = 1;
- } else {
- this->var_i16_484 = -1;
- }
- this->var_i16_7a8 = this->var_i16_233c;
+ int16 incr = (this->_humbugTrailIndex < this->var_i16_1a9c) ? 1 : -1;
+ int16 index = this->_humbugTrailIndex;
do {
_zbasic->put(
- this->arr_i16_9894[this->var_i16_7a8],
- this->arr_i16_ac1c[this->var_i16_7a8],
+ _humbugTrail[index].x,
+ _humbugTrail[index].y,
this->arr_bmp_b3ec,
kSrcCopy
);
// 142:051c
- } while (_zbasic->incrAndCheck(this->var_i16_7a8, this->var_i16_1a9c, this->var_i16_484));
- this->var_i16_233c = this->var_i16_1a9c;
+ } while (_zbasic->incrAndCheck(index, this->var_i16_1a9c, incr));
+ this->_humbugTrailIndex = this->var_i16_1a9c;
this->var_i16_1ab6 = _event.where.x;
this->var_i16_1ab8 = _event.where.y;
} else {
// 142:054a
- this->var_i16_7e4 = this->var_i16_233c - 0xa;
- if (this->var_i16_7e4 < 1) {
- this->var_i16_7e4 = 1;
+ int16 rewindTo = this->_humbugTrailIndex - 0xa;
+ if (rewindTo < 1) {
+ rewindTo = 1;
}
- for (int16 i = this->var_i16_233c; i >= this->var_i16_7e4; i--) {
+ for (int16 i = this->_humbugTrailIndex; i >= rewindTo; i--) {
_zbasic->put(
- this->arr_i16_9894[i],
- this->arr_i16_ac1c[i],
+ _humbugTrail[i].x,
+ _humbugTrail[i].y,
this->arr_bmp_b3ec,
kSrcCopy
);
// 142:05c8
}
- this->var_i16_233c -= 0xa;
- if (this->var_i16_233c < 1) {
- this->var_i16_233c = 1;
+ this->_humbugTrailIndex -= 0xa;
+ if (this->_humbugTrailIndex < 1) {
+ this->_humbugTrailIndex = 1;
}
}
// 142:05f0
@@ -210,38 +206,38 @@ void FoolGame::sub_142_630() {
temp.right = this->arr_i16_2f38[i*32+3];
_toolbox->FillRect(temp, _patterns[2]);
_toolbox->FrameRect(temp);
- this->var_str_384 = Common::U32String::format(" %d ", i);
- this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_384);
- this->var_i16_9f2 = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
+ Common::U32String idStr = Common::U32String::format(" %d ", i);
+ int16 width = _toolbox->StringWidth(idStr);
+ int16 xOffset = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
// 142:0756
_toolbox->MoveTo(
- this->arr_i16_2f38[i*32+1] + this->var_i16_9f2 - (this->var_i16_7e4 / 2),
+ this->arr_i16_2f38[i*32+1] + xOffset - (width / 2),
this->arr_i16_2f38[i*32 + 2] - 0x1e
);
- _toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(idStr);
}
// 142:07ca
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
this->waitForMouseUp();
this->menuClickMessage();
- this->var_i16_484 = 0;
- this->var_i16_7e4 = 0;
- this->var_i16_9f2 = 0;
+
+ int16 tickCounter = 0;
+ int16 idCounter = 0;
while (_event.modifiers & kModMouseButtonUp) {
// 142:07f8
this->getNextEvent(-1); // was: 0
- this->var_i16_7e4++;
- if (this->var_i16_7e4 == 0x64) {
- this->var_i16_7e4 = 0;
- this->var_i16_9f2++;
- if (this->var_i16_9f2 > 4) {
- this->var_i16_9f2 = 1;
+ tickCounter++;
+ if (tickCounter == 0x64) {
+ tickCounter = 0;
+ idCounter++;
+ if (idCounter > 4) {
+ idCounter = 1;
}
Common::Rect temp;
- temp.top = this->arr_i16_2f38[this->var_i16_9f2*32];
- temp.left = this->arr_i16_2f38[this->var_i16_9f2*32+1];
- temp.bottom = this->arr_i16_2f38[this->var_i16_9f2*32+2];
- temp.right = this->arr_i16_2f38[this->var_i16_9f2*32+3];
+ temp.top = this->arr_i16_2f38[idCounter*32];
+ temp.left = this->arr_i16_2f38[idCounter*32+1];
+ temp.bottom = this->arr_i16_2f38[idCounter*32+2];
+ temp.right = this->arr_i16_2f38[idCounter*32+3];
_toolbox->InvertRect(temp);
}
}
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index a7ee9a61d9c..b099829ba6a 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -33,7 +33,7 @@ namespace Fool {
void FoolGame::mazeRun() {
// 136:0004
fetchPuzzleData();
- sub_128_4da(0);
+ toggleMouseCursor(false);
for (int16 i = 0; i <= 0x17; i++) {
arr_i16_1eb8[i] = puzzlesReadShort();
}
@@ -146,7 +146,7 @@ void FoolGame::mazeRun() {
mazeSetupMenu();
sub_136_ade();
_stateFlags = kStateNull;
- sub_128_4da(1);
+ toggleMouseCursor(true);
if (_mazePlayerX == 0x19) {
_activePuzzleSolved = true;
} else {
@@ -502,8 +502,7 @@ void FoolGame::mazePrintMessage() {
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
int16 width = _toolbox->StringWidth(var_str_1ce2);
fillRect(0x13b, 0xf1 - (width / 2), 0x14f, 0x10f + (width / 2), 2);
- var_i16_7a2 = 0x149;
- sub_128_918(var_str_1ce2.decode(Common::kMacRoman));
+ drawStringCenter(var_str_1ce2.decode(Common::kMacRoman), 0x149);
}
// 136:0e3a
var_str_1578 = var_str_1ce2.decode(Common::kMacRoman);
@@ -1040,7 +1039,7 @@ void FoolGame::mazeMovementTrail() {
if (var_i16_1dec == 2) {
_toolbox->InvertOval(temp);
}
- sub_128_406(0);
+ delayFromMarker(0);
}
}
}
@@ -1059,7 +1058,7 @@ void FoolGame::mazeLoadTone(int16 offset) {
void FoolGame::mazePlayTone() {
// 136:2538
- playTone(mazeToneFreq, var_i16_1372, 0);
+ playTone(mazeToneFreq, var_i16_1372, false);
if ((mazeToneFreq > 0xe) && (mazeToneFreq < 0x7d00)) {
mazeToneFreq += mazeToneFreqStep;
}
@@ -1516,7 +1515,7 @@ void FoolGame::sub_136_3a30() {
}
if (var_i16_1de6 == 0) {
var_i16_1f08 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
- debugC(5, kDebugLoading, "sub_136_3a80: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
+ debugC(5, kDebugLoading, "sub_136_3a30: mask[%d] %04x", var_i16_1f0a, var_i16_1f08);
var_i16_1f0a += 2;
}
// 136:3a6e
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 8a3968d5fa1..9895f60ba34 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -329,13 +329,12 @@ void FoolGame::sub_138_9c4() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
_toolbox->FillRect(temp, _patterns[2]);
- var_i16_7a2 = 0x146;
- sub_128_918(var_str_1272);
+ drawStringCenter(var_str_1272, 0x146);
}
void FoolGame::sub_138_a06() {
// 138:0a06
- playTone(0x19, 0x64, 1);
+ playTone(0x19, 0x64, true);
if (_metapuzzleSecretCodeCount == 0)
return;
metapuzzleSecretCodeReset();
@@ -350,9 +349,8 @@ void FoolGame::metapuzzleSecretCodeReset() {
temp.right = arr_i16_1eb8[3];
_toolbox->FillRect(temp, _patterns[2]);
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- var_i16_7a2 = 0x140;
var_str_384 = _zbasic->str(OFF(15)); // if you know which is which, enter the letters you wish to switch
- sub_128_918(var_str_384);
+ drawStringCenter(var_str_384, 0x140);
var_str_1272.clear(); // was: str(OFF(16))
_metapuzzleSecretCodeCount = 0;
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 0d15fbf5762..faf64489e6e 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -313,7 +313,7 @@ void FoolGame::polyominoOnClick() {
_zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4 + 2]);
// 133:0b1c
this->polyominoDrawFrame();
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
this->var_i16_1ab6 = this->_polyominoPosX;
this->var_i16_1ab8 = this->_polyominoPosY;
_zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
@@ -388,7 +388,7 @@ void FoolGame::polyominoOnClick() {
// 133:0ea2
this->polyominoDrawFrame();
this->polyominoCheckIfSolved();
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
}
void FoolGame::polyominoCancelMove() {
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 4c8a20abd36..fa87583b503 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -41,29 +41,28 @@ void FoolGame::sentenceRun() {
this->arr_i16_3738[4] = 0xbf;
this->arr_i16_3738[5] = 0;
this->arr_i16_3738[6] = 0xe1;
- this->arr_i16_3738[7] = 0x200;
+ this->arr_i16_3738[7] = SCREEN_WIDTH;
this->arr_i16_3738[8] = 0xf2;
- this->arr_i16_3738[0xa] = 0x156;
- this->arr_i16_3738[0xc] = 0x14;
+ this->arr_i16_3738[0xa] = SCREEN_HEIGHT;
+ this->arr_i16_3738[0xc] = MENU_HEIGHT;
this->arr_i16_3738[0xd] = 0;
- this->arr_i16_3738[0xe] = 0x156;
- this->arr_i16_3738[0xf] = 0x200;
+ this->arr_i16_3738[0xe] = SCREEN_HEIGHT;
+ this->arr_i16_3738[0xf] = SCREEN_WIDTH;
// 135:00ce
- this->var_i16_1066 = puzzlesReadShort();
- this->arr_i32_192c0[0] = _toolbox->GetPicture(this->var_i16_1066);
+ this->arr_i32_192c0[0] = _toolbox->GetPicture(puzzlesReadShort());
this->arr_i16_1eb8[0] = puzzlesReadShort();
_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
_sentenceGoal = puzzlesReadString().decode(Common::kMacRoman);
- this->var_str_384 = puzzlesReadString().decode(Common::kMacRoman);
- this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1)); // to reveal XXXXX
+ Common::U32String menuStr = puzzlesReadString().decode(Common::kMacRoman);
+ menuStr = _zbasic->str(OFF(0)) + menuStr + _zbasic->str(OFF(1)); // to reveal XXXXX
// 135:0152
- _zbasic->menu(8, 7, 1, this->var_str_384);
+ _zbasic->menu(8, 7, 1, menuStr);
this->arr_i16_1eb8[1] = 0x1c2 / this->arr_i16_1eb8[0];
- this->arr_i16_1eb8[2] = 0x100 - ((this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1]) / 2);
+ this->arr_i16_1eb8[2] = (SCREEN_WIDTH/2) - ((this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1]) / 2);
// 135:01e2
- this->var_i16_7e4 = this->arr_i16_1eb8[2];
+ int16 buttonGridX = this->arr_i16_1eb8[2];
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
this->arr_i16_4338[i] = 0;
this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = puzzlesReadByte();
@@ -71,31 +70,31 @@ void FoolGame::sentenceRun() {
// 135:0254
_zbasic->indexRawSet(puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
_screenGrid[i].top = 0xf2;
- _screenGrid[i].left = this->var_i16_7e4;
- _screenGrid[i].bottom = 0x156;
- _screenGrid[i].right = this->var_i16_7e4 + this->arr_i16_1eb8[1];
+ _screenGrid[i].left = buttonGridX;
+ _screenGrid[i].bottom = SCREEN_HEIGHT;
+ _screenGrid[i].right = buttonGridX + this->arr_i16_1eb8[1];
// 135:030c
- this->var_i16_7e4 += this->arr_i16_1eb8[1];
+ buttonGridX += this->arr_i16_1eb8[1];
}
// 135:0348
- _zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
+ _zbasic->picture(0, MENU_HEIGHT, this->arr_i32_192c0[0]);
_toolbox->ReleaseResource(this->arr_i32_192c0[0]);
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
_toolbox->FillRect(temp, _patterns[2]);
this->arr_i16_1eb8[4] = 0;
- for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
// 135:03a4
if (_activePuzzleBuffer.empty()) { // was: str(OFF(2))
- this->arr_i16_4338[this->var_i16_68a] = 1;
+ this->arr_i16_4338[i] = 1;
} else {
// 135:03d4
- this->arr_i16_4338[this->var_i16_68a] = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_68a, 1));
+ this->arr_i16_4338[i] = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, i, 1));
}
// 135:0408
- if (this->arr_i16_4338[this->var_i16_68a] == 1) {
- this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, 1);
- this->sentenceDrawButton();
+ if (this->arr_i16_4338[i] == 1) {
+ this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, true);
+ this->sentenceDrawButton(i);
}
// 135:044a
}
@@ -146,27 +145,28 @@ void FoolGame::sentenceOnClick() {
this->var_i16_1abc = 0;
if ((_event.where.x < this->arr_i16_1eb8[2]) || (_event.where.y < 0xf2))
return;
+
// determine which button was clicked on
- this->var_i16_103a = ((_event.where.x - this->arr_i16_1eb8[2]) / this->arr_i16_1eb8[1]) + 1;
+ int16 index = ((_event.where.x - this->arr_i16_1eb8[2]) / this->arr_i16_1eb8[1]) + 1;
// 135:0632
- if ((this->var_i16_103a > this->arr_i16_1eb8[0]) || (this->arr_i16_4338[this->var_i16_103a] == 0))
+ if ((index > this->arr_i16_1eb8[0]) || (this->arr_i16_4338[index] == 0))
return;
// 135:0676
- this->arr_i16_4338[this->var_i16_103a] = 0;
- _toolbox->FillOval(_screenGrid[this->var_i16_103a], _patterns[2]);
+ this->arr_i16_4338[index] = 0;
+ _toolbox->FillOval(_screenGrid[index], _patterns[2]);
// 135:06aa
- switch (this->arr_i16_4338[this->var_i16_103a + this->arr_i16_1eb8[0]]-1) {
+ switch (this->arr_i16_4338[index + this->arr_i16_1eb8[0]]-1) {
case 0:
- sentenceAddLeft();
+ sentenceAddLeft(index);
break;
case 1:
- sentenceAddRight();
+ sentenceAddRight(index);
break;
case 2:
- sentenceAddLeftRight();
+ sentenceAddLeftRight(index);
break;
case 3:
- sentenceReplace();
+ sentenceReplace(index);
break;
case 4:
sentenceReverse();
@@ -181,19 +181,18 @@ void FoolGame::sentenceOnClick() {
return;
}
// 135:0714
- this->var_i16_484 = 0;
+ bool buttonsRemaining = false;
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
if (this->arr_i16_4338[i] != 0) {
- this->var_i16_484 = 1;
+ buttonsRemaining = true;
}
}
// 135:0758
- if (this->var_i16_484 != 0) {
+ if (buttonsRemaining) {
return;
}
_zbasic->text(_fontChicago, 0xc, 0, kSrcBic);
- this->var_i16_7a2 = 0x124;
- this->sub_128_918(_zbasic->str(OFF(4))); // click mouse to reset puzzle
+ drawStringCenter(_zbasic->str(OFF(4)), 0x124); // click mouse to reset puzzle
this->waitForMouseUp();
this->var_i16_1abc = 1;
@@ -208,47 +207,46 @@ void FoolGame::sentenceOnClick() {
}
}
-void FoolGame::sentenceAddLeft() {
+void FoolGame::sentenceAddLeft(int16 index) {
// 135:07d6
- _sentenceBuffer = _zbasic->index(1, this->var_i16_103a) + _sentenceBuffer;
+ _sentenceBuffer = _zbasic->index(1, index) + _sentenceBuffer;
}
-void FoolGame::sentenceAddRight() {
+void FoolGame::sentenceAddRight(int16 index) {
// 135:07fa
- _sentenceBuffer += _zbasic->index(1, this->var_i16_103a);
+ _sentenceBuffer += _zbasic->index(1, index);
}
-void FoolGame::sentenceAddLeftRight() {
+void FoolGame::sentenceAddLeftRight(int16 index) {
// 135:0813
- _sentenceBuffer = _zbasic->index(1, this->var_i16_103a)
+ _sentenceBuffer = _zbasic->index(1, index)
+ _sentenceBuffer
- + _zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0]);
+ + _zbasic->index(1, index + this->arr_i16_1eb8[0]);
}
-void FoolGame::sentenceReplace() {
+void FoolGame::sentenceReplace(int16 index) {
// 135:086a
- this->var_i16_9f2 = _zbasic->index(1, this->var_i16_103a).size();
+ this->var_i16_9f2 = _zbasic->index(1, index).size();
while (true) {
// 135:0884
- this->var_i16_484 = _sentenceBuffer.size();
- this->var_i16_1abe = _zbasic->instr(1, _sentenceBuffer, _zbasic->index(1, this->var_i16_103a));
+ int16 length = _sentenceBuffer.size();
+ this->var_i16_1abe = _zbasic->instr(1, _sentenceBuffer, _zbasic->index(1, index));
if (this->var_i16_1abe == 0)
return;
// 135:08bc
- if ((this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2) < 0)
+ if ((length - this->var_i16_1abe + 1 - this->var_i16_9f2) < 0)
return;
_sentenceBuffer = _zbasic->leftStr(_sentenceBuffer, this->var_i16_1abe - 1)
- + _zbasic->index(1, this->var_i16_103a + this->arr_i16_1eb8[0])
- + _zbasic->rightStr(_sentenceBuffer, this->var_i16_484 - this->var_i16_1abe + 1 - this->var_i16_9f2);
+ + _zbasic->index(1, index + this->arr_i16_1eb8[0])
+ + _zbasic->rightStr(_sentenceBuffer, length - this->var_i16_1abe + 1 - this->var_i16_9f2);
}
// should never reach here
}
void FoolGame::sentenceReverse() {
// 135:094c
- this->var_i16_484 = _sentenceBuffer.size();
Common::U32String buffer; // was: str(OFF(5))
- for (int16 i = this->var_i16_484; i >= 1; i--) {
+ for (int16 i = (int16)_sentenceBuffer.size(); i >= 1; i--) {
buffer += _zbasic->midStr(_sentenceBuffer, i, 1);
}
_sentenceBuffer = buffer;
@@ -259,40 +257,40 @@ void FoolGame::sentenceUndo() {
this->arr_i16_1eb8[4] = 0;
Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
_toolbox->FillRect(temp, _patterns[2]);
- for (this->var_i16_68a = 1; this->var_i16_68a <= this->arr_i16_1eb8[0]; this->var_i16_68a++) {
- this->arr_i16_4338[this->var_i16_68a] = 1;
- this->sentenceDrawButton();
+ for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ this->arr_i16_4338[i] = 1;
+ this->sentenceDrawButton(i);
}
_sentenceBuffer = _zbasic->index(1, 0);
this->sentenceDrawBuffer();
}
-void FoolGame::sentenceDrawButton() {
+void FoolGame::sentenceDrawButton(int16 gridIndex) {
// 135:0a34
_zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
- this->var_str_384 = Common::U32String::format("%d", this->var_i16_68a) + _zbasic->str(OFF(6)); // ' '
- this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_384);
- _toolbox->FillOval(_screenGrid[this->var_i16_68a], _patterns[0]);
- _toolbox->FrameOval(_screenGrid[this->var_i16_68a]);
- _toolbox->MoveTo(_screenGrid[this->var_i16_68a].left + (this->arr_i16_1eb8[1] / 2) - (this->var_i16_7e4 / 2), 0x129);
- _toolbox->DrawString(this->var_str_384);
+ Common::U32String buf = Common::U32String::format("%d", gridIndex) + _zbasic->str(OFF(6)); // ' '
+ int16 width = _toolbox->StringWidth(buf);
+ _toolbox->FillOval(_screenGrid[gridIndex], _patterns[0]);
+ _toolbox->FrameOval(_screenGrid[gridIndex]);
+ _toolbox->MoveTo(_screenGrid[gridIndex].left + (this->arr_i16_1eb8[1] / 2) - (width / 2), 0x129);
+ _toolbox->DrawString(buf);
}
void FoolGame::sentenceDrawBuffer() {
// 135:0b16
_zbasic->text(kFontLarge, 0x18, 0, kSrcOr);
- this->var_i16_484 = _toolbox->StringWidth(_sentenceBuffer);
- if (this->var_i16_484 < this->arr_i16_1eb8[4]) {
- this->var_i16_484 = this->arr_i16_1eb8[4];
+ int16 width = _toolbox->StringWidth(_sentenceBuffer);
+ if (width < this->arr_i16_1eb8[4]) {
+ width = this->arr_i16_1eb8[4];
} else {
- this->arr_i16_1eb8[4] = this->var_i16_484;
+ this->arr_i16_1eb8[4] = width;
}
// 135:0b80
- this->arr_i16_3738[1] = 0xf6 - (this->var_i16_484 / 2);
- this->arr_i16_3738[3] = 0x109 + (this->var_i16_484 / 2);
+ this->arr_i16_3738[1] = 0xf6 - (width / 2);
+ this->arr_i16_3738[3] = 0x109 + (width / 2);
Common::Rect temp(this->arr_i16_3738[1], this->arr_i16_3738[0], this->arr_i16_3738[3], this->arr_i16_3738[2]);
_toolbox->FillRect(temp, _patterns[0]);
- _toolbox->MoveTo(0x100 - (this->var_i16_484 / 2), 0xd9);
+ _toolbox->MoveTo(0x100 - (width / 2), 0xd9);
_toolbox->DrawString(_sentenceBuffer);
}
@@ -305,9 +303,9 @@ void FoolGame::sentenceStoreState() {
}
// 135:0c44
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->var_str_384 = Common::U32String::format("%d", this->arr_i16_4338[i]);
- this->var_str_384 = _zbasic->rightStr(this->var_str_384, 1);
- _activePuzzleBuffer += this->var_str_384;
+ Common::U32String buf = Common::U32String::format("%d", this->arr_i16_4338[i]);
+ buf = _zbasic->rightStr(buf, 1);
+ _activePuzzleBuffer += buf;
}
// 135:0cba
Common::String temp = _sentenceBuffer.encode(Common::kMacRoman);
@@ -320,7 +318,7 @@ void FoolGame::sentenceSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, 0);
+ this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, false);
}
}
// 135:0d40
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index fc4c119652b..c5edd285a4e 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -99,11 +99,8 @@ void FoolGame::straightPathRun() {
// 143:04cc
var_i16_1574 = 0;
_stateFlags = kStateNull;
- if (var_str_1272 == _activePuzzleBuffer) {
- _activePuzzleSolved = true;
- } else {
- _activePuzzleSolved = false;
- }
+ _activePuzzleSolved = (var_str_1272 == _activePuzzleBuffer);
+
// JMP 0x582
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
// 143:0500
@@ -172,7 +169,7 @@ void FoolGame::straightPathReset() {
for (int16 i = 0; i <= 0x14; i++) {
var_i16_1574 = _zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
_toolbox->InvertRect(_screenGrid[var_i16_1574]);
- playTone(_zbasic->rndInt(0x2328) + 0xf, 0x28, 0x1);
+ playTone(_zbasic->rndInt(0x2328) + 0xf, 0x28, true);
// 143:0812
_toolbox->InvertRect(_screenGrid[var_i16_1574]);
}
@@ -187,8 +184,7 @@ void FoolGame::straightPathDrawText() {
// 143:0864
straightPathClearText();
_zbasic->text(kFontLarge, 0x18, 0x18, kSrcBic);
- var_i16_7a2 = 0x148;
- sub_128_918(_activePuzzleBuffer);
+ drawStringCenter(_activePuzzleBuffer, 0x148);
}
void FoolGame::straightPathClearText() {
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 08350f21823..01a673ea592 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -140,7 +140,7 @@ void FoolGame::highPriestessRun() {
for (int16 i = 0; i <= 0x22; i++) {
this->var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(area);
- this->sub_128_406(1);
+ this->delayFromMarker(1);
}
// 140:037e
this->var_i16_484 = 0x96;
@@ -160,12 +160,9 @@ void FoolGame::highPriestessRun() {
}
// 140:03f0
_zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
- this->var_i16_7a2 = 0x96;
- this->sub_128_918(_zbasic->str(OFF(3))); // you cannot claim
- this->var_i16_7a2 = 0xb9;
- this->sub_128_918(_zbasic->str(OFF(4))); // the book of thoth
- this->var_i16_7a2 = 0xdc;
- this->sub_128_918(_zbasic->str(OFF(5))); // so easily
+ this->drawStringCenter(_zbasic->str(OFF(3)), 0x96); // you cannot claim
+ this->drawStringCenter(_zbasic->str(OFF(4)), 0xb9); // the book of thoth
+ this->drawStringCenter(_zbasic->str(OFF(5)), 0xdc); // so easily
_toolbox->SetPort(this->var_i32_0);
this->waitForClick();
}
@@ -177,7 +174,7 @@ void FoolGame::highPriestessRun() {
void FoolGame::thoth99Enchantments() {
// 140:0458
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
if (_activePuzzleBuffer.empty()) { // was: str(OFF(6))
this->arr_i16_1eb8[0] = 0x63;
} else {
@@ -189,10 +186,8 @@ void FoolGame::thoth99Enchantments() {
}
if (this->arr_i16_1eb8[0] == 0x63) {
_zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
- this->var_i16_7a2 = 0xaf;
- this->sub_128_918(_zbasic->str(OFF(7))); // you dare to challenge
- this->var_i16_7a2 = 0xd2;
- this->sub_128_918(_zbasic->str(OFF(8))); // the high priestess
+ this->drawStringCenter(_zbasic->str(OFF(7)), 0xaf); // you dare to challenge
+ this->drawStringCenter(_zbasic->str(OFF(8)), 0xd2); // the high priestess
this->delay(0xb4);
}
// 140:0532
@@ -228,7 +223,7 @@ void FoolGame::thoth99Enchantments() {
this->arr_i16_4758[7] = SCREEN_WIDTH;
this->arr_i16_1eb8[1] = 0;
_zbasic->unk_20();
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
_stateFlags = kStateNull;
_activePuzzleSolved = false;
this->var_i16_2326 = 0;
@@ -237,6 +232,8 @@ void FoolGame::thoth99Enchantments() {
// new value: number of updates before a screen flash
this->arr_i16_1eb8[3] = 0;
+ uint32 phase2Timer = _toolbox->TickCount();
+
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:0752
this->var_i32_692 = _toolbox->TickCount();
@@ -274,11 +271,11 @@ void FoolGame::thoth99Enchantments() {
// 140:0852
this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0] - this->arr_i16_1eb8[1];
if (this->arr_i16_1eb8[2] == this->arr_i16_1eb8[0]) {
- if ((this->var_i16_2328 == 1) && (_toolbox->TickCount() > (this->var_i32_68e + 0x28))) {
+ if ((this->var_i16_2328 == 1) && (_toolbox->TickCount() > (phase2Timer + 0x28))) {
this->var_i16_2328 = 0;
}
if (this->var_i16_2328 == 0) {
- this->var_i32_68e = _toolbox->TickCount();
+ phase2Timer = _toolbox->TickCount();
this->var_i16_2328 = 1;
this->thothMoveEnchantment();
}
@@ -299,7 +296,7 @@ void FoolGame::thoth99Enchantments() {
}
} while (_event.what != 0);
// 140:094a
- this->sub_128_406(1);
+ this->delayFromMarker(1);
}
// 140:097a
if (_activePuzzleSolved) {
@@ -1043,7 +1040,7 @@ void FoolGame::hermitScreenFlash() {
void FoolGame::hermitScreenZoom() {
// 140:26ca
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
_toolbox->PenSize(0xa, 0x7);
for (int16 j = 0; j <= 2; j++) {
@@ -1069,7 +1066,7 @@ void FoolGame::hermitScreenZoom() {
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
this->var_i16_1de6 = 0;
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
}
void FoolGame::hermitScreenBehold() {
@@ -1289,7 +1286,7 @@ void FoolGame::sub_140_3296() {
void FoolGame::sub_140_32ac() {
// 140:33ac
- this->sub_128_4da(0);
+ this->toggleMouseCursor(false);
_toolbox->PenNormal();
for (int16 j = 0; j <= 0x22; j++) {
for (int16 i = -5; i <= 0x159; i += 0xa) {
@@ -1302,11 +1299,11 @@ void FoolGame::sub_140_32ac() {
for (int16 i = 1; i <= 0xd; i++) {
this->var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(area);
- this->sub_128_406(1);
+ this->delayFromMarker(1);
}
// 140:334a
_toolbox->FillRect(area, _patterns[2]);
- this->sub_128_4da(1);
+ this->toggleMouseCursor(true);
_toolbox->SetPort(this->var_i32_0);
}
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
index 4601a28e3fa..7cf21ffb86b 100644
--- a/engines/fool/fool_threeships.cpp
+++ b/engines/fool/fool_threeships.cpp
@@ -239,7 +239,7 @@ void FoolGame::sub_128_5a6c() {
//this->arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
_toolbox->EraseRoundRect(this->arr_rect_1910c, 8, 7);
_zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_b3ec, kSrcXor);
- this->sub_128_406(0);
+ this->delayFromMarker(0);
}
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 2152a48dc37..43cf72a7707 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -330,8 +330,7 @@ void FoolGame::wordSearchDrawFooter() {
// 131:0d22
this->fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7a2 = 0x152;
- this->sub_128_918(this->var_str_384);
+ this->drawStringCenter(this->var_str_384, 0x152);
}
void FoolGame::wordSearchStoreState() {
Commit: d9d7b2173aad7f4a5b4c5ffd34032b14386f6091
https://github.com/scummvm/scummvm/commit/d9d7b2173aad7f4a5b4c5ffd34032b14386f6091
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:32+02:00
Commit Message:
FOOL: Finish transcribing finale
Changed paths:
engines/fool/fool_finale.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/toolbox_quickdraw.cpp
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index 74d6c470acb..94129867d71 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -376,10 +376,10 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
this->setPortBitsToPage(0x6);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]);
+ _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]); // wadjet eye mask
this->setPortBitsToPage(0x7);
this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]);
+ _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]); // wadjet eye
//_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
this->setPortBitsToPage(0x8);
@@ -429,7 +429,7 @@ void FoolPrologue::finaleRun() {
this->copyScreenToPage(0x5);
this->setPortBitsToPage(0x5);
this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]); // fool card
_toolbox->SetPortBits(this->var_i32_32);
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
@@ -609,13 +609,13 @@ void FoolPrologue::finaleRun() {
drawTextRightAlign(0x181, 0x5e);
var_str_76 = _zbasic->str(32) + _zbasic->chr(0x22); // have been able to find them so easily
drawTextRightAlign(0x181, 0x6f);
- arr_i16_41af4.top = 6;
- arr_i16_41af4.left = 0xd0;
- arr_i16_41af4.bottom = 0x6c;
- arr_i16_41af4.right = 0x133;
+ arr_rect_41af4.top = 6;
+ arr_rect_41af4.left = 0xd0;
+ arr_rect_41af4.bottom = 0x6c;
+ arr_rect_41af4.right = 0x133;
arr_i16_41afc.top = 0xa;
arr_i16_41afc.left = 0xb4;
- arr_i16_41afc.bottom = 0x1fc;
+ arr_i16_41afc.bottom = 0x14c;
arr_i16_41afc.right = 0x1f6;
arr_i16_41b04[0] = 2;
arr_i16_41b04[1] = 0xa;
@@ -623,23 +623,24 @@ void FoolPrologue::finaleRun() {
// 131:1b6e
// unroll loops
- arr_f64_41bbe[0] = (float)arr_i16_41af4.top;
- arr_f64_41bbe[0+4] = (float)(arr_i16_41afc.top - arr_i16_41af4.top) / arr_i16_41b04[2];
- arr_f64_41bbe[1] = (float)arr_i16_41af4.left;
- arr_f64_41bbe[1+4] = (float)(arr_i16_41afc.left - arr_i16_41af4.left) / arr_i16_41b04[2];
- arr_f64_41bbe[2] = (float)arr_i16_41af4.bottom;
- arr_f64_41bbe[2+4] = (float)(arr_i16_41afc.bottom - arr_i16_41af4.bottom) / arr_i16_41b04[2];
- arr_f64_41bbe[3] = (float)arr_i16_41af4.right;
- arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_i16_41af4.right) / arr_i16_41b04[2];
+ arr_f64_41bbe[0] = (float)arr_rect_41af4.top;
+ arr_f64_41bbe[0+4] = (float)(arr_i16_41afc.top - arr_rect_41af4.top) / arr_i16_41b04[2];
+ arr_f64_41bbe[1] = (float)arr_rect_41af4.left;
+ arr_f64_41bbe[1+4] = (float)(arr_i16_41afc.left - arr_rect_41af4.left) / arr_i16_41b04[2];
+ arr_f64_41bbe[2] = (float)arr_rect_41af4.bottom;
+ arr_f64_41bbe[2+4] = (float)(arr_i16_41afc.bottom - arr_rect_41af4.bottom) / arr_i16_41b04[2];
+ arr_f64_41bbe[3] = (float)arr_rect_41af4.right;
+ arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_rect_41af4.right) / arr_i16_41b04[2];
// 131:1c24
_toolbox->PenPat(arr_pat_194[1]);
_toolbox->PenMode(kPatXor);
+ // pre-draw the puzzle circles coming off the high priestess' head
for (int16 j = 6; j <= 9; j++) {
arr_i32_41296[j]->copyFrom(*arr_i32_41296[j - 1]);
// 131:1c7a
setPortBitsToPage(j);
if (j == 6) {
- _toolbox->PaintOval(arr_i16_41af4);
+ _toolbox->PaintOval(arr_rect_41af4);
}
// 131:1c9c
for (int16 i = 0; i <= 2; i++) {
@@ -988,11 +989,11 @@ void FoolPrologue::finaleRun() {
drawText(0x3c, 0x3e);
arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0xa]);
setPortBitsToPage(0xb);
- arr_i16_41af4.top = 0xa;
- arr_i16_41af4.left = 0xb4;
- arr_i16_41af4.bottom = 0x14c;
- arr_i16_41af4.right = 0x1f6;
- _toolbox->InvertOval(arr_i16_41af4);
+ arr_rect_41af4.top = 0xa;
+ arr_rect_41af4.left = 0xb4;
+ arr_rect_41af4.bottom = 0x14c;
+ arr_rect_41af4.right = 0x1f6;
+ _toolbox->InvertOval(arr_rect_41af4);
for (int16 i = 5; i <= 0x9; i++) {
arr_i32_41296[i]->copyFrom(*arr_i32_41296[4]);
}
@@ -1045,10 +1046,10 @@ void FoolPrologue::finaleRun() {
var_i16_3ee = 0x3c;
setPortBitsToPage(9);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x29]);
+ _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x29]); // wadjet eye mask
setPortBitsToPage(0xa);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x2a]);
+ _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x2a]); // wadjet eye
_toolbox->SetPortBits(var_i32_32);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// the book of thoth?
@@ -1093,13 +1094,426 @@ void FoolPrologue::finaleRun() {
// 131:3806
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(54).encode().c_str()); // destroy him
+ drawTextRightAlign(0x1a4, 0x2d);
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0xb4);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(55).encode(Common::kMacRoman).c_str()); // the book of thoth?
+ drawTextRightAlign(0x1a4, 0x2d);
+ delay(0xf);
+ blitPageToScreen(0x5);
+ var_i16_5c.left = var_i16_3ec;
+ var_i16_5c.right = var_i16_3ec + 0xc8;
+ var_i16_64.left = var_i16_3ec;
+ var_i16_64.right = var_i16_3ec + 0xc8;
+ var_i16_5c.top = 0x19;
+ var_i16_64.bottom = 0xdf;
+
+ // 131:38f4
+ // wadjet eye rises over horizon
+ for (int16 i = 0xdc; i >= 0x19; i -= 5) {
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_4e->copyFrom(*arr_i32_41296[5]);
+ var_i16_64.top = i;
+ var_i16_5c.bottom = 0x19 + 0xdf - i;
+
+ var_i32_40 = arr_i32_41296[9];
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcBic, 0);
+
+ var_i32_40 = arr_i32_41296[10];
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcOr, 0);
+ delayFromMarker(2);
+
+ _toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_64, var_i16_64, kSrcCopy, 0);
+ }
+ // 131:39ba
+
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->ReleaseResource(arr_i32_0[0x29]);
+ _toolbox->ReleaseResource(arr_i32_0[0x2a]);
+
+ // 131:39e8
+ for (int16 i = 0x53; i <= 0x59; i++) {
+ _toolbox->ReleaseResource(arr_i32_0[i]);
+ }
+ _toolbox->ReleaseResource(arr_i32_0[0x5b]);
+
+ // 131:3a20
+ arr_i32_41296[10]->copyFrom(*arr_i32_41296[8]);
+ delayFromMarker(0x3c);
+
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(56).encode(Common::kMacRoman).c_str()); // here is the book of thoth
+ drawTextRightAlign(0x1a4, 0x2d);
+
+ delay(0xf);
+ blitPageToScreen(0x7);
+ var_i32_2 = _toolbox->TickCount();
+
+ for (int16 i = 0x39; i <= 0x45; i++) {
+ arr_i32_0[i] = _toolbox->GetPicture(i);
+ }
+ arr_i32_0[0x47] = _toolbox->GetPicture(0x47);
+ delayFromMarker(0xc8);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(57).encode(Common::kMacRoman).c_str()); // and your answer is incorrect
+ drawTextRightAlign(0x1a4, 0x2d);
+ delay(0xf);
+
+ blitPageToScreen(0xa);
+ var_i32_2 = _toolbox->TickCount();
+ setPortBitsToPage(0x7);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0, 0xaa, arr_i32_0[0x39]); // treasure pile
+ // 131:3b8a
+ fillRect(0x124, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ arr_i32_41296[8]->copyFrom(*arr_i32_41296[7]);
+ arr_i32_41296[9]->copyFrom(*arr_i32_41296[8]);
+ _toolbox->InvertRect(var_i16_38);
+ setPortBitsToPage(0x9);
+ _zbasic->picture(0x5d, 0x22, arr_i32_0[0x3a]); // priestess card
+ _zbasic->picture(0x1b3, 0xb5, arr_i32_0[0x3b]); // fool head
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0x5a);
+ for (int16 k = 0; k <= 8; k++) {
+ for (int16 j = 1; j <= 8; j++) {
+ _toolbox->SetRect(arr_i16_1bc, 0xe9, 0x58, 0xe9, 0x58);
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 1; i <= j; i++) {
+ _toolbox->InsetRect(arr_i16_1bc, -1, -1);
+ _toolbox->InvertOval(arr_i16_1bc);
+ }
+ // 131:3cbe
+ for (int16 i = 1; i <= j; i++) {
+ _toolbox->InsetRect(arr_i16_1bc, 1, 1);
+ _toolbox->InvertOval(arr_i16_1bc);
+ }
+ delayFromMarker(1);
+ }
+ // 131:3d0c
+ if (k == 7) {
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(58).encode(Common::kMacRoman).c_str()); // destroy him
+ drawTextRightAlign(0x1a4, 0x2d);
+ _zbasic->picture(0x181, 0xf, arr_i32_0[0x5a]); // angry priestess
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(59).encode(Common::kMacRoman).c_str()); // destroy him!!!
+ drawTextRightAlign(0x1a4, 0x2d);
+ }
+ // 131:3db8
+ if (k < 8) {
+ for (int16 j = 8; j >= 1; j--) {
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 1; i <= j; i++) {
+ _toolbox->InsetRect(arr_i16_1bc, -1, -1);
+ _toolbox->InvertOval(arr_i16_1bc);
+ }
+ for (int16 i = 1; i <= j; i++) {
+ _toolbox->InsetRect(arr_i16_1bc, 1, 1);
+ _toolbox->InvertOval(arr_i16_1bc);
+ }
+ delayFromMarker(1);
+ }
+ }
+ // 131:3e5e
+ }
+ // 131:3e6c
+ _toolbox->PenPat(arr_pat_194[2]);
+ _toolbox->PenSize(5, 5);
+ _toolbox->PenMode(kPatXor);
+ var_i16_176 = 0xe5;
+ var_i16_180 = 0x58;
+ for (int16 i = 1; i <= 0x13; i++) {
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_176 -= i;
+ var_i16_180 += (int16)(i*0.9f);
+ _toolbox->MoveTo(0xe5, 0x58);
+ _toolbox->LineTo(var_i16_176, var_i16_180);
+ delayFromMarker(0);
+ _toolbox->MoveTo(0xe5, 0x58);
+ _toolbox->LineTo(var_i16_176, var_i16_180);
+ }
+ _toolbox->MoveTo(0xe5, 0x58);
+ _toolbox->LineTo(0x34, 0xf2);
+ var_i16_176 = 0x34;
+ var_i16_180 = 0xf2;
+ for (int16 i = 5; i <= 0x1c; i++) {
+ // 131:3f4c
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_176 += i;
+ var_i16_180 -= (int16)(i*0.5f);
+ _toolbox->MoveTo(0x34, 0xf2);
+ _toolbox->LineTo(var_i16_176, var_i16_180);
+ delayFromMarker(0);
+ _toolbox->MoveTo(0x34, 0xf2);
+ _toolbox->LineTo(var_i16_176, var_i16_180);
+ }
+ // 131:3fd8
+ _toolbox->MoveTo(0x34, 0xf2);
+ _toolbox->LineTo(var_i16_176, var_i16_180);
+ arr_rect_41af4.top = 0;
+ arr_rect_41af4.left = 0;
+ arr_rect_41af4.bottom = SCREEN_HEIGHT;
+ arr_rect_41af4.right = SCREEN_WIDTH;
+ for (int16 i = 0x1e; i >= 0xa; i -= 5) {
+ sub_128_800(var_i16_180 - 3, var_i16_176 - 3, var_i16_180 + 3, var_i16_176 + 3, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, i);
+ }
+
+ for (int16 k = 7; k <= 8; k++) {
+ // 131:4088
+ int16 segs = (k == 7) ? 0x19 : 0x23;
+
+ // 131:40a2
+ var_i32_40 = arr_i32_41296[k];
+ arr_rect_41af4.top = var_i16_180 - 3;
+ arr_rect_41af4.left = var_i16_176 - 3;
+ arr_rect_41af4.bottom = var_i16_180 + 3;
+ arr_rect_41af4.right = var_i16_176 + 3;
+ arr_i16_41afc.top = 0;
+ arr_i16_41afc.left = 0;
+ arr_i16_41afc.bottom = SCREEN_HEIGHT;
+ arr_i16_41afc.right = SCREEN_WIDTH;
+ // unroll loop
+ arr_f64_41bbe[0] = (double)arr_rect_41af4.top;
+ arr_f64_41bbe[0+4] = (double)(arr_i16_41afc.top - arr_rect_41af4.top)/segs;
+ arr_f64_41bbe[1] = (double)arr_rect_41af4.left;
+ arr_f64_41bbe[1+4] = (double)(arr_i16_41afc.left - arr_rect_41af4.left)/segs;
+ arr_f64_41bbe[2] = (double)arr_rect_41af4.bottom;
+ arr_f64_41bbe[2+4] = (double)(arr_i16_41afc.bottom - arr_rect_41af4.bottom)/segs;
+ arr_f64_41bbe[3] = (double)arr_rect_41af4.right;
+ arr_f64_41bbe[3+4] = (double)(arr_i16_41afc.right - arr_rect_41af4.right)/segs;
+
+ // 131:420a
+ var_i16_5c = arr_rect_41af4;
+
+ // 131:425a
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, 0);
+
+ for (int16 j = 1; j <= segs - 1; j++) {
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 i = 0; i <= 3; i++) {
+ arr_f64_41bbe[i] += arr_f64_41bbe[i+4];
+ }
+ // 131:42e6
+ var_i16_5c.top = (int16)arr_f64_41bbe[0];
+ var_i16_5c.left = (int16)arr_f64_41bbe[1];
+ var_i16_5c.bottom = (int16)arr_f64_41bbe[2];
+ var_i16_5c.right = (int16)arr_f64_41bbe[3];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, 0);
+ delayFromMarker(0);
+ // 131:4362
+ }
+ // 131:4376
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, 0);
+
+ }
+ // 131:439a
+ _zbasic->picture(0x1b3, 0xb5, arr_i32_0[0x3b]);
+ arr_i16_41af4[0] = 0;
+ arr_i16_41af4[1] = 0;
+ arr_i16_41af4[2] = 0x200;
+ arr_i16_41af4[3] = 0;
+ arr_i16_41af4[4] = 0x200;
+ arr_i16_41af4[5] = 0x156;
+ arr_i16_41af4[6] = 0;
+ arr_i16_41af4[7] = 0x156;
+ arr_i16_41af4[8] = 0xb5;
+ arr_i16_41af4[9] = 0x22;
+ arr_i16_41af4[10] = 0xb5;
+ arr_i16_41af4[11] = 0xb5;
+ arr_i16_41af4[12] = 0x5d;
+ arr_i16_41af4[13] = 0xb5;
+ arr_i16_41af4[14] = 0x5d;
+ arr_i16_41af4[15] = 0x22;
+
+ finaleCardRotate();
+ finaleCardRotate();
+
+ // 131:44b8
+ sub_128_50a(0x9, 0, SCREEN_WIDTH, 0);
+ copyScreenToPage(0);
+ setPortBitsToPage(0);
+ _zbasic->picture(0x1b5, 0xba, arr_i32_0[0x3c]);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ var_str_76 = _zbasic->str(60); // but the fool had gained the gift of wisdom
+ drawText(0xd2, 0x61);
+ var_str_76 = _zbasic->str(61); // and was able to trick the high priestess
+ drawText(0xd2, 0x72);
+ sub_128_e1c();
+ _toolbox->SetPortBits(var_i32_32);
+ blitPageToScreen(0);
+ setPortBitsToPage(0);
+ _zbasic->picture(0x1b8, 0xb3, arr_i32_0[0x3d]);
+ fillRect(0, 0xc8, 0xa5, SCREEN_WIDTH, 0);
+
+ // 131:45a4
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ var_str_76 = _zbasic->str(62); // he had remembered well the words
+ drawText(0xd2, 0x3f);
+ var_str_76 = _zbasic->str(63); // of the magician
+ drawText(0xd2, 0x50);
+ var_str_76 = Common::U32String::format("\"%s", _zbasic->str(64).encode().c_str()); // the high priestess may have learned how
+ drawText(0xd7, 0x6d);
+ var_str_76 = _zbasic->str(65); // to command the sacred book of thoth
+ drawText(0xde, 0x7e);
+ var_str_76 = _zbasic->str(66); // but even she cannot force it to do
+ drawText(0xde, 0x8f);
+ var_str_76 = Common::U32String::format("%s\"", _zbasic->str(67).encode().c_str()); // anything inherently evil
+ drawText(0xde, 0xa0);
+ // 131:46aa
+ _toolbox->SetPortBits(var_i32_32);
+ sub_128_e58();
+ blitPageToScreen(0);
+ copyScreenToPage(0);
+ setPortBitsToPage(0);
+ _zbasic->picture(0x1c4, 0xb3, arr_i32_0[0x3e]);
+ fillRect(0, 0xc8, 0xa5, SCREEN_WIDTH, 0);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+
+ var_str_76 = _zbasic->str(68); // some say that the story of the fool and his
+ drawText(0xd2, 0x5c);
+ var_str_76 = _zbasic->str(69); // adventures inspired the creation of the
+ drawText(0xd2, 0x6d);
+ var_str_76 = _zbasic->str(70); // modern day tarot deck
+ drawText(0xd2, 0x7e);
+
+ // 131:4780
+ _toolbox->SetPortBits(var_i32_32);
+ sub_128_e58();
+ blitPageToScreen(0);
+ copyScreenToPage(0);
+ setPortBitsToPage(0);
+ _zbasic->picture(0x1be, 0xb4, arr_i32_0[0x3f]);
+ fillRect(0, 0xc8, 0x96, SCREEN_WIDTH, 0);
+ fillRect(0x12c, 0x12c, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(71).encode().c_str()); // but I doubt it
+ drawText(0x184, 0xb1);
+ // 131:4848
+ _toolbox->SetPortBits(var_i32_32);
+ sub_128_e58();
+ blitPageToScreen(0);
+ var_i32_2 = _toolbox->TickCount();
+ setPortBitsToPage(0);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0x78);
+
+ _toolbox->PenNormal();
+ _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenSize(4, 3);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, 0x201, 0x156);
+ for (int16 i = 0; i <= 0x200; i++) {
+ if ((i % 4) == 0) {
+ var_i32_2 = _toolbox->TickCount();
+ }
+ // 131:48ea
+ if ((i % 2) == 0) {
+ arr_i16_1bc.top = (int16)(i/2.5);
+ }
+ // 131:4936
+ arr_i16_1bc.left = i;
+ if ((i % 10) == 0) {
+ arr_i16_1bc.bottom = SCREEN_HEIGHT - (i/10);
+ }
+ // 131:498a
+ if (i > 0x1bd) {
+ arr_i16_1bc.right -= 1;
+ }
+ // 131:49b6
+ _toolbox->FrameRect(arr_i16_1bc);
+ if ((i % 4) == 3) {
+ delayFromMarker(0);
+ }
+ // 131:49e2
+ }
+ // 131:49f0
+ fillRect(0, 0, 0x3e8, 0x3e8, 1);
+ sub_128_50a(0, 0, SCREEN_WIDTH, 2);
+ delay(0x28);
+ // var_i16_3f2 = 0x10a;
+ int16 yPic = 0x5a;
+ for (int16 j = 0x40; j <= 0x45; j++) {
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[0];
+ _toolbox->SetPortBits(var_i32_40);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x78, yPic, arr_i32_0[j]);
+ int16 textCount = _zbasic->readDataInt();
+ int16 textWidth = _zbasic->readDataInt();
+ int16 yOffset = 0x41 - (textWidth / 2);
+ for (int16 i = 1; i <= textCount; i++) {
+ int16 textSize = _zbasic->readDataInt();
+ var_str_76 = _zbasic->readDataStr();
+ _zbasic->text(kPrologueFontFool, textSize, 0, kSrcBic);
+ if (textSize == 0xc) {
+ yOffset += 0x19;
+ } else {
+ // 131:4afa
+ yOffset += 0x20;
+ }
+ // 131:4b00
+ drawText(0xe6, yOffset + yPic);
+ }
+ // 131:4b2a
+ delayFromMarker(0x14);
+ _toolbox->SetPortBits(var_i32_32);
+ blitPageToScreen(0);
+ if (j == 0x40) {
+ delay(0xd2);
+ } else {
+ // 131:4b54
+ delay(0xb4);
+ }
+ // 131:4b5e
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ }
+ // 131:4b86
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[0];
+ _toolbox->SetPortBits(var_i32_40);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->text(kPrologueFontSmall, 9, 0, kSrcBic);
+ var_str_76 = _zbasic->str(72); // the fool's errand
+ drawTextCenterAlign(0x100, 0x19 + yPic + 0x19);
+ var_str_76 = _zbasic->str(73); // (c) 1987 by cliff johnson. all rights reserved
+ drawTextCenterAlign(0x100, 0x32 + yPic + 0x19);
+ var_str_76 = _zbasic->str(74); // portions of this code are copyrighted 1985 zedcor inc
+ drawTextCenterAlign(0x100, 0x4b + yPic + 0x19);
+ var_str_76 = _zbasic->str(75); // the fool's errand is a registered trademark of cliff johnson
+ drawTextCenterAlign(0x100, 0x64 + yPic + 0x19);
+ // 131:4c94
+ delayFromMarker(0x14);
+ _toolbox->SetPortBits(var_i32_32);
+ blitPageToScreen(0);
+ delay(0xb4);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[0];
+ _toolbox->SetPortBits(var_i32_40);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+
+ _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ var_str_76 = _zbasic->str(76); // and yes, the fool will return in
+ drawTextCenterAlign(0x100, 0xa0);
+ _zbasic->text(kPrologueFontFool, 0x18, 0, kSrcBic);
+ var_str_76 = _zbasic->str(77); // the fool and his money
+ drawTextCenterAlign(0x100, 0xc8);
+ delayFromMarker(0x14);
+ _toolbox->SetPortBits(var_i32_32);
+ blitPageToScreen(0);
+ delay(0xd2);
+ for (int16 i = 0x40; i <= 0x47; i++) {
+ _toolbox->ReleaseResource(arr_i32_0[i]);
+ }
}
void FoolPrologue::finaleDrawLoadingMsg() {
+ // 131:4dc0
// FIXME: we don't share the menu surface here yet
return;
- // 131:4dc0
_toolbox->SetPort(this->var_i32_c);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Finale
@@ -1160,5 +1574,44 @@ void FoolPrologue::sub_131_4f96(int16 offset) {
);
}
+void FoolPrologue::finaleCardRotate() {
+ // 131:5038
+ _toolbox->PenNormal();
+ _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenMode(kPatXor);
+ var_i16_18e = 0x21;
+ for (int16 i = 0; i <= 7; i++) {
+ arr_f64_41bbe[i] = (double)arr_i16_41af4[i];
+ arr_f64_41bbe[i+8] = (double)(arr_i16_41af4[i+8] - arr_i16_41af4[i])/var_i16_18e;
+ }
+ // 131:5106
+ _toolbox->MoveTo(arr_i16_41af4[0], arr_i16_41af4[1]);
+ _toolbox->LineTo(arr_i16_41af4[2], arr_i16_41af4[3]);
+ _toolbox->LineTo(arr_i16_41af4[4], arr_i16_41af4[5]);
+ _toolbox->LineTo(arr_i16_41af4[6], arr_i16_41af4[7]);
+ _toolbox->LineTo(arr_i16_41af4[0], arr_i16_41af4[1]);
+
+ for (int16 i = 1; i <= var_i16_18e - 1; i++) {
+ // 131:51ca
+ var_i32_2 = _toolbox->TickCount();
+ for (int16 j = 0; j <= 7; j++) {
+ arr_f64_41bbe[j] += arr_f64_41bbe[j+8];
+ arr_i16_41af4[j + 0x10] = (int16)arr_f64_41bbe[j];
+ }
+ // 131:5276
+ _toolbox->MoveTo(arr_i16_41af4[0x10], arr_i16_41af4[0x11]);
+ _toolbox->LineTo(arr_i16_41af4[0x12], arr_i16_41af4[0x13]);
+ _toolbox->LineTo(arr_i16_41af4[0x14], arr_i16_41af4[0x15]);
+ _toolbox->LineTo(arr_i16_41af4[0x16], arr_i16_41af4[0x17]);
+ _toolbox->LineTo(arr_i16_41af4[0x10], arr_i16_41af4[0x11]);
+ delayFromMarker(1);
+ }
+ // 131:534e
+ _toolbox->MoveTo(arr_i16_41af4[0x8], arr_i16_41af4[0x9]);
+ _toolbox->LineTo(arr_i16_41af4[0xa], arr_i16_41af4[0xb]);
+ _toolbox->LineTo(arr_i16_41af4[0xc], arr_i16_41af4[0xd]);
+ _toolbox->LineTo(arr_i16_41af4[0xe], arr_i16_41af4[0xf]);
+ _toolbox->LineTo(arr_i16_41af4[0x8], arr_i16_41af4[0x9]);
+}
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 4503cdfcfe6..db8a88ab3cf 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -163,22 +163,22 @@ void FoolPrologue::delayFromMarker(int16 numTicks) {
void FoolPrologue::drawTextRightAlign(int16 x, int16 y) {
// 128:026c
- this->var_i32_182 = _toolbox->StringWidth(this->var_str_76);
- _toolbox->MoveTo(x - this->var_i32_182, y);
+ int16 width = _toolbox->StringWidth(this->var_str_76);
+ _toolbox->MoveTo(x - width, y);
_toolbox->DrawString(this->var_str_76);
}
void FoolPrologue::drawTextCenterAlign(int16 x, int16 y) {
// 128:02a6
- this->var_i32_182 = _toolbox->StringWidth(this->var_str_76);
- _toolbox->MoveTo(x - (this->var_i32_182 / 2), y);
+ int16 width = _toolbox->StringWidth(this->var_str_76);
+ _toolbox->MoveTo(x - (width / 2), y);
_toolbox->DrawString(this->var_str_76);
}
void FoolPrologue::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:02f0
- _toolbox->SetRect(this->arr_i16_41af4, left, top, right, bottom);
- _toolbox->FillRect(this->arr_i16_41af4, this->arr_pat_194[patternID]);
+ _toolbox->SetRect(this->arr_rect_41af4, left, top, right, bottom);
+ _toolbox->FillRect(this->arr_rect_41af4, this->arr_pat_194[patternID]);
}
void FoolPrologue::zoomClose(int16 patternID, PatternMode mode) {
@@ -295,10 +295,10 @@ void FoolPrologue::zoomTransition(int16 screenPage) {
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
// 128:0800
- this->arr_i16_41af4.top = unk1;
- this->arr_i16_41af4.left = unk2;
- this->arr_i16_41af4.bottom = unk3;
- this->arr_i16_41af4.right = unk4;
+ this->arr_rect_41af4.top = unk1;
+ this->arr_rect_41af4.left = unk2;
+ this->arr_rect_41af4.bottom = unk3;
+ this->arr_rect_41af4.right = unk4;
this->arr_i16_41afc.top = unk5;
this->arr_i16_41afc.left = unk6;
this->arr_i16_41afc.bottom = unk7;
@@ -307,17 +307,17 @@ void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t
_toolbox->PenMode(kPatXor);
// 128:08bc
- this->arr_f64_41bbe[0] = (double)this->arr_i16_41af4.top;
- this->arr_f64_41bbe[1] = (double)this->arr_i16_41af4.left;
- this->arr_f64_41bbe[2] = (double)this->arr_i16_41af4.bottom;
- this->arr_f64_41bbe[3] = (double)this->arr_i16_41af4.right;
- this->arr_f64_41bbe[4] = (double)(this->arr_i16_41afc.top - this->arr_i16_41af4.top)/(double)(unk9);
- this->arr_f64_41bbe[5] = (double)(this->arr_i16_41afc.left - this->arr_i16_41af4.left)/(double)(unk9);
- this->arr_f64_41bbe[6] = (double)(this->arr_i16_41afc.bottom - this->arr_i16_41af4.bottom)/(double)(unk9);
- this->arr_f64_41bbe[7] = (double)(this->arr_i16_41afc.right - this->arr_i16_41af4.right)/(double)(unk9);
+ this->arr_f64_41bbe[0] = (double)this->arr_rect_41af4.top;
+ this->arr_f64_41bbe[1] = (double)this->arr_rect_41af4.left;
+ this->arr_f64_41bbe[2] = (double)this->arr_rect_41af4.bottom;
+ this->arr_f64_41bbe[3] = (double)this->arr_rect_41af4.right;
+ this->arr_f64_41bbe[4] = (double)(this->arr_i16_41afc.top - this->arr_rect_41af4.top)/(double)(unk9);
+ this->arr_f64_41bbe[5] = (double)(this->arr_i16_41afc.left - this->arr_rect_41af4.left)/(double)(unk9);
+ this->arr_f64_41bbe[6] = (double)(this->arr_i16_41afc.bottom - this->arr_rect_41af4.bottom)/(double)(unk9);
+ this->arr_f64_41bbe[7] = (double)(this->arr_i16_41afc.right - this->arr_rect_41af4.right)/(double)(unk9);
// 128:096e
- _toolbox->PaintRect(this->arr_i16_41af4);
+ _toolbox->PaintRect(this->arr_rect_41af4);
for (int i = 1; i <= (unk9 - 1); i++) {
this->var_i32_2 = _toolbox->TickCount();
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index fd5ea1a63d3..52b43e03bb4 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -92,6 +92,8 @@ public:
void finaleStartText(); // sub_131_4e98
void sub_131_4f96(int16 offset);
+ void finaleCardRotate(); // sub_131_5038
+
private:
Toolbox *_toolbox;
ZBasic *_zbasic;
@@ -135,7 +137,6 @@ private:
int16 var_i16_176;
int16 var_i16_180;
- int32 var_i32_182;
int16 var_i16_18c;
int16 var_i16_18e;
@@ -205,12 +206,13 @@ private:
int16 arr_i16_41598[SCREEN_HEIGHT] = { 0 };
int16 arr_i16_41846[SCREEN_HEIGHT] = { 0 };
- Common::Rect arr_i16_41af4;
+ int16 arr_i16_41af4[32];
+ Common::Rect arr_rect_41af4;
Common::Rect arr_i16_41afc;
int16 arr_i16_41b04[3];
Common::Rect arr_i16_41b0a;
- double arr_f64_41bbe[8] = { 0 };
+ double arr_f64_41bbe[16] = { 0 };
PicHandle glob_i32_2ce;
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 6e191024b31..75f07ddb29e 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -530,9 +530,6 @@ void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
r.right -= dh;
r.top += dv;
r.bottom -= dv;
- if ((r.width() < 1) || (r.height() < 1)) {
- r = { 0, 0, 0, 0 };
- }
}
void Toolbox::InvertOval(const Common::Rect &r) {
Commit: 766f700beda1b7dec5312d571adc706783a776e1
https://github.com/scummvm/scummvm/commit/766f700beda1b7dec5312d571adc706783a776e1
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:32+02:00
Commit Message:
FOOL: Clean up variables
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/toolbox.h
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 4b22781239e..3c0d03cd616 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -188,12 +188,12 @@ void FoolGame::cardsDrawTable() {
this->drawTarotCard(3, 6, 0);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// 139:061a
- this->drawStringCenter(_zbasic->str(OFF(0)), 0xc3); // Select a card above
- this->drawStringCenter(_zbasic->str(OFF(1)), 0xd4); // or
+ this->drawTextCenter(_zbasic->str(OFF(0)), 0xc3); // Select a card above
+ this->drawTextCenter(_zbasic->str(OFF(1)), 0xd4); // or
_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
_zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->drawStringCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
+ this->drawTextCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
this->var_i16_2016 = 1;
this->var_i16_2010 = 1;
this->waitForMouseUp();
@@ -279,7 +279,7 @@ void FoolGame::cardsOnClick() {
// original code has the font ID as 1... maybe there's a fallback?
// this was intended to be Small
_zbasic->text(kFontSmall, 9, Graphics::kMacFontRegular, kSrcBic);
- this->drawStringCenter(_zbasic->str(OFF(3)), strY); // (click mouse to continue)
+ this->drawTextCenter(_zbasic->str(OFF(3)), strY); // (click mouse to continue)
this->var_i16_2014 = 0;
_stateFlags = 0;
while ((_stateFlags == 0) && (this->var_i16_2014 == 0)) {
@@ -389,7 +389,7 @@ void FoolGame::cardsOpponentYields() {
this->var_i16_2012 = -CARDS_YIELD_PENALTY;
this->cardsDrawScores();
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->drawStringCenter(_zbasic->str(OFF(4)), 0xc4); // The Old Man yields
+ this->drawTextCenter(_zbasic->str(OFF(4)), 0xc4); // The Old Man yields
}
void FoolGame::cardsRevealHands() {
@@ -515,10 +515,10 @@ void FoolGame::cardsRevealHands() {
this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
this->fillRect(0x2e, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->drawStringCenter(this->var_str_384, 0x46);
- this->drawStringCenter(this->var_str_167c, 0x64);
- this->drawStringCenter(_zbasic->str(OFF(16)), 0x78); // beats
- this->drawStringCenter(this->var_str_2222, 0x8c);
+ this->drawTextCenter(this->var_str_384, 0x46);
+ this->drawTextCenter(this->var_str_167c, 0x64);
+ this->drawTextCenter(_zbasic->str(OFF(16)), 0x78); // beats
+ this->drawTextCenter(this->var_str_2222, 0x8c);
if (this->arr_i16_1eb8[1] != 0) {
this->var_i16_68a = this->arr_i16_1eb8[1];
if (this->var_i16_68a > 8) {
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index 94129867d71..cecf0309e4d 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -34,9 +34,9 @@ namespace Fool {
// run finale
void FoolPrologue::finaleRun() {
// 131:0004
- this->var_i16_3ce = 0x2d;
- this->finaleDrawLoadingMsg();
- this->var_i32_3d6 = _toolbox->OpenPoly();
+ var_i16_3ce = 0x2d;
+ finaleDrawLoadingMsg();
+ var_i32_3d6 = _toolbox->OpenPoly();
_toolbox->MoveTo(0xc8, 0x8d);
_toolbox->LineTo(0x1df, 0xc8);
_toolbox->LineTo(0x1d2, 0x11b);
@@ -44,175 +44,174 @@ void FoolPrologue::finaleRun() {
_toolbox->LineTo(0xc8, 0x8d);
_toolbox->ClosePoly();
// 131:004c
- this->arr_i32_0[0x1f] = _toolbox->GetPicture(0x1f);
- this->setPortBitsToPage(0x4);
- _zbasic->picture(0x0, 0x0, this->arr_i32_0[0x1f]);
- _toolbox->ReleaseResource(this->arr_i32_0[0x1f]);
- this->finaleDrawLoadingMsg();
+ _pics[0x1f] = _toolbox->GetPicture(0x1f);
+ setPortBitsToPage(0x4);
+ _zbasic->picture(0x0, 0x0, _pics[0x1f]);
+ _toolbox->ReleaseResource(_pics[0x1f]);
+ finaleDrawLoadingMsg();
for (int i = 0x14; i <= 0x1e; i++) {
// 131:009c
- this->arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
if ((i % 3) == 0) {
- this->var_i16_3ce += 5;
- this->finaleDrawLoadingMsg();
+ var_i16_3ce += 5;
+ finaleDrawLoadingMsg();
}
}
// 131:00e6
for (int i = 6; i <= 9; i++) {
- this->setPortBitsToPage(i);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ setPortBitsToPage(i);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
// 131:0110
if (i < 8) {
- _zbasic->picture(0, 0x3, this->arr_i32_0[0x19]);
+ _zbasic->picture(0, 0x3, _pics[0x19]);
}
if (i == 8) {
- _zbasic->picture(0, 0, this->arr_i32_0[0x1a]);
+ _zbasic->picture(0, 0, _pics[0x1a]);
}
if (i == 9) {
- _zbasic->picture(0x60, 0x4c, this->arr_i32_0[0x1b]);
+ _zbasic->picture(0x60, 0x4c, _pics[0x1b]);
}
}
// 131:0184
for (int i = 0x19; i <= 0x1b; i++) {
- _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
// 131:01aa
- this->arr_i32_0[0x13] = _toolbox->GetPicture(0x13);
- this->setPortBitsToPage(0x5);
- _zbasic->picture(0, 0xb4, this->arr_i32_0[0x13]);
- _zbasic->picture(0, 0, this->arr_i32_0[0x18]);
- _toolbox->ReleaseResource(this->arr_i32_0[0x13]);
- _toolbox->ReleaseResource(this->arr_i32_0[0x18]);
- this->finaleStartText();
- this->var_i16_3ce = 0x4b;
- this->finaleDrawLoadingMsg();
+ _pics[0x13] = _toolbox->GetPicture(0x13);
+ setPortBitsToPage(0x5);
+ _zbasic->picture(0, 0xb4, _pics[0x13]);
+ _zbasic->picture(0, 0, _pics[0x18]);
+ _toolbox->ReleaseResource(_pics[0x13]);
+ _toolbox->ReleaseResource(_pics[0x18]);
+ finaleStartText();
+ var_i16_3ce = 0x4b;
+ finaleDrawLoadingMsg();
// 131:021e
for (int i = 0x20; i <= 0x2f; i++) {
- this->arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
if (i % 3) {
- this->var_i16_3ce += 5;
- this->finaleDrawLoadingMsg();
+ var_i16_3ce += 5;
+ finaleDrawLoadingMsg();
}
}
// 131:026e
- this->var_i16_18e = SCREEN_HEIGHT;
- this->shuffleScanlines();
- this->var_i32_1a6 = _zbasic->mem(-1);
- _toolbox->SetPortBits(this->var_i32_32);
- if (!((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT))) {
+ var_i16_18e = SCREEN_HEIGHT;
+ shuffleScanlines();
+ var_i32_1a6 = _zbasic->mem(-1);
+ _toolbox->SetPortBits(var_i32_32);
+ if (!((var_i16_10 == SCREEN_WIDTH) && (var_i16_12 == SCREEN_HEIGHT))) {
// 131:02ac
- this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
+ fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
} else {
- _toolbox->SetPort(this->var_i32_c);
- this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
+ _toolbox->SetPort(var_i32_c);
+ fillRect(0, 0, 0x14, var_i16_10, 2);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
}
// 131:02ec
- this->delay(0x3c);
- this->zoomTransition(0x5);
- this->sub_128_e58();
+ delay(0x3c);
+ zoomTransition(0x5);
+ sub_128_e58();
if (_quit)
return;
// xor out the start text
- this->finaleStartText();
+ finaleStartText();
_zbasic->restore(0x4c);
for (int j = 1; j <= 0xe; j++) {
- this->var_i16_3da = 1;
+ var_i16_3da = 1;
// 131:030c
- this->var_i16_18e = _zbasic->readDataInt();
- for (int i = 1; i <= this->var_i16_18e; i++) {
+ var_i16_18e = _zbasic->readDataInt();
+ for (int i = 1; i <= var_i16_18e; i++) {
// 131:031a
- this->arr_i16_1e8[i] = _zbasic->readDataInt();
- this->arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
- this->arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
+ arr_i16_1e8[i] = _zbasic->readDataInt();
+ arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
+ arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
}
// 131:0380
_toolbox->PenMode(kPatXor);
- this->drawTreasurePhaseIn(0x14);
- this->drawTreasurePhaseIn(0xa);
- this->drawTreasurePhaseIn(0x14);
- this->drawTreasurePhaseIn(0x5);
- this->drawTreasurePhaseIn(0xa);
- this->drawTreasurePhaseIn(0x5);
+ drawTreasurePhaseIn(0x14);
+ drawTreasurePhaseIn(0xa);
+ drawTreasurePhaseIn(0x14);
+ drawTreasurePhaseIn(0x5);
+ drawTreasurePhaseIn(0xa);
+ drawTreasurePhaseIn(0x5);
_toolbox->PenNormal();
- this->drawTreasurePhaseIn(0x0);
+ drawTreasurePhaseIn(0x0);
}
// 131:03c0
- this->delay(0x1e);
+ delay(0x1e);
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- // well, that's that!
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(22).encode().c_str());
// 131:0400
- this->drawText(0x17c, 0xb4);
- this->delay(0x1e);
+ // well, that's that!
+ drawText(Common::U32String::format("\"%s\"", _zbasic->str(22).encode().c_str()), 0x17c, 0xb4);
+ delay(0x1e);
// 131:041a
// fool nods and puts away map
- _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
- this->delay(0x2);
- _zbasic->picture(0x1cd, 0xbf, this->arr_i32_0[0x15]);
- this->delay(0x3c);
- _zbasic->picture(0x1cd, 0xbd, this->arr_i32_0[0x14]);
- this->delay(0x6);
- _zbasic->picture(0x1a6, 0xbf, this->arr_i32_0[0x16]);
- this->delay(0x6);
- _zbasic->picture(0x1b3, 0xc5, this->arr_i32_0[0x17]);
- this->delay(0);
+ _zbasic->picture(0x1cd, 0xbd, _pics[0x14]);
+ delay(0x2);
+ _zbasic->picture(0x1cd, 0xbf, _pics[0x15]);
+ delay(0x3c);
+ _zbasic->picture(0x1cd, 0xbd, _pics[0x14]);
+ delay(0x6);
+ _zbasic->picture(0x1a6, 0xbf, _pics[0x16]);
+ delay(0x6);
+ _zbasic->picture(0x1b3, 0xc5, _pics[0x17]);
+ delay(0);
// 131:04b4
for (int i = 0x14; i <= 0x17; i++) {
- _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
// 131:04da
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[5];
- _toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ var_i32_40 = arr_i32_41296[5];
+ _toolbox->CopyBits(var_i32_32, var_i32_40, var_i16_38, var_i16_38, kSrcCopy, nullptr);
setPortBitsToPage(5);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- this->finaleDrawFoolUhOh();
+ fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ finaleDrawFoolUhOh();
// 131:0538
- _toolbox->CopyBits(this->var_i32_32, this->var_i32_4e, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
- _toolbox->SetPortBits(this->var_i32_4e);
+ _toolbox->CopyBits(var_i32_32, var_i32_4e, var_i16_38, var_i16_38, kSrcCopy, nullptr);
+ _toolbox->SetPortBits(var_i32_4e);
// 131:0554
- this->fillRect(0, 0, 0xa0, 0x15e, 0);
- this->fillRect(0xa0, 0x5a, 0xd2, 0xaa, 0);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ fillRect(0, 0, 0xa0, 0x15e, 0);
+ fillRect(0xa0, 0x5a, 0xd2, 0xaa, 0);
+ fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
// 131:05b0
- this->setPortBitsToPage(6);
- _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->setPortBitsToPage(7);
- _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->setPortBitsToPage(8);
- _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
- this->setPortBitsToPage(9);
- _toolbox->CopyBits(this->var_i32_4e, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcOr, nullptr);
+ setPortBitsToPage(6);
+ _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ setPortBitsToPage(7);
+ _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ setPortBitsToPage(8);
+ _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ setPortBitsToPage(9);
+ _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
// 131:0630
// tree morphing into priestess
- _toolbox->SetPortBits(this->var_i32_32);
- _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, this->arr_i32_3bca4);
- this->delayFromMarker(0x3c);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ _toolbox->SetPortBits(var_i32_32);
+ _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, arr_i32_3bca4);
+ delayFromMarker(0x3c);
+ fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
sub_128_50a(0x6, 0, SCREEN_WIDTH, 0x3);
- this->finaleDrawFoolUhOh();
+ finaleDrawFoolUhOh();
// 131:06aa
- this->sub_128_50a(5, 0, SCREEN_WIDTH, 2);
- this->sub_128_50a(7, 0, SCREEN_WIDTH, 2);
- this->sub_128_50a(8, 0, SCREEN_WIDTH, 1);
- this->fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- this->sub_128_50a(0x9, 0, SCREEN_WIDTH, 1);
+ sub_128_50a(5, 0, SCREEN_WIDTH, 2);
+ sub_128_50a(7, 0, SCREEN_WIDTH, 2);
+ sub_128_50a(8, 0, SCREEN_WIDTH, 1);
+ fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
+ sub_128_50a(0x9, 0, SCREEN_WIDTH, 1);
// the wind picks up
_toolbox->PenNormal();
@@ -220,35 +219,35 @@ void FoolPrologue::finaleRun() {
_zbasic->unk_20();
// 131:0730
- this->var_i16_3dc = 0;
- this->var_i16_18e = 0;
+ var_i16_3dc = 0;
+ var_i16_18e = 0;
for (int j = 1; j <= 0x63; j++) {
- if (this->var_i16_3dc < SCREEN_HEIGHT) {
+ if (var_i16_3dc < SCREEN_HEIGHT) {
// 131:074e
- this->var_i16_3dc += _zbasic->maybe() ? 0x4 : 0x5;
+ var_i16_3dc += _zbasic->maybe() ? 0x4 : 0x5;
}
- if (this->var_i16_18e < 0x41) {
+ if (var_i16_18e < 0x41) {
// 131:0770
- this->var_i16_18e += 1;
- this->arr_i16_1e8[this->var_i16_18e] = _zbasic->rndInt(32);
- this->arr_i16_1e8[this->var_i16_18e+0xfb] = _zbasic->rndInt(this->var_i16_3dc);
- this->arr_i16_1e8[this->var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
- this->sub_131_4f96(this->var_i16_18e);
+ var_i16_18e += 1;
+ arr_i16_1e8[var_i16_18e] = _zbasic->rndInt(32);
+ arr_i16_1e8[var_i16_18e+0xfb] = _zbasic->rndInt(var_i16_3dc);
+ arr_i16_1e8[var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
+ finaleDrawWind(var_i16_18e);
}
// 131:07ea
- for (int i = 1; i <= this->var_i16_18e; i++) {
- this->sub_131_4f96(i);
- this->arr_i16_1e8[i] += this->arr_i16_1e8[0x1f6+i]*2;
+ for (int i = 1; i <= var_i16_18e; i++) {
+ finaleDrawWind(i);
+ arr_i16_1e8[i] += arr_i16_1e8[0x1f6+i]*2;
// 131:0870
- if (this->arr_i16_1e8[i] > SCREEN_WIDTH) {
- this->arr_i16_1e8[i] = 1;
- this->arr_i16_1e8[0xfb+i] = _zbasic->rndInt(this->var_i16_3dc);
- this->arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
+ if (arr_i16_1e8[i] > SCREEN_WIDTH) {
+ arr_i16_1e8[i] = 1;
+ arr_i16_1e8[0xfb+i] = _zbasic->rndInt(var_i16_3dc);
+ arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
}
// 131:0902
- this->sub_131_4f96(i);
+ finaleDrawWind(i);
}
// Simulate slow redraw
_toolbox->Delay(0);
@@ -256,359 +255,358 @@ void FoolPrologue::finaleRun() {
// 131:0926
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->PenPat(this->arr_pat_194[3]);
- _zbasic->picture(0x6d, 0x49, this->arr_i32_0[0x1c]);
- _zbasic->picture(0x65, 0x48, this->arr_i32_0[0x1d]);
- _zbasic->picture(0x64, 0x54, this->arr_i32_0[0x1e]);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->PenPat(_patterns[3]);
+ _zbasic->picture(0x6d, 0x49, _pics[0x1c]);
+ _zbasic->picture(0x65, 0x48, _pics[0x1d]);
+ _zbasic->picture(0x64, 0x54, _pics[0x1e]);
// 131:099c
// zzzzap
- _toolbox->PaintPoly(this->var_i32_3d6);
+ _toolbox->PaintPoly(var_i32_3d6);
for (int i = 0; i <= 0x21; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->InvertRect(this->arr_i16_1bc);
- this->delayFromMarker(0);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(arr_i16_1bc);
+ delayFromMarker(0);
}
// 131:09d2
- this->sub_128_800(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- this->sub_128_800(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- this->sub_128_800(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- this->sub_128_800(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ sub_128_800(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ sub_128_800(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ sub_128_800(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ sub_128_800(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
// 131:0a7a
// horrible flashing fool duplication spree
for (int i = 1; i <= 0x63; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i16_74 = _zbasic->rndInt(0x1ca);
- this->var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, (i % 2) ? kSrcCopy : kNotSrcCopy);
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_74 = _zbasic->rndInt(0x1ca);
+ var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->put(var_i16_74, var_i16_192, arr_i32_3bca4, (i % 2) ? kSrcCopy : kNotSrcCopy);
// limit flashing to WCAG recommendation
if ((i % 10) == 0) {
- _toolbox->InvertRect(this->arr_i16_1bc);
+ _toolbox->InvertRect(arr_i16_1bc);
}
- this->delayFromMarker(0);
+ delayFromMarker(0);
}
// 131:0aec
// scrumble the contents of the screen for a few seconds
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
// 131:0af6
- while (_toolbox->TickCount() < (this->var_i32_2 + 0x78)) {
- this->var_i16_74 = _zbasic->rndInt(0x1ca);
- this->var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->get(this->var_i16_74, this->var_i16_192, this->var_i16_74 + 0x36, this->var_i16_192 + 0x5a, this->arr_i32_3bca4);
+ while (_toolbox->TickCount() < (var_i32_2 + 0x78)) {
+ var_i16_74 = _zbasic->rndInt(0x1ca);
+ var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->get(var_i16_74, var_i16_192, var_i16_74 + 0x36, var_i16_192 + 0x5a, arr_i32_3bca4);
// 131:0b54
- this->var_i16_74 = _zbasic->rndInt(0x1ca);
- this->var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->put(this->var_i16_74, this->var_i16_192, this->arr_i32_3bca4, kSrcCopy);
+ var_i16_74 = _zbasic->rndInt(0x1ca);
+ var_i16_192 = _zbasic->rndInt(0xfc);
+ _zbasic->put(var_i16_74, var_i16_192, arr_i32_3bca4, kSrcCopy);
_toolbox->Delay(0);
}
// 131:0bb0
// fade in to seascape
- this->sub_128_50a(4, 0, SCREEN_WIDTH, 3);
- this->setPortBitsToPage(5);
- this->copyScreenToPage(5);
+ sub_128_50a(4, 0, SCREEN_WIDTH, 3);
+ setPortBitsToPage(5);
+ copyScreenToPage(5);
// fade in the fool
- _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
- _toolbox->SetPortBits(this->var_i32_32);
- this->delay(0x3c);
- this->sub_128_50a(5, 0, SCREEN_WIDTH, 0);
+ _zbasic->picture(0x198, 0x102, _pics[0x25]);
+ _toolbox->SetPortBits(var_i32_32);
+ delay(0x3c);
+ sub_128_50a(5, 0, SCREEN_WIDTH, 0);
// fool looks around
- _zbasic->picture(0x197, 0x101, this->arr_i32_0[0x26]);
+ _zbasic->picture(0x197, 0x101, _pics[0x26]);
// 131:0c36
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->KillPoly(this->var_i32_3d6);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->KillPoly(var_i32_3d6);
for (int i = 0x1c; i < 0x1e; i++) {
- _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
// 131:0c6c
// high priestess becomes giant
for (int i = 0x6; i <= 0xa; i++) {
- //_zbasic->blockMove(*this->arr_i32_41296[5], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[5]);
- }
- this->setPortBitsToPage(0x6);
- _zbasic->picture(0x6, 0x8f, this->arr_i32_0[0x20]);
- this->setPortBitsToPage(0x7);
- _zbasic->picture(0x1a, 0x7e, this->arr_i32_0[0x21]);
- this->setPortBitsToPage(0x8);
- _zbasic->picture(0x2e, 0x6a, this->arr_i32_0[0x22]);
- this->setPortBitsToPage(0x9);
- _zbasic->picture(0x45, 0x4e, this->arr_i32_0[0x23]);
- this->setPortBitsToPage(0xa);
- _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
+ //_zbasic->blockMove(*arr_i32_41296[5], arr_i32_41296[i], 0x5580);
+ arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
+ }
+ setPortBitsToPage(0x6);
+ _zbasic->picture(0x6, 0x8f, _pics[0x20]);
+ setPortBitsToPage(0x7);
+ _zbasic->picture(0x1a, 0x7e, _pics[0x21]);
+ setPortBitsToPage(0x8);
+ _zbasic->picture(0x2e, 0x6a, _pics[0x22]);
+ setPortBitsToPage(0x9);
+ _zbasic->picture(0x45, 0x4e, _pics[0x23]);
+ setPortBitsToPage(0xa);
+ _zbasic->picture(0x73, 0x28, _pics[0x24]);
// 131:0d64
for (int i = 0x20; i <= 0x23; i++) {
- _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
- _toolbox->SetPortBits(this->var_i32_32);
- this->delayFromMarker(0x64);
- _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0x64);
+ _zbasic->picture(0x198, 0x102, _pics[0x25]);
for (int i = 0x6; i <= 0xa; i++) {
- this->delay(0xf);
- this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
+ delay(0xf);
+ sub_128_50a(i, 0, SCREEN_WIDTH, 1);
}
- _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
- this->delay(0x3c);
+ _zbasic->picture(0x191, 0x102, _pics[0x27]);
+ delay(0x3c);
// 131:0e08
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// Are you still angry with me?
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(23).encode().c_str());
- this->drawText(0x1f4 - _toolbox->StringWidth(this->var_str_76), 0xd2);
- this->var_i32_2 = _toolbox->TickCount();
+ drawText(
+ Common::U32String::format("\"%s\"", _zbasic->str(23).encode().c_str()),
+ 0x1f4 - _toolbox->StringWidth(var_str_76),
+ 0xd2
+ );
+ var_i32_2 = _toolbox->TickCount();
// 131:0e76
- //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[5], 0x5580);
- this->arr_i32_41296[5]->copyFrom(*this->arr_i32_41296[4]);
- this->setPortBitsToPage(0x5);
- _zbasic->picture(0x73, 0x28, this->arr_i32_0[0x24]);
- _zbasic->picture(0x191, 0x102, this->arr_i32_0[0x27]);
- _zbasic->picture(0x8a, 0x24, this->arr_i32_0[0x28]);
- this->setPortBitsToPage(0x6);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x29]); // wadjet eye mask
- this->setPortBitsToPage(0x7);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x118, 0x19, this->arr_i32_0[0x2a]); // wadjet eye
- //_zbasic->blockMove(this->arr_i32_41296[5], this->arr_i32_41296[8], 0x5580);
- this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[5]);
- this->setPortBitsToPage(0x8);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
- //_zbasic->blockMove(this->arr_i32_41296[4], this->arr_i32_41296[9], 0x5580);
- this->arr_i32_41296[9]->copyFrom(*this->arr_i32_41296[4]);
- this->setPortBitsToPage(0x9);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
- this->setPortBitsToPage(0xa);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]);
+ //_zbasic->blockMove(arr_i32_41296[4], arr_i32_41296[5], 0x5580);
+ arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
+ setPortBitsToPage(0x5);
+ _zbasic->picture(0x73, 0x28, _pics[0x24]);
+ _zbasic->picture(0x191, 0x102, _pics[0x27]);
+ _zbasic->picture(0x8a, 0x24, _pics[0x28]);
+ setPortBitsToPage(0x6);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0x118, 0x19, _pics[0x29]); // wadjet eye mask
+ setPortBitsToPage(0x7);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0x118, 0x19, _pics[0x2a]); // wadjet eye
+ //_zbasic->blockMove(arr_i32_41296[5], arr_i32_41296[8], 0x5580);
+ arr_i32_41296[8]->copyFrom(*arr_i32_41296[5]);
+ setPortBitsToPage(0x8);
+ _zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
+ //_zbasic->blockMove(arr_i32_41296[4], arr_i32_41296[9], 0x5580);
+ arr_i32_41296[9]->copyFrom(*arr_i32_41296[4]);
+ setPortBitsToPage(0x9);
+ _zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
+ setPortBitsToPage(0xa);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
// 131:1056
- _toolbox->ReleaseResource(this->arr_i32_0[0x24]);
- _toolbox->SetPortBits(this->var_i32_32);
- this->delayFromMarker(0x78);
- this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- this->sub_128_50a(0x5, 0x64, 0x19c, 0x0);
- this->delay(0x28);
-
- this->var_i16_5c.left = 0x118;
- this->var_i16_5c.right = 0x1d1;
- this->var_i16_5c.top = 0x19;
- this->var_i16_64.left = 0x118;
- this->var_i16_64.right = 0x1d1;
- this->var_i16_64.bottom = 0xdf;
+ _toolbox->ReleaseResource(_pics[0x24]);
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0x78);
+ fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
+ sub_128_50a(0x5, 0x64, 0x19c, 0x0);
+ delay(0x28);
+
+ var_i16_5c.left = 0x118;
+ var_i16_5c.right = 0x1d1;
+ var_i16_5c.top = 0x19;
+ var_i16_64.left = 0x118;
+ var_i16_64.right = 0x1d1;
+ var_i16_64.bottom = 0xdf;
// wadjet eye appears from horizon
for (int i = 0xdc; i >= 0x19; i -= 5) {
// 131:10de
- this->var_i32_2 = _toolbox->TickCount();
- //_zbasic->blockMove(this->arr_i32_41296[5], *this->var_i32_4e, 0x5580);
- this->var_i32_4e->copyFrom(*this->arr_i32_41296[5]);
- this->var_i16_64.top = i;
- this->var_i16_5c.bottom = 0x19 + (0xdf - i);
+ var_i32_2 = _toolbox->TickCount();
+ //_zbasic->blockMove(arr_i32_41296[5], *var_i32_4e, 0x5580);
+ var_i32_4e->copyFrom(*arr_i32_41296[5]);
+ var_i16_64.top = i;
+ var_i16_5c.bottom = 0x19 + (0xdf - i);
// 131:1124
- this->var_i32_40 = this->arr_i32_41296[6];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcBic, nullptr);
- this->var_i32_40 = this->arr_i32_41296[7];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcOr, nullptr);
- this->delayFromMarker(0x2);
- _toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_64, this->var_i16_64, kSrcCopy, nullptr);
+ var_i32_40 = arr_i32_41296[6];
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcBic, nullptr);
+ var_i32_40 = arr_i32_41296[7];
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcOr, nullptr);
+ delayFromMarker(0x2);
+ _toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_64, var_i16_64, kSrcCopy, nullptr);
}
_toolbox->Delay(0);
// 131:11a4
- this->copyScreenToPage(0x5);
- this->setPortBitsToPage(0x5);
- this->fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- _zbasic->picture(0x18f, 0xc0, this->arr_i32_0[0x2b]); // fool card
- _toolbox->SetPortBits(this->var_i32_32);
+ copyScreenToPage(0x5);
+ setPortBitsToPage(0x5);
+ fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x18f, 0xc0, _pics[0x2b]); // fool card
+ _toolbox->SetPortBits(var_i32_32);
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
_toolbox->PenSize(0x5, 0x5);
// 131:1208
for (int i = 0; i <= 0x1b8; i += 6) {
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
_toolbox->MoveTo(0x172, 0x33);
_toolbox->LineTo(i, 0x14a);
if (i == 0x4e) {
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// yes, apparently so
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str());
- this->drawTextRightAlign(0x1f4, 0xd2);
- _zbasic->picture(0x198, 0x102, this->arr_i32_0[0x25]);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str()), 0x1f4, 0xd2);
+ _zbasic->picture(0x198, 0x102, _pics[0x25]);
}
- this->delayFromMarker(0x2);
+ delayFromMarker(0x2);
_toolbox->MoveTo(0x172, 0x33);
_toolbox->LineTo(i, 0x14a);
}
// 131:12cc
- this->sub_128_800(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
+ sub_128_800(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
// get turned into card
- this->sub_128_50a(0x5, 0x12c, SCREEN_WIDTH, 0x1);
- this->delay(0xec);
+ sub_128_50a(0x5, 0x12c, SCREEN_WIDTH, 0x1);
+ delay(0xec);
// fade out eye, then priestess, then seascape
for (int i = 8; i <= 0xa; i++) {
- this->sub_128_50a(i, 0, SCREEN_WIDTH, 1);
+ sub_128_50a(i, 0, SCREEN_WIDTH, 1);
}
- this->var_i32_2 = _toolbox->TickCount();
- this->setPortBitsToPage(0x5);
+ var_i32_2 = _toolbox->TickCount();
+ setPortBitsToPage(0x5);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0, 0, this->arr_i32_0[0x2f]);
- _toolbox->SetPortBits(this->var_i32_32);
- this->delayFromMarker(0xa);
- this->var_i16_5c.left = 0x18b;
- this->var_i16_5c.right = 0x1ef;
- this->var_i16_64.left = 0x18b;
- this->var_i16_64.right = 0x1ef;
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0, 0, _pics[0x2f]);
+ _toolbox->SetPortBits(var_i32_32);
+ delayFromMarker(0xa);
+ var_i16_5c.left = 0x18b;
+ var_i16_5c.right = 0x1ef;
+ var_i16_64.left = 0x18b;
+ var_i16_64.right = 0x1ef;
// 131:13b8
// move the fool card up the screen
for (int i = 0xc0; i >= 0x15; i--) {
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i16_5c.top = i;
- this->var_i16_5c.bottom = this->var_i16_5c.top + 0x96;
- this->var_i16_64.top = i - 1;
- this->var_i16_64.bottom = this->var_i16_64.top + 0x96;
- _toolbox->CopyBits(this->var_i32_32, this->var_i32_32, this->var_i16_5c, this->var_i16_64, kSrcCopy, nullptr);
- this->delayFromMarker(0);
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_5c.top = i;
+ var_i16_5c.bottom = var_i16_5c.top + 0x96;
+ var_i16_64.top = i - 1;
+ var_i16_64.bottom = var_i16_64.top + 0x96;
+ _toolbox->CopyBits(var_i32_32, var_i32_32, var_i16_5c, var_i16_64, kSrcCopy, nullptr);
+ delayFromMarker(0);
}
// 131:1424
// fool turns
- _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2c]);
- this->delay(0x1);
- _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2d]);
- this->delay(0x1);
- _zbasic->picture(0x193, 0x2d, this->arr_i32_0[0x2e]);
- this->copyScreenToPage(0x6);
+ _zbasic->picture(0x193, 0x2d, _pics[0x2c]);
+ delay(0x1);
+ _zbasic->picture(0x193, 0x2d, _pics[0x2d]);
+ delay(0x1);
+ _zbasic->picture(0x193, 0x2d, _pics[0x2e]);
+ copyScreenToPage(0x6);
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
_toolbox->PenSize(0x3, 0x3);
- this->var_i16_6c.left = 0x190;
- this->var_i16_6c.right = SCREEN_WIDTH;
- this->var_i16_6c.top = 0x50;
- this->var_i16_6c.bottom = SCREEN_HEIGHT;
- this->var_i16_5c.left = 0;
- this->var_i16_5c.right = 0x32;
- this->var_i16_5c.top = 0;
- this->var_i16_5c.bottom = 0x32;
- this->var_i16_3e0 = 0x64;
+ var_i16_6c.left = 0x190;
+ var_i16_6c.right = SCREEN_WIDTH;
+ var_i16_6c.top = 0x50;
+ var_i16_6c.bottom = SCREEN_HEIGHT;
+ var_i16_5c.left = 0;
+ var_i16_5c.right = 0x32;
+ var_i16_5c.top = 0;
+ var_i16_5c.bottom = 0x32;
+ var_i16_3e0 = 0x64;
// 131:14d8
// fool drops bindle
- this->var_i32_40 = this->arr_i32_41296[5];
- _toolbox->SetPortBits(this->var_i32_4e);
+ var_i32_40 = arr_i32_41296[5];
+ _toolbox->SetPortBits(var_i32_4e);
for (int i = 1; i <= 0xf; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- //_zbasic->blockMove(this->arr_i32_41296[6], *this->var_i32_4e, 0x5580);
- this->var_i32_4e->copyFrom(*this->arr_i32_41296[6]);
- this->var_i16_3e0 += 5 + i*2;
- this->var_i16_64.left = 0x1e0;
- this->var_i16_64.right = this->var_i16_64.left + 0x32;
- this->var_i16_64.top = this->var_i16_3e0;
- this->var_i16_64.bottom = this->var_i16_64.top + 0x32;
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_4e, this->var_i16_5c, this->var_i16_64, kSrcXor, nullptr);
+ var_i32_2 = _toolbox->TickCount();
+ //_zbasic->blockMove(arr_i32_41296[6], *var_i32_4e, 0x5580);
+ var_i32_4e->copyFrom(*arr_i32_41296[6]);
+ var_i16_3e0 += 5 + i*2;
+ var_i16_64.left = 0x1e0;
+ var_i16_64.right = var_i16_64.left + 0x32;
+ var_i16_64.top = var_i16_3e0;
+ var_i16_64.bottom = var_i16_64.top + 0x32;
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcXor, nullptr);
// 131:1582
- _toolbox->MoveTo(0x190 - i, this->var_i16_3e0 - 0x1e + i*3);
- _toolbox->LineTo(0x1f4, this->var_i16_3e0 + 0xa - i);
- _toolbox->CopyBits(this->var_i32_4e, this->var_i32_32, this->var_i16_6c, this->var_i16_6c, kSrcCopy, nullptr);
- this->delayFromMarker(0x1);
+ _toolbox->MoveTo(0x190 - i, var_i16_3e0 - 0x1e + i*3);
+ _toolbox->LineTo(0x1f4, var_i16_3e0 + 0xa - i);
+ _toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_6c, var_i16_6c, kSrcCopy, nullptr);
+ delayFromMarker(0x1);
}
- _toolbox->SetPortBits(this->var_i32_32);
+ _toolbox->SetPortBits(var_i32_32);
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
// 131:1606
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= 0xfa; i++) {
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
if (j == 0) {
- this->arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
- this->arr_i16_1e8[i+0xfb] = SCREEN_HEIGHT - _zbasic->rndInt(i);
+ arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
+ arr_i16_1e8[i+0xfb] = SCREEN_HEIGHT - _zbasic->rndInt(i);
}
// 131:1692
- _toolbox->MoveTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
- _toolbox->LineTo(this->arr_i16_1e8[i], this->arr_i16_1e8[i+0xfb]);
+ _toolbox->MoveTo(arr_i16_1e8[i], arr_i16_1e8[i+0xfb]);
+ _toolbox->LineTo(arr_i16_1e8[i], arr_i16_1e8[i+0xfb]);
if (i % 0x19 == 0) {
- this->delayFromMarker(0x1);
+ delayFromMarker(0x1);
}
}
}
// 131:1748
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
for (int i = 0x25; i <= 0x2f; i++) {
- _toolbox->ReleaseResource(this->arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
- this->delayFromMarker(0x3c);
+ delayFromMarker(0x3c);
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// well, this won't do
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(25).encode().c_str());
- this->drawTextRightAlign(0x181, 0x3c);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(25).encode().c_str()), 0x181, 0x3c);
// 131:17c8
var_i32_2 = _toolbox->TickCount();
for (int16 i = 0x30; i <= 0x31; i++) {
- arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
}
for (int16 i = 0x4b; i <= 0x52; i++) {
- arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
}
delayFromMarker(0xd2);
fillRect(0, 0, 0x96, 0x18b, 2);
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x30]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x30]);
delay(1);
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x31]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x31]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
- var_str_76 = _zbasic->chr(0x22) + _zbasic->str(26); // high priestess!
- drawTextRightAlign(0x181, 0x3c);
- var_str_76 = _zbasic->str(27); // am I to suffer this fate merely for uncovering
- drawTextRightAlign(0x181, 0x4d);
- var_str_76 = _zbasic->str(28) + _zbasic->chr(0x22); // the fourteen lost treasures of the land?
- drawTextRightAlign(0x181, 0x5e);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(26).encode().c_str()), 0x181, 0x3c);
+ // am I to suffer this fate merely for uncovering
+ drawTextRight(_zbasic->str(27), 0x181, 0x4d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(28).encode().c_str()), 0x181, 0x5e);
for (int16 i = 0x30; i <= 0x31; i++) {
- _toolbox->ReleaseResource(arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
for (int16 i = 0x32; i <= 0x38; i++) {
- arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
if (i == 0x37) {
setPortBitsToPage(5);
- _zbasic->picture(0, 0, arr_i32_0[0x37]);
- _toolbox->ReleaseResource(arr_i32_0[0x37]);
+ _zbasic->picture(0, 0, _pics[0x37]);
+ _toolbox->ReleaseResource(_pics[0x37]);
_toolbox->SetPortBits(var_i32_32);
}
}
// 131:19be
- sub_128_e1c();
+ drawClickMessageRightAlign();
sub_128_e58();
- sub_128_e1c();
+ drawClickMessageRightAlign();
fillRect(0, 0, 0x96, 0x18b, 2);
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x32]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x32]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
- var_str_76 = _zbasic->chr(0x22) + _zbasic->str(29); // for if that be true
- drawTextRightAlign(0x181, 0x3c);
- var_str_76 = _zbasic->str(30); // I wish you had made the challenge more difficult
- drawTextRightAlign(0x181, 0x4d);
- var_str_76 = _zbasic->str(31); // after all, I am just a fool and I should not
- drawTextRightAlign(0x181, 0x5e);
- var_str_76 = _zbasic->str(32) + _zbasic->chr(0x22); // have been able to find them so easily
- drawTextRightAlign(0x181, 0x6f);
+ // for if that be true
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(29).encode().c_str()), 0x181, 0x3c);
+ // I wish you had made the challenge more difficult
+ drawTextRight(_zbasic->str(30), 0x181, 0x4d);
+ // after all, I am just a fool and I should not
+ drawTextRight(_zbasic->str(31), 0x181, 0x5e);
+ // have been able to find them so easily
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(32).encode().c_str()), 0x181, 0x6f);
arr_rect_41af4.top = 6;
arr_rect_41af4.left = 0xd0;
arr_rect_41af4.bottom = 0x6c;
@@ -632,7 +630,7 @@ void FoolPrologue::finaleRun() {
arr_f64_41bbe[3] = (float)arr_rect_41af4.right;
arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_rect_41af4.right) / arr_i16_41b04[2];
// 131:1c24
- _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenPat(_patterns[1]);
_toolbox->PenMode(kPatXor);
// pre-draw the puzzle circles coming off the high priestess' head
for (int16 j = 6; j <= 9; j++) {
@@ -667,7 +665,7 @@ void FoolPrologue::finaleRun() {
_toolbox->SetRect(arr_i16_1bc, 0x151, 0x86, 0x159, 0x8e);
_toolbox->InvertOval(arr_i16_1bc);
_toolbox->SetPortBits(var_i32_32);
- sub_128_e1c();
+ drawClickMessageRightAlign();
sub_128_e58();
// 131:1e18
@@ -716,30 +714,30 @@ void FoolPrologue::finaleRun() {
}
// 131:21e0
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x33]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x33]);
var_i16_1b6 = 0x14;
var_str_76 = _zbasic->str(33); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
var_i32_2 = _toolbox->TickCount();
_zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
var_i16_1b6 += i;
- drawText(5 + i*2, var_i16_1b6);
+ drawText(var_str_76, 5 + i*2, var_i16_1b6);
delayFromMarker(3);
}
// 131:2282
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x34]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x34]);
var_i32_2 = _toolbox->TickCount();
setPortBitsToPage(4);
_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
_toolbox->InvertRect(arr_i16_1bc);
_toolbox->SetRect(arr_i16_1bc, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->PenMode(kPatOr);
- _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenPat(_patterns[1]);
_toolbox->PaintRect(arr_i16_1bc);
// 131:2316
arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0x4].get());
setPortBitsToPage(0xb);
- _zbasic->picture(0xb5, 0xa, arr_i32_0[0x38]);
+ _zbasic->picture(0xb5, 0xa, _pics[0x38]);
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0x1e);
_toolbox->PenNormal();
@@ -764,28 +762,23 @@ void FoolPrologue::finaleRun() {
}
// 131:2422
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x35]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x35]);
delay(0x1e);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// well I for one am not content
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(34).encode().c_str());
- drawTextRightAlign(0x181, 0x3c);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(35).encode().c_str());
- drawTextRightAlign(0x181, 0x4d);
- sub_128_e1c();
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(34).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(35).encode().c_str()), 0x181, 0x4d);
+ drawClickMessageRightAlign();
sub_128_e58();
- _zbasic->picture(0x193, 0x2d, arr_i32_0[0x36]);
+ _zbasic->picture(0x193, 0x2d, _pics[0x36]);
// 131:24da
fillRect(0, 0, 0x96, 0x18b, 2);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// show me one last puzzle if you dare
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(36).encode().c_str());
- drawTextRightAlign(0x181, 0x3c);
- var_str_76 = _zbasic->str(37);
- drawTextRightAlign(0x181, 0x4d);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(38).encode().c_str());
- drawTextRightAlign(0x181, 0x5e);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(36).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(_zbasic->str(37), 0x181, 0x4d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(38).encode().c_str()), 0x181, 0x5e);
sub_128_e58();
// 131:258a
@@ -805,16 +798,16 @@ void FoolPrologue::finaleRun() {
_toolbox->SetRect(arr_i32_1c4, 0x151, 0x86, 0x159, 0x8e);
_toolbox->InsetRect(arr_i16_1bc, 3, 3);
_toolbox->InsetRect(arr_i32_1c4, 3, 3);
- _toolbox->FillOval(arr_i16_1bc, arr_pat_194[0]);
- _toolbox->FillOval(arr_i32_1c4, arr_pat_194[0]);
+ _toolbox->FillOval(arr_i16_1bc, _patterns[0]);
+ _toolbox->FillOval(arr_i32_1c4, _patterns[0]);
_toolbox->Delay(0);
// 131:2720
for (int i = 1; i <= 3; i++) {
var_i32_2 = _toolbox->TickCount();
_toolbox->InsetRect(arr_i16_1bc, -1, -1);
_toolbox->InsetRect(arr_i32_1c4, -1, -1);
- _toolbox->FillOval(arr_i16_1bc, arr_pat_194[0]);
- _toolbox->FillOval(arr_i32_1c4, arr_pat_194[0]);
+ _toolbox->FillOval(arr_i16_1bc, _patterns[0]);
+ _toolbox->FillOval(arr_i32_1c4, _patterns[0]);
delayFromMarker(1);
}
// 131:27a2
@@ -852,16 +845,16 @@ void FoolPrologue::finaleRun() {
sub_128_50a(0xb, 0, SCREEN_WIDTH, 1);
arr_i32_41296[5]->copyFrom(*arr_i32_41296[11]);
setPortBitsToPage(5);
- _zbasic->picture(0x16, 0xde, arr_i32_0[0x4b]);
+ _zbasic->picture(0x16, 0xde, _pics[0x4b]);
// 131:2926
for (int16 i = 6; i <= 7; i++) {
arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
}
setPortBitsToPage(6);
- _zbasic->picture(0x10, 0x54, arr_i32_0[0x4c]);
+ _zbasic->picture(0x10, 0x54, _pics[0x4c]);
setPortBitsToPage(7);
- _zbasic->picture(0x10, 0x54, arr_i32_0[0x4c]);
- _zbasic->picture(0x2, 0x50, arr_i32_0[0x52]);
+ _zbasic->picture(0x10, 0x54, _pics[0x4c]);
+ _zbasic->picture(0x2, 0x50, _pics[0x52]);
_toolbox->SetPortBits(var_i32_32);
delay(0x1e);
sub_128_50a(0x6, 0, SCREEN_WIDTH, 1);
@@ -873,24 +866,22 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// 131:2a22
// now what have I gotten myself into?
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(39).encode().c_str());
- drawText(0x3c, 0x2d);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(40).encode().c_str());
- drawText(0x46, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(39).encode().c_str()), 0x3c, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(40).encode().c_str()), 0x46, 0x3e);
var_i32_2 = _toolbox->TickCount();
for (int16 i = 6; i <= 0xa; i++) {
arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
}
setPortBitsToPage(6);
- _zbasic->picture(0x15, 0x55, arr_i32_0[0x4d]);
+ _zbasic->picture(0x15, 0x55, _pics[0x4d]);
setPortBitsToPage(7);
- _zbasic->picture(0x1c, 0x57, arr_i32_0[0x4e]);
+ _zbasic->picture(0x1c, 0x57, _pics[0x4e]);
setPortBitsToPage(8);
- _zbasic->picture(0x1c, 0x57, arr_i32_0[0x4f]);
+ _zbasic->picture(0x1c, 0x57, _pics[0x4f]);
setPortBitsToPage(9);
- _zbasic->picture(0x1d, 0x58, arr_i32_0[0x50]);
+ _zbasic->picture(0x1d, 0x58, _pics[0x50]);
setPortBitsToPage(0xa);
- _zbasic->picture(0x1d, 0x58, arr_i32_0[0x51]);
+ _zbasic->picture(0x1d, 0x58, _pics[0x51]);
// 131:2b7c
for (int16 i = 1; i <= 0xe; i++) {
arr_i16_1e8[i] = _zbasic->readDataInt();
@@ -902,21 +893,18 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcOr);
for (int16 i = 1; i <= 0xe; i++) {
// THEBOOKOFTHOTH
- var_str_76 = _zbasic->midStr(_zbasic->str(41), i, 1);
- drawText(arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ drawText(_zbasic->midStr(_zbasic->str(41), i, 1), arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
}
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// that's it! the answer is the book of thoth
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(42).encode().c_str());
- drawText(0x32, 0x2d);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(43).encode().c_str());
- drawText(0x3c, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(42).encode().c_str()), 0x32, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(43).encode().c_str()), 0x3c, 0x3e);
// 131:2cf6
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0xd2);
- sub_128_e1c();
+ drawClickMessageRightAlign();
sub_128_e58();
- sub_128_e1c();
+ drawClickMessageRightAlign();
blitPageToScreen(6);
delay(3);
blitPageToScreen(7);
@@ -925,25 +913,24 @@ void FoolPrologue::finaleRun() {
var_i32_2 = _toolbox->TickCount();
// 131:2d3a
for (int16 i = 0x30; i <= 0x36; i++) {
- _toolbox->ReleaseResource(arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
- _toolbox->ReleaseResource(arr_i32_0[0x38]);
+ _toolbox->ReleaseResource(_pics[0x38]);
for (int16 i = 0x4b; i <= 0x52; i++) {
- _toolbox->ReleaseResource(arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
for (int16 i = 0x29; i <= 0x2a; i++) {
- arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
}
for (int16 i = 0x53; i <= 0x5b; i++) {
- arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
}
delayFromMarker(0x96);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// 131:2e1a
- // wait, what's this?
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(44).encode().c_str());
_toolbox->MoveTo(0x46, 0x3e);
- _toolbox->DrawString(var_str_76);
+ // wait, what's this?
+ _toolbox->DrawString(Common::U32String::format("\"%s\"", _zbasic->str(44).encode().c_str()));
delay(0x96);
blitPageToScreen(0x9);
// 131:2e58
@@ -958,7 +945,7 @@ void FoolPrologue::finaleRun() {
// 131:2f66
if (l == 0) {
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcOr);
- drawText(arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ drawText(var_str_76, arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
}
// 131:2fc4
_zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcXor);
@@ -968,10 +955,10 @@ void FoolPrologue::finaleRun() {
arr_f64_41bbe[1] += arr_f64_41bbe[1 + 2];
int16 y = (int16)arr_f64_41bbe[1];
// 131:3078
- drawText(x, y);
+ drawText(var_str_76, x, y);
}
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- drawText(arr_i16_1e8[0x1f6 + i], arr_i16_1e8[0x2f1 + i]);
+ drawText(var_str_76, arr_i16_1e8[0x1f6 + i], arr_i16_1e8[0x2f1 + i]);
delay(1);
}
}
@@ -983,10 +970,8 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0xa);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// that's it! the answer is the book of thoth
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(46).encode().c_str());
- drawText(0x32, 0x2d);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(47).encode().c_str());
- drawText(0x3c, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(46).encode().c_str()), 0x32, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(47).encode().c_str()), 0x3c, 0x3e);
arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0xa]);
setPortBitsToPage(0xb);
arr_rect_41af4.top = 0xa;
@@ -1001,27 +986,25 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(4);
_toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, 0xdf);
_toolbox->InvertRect(arr_i16_1bc);
- _zbasic->picture(0xd, 0xf0, arr_i32_0[0x58]);
- _zbasic->picture(0x186, 0xc, arr_i32_0[0x59]);
+ _zbasic->picture(0xd, 0xf0, _pics[0x58]);
+ _zbasic->picture(0x186, 0xc, _pics[0x59]);
setPortBitsToPage(5);
- _zbasic->picture(0xf, 0x68, arr_i32_0[0x53]);
+ _zbasic->picture(0xf, 0x68, _pics[0x53]);
setPortBitsToPage(6);
- _zbasic->picture(0x11, 0x8a, arr_i32_0[0x54]);
+ _zbasic->picture(0x11, 0x8a, _pics[0x54]);
setPortBitsToPage(7);
- _zbasic->picture(0x13, 0xa9, arr_i32_0[0x55]);
+ _zbasic->picture(0x13, 0xa9, _pics[0x55]);
setPortBitsToPage(8);
- _zbasic->picture(0x11, 0xcd, arr_i32_0[0x56]);
+ _zbasic->picture(0x11, 0xcd, _pics[0x56]);
setPortBitsToPage(9);
- _zbasic->picture(0xf, 0xf3, arr_i32_0[0x57]);
+ _zbasic->picture(0xf, 0xf3, _pics[0x57]);
// 131:339c
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0x96);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// that's it! the answer is the book of thoth
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(48).encode().c_str());
- drawText(0x32, 0x2d);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(49).encode().c_str());
- drawText(0x3c, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(48).encode().c_str()), 0x32, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(49).encode().c_str()), 0x3c, 0x3e);
// 131:341c
sub_128_50a(0xb, 0xb0, 0x1f6, 0);
sub_128_50a(0x5, 0xb0, 0x1f6, 0);
@@ -1030,7 +1013,7 @@ void FoolPrologue::finaleRun() {
blitPageToScreen(i);
delay(3);
}
- _zbasic->picture(0xd, 0xf0, arr_i32_0[0x58]);
+ _zbasic->picture(0xd, 0xf0, _pics[0x58]);
_toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, 0xdf);
// lightning flash in sky
for (int16 i = 0x1b; i >= 0; i--) {
@@ -1046,23 +1029,21 @@ void FoolPrologue::finaleRun() {
var_i16_3ee = 0x3c;
setPortBitsToPage(9);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x29]); // wadjet eye mask
+ _zbasic->picture(var_i16_3ec, var_i16_3ee, _pics[0x29]); // wadjet eye mask
setPortBitsToPage(0xa);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(var_i16_3ec, var_i16_3ee, arr_i32_0[0x2a]); // wadjet eye
+ _zbasic->picture(var_i16_3ec, var_i16_3ee, _pics[0x2a]); // wadjet eye
_toolbox->SetPortBits(var_i32_32);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// the book of thoth?
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(50).encode().c_str());
- drawTextRightAlign(0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(50).encode().c_str()), 0x1a4, 0x2d);
var_i32_2 = _toolbox->TickCount();
arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
setPortBitsToPage(5);
- _zbasic->picture(0x171, 0xb, arr_i32_0[0x5b]);
+ _zbasic->picture(0x171, 0xb, _pics[0x5b]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// here is the book of thoth
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(51).encode().c_str());
- drawTextRightAlign(0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(51).encode().c_str()), 0x1a4, 0x2d);
var_i16_5c.top = var_i16_3ee;
var_i16_5c.left = var_i16_3ec;
@@ -1078,30 +1059,28 @@ void FoolPrologue::finaleRun() {
arr_i32_41296[i]->copyFrom(*var_i32_4e);
}
setPortBitsToPage(6);
- _zbasic->picture(0x171, 0xb, arr_i32_0[0x5b]);
+ _zbasic->picture(0x171, 0xb, _pics[0x5b]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// here is the book of thoth
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(52).encode().c_str());
- drawTextRightAlign(0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(52).encode().c_str()), 0x1a4, 0x2d);
setPortBitsToPage(7);
- _zbasic->picture(0x181, 0xf, arr_i32_0[0x5a]);
+ _zbasic->picture(0x181, 0xf, _pics[0x5a]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// and your answer is incorrect
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(53).encode().c_str());
- drawTextRightAlign(0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(53).encode().c_str()), 0x1a4, 0x2d);
setPortBitsToPage(8);
// 131:3806
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(54).encode().c_str()); // destroy him
- drawTextRightAlign(0x1a4, 0x2d);
+ // destroy him
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(54).encode().c_str()), 0x1a4, 0x2d);
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0xb4);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(55).encode(Common::kMacRoman).c_str()); // the book of thoth?
- drawTextRightAlign(0x1a4, 0x2d);
+ // the book of thoth?
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(55).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0x5);
var_i16_5c.left = var_i16_3ec;
@@ -1131,51 +1110,51 @@ void FoolPrologue::finaleRun() {
// 131:39ba
var_i32_2 = _toolbox->TickCount();
- _toolbox->ReleaseResource(arr_i32_0[0x29]);
- _toolbox->ReleaseResource(arr_i32_0[0x2a]);
+ _toolbox->ReleaseResource(_pics[0x29]);
+ _toolbox->ReleaseResource(_pics[0x2a]);
// 131:39e8
for (int16 i = 0x53; i <= 0x59; i++) {
- _toolbox->ReleaseResource(arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
- _toolbox->ReleaseResource(arr_i32_0[0x5b]);
+ _toolbox->ReleaseResource(_pics[0x5b]);
// 131:3a20
arr_i32_41296[10]->copyFrom(*arr_i32_41296[8]);
delayFromMarker(0x3c);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(56).encode(Common::kMacRoman).c_str()); // here is the book of thoth
- drawTextRightAlign(0x1a4, 0x2d);
+ // here is the book of thoth
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(56).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0x7);
var_i32_2 = _toolbox->TickCount();
for (int16 i = 0x39; i <= 0x45; i++) {
- arr_i32_0[i] = _toolbox->GetPicture(i);
+ _pics[i] = _toolbox->GetPicture(i);
}
- arr_i32_0[0x47] = _toolbox->GetPicture(0x47);
+ _pics[0x47] = _toolbox->GetPicture(0x47);
delayFromMarker(0xc8);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(57).encode(Common::kMacRoman).c_str()); // and your answer is incorrect
- drawTextRightAlign(0x1a4, 0x2d);
+ // and your answer is incorrect
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(57).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0xa);
var_i32_2 = _toolbox->TickCount();
setPortBitsToPage(0x7);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0, 0xaa, arr_i32_0[0x39]); // treasure pile
+ _zbasic->picture(0, 0xaa, _pics[0x39]); // treasure pile
// 131:3b8a
fillRect(0x124, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
arr_i32_41296[8]->copyFrom(*arr_i32_41296[7]);
arr_i32_41296[9]->copyFrom(*arr_i32_41296[8]);
_toolbox->InvertRect(var_i16_38);
setPortBitsToPage(0x9);
- _zbasic->picture(0x5d, 0x22, arr_i32_0[0x3a]); // priestess card
- _zbasic->picture(0x1b3, 0xb5, arr_i32_0[0x3b]); // fool head
+ _zbasic->picture(0x5d, 0x22, _pics[0x3a]); // priestess card
+ _zbasic->picture(0x1b3, 0xb5, _pics[0x3b]); // fool head
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0x5a);
for (int16 k = 0; k <= 8; k++) {
@@ -1196,11 +1175,11 @@ void FoolPrologue::finaleRun() {
// 131:3d0c
if (k == 7) {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(58).encode(Common::kMacRoman).c_str()); // destroy him
- drawTextRightAlign(0x1a4, 0x2d);
- _zbasic->picture(0x181, 0xf, arr_i32_0[0x5a]); // angry priestess
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(59).encode(Common::kMacRoman).c_str()); // destroy him!!!
- drawTextRightAlign(0x1a4, 0x2d);
+ // destroy him
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(58).encode().c_str()), 0x1a4, 0x2d);
+ _zbasic->picture(0x181, 0xf, _pics[0x5a]); // angry priestess
+ // destroy him!!!
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(59).encode().c_str()), 0x1a4, 0x2d);
}
// 131:3db8
if (k < 8) {
@@ -1220,7 +1199,7 @@ void FoolPrologue::finaleRun() {
// 131:3e5e
}
// 131:3e6c
- _toolbox->PenPat(arr_pat_194[2]);
+ _toolbox->PenPat(_patterns[2]);
_toolbox->PenSize(5, 5);
_toolbox->PenMode(kPatXor);
var_i16_176 = 0xe5;
@@ -1310,7 +1289,7 @@ void FoolPrologue::finaleRun() {
}
// 131:439a
- _zbasic->picture(0x1b3, 0xb5, arr_i32_0[0x3b]);
+ _zbasic->picture(0x1b3, 0xb5, _pics[0x3b]);
arr_i16_41af4[0] = 0;
arr_i16_41af4[1] = 0;
arr_i16_41af4[2] = 0x200;
@@ -1335,49 +1314,49 @@ void FoolPrologue::finaleRun() {
sub_128_50a(0x9, 0, SCREEN_WIDTH, 0);
copyScreenToPage(0);
setPortBitsToPage(0);
- _zbasic->picture(0x1b5, 0xba, arr_i32_0[0x3c]);
+ _zbasic->picture(0x1b5, 0xba, _pics[0x3c]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- var_str_76 = _zbasic->str(60); // but the fool had gained the gift of wisdom
- drawText(0xd2, 0x61);
- var_str_76 = _zbasic->str(61); // and was able to trick the high priestess
- drawText(0xd2, 0x72);
- sub_128_e1c();
+ // but the fool had gained the gift of wisdom
+ drawText(_zbasic->str(60), 0xd2, 0x61);
+ // and was able to trick the high priestess
+ drawText(_zbasic->str(61), 0xd2, 0x72);
+ drawClickMessageRightAlign();
_toolbox->SetPortBits(var_i32_32);
blitPageToScreen(0);
setPortBitsToPage(0);
- _zbasic->picture(0x1b8, 0xb3, arr_i32_0[0x3d]);
+ _zbasic->picture(0x1b8, 0xb3, _pics[0x3d]);
fillRect(0, 0xc8, 0xa5, SCREEN_WIDTH, 0);
// 131:45a4
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- var_str_76 = _zbasic->str(62); // he had remembered well the words
- drawText(0xd2, 0x3f);
- var_str_76 = _zbasic->str(63); // of the magician
- drawText(0xd2, 0x50);
- var_str_76 = Common::U32String::format("\"%s", _zbasic->str(64).encode().c_str()); // the high priestess may have learned how
- drawText(0xd7, 0x6d);
- var_str_76 = _zbasic->str(65); // to command the sacred book of thoth
- drawText(0xde, 0x7e);
- var_str_76 = _zbasic->str(66); // but even she cannot force it to do
- drawText(0xde, 0x8f);
- var_str_76 = Common::U32String::format("%s\"", _zbasic->str(67).encode().c_str()); // anything inherently evil
- drawText(0xde, 0xa0);
+ // he had remembered well the words
+ drawText(_zbasic->str(62), 0xd2, 0x3f);
+ // of the magician
+ drawText(_zbasic->str(63), 0xd2, 0x50);
+ // the high priestess may have learned how
+ drawText(Common::U32String::format("\"%s", _zbasic->str(64).encode().c_str()), 0xd7, 0x6d);
+ // to command the sacred book of thoth
+ drawText(_zbasic->str(65), 0xde, 0x7e);
+ // but even she cannot force it to do
+ drawText(_zbasic->str(66), 0xde, 0x8f);
+ // anything inherently evil
+ drawText(Common::U32String::format("%s\"", _zbasic->str(67).encode().c_str()), 0xde, 0xa0);
// 131:46aa
_toolbox->SetPortBits(var_i32_32);
sub_128_e58();
blitPageToScreen(0);
copyScreenToPage(0);
setPortBitsToPage(0);
- _zbasic->picture(0x1c4, 0xb3, arr_i32_0[0x3e]);
+ _zbasic->picture(0x1c4, 0xb3, _pics[0x3e]);
fillRect(0, 0xc8, 0xa5, SCREEN_WIDTH, 0);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- var_str_76 = _zbasic->str(68); // some say that the story of the fool and his
- drawText(0xd2, 0x5c);
- var_str_76 = _zbasic->str(69); // adventures inspired the creation of the
- drawText(0xd2, 0x6d);
- var_str_76 = _zbasic->str(70); // modern day tarot deck
- drawText(0xd2, 0x7e);
+ // some say that the story of the fool and his
+ drawText(_zbasic->str(68), 0xd2, 0x5c);
+ // adventures inspired the creation of the
+ drawText(_zbasic->str(69), 0xd2, 0x6d);
+ // modern day tarot deck
+ drawText(_zbasic->str(70), 0xd2, 0x7e);
// 131:4780
_toolbox->SetPortBits(var_i32_32);
@@ -1385,12 +1364,12 @@ void FoolPrologue::finaleRun() {
blitPageToScreen(0);
copyScreenToPage(0);
setPortBitsToPage(0);
- _zbasic->picture(0x1be, 0xb4, arr_i32_0[0x3f]);
+ _zbasic->picture(0x1be, 0xb4, _pics[0x3f]);
fillRect(0, 0xc8, 0x96, SCREEN_WIDTH, 0);
fillRect(0x12c, 0x12c, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(71).encode().c_str()); // but I doubt it
- drawText(0x184, 0xb1);
+ // but I doubt it
+ drawText(Common::U32String::format("\"%s\"", _zbasic->str(71).encode().c_str()), 0x184, 0xb1);
// 131:4848
_toolbox->SetPortBits(var_i32_32);
sub_128_e58();
@@ -1402,7 +1381,7 @@ void FoolPrologue::finaleRun() {
delayFromMarker(0x78);
_toolbox->PenNormal();
- _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenPat(_patterns[1]);
_toolbox->PenSize(4, 3);
_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x201, 0x156);
for (int16 i = 0; i <= 0x200; i++) {
@@ -1440,13 +1419,13 @@ void FoolPrologue::finaleRun() {
var_i32_40 = arr_i32_41296[0];
_toolbox->SetPortBits(var_i32_40);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x78, yPic, arr_i32_0[j]);
+ _zbasic->picture(0x78, yPic, _pics[j]);
int16 textCount = _zbasic->readDataInt();
int16 textWidth = _zbasic->readDataInt();
int16 yOffset = 0x41 - (textWidth / 2);
for (int16 i = 1; i <= textCount; i++) {
int16 textSize = _zbasic->readDataInt();
- var_str_76 = _zbasic->readDataStr();
+ Common::U32String label = _zbasic->readDataStr();
_zbasic->text(kPrologueFontFool, textSize, 0, kSrcBic);
if (textSize == 0xc) {
yOffset += 0x19;
@@ -1455,7 +1434,7 @@ void FoolPrologue::finaleRun() {
yOffset += 0x20;
}
// 131:4b00
- drawText(0xe6, yOffset + yPic);
+ drawText(label, 0xe6, yOffset + yPic);
}
// 131:4b2a
delayFromMarker(0x14);
@@ -1476,14 +1455,14 @@ void FoolPrologue::finaleRun() {
_toolbox->SetPortBits(var_i32_40);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcBic);
- var_str_76 = _zbasic->str(72); // the fool's errand
- drawTextCenterAlign(0x100, 0x19 + yPic + 0x19);
- var_str_76 = _zbasic->str(73); // (c) 1987 by cliff johnson. all rights reserved
- drawTextCenterAlign(0x100, 0x32 + yPic + 0x19);
- var_str_76 = _zbasic->str(74); // portions of this code are copyrighted 1985 zedcor inc
- drawTextCenterAlign(0x100, 0x4b + yPic + 0x19);
- var_str_76 = _zbasic->str(75); // the fool's errand is a registered trademark of cliff johnson
- drawTextCenterAlign(0x100, 0x64 + yPic + 0x19);
+ // the fool's errand
+ drawTextCenter(_zbasic->str(72), SCREEN_WIDTH, 0x19 + yPic + 0x19);
+ // (c) 1987 by cliff johnson. all rights reserved
+ drawTextCenter(_zbasic->str(73), SCREEN_WIDTH, 0x32 + yPic + 0x19);
+ // portions of this code are copyrighted 1985 zedcor inc
+ drawTextCenter(_zbasic->str(74), SCREEN_WIDTH, 0x4b + yPic + 0x19);
+ // the fool's errand is a registered trademark of cliff johnson
+ drawTextCenter(_zbasic->str(75), SCREEN_WIDTH, 0x64 + yPic + 0x19);
// 131:4c94
delayFromMarker(0x14);
_toolbox->SetPortBits(var_i32_32);
@@ -1496,17 +1475,17 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
- var_str_76 = _zbasic->str(76); // and yes, the fool will return in
- drawTextCenterAlign(0x100, 0xa0);
+ // and yes, the fool will return in
+ drawTextCenter(_zbasic->str(76), 0x100, 0xa0);
_zbasic->text(kPrologueFontFool, 0x18, 0, kSrcBic);
- var_str_76 = _zbasic->str(77); // the fool and his money
- drawTextCenterAlign(0x100, 0xc8);
+ // the fool and his money
+ drawTextCenter(_zbasic->str(77), 0x100, 0xc8);
delayFromMarker(0x14);
_toolbox->SetPortBits(var_i32_32);
blitPageToScreen(0);
delay(0xd2);
for (int16 i = 0x40; i <= 0x47; i++) {
- _toolbox->ReleaseResource(arr_i32_0[i]);
+ _toolbox->ReleaseResource(_pics[i]);
}
}
@@ -1514,17 +1493,17 @@ void FoolPrologue::finaleDrawLoadingMsg() {
// 131:4dc0
// FIXME: we don't share the menu surface here yet
return;
- _toolbox->SetPort(this->var_i32_c);
+ _toolbox->SetPort(var_i32_c);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Finale
- this->var_str_76 = _zbasic->str(78);
- this->var_str_76 += Common::U32String::format("%d%%", this->var_i16_3ce);
+ var_str_76 = _zbasic->str(78);
+ var_str_76 += Common::U32String::format("%d%%", var_i16_3ce);
// 131:4e08
- this->fillRect(0, 0, 7, 0x13, this->var_i16_10 - 7);
+ fillRect(0, 0, 7, 0x13, var_i16_10 - 7);
- this->drawTextCenterAlign(this->var_i16_10 / 2, 0xe);
+ drawTextCenter(var_str_76, var_i16_10 / 2, 0xe);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
}
void FoolPrologue::finaleDrawFoolUhOh() {
@@ -1532,52 +1511,41 @@ void FoolPrologue::finaleDrawFoolUhOh() {
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Uh oh . . .
- this->var_str_76 = Common::U32String::format("\"%s\"", _zbasic->str(80).encode().c_str());
-
- this->drawText(0x1ae, 0xb4);
+ drawText(Common::U32String::format("\"%s\"", _zbasic->str(80).encode().c_str()), 0x1ae, 0xb4);
}
void FoolPrologue::finaleStartText() {
// 131:4e98
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcXor);
- this->var_i16_3fc = 0xa0;
+ var_i16_3fc = 0xa0;
// "And so the fool heeded the advice of the magician..."
- this->var_str_76 = _zbasic->str(81);
- this->drawText(0x96, this->var_i16_3fc);
-
- this->var_str_76 = _zbasic->str(82);
- this->drawText(0xa0, this->var_i16_3fc + 0xf);
-
- this->var_str_76 = _zbasic->str(83);
- this->drawText(0xaa, this->var_i16_3fc + 0x1e);
-
- this->var_str_76 = _zbasic->str(84);
- this->drawText(0xc8, this->var_i16_3fc + 0x2d);
-
- this->var_str_76 = _zbasic->str(85);
- this->drawText(0xe6, this->var_i16_3fc + 0x3c);
+ drawText(_zbasic->str(81), 0x96, var_i16_3fc);
+ drawText(_zbasic->str(82), 0xa0, var_i16_3fc + 0xf);
+ drawText(_zbasic->str(83), 0xaa, var_i16_3fc + 0x1e);
+ drawText(_zbasic->str(84), 0xc8, var_i16_3fc + 0x2d);
+ drawText(_zbasic->str(85), 0xe6, var_i16_3fc + 0x3c);
- this->drawClickMessage();
+ drawClickMessage();
}
-void FoolPrologue::sub_131_4f96(int16 offset) {
+void FoolPrologue::finaleDrawWind(int16 offset) {
// 131:4f96
_toolbox->MoveTo(
- this->arr_i16_1e8[offset],
- this->arr_i16_1e8[offset+0xfb]
+ arr_i16_1e8[offset],
+ arr_i16_1e8[offset+0xfb]
);
// 131:4fd4
_toolbox->LineTo(
- this->arr_i16_1e8[offset] + this->arr_i16_1e8[offset+0x1f6],
- this->arr_i16_1e8[offset+0xfb]
+ arr_i16_1e8[offset] + arr_i16_1e8[offset+0x1f6],
+ arr_i16_1e8[offset+0xfb]
);
}
void FoolPrologue::finaleCardRotate() {
// 131:5038
_toolbox->PenNormal();
- _toolbox->PenPat(arr_pat_194[1]);
+ _toolbox->PenPat(_patterns[1]);
_toolbox->PenMode(kPatXor);
var_i16_18e = 0x21;
for (int16 i = 0; i <= 7; i++) {
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 3f411af9cd5..dca69cab61e 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -80,8 +80,6 @@ static const byte fondPuzzle[] = {
0, 0, 0, 1, 0, 2, 0, 12, 0, 0, 125, 140, 0, 24, 0, 0,
125, 152, 0, 48, 0, 0, 125, 176
};
-
-// v1.1 includes all fonts except Small
static const byte fondSmall[] = {
96, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -104,23 +102,18 @@ void FoolGame::run() {
return;
}
- _zbasic->loadFonts();
-
+ Common::String chicagoName("Chicago");
switch (_version) {
case kFool11:
_zstrOffset = fool11ZStrOffset;
// v1.1 and v2.0 provide direct overrides for "Chicago".
- // v1.1 doesn't include any FOND chunks, so we have to provide them here.
_fontChicago = 0;
- _zbasic->injectFOND(fondChicago, sizeof(fondChicago), Common::String("Chicago"));
- _zbasic->injectFOND(fondFool, sizeof(fondFool), Common::String("fool"));
- _zbasic->injectFOND(fondLarge, sizeof(fondLarge), Common::String("Large"));
- _zbasic->injectFOND(fondPuzzle, sizeof(fondPuzzle), Common::String("Puzzle"));
break;
case kFool30:
_zstrOffset = fool30ZStrOffset;
// v3.0 calls the font "Foolish Chicago" and changes the index
_fontChicago = 255;
+ chicagoName = Common::String("Foolish Chicago");
break;
case kFool20:
default:
@@ -129,6 +122,29 @@ void FoolGame::run() {
break;
}
+ if (_version == kFool11) {
+ // v1.1 doesn't include any FOND chunks, so we have to provide them here.
+ _zbasic->injectFOND(fondFool, sizeof(fondFool), Common::String("Fool"));
+ _zbasic->injectFOND(fondChicago, sizeof(fondChicago), chicagoName);
+ _zbasic->injectFOND(fondLarge, sizeof(fondLarge), Common::String("Large"));
+ _zbasic->injectFOND(fondPuzzle, sizeof(fondPuzzle), Common::String("Puzzle"));
+ _zbasic->injectFOND(fondSmall, sizeof(fondSmall), Common::String("Small"));
+ } else {
+ // Load in the FOND chunks from the executable
+ int16 exec = _zbasic->getFileId();
+ Handle foolFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontFool);
+ _toolbox->_injectFOND(exec, foolFOND->data(), foolFOND->size(), Common::String("Fool"));
+ Handle chicagoFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), _fontChicago);
+ _toolbox->_injectFOND(exec, chicagoFOND->data(), chicagoFOND->size(), chicagoName);
+ Handle largeFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontLarge);
+ _toolbox->_injectFOND(exec, largeFOND->data(), largeFOND->size(), Common::String("Large"));
+ Handle puzzleFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontPuzzle);
+ _toolbox->_injectFOND(exec, puzzleFOND->data(), puzzleFOND->size(), Common::String("Puzzle"));
+ Handle smallFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontSmall);
+ _toolbox->_injectFOND(exec, smallFOND->data(), smallFOND->size(), Common::String("Small"));
+ }
+
+
// Fool's Errand has an embedded version of Chicago with custom characters
_zbasic->setMenuFont(_fontChicago, 12);
@@ -578,7 +594,7 @@ void FoolGame::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16
_toolbox->FillRect(bounds, _patterns[patternID]);
}
-void FoolGame::drawStringCenter(const Common::U32String &str, int16 yPos) {
+void FoolGame::drawTextCenter(const Common::U32String &str, int16 yPos) {
// 128:0918
int16 width = _toolbox->StringWidth(str);
_toolbox->MoveTo((SCREEN_WIDTH / 2) - (width / 2), yPos);
@@ -765,7 +781,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
// 128:1056
for (int i = 0; i <= lineCount; i++) {
this->var_str_384 = _modalText[i];
- this->drawStringCenter(this->var_str_384, strY);
+ this->drawTextCenter(this->var_str_384, strY);
// 128:1086
// 128:1086: CLR.W - -0x772(A5)
strY += 0x11;
@@ -1308,7 +1324,7 @@ void FoolGame::sub_128_2808() {
if (this->var_i16_7e6 != 0) {
_modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", this->var_str_588.encode().c_str()); // was: str(17), str(18)
_modalText[1] = Common::U32String("Okay"); // was: str(19)
- this->showChoiceModal(0, 0, 1, 1);
+ this->showChoiceModal(_fontChicago, 0, 1, 1);
this->var_str_588.clear(); // was: str(20)
this->var_i16_7e6 = 0;
}
@@ -1624,7 +1640,7 @@ void FoolGame::savePrompt() {
_modalText[1] = Common::U32String("Yes");
_modalText[2] = Common::U32String("No");
_modalText[3] = Common::U32String("Cancel");
- this->showChoiceModal(0, 0, 3, 0);
+ this->showChoiceModal(_fontChicago, 0, 3, 0);
if (_savePromptChoice > 1) {
_saveFileName = previous;
return;
@@ -2353,13 +2369,13 @@ void FoolGame::menuAbout() {
int16 strY = 0xbe - this->var_i16_7b6;
for (int i = 0; i <= modalLines; i++) {
this->var_str_384 = _modalText[i];
- this->drawStringCenter(this->var_str_384, strY);
+ this->drawTextCenter(this->var_str_384, strY);
strY += 0x11;
}
// 128:50f4
_zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, kSrcOr);
strY += 0xe;
- this->drawStringCenter(_zbasic->str(_zstrOffset[kOffsetVersion]), strY); // version string
+ this->drawTextCenter(_zbasic->str(_zstrOffset[kOffsetVersion]), strY); // version string
this->menuClickMessage();
this->waitForClick();
_toolbox->DrawMenuBar();
@@ -2766,7 +2782,7 @@ void FoolGame::sub_129_068() {
_modalText[1] = Common::U32String("2 color black and white");
_modalText[2] = Common::U32String("and start the game again.");
_modalText[3] = Common::U32String("Okay");
- this->showChoiceModal(0, 2, 1, 0);
+ this->showChoiceModal(_fontChicago, 2, 1, 0);
_zbasic->unk_4();
}
// 129:0390
@@ -2782,7 +2798,7 @@ void FoolGame::sub_129_068() {
_modalText[4] = Common::U32String("for possible solutions.");
_modalText[5] = Common::U32String();
_modalText[6] = Common::U32String("Quit");
- this->showChoiceModal(0, 5, 1, 1);
+ this->showChoiceModal(_fontChicago, 5, 1, 1);
_zbasic->unk_4();
}
// 129:0496
@@ -3211,7 +3227,7 @@ void FoolGame::sub_144_004() {
_modalText[4] = Common::U32String("Congratulations!");
_modalText[5] = Common::U32String("You may now view the finale.");
_modalText[7] = Common::U32String("Okay");
- showChoiceModal(0xfa, 6, 1, 0);
+ showChoiceModal(kFontFool, 6, 1, 0);
if (!_screenOversized) {
_toolbox->ClearMenuBar();
_toolbox->DrawMenuBar();
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 9cceb98f439..926f59f0bfa 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -112,7 +112,7 @@ public:
void fillRect(int16 patternID, PatternMode mode, int16 top, int16 left, int16 bottom, int16 right); // sub_128_69c
void drawTarotCard(int16 rectID, int16 deckPos, int16 type); // sub_128_712
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
- void drawStringCenter(const Common::U32String &str, int16 yPos); // sub_128_918
+ void drawTextCenter(const Common::U32String &str, int16 yPos); // sub_128_918
void zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 patternID, PatternMode mode, int16 steps); // sub_128_962
void sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1);
void getNextEvent(uint32 mask); // sub_128_c6a
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index b099829ba6a..4147abebbbf 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -502,7 +502,7 @@ void FoolGame::mazePrintMessage() {
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
int16 width = _toolbox->StringWidth(var_str_1ce2);
fillRect(0x13b, 0xf1 - (width / 2), 0x14f, 0x10f + (width / 2), 2);
- drawStringCenter(var_str_1ce2.decode(Common::kMacRoman), 0x149);
+ drawTextCenter(var_str_1ce2.decode(Common::kMacRoman), 0x149);
}
// 136:0e3a
var_str_1578 = var_str_1ce2.decode(Common::kMacRoman);
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 9895f60ba34..01dbb13e7dc 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -329,7 +329,7 @@ void FoolGame::sub_138_9c4() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
_toolbox->FillRect(temp, _patterns[2]);
- drawStringCenter(var_str_1272, 0x146);
+ drawTextCenter(var_str_1272, 0x146);
}
void FoolGame::sub_138_a06() {
@@ -350,7 +350,7 @@ void FoolGame::metapuzzleSecretCodeReset() {
_toolbox->FillRect(temp, _patterns[2]);
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
var_str_384 = _zbasic->str(OFF(15)); // if you know which is which, enter the letters you wish to switch
- drawStringCenter(var_str_384, 0x140);
+ drawTextCenter(var_str_384, 0x140);
var_str_1272.clear(); // was: str(OFF(16))
_metapuzzleSecretCodeCount = 0;
}
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index db8a88ab3cf..ee957d3893d 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -42,8 +42,32 @@ namespace Fool {
void FoolPrologue::run(bool finale) {
_toolbox = new Toolbox();
_zbasic = new ZBasic(_toolbox);
- _zbasic->loadProgram(Common::Path("Prologue - Finale"));
- this->sub_128_004(finale);
+
+ Common::MacFinderInfo finfo;
+ if (_toolbox->GetFInfo(Common::U32String("Prologue - Finale"), 0, finfo) == kNoErr) {
+ _zbasic->loadProgram(Common::Path("Prologue - Finale", ':'));
+ } else if (_toolbox->GetFInfo(Common::U32String("Prologue & Finale"), 0, finfo) == kNoErr) {
+ _zbasic->loadProgram(Common::Path("Prologue & Finale", ':'));
+ } else {
+ error("FoolGame::run: Prologue - Finale program not found");
+ return;
+ }
+
+ // The fonts in this game are a bit of a mess.
+ // Both copies of the Fool and Small fonts have missing characters,
+ // so we need to have them coexisting.
+ int16 exec = _zbasic->getFileId();
+ Handle foolFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kPrologueFontFool + 10);
+ // These second copies can't clash, so we need to patch in new family IDs.
+ foolFOND->data()[2] = 0;
+ foolFOND->data()[3] = (byte)kPrologueFontFool;
+ _toolbox->_injectFOND(exec, foolFOND->data(), foolFOND->size(), Common::String("Fool Prologue"));
+ Handle smallFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kPrologueFontSmall + 10);
+ smallFOND->data()[2] = 0;
+ smallFOND->data()[3] = (byte)kPrologueFontSmall;
+ _toolbox->_injectFOND(exec, smallFOND->data(), smallFOND->size(), Common::String("Small Prologue"));
+
+ sub_128_004(finale);
delete _zbasic;
_zbasic = nullptr;
delete _toolbox;
@@ -63,35 +87,35 @@ void FoolPrologue::sub_128_004(bool finale) {
// b54 must be the 1-bit screen buffer
// 41296 is an array of pointers to screen pages within the buffer
for (int i = 0; i < 16; i++) {
- this->arr_i32_1e3fc[i] = BitMap(new Graphics::ManagedSurface());
- this->arr_i32_1e3fc[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ arr_i32_1e3fc[i] = BitMap(new Graphics::ManagedSurface());
+ arr_i32_1e3fc[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
for (int i = 0; i < 12; i++) {
- //this->arr_i32_41296[i] = &this->arr_i32_b54[SCREEN_PAGE_SIZE*i];
- this->arr_i32_41296[i] = BitMap(new Graphics::ManagedSurface());
- this->arr_i32_41296[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ //arr_i32_41296[i] = &arr_i32_b54[SCREEN_PAGE_SIZE*i];
+ arr_i32_41296[i] = BitMap(new Graphics::ManagedSurface());
+ arr_i32_41296[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
- this->arr_i32_3bca4 = BitMap(new Graphics::ManagedSurface());
- this->arr_i32_3bca4->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ arr_i32_3bca4 = BitMap(new Graphics::ManagedSurface());
+ arr_i32_3bca4->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
// 128:0066
- this->var_i32_4e = this->arr_i32_41296[11];
+ var_i32_4e = arr_i32_41296[11];
// 128:0078
// pattern buffer
- this->arr_pat_194[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; // solid white
- this->arr_pat_194[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } }; // checkerboard
- this->arr_pat_194[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; // solid black
+ _patterns[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; // solid white
+ _patterns[1] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } }; // checkerboard
+ _patterns[2] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; // solid black
// 128:00d6
- this->arr_pat_194[3] = { { 0x01, 0x07, 0x0e, 0x0c, 0x7c, 0x70, 0xc0, 0xc0 } };
- this->arr_pat_194[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
+ _patterns[3] = { { 0x01, 0x07, 0x0e, 0x0c, 0x7c, 0x70, 0xc0, 0xc0 } };
+ _patterns[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
// 128:017a
// about message
- this->var_str_76 = _zbasic->str(0);
- this->var_str_76 = _zbasic->str(1);
- this->var_str_76 = _zbasic->str(2);
+ var_str_76 = _zbasic->str(0);
+ var_str_76 = _zbasic->str(1);
+ var_str_76 = _zbasic->str(2);
// fill graphics pages with white
for (int16 i = 0; i < 12; i++) {
@@ -117,18 +141,18 @@ void FoolPrologue::sub_128_004(bool finale) {
// JMP 0xa88
// JMP 0xc8a
// 128:0c8a
- this->sub_129_004();
+ sub_129_004();
if (_quit)
return;
- this->var_i32_1a6 = _zbasic->mem(-1);
- if (this->var_i16_1aa == 1) {
- this->prologueRun();
- this->var_i32_1a6 = _zbasic->mem(-1);
+ var_i32_1a6 = _zbasic->mem(-1);
+ if (var_i16_1aa == 1) {
+ prologueRun();
+ var_i32_1a6 = _zbasic->mem(-1);
}
// 128:0cb0
- if (this->var_i16_1aa == 2) {
- this->finaleRun();
- this->var_i32_1a6 = _zbasic->mem(-1);
+ if (var_i16_1aa == 2) {
+ finaleRun();
+ var_i32_1a6 = _zbasic->mem(-1);
}
// 128:0cc8
//_zbasic->unk4(); // exit command?
@@ -137,14 +161,14 @@ void FoolPrologue::sub_128_004(bool finale) {
void FoolPrologue::copyScreenToPage(int16 screenPage) {
// 128:01ba
- this->var_i32_40 = this->arr_i32_41296[screenPage];
- _toolbox->CopyBits(this->var_i32_32, this->var_i32_40, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ var_i32_40 = arr_i32_41296[screenPage];
+ _toolbox->CopyBits(var_i32_32, var_i32_40, var_i16_38, var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::setPortBitsToPage(int16 screenPage) {
// 128:01f4
- this->var_i32_40 = this->arr_i32_41296[screenPage];
- _toolbox->SetPortBits(this->var_i32_40);
+ var_i32_40 = arr_i32_41296[screenPage];
+ _toolbox->SetPortBits(var_i32_40);
}
void FoolPrologue::delay(int16 numTicks) {
@@ -156,71 +180,71 @@ void FoolPrologue::delay(int16 numTicks) {
void FoolPrologue::delayFromMarker(int16 numTicks) {
// 128:024a
- uint32 delay = (uint32)MAX<int>(this->var_i32_2 + numTicks + 1 - _toolbox->TickCount(), 0);
+ uint32 delay = (uint32)MAX<int>(var_i32_2 + numTicks + 1 - _toolbox->TickCount(), 0);
// again, polling TickCount in a loop.
_toolbox->Delay(delay);
}
-void FoolPrologue::drawTextRightAlign(int16 x, int16 y) {
+void FoolPrologue::drawTextRight(const Common::U32String &str, int16 x, int16 y) {
// 128:026c
- int16 width = _toolbox->StringWidth(this->var_str_76);
+ int16 width = _toolbox->StringWidth(str);
_toolbox->MoveTo(x - width, y);
- _toolbox->DrawString(this->var_str_76);
+ _toolbox->DrawString(str);
}
-void FoolPrologue::drawTextCenterAlign(int16 x, int16 y) {
+void FoolPrologue::drawTextCenter(const Common::U32String &str, int16 x, int16 y) {
// 128:02a6
- int16 width = _toolbox->StringWidth(this->var_str_76);
+ int16 width = _toolbox->StringWidth(str);
_toolbox->MoveTo(x - (width / 2), y);
- _toolbox->DrawString(this->var_str_76);
+ _toolbox->DrawString(str);
}
void FoolPrologue::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:02f0
- _toolbox->SetRect(this->arr_rect_41af4, left, top, right, bottom);
- _toolbox->FillRect(this->arr_rect_41af4, this->arr_pat_194[patternID]);
+ _toolbox->SetRect(arr_rect_41af4, left, top, right, bottom);
+ _toolbox->FillRect(arr_rect_41af4, _patterns[patternID]);
}
void FoolPrologue::zoomClose(int16 patternID, PatternMode mode) {
// 128:0354
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->PenPat(this->arr_pat_194[patternID]);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->PenPat(_patterns[patternID]);
_toolbox->PenMode(mode);
_toolbox->PenSize(6, 4);
for (int i = 0; i <= 130; i += 3) {
- _toolbox->FrameRect(this->arr_i16_1bc);
- _toolbox->InsetRect(this->arr_i16_1bc, 6, 4);
- this->delay(0);
+ _toolbox->FrameRect(arr_i16_1bc);
+ _toolbox->InsetRect(arr_i16_1bc, 6, 4);
+ delay(0);
}
_toolbox->PenNormal();
}
void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
// 128:03ee
- this->var_i16_18c = 0x5;
- if (this->var_i16_18e > 0x28) {
- this->var_i16_18c = 0x8;
+ var_i16_18c = 0x5;
+ if (var_i16_18e > 0x28) {
+ var_i16_18c = 0x8;
}
- if (this->var_i16_18e > 0x50) {
- this->var_i16_18c = 0xb;
+ if (var_i16_18e > 0x50) {
+ var_i16_18c = 0xb;
}
- if (this->var_i16_18e > 0x64) {
- this->var_i16_18c = 0xe;
+ if (var_i16_18e > 0x64) {
+ var_i16_18c = 0xe;
}
// 128:0428
- for (int i = 1; i <= this->var_i16_18e; i++) {
- this->var_i32_2 = _toolbox->TickCount();
+ for (int i = 1; i <= var_i16_18e; i++) {
+ var_i32_2 = _toolbox->TickCount();
_toolbox->MoveTo(
- this->arr_i16_1e8[i] - unk1,
- this->arr_i16_1e8[i + 0x1f6] - unk1
+ arr_i16_1e8[i] - unk1,
+ arr_i16_1e8[i + 0x1f6] - unk1
);
_toolbox->LineTo(
- this->arr_i16_1e8[i + 0xfb] + unk1,
- this->arr_i16_1e8[i + 0x1f6] - unk1
+ arr_i16_1e8[i + 0xfb] + unk1,
+ arr_i16_1e8[i + 0x1f6] - unk1
);
- if (i % this->var_i16_18c == 0) {
- this->delayFromMarker(0);
+ if (i % var_i16_18c == 0) {
+ delayFromMarker(0);
};
}
@@ -228,9 +252,9 @@ void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
void FoolPrologue::sub_128_50a(int16 screenPage, int16 left, int16 right, int16 updatePeriod) {
// 128:050a
- this->var_i32_40 = this->arr_i32_41296[screenPage];
- this->var_i16_5c.left = left;
- this->var_i16_5c.right = right;
+ var_i32_40 = arr_i32_41296[screenPage];
+ var_i16_5c.left = left;
+ var_i16_5c.right = right;
if (updatePeriod == 0) {
updatePeriod = 0x14;
}
@@ -245,33 +269,33 @@ void FoolPrologue::sub_128_50a(int16 screenPage, int16 left, int16 right, int16
}
// 128:0584
for (int i = 0; i < SCREEN_HEIGHT; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i16_5c.top = this->arr_i16_412ea[i];
- this->var_i16_5c.bottom = this->arr_i16_412ea[i] + 1;
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_5c.top = arr_i16_412ea[i];
+ var_i16_5c.bottom = arr_i16_412ea[i] + 1;
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
if (i % updatePeriod == 0) {
- this->delayFromMarker(0);
+ delayFromMarker(0);
}
}
}
void FoolPrologue::blitPageToScreen(int16 screenPage) {
// 128:0610
- this->var_i32_40 = this->arr_i32_41296[screenPage];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ var_i32_40 = arr_i32_41296[screenPage];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
}
void FoolPrologue::scanlineTransition(int16 patternID) {
// 128:064a
_toolbox->PenNormal();
- _toolbox->PenPat(this->arr_pat_194[patternID]);
+ _toolbox->PenPat(_patterns[patternID]);
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->MoveTo(0, this->arr_i16_412ea[i]);
- _toolbox->LineTo(SCREEN_WIDTH, this->arr_i16_412ea[i]);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->MoveTo(0, arr_i16_412ea[i]);
+ _toolbox->LineTo(SCREEN_WIDTH, arr_i16_412ea[i]);
if (i % 5 == 0) {
- this->delayFromMarker(0);
+ delayFromMarker(0);
}
}
_toolbox->PenNormal();
@@ -279,102 +303,102 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
- this->var_i32_40 = this->arr_i32_41296[screenPage];
+ var_i32_40 = arr_i32_41296[screenPage];
for (int i = 1; i <= 0x36; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
- this->var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
- this->var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
- this->var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
+ var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
+ var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
+ var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_38, this->var_i16_38, kSrcCopy, nullptr);
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
// 128:0800
- this->arr_rect_41af4.top = unk1;
- this->arr_rect_41af4.left = unk2;
- this->arr_rect_41af4.bottom = unk3;
- this->arr_rect_41af4.right = unk4;
- this->arr_i16_41afc.top = unk5;
- this->arr_i16_41afc.left = unk6;
- this->arr_i16_41afc.bottom = unk7;
- this->arr_i16_41afc.right = unk8;
+ arr_rect_41af4.top = unk1;
+ arr_rect_41af4.left = unk2;
+ arr_rect_41af4.bottom = unk3;
+ arr_rect_41af4.right = unk4;
+ arr_i16_41afc.top = unk5;
+ arr_i16_41afc.left = unk6;
+ arr_i16_41afc.bottom = unk7;
+ arr_i16_41afc.right = unk8;
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
// 128:08bc
- this->arr_f64_41bbe[0] = (double)this->arr_rect_41af4.top;
- this->arr_f64_41bbe[1] = (double)this->arr_rect_41af4.left;
- this->arr_f64_41bbe[2] = (double)this->arr_rect_41af4.bottom;
- this->arr_f64_41bbe[3] = (double)this->arr_rect_41af4.right;
- this->arr_f64_41bbe[4] = (double)(this->arr_i16_41afc.top - this->arr_rect_41af4.top)/(double)(unk9);
- this->arr_f64_41bbe[5] = (double)(this->arr_i16_41afc.left - this->arr_rect_41af4.left)/(double)(unk9);
- this->arr_f64_41bbe[6] = (double)(this->arr_i16_41afc.bottom - this->arr_rect_41af4.bottom)/(double)(unk9);
- this->arr_f64_41bbe[7] = (double)(this->arr_i16_41afc.right - this->arr_rect_41af4.right)/(double)(unk9);
+ arr_f64_41bbe[0] = (double)arr_rect_41af4.top;
+ arr_f64_41bbe[1] = (double)arr_rect_41af4.left;
+ arr_f64_41bbe[2] = (double)arr_rect_41af4.bottom;
+ arr_f64_41bbe[3] = (double)arr_rect_41af4.right;
+ arr_f64_41bbe[4] = (double)(arr_i16_41afc.top - arr_rect_41af4.top)/(double)(unk9);
+ arr_f64_41bbe[5] = (double)(arr_i16_41afc.left - arr_rect_41af4.left)/(double)(unk9);
+ arr_f64_41bbe[6] = (double)(arr_i16_41afc.bottom - arr_rect_41af4.bottom)/(double)(unk9);
+ arr_f64_41bbe[7] = (double)(arr_i16_41afc.right - arr_rect_41af4.right)/(double)(unk9);
// 128:096e
- _toolbox->PaintRect(this->arr_rect_41af4);
+ _toolbox->PaintRect(arr_rect_41af4);
for (int i = 1; i <= (unk9 - 1); i++) {
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
// 128:098c
for (int j = 0; j <= 3; j++) {
- this->arr_f64_41bbe[j] += this->arr_f64_41bbe[j+4];
+ arr_f64_41bbe[j] += arr_f64_41bbe[j+4];
}
- this->arr_i16_41b0a.top = (int16)this->arr_f64_41bbe[0];
- this->arr_i16_41b0a.left = (int16)this->arr_f64_41bbe[1];
- this->arr_i16_41b0a.bottom = (int16)this->arr_f64_41bbe[2];
- this->arr_i16_41b0a.right = (int16)this->arr_f64_41bbe[3];
+ arr_i16_41b0a.top = (int16)arr_f64_41bbe[0];
+ arr_i16_41b0a.left = (int16)arr_f64_41bbe[1];
+ arr_i16_41b0a.bottom = (int16)arr_f64_41bbe[2];
+ arr_i16_41b0a.right = (int16)arr_f64_41bbe[3];
// 128:0a2e
- _toolbox->PaintRect(this->arr_i16_41b0a);
- this->delayFromMarker(0);
+ _toolbox->PaintRect(arr_i16_41b0a);
+ delayFromMarker(0);
}
- _toolbox->PaintRect(this->arr_i16_41afc);
+ _toolbox->PaintRect(arr_i16_41afc);
_toolbox->PenNormal();
}
-void FoolPrologue::drawText(int16_t x, int16_t y) {
+void FoolPrologue::drawText(const Common::U32String &str, int16_t x, int16_t y) {
// 128:0a6c
_toolbox->MoveTo(x, y);
- _toolbox->DrawString(this->var_str_76);
+ _toolbox->DrawString(str);
}
void FoolPrologue::drawRainRecycle(int16_t unk) {
// 128:0a8c
- this->var_i16_1a4 = unk;
+ var_i16_1a4 = unk;
_toolbox->PenMode(kPatXor);
do {
// 128:0a96
- this->drawRainDrop();
- this->arr_i16_1e8[this->var_i16_6] =
- this->arr_i16_1e8[0x2f1+this->var_i16_6]
- + this->arr_i16_1e8[this->var_i16_6];
+ drawRainDrop();
+ arr_i16_1e8[var_i16_6] =
+ arr_i16_1e8[0x2f1+var_i16_6]
+ + arr_i16_1e8[var_i16_6];
- this->arr_i16_1e8[0xfb+this->var_i16_6] =
- this->arr_i16_1e8[0xfb+this->var_i16_6]
- + this->arr_i16_1e8[0x2f1+this->var_i16_6];
+ arr_i16_1e8[0xfb+var_i16_6] =
+ arr_i16_1e8[0xfb+var_i16_6]
+ + arr_i16_1e8[0x2f1+var_i16_6];
// 128:0b52
- if ((this->arr_i16_1e8[this->var_i16_6] > 0x1f4) || (this->arr_i16_1e8[this->var_i16_6 + 0xfb] > 0x140)) {
+ if ((arr_i16_1e8[var_i16_6] > 0x1f4) || (arr_i16_1e8[var_i16_6 + 0xfb] > 0x140)) {
// 128:0bae
- this->arr_i16_1e8[this->var_i16_6] = _zbasic->rndInt(0x264) - 0xc8;
- this->arr_i16_1e8[0xfb + this->var_i16_6] = _zbasic->rndInt(0x1ba) - 0xc8;
- this->arr_i16_1e8[0x1f6 + this->var_i16_6] = _zbasic->rndInt(0x5) + 0x1;
- this->arr_i16_1e8[0x2f1 + this->var_i16_6] = _zbasic->rndInt(0xa) + 0x19;
+ arr_i16_1e8[var_i16_6] = _zbasic->rndInt(0x264) - 0xc8;
+ arr_i16_1e8[0xfb + var_i16_6] = _zbasic->rndInt(0x1ba) - 0xc8;
+ arr_i16_1e8[0x1f6 + var_i16_6] = _zbasic->rndInt(0x5) + 0x1;
+ arr_i16_1e8[0x2f1 + var_i16_6] = _zbasic->rndInt(0xa) + 0x19;
}
// 128:0c56
- this->drawRainDrop();
- this->var_i16_6 += 1;
- if (this->var_i16_6 > 0xb5) {
- this->var_i16_6 = 0;
+ drawRainDrop();
+ var_i16_6 += 1;
+ if (var_i16_6 > 0xb5) {
+ var_i16_6 = 0;
_toolbox->Delay(0);
}
- } while (this->var_i32_2 + this->var_i16_1a4 > _toolbox->TickCount());
+ } while (var_i32_2 + var_i16_1a4 > _toolbox->TickCount());
_toolbox->Delay(0);
}
@@ -384,93 +408,93 @@ void FoolPrologue::sub_128_c8a() {
void FoolPrologue::shuffleScanlines() {
_zbasic->unk_20();
- this->var_i32_1ac = (byte *)&this->arr_i16_41598[0];
- this->var_i32_1b0 = (byte *)&this->arr_i16_41846[0];
- this->var_i16_1b4 = this->var_i16_18e * 2;
+ var_i32_1ac = (byte *)&arr_i16_41598[0];
+ var_i32_1b0 = (byte *)&arr_i16_41846[0];
+ var_i16_1b4 = var_i16_18e * 2;
// 128:0d00
- for (int i=0; i < this->var_i16_18e; i++) {
- this->arr_i16_41598[i] = i;
+ for (int i=0; i < var_i16_18e; i++) {
+ arr_i16_41598[i] = i;
}
// 128:0d2a
- for (int i=this->var_i16_18e - 1; i >= 0; i--) {
- this->var_i16_1b6 = _zbasic->rndInt(i + 1) - 1;
- this->arr_i16_412ea[i] = this->arr_i16_41598[this->var_i16_1b6];
- this->var_i16_1b8 = this->var_i16_1b6 * 2 + 2;
- _zbasic->blockMove(this->var_i32_1ac + this->var_i16_1b8, this->var_i32_1b0 + this->var_i16_1b8, this->var_i16_1b4 - this->var_i16_1b8);
- _zbasic->blockMove(this->var_i32_1b0 + this->var_i16_1b8, this->var_i32_1ac + this->var_i16_1b8 - 2, this->var_i16_1b4 - this->var_i16_1b8);
+ for (int i=var_i16_18e - 1; i >= 0; i--) {
+ var_i16_1b6 = _zbasic->rndInt(i + 1) - 1;
+ arr_i16_412ea[i] = arr_i16_41598[var_i16_1b6];
+ var_i16_1b8 = var_i16_1b6 * 2 + 2;
+ _zbasic->blockMove(var_i32_1ac + var_i16_1b8, var_i32_1b0 + var_i16_1b8, var_i16_1b4 - var_i16_1b8);
+ _zbasic->blockMove(var_i32_1b0 + var_i16_1b8, var_i32_1ac + var_i16_1b8 - 2, var_i16_1b4 - var_i16_1b8);
}
}
void FoolPrologue::drawClickMessage() {
// 128:0de2
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
- this->var_str_76 = _zbasic->str(3);
- this->drawText(5, 0x151);
+ // Click Mouse to Continue
+ drawText(_zbasic->str(3), 5, 0x151);
}
-void FoolPrologue::sub_128_e1c() {
+void FoolPrologue::drawClickMessageRightAlign() {
// 128:0e1c
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
- this->var_str_76 = _zbasic->str(4);
- this->drawTextRightAlign(0x1fb, 0x154);
+ // Click Mouse to Continue
+ drawTextRight(_zbasic->str(4), 0x1fb, 0x154);
}
void FoolPrologue::sub_128_e58() {
// 128:0e58
- this->sub_128_e80();
+ sub_128_e80();
while (true) {
// was: 2
- this->var_i16_1ba = _toolbox->GetNextEvent(-1, this->var_ev_22);
- if (this->var_ev_22.what == kMouseDown)
+ var_i16_1ba = _toolbox->GetNextEvent(-1, var_ev_22);
+ if (var_ev_22.what == kMouseDown)
break;
- if ((this->var_ev_22.what == kScummVMQuitEvt) || (this->var_ev_22.what == kScummVMReturnToLauncherEvt)) {
+ if ((var_ev_22.what == kScummVMQuitEvt) || (var_ev_22.what == kScummVMReturnToLauncherEvt)) {
_quit = true;
return;
}
// wait until next redraw
- if (this->var_ev_22.what == kNullEvent)
+ if (var_ev_22.what == kNullEvent)
_toolbox->Delay(0);
}
- this->sub_128_e80();
+ sub_128_e80();
}
void FoolPrologue::sub_128_e80() {
// 128:0e80
while (true) {
- this->var_i16_1ba = (int)_toolbox->GetNextEvent(-1, this->var_ev_22);
- if (this->var_ev_22.what == kUpdateEvt) {
- this->sub_128_ed2();
+ var_i16_1ba = (int)_toolbox->GetNextEvent(-1, var_ev_22);
+ if (var_ev_22.what == kUpdateEvt) {
+ sub_128_ed2();
}
- if (this->var_ev_22.what == kDiskEvt) {
- this->sub_128_ee0();
+ if (var_ev_22.what == kDiskEvt) {
+ sub_128_ee0();
}
- if (this->var_ev_22.what == kScummVMQuitEvt || this->var_ev_22.what == kScummVMReturnToLauncherEvt) {
+ if (var_ev_22.what == kScummVMQuitEvt || var_ev_22.what == kScummVMReturnToLauncherEvt) {
_quit = true;
return;
}
// keep looping until mouse is seen as up??
// see I-252
- if ((this->var_ev_22.modifiers & kModMouseButtonUp) && (this->var_ev_22.what == kNullEvent)) {
+ if ((var_ev_22.modifiers & kModMouseButtonUp) && (var_ev_22.what == kNullEvent)) {
break;
}
// wait until next redraw
- if (this->var_ev_22.what == kNullEvent)
+ if (var_ev_22.what == kNullEvent)
_toolbox->Delay(0);
}
}
void FoolPrologue::sub_128_ed2() {
// 128:0ed2
- _toolbox->BeginUpdate(this->var_window_24);
- _toolbox->EndUpdate(this->var_window_24);
+ _toolbox->BeginUpdate(var_window_24);
+ _toolbox->EndUpdate(var_window_24);
}
void FoolPrologue::sub_128_ee0() {
// 128:0ee0
// done by using PEEKWORD into fixed offsets of the window pointer
- //this->var_i16_1bc = &this->var_window_24; // +0
- //this->var_i16_1be = &this->var_window_24; // +2
- //_zbasic->unk11(this->var_i16_1be);
+ //var_i16_1bc = &var_window_24; // +0
+ //var_i16_1be = &var_window_24; // +2
+ //_zbasic->unk11(var_i16_1be);
}
void FoolPrologue::sub_128_f0a() {
@@ -505,114 +529,109 @@ void FoolPrologue::sub_129_004() {
// 0x000a: JSR - "PEEKLONG" # current A5
// 0x000e: SUBI.L - 0x72,D0
// 0x0014: JSR - "PEEKWORD" # quickdraw globals,
- this->var_i16_10 = g_engine->_wm._screenDims.width(); // window width?
- this->var_i16_12 = g_engine->_wm._screenDims.height(); // window height?
+ var_i16_10 = g_engine->_wm._screenDims.width(); // window width?
+ var_i16_12 = g_engine->_wm._screenDims.height(); // window height?
// 129:0034
// set left and top offsets based on a drawable area of 512x342
- this->var_i16_14 = (this->var_i16_10 - SCREEN_WIDTH)/2;
- this->var_i16_16 = (this->var_i16_12 - SCREEN_HEIGHT)/2;
+ var_i16_14 = (var_i16_10 - SCREEN_WIDTH)/2;
+ var_i16_16 = (var_i16_12 - SCREEN_HEIGHT)/2;
// 129:0064
- _zbasic->window(1, "", 0, 0, this->var_i16_10, this->var_i16_12, kWindowDialogOneLine);
+ _zbasic->window(1, "", 0, 0, var_i16_10, var_i16_12, kWindowDialogOneLine);
_zbasic->coordinateWindow();
- this->var_i16_1c = { 0, 0, 0 };
+ var_i16_1c = { 0, 0, 0 };
// code checks Rom85 for presence of 128K ROM before doing next bit
// 129:00a2
if (false) {
- this->var_i16_1c = { 0x4e20, 0x4e20, 0x4e20 };
- _toolbox->SetCPixel(0x64, 0x64, this->var_i16_1c);
- _toolbox->GetCPixel(0x64, 0x64, this->var_i16_1c);
+ var_i16_1c = { 0x4e20, 0x4e20, 0x4e20 };
+ _toolbox->SetCPixel(0x64, 0x64, var_i16_1c);
+ _toolbox->GetCPixel(0x64, 0x64, var_i16_1c);
}
// 129:00ee
// used for drawing on the menu bar
- this->var_i32_c = &this->arr_grafport_a8a;
- _toolbox->OpenPort(this->var_i32_c);
- //this->var_i32_c->portBits = _toolbox->_defaultMenuBits;
- //this->var_i32_c->portRect = _toolbox->_defaultMenuBits->getBounds();
+ var_i32_c = &arr_grafport_a8a;
+ _toolbox->OpenPort(var_i32_c);
+ //var_i32_c->portBits = _toolbox->_defaultMenuBits;
+ //var_i32_c->portRect = _toolbox->_defaultMenuBits->getBounds();
- this->var_i32_8 = &this->arr_grafport_9c0;
- _toolbox->OpenPort(this->var_i32_8);
+ var_i32_8 = &arr_grafport_9c0;
+ _toolbox->OpenPort(var_i32_8);
- if ((this->var_i16_10 != SCREEN_WIDTH || this->var_i16_12 != SCREEN_HEIGHT)) {
+ if ((var_i16_10 != SCREEN_WIDTH || var_i16_12 != SCREEN_HEIGHT)) {
// 129:013a
- this->fillRect(0x14, 0, this->var_i16_12, this->var_i16_10, 2);
- _toolbox->SetRect(this->arr_i16_1bc, this->var_i16_14 - 2, this->var_i16_16 - 2, this->var_i16_14 + SCREEN_WIDTH + 2, this->var_i16_16 + SCREEN_HEIGHT + 2);
- _toolbox->PenPat(this->arr_pat_194[1]);
- _toolbox->FrameRect(this->arr_i16_1bc);
+ fillRect(0x14, 0, var_i16_12, var_i16_10, 2);
+ _toolbox->SetRect(arr_i16_1bc, var_i16_14 - 2, var_i16_16 - 2, var_i16_14 + SCREEN_WIDTH + 2, var_i16_16 + SCREEN_HEIGHT + 2);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->FrameRect(arr_i16_1bc);
}
// 129:01b0
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->MovePortTo(this->var_i16_14, this->var_i16_16);
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->ClipRect(this->arr_i16_1bc);
+ _toolbox->MovePortTo(var_i16_14, var_i16_16);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->ClipRect(arr_i16_1bc);
// 129:01f2
- if (this->var_i16_12 == SCREEN_HEIGHT) {
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
+ if (var_i16_12 == SCREEN_HEIGHT) {
+ _toolbox->SetRect(arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->FillRect(arr_i16_1bc, _patterns[1]);
} else {
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->FillRect(this->arr_i16_1bc, this->arr_pat_194[1]);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->FillRect(arr_i16_1bc, _patterns[1]);
}
// 129:026c
- this->var_i32_32 = this->var_i32_8->portBits;
- this->var_i16_36 = 0x40;
- this->var_i16_38.top = -this->var_i16_16;
- this->var_i16_38.left = -this->var_i16_14;
- this->var_i16_38.bottom = this->var_i16_16 + SCREEN_HEIGHT;
- this->var_i16_38.right = this->var_i16_14 + SCREEN_WIDTH;
- this->var_i16_44 = 0x40;
- this->var_i16_46.top = 0x0;
- this->var_i16_46.left = 0x0;
- this->var_i16_46.bottom = SCREEN_HEIGHT;
- this->var_i16_46.right = SCREEN_WIDTH;
- this->var_i16_52 = 0x40;
- this->var_i16_54.top = 0x0;
- this->var_i16_54.left = 0x0;
- this->var_i16_54.bottom = SCREEN_HEIGHT;
- this->var_i16_54.right = SCREEN_WIDTH;
-
- this->var_i32_1c0 = _zbasic->mem(-1);
+ var_i32_32 = var_i32_8->portBits;
+ var_i16_36 = 0x40;
+ var_i16_38.top = -var_i16_16;
+ var_i16_38.left = -var_i16_14;
+ var_i16_38.bottom = var_i16_16 + SCREEN_HEIGHT;
+ var_i16_38.right = var_i16_14 + SCREEN_WIDTH;
+ var_i16_44 = 0x40;
+ var_i16_46.top = 0x0;
+ var_i16_46.left = 0x0;
+ var_i16_46.bottom = SCREEN_HEIGHT;
+ var_i16_46.right = SCREEN_WIDTH;
+ var_i16_52 = 0x40;
+ var_i16_54.top = 0x0;
+ var_i16_54.left = 0x0;
+ var_i16_54.bottom = SCREEN_HEIGHT;
+ var_i16_54.right = SCREEN_WIDTH;
+
+ var_i32_1c0 = _zbasic->mem(-1);
// 129:02fe
- if (this->var_i32_1c0 < 0xd6d8) {
+ if (var_i32_1c0 < 0xd6d8) {
_toolbox->InitCursor();
- _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
+ _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, arr_i32_41296[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x0);
- this->fillRect(0x46, 0x64, 0xdc, 0x19c, 2);
- this->fillRect(0x4b, 0x69, 0xd7, 0x197, 1);
+ fillRect(0x46, 0x64, 0xdc, 0x19c, 2);
+ fillRect(0x4b, 0x69, 0xd7, 0x197, 1);
// 129:0386
- this->fillRect(0x50, 0x6e, 0xd2, 0x192, 2);
+ fillRect(0x50, 0x6e, 0xd2, 0x192, 2);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "not enough memory" message
- this->var_str_76 = _zbasic->str(6);
- this->drawTextCenterAlign(0x100, 0x64);
- this->var_str_76 = _zbasic->str(7);
- this->drawTextCenterAlign(0x100, 0x78);
- this->var_str_76 = _zbasic->str(8);
- this->drawTextCenterAlign(0x100, 0x96);
- this->var_str_76 = _zbasic->str(9);
- this->drawTextCenterAlign(0x100, 0xaa);
- this->var_str_76 = _zbasic->str(10);
- this->drawTextCenterAlign(0x100, 0xcb);
- this->sub_128_e58();
+ drawTextCenter(_zbasic->str(6), 0x100, 0x64);
+ drawTextCenter(_zbasic->str(7), 0x100, 0x78);
+ drawTextCenter(_zbasic->str(8), 0x100, 0x96);
+ drawTextCenter(_zbasic->str(9), 0x100, 0xaa);
+ drawTextCenter(_zbasic->str(10), 0x100, 0xcb);
+ sub_128_e58();
if (_quit)
return;
- _zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
- this->var_i16_1aa = 0;
+ _zbasic->put(0x0, 0x14, arr_i32_41296[0], kSrcCopy);
+ var_i16_1aa = 0;
} else {
// 129:04a0
- this->var_i16_180 = 1;
+ var_i16_180 = 1;
// this next blob of code is for determining whether to
// open the prologue or the finale.
// both are in the same EXE, however the finale is accessed
@@ -621,78 +640,71 @@ void FoolPrologue::sub_129_004() {
// we don't need to worry about files as we add a start trigger
// in the game's menu.
/*
- this->var_i16_1aa = 1;
+ var_i16_1aa = 1;
// 180 == number, possibly file number
// 1c4 == string
// 2c4 == unused
// 2c8 == volume number?
- this->var_i16_176 = _zbasic->finderInfo(this->var_i16_180, this->var_i16_1c4, this->var_i32_2c4, this->var_i16_2c8);
- if (Common::U32String("") != this->var_i16_1c4) {
+ var_i16_176 = _zbasic->finderInfo(var_i16_180, var_i16_1c4, var_i32_2c4, var_i16_2c8);
+ if (Common::U32String("") != var_i16_1c4) {
// 129:04de
// "and now it is time to show the finale" message
- this->var_str_76 = _zbasic->str(12);
+ var_str_76 = _zbasic->str(12);
for (int i = 1; i <= 0xa; i++) {
- this->var_str_76 += _zbasic->chr(i);
+ var_str_76 += _zbasic->chr(i);
}
// 129:0522
- this->var_i16_2ca = this->var_str_76.size();
- this->var_i16_2cc = 0;
+ var_i16_2ca = var_str_76.size();
+ var_i16_2cc = 0;
// 129:0534
// what is this???
// 0x0534: LEA - [0x0764],A0
// 0x0538: MOVE.L - A0,-0x8ee(A5)
// 0x053c: SF - 0x8,D0
- _zbasic->openR(1, this->var_i16_1c4, 0x400, this->var_i16_2c8);
+ _zbasic->openR(1, var_i16_1c4, 0x400, var_i16_2c8);
- Handle payload = _zbasic->readFile(1, this->var_i16_2ca);
- this->var_i16_2ce = Common::U32String((char *)payload->data(), this->var_i16_2ca, Common::kMacRoman);
+ Handle payload = _zbasic->readFile(1, var_i16_2ca);
+ var_i16_2ce = Common::U32String((char *)payload->data(), var_i16_2ca, Common::kMacRoman);
_zbasic->close(1);
// 0x0570: CLR.L - -0x8ee(A5)
// 129:0582
- if ((this->var_i16_2ce == this->var_str_76) &&
- this->var_i16_2cc == 0) {
- this->var_i16_1aa = 2;
+ if ((var_i16_2ce == var_str_76) &&
+ var_i16_2cc == 0) {
+ var_i16_1aa = 2;
} else {
- this->var_i16_1aa = 0;
+ var_i16_1aa = 0;
}
}
*/
// 129:05a6
- if (this->var_i16_1c.red + this->var_i16_1c.blue + this->var_i16_1c.green != 0) {
+ if (var_i16_1c.red + var_i16_1c.blue + var_i16_1c.green != 0) {
_toolbox->InitCursor();
- _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_i32_41296[0], true);
+ _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, arr_i32_41296[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x00);
- this->fillRect(0x64, 0x82, 0xdc, 0x17e, 2);
- this->fillRect(0x69, 0x87, 0xd7, 0x179, 1);
- this->fillRect(0x6e, 0x8c, 0xd2, 0x174, 2);
+ fillRect(0x64, 0x82, 0xdc, 0x17e, 2);
+ fillRect(0x69, 0x87, 0xd7, 0x179, 1);
+ fillRect(0x6e, 0x8c, 0xd2, 0x174, 2);
// 129:0662
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
// "set your monitor to black and white" message"
- this->var_str_76 = _zbasic->str(13);
- this->drawTextCenterAlign(0x100, 0x82);
- this->var_str_76 = _zbasic->str(14);
- this->drawTextCenterAlign(0x100, 0x96);
+ drawTextCenter(_zbasic->str(13), 0x100, 0x82);
+ drawTextCenter(_zbasic->str(14), 0x100, 0x96);
- this->var_str_76 = _zbasic->str(15);
// if this is the finale
- if (this->var_i16_1aa == 2) {
- this->var_str_76 = _zbasic->str(16);
- }
- this->drawTextCenterAlign(0x100, 0xaa);
+ drawTextCenter(var_i16_1aa == 2 ? _zbasic->str(16): _zbasic->str(15), 0x100, 0xaa);
- this->var_str_76 = _zbasic->str(17);
- this->drawTextCenterAlign(0x100, 0xcb);
+ drawTextCenter(_zbasic->str(17), 0x100, 0xcb);
// 129:0730
- this->sub_128_e58();
+ sub_128_e58();
if (_quit)
return;
- _zbasic->put(0x0, 0x14, this->arr_i32_41296[0], kSrcCopy);
- this->var_i16_1aa = 0;
+ _zbasic->put(0x0, 0x14, arr_i32_41296[0], kSrcCopy);
+ var_i16_1aa = 0;
} else {
// 129:075c
- this->sub_128_e80();
+ sub_128_e80();
}
// 129:0772
@@ -701,21 +713,17 @@ void FoolPrologue::sub_129_004() {
void FoolPrologue::sub_129_764() {
// 129:0764
- this->var_i16_2cc = 1;
+ var_i16_2cc = 1;
_zbasic->unk_130(0);
}
-void FoolPrologue::sub_129_772() {
- // _zbasic->pushOldCodeResource(0x81);
-}
-
void FoolPrologue::prologueRun() {
// 130:0004
- this->var_i16_3ce = 5;
- this->prologueDrawLoadingMsg();
- this->var_i16_18e = SCREEN_HEIGHT;
+ var_i16_3ce = 5;
+ prologueDrawLoadingMsg();
+ var_i16_18e = SCREEN_HEIGHT;
// fill a buffer with random screen y-positions, to use for the scanline transition
- this->shuffleScanlines();
+ shuffleScanlines();
// Because of floppy disk read times, the game pre-loads as many PICT resources
// as it can stuff into memory. The below process happens a bunch of times:
@@ -726,252 +734,251 @@ void FoolPrologue::prologueRun() {
// - Release the resource
// "The Fool's Errand" title card
- this->glob_i32_2ce = _toolbox->GetPicture(0x47);
- this->var_i16_3ce = 10;
- this->prologueDrawLoadingMsg();
- this->setPortBitsToPage(0xb);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x74, 0xaa, this->glob_i32_2ce);
- _toolbox->ReleaseResource(this->glob_i32_2ce);
+ glob_i32_2ce = _toolbox->GetPicture(0x47);
+ var_i16_3ce = 10;
+ prologueDrawLoadingMsg();
+ setPortBitsToPage(0xb);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x74, 0xaa, glob_i32_2ce);
+ _toolbox->ReleaseResource(glob_i32_2ce);
// 130:007a
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcBic);
- this->var_str_76 = _zbasic->str(18);
- this->drawTextCenterAlign(0x103, 0x10d);
- _toolbox->SetPortBits(this->var_i32_32);
+ drawTextCenter(_zbasic->str(18), 0x103, 0x10d);
+ _toolbox->SetPortBits(var_i32_32);
// cliffside images with lightning
for (int i = 1; i <= 5; i++) {
- this->prologueBufferNextPicture();
+ prologueBufferNextPicture();
}
- this->setPortBitsToPage(7);
+ setPortBitsToPage(7);
// 130:00d6
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0, 0x96, this->arr_i32_0[1]);
- _toolbox->ReleaseResource(this->arr_i32_0[1]);
- this->setPortBitsToPage(8);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0, 0x96, _pics[1]);
+ _toolbox->ReleaseResource(_pics[1]);
+ setPortBitsToPage(8);
// 130:011c
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0, 0x96, this->arr_i32_0[2]);
- _toolbox->ReleaseResource(this->arr_i32_0[2]);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0, 0x96, _pics[2]);
+ _toolbox->ReleaseResource(_pics[2]);
// 130:015c
for (int i = 3; i <= 5; i++) {
- //_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[7]);
+ //_zbasic->blockMove(arr_i32_41296[7], arr_i32_41296[i], 0x5580);
+ arr_i32_41296[i]->copyFrom(*arr_i32_41296[7]);
}
// high priestess skull
- this->prologueBufferNextPicture();
- this->setPortBitsToPage(0);
+ prologueBufferNextPicture();
+ setPortBitsToPage(0);
// 130:01aa
- _zbasic->picture(0, 0, this->arr_i32_0[6]);
- _toolbox->ReleaseResource(this->arr_i32_0[6]);
+ _zbasic->picture(0, 0, _pics[6]);
+ _toolbox->ReleaseResource(_pics[6]);
// high priestess face
- this->prologueBufferNextPicture();
+ prologueBufferNextPicture();
- //_zbasic->blockMove(this->arr_i32_41296[0], this->arr_i32_41296[1], 0x5580);
- this->arr_i32_41296[1]->copyFrom(*this->arr_i32_41296[0]);
- this->setPortBitsToPage(1);
+ //_zbasic->blockMove(arr_i32_41296[0], arr_i32_41296[1], 0x5580);
+ arr_i32_41296[1]->copyFrom(*arr_i32_41296[0]);
+ setPortBitsToPage(1);
// 130:0202
- _zbasic->picture(0xa2, 0x3c, this->arr_i32_0[7]);
- _toolbox->ReleaseResource(this->arr_i32_0[7]);
+ _zbasic->picture(0xa2, 0x3c, _pics[7]);
+ _toolbox->ReleaseResource(_pics[7]);
// priestess on mountain
- this->prologueBufferNextPicture();
- this->setPortBitsToPage(2);
+ prologueBufferNextPicture();
+ setPortBitsToPage(2);
// 130:0234
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x5a, 0x2e, this->arr_i32_0[8]);
- _toolbox->ReleaseResource(this->arr_i32_0[8]);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
+ _zbasic->picture(0x5a, 0x2e, _pics[8]);
+ _toolbox->ReleaseResource(_pics[8]);
// 130:0276
for (int j = 9; j <= 0xb; j++) {
// priestess shooting lightning
- this->prologueBufferNextPicture();
+ prologueBufferNextPicture();
if (j == 9) {
- this->var_i16_74 = 0;
+ var_i16_74 = 0;
} else {
- this->var_i16_74 = 0x81;
+ var_i16_74 = 0x81;
}
// 130:029a
- this->setPortBitsToPage(j - 6);
- _zbasic->picture(0, 0, this->arr_i32_0[j]);
- _zbasic->picture(this->var_i16_74, 0x96, this->arr_i32_0[j - 6]);
- _toolbox->ReleaseResource(this->arr_i32_0[j]);
- _toolbox->ReleaseResource(this->arr_i32_0[j - 6]);
+ setPortBitsToPage(j - 6);
+ _zbasic->picture(0, 0, _pics[j]);
+ _zbasic->picture(var_i16_74, 0x96, _pics[j - 6]);
+ _toolbox->ReleaseResource(_pics[j]);
+ _toolbox->ReleaseResource(_pics[j - 6]);
}
// priestess lightning closeup
- this->prologueBufferNextPicture();
+ prologueBufferNextPicture();
// 130:0320
- this->setPortBitsToPage(6);
- _zbasic->picture(0, 0, this->arr_i32_0[0xc]);
- _toolbox->ReleaseResource(this->arr_i32_0[0xc]);
+ setPortBitsToPage(6);
+ _zbasic->picture(0, 0, _pics[0xc]);
+ _toolbox->ReleaseResource(_pics[0xc]);
// 130:034a
for (int i = 0xd; i <= 0x12; i++) {
// priestess silhouette -> fool on the cliff.
- this->prologueBufferNextPicture();
+ prologueBufferNextPicture();
}
// fool looking up at sun
- this->arr_i32_0[0x48] = _toolbox->GetPicture(0x48);
- _toolbox->SetPortBits(this->var_i32_32);
+ _pics[0x48] = _toolbox->GetPicture(0x48);
+ _toolbox->SetPortBits(var_i32_32);
// 130:0380
- if ((this->var_i16_10 == SCREEN_WIDTH) && (this->var_i16_12 == SCREEN_HEIGHT)) {
- this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
+ if ((var_i16_10 == SCREEN_WIDTH) && (var_i16_12 == SCREEN_HEIGHT)) {
+ fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
} else {
// FIXME: menu draw code not used
- /*_toolbox->SetPort(this->var_i32_c);
- this->fillRect(0, 0, 0x14, this->var_i16_10, 2);
+ /*_toolbox->SetPort(var_i32_c);
+ fillRect(0, 0, 0x14, var_i16_10, 2);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_8);*/
+ _toolbox->SetPort(var_i32_8);*/
}
// We're done loading, start the intro.
// Erase the screen with a bunch of cool scanlines.
// 130:03e4
- this->delay(0x3c);
- this->scanlineTransition(0x2);
- this->delay(0x1e);
+ delay(0x3c);
+ scanlineTransition(0x2);
+ delay(0x1e);
// draw logo
- this->blitPageToScreen(0xb);
- this->delay(0x5a);
+ blitPageToScreen(0xb);
+ delay(0x5a);
// animate rain
- this->drawRain();
+ drawRain();
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->SetRect(this->arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
// 130:043c
for (int i = 1; i <= 2; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- this->drawRainRecycle(0xb4);
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->InvertRect(this->arr_i16_1bc);
- this->delayFromMarker(1);
- _toolbox->InvertRect(this->arr_i16_1bc);
+ var_i32_2 = _toolbox->TickCount();
+ drawRainRecycle(0xb4);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(arr_i16_1bc);
+ delayFromMarker(1);
+ _toolbox->InvertRect(arr_i16_1bc);
// 130:04ca
for (int j = 0; j <= 3; j++) {
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[8];
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[8];
// 130:049e
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->drawRainRecycle(4);
- this->var_i16_192 = 0;
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[3];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->drawRainRecycle(5);
+ _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ drawRainRecycle(4);
+ var_i16_192 = 0;
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[3];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ drawRainRecycle(5);
// 130:0518
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[4];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->drawRainRecycle(5);
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[5];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->drawRainRecycle(5);
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[4];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ drawRainRecycle(5);
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[5];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ drawRainRecycle(5);
}
// 130:05b6
- this->var_i32_40 = this->arr_i32_41296[7];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
+ var_i32_40 = arr_i32_41296[7];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
}
// 130:05fc
- this->blitPageToScreen(0);
- this->drawRain();
- this->var_i32_2 = _toolbox->TickCount();
- this->drawRainRecycle(0xb4);
- this->var_i32_40 = this->arr_i32_41296[1];
+ blitPageToScreen(0);
+ drawRain();
+ var_i32_2 = _toolbox->TickCount();
+ drawRainRecycle(0xb4);
+ var_i32_40 = arr_i32_41296[1];
// scanline fade in priestess face
// 130:062c
int y = 0;
while (y != SCREEN_HEIGHT) {
- this->var_i16_5c.right = SCREEN_WIDTH;
- this->var_i32_2 = _toolbox->TickCount();
+ var_i16_5c.right = SCREEN_WIDTH;
+ var_i32_2 = _toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
- this->var_i16_192 = 1;
+ var_i16_192 = 1;
if (y < SCREEN_HEIGHT) {
y += 1;
}
- this->var_i16_5c.top = this->arr_i16_412ea[y];
- this->var_i16_5c.bottom = this->arr_i16_412ea[y] + 1;
+ var_i16_5c.top = arr_i16_412ea[y];
+ var_i16_5c.bottom = arr_i16_412ea[y] + 1;
// 130:068e
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->var_i16_5c, this->var_i16_5c, kSrcCopy, nullptr);
+ _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
}
// 130:06b0
- this->drawRainRecycle(1);
+ drawRainRecycle(1);
}
// lightning flash over priestess face
- this->var_i32_2 = _toolbox->TickCount();
- this->drawRainRecycle(0xa);
- this->blitPageToScreen(1);
+ var_i32_2 = _toolbox->TickCount();
+ drawRainRecycle(0xa);
+ blitPageToScreen(1);
// 130:06d4
for (int i = 1; i <= 4; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->InvertRect(this->arr_i16_1bc);
- this->drawRainRecycle(0x2);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(arr_i16_1bc);
+ drawRainRecycle(0x2);
}
// 130:0704
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->InvertRect(this->arr_i16_1bc);
- this->drawRainRecycle(0xf);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(arr_i16_1bc);
+ drawRainRecycle(0xf);
- this->var_i32_2 = _toolbox->TickCount();
- _toolbox->InvertRect(this->arr_i16_1bc);
- this->drawRainRecycle(0x78);
+ var_i32_2 = _toolbox->TickCount();
+ _toolbox->InvertRect(arr_i16_1bc);
+ drawRainRecycle(0x78);
// cut to shot of cliff
- this->blitPageToScreen(2);
+ blitPageToScreen(2);
// 130:0740
- this->drawRain();
- this->var_i32_2 = _toolbox->TickCount();
- this->drawRainRecycle(0xb4);
+ drawRain();
+ var_i32_2 = _toolbox->TickCount();
+ drawRainRecycle(0xb4);
- _toolbox->SetRect(this->arr_i32_1c4, 0, 0, 0x150, 0x96);
+ _toolbox->SetRect(arr_i32_1c4, 0, 0, 0x150, 0x96);
// priestess zap
// 130:0778
for (int j = 0; j <= 8; j++) {
for (int i = 3; i <= 5; i++) {
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i32_40 = this->arr_i32_41296[i];
- _toolbox->CopyBits(this->var_i32_40, this->var_i32_32, this->arr_i32_1c4, this->arr_i32_1c4, kSrcCopy, nullptr);
- this->drawRainRecycle(3);
+ var_i32_2 = _toolbox->TickCount();
+ var_i32_40 = arr_i32_41296[i];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ drawRainRecycle(3);
}
}
// cut to closeup of priestess mid-zap
// 130:07ec
- this->blitPageToScreen(6);
- _toolbox->SetRect(this->arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ blitPageToScreen(6);
+ _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i <= 0x2d; i++) {
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
// seizure warning
- _toolbox->InvertRect(this->arr_i16_1bc);
- this->delayFromMarker(1);
+ _toolbox->InvertRect(arr_i16_1bc);
+ delayFromMarker(1);
}
// 130:083c
// Draw the priestess silhouette
- _zbasic->picture(0, 0, this->arr_i32_0[0xd]);
+ _zbasic->picture(0, 0, _pics[0xd]);
// Image two in this sequence is a PICT that draws the words
// "...for no-one can undo the treachery I have inflicted upon the land!"
@@ -982,140 +989,140 @@ void FoolPrologue::prologueRun() {
// On original (i.e. slow) hardware, this image takes a while to render to the
// screen with the line tool and gives a cool fade-in effect, which we
// simulate here.
- this->arr_i32_0[0xe]->_opsPerTick = 32;
- _zbasic->picture(5, 0, this->arr_i32_0[0xe]);
+ _pics[0xe]->_opsPerTick = 32;
+ _zbasic->picture(5, 0, _pics[0xe]);
- _toolbox->ReleaseResource(this->arr_i32_0[0xd]);
- _toolbox->ReleaseResource(this->arr_i32_0[0xe]);
+ _toolbox->ReleaseResource(_pics[0xd]);
+ _toolbox->ReleaseResource(_pics[0xe]);
// start loading some new resources from the floppy disk into the screen buffers
- this->var_i32_2 = _toolbox->TickCount();
+ var_i32_2 = _toolbox->TickCount();
// 130:0890
_zbasic->restore(0);
- this->setPortBitsToPage(0);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0, 0x17, this->arr_i32_0[0xf]);
- _toolbox->ReleaseResource(this->arr_i32_0[0xf]);
+ setPortBitsToPage(0);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0, 0x17, _pics[0xf]);
+ _toolbox->ReleaseResource(_pics[0xf]);
// 130:08dc
- this->prologueRenderNextText();
- this->drawClickMessage();
- this->setPortBitsToPage(1);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0xf0, 0xba, this->arr_i32_0[0x10]);
- _toolbox->ReleaseResource(this->arr_i32_0[0x10]);
- this->prologueRenderNextText();
- this->drawClickMessage();
+ prologueRenderNextText();
+ drawClickMessage();
+ setPortBitsToPage(1);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0xf0, 0xba, _pics[0x10]);
+ _toolbox->ReleaseResource(_pics[0x10]);
+ prologueRenderNextText();
+ drawClickMessage();
// 130:0934
for (int i = 2; i <= 5; i++) {
- //_zbasic->blockMove(this->arr_i32_41296[1], this->arr_i32_41296[i], 0x5580);
- this->arr_i32_41296[i]->copyFrom(*this->arr_i32_41296[1]);
+ //_zbasic->blockMove(arr_i32_41296[1], arr_i32_41296[i], 0x5580);
+ arr_i32_41296[i]->copyFrom(*arr_i32_41296[1]);
}
// 130:0978
// draw the sun pulsing to pages 1-5
for (int i = 1; i <= 5; i++) {
- this->setPortBitsToPage(i);
- _toolbox->PenPat(this->arr_pat_194[1]);
- _toolbox->SetRect(this->arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
- _toolbox->FrameOval(this->arr_i16_1bc);
- _toolbox->PenPat(this->arr_pat_194[4]);
+ setPortBitsToPage(i);
+ _toolbox->PenPat(_patterns[1]);
+ _toolbox->SetRect(arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
+ _toolbox->FrameOval(arr_i16_1bc);
+ _toolbox->PenPat(_patterns[4]);
// 130:09d0
- _toolbox->InsetRect(this->arr_i16_1bc, -i, -i);
+ _toolbox->InsetRect(arr_i16_1bc, -i, -i);
for (int j = 2; j <= 0xd; j++) {
- _toolbox->InsetRect(this->arr_i16_1bc, -j, -j);
- _toolbox->FrameOval(this->arr_i16_1bc);
+ _toolbox->InsetRect(arr_i16_1bc, -j, -j);
+ _toolbox->FrameOval(arr_i16_1bc);
}
}
// 130:0a42
- this->setPortBitsToPage(6);
- this->fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(0x166, 0x77, this->arr_i32_0[0x11]);
- this->drawClickMessage();
- //_zbasic->blockMove(this->arr_i32_41296[6], this->arr_i32_41296[7], 0x5580);
- this->arr_i32_41296[7]->copyFrom(*this->arr_i32_41296[6]);
- this->prologueRenderNextText();
- _toolbox->ReleaseResource(this->arr_i32_0[0x11]);
- this->setPortBitsToPage(7);
+ setPortBitsToPage(6);
+ fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
+ _zbasic->picture(0x166, 0x77, _pics[0x11]);
+ drawClickMessage();
+ //_zbasic->blockMove(arr_i32_41296[6], arr_i32_41296[7], 0x5580);
+ arr_i32_41296[7]->copyFrom(*arr_i32_41296[6]);
+ prologueRenderNextText();
+ _toolbox->ReleaseResource(_pics[0x11]);
+ setPortBitsToPage(7);
// 130:0ac2
- _zbasic->picture(-0x14, -0x1e, this->arr_i32_0[0x12]);
- this->prologueRenderNextText();
- _toolbox->ReleaseResource(this->arr_i32_0[0x12]);
- this->setPortBitsToPage(8);
- //_zbasic->blockMove(this->arr_i32_41296[7], this->arr_i32_41296[8], 0x5580);
- this->arr_i32_41296[8]->copyFrom(*this->arr_i32_41296[7]);
- this->fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
- _zbasic->picture(0x16d, 0x80, this->arr_i32_0[0x48]);
- _toolbox->ReleaseResource(this->arr_i32_0[0x48]);
- _toolbox->SetPortBits(this->var_i32_32);
+ _zbasic->picture(-0x14, -0x1e, _pics[0x12]);
+ prologueRenderNextText();
+ _toolbox->ReleaseResource(_pics[0x12]);
+ setPortBitsToPage(8);
+ //_zbasic->blockMove(arr_i32_41296[7], arr_i32_41296[8], 0x5580);
+ arr_i32_41296[8]->copyFrom(*arr_i32_41296[7]);
+ fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
+ _zbasic->picture(0x16d, 0x80, _pics[0x48]);
+ _toolbox->ReleaseResource(_pics[0x48]);
+ _toolbox->SetPortBits(var_i32_32);
// 130:0b74
- this->delayFromMarker(0xd2);
- this->sub_128_e80();
+ delayFromMarker(0xd2);
+ sub_128_e80();
if (_quit)
return;
- this->scanlineTransition(1);
+ scanlineTransition(1);
// rectangle zoom into the clifftop scene
- this->delay(0x14);
- this->zoomTransition(0);
+ delay(0x14);
+ zoomTransition(0);
// stall until mouse click
- this->sub_128_e58();
+ sub_128_e58();
if (_quit)
return;
// 130:0b98
- this->var_i16_74 = 0;
- this->var_i16_192 = 1;
- while (this->var_ev_22.what != kMouseDown) {
+ var_i16_74 = 0;
+ var_i16_192 = 1;
+ while (var_ev_22.what != kMouseDown) {
// 130:0ba4
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i16_74 += this->var_i16_192;
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_74 += var_i16_192;
// 130:0bbe
- if (this->var_i16_74 == 0x5) {
- this->var_i16_192 = -1;
+ if (var_i16_74 == 0x5) {
+ var_i16_192 = -1;
}
- if (this->var_i16_74 == 1) {
- this->var_i16_192 = 1;
+ if (var_i16_74 == 1) {
+ var_i16_192 = 1;
}
- this->blitPageToScreen(this->var_i16_74);
- this->delayFromMarker(0xa);
+ blitPageToScreen(var_i16_74);
+ delayFromMarker(0xa);
// 130:0bee
- this->var_i16_1ba = _toolbox->GetNextEvent(2, this->var_ev_22);
+ var_i16_1ba = _toolbox->GetNextEvent(2, var_ev_22);
}
- while (!((this->var_ev_22.what == kNullEvent) && (this->var_ev_22.modifiers & kModMouseButtonUp))) {
+ while (!((var_ev_22.what == kNullEvent) && (var_ev_22.modifiers & kModMouseButtonUp))) {
// 130:0c0c
- this->var_i32_2 = _toolbox->TickCount();
- this->var_i16_74 += this->var_i16_192;
+ var_i32_2 = _toolbox->TickCount();
+ var_i16_74 += var_i16_192;
// 130:0c26
- if (this->var_i16_74 == 0x5) {
- this->var_i16_192 = -1;
+ if (var_i16_74 == 0x5) {
+ var_i16_192 = -1;
}
- if (this->var_i16_74 == 1) {
- this->var_i16_192 = 1;
+ if (var_i16_74 == 1) {
+ var_i16_192 = 1;
}
- this->blitPageToScreen(this->var_i16_74);
- this->delayFromMarker(0xa);
+ blitPageToScreen(var_i16_74);
+ delayFromMarker(0xa);
// 130:0c56
- this->var_i16_1ba = _toolbox->GetNextEvent(-1, this->var_ev_22);
- if (this->var_ev_22.what == kUpdateEvt) {
- this->sub_128_ed2();
+ var_i16_1ba = _toolbox->GetNextEvent(-1, var_ev_22);
+ if (var_ev_22.what == kUpdateEvt) {
+ sub_128_ed2();
}
- if (this->var_ev_22.what == kDiskEvt) {
- this->sub_128_ee0();
+ if (var_ev_22.what == kDiskEvt) {
+ sub_128_ee0();
}
}
// 130:0ca8
// "who dares to interrupt my errand"
- this->blitPageToScreen(0x6);
- this->sub_128_e58();
+ blitPageToScreen(0x6);
+ sub_128_e58();
if (_quit)
return;
- this->sub_128_50a(7, 0, SCREEN_WIDTH, 0);
- this->delay(0xa);
+ sub_128_50a(7, 0, SCREEN_WIDTH, 0);
+ delay(0xa);
// "I dare"
- this->blitPageToScreen(0x8);
- this->sub_128_e58();
+ blitPageToScreen(0x8);
+ sub_128_e58();
if (_quit)
return;
@@ -1125,35 +1132,35 @@ void FoolPrologue::prologueRun() {
// 130:0ce6
// JMP 1002
// _zbasic->pushOldCodeResource(0x82);
- //this->finaleRun();
+ //finaleRun();
}
void FoolPrologue::prologueBufferNextPicture() {
// 130:0cea
- this->var_i16_3d4 += 1;
- this->arr_i32_0[this->var_i16_3d4] = _toolbox->GetPicture(this->var_i16_3d4);
+ var_i16_3d4 += 1;
+ _pics[var_i16_3d4] = _toolbox->GetPicture(var_i16_3d4);
// 130:0d0a
- this->var_i16_3ce = this->var_i16_3d4 * 5 + 10;
- this->prologueDrawLoadingMsg();
+ var_i16_3ce = var_i16_3d4 * 5 + 10;
+ prologueDrawLoadingMsg();
}
void FoolPrologue::prologueDrawLoadingMsg() {
// FIXME: we don't share the menu surface here yet
return;
// 130:0d28
- _toolbox->SetPort(this->var_i32_c);
+ _toolbox->SetPort(var_i32_c);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// "loading prologue" message
- this->var_str_76 = _zbasic->str(19);
- this->var_str_76 += Common::U32String::format(" %d", this->var_i16_3ce);
- this->var_str_76 += _zbasic->str(20);
+ var_str_76 = _zbasic->str(19);
+ var_str_76 += Common::U32String::format(" %d", var_i16_3ce);
+ var_str_76 += _zbasic->str(20);
// 130:0d70
// white out the contents of the top menu bar.
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
- this->fillRect(0, 0x7, 0x13, this->var_i16_10 - 7, 0);
- this->drawTextCenterAlign(this->var_i16_10/2, 0xe);
+ fillRect(0, 0x7, 0x13, var_i16_10 - 7, 0);
+ drawTextCenter(var_str_76, var_i16_10/2, 0xe);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
_toolbox->Delay(0);
}
@@ -1161,53 +1168,53 @@ void FoolPrologue::drawRain() {
// 130:0db0
_zbasic->unk_20();
_toolbox->PenMode(kPatXor);
- this->var_i16_6 = 0x1;
- while (this->var_i16_6 <= 0xb5) {
+ var_i16_6 = 0x1;
+ while (var_i16_6 <= 0xb5) {
// 130:0dc0
- this->arr_i16_1e8[this->var_i16_6] = _zbasic->rndInt(0x264) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0xfb] = _zbasic->rndInt(0x1ba) - 0x64;
- this->arr_i16_1e8[this->var_i16_6 + 0x1f6] = _zbasic->rndInt(0x5) + 1;
- this->arr_i16_1e8[this->var_i16_6 + 0x2f1] = _zbasic->rndInt(0xa) + 0x19;
+ arr_i16_1e8[var_i16_6] = _zbasic->rndInt(0x264) - 0x64;
+ arr_i16_1e8[var_i16_6 + 0xfb] = _zbasic->rndInt(0x1ba) - 0x64;
+ arr_i16_1e8[var_i16_6 + 0x1f6] = _zbasic->rndInt(0x5) + 1;
+ arr_i16_1e8[var_i16_6 + 0x2f1] = _zbasic->rndInt(0xa) + 0x19;
// 130:0e68
- this->drawRainDrop();
- this->var_i16_6 += 1;
+ drawRainDrop();
+ var_i16_6 += 1;
}
- this->var_i16_6 = 1;
+ var_i16_6 = 1;
_toolbox->Delay(0);
}
void FoolPrologue::drawRainDrop() {
// 130:0e82
- _toolbox->MoveTo(this->arr_i16_1e8[this->var_i16_6], this->arr_i16_1e8[this->var_i16_6 + 0xfb]);
+ _toolbox->MoveTo(arr_i16_1e8[var_i16_6], arr_i16_1e8[var_i16_6 + 0xfb]);
// 130:0ec0
_toolbox->LineTo(
- this->arr_i16_1e8[this->var_i16_6] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6],
- this->arr_i16_1e8[this->var_i16_6 + 0xfb] + this->arr_i16_1e8[this->var_i16_6 + 0x1f6]
+ arr_i16_1e8[var_i16_6] + arr_i16_1e8[var_i16_6 + 0x1f6],
+ arr_i16_1e8[var_i16_6 + 0xfb] + arr_i16_1e8[var_i16_6 + 0x1f6]
);
}
void FoolPrologue::prologueRenderNextText() {
// 130:0f48
- this->var_i16_3d2 = _zbasic->readDataInt();
- for (int i = 1; i <= this->var_i16_3d2; i++) {
+ var_i16_3d2 = _zbasic->readDataInt();
+ for (int i = 1; i <= var_i16_3d2; i++) {
// 130:0f56
- this->var_i16_176 = _zbasic->readDataInt();
- this->var_i16_180 = _zbasic->readDataInt();
- this->var_str_76 = _zbasic->readDataStr();
- this->var_i16_1ba = 1;
+ var_i16_176 = _zbasic->readDataInt();
+ var_i16_180 = _zbasic->readDataInt();
+ var_str_76 = _zbasic->readDataStr();
+ var_i16_1ba = 1;
// JMP 0xfc2
- while (this->var_i16_1ba > 0) {
+ while (var_i16_1ba > 0) {
// 130:0f78
- this->var_i16_1ba = _zbasic->instr(this->var_i16_1ba, this->var_str_76, _zbasic->str(21));
- if (this->var_i16_1ba > 0) {
- this->var_str_76.replace(this->var_i16_1ba-1, 1, Common::U32String("\""));
+ var_i16_1ba = _zbasic->instr(var_i16_1ba, var_str_76, _zbasic->str(21));
+ if (var_i16_1ba > 0) {
+ var_str_76.replace(var_i16_1ba-1, 1, Common::U32String("\""));
}
}
// 130:0fc8
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->drawText(this->var_i16_176, this->var_i16_180);
+ drawText(var_str_76, var_i16_176, var_i16_180);
}
}
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 52b43e03bb4..6ed99468712 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -34,10 +34,10 @@ namespace Fool {
class ZBasic;
enum FoolPrologueFontID : uint16 {
- kPrologueFontFool = 250,
- // The original prologue uses 251 for Small,
- // however we need this to be the same as the main game.
- kPrologueFontSmall = 252,
+ // We subtract 10 from the original ID so they can coexist with
+ // the fonts from the main game.
+ kPrologueFontFool = 240,
+ kPrologueFontSmall = 241,
};
class FoolPrologue {
@@ -52,8 +52,8 @@ public:
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
void delayFromMarker(int16 numTicks); // sub_128_24a
- void drawTextRightAlign(int16 x, int16 y); // sub_128_26c
- void drawTextCenterAlign(int16 x, int16 y); // sub_128_2a6
+ void drawTextRight(const Common::U32String &str, int16 x, int16 y); // sub_128_26c
+ void drawTextCenter(const Common::U32String &str, int16 x, int16 y); // sub_128_2a6
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_2f0
void zoomClose(int16 patternID, PatternMode mode); // sub_128_354
void drawTreasurePhaseIn(int16 unk1); // sub_128_3ee
@@ -62,12 +62,12 @@ public:
void scanlineTransition(int16 patternID); // sub_128_64a
void zoomTransition(int16 screenPage); // sub_128_6e4
void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
- void drawText(int16_t x, int16_t y); // sub_128_a6c
+ void drawText(const Common::U32String &str, int16_t x, int16_t y); // sub_128_a6c
void drawRainRecycle(int16_t unk); // sub_128_a8c
void sub_128_c8a();
void shuffleScanlines(); // sub_128_ccc
void drawClickMessage(); // sub_128_de2
- void sub_128_e1c();
+ void drawClickMessageRightAlign(); // sub_128_e1c
void sub_128_e58();
void sub_128_e80();
void sub_128_ed2();
@@ -76,7 +76,6 @@ public:
void sub_129_004();
void sub_129_764();
- void sub_129_772();
void prologueRun(); // sub_130_004
void prologueBufferNextPicture(); // sub_130_cea
@@ -90,8 +89,7 @@ public:
void finaleDrawLoadingMsg(); // sub_131_4dc0
void finaleDrawFoolUhOh(); // sub_131_4e48
void finaleStartText(); // sub_131_4e98
- void sub_131_4f96(int16 offset);
-
+ void finaleDrawWind(int16 offset); // sub_131_4f96
void finaleCardRotate(); // sub_131_5038
private:
@@ -181,9 +179,9 @@ private:
int16 var_i16_3fc;
// picture resource handles
- PicHandle arr_i32_0[92] = { nullptr };
+ PicHandle _pics[92] = { nullptr }; // arr_i32_0
- Pattern arr_pat_194[5];
+ Pattern _patterns[5]; // arr_pat_194
Common::Rect arr_i16_1bc;
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index fa87583b503..b1eba60492f 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -192,7 +192,7 @@ void FoolGame::sentenceOnClick() {
return;
}
_zbasic->text(_fontChicago, 0xc, 0, kSrcBic);
- drawStringCenter(_zbasic->str(OFF(4)), 0x124); // click mouse to reset puzzle
+ drawTextCenter(_zbasic->str(OFF(4)), 0x124); // click mouse to reset puzzle
this->waitForMouseUp();
this->var_i16_1abc = 1;
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index c5edd285a4e..39e4d271be1 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -184,7 +184,7 @@ void FoolGame::straightPathDrawText() {
// 143:0864
straightPathClearText();
_zbasic->text(kFontLarge, 0x18, 0x18, kSrcBic);
- drawStringCenter(_activePuzzleBuffer, 0x148);
+ drawTextCenter(_activePuzzleBuffer, 0x148);
}
void FoolGame::straightPathClearText() {
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 01a673ea592..473fdf72e2f 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -160,9 +160,9 @@ void FoolGame::highPriestessRun() {
}
// 140:03f0
_zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
- this->drawStringCenter(_zbasic->str(OFF(3)), 0x96); // you cannot claim
- this->drawStringCenter(_zbasic->str(OFF(4)), 0xb9); // the book of thoth
- this->drawStringCenter(_zbasic->str(OFF(5)), 0xdc); // so easily
+ this->drawTextCenter(_zbasic->str(OFF(3)), 0x96); // you cannot claim
+ this->drawTextCenter(_zbasic->str(OFF(4)), 0xb9); // the book of thoth
+ this->drawTextCenter(_zbasic->str(OFF(5)), 0xdc); // so easily
_toolbox->SetPort(this->var_i32_0);
this->waitForClick();
}
@@ -186,8 +186,8 @@ void FoolGame::thoth99Enchantments() {
}
if (this->arr_i16_1eb8[0] == 0x63) {
_zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
- this->drawStringCenter(_zbasic->str(OFF(7)), 0xaf); // you dare to challenge
- this->drawStringCenter(_zbasic->str(OFF(8)), 0xd2); // the high priestess
+ this->drawTextCenter(_zbasic->str(OFF(7)), 0xaf); // you dare to challenge
+ this->drawTextCenter(_zbasic->str(OFF(8)), 0xd2); // the high priestess
this->delay(0xb4);
}
// 140:0532
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 43cf72a7707..b97d5bdc1ae 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -330,7 +330,7 @@ void FoolGame::wordSearchDrawFooter() {
// 131:0d22
this->fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->drawStringCenter(this->var_str_384, 0x152);
+ this->drawTextCenter(this->var_str_384, 0x152);
}
void FoolGame::wordSearchStoreState() {
diff --git a/engines/fool/toolbox.h b/engines/fool/toolbox.h
index 5a7be6dc568..f3b04bdff97 100644
--- a/engines/fool/toolbox.h
+++ b/engines/fool/toolbox.h
@@ -649,6 +649,15 @@ public:
// toolbox_resman.cpp
+ // PROCEDURE CloseResFile (refNum: INTEGER);
+ // Given the reference number of a resource file, CloseResFile does the following:
+ // - updates the resource file by calling the UpdateResFile procedure
+ // - for each resource in the resource file, releases the memory it occupies by calling the
+ // ReleaseResource procedure
+ // - releases the memory occupied by the resource map
+ // - closes the resource file
+ void CloseResFile(int16 refNum);
+
// FUNCTION CountResources (theType: ResType): Integer;
// Given a resource type, the CountResources function reads the resource maps in
// memory for all resource forks open to your application. It returns as its function result
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 75f07ddb29e..e748928c517 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -530,6 +530,9 @@ void Toolbox::InsetRect(Common::Rect &r, int16 dh, int16 dv) {
r.right -= dh;
r.top += dv;
r.bottom -= dv;
+ if ((r.width() < 0) || (r.height() < 0)) {
+ r = { 0, 0, 0, 0 };
+ }
}
void Toolbox::InvertOval(const Common::Rect &r) {
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index 781cd1dbcee..00739485840 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -40,6 +40,19 @@ void Toolbox::_loadFonts(int16 resID) {
}
}
+void Toolbox::CloseResFile(int16 refNum) {
+ if (_resMap.contains(refNum)) {
+ _resMap.erase(refNum);
+ }
+ for (int i = 0; i < (int)_resOrder.size(); i++) {
+ if (_resOrder[i] == refNum) {
+ _resOrder.remove_at(i);
+ i--;
+ }
+ }
+ // FIXME: free up all of the resource handles in _resInfo/_resPicts associated with this archive
+}
+
int16 Toolbox::CurResFile() {
// Return whatever the first resource file is
if (_resOrder.empty())
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 843114f3ee7..f08650fe5c2 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -608,11 +608,19 @@ int16 ZBasic::rndInt(int16 max) {
}
-const Common::U32String &ZBasic::str(size_t index) {
+const Common::U32String ZBasic::str(size_t index) {
+ if (_stringTable.size() < index) {
+ warning("ZBasic::str: no string %ld, returning empty", index);
+ return Common::U32String();
+ }
return *_stringTable[index]->data.str;
}
const Common::String ZBasic::strRaw(size_t index) {
+ if (_stringTable.size() < index) {
+ warning("ZBasic::strRaw: no string %ld, returning empty", index);
+ return Common::String();
+ }
return _stringTable[index]->data.str->encode(Common::kMacRoman);
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 3e983bb3474..2bb5310820c 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -284,7 +284,7 @@ public:
void writeFileDblInt(int16 fileNo, int32 data);
Common::U32String ucase(const Common::U32String &str);
- const Common::U32String &str(size_t index);
+ const Common::U32String str(size_t index);
const Common::String strRaw(size_t index);
@@ -309,6 +309,7 @@ public:
Common::U32String index(int16 table, int16 index);
Common::String indexRaw(int16 table, int16 index);
+ int16 getFileId() { return _fileId; }
void injectFOND(const byte *data, const size_t size, const Common::String &name);
void setMenuFont(uint16 font, uint16 size);
};
Commit: cdfb997431ca845ff3819b36cb295cf5aa49ff3d
https://github.com/scummvm/scummvm/commit/cdfb997431ca845ff3819b36cb295cf5aa49ff3d
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:32+02:00
Commit Message:
FOOL: More cleanup
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_wordsearch.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 3c0d03cd616..354ba35ff3c 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -192,7 +192,7 @@ void FoolGame::cardsDrawTable() {
this->drawTextCenter(_zbasic->str(OFF(1)), 0xd4); // or
_toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
_toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
this->drawTextCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
this->var_i16_2016 = 1;
this->var_i16_2010 = 1;
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index cecf0309e4d..f0bbe8dd77c 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -34,9 +34,9 @@ namespace Fool {
// run finale
void FoolPrologue::finaleRun() {
// 131:0004
- var_i16_3ce = 0x2d;
+ _prologueLoading = 45;
finaleDrawLoadingMsg();
- var_i32_3d6 = _toolbox->OpenPoly();
+ PolyHandle zapShape = _toolbox->OpenPoly(); // var_i32_3d6
_toolbox->MoveTo(0xc8, 0x8d);
_toolbox->LineTo(0x1df, 0xc8);
_toolbox->LineTo(0x1d2, 0x11b);
@@ -53,7 +53,7 @@ void FoolPrologue::finaleRun() {
// 131:009c
_pics[i] = _toolbox->GetPicture(i);
if ((i % 3) == 0) {
- var_i16_3ce += 5;
+ _prologueLoading += 5;
finaleDrawLoadingMsg();
}
}
@@ -84,13 +84,13 @@ void FoolPrologue::finaleRun() {
_toolbox->ReleaseResource(_pics[0x13]);
_toolbox->ReleaseResource(_pics[0x18]);
finaleStartText();
- var_i16_3ce = 0x4b;
+ _prologueLoading = 75;
finaleDrawLoadingMsg();
// 131:021e
for (int i = 0x20; i <= 0x2f; i++) {
_pics[i] = _toolbox->GetPicture(i);
if (i % 3) {
- var_i16_3ce += 5;
+ _prologueLoading += 5;
finaleDrawLoadingMsg();
}
}
@@ -99,19 +99,19 @@ void FoolPrologue::finaleRun() {
shuffleScanlines();
var_i32_1a6 = _zbasic->mem(-1);
_toolbox->SetPortBits(var_i32_32);
- if (!((var_i16_10 == SCREEN_WIDTH) && (var_i16_12 == SCREEN_HEIGHT))) {
+ if (!((_windowWidth == SCREEN_WIDTH) && (_windowHeight == SCREEN_HEIGHT))) {
// 131:02ac
- fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
+ fillRect(0, 0, MENU_HEIGHT, SCREEN_WIDTH, 1);
} else {
- _toolbox->SetPort(var_i32_c);
- fillRect(0, 0, 0x14, var_i16_10, 2);
+ _toolbox->SetPort(_grafPtrMenu);
+ fillRect(0, 0, MENU_HEIGHT, _windowWidth, 2);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(var_i32_8);
+ _toolbox->SetPort(_grafPtrWindow);
}
// 131:02ec
delay(0x3c);
zoomTransition(0x5);
- sub_128_e58();
+ waitForClick();
if (_quit)
return;
@@ -119,7 +119,6 @@ void FoolPrologue::finaleRun() {
finaleStartText();
_zbasic->restore(0x4c);
for (int j = 1; j <= 0xe; j++) {
- var_i16_3da = 1;
// 131:030c
var_i16_18e = _zbasic->readDataInt();
@@ -170,7 +169,7 @@ void FoolPrologue::finaleRun() {
}
// 131:04da
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[5];
_toolbox->CopyBits(var_i32_32, var_i32_40, var_i16_38, var_i16_38, kSrcCopy, nullptr);
@@ -203,15 +202,15 @@ void FoolPrologue::finaleRun() {
_zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, arr_i32_3bca4);
delayFromMarker(0x3c);
fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- sub_128_50a(0x6, 0, SCREEN_WIDTH, 0x3);
+ scanlineBlitPageToScreen(0x6, 0, SCREEN_WIDTH, 0x3);
finaleDrawFoolUhOh();
// 131:06aa
- sub_128_50a(5, 0, SCREEN_WIDTH, 2);
- sub_128_50a(7, 0, SCREEN_WIDTH, 2);
- sub_128_50a(8, 0, SCREEN_WIDTH, 1);
+ scanlineBlitPageToScreen(5, 0, SCREEN_WIDTH, 2);
+ scanlineBlitPageToScreen(7, 0, SCREEN_WIDTH, 2);
+ scanlineBlitPageToScreen(8, 0, SCREEN_WIDTH, 1);
fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
- sub_128_50a(0x9, 0, SCREEN_WIDTH, 1);
+ scanlineBlitPageToScreen(0x9, 0, SCREEN_WIDTH, 1);
// the wind picks up
_toolbox->PenNormal();
@@ -219,18 +218,18 @@ void FoolPrologue::finaleRun() {
_zbasic->unk_20();
// 131:0730
- var_i16_3dc = 0;
+ int16 windHeight = 0; // windHeight
var_i16_18e = 0;
for (int j = 1; j <= 0x63; j++) {
- if (var_i16_3dc < SCREEN_HEIGHT) {
+ if (windHeight < SCREEN_HEIGHT) {
// 131:074e
- var_i16_3dc += _zbasic->maybe() ? 0x4 : 0x5;
+ windHeight += _zbasic->maybe() ? 0x4 : 0x5;
}
if (var_i16_18e < 0x41) {
// 131:0770
var_i16_18e += 1;
arr_i16_1e8[var_i16_18e] = _zbasic->rndInt(32);
- arr_i16_1e8[var_i16_18e+0xfb] = _zbasic->rndInt(var_i16_3dc);
+ arr_i16_1e8[var_i16_18e+0xfb] = _zbasic->rndInt(windHeight);
arr_i16_1e8[var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
finaleDrawWind(var_i16_18e);
}
@@ -242,7 +241,7 @@ void FoolPrologue::finaleRun() {
// 131:0870
if (arr_i16_1e8[i] > SCREEN_WIDTH) {
arr_i16_1e8[i] = 1;
- arr_i16_1e8[0xfb+i] = _zbasic->rndInt(var_i16_3dc);
+ arr_i16_1e8[0xfb+i] = _zbasic->rndInt(windHeight);
arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
}
@@ -263,23 +262,23 @@ void FoolPrologue::finaleRun() {
// 131:099c
// zzzzap
- _toolbox->PaintPoly(var_i32_3d6);
+ _toolbox->PaintPoly(zapShape);
for (int i = 0; i <= 0x21; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InvertRect(arr_i16_1bc);
delayFromMarker(0);
}
// 131:09d2
- sub_128_800(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- sub_128_800(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- sub_128_800(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
- sub_128_800(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ zoomFlash(0xc1, 0x1bc, 0x11b, 0x1f2, 0x0, 0x0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ zoomFlash(0x156, 0, 0x156, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ zoomFlash(0, 0, 0, 0, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
+ zoomFlash(0, SCREEN_WIDTH, 0, SCREEN_WIDTH, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0x21);
// 131:0a7a
// horrible flashing fool duplication spree
for (int i = 1; i <= 0x63; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i16_74 = _zbasic->rndInt(0x1ca);
var_i16_192 = _zbasic->rndInt(0xfc);
_zbasic->put(var_i16_74, var_i16_192, arr_i32_3bca4, (i % 2) ? kSrcCopy : kNotSrcCopy);
@@ -292,10 +291,10 @@ void FoolPrologue::finaleRun() {
// 131:0aec
// scrumble the contents of the screen for a few seconds
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
// 131:0af6
- while (_toolbox->TickCount() < (var_i32_2 + 0x78)) {
+ while (_toolbox->TickCount() < (_tickMarker + 0x78)) {
var_i16_74 = _zbasic->rndInt(0x1ca);
var_i16_192 = _zbasic->rndInt(0xfc);
_zbasic->get(var_i16_74, var_i16_192, var_i16_74 + 0x36, var_i16_192 + 0x5a, arr_i32_3bca4);
@@ -309,21 +308,21 @@ void FoolPrologue::finaleRun() {
// 131:0bb0
// fade in to seascape
- sub_128_50a(4, 0, SCREEN_WIDTH, 3);
+ scanlineBlitPageToScreen(4, 0, SCREEN_WIDTH, 3);
setPortBitsToPage(5);
copyScreenToPage(5);
// fade in the fool
_zbasic->picture(0x198, 0x102, _pics[0x25]);
_toolbox->SetPortBits(var_i32_32);
delay(0x3c);
- sub_128_50a(5, 0, SCREEN_WIDTH, 0);
+ scanlineBlitPageToScreen(5, 0, SCREEN_WIDTH, 0);
// fool looks around
_zbasic->picture(0x197, 0x101, _pics[0x26]);
// 131:0c36
- var_i32_2 = _toolbox->TickCount();
- _toolbox->KillPoly(var_i32_3d6);
+ _tickMarker = _toolbox->TickCount();
+ _toolbox->KillPoly(zapShape);
for (int i = 0x1c; i < 0x1e; i++) {
_toolbox->ReleaseResource(_pics[i]);
}
@@ -331,7 +330,6 @@ void FoolPrologue::finaleRun() {
// 131:0c6c
// high priestess becomes giant
for (int i = 0x6; i <= 0xa; i++) {
- //_zbasic->blockMove(*arr_i32_41296[5], arr_i32_41296[i], 0x5580);
arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
}
setPortBitsToPage(0x6);
@@ -354,7 +352,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x198, 0x102, _pics[0x25]);
for (int i = 0x6; i <= 0xa; i++) {
delay(0xf);
- sub_128_50a(i, 0, SCREEN_WIDTH, 1);
+ scanlineBlitPageToScreen(i, 0, SCREEN_WIDTH, 1);
}
_zbasic->picture(0x191, 0x102, _pics[0x27]);
delay(0x3c);
@@ -362,15 +360,15 @@ void FoolPrologue::finaleRun() {
// 131:0e08
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// Are you still angry with me?
+ Common::U32String dialog = Common::U32String::format("\"%s\"", _zbasic->str(23).encode().c_str());
drawText(
- Common::U32String::format("\"%s\"", _zbasic->str(23).encode().c_str()),
- 0x1f4 - _toolbox->StringWidth(var_str_76),
+ dialog,
+ 0x1f4 - _toolbox->StringWidth(dialog),
0xd2
);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
// 131:0e76
- //_zbasic->blockMove(arr_i32_41296[4], arr_i32_41296[5], 0x5580);
arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
setPortBitsToPage(0x5);
_zbasic->picture(0x73, 0x28, _pics[0x24]);
@@ -382,11 +380,9 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0x7);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0x118, 0x19, _pics[0x2a]); // wadjet eye
- //_zbasic->blockMove(arr_i32_41296[5], arr_i32_41296[8], 0x5580);
arr_i32_41296[8]->copyFrom(*arr_i32_41296[5]);
setPortBitsToPage(0x8);
_zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
- //_zbasic->blockMove(arr_i32_41296[4], arr_i32_41296[9], 0x5580);
arr_i32_41296[9]->copyFrom(*arr_i32_41296[4]);
setPortBitsToPage(0x9);
_zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
@@ -399,7 +395,7 @@ void FoolPrologue::finaleRun() {
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0x78);
fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
- sub_128_50a(0x5, 0x64, 0x19c, 0x0);
+ scanlineBlitPageToScreen(0x5, 0x64, 0x19c, 0x0);
delay(0x28);
var_i16_5c.left = 0x118;
@@ -412,8 +408,7 @@ void FoolPrologue::finaleRun() {
// wadjet eye appears from horizon
for (int i = 0xdc; i >= 0x19; i -= 5) {
// 131:10de
- var_i32_2 = _toolbox->TickCount();
- //_zbasic->blockMove(arr_i32_41296[5], *var_i32_4e, 0x5580);
+ _tickMarker = _toolbox->TickCount();
var_i32_4e->copyFrom(*arr_i32_41296[5]);
var_i16_64.top = i;
var_i16_5c.bottom = 0x19 + (0xdf - i);
@@ -439,7 +434,7 @@ void FoolPrologue::finaleRun() {
// 131:1208
for (int i = 0; i <= 0x1b8; i += 6) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->MoveTo(0x172, 0x33);
_toolbox->LineTo(i, 0x14a);
if (i == 0x4e) {
@@ -454,17 +449,17 @@ void FoolPrologue::finaleRun() {
}
// 131:12cc
- sub_128_800(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
+ zoomFlash(0x14a, 0x1b8, 0x14a, 0x1b8, 0xc0, 0x18f, 0x156, 0x1e6, 0x10);
// get turned into card
- sub_128_50a(0x5, 0x12c, SCREEN_WIDTH, 0x1);
+ scanlineBlitPageToScreen(0x5, 0x12c, SCREEN_WIDTH, 0x1);
delay(0xec);
// fade out eye, then priestess, then seascape
for (int i = 8; i <= 0xa; i++) {
- sub_128_50a(i, 0, SCREEN_WIDTH, 1);
+ scanlineBlitPageToScreen(i, 0, SCREEN_WIDTH, 1);
}
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
setPortBitsToPage(0x5);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
@@ -479,7 +474,7 @@ void FoolPrologue::finaleRun() {
// 131:13b8
// move the fool card up the screen
for (int i = 0xc0; i >= 0x15; i--) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i16_5c.top = i;
var_i16_5c.bottom = var_i16_5c.top + 0x96;
var_i16_64.top = i - 1;
@@ -507,25 +502,24 @@ void FoolPrologue::finaleRun() {
var_i16_5c.right = 0x32;
var_i16_5c.top = 0;
var_i16_5c.bottom = 0x32;
- var_i16_3e0 = 0x64;
+ int16 bindleHeight = 0x64;
// 131:14d8
// fool drops bindle
var_i32_40 = arr_i32_41296[5];
_toolbox->SetPortBits(var_i32_4e);
for (int i = 1; i <= 0xf; i++) {
- var_i32_2 = _toolbox->TickCount();
- //_zbasic->blockMove(arr_i32_41296[6], *var_i32_4e, 0x5580);
+ _tickMarker = _toolbox->TickCount();
var_i32_4e->copyFrom(*arr_i32_41296[6]);
- var_i16_3e0 += 5 + i*2;
+ bindleHeight += 5 + i*2;
var_i16_64.left = 0x1e0;
var_i16_64.right = var_i16_64.left + 0x32;
- var_i16_64.top = var_i16_3e0;
+ var_i16_64.top = bindleHeight;
var_i16_64.bottom = var_i16_64.top + 0x32;
_toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcXor, nullptr);
// 131:1582
- _toolbox->MoveTo(0x190 - i, var_i16_3e0 - 0x1e + i*3);
- _toolbox->LineTo(0x1f4, var_i16_3e0 + 0xa - i);
+ _toolbox->MoveTo(0x190 - i, bindleHeight - 0x1e + i*3);
+ _toolbox->LineTo(0x1f4, bindleHeight + 0xa - i);
_toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_6c, var_i16_6c, kSrcCopy, nullptr);
delayFromMarker(0x1);
}
@@ -537,7 +531,7 @@ void FoolPrologue::finaleRun() {
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= 0xfa; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
if (j == 0) {
arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
@@ -552,7 +546,7 @@ void FoolPrologue::finaleRun() {
}
}
// 131:1748
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int i = 0x25; i <= 0x2f; i++) {
_toolbox->ReleaseResource(_pics[i]);
}
@@ -563,7 +557,7 @@ void FoolPrologue::finaleRun() {
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(25).encode().c_str()), 0x181, 0x3c);
// 131:17c8
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 0x30; i <= 0x31; i++) {
_pics[i] = _toolbox->GetPicture(i);
}
@@ -594,7 +588,7 @@ void FoolPrologue::finaleRun() {
}
// 131:19be
drawClickMessageRightAlign();
- sub_128_e58();
+ waitForClick();
drawClickMessageRightAlign();
fillRect(0, 0, 0x96, 0x18b, 2);
_zbasic->picture(0x193, 0x2d, _pics[0x32]);
@@ -666,7 +660,7 @@ void FoolPrologue::finaleRun() {
_toolbox->InvertOval(arr_i16_1bc);
_toolbox->SetPortBits(var_i32_32);
drawClickMessageRightAlign();
- sub_128_e58();
+ waitForClick();
// 131:1e18
// card gets vivisected
@@ -693,7 +687,7 @@ void FoolPrologue::finaleRun() {
if (j < 9) {
_toolbox->InvertRect(var_i16_38);
}
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
_zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
arr_i16_1e8[i] -= arr_i16_1e8[0xfb + i]*j;
@@ -704,7 +698,7 @@ void FoolPrologue::finaleRun() {
delayFromMarker(2);
}
for (int16 j = 1; j <= 0xf; j++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
_zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
arr_i16_1e8[i] += arr_i16_1e8[0xfb + i]*j;
@@ -716,17 +710,17 @@ void FoolPrologue::finaleRun() {
// 131:21e0
_zbasic->picture(0x193, 0x2d, _pics[0x33]);
var_i16_1b6 = 0x14;
- var_str_76 = _zbasic->str(33); // be content that you still live
+ dialog = _zbasic->str(33); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
var_i16_1b6 += i;
- drawText(var_str_76, 5 + i*2, var_i16_1b6);
+ drawText(dialog, 5 + i*2, var_i16_1b6);
delayFromMarker(3);
}
// 131:2282
_zbasic->picture(0x193, 0x2d, _pics[0x34]);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
setPortBitsToPage(4);
_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
_toolbox->InvertRect(arr_i16_1bc);
@@ -743,7 +737,7 @@ void FoolPrologue::finaleRun() {
_toolbox->PenNormal();
var_i16_3e6 = 0x17c;
for (int16 j = 0; j <= 0x14a; j++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
if (j > 0xb4) {
var_i16_3e6 = SCREEN_WIDTH;
}
@@ -769,7 +763,7 @@ void FoolPrologue::finaleRun() {
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(34).encode().c_str()), 0x181, 0x3c);
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(35).encode().c_str()), 0x181, 0x4d);
drawClickMessageRightAlign();
- sub_128_e58();
+ waitForClick();
_zbasic->picture(0x193, 0x2d, _pics[0x36]);
// 131:24da
@@ -779,7 +773,7 @@ void FoolPrologue::finaleRun() {
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(36).encode().c_str()), 0x181, 0x3c);
drawTextRight(_zbasic->str(37), 0x181, 0x4d);
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(38).encode().c_str()), 0x181, 0x5e);
- sub_128_e58();
+ waitForClick();
// 131:258a
var_i32_40 = arr_i32_41296[5];
@@ -803,7 +797,7 @@ void FoolPrologue::finaleRun() {
_toolbox->Delay(0);
// 131:2720
for (int i = 1; i <= 3; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InsetRect(arr_i16_1bc, -1, -1);
_toolbox->InsetRect(arr_i32_1c4, -1, -1);
_toolbox->FillOval(arr_i16_1bc, _patterns[0]);
@@ -817,32 +811,32 @@ void FoolPrologue::finaleRun() {
_toolbox->PenSize(3, 3);
var_i16_18e = 10;
for (int16 i = 355; i >= 180; i -= 5) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->FrameArc(arr_i16_1bc, i, var_i16_18e);
var_i16_18e += 10;
delayFromMarker(1);
}
// 131:281c
for (int16 i = 0; i <= 6; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->FrameOval(arr_i16_1bc);
delayFromMarker(1);
}
// 131:284c
for (int16 i = 5; i <= 0xa; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
blitPageToScreen(i);
delayFromMarker(1);
}
// 131:2878
_toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x1e; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InvertRect(arr_i16_1bc);
delayFromMarker(1);
}
// 131:28c2
- sub_128_50a(0xb, 0, SCREEN_WIDTH, 1);
+ scanlineBlitPageToScreen(0xb, 0, SCREEN_WIDTH, 1);
arr_i32_41296[5]->copyFrom(*arr_i32_41296[11]);
setPortBitsToPage(5);
_zbasic->picture(0x16, 0xde, _pics[0x4b]);
@@ -857,7 +851,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x2, 0x50, _pics[0x52]);
_toolbox->SetPortBits(var_i32_32);
delay(0x1e);
- sub_128_50a(0x6, 0, SCREEN_WIDTH, 1);
+ scanlineBlitPageToScreen(0x6, 0, SCREEN_WIDTH, 1);
delay(0x1e);
blitPageToScreen(7);
delay(0x48);
@@ -868,7 +862,7 @@ void FoolPrologue::finaleRun() {
// now what have I gotten myself into?
drawText(Common::U32String::format("\"%s", _zbasic->str(39).encode().c_str()), 0x3c, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(40).encode().c_str()), 0x46, 0x3e);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 6; i <= 0xa; i++) {
arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
}
@@ -903,14 +897,14 @@ void FoolPrologue::finaleRun() {
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0xd2);
drawClickMessageRightAlign();
- sub_128_e58();
+ waitForClick();
drawClickMessageRightAlign();
blitPageToScreen(6);
delay(3);
blitPageToScreen(7);
delay(3);
blitPageToScreen(8);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
// 131:2d3a
for (int16 i = 0x30; i <= 0x36; i++) {
_toolbox->ReleaseResource(_pics[i]);
@@ -935,7 +929,7 @@ void FoolPrologue::finaleRun() {
blitPageToScreen(0x9);
// 131:2e58
for (int16 i = 1; i <= 0xe; i++) {
- var_str_76 = _zbasic->midStr(_zbasic->str(45), i, 1);
+ dialog = _zbasic->midStr(_zbasic->str(45), i, 1);
for (int16 l = 0; l <= 1; l++) {
var_i16_18e = 0x21;
for (int16 j = 0; j <= 1; j++) {
@@ -945,7 +939,7 @@ void FoolPrologue::finaleRun() {
// 131:2f66
if (l == 0) {
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcOr);
- drawText(var_str_76, arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ drawText(dialog, arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
}
// 131:2fc4
_zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcXor);
@@ -955,17 +949,17 @@ void FoolPrologue::finaleRun() {
arr_f64_41bbe[1] += arr_f64_41bbe[1 + 2];
int16 y = (int16)arr_f64_41bbe[1];
// 131:3078
- drawText(var_str_76, x, y);
+ drawText(dialog, x, y);
}
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- drawText(var_str_76, arr_i16_1e8[0x1f6 + i], arr_i16_1e8[0x2f1 + i]);
+ drawText(dialog, arr_i16_1e8[0x1f6 + i], arr_i16_1e8[0x2f1 + i]);
delay(1);
}
}
// 131:3130
delay(0x1e);
blitPageToScreen(0xa);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
copyScreenToPage(0xa);
setPortBitsToPage(0xa);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
@@ -1006,8 +1000,8 @@ void FoolPrologue::finaleRun() {
drawText(Common::U32String::format("\"%s", _zbasic->str(48).encode().c_str()), 0x32, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(49).encode().c_str()), 0x3c, 0x3e);
// 131:341c
- sub_128_50a(0xb, 0xb0, 0x1f6, 0);
- sub_128_50a(0x5, 0xb0, 0x1f6, 0);
+ scanlineBlitPageToScreen(0xb, 0xb0, 0x1f6, 0);
+ scanlineBlitPageToScreen(0x5, 0xb0, 0x1f6, 0);
delay(0xa);
for (int16 i = 5; i <= 9; i++) {
blitPageToScreen(i);
@@ -1024,32 +1018,32 @@ void FoolPrologue::finaleRun() {
}
// 131:34dc
blitPageToScreen(4);
- var_i32_2 = _toolbox->TickCount();
- var_i16_3ec = 0x8c;
- var_i16_3ee = 0x3c;
+ _tickMarker = _toolbox->TickCount();
+ int16 wadjetX = 0x8c;
+ int16 wadjetY = 0x3c;
setPortBitsToPage(9);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(var_i16_3ec, var_i16_3ee, _pics[0x29]); // wadjet eye mask
+ _zbasic->picture(wadjetX, wadjetY, _pics[0x29]); // wadjet eye mask
setPortBitsToPage(0xa);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
- _zbasic->picture(var_i16_3ec, var_i16_3ee, _pics[0x2a]); // wadjet eye
+ _zbasic->picture(wadjetX, wadjetY, _pics[0x2a]); // wadjet eye
_toolbox->SetPortBits(var_i32_32);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// the book of thoth?
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(50).encode().c_str()), 0x1a4, 0x2d);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
setPortBitsToPage(5);
_zbasic->picture(0x171, 0xb, _pics[0x5b]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// here is the book of thoth
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(51).encode().c_str()), 0x1a4, 0x2d);
- var_i16_5c.top = var_i16_3ee;
- var_i16_5c.left = var_i16_3ec;
+ var_i16_5c.top = wadjetY;
+ var_i16_5c.left = wadjetX;
// 131:366e
- var_i16_5c.bottom = var_i16_3ee + 100;
- var_i16_5c.right = var_i16_3ec + 200;
+ var_i16_5c.bottom = wadjetY + 100;
+ var_i16_5c.right = wadjetX + 200;
var_i32_4e->copyFrom(*arr_i32_41296[4]);
var_i32_40 = arr_i32_41296[9];
_toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_5c, kSrcBic, 0);
@@ -1083,17 +1077,17 @@ void FoolPrologue::finaleRun() {
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(55).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0x5);
- var_i16_5c.left = var_i16_3ec;
- var_i16_5c.right = var_i16_3ec + 0xc8;
- var_i16_64.left = var_i16_3ec;
- var_i16_64.right = var_i16_3ec + 0xc8;
+ var_i16_5c.left = wadjetX;
+ var_i16_5c.right = wadjetX + 0xc8;
+ var_i16_64.left = wadjetX;
+ var_i16_64.right = wadjetX + 0xc8;
var_i16_5c.top = 0x19;
var_i16_64.bottom = 0xdf;
// 131:38f4
// wadjet eye rises over horizon
for (int16 i = 0xdc; i >= 0x19; i -= 5) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_4e->copyFrom(*arr_i32_41296[5]);
var_i16_64.top = i;
var_i16_5c.bottom = 0x19 + 0xdf - i;
@@ -1109,7 +1103,7 @@ void FoolPrologue::finaleRun() {
}
// 131:39ba
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->ReleaseResource(_pics[0x29]);
_toolbox->ReleaseResource(_pics[0x2a]);
@@ -1129,7 +1123,7 @@ void FoolPrologue::finaleRun() {
delay(0xf);
blitPageToScreen(0x7);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 0x39; i <= 0x45; i++) {
_pics[i] = _toolbox->GetPicture(i);
@@ -1143,7 +1137,7 @@ void FoolPrologue::finaleRun() {
delay(0xf);
blitPageToScreen(0xa);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
setPortBitsToPage(0x7);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0, 0xaa, _pics[0x39]); // treasure pile
@@ -1160,7 +1154,7 @@ void FoolPrologue::finaleRun() {
for (int16 k = 0; k <= 8; k++) {
for (int16 j = 1; j <= 8; j++) {
_toolbox->SetRect(arr_i16_1bc, 0xe9, 0x58, 0xe9, 0x58);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 1; i <= j; i++) {
_toolbox->InsetRect(arr_i16_1bc, -1, -1);
_toolbox->InvertOval(arr_i16_1bc);
@@ -1184,7 +1178,7 @@ void FoolPrologue::finaleRun() {
// 131:3db8
if (k < 8) {
for (int16 j = 8; j >= 1; j--) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 1; i <= j; i++) {
_toolbox->InsetRect(arr_i16_1bc, -1, -1);
_toolbox->InvertOval(arr_i16_1bc);
@@ -1202,42 +1196,42 @@ void FoolPrologue::finaleRun() {
_toolbox->PenPat(_patterns[2]);
_toolbox->PenSize(5, 5);
_toolbox->PenMode(kPatXor);
- var_i16_176 = 0xe5;
- var_i16_180 = 0x58;
+ int16 beamX = 0xe5;
+ int16 beamY = 0x58;
for (int16 i = 1; i <= 0x13; i++) {
- var_i32_2 = _toolbox->TickCount();
- var_i16_176 -= i;
- var_i16_180 += (int16)(i*0.9f);
+ _tickMarker = _toolbox->TickCount();
+ beamX -= i;
+ beamY += (int16)(i*0.9f);
_toolbox->MoveTo(0xe5, 0x58);
- _toolbox->LineTo(var_i16_176, var_i16_180);
+ _toolbox->LineTo(beamX, beamY);
delayFromMarker(0);
_toolbox->MoveTo(0xe5, 0x58);
- _toolbox->LineTo(var_i16_176, var_i16_180);
+ _toolbox->LineTo(beamX, beamY);
}
_toolbox->MoveTo(0xe5, 0x58);
_toolbox->LineTo(0x34, 0xf2);
- var_i16_176 = 0x34;
- var_i16_180 = 0xf2;
+ beamX = 0x34;
+ beamY = 0xf2;
for (int16 i = 5; i <= 0x1c; i++) {
// 131:3f4c
- var_i32_2 = _toolbox->TickCount();
- var_i16_176 += i;
- var_i16_180 -= (int16)(i*0.5f);
+ _tickMarker = _toolbox->TickCount();
+ beamX += i;
+ beamY -= (int16)(i*0.5f);
_toolbox->MoveTo(0x34, 0xf2);
- _toolbox->LineTo(var_i16_176, var_i16_180);
+ _toolbox->LineTo(beamX, beamY);
delayFromMarker(0);
_toolbox->MoveTo(0x34, 0xf2);
- _toolbox->LineTo(var_i16_176, var_i16_180);
+ _toolbox->LineTo(beamX, beamY);
}
// 131:3fd8
_toolbox->MoveTo(0x34, 0xf2);
- _toolbox->LineTo(var_i16_176, var_i16_180);
+ _toolbox->LineTo(beamX, beamY);
arr_rect_41af4.top = 0;
arr_rect_41af4.left = 0;
arr_rect_41af4.bottom = SCREEN_HEIGHT;
arr_rect_41af4.right = SCREEN_WIDTH;
for (int16 i = 0x1e; i >= 0xa; i -= 5) {
- sub_128_800(var_i16_180 - 3, var_i16_176 - 3, var_i16_180 + 3, var_i16_176 + 3, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, i);
+ zoomFlash(beamY - 3, beamX - 3, beamY + 3, beamX + 3, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, i);
}
for (int16 k = 7; k <= 8; k++) {
@@ -1246,32 +1240,34 @@ void FoolPrologue::finaleRun() {
// 131:40a2
var_i32_40 = arr_i32_41296[k];
- arr_rect_41af4.top = var_i16_180 - 3;
- arr_rect_41af4.left = var_i16_176 - 3;
- arr_rect_41af4.bottom = var_i16_180 + 3;
- arr_rect_41af4.right = var_i16_176 + 3;
- arr_i16_41afc.top = 0;
- arr_i16_41afc.left = 0;
- arr_i16_41afc.bottom = SCREEN_HEIGHT;
- arr_i16_41afc.right = SCREEN_WIDTH;
+ Common::Rect start; // arr_rect_41af4
+ Common::Rect end; // arr_rect_41afc
+ start.top = beamY - 3;
+ start.left = beamX - 3;
+ start.bottom = beamY + 3;
+ start.right = beamX + 3;
+ end.top = 0;
+ end.left = 0;
+ end.bottom = SCREEN_HEIGHT;
+ end.right = SCREEN_WIDTH;
// unroll loop
- arr_f64_41bbe[0] = (double)arr_rect_41af4.top;
- arr_f64_41bbe[0+4] = (double)(arr_i16_41afc.top - arr_rect_41af4.top)/segs;
- arr_f64_41bbe[1] = (double)arr_rect_41af4.left;
- arr_f64_41bbe[1+4] = (double)(arr_i16_41afc.left - arr_rect_41af4.left)/segs;
- arr_f64_41bbe[2] = (double)arr_rect_41af4.bottom;
- arr_f64_41bbe[2+4] = (double)(arr_i16_41afc.bottom - arr_rect_41af4.bottom)/segs;
- arr_f64_41bbe[3] = (double)arr_rect_41af4.right;
- arr_f64_41bbe[3+4] = (double)(arr_i16_41afc.right - arr_rect_41af4.right)/segs;
+ arr_f64_41bbe[0] = (double)start.top;
+ arr_f64_41bbe[0+4] = (double)(end.top - start.top)/segs;
+ arr_f64_41bbe[1] = (double)start.left;
+ arr_f64_41bbe[1+4] = (double)(end.left - start.left)/segs;
+ arr_f64_41bbe[2] = (double)start.bottom;
+ arr_f64_41bbe[2+4] = (double)(end.bottom - start.bottom)/segs;
+ arr_f64_41bbe[3] = (double)start.right;
+ arr_f64_41bbe[3+4] = (double)(end.right - start.right)/segs;
// 131:420a
- var_i16_5c = arr_rect_41af4;
+ var_i16_5c = start;
// 131:425a
_toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, 0);
for (int16 j = 1; j <= segs - 1; j++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 i = 0; i <= 3; i++) {
arr_f64_41bbe[i] += arr_f64_41bbe[i+4];
}
@@ -1292,12 +1288,12 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x1b3, 0xb5, _pics[0x3b]);
arr_i16_41af4[0] = 0;
arr_i16_41af4[1] = 0;
- arr_i16_41af4[2] = 0x200;
+ arr_i16_41af4[2] = SCREEN_WIDTH;
arr_i16_41af4[3] = 0;
- arr_i16_41af4[4] = 0x200;
- arr_i16_41af4[5] = 0x156;
+ arr_i16_41af4[4] = SCREEN_WIDTH;
+ arr_i16_41af4[5] = SCREEN_HEIGHT;
arr_i16_41af4[6] = 0;
- arr_i16_41af4[7] = 0x156;
+ arr_i16_41af4[7] = SCREEN_HEIGHT;
arr_i16_41af4[8] = 0xb5;
arr_i16_41af4[9] = 0x22;
arr_i16_41af4[10] = 0xb5;
@@ -1311,7 +1307,7 @@ void FoolPrologue::finaleRun() {
finaleCardRotate();
// 131:44b8
- sub_128_50a(0x9, 0, SCREEN_WIDTH, 0);
+ scanlineBlitPageToScreen(0x9, 0, SCREEN_WIDTH, 0);
copyScreenToPage(0);
setPortBitsToPage(0);
_zbasic->picture(0x1b5, 0xba, _pics[0x3c]);
@@ -1343,7 +1339,7 @@ void FoolPrologue::finaleRun() {
drawText(Common::U32String::format("%s\"", _zbasic->str(67).encode().c_str()), 0xde, 0xa0);
// 131:46aa
_toolbox->SetPortBits(var_i32_32);
- sub_128_e58();
+ waitForClick();
blitPageToScreen(0);
copyScreenToPage(0);
setPortBitsToPage(0);
@@ -1360,7 +1356,7 @@ void FoolPrologue::finaleRun() {
// 131:4780
_toolbox->SetPortBits(var_i32_32);
- sub_128_e58();
+ waitForClick();
blitPageToScreen(0);
copyScreenToPage(0);
setPortBitsToPage(0);
@@ -1372,9 +1368,9 @@ void FoolPrologue::finaleRun() {
drawText(Common::U32String::format("\"%s\"", _zbasic->str(71).encode().c_str()), 0x184, 0xb1);
// 131:4848
_toolbox->SetPortBits(var_i32_32);
- sub_128_e58();
+ waitForClick();
blitPageToScreen(0);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
setPortBitsToPage(0);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_toolbox->SetPortBits(var_i32_32);
@@ -1386,7 +1382,7 @@ void FoolPrologue::finaleRun() {
_toolbox->SetRect(arr_i16_1bc, 0, 0, 0x201, 0x156);
for (int16 i = 0; i <= 0x200; i++) {
if ((i % 4) == 0) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
}
// 131:48ea
if ((i % 2) == 0) {
@@ -1410,12 +1406,12 @@ void FoolPrologue::finaleRun() {
}
// 131:49f0
fillRect(0, 0, 0x3e8, 0x3e8, 1);
- sub_128_50a(0, 0, SCREEN_WIDTH, 2);
+ scanlineBlitPageToScreen(0, 0, SCREEN_WIDTH, 2);
delay(0x28);
// var_i16_3f2 = 0x10a;
int16 yPic = 0x5a;
for (int16 j = 0x40; j <= 0x45; j++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[0];
_toolbox->SetPortBits(var_i32_40);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
@@ -1450,26 +1446,26 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
}
// 131:4b86
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[0];
_toolbox->SetPortBits(var_i32_40);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcBic);
// the fool's errand
- drawTextCenter(_zbasic->str(72), SCREEN_WIDTH, 0x19 + yPic + 0x19);
+ drawTextCenter(_zbasic->str(72), 0x100, 0x19 + yPic + 0x19);
// (c) 1987 by cliff johnson. all rights reserved
- drawTextCenter(_zbasic->str(73), SCREEN_WIDTH, 0x32 + yPic + 0x19);
+ drawTextCenter(_zbasic->str(73), 0x100, 0x32 + yPic + 0x19);
// portions of this code are copyrighted 1985 zedcor inc
- drawTextCenter(_zbasic->str(74), SCREEN_WIDTH, 0x4b + yPic + 0x19);
+ drawTextCenter(_zbasic->str(74), 0x100, 0x4b + yPic + 0x19);
// the fool's errand is a registered trademark of cliff johnson
- drawTextCenter(_zbasic->str(75), SCREEN_WIDTH, 0x64 + yPic + 0x19);
+ drawTextCenter(_zbasic->str(75), 0x100, 0x64 + yPic + 0x19);
// 131:4c94
delayFromMarker(0x14);
_toolbox->SetPortBits(var_i32_32);
blitPageToScreen(0);
delay(0xb4);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[0];
_toolbox->SetPortBits(var_i32_40);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
@@ -1493,17 +1489,16 @@ void FoolPrologue::finaleDrawLoadingMsg() {
// 131:4dc0
// FIXME: we don't share the menu surface here yet
return;
- _toolbox->SetPort(var_i32_c);
+ _toolbox->SetPort(_grafPtrMenu);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Finale
- var_str_76 = _zbasic->str(78);
- var_str_76 += Common::U32String::format("%d%%", var_i16_3ce);
+ Common::U32String str = Common::U32String::format("%s%d%%", _zbasic->str(78).encode().c_str(), _prologueLoading);
// 131:4e08
- fillRect(0, 0, 7, 0x13, var_i16_10 - 7);
+ fillRect(0, 0, 7, 0x13, _windowWidth - 7);
- drawTextCenter(var_str_76, var_i16_10 / 2, 0xe);
+ drawTextCenter(str, _windowWidth / 2, 0xe);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(var_i32_8);
+ _toolbox->SetPort(_grafPtrWindow);
}
void FoolPrologue::finaleDrawFoolUhOh() {
@@ -1561,7 +1556,7 @@ void FoolPrologue::finaleCardRotate() {
for (int16 i = 1; i <= var_i16_18e - 1; i++) {
// 131:51ca
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int16 j = 0; j <= 7; j++) {
arr_f64_41bbe[j] += arr_f64_41bbe[j+8];
arr_i16_41af4[j + 0x10] = (int16)arr_f64_41bbe[j];
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index dca69cab61e..1bf20fce360 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/endian.h"
#include "common/memstream.h"
#include "common/ustr.h"
#include "common/util.h"
@@ -55,7 +56,7 @@ static const int fool30ZStrOffset[] = {
// Fool's Errand v1.1 is missing FOND data, below is taken from 2.0
static const byte fondChicago[] = {
- 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 96, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 12
@@ -102,30 +103,26 @@ void FoolGame::run() {
return;
}
- Common::String chicagoName("Chicago");
+ int16 fontChicago = 0;
switch (_version) {
case kFool11:
_zstrOffset = fool11ZStrOffset;
- // v1.1 and v2.0 provide direct overrides for "Chicago".
- _fontChicago = 0;
break;
case kFool30:
_zstrOffset = fool30ZStrOffset;
// v3.0 calls the font "Foolish Chicago" and changes the index
- _fontChicago = 255;
- chicagoName = Common::String("Foolish Chicago");
+ fontChicago = 255;
break;
case kFool20:
default:
_zstrOffset = fool20ZStrOffset;
- _fontChicago = 0;
break;
}
if (_version == kFool11) {
// v1.1 doesn't include any FOND chunks, so we have to provide them here.
_zbasic->injectFOND(fondFool, sizeof(fondFool), Common::String("Fool"));
- _zbasic->injectFOND(fondChicago, sizeof(fondChicago), chicagoName);
+ _zbasic->injectFOND(fondChicago, sizeof(fondChicago), Common::String("Foolish Chicago"));
_zbasic->injectFOND(fondLarge, sizeof(fondLarge), Common::String("Large"));
_zbasic->injectFOND(fondPuzzle, sizeof(fondPuzzle), Common::String("Puzzle"));
_zbasic->injectFOND(fondSmall, sizeof(fondSmall), Common::String("Small"));
@@ -134,8 +131,10 @@ void FoolGame::run() {
int16 exec = _zbasic->getFileId();
Handle foolFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontFool);
_toolbox->_injectFOND(exec, foolFOND->data(), foolFOND->size(), Common::String("Fool"));
- Handle chicagoFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), _fontChicago);
- _toolbox->_injectFOND(exec, chicagoFOND->data(), chicagoFOND->size(), chicagoName);
+ Handle chicagoFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), fontChicago);
+ // v2.0 sets the ID to 0 in order to override Chicago, patch it.
+ chicagoFOND->data()[3] = kFontChicago;
+ _toolbox->_injectFOND(exec, chicagoFOND->data(), chicagoFOND->size(), Common::String("Foolish Chicago"));
Handle largeFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontLarge);
_toolbox->_injectFOND(exec, largeFOND->data(), largeFOND->size(), Common::String("Large"));
Handle puzzleFOND = _toolbox->GetResource(MKTAG('F', 'O', 'N', 'D'), kFontPuzzle);
@@ -146,7 +145,7 @@ void FoolGame::run() {
// Fool's Errand has an embedded version of Chicago with custom characters
- _zbasic->setMenuFont(_fontChicago, 12);
+ _zbasic->setMenuFont(kFontChicago, 12);
// Start the game
foolRun();
@@ -187,9 +186,9 @@ void FoolGame::foolRun() {
_toolbox->SetRect(_screenClipRect, 0, MENU_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
- this->var_str_384 = _zbasic->str(0);
- this->var_str_384 = _zbasic->str(1);
- this->var_str_384 = _zbasic->str(2);
+ //this->var_str_384 = _zbasic->str(0);
+ //this->var_str_384 = _zbasic->str(1);
+ //this->var_str_384 = _zbasic->str(2);
// 128:0086
// 128:0086: MOVEQ - 0x0,D0
@@ -361,11 +360,9 @@ void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::
// 128:015a
_event.where.y = this->var_i16_58 + 0x3d;
_event.where.x = this->var_i16_56 + 0x68;
- this->var_i16_16c = 1;
- this->var_i32_16e = 0;
// 128:017e
- _toolbox->SFPutFile(_event.where, title, filename, this->var_i32_16e, this->var_sfr_5e);
+ _toolbox->SFPutFile(_event.where, title, filename, 0, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -378,9 +375,8 @@ void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::
}
-void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
+void FoolGame::sub_128_1e4(const Common::String &osType) {
// 128:01e4
- _zbasic->stringCopy(this->var_str_172, unk1);
this->var_str_588 = _zbasic->str(4);
this->var_i16_688 = 0;
@@ -388,18 +384,16 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
// 128:0218
_event.where.y = this->var_i16_58 + 0x3d;
_event.where.x = this->var_i16_56 + 0x53;
- this->var_i16_16c = 1;
- this->var_i32_16e = 0;
// 128:023c
// get offset of bytes in string and pretend it's an OSType
// this->var_i32_168 = *(this->var_str_172 + 1);
SFTypeList typeList = { { 0 } };
- typeList.types[0] = this->var_str_172.at(0) << 24;
- typeList.types[0] += this->var_str_172.at(1) << 16;
- typeList.types[0] += this->var_str_172.at(2) << 8;
- typeList.types[0] += this->var_str_172.at(3) << 0;
+ typeList.types[0] = osType.at(0) << 24;
+ typeList.types[0] += osType.at(1) << 16;
+ typeList.types[0] += osType.at(2) << 8;
+ typeList.types[0] += osType.at(3) << 0;
- _toolbox->SFGetFile(_event.where, _zbasic->str(5), this->var_i32_16e, this->var_i16_16c, typeList, this->var_i32_16e, this->var_sfr_5e);
+ _toolbox->SFGetFile(_event.where, _zbasic->str(5), 0, 1, typeList, 0, this->var_sfr_5e);
this->sub_128_6244();
this->copyScreen(1, this->arr_bmp_138bc);
@@ -410,13 +404,12 @@ void FoolGame::sub_128_1e4(const Common::U32String &unk1) {
}
}
-void FoolGame::sub_128_2be(int16 unk2, int16 unk1) {
+void FoolGame::getGridFromMouse(int16 &gridX, int16 &gridY) {
+ // 128:02be
// convert mouse coordinates to grid coordinates
- this->var_i16_68c = unk1;
- this->var_i16_68a = unk2;
- this->var_i16_68a = (_event.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
+ gridX = (_event.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
- this->var_i16_68c = (_event.where.y - this->arr_i16_1eb8[5]) / (this->arr_i16_1eb8[7]);
+ gridY = (_event.where.y - this->arr_i16_1eb8[5]) / (this->arr_i16_1eb8[7]);
}
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
@@ -526,24 +519,23 @@ void FoolGame::drawPuzzleButton(const Common::U32String &symbol) {
_toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
_toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
_toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
int16 width = _toolbox->StringWidth(symbol);
_toolbox->MoveTo(0x78 - (width / 2), 0x133);
_toolbox->DrawString(symbol);
}
-int16 FoolGame::sub_128_5fe() {
+int16 FoolGame::getVolRefNum() {
// 128:05fe
ParamBlockRec pb;
_toolbox->PBGetVol(pb);
- this->var_i16_30 = pb.ioVRefNum;
- return this->var_i16_30;
+ return pb.ioVRefNum;
}
-OSErr FoolGame::sub_128_64c(int16 unk1) {
+OSErr FoolGame::setVolRefNum(int16 volRefNum) {
// 128:064c
ParamBlockRec pb;
- pb.ioVRefNum = unk1;
+ pb.ioVRefNum = volRefNum;
return _toolbox->PBSetVol(pb);
}
@@ -657,7 +649,7 @@ void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16
this->arr_i16_4758[3] = unk3;
this->arr_i16_4758[4] = unk2;
this->arr_i16_4758[5] = unk1;
- this->sub_128_4472();
+ this->storyDrawZoom();
}
void FoolGame::getNextEvent(uint32 unk1) {
@@ -680,7 +672,7 @@ void FoolGame::getNextEvent(uint32 unk1) {
if ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0) {
this->sub_128_5f9e();
} else {
- this->sub_128_5baa();
+ this->onMenuKey();
}
}
// 128:0ce0
@@ -688,10 +680,10 @@ void FoolGame::getNextEvent(uint32 unk1) {
this->sub_128_5f9e();
}
if (_event.what == kUpdateEvt) {
- this->sub_128_5fb4();
+ this->onUpdateEvent();
}
if (_event.what == kDiskEvt) {
- this->sub_128_6154();
+ this->onDiskEvent();
}
if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
this->menuQuit();
@@ -780,8 +772,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
int16 strY = 0xbe - this->var_i16_7b6;
// 128:1056
for (int i = 0; i <= lineCount; i++) {
- this->var_str_384 = _modalText[i];
- this->drawTextCenter(this->var_str_384, strY);
+ this->drawTextCenter(_modalText[i], strY);
// 128:1086
// 128:1086: CLR.W - -0x772(A5)
strY += 0x11;
@@ -789,7 +780,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
// 128:10a0
if (buttonCount != 0) {
_toolbox->PenNormal();
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// 128:10c0
// loop to zero out three button rects
@@ -947,28 +938,29 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
this->toggleMouseCursor(false);
_zbasic->picture(0, MENU_HEIGHT, this->var_pic_7c2);
_zbasic->text(kFontFool, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
+ Common::Rect rect;
for (int j = 0; j <= 1; j++) {
// 128:18c4
for (int i = 0; i <= 0x64; i += 4) {
this->var_i32_692 = _toolbox->TickCount();
_toolbox->SetRect(
- this->arr_rect_4338,
+ rect,
(0x105 - (int)(i*2.2f)),
i + 0xa5,
(0x105 + (int)(i*2.2f)),
(0xa6 + (int)(i*1.6f))
);
// 128:1982
- _toolbox->InvertRect(this->arr_rect_4338);
+ _toolbox->InvertRect(rect);
this->delayFromMarker(0);
}
// 128:19a4
}
// 128:19b2
_toolbox->PenNormal();
- _toolbox->PaintRect(this->arr_rect_4338);
+ _toolbox->PaintRect(rect);
_toolbox->PenMode(kPatXor);
- _toolbox->FrameRect(this->arr_rect_4338);
+ _toolbox->FrameRect(rect);
_toolbox->PenMode(kPatCopy);
this->var_i16_484 = _toolbox->StringWidth(message);
// 128:19ec
@@ -977,32 +969,32 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
// loop count was 0x4d
for (int i = 0; i <= 0x24; i++) {
this->var_i32_692 = _toolbox->TickCount();
- _toolbox->InvertRect(this->arr_rect_4338);
+ _toolbox->InvertRect(rect);
// this was 1, however the flashing was far too intense
this->delayFromMarker(8);
}
for (int i = 1; i <= 0x24; i++) {
// 128:1a4c
this->var_i32_692 = _toolbox->TickCount();
- this->arr_rect_4338.top -= (int)(i*0.4f);
- this->arr_rect_4338.left -= (int)(i*0.1f);
- this->arr_rect_4338.bottom += (int)(i*0.05f);
- this->arr_rect_4338.right += (int)(i*0.1f);
+ rect.top -= (int)(i*0.4f);
+ rect.left -= (int)(i*0.1f);
+ rect.bottom += (int)(i*0.05f);
+ rect.right += (int)(i*0.1f);
// 128:1b82
- if (this->arr_rect_4338.top < MENU_HEIGHT) {
- this->arr_rect_4338.top = MENU_HEIGHT;
+ if (rect.top < MENU_HEIGHT) {
+ rect.top = MENU_HEIGHT;
}
// 128:1bac
if (this->var_i16_32 == 0) {
- _toolbox->InvertRect(this->arr_rect_4338);
+ _toolbox->InvertRect(rect);
}
// 128:1bc2
if (this->var_i16_32 == 1) {
- _toolbox->FillRect(this->arr_rect_4338, _patterns[3]);
+ _toolbox->FillRect(rect, _patterns[3]);
}
// 128:1be6
if (this->var_i16_32 == 2) {
- _toolbox->FillRect(this->arr_rect_4338, _patterns[0x47]);
+ _toolbox->FillRect(rect, _patterns[0x47]);
}
// 128:1c0a
// was 1
@@ -1167,25 +1159,25 @@ void FoolGame::storyRenderPage() {
// 128:235e
if (_puzzleType[_storyCurrentChapter] > 0) {
// set story button icon
- this->var_str_384 = Common::U32String("?"); // was: str(10)
+ Common::U32String iconStr = Common::U32String("?"); // was: str(10)
if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
- this->var_str_384 = Common::U32String("~"); // wadjet eye, was: str(11)
+ iconStr = Common::U32String("~"); // wadjet eye, was: str(11)
}
// 128:23b8
if (_puzzleCompletionStatus[_storyCurrentChapter] >= 0x64) {
- this->var_str_384 = Common::U32String("*"); // was: str(12)
+ iconStr = Common::U32String("*"); // was: str(12)
}
// 128:23e8
- this->drawPuzzleButton(this->var_str_384);
+ this->drawPuzzleButton(iconStr);
// 128:23f0: CLR.W - -0x772(A5)
this->var_i16_7d6 = 1;
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
_toolbox->MoveTo(0x8a, 0x133);
_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
this->var_i16_7d6 = 0;
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
_toolbox->MoveTo(0x70, 0x133);
_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
}
@@ -1219,8 +1211,7 @@ void FoolGame::storyRenderPage() {
_toolbox->MoveTo(0x41, strY);
for (int i = _pageLineRanges[_storyNextPage*2]; i <= _pageLineRanges[_storyNextPage*2+1]; i++) {
_toolbox->TextFace(_pageLineFace[i]);
- this->var_str_384 = _zbasic->index(0, i);
- _toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(_zbasic->index(0, i));
if (_pageLineBreak[i] != 0) {
// 128:262a
strY += 0xf;
@@ -1239,7 +1230,7 @@ void FoolGame::menuClickMessage() {
// hide menu and replace with "click mouse to continue" message
_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
Common::U32String message = Common::U32String("Click Mouse to Continue"); // was: str(15)
int16 width = _toolbox->StringWidth(message);
_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
@@ -1324,7 +1315,7 @@ void FoolGame::sub_128_2808() {
if (this->var_i16_7e6 != 0) {
_modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", this->var_str_588.encode().c_str()); // was: str(17), str(18)
_modalText[1] = Common::U32String("Okay"); // was: str(19)
- this->showChoiceModal(_fontChicago, 0, 1, 1);
+ this->showChoiceModal(kFontChicago, 0, 1, 1);
this->var_str_588.clear(); // was: str(20)
this->var_i16_7e6 = 0;
}
@@ -1333,7 +1324,7 @@ void FoolGame::sub_128_2808() {
void FoolGame::menuOpenGame() {
// 128:2988
// File -> Open
- this->sub_128_1e4(Common::U32String("FOOL")); // was: str(21)
+ this->sub_128_1e4(Common::String("FOOL")); // was: str(21)
if (this->var_str_588.empty()) { // was: str(22)
return;
}
@@ -1508,7 +1499,11 @@ void FoolGame::openGame() {
// 128:2e70: SF - 0x8,D0
_zbasic->openR(2, _saveFileName, 0x400, this->var_i16_9ec);
- this->var_str_384 = _zbasic->readFileStr(2, 0x11);
+ Common::String magic = _zbasic->readFileStr(2, 0x11);
+ if (!magic.equals("The Fool's Errand")) {
+ error("FoolGame::openGame: invalid save file");
+ return;
+ }
_storyNextPage = _zbasic->readFileInt(2);
_activePuzzle = _zbasic->readFileInt(2);
this->var_i16_7ce = _zbasic->readFileInt(2);
@@ -1588,8 +1583,7 @@ void FoolGame::sub_128_3032() {
for (int i = 1; i <= 0xf; i++) {
// 128:31ec
_toolbox->MoveTo(0x41, strY);
- this->var_str_384 = _zbasic->index(0, i);
- _toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(_zbasic->index(0, i));
strY += 0xf;
}
// 128:3228
@@ -1606,7 +1600,7 @@ void FoolGame::sub_128_3032() {
}
}
// 128:3294
- this->sub_128_32c8();
+ this->menuToggleSound();
if (_sunMapRestored == 0) {
_zbasic->menu(2, 7, 0, Common::U32String());
} else {
@@ -1614,7 +1608,7 @@ void FoolGame::sub_128_3032() {
}
}
-void FoolGame::sub_128_32c8() {
+void FoolGame::menuToggleSound() {
if (!_soundEnabled) {
_zbasic->menu(2, 6, 1, Common::U32String());
} else {
@@ -1640,7 +1634,7 @@ void FoolGame::savePrompt() {
_modalText[1] = Common::U32String("Yes");
_modalText[2] = Common::U32String("No");
_modalText[3] = Common::U32String("Cancel");
- this->showChoiceModal(_fontChicago, 0, 3, 0);
+ this->showChoiceModal(kFontChicago, 0, 3, 0);
if (_savePromptChoice > 1) {
_saveFileName = previous;
return;
@@ -1666,7 +1660,7 @@ void FoolGame::autoSaveGame() {
// This wrapper changes the autosave behaviour to match the rest of ScummVM.
_isAutoSaving = true;
Common::U32String previous = _saveFileName;
- _saveFileName = Common::U32String::format("%s-Autosave.fool", g_engine->getGameId().c_str());
+ _saveFileName = Common::U32String::format("%s-Autosave", g_engine->getGameId().c_str());
saveGame();
_saveFileName = previous;
_isAutoSaving = false;
@@ -1748,9 +1742,9 @@ void FoolGame::saveGame() {
void FoolGame::sub_128_3744() {
// 128:3744
for (int i = 3; i <= 7; i++) {
- this->var_menu_bf8 = _toolbox->GetMHandle(i);
+ MenuHandle menu = _toolbox->GetMHandle(i);
_toolbox->DeleteMenu(i);
- _toolbox->DisposeMenu(this->var_menu_bf8);
+ _toolbox->DisposeMenu(menu);
}
_toolbox->DrawMenuBar();
}
@@ -1886,9 +1880,9 @@ void FoolGame::puzzleRun() {
if ((_stateFlags & kStateQuit) == 0) {
_toolbox->PenNormal();
this->copyScreen(1, this->arr_bmp_5dfc);
- this->var_menu_bf8 = _toolbox->GetMHandle(8);
+ MenuHandle menu = _toolbox->GetMHandle(8);
_toolbox->DeleteMenu(8);
- _toolbox->DisposeMenu(this->var_menu_bf8);
+ _toolbox->DisposeMenu(menu);
_toolbox->DrawMenuBar();
}
// 128:3aea
@@ -2002,38 +1996,38 @@ void FoolGame::storyUnlockChapter() {
void FoolGame::puzzleSetupMenu() {
// 128:3fb6
// new: delete existing menu 8
- this->var_menu_bf8 = _toolbox->GetMHandle(8);
+ MenuHandle menu = _toolbox->GetMHandle(8);
_toolbox->DeleteMenu(8);
- _toolbox->DisposeMenu(this->var_menu_bf8);
+ _toolbox->DisposeMenu(menu);
_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
- this->var_str_384 = Common::U32String("/RReturn to Scroll "); // was: str(72)
+ Common::U32String returnMsg = Common::U32String("/RReturn to Scroll "); // was: str(72)
if ((_activePuzzle == 0x34) || (_activePuzzle == 0x35)) {
- this->var_str_384 = Common::U32String("/RRun for your life@ "); // was: str(73)
+ returnMsg = Common::U32String("/RRun for your life@ "); // was: str(73)
}
// 128:4024
if (_activePuzzle > 0x50) {
- this->var_str_384 = Common::U32String("/RReturn to Map "); // was: str(74)
+ returnMsg = Common::U32String("/RReturn to Map "); // was: str(74)
}
- _zbasic->menu(8, 1, 1, this->var_str_384);
+ _zbasic->menu(8, 1, 1, returnMsg);
// 128:4056
if (_puzzleMenuInstructions[_puzzleType[_activePuzzle]*2] <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]) {
_zbasic->menu(8, 2, 0, Common::U32String("-")); // was: str(75)
// 128:40c6
- this->var_i16_484 = 2;
+ int16 itemNo = 2;
for (int i = _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]; i <= _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2 + 1]; i++) {
// 128:40f6
- this->var_i16_484++;
- this->var_str_384 = _zbasic->index(0, i) + Common::U32String(" "); // was: str(76)
+ itemNo++;
+ Common::U32String instructMsg = _zbasic->index(0, i) + Common::U32String(" "); // was: str(76)
// New: Override instructions for card game.
// v3 changed the score from 700 points to 666 points, but didn't change the puzzle data
// file (where the menu entries come from). V3 applies a bodge with a program string.
if ((_activePuzzle == 7) &&(i == _puzzleMenuInstructions[_puzzleType[_activePuzzle]*2]+7)) {
- this->var_str_384 = Common::U32String("⢠The first player to earn over 666 points wins the game. ");
+ instructMsg = Common::U32String("⢠The first player to earn over 666 points wins the game. ");
}
- _zbasic->menu(8, this->var_i16_484, 1, this->var_str_384);
+ _zbasic->menu(8, itemNo, 1, instructMsg);
}
}
// 128:4166
@@ -2119,10 +2113,10 @@ void FoolGame::sub_128_41d8() {
this->arr_i16_4758[1] = 0x31;
}
}
- sub_128_4472();
+ storyDrawZoom();
}
-void FoolGame::sub_128_4472() {
+void FoolGame::storyDrawZoom() {
// 128:4472
if (this->arr_i16_4758[1] == 0) {
this->arr_i16_4758[1] = _activePuzzle;
@@ -2187,8 +2181,8 @@ void FoolGame::sub_128_4472() {
}
// 128:4850
if ((this->arr_i16_15e8[_activePuzzle] == 0xd) || (this->arr_i16_15e8[_activePuzzle] == 0xe)) {
- fillRect(0x14f, 0, 0x156, 0x7, 1);
- fillRect(0x14f, 0x1f9, 0x156, 0x200, 1);
+ fillRect(0x14f, 0, SCREEN_HEIGHT, 0x7, 1);
+ fillRect(0x14f, 0x1f9, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
}
// 128:48d6
for (int i = 0; i <= this->arr_i16_4758[12]; i++) {
@@ -2368,8 +2362,7 @@ void FoolGame::menuAbout() {
// 128:509a
int16 strY = 0xbe - this->var_i16_7b6;
for (int i = 0; i <= modalLines; i++) {
- this->var_str_384 = _modalText[i];
- this->drawTextCenter(this->var_str_384, strY);
+ this->drawTextCenter(_modalText[i], strY);
strY += 0x11;
}
// 128:50f4
@@ -2409,12 +2402,12 @@ void FoolGame::onClickMenu() {
if (_menuHidesPlayfield) {
this->thothHidePlayfield();
}
- this->var_i32_bf8 = _toolbox->MenuSelect(_event.where);
- _selectedMenuID = (uint16)(this->var_i32_bf8 >> 16);
- _selectedMenuItem = (uint16)(this->var_i32_bf8 & 0xffff);
+ uint32 menuData = _toolbox->MenuSelect(_event.where);
+ _selectedMenuID = (uint16)(menuData >> 16);
+ _selectedMenuItem = (uint16)(menuData & 0xffff);
if (_selectedMenuID > 0) {
// 128:5b8c
- this->sub_128_5c20();
+ this->onMenuSelect();
_toolbox->HiliteMenu(0);
}
// 128:5b94
@@ -2424,18 +2417,18 @@ void FoolGame::onClickMenu() {
this->sub_128_61ec();
}
-void FoolGame::sub_128_5baa() {
+void FoolGame::onMenuKey() {
if (_menuDisabled)
return;
- this->var_i32_bf8 = _toolbox->MenuKey((char)(_event.message & 0xff));
+ uint32 menuData = _toolbox->MenuKey((char)(_event.message & 0xff));
_toolbox->Delay(0);
- _selectedMenuID = this->var_i32_bf8 >> 16;
- _selectedMenuItem = this->var_i32_bf8 & 0xffff;
+ _selectedMenuID = (uint16)(menuData >> 16);
+ _selectedMenuItem = (uint16)(menuData & 0xffff);
if (_selectedMenuID > 0) {
if (_menuHidesPlayfield) {
this->thothHidePlayfield();
}
- this->sub_128_5c20();
+ this->onMenuSelect();
if (_menuHidesPlayfield) {
this->thothShowPlayfield();
}
@@ -2445,7 +2438,7 @@ void FoolGame::sub_128_5baa() {
this->sub_128_61ec();
}
-void FoolGame::sub_128_5c20() {
+void FoolGame::onMenuSelect() {
_stateFlags = kStateNull;
if (_selectedMenuID == 1) { // Eye menu
if (_selectedMenuItem == 2) {
@@ -2470,7 +2463,7 @@ void FoolGame::sub_128_5c20() {
} else if (_selectedMenuItem == 6) {
_soundEnabled = !_soundEnabled;
// 128:5cbc
- this->sub_128_32c8();
+ this->menuToggleSound();
// 128:5cc4
} else if (_selectedMenuItem == 7) {
this->menuPrintStory();
@@ -2559,7 +2552,7 @@ void FoolGame::sub_128_5f9e() {
_keyLastPressed = _event.message & 0xff;
}
-void FoolGame::sub_128_5fb4() {
+void FoolGame::onUpdateEvent() {
// 128:5fb4
_toolbox->BeginUpdate(*_event.windowPtr);
_toolbox->EndUpdate(*_event.windowPtr);
@@ -2591,7 +2584,7 @@ void FoolGame::sub_128_5fea() {
// 128:6152
}
-void FoolGame::sub_128_6154() {
+void FoolGame::onDiskEvent() {
// 128:6154
this->var_i16_e1c = _event.message >> 16;
this->var_i16_e1e = _event.message & 0xffff;
@@ -2632,10 +2625,10 @@ void FoolGame::sub_128_61ec() {
do {
this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
- this->sub_128_5fb4();
+ this->onUpdateEvent();
}
if (_event.what == kDiskEvt) {
- this->sub_128_6154();
+ this->onDiskEvent();
}
if (_event.what == kNullEvent)
_toolbox->Delay(0);
@@ -2652,7 +2645,7 @@ void FoolGame::sub_128_6244() {
}
// 128:6272
if (_event.what == kDiskEvt) {
- this->sub_128_6154();
+ this->onDiskEvent();
}
_toolbox->Delay(0);
} while ((_event.what == kNullEvent) && ((_event.modifiers & kModMouseButtonUp) == 0));
@@ -2782,7 +2775,7 @@ void FoolGame::sub_129_068() {
_modalText[1] = Common::U32String("2 color black and white");
_modalText[2] = Common::U32String("and start the game again.");
_modalText[3] = Common::U32String("Okay");
- this->showChoiceModal(_fontChicago, 2, 1, 0);
+ this->showChoiceModal(kFontChicago, 2, 1, 0);
_zbasic->unk_4();
}
// 129:0390
@@ -2798,7 +2791,7 @@ void FoolGame::sub_129_068() {
_modalText[4] = Common::U32String("for possible solutions.");
_modalText[5] = Common::U32String();
_modalText[6] = Common::U32String("Quit");
- this->showChoiceModal(_fontChicago, 5, 1, 1);
+ this->showChoiceModal(kFontChicago, 5, 1, 1);
_zbasic->unk_4();
}
// 129:0496
@@ -2823,7 +2816,7 @@ void FoolGame::sub_129_068() {
}
}
// 129:0562
- this->var_i16_f2c = this->sub_128_5fe(); // volume ref num
+ this->var_i16_f2c = this->getVolRefNum(); // volume ref num
this->var_i16_e20 = this->var_i16_f2c;
if (this->var_str_e22.empty()) { // was: str(130)
this->sub_129_004();
@@ -2845,13 +2838,13 @@ void FoolGame::sub_129_068() {
// 129:0636
if (this->var_str_e22.empty()) { // was: str(135)
do {
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcBic);
fillRect(0x17, 0x92, 0x31, 0x16e, 2);
//this->var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
this->toggleMouseCursor(true);
- this->sub_128_1e4(Common::U32String("PUZZ")); // was: str(137)
+ this->sub_128_1e4(Common::String("PUZZ")); // was: str(137)
// 129:06a6: CLR.W - -0x772(A5)
fillRect(0x17, 0x92, 0x31, 0x16e, 1);
this->toggleMouseCursor(false);
@@ -2863,10 +2856,10 @@ void FoolGame::sub_129_068() {
} while (this->var_str_e22 != Common::U32String("Fool's Puzzles")); // was: str(139)
}
// 129:0718
- this->sub_128_64c(this->var_i16_f22);
+ this->setVolRefNum(this->var_i16_f22);
this->var_i16_1030 = _toolbox->OpenResFile(Common::Path(this->var_str_e22, ':'));
_toolbox->UseResFile(this->var_i16_1030);
- this->var_i16_484 = this->sub_128_64c(this->var_i16_f2c);
+ this->var_i16_484 = this->setVolRefNum(this->var_i16_f2c);
for (int i = 0; i <= 1; i++) {
// scroll background
this->arr_i32_192c0[i] = _toolbox->GetPicture(i + 0x54);
@@ -3141,7 +3134,7 @@ void FoolGame::menuLoadingMessage(int16 percent) {
// draw the loading text on the menu bar
_toolbox->SetPort(this->var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
Common::U32String message = Common::U32String::format("Loading Game - %d%%", percent); // was: str(158)
int16 width = _toolbox->StringWidth(message);
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 926f59f0bfa..40ace5edc09 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -78,11 +78,11 @@ enum FoolZStrOffset : uint16 {
};
enum FoolFontID : uint16 {
- kFontChicago = 0,
kFontFool = 250,
kFontPuzzle = 251,
kFontSmall = 252,
kFontLarge = 254,
+ kFontChicago = 255,
};
class FoolGame {
@@ -95,8 +95,8 @@ public:
void foolRun(); // sub_128_004
void copyScreen(int16 put, BitMap &bmp); // sub_128_0a2
void openSaveFileDialog(const Common::U32String &title, const Common::U32String &filename); // sub_128_11c
- void sub_128_1e4(const Common::U32String &unk1);
- void sub_128_2be(int16 unk2, int16 unk1);
+ void sub_128_1e4(const Common::String &osType);
+ void getGridFromMouse(int16 &gridX, int16 &gridY); // sub_128_2be
void sub_128_342(int16 unk2, int16 unk1);
void delay(int16 numTicks); // sub_128_3da
void delayFromMarker(int16 numTicks); // sub_128_406
@@ -107,8 +107,8 @@ public:
void toggleMouseCursor(bool visible); // sub_128_4da
void playTone(int16 freq, int16 duration, bool wait);
void drawPuzzleButton(const Common::U32String &symbol); // sub_128_55c
- int16 sub_128_5fe();
- OSErr sub_128_64c(int16 unk1);
+ int16 getVolRefNum(); // sub_128_5fe
+ OSErr setVolRefNum(int16 volRefNum); // sub_128_64c
void fillRect(int16 patternID, PatternMode mode, int16 top, int16 left, int16 bottom, int16 right); // sub_128_69c
void drawTarotCard(int16 rectID, int16 deckPos, int16 type); // sub_128_712
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_8b4
@@ -147,7 +147,7 @@ public:
void openGame(); // sub_128_2e3e
void sub_128_3032();
- void sub_128_32c8();
+ void menuToggleSound(); // sub_128_32c8
void savePrompt(); // sub_128_32fa
void autoSaveGame();
void saveGame(); // sub_128_3536
@@ -163,7 +163,7 @@ public:
void puzzleLoadContext(); // sub_128_4168
void puzzleSaveContext(); // sub_128_41aa
void sub_128_41d8();
- void sub_128_4472();
+ void storyDrawZoom(); // sub_128_4472
void menuAbout(); // sub_128_4a92
void menuPrologue();
void menuFinale();
@@ -175,14 +175,14 @@ public:
void sub_128_5a6c();
void onClickMenu(); // sub_128_5b30
- void sub_128_5baa();
- void sub_128_5c20();
+ void onMenuKey(); // sub_128_5baa
+ void onMenuSelect(); // sub_128_5c20
void thothHidePlayfield(); // sub_128_5ef0
void thothShowPlayfield(); // sub_128_5f16
void sub_128_5f9e();
- void sub_128_5fb4();
+ void onUpdateEvent(); // sub_128_5fb4
void sub_128_5fea();
- void sub_128_6154();
+ void onDiskEvent(); // sub_128_6154
void waitForMouseUp(); // sub_128_6186
void waitForClick(); // sub_128_61c2
void sub_128_61ec(); // sub_128_61ec
@@ -401,7 +401,7 @@ public:
void sub_140_2968();
void sub_140_2978();
void thothKeyLastSetup(); // sub_140_2998
- void sub_140_2f92();
+ void thothSetupMenu(); // sub_140_2f92
Common::Rect thothRandomSquare(); // sub_140_3050
Common::Rect thothRandomHRect(); // sub_140_30da
Common::Rect thothRandomVRect(); // sub_140_3148
@@ -420,20 +420,21 @@ public:
// fool_humbug.cpp
void humbugRun(); // sub_142_004
void humbugPlayTrail(); // sub_142_0e6
- void sub_142_370();
+ void humbugMoveMouse(); // sub_142_370
void humbugSuccess(); // sub_142_5f2
- void sub_142_630();
+ void humbugShowThoth(); // sub_142_630
// fool_justice.cpp
void justiceRun(); // sub_142_852
- void sub_142_9be();
+ void justiceSetup(); // sub_142_9be
void justiceOnClick(); // sub_142_cb2
void justiceZoom(); // sub_142_f58
- void justiceDrawBlock(); // sub_142_f96
- void justiceRemoveBlock(); // sub_142_10bc
+ void justiceDrawBlock(int16 gridIndex); // sub_142_f96
+ void justiceRemoveBlock(int16 gridIndex); // sub_142_10bc
void justiceStoreState(); // sub_142_111e
void justiceResetGrid(); // sub_142_11fe
+ // fool_hermit.cpp
void hermitRun(); // sub_142_12ac
// fool_straightpath.cpp
@@ -450,7 +451,6 @@ public:
private:
FoolVersion _version;
const int *_zstrOffset;
- int _fontChicago;
Toolbox *_toolbox;
ZBasic *_zbasic;
bool _quit = false;
@@ -473,8 +473,6 @@ private:
int16 _windowWidth; // var_i16_5a
int16 _windowHeight; // var_i16_5c
SFReply var_sfr_5e; // -> aa
- int16 var_i16_16c;
- ProcPtr var_i32_16e;
Common::U32String var_str_172;
Common::U32String var_str_272;
RGBColor var_i16_372;
@@ -538,9 +536,6 @@ private:
Common::U32String var_str_af4;
int16 var_i16_bfc;
- // Used as both a pointer and a bitstore
- uint32 var_i32_bf8;
- MenuHandle var_menu_bf8;
int16 var_i16_c00;
int16 var_i16_c02;
int16 _activePuzzleStatus; // var_i16_c04
@@ -589,15 +584,18 @@ private:
int16 _jumblePosition; // var_i16_106e
Common::U32String var_str_1070;
Common::U32String _sentenceBuffer; // var_str_1070
+ Common::U32String _metapuzzleSecretGoal; // var_str_1170
Common::U32String var_str_1170;
int16 var_i16_1270;
- Common::U32String var_str_1272;
+ Common::U32String _metapuzzleSecretBuffer;
+ Common::String _straightPathGoal; // var_str_1272
Common::U32String _sentenceGoal; // var_str_1272
int16 var_i16_1372;
Common::U32String var_str_1374;
Common::U32String var_str_1474;
int16 var_i16_1574;
+ int16 _straightPathSelected; // var_i16_1574
int16 _jumbleSelected; // var_i16_1574
int16 var_i16_1576;
@@ -729,12 +727,9 @@ private:
int16 var_i16_2338;
bool _deathWhiteEyeNeedsDraw; // var_i16_233a
- int16 var_i16_233e;
+ int16 _justiceFirstMove; // var_i16_233e
int16 _humbugTrailIndex; // var_i16_233c
- int16 var_i16_2340;
- int16 var_i16_2342;
-
// FIXME: bounds on the following are guessed! need to trace index range
int16 _pageLineRanges[202]; // arr_i16_0
int16 _pageLineFace[1301]; // arr_i16_194
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 6d02faf8497..2ab524c4011 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -51,7 +51,7 @@ void FoolGame::humbugRun() {
}
// 142:00b2
if (_activePuzzleStatus == 0x63) {
- this->sub_142_630();
+ this->humbugShowThoth();
}
if (_activePuzzleStatus >= 0x64) {
this->humbugPlayTrail();
@@ -76,7 +76,7 @@ void FoolGame::humbugPlayTrail() {
// 142:0166
this->fetchPuzzleData();
this->toggleMouseCursor(false);
- _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
this->drawPuzzleButton(_zbasic->str(OFF(5))); // ~
// eye button
_zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
@@ -111,7 +111,7 @@ void FoolGame::humbugPlayTrail() {
// 142:02ee
this->getNextEvent(-1);
if (!((this->var_i16_1ab6 == _event.where.x) && (this->var_i16_1ab8 == _event.where.y))) {
- this->sub_142_370();
+ this->humbugMoveMouse();
}
if (this->_humbugTrailIndex >= 0xa42) {
_activePuzzleSolved = true;
@@ -123,7 +123,7 @@ void FoolGame::humbugPlayTrail() {
}
}
-void FoolGame::sub_142_370() {
+void FoolGame::humbugMoveMouse() {
// 142:0370
int16 trailMax = this->_humbugTrailIndex + 0x19;
if (trailMax > 0xa42) {
@@ -189,7 +189,7 @@ void FoolGame::humbugSuccess() {
this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
}
-void FoolGame::sub_142_630() {
+void FoolGame::humbugShowThoth() {
// 142:0630
_zbasic->menu(8, 0, 1, _zbasic->str(OFF(6))); // the 2nd key of thoth
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(7))); // return to scroll
@@ -217,7 +217,7 @@ void FoolGame::sub_142_630() {
_toolbox->DrawString(idStr);
}
// 142:07ca
- _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
this->waitForMouseUp();
this->menuClickMessage();
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 1428fa379a1..a95bc826b1e 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -150,7 +150,7 @@ void FoolGame::jigsawRun() {
void FoolGame::jigsawOnClick() {
// 132:0518
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || ((this->var_i16_68a - (this->arr_i16_1eb8[0])) > 0) || (this->var_i16_68c < 1) || ((this->var_i16_68c - (this->arr_i16_1eb8[1])) > 0)) {
return;
}
@@ -191,7 +191,7 @@ void FoolGame::jigsawDragSelect() {
// change select area while mouse button held down
do {
this->getNextEvent(4);
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->var_i16_68a >= this->arr_i16_4758[0]) {
this->arr_i16_4758[2] = this->arr_i16_4758[0];
@@ -230,7 +230,7 @@ void FoolGame::jigsawMoveSelected() {
warning("call: %s", __func__);
do {
this->getNextEvent(2);
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->arr_i16_4758[0] >= 0) {
this->arr_i16_4758[4] = this->var_i16_68a;
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index c353e8b946e..1691ef90954 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -151,12 +151,12 @@ void FoolGame::jumbleRun() {
this->var_str_1170.clear(); // was: str(169)
this->var_i16_1270 = puzzlesReadShort();
for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
- this->var_str_1272 = puzzlesReadString().decode(Common::kMacRoman);
- this->var_i16_1372 = this->var_str_1272.size();
- this->var_str_1170 += this->var_str_1272;
+ Common::U32String data = puzzlesReadString().decode(Common::kMacRoman);
+ this->var_i16_1372 = data.size();
+ this->var_str_1170 += data;
// 130:047e
if (_activePuzzleStatus > _jumbleCurrentSubPuzzle) {
- this->var_str_1070 += this->var_str_1272;
+ this->var_str_1070 += data;
} else {
// 130:04ac
if ((_activePuzzleStatus == _jumbleCurrentSubPuzzle) && !_activePuzzleBuffer.empty()) { // was: str(170)
@@ -166,12 +166,12 @@ void FoolGame::jumbleRun() {
// 130:04f0
if ((_jumbleGameType == 1) || (_jumbleGameType == 5)) {
// 130:0514
- this->var_str_384 = this->var_str_1272;
+ this->var_str_384 = data;
this->sub_130_25d8();
}
// 130:0528
if (_jumbleGameType == 2) {
- this->var_str_384 = this->var_str_1272;
+ this->var_str_384 = data;
this->sub_130_2790();
}
// 130:0548
@@ -181,13 +181,13 @@ void FoolGame::jumbleRun() {
// 130:0580
// word square
if (_jumbleGameType == 4) {
- this->var_str_384 = _zbasic->leftStr(this->var_str_1272, 4);
+ this->var_str_384 = _zbasic->leftStr(data, 4);
this->sub_130_25d8();
this->var_str_1374 = this->var_str_9f4;
- this->var_str_384 = _zbasic->rightStr(this->var_str_1272, 4);
+ this->var_str_384 = _zbasic->rightStr(data, 4);
this->sub_130_25d8();
this->var_str_1474 = this->var_str_9f4;
- this->var_str_9f4 = this->var_str_1374 + _zbasic->midStr(this->var_str_1272, 5, 1) + this->var_str_1474;
+ this->var_str_9f4 = this->var_str_1374 + _zbasic->midStr(data, 5, 1) + this->var_str_1474;
}
// 130:0610
this->var_str_1070 += this->var_str_9f4;
@@ -573,7 +573,7 @@ void FoolGame::jumbleRunHiddenMessage() {
if (_keyLastPressed != 0) {
this->jumbleOnKey();
}
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
if (_event.what == kMouseDown) {
this->jumbleOnClick();
}
@@ -619,7 +619,7 @@ void FoolGame::sub_130_1426() {
void FoolGame::jumbleOnClick() {
warning(__func__);
// 130:1476
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
// 130:14fa
if (_event.where.x > 0x14) {
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index 02928f9f5db..4f7cfa0ec9a 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -34,51 +34,51 @@ namespace Fool {
void FoolGame::justiceRun() {
// 142:0852
if (_activePuzzleStatus < 0x63) {
- this->sub_142_9be();
+ justiceSetup();
if (!_activePuzzleSolved) {
- this->justiceStoreState();
+ justiceStoreState();
return;
}
// 142:0874
- this->justiceResetGrid();
+ justiceResetGrid();
if (_puzzleCompletionStatus[0x34] > 3) {
_activePuzzleStatus = 0x64;
return;
} else {
// 142:08a2
- this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
+ zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
_activePuzzleStatus = 0x63;
// behold the 3rd key of thoth
- this->showBehold(0x3f, 1, _zbasic->str(OFF(0)));
+ showBehold(0x3f, 1, _zbasic->str(OFF(0)));
}
}
// 142:0906
if (_activePuzzleStatus == 0x63) {
_zbasic->menu(8, 0, 1, _zbasic->str(OFF(1))); // the 3rd key of thoth
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(2))); // return to scroll
- this->thothKey3rd();
+ thothKey3rd();
if (_activePuzzleSolved) {
- this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
+ zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
}
}
// 142:098a
if (_activePuzzleStatus >= 0x64) {
- this->sub_142_9be();
+ justiceSetup();
if (!_activePuzzleSolved) {
- this->justiceStoreState();
+ justiceStoreState();
return;
}
// 142:09b0
- this->justiceResetGrid();
+ justiceResetGrid();
_activePuzzleStatus = 0x65;
}
// 142:09ba
return;
}
-void FoolGame::sub_142_9be() {
+void FoolGame::justiceSetup() {
// 142:09be
- this->fetchPuzzleData();
+ fetchPuzzleData();
for (int16 i = 1; i <= 0x19; i++) {
_zbasic->indexRawSet(puzzlesReadString(), 1, i);
}
@@ -92,13 +92,13 @@ void FoolGame::sub_142_9be() {
_zbasic->menu(8, 4, 1, _zbasic->str(OFF(6))); // unless twenty-five appear
}
// 142:0a6a
- this->justiceZoom();
- this->var_i16_484 = 0;
+ justiceZoom();
+ int16 gridIndex = 0;
for (int16 i = 0x24; i <= 0x11d; i += 0x32) {
for (int16 j = 0x8c; j <= 0x185; j += 0x32) {
- this->var_i16_484++;
+ gridIndex++;
_toolbox->SetRect(
- _screenGrid[this->var_i16_484],
+ _screenGrid[gridIndex],
j,
i,
j + 0x32,
@@ -107,30 +107,30 @@ void FoolGame::sub_142_9be() {
}
}
// 142:0adc
- this->justiceZoom();
- this->fillRect(0x1a, 0x82, 0x128, 0x190, 2);
+ justiceZoom();
+ fillRect(0x1a, 0x82, 0x128, 0x190, 2);
if (_activePuzzleBuffer.empty()) { // was: str(OFF(7))
_activePuzzleBuffer = (_zbasic->space(0xc) + _zbasic->str(OFF(8)) + _zbasic->space(0xc)).encode(Common::kMacRoman); // 1
- this->var_i16_233e = 1;
+ _justiceFirstMove = 1;
} else {
// 142:0b4c
- this->var_i16_233e = _zbasic->castInt(_zbasic->leftStr(_activePuzzleBuffer, 1));
+ _justiceFirstMove = _zbasic->castInt(_zbasic->leftStr(_activePuzzleBuffer, 1));
_activePuzzleBuffer = _zbasic->rightStr(_activePuzzleBuffer, 0x19);
}
// 142:0b7c
- for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- this->var_i16_103a = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_484, 1));
- if ((this->var_i16_103a & 2) == 0) {
- _zbasic->indexSet(_zbasic->str(OFF(9)), 1, (this->var_i16_484 + 0x19)); // bullet
+ for (int16 i = 1; i <= 0x19; i++) {
+ int16 drawData = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, i, 1));
+ if ((drawData & 2) == 0) {
+ _zbasic->indexRawSet(_zbasic->strRaw(OFF(9)), 1, (i + 0x19)); // bullet
} else {
// 142:0be0
- _zbasic->indexSet(_zbasic->str(OFF(10)), 1, (this->var_i16_484 + 0x19)); // wadjet
+ _zbasic->indexRawSet(_zbasic->strRaw(OFF(10)), 1, (i + 0x19)); // wadjet
}
// 142:0c06
- if ((this->var_i16_103a & 1) != 0) {
- this->justiceDrawBlock();
+ if ((drawData & 1) != 0) {
+ justiceDrawBlock(i);
} else {
- this->justiceRemoveBlock();
+ justiceRemoveBlock(i);
}
}
// 142:0c32
@@ -139,15 +139,15 @@ void FoolGame::sub_142_9be() {
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
// 142:0c42
while ((_stateFlags == 0) && (!_activePuzzleSolved)) {
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == 1) {
- this->justiceOnClick();
+ justiceOnClick();
}
}
// 142:0c76
if (_stateFlags == kStateSaveGame) {
- this->justiceStoreState();
- this->saveGame();
+ justiceStoreState();
+ saveGame();
}
// 142:0c88
}
@@ -155,125 +155,120 @@ void FoolGame::sub_142_9be() {
void FoolGame::justiceOnClick() {
// 142:0cb2
- this->var_i16_68a = (_event.where.x - 0x5a) / 0x32;
- this->var_i16_68c = (_event.where.y + 0xe) / 0x32;
- if ((this->var_i16_68a < 0) || (this->var_i16_68c < 0) || (this->var_i16_68a > 5) || (this->var_i16_68c > 5)) {
+ int16 gridX = (_event.where.x - 0x5a) / 0x32;
+ int16 gridY = (_event.where.y + 0xe) / 0x32;
+ if ((gridX < 0) || (gridY < 0) || (gridX > 5) || (gridY > 5)) {
return;
}
// 142:0d26
- this->var_i16_103a = (this->var_i16_68c - 1)*5 + this->var_i16_68a;
- if (this->arr_i16_3738[this->var_i16_103a] == 0) {
+ int16 gridIndex = (gridY - 1)*5 + gridX;
+ if (arr_i16_3738[gridIndex] == 0) {
return;
}
// 142:0d56
- _toolbox->InvertRoundRect(_screenGrid[this->var_i16_103a], 0x1e, 0x1e);
- if (_zbasic->index(1, this->var_i16_103a + 0x19) == _zbasic->str(OFF(11))) { // bullet
- _zbasic->indexSet(_zbasic->str(OFF(12)), 1, this->var_i16_103a + 0x19); // wadjet
+ _toolbox->InvertRoundRect(_screenGrid[gridIndex], 0x1e, 0x1e);
+ if (_zbasic->index(1, gridIndex + 0x19) == _zbasic->str(OFF(11))) { // bullet
+ _zbasic->indexSet(_zbasic->str(OFF(12)), 1, gridIndex + 0x19); // wadjet
}
// 142:0dc6
- if (this->var_i16_103a == 0xd) { // center button
- if (this->var_i16_233e == 0) {
- for (this->var_i16_484 = 1; this->var_i16_484 <= 0x19; this->var_i16_484++) {
- _zbasic->indexSet(_zbasic->str(OFF(13)), 1, this->var_i16_484 + 0x19); // bullet
- this->arr_i16_3738[this->var_i16_484] = 0;
- this->justiceRemoveBlock();
+ if (gridIndex == 0xd) { // center button
+ if (_justiceFirstMove == 0) {
+ for (int16 i = 1; i <= 0x19; i++) {
+ _zbasic->indexSet(_zbasic->str(OFF(13)), 1, i + 0x19); // bullet
+ arr_i16_3738[i] = 0;
+ justiceRemoveBlock(i);
}
- this->var_i16_233e = 1;
+ _justiceFirstMove = 1;
// redraw center tile
- this->var_i16_484 = 0xd;
- this->justiceDrawBlock();
+ justiceDrawBlock(0xd);
return;
}
// 142:0e3e
- this->var_i16_233e = 0;
+ _justiceFirstMove = 0;
}
// 142:0e44
- Common::String buffer = _zbasic->indexRaw(1, this->var_i16_103a);
+ Common::String buffer = _zbasic->indexRaw(1, gridIndex);
+ int16 offset = 2;
if (_zbasic->leftStr(buffer, 1) == _zbasic->str(OFF(14)).encode(Common::kMacRoman)) { // M
- this->var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(buffer, 2, 2));
- this->justiceDrawBlock();
- this->var_i16_2340 = 5;
- } else {
- // 142:0ea8
- this->var_i16_2340 = 2;
+ gridIndex = _zbasic->decodeInt(_zbasic->midStr(buffer, 2, 2));
+ justiceDrawBlock(gridIndex);
+ offset = 5;
}
// 142:0eae
- this->var_i16_2342 = _zbasic->decodeInt(_zbasic->midStr(buffer, this->var_i16_2340, 2));
- for (int16 i = 1; i <= this->var_i16_2342; i++) {
- this->var_i16_2340 += 2;
- this->var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(buffer, this->var_i16_2340, 2));
+ int16 blockCount = _zbasic->decodeInt(_zbasic->midStr(buffer, offset, 2));
+ for (int16 i = 1; i <= blockCount; i++) {
+ offset += 2;
+ gridIndex = _zbasic->decodeInt(_zbasic->midStr(buffer, offset, 2));
// 142:0ef0
- if (this->arr_i16_3738[this->var_i16_484] == 0) {
- this->justiceDrawBlock();
+ if (arr_i16_3738[gridIndex] == 0) {
+ justiceDrawBlock(gridIndex);
} else {
- this->justiceRemoveBlock();
+ justiceRemoveBlock(gridIndex);
}
}
// 142:0f20
_activePuzzleSolved = true;
for (int16 i = 1; i <= 0x19; i++) {
- if (this->arr_i16_3738[i] == 0) {
+ if (arr_i16_3738[i] == 0) {
_activePuzzleSolved = false;
}
}
- this->waitForMouseUp();
+ waitForMouseUp();
}
void FoolGame::justiceZoom() {
// 142:0f58
- this->zoomRect(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
+ zoomRect(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
}
-void FoolGame::justiceDrawBlock() {
+void FoolGame::justiceDrawBlock(int16 gridIndex) {
// 142:0f96
- this->arr_i16_3738[this->var_i16_484] = 1;
- this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ arr_i16_3738[gridIndex] = 1;
+ playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
_toolbox->PenNormal();
- _toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e, _patterns[0]);
- _toolbox->FrameRoundRect(_screenGrid[this->var_i16_484], 0x1e, 0x1e);
- _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
- this->var_str_384 = _zbasic->index(1, this->var_i16_484 + 0x19);
- this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_384);
+ _toolbox->FillRoundRect(_screenGrid[gridIndex], 0x1e, 0x1e, _patterns[0]);
+ _toolbox->FrameRoundRect(_screenGrid[gridIndex], 0x1e, 0x1e);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ Common::U32String label = _zbasic->index(1, gridIndex + 0x19);
+ int16 width = _toolbox->StringWidth(label);
// 142:1056
_toolbox->MoveTo(
- _screenGrid[this->var_i16_484].left + 0x19 - (this->var_i16_7e4/2),
- _screenGrid[this->var_i16_484].top + 0x1e
+ _screenGrid[gridIndex].left + 0x19 - (width/2),
+ _screenGrid[gridIndex].top + 0x1e
);
- _toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(label);
}
-void FoolGame::justiceRemoveBlock() {
+void FoolGame::justiceRemoveBlock(int16 gridIndex) {
// 142:10bc
- this->arr_i16_3738[this->var_i16_484] = 0;
- this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
- _toolbox->FillRect(_screenGrid[this->var_i16_484], _patterns[_zbasic->rndInt(0x4d)+3]);
+ arr_i16_3738[gridIndex] = 0;
+ playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ _toolbox->FillRect(_screenGrid[gridIndex], _patterns[_zbasic->rndInt(0x4d)+3]);
}
void FoolGame::justiceStoreState() {
// 142:111e
- this->var_str_384 = Common::U32String::format(" %d", this->var_i16_233e);
- _activePuzzleBuffer = _zbasic->rightStr(this->var_str_384, 1);
+ _activePuzzleBuffer = Common::String::format("%d", _justiceFirstMove);
for (int16 i = 1; i <= 0x19; i++) {
- this->var_i16_484 = this->arr_i16_3738[i];
+ int16 data = arr_i16_3738[i];
if (_zbasic->index(1, i + 0x19) == _zbasic->str(OFF(15))) { // wadjet
- this->var_i16_484 |= 2;
- this->var_str_384 = _zbasic->rightStr(Common::U32String::format(" %d", this->var_i16_484), 1);
- _activePuzzleBuffer += this->var_str_384;
+ data |= 2;
}
+ _activePuzzleBuffer += Common::String::format("%d", data);
}
// 142:11fc
}
void FoolGame::justiceResetGrid() {
// 142:11fe
- this->delay(0x28);
+ delay(0x28);
_activePuzzleBuffer.clear();
for (int16 i = 1; i <= 0x19; i++) {
- this->playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
+ playTone(_zbasic->rndInt(0x1f4) + 0x14, 0x28, 1);
_toolbox->FillRect(_screenGrid[i], _patterns[2]);
}
// 142:126e
- this->zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
}
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 4147abebbbf..d624a7cdd05 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -183,7 +183,7 @@ void FoolGame::mazeRun() {
void FoolGame::mazeOnClick() {
// 136:079e
- sub_128_2be(var_i16_68a, var_i16_68c);
+ getGridFromMouse(var_i16_68a, var_i16_68c);
if ((var_i16_68a == _mazePlayerX) && (var_i16_68c == _mazePlayerY)) {
return;
}
@@ -1099,9 +1099,9 @@ void FoolGame::mazeDrawPlayer() {
}
void FoolGame::mazeSetupMenu() {
- this->var_menu_bf8 = _toolbox->GetMHandle(8);
+ MenuHandle menu = _toolbox->GetMHandle(8);
_toolbox->DeleteMenu(8);
- _toolbox->DisposeMenu(this->var_menu_bf8);
+ _toolbox->DisposeMenu(menu);
// 136:274e
_zbasic->menu(8, 0, 1, _puzzleName[_activePuzzle]);
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 01dbb13e7dc..86176321150 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -89,9 +89,9 @@ void FoolGame::metapuzzleRun() {
// 138:0e7c
var_i16_c00 = 0;
if ((_stateFlags & kStateMetapuzzleComplete) == 0) {
- var_menu_bf8 = _toolbox->GetMHandle(8);
+ MenuHandle menu = _toolbox->GetMHandle(8);
_toolbox->DeleteMenu(8);
- _toolbox->DisposeMenu(var_menu_bf8);
+ _toolbox->DisposeMenu(menu);
_toolbox->DrawMenuBar();
copyScreen(1, arr_bmp_5dfc);
if ((_stateFlags & (kStateNewGame | kStateOpenGame | kStateQuit)) == 0) {
@@ -213,25 +213,25 @@ void FoolGame::metapuzzleSecretCode() {
zoomRect(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
}
if (_activePuzzle == 0x58) {
- var_str_1170 = _zbasic->str(OFF(4)); // treasure name
+ _metapuzzleSecretGoal = _zbasic->str(OFF(4)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 8;
_metapuzzleSecretCodeCipher = _zbasic->str(OFF(5)); // CQHXBMLGPTWIFRYASUVJZNKDOE
}
// 138:0650
if (_activePuzzle == 0x59) {
- var_str_1170 = _zbasic->str(OFF(6)); // treasure name
+ _metapuzzleSecretGoal = _zbasic->str(OFF(6)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 0;
_metapuzzleSecretCodeCipher = _zbasic->str(OFF(7)); // IEGADHFBCPLNRKQOJMZWTYVUSX
}
// 138:068a
if (_activePuzzle == 0x5a) {
- var_str_1170 = _zbasic->str(OFF(8)); // treasure name
+ _metapuzzleSecretGoal = _zbasic->str(OFF(8)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 5;
_metapuzzleSecretCodeCipher = _zbasic->str(OFF(9)); // ISDXMRCLHQYWBVPKGOUZTFNJAE
}
// 138:06c4
if (_activePuzzle == 0x5b) {
- var_str_1170 = _zbasic->str(OFF(10)); // treasure name
+ _metapuzzleSecretGoal = _zbasic->str(OFF(10)); // treasure name
_metapuzzleSecretCodeSpaceOffset = 9;
_metapuzzleSecretCodeCipher = _zbasic->str(OFF(11)); // ZYXWVUTSRQPONMLKJIHGFEDCBA
}
@@ -250,11 +250,11 @@ void FoolGame::metapuzzleSecretCode() {
metapuzzleSecretCodeReset();
} else {
// 138:0778
- var_str_1272 = _activePuzzleBuffer;
+ _metapuzzleSecretBuffer = _activePuzzleBuffer.decode(Common::kMacRoman);
_metapuzzleSecretCodeCount = 0;
var_i16_68a = 1;
- for (int16 i = 1; i <= (int16)var_str_1272.size(); i++) {
- if (_zbasic->midStr(var_str_1272, i, 1) != _zbasic->str(OFF(12))) { // ' '
+ for (int16 i = 1; i <= (int16)_metapuzzleSecretBuffer.size(); i++) {
+ if (_zbasic->midStr(_metapuzzleSecretBuffer, i, 1) != _zbasic->str(OFF(12))) { // ' '
_metapuzzleSecretCodeCount++;
}
// 138:07c2
@@ -273,7 +273,7 @@ void FoolGame::metapuzzleSecretCode() {
metapuzzleSecretCodeDrawText();
_keyLastPressed = 0;
}
- if (var_str_1272 == var_str_1170) {
+ if (_metapuzzleSecretBuffer == _metapuzzleSecretGoal) {
sub_138_a90();
}
// 138:081c
@@ -282,7 +282,7 @@ void FoolGame::metapuzzleSecretCode() {
if (_stateFlags == kStateUndo) {
metapuzzleSecretCodeReset();
}
- _activePuzzleBuffer = var_str_1272;
+ _activePuzzleBuffer = _metapuzzleSecretBuffer;
if (_stateFlags == kStateSaveGame) {
saveGame();
}
@@ -304,15 +304,15 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
_zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
_metapuzzleSecretCodeCount++;
if (_metapuzzleSecretCodeSpaceOffset == _metapuzzleSecretCodeCount) {
- if (_zbasic->leftStr(var_str_1170, _metapuzzleSecretCodeSpaceOffset - 1) == var_str_1272) {
- var_str_1272 += _zbasic->str(OFF(14)); // ' '
+ if (_zbasic->leftStr(_metapuzzleSecretGoal, _metapuzzleSecretCodeSpaceOffset - 1) == _metapuzzleSecretBuffer) {
+ _metapuzzleSecretBuffer += _zbasic->str(OFF(14)); // ' '
}
}
// 138:0946
var_str_d12 = _zbasic->midStr(_metapuzzleSecretCodeCipher, _keyLastPressed - 0x40, 1);
- var_str_1272 += var_str_d12;
- var_i16_484 = _toolbox->StringWidth(var_str_1272);
- var_i16_7e4 = _toolbox->StringWidth(var_str_1170);
+ _metapuzzleSecretBuffer += var_str_d12;
+ var_i16_484 = _toolbox->StringWidth(_metapuzzleSecretBuffer);
+ var_i16_7e4 = _toolbox->StringWidth(_metapuzzleSecretGoal);
if (var_i16_484 > var_i16_7e4) {
sub_138_a06();
} else {
@@ -329,7 +329,7 @@ void FoolGame::sub_138_9c4() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
_toolbox->FillRect(temp, _patterns[2]);
- drawTextCenter(var_str_1272, 0x146);
+ drawTextCenter(_metapuzzleSecretBuffer, 0x146);
}
void FoolGame::sub_138_a06() {
@@ -351,14 +351,14 @@ void FoolGame::metapuzzleSecretCodeReset() {
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
var_str_384 = _zbasic->str(OFF(15)); // if you know which is which, enter the letters you wish to switch
drawTextCenter(var_str_384, 0x140);
- var_str_1272.clear(); // was: str(OFF(16))
+ _metapuzzleSecretBuffer.clear(); // was: str(OFF(16))
_metapuzzleSecretCodeCount = 0;
}
void FoolGame::sub_138_a90() {
// 138:0a90
_stateFlags = kStateReturn;
- _activePuzzleBuffer = var_str_1272;
+ _activePuzzleBuffer = _metapuzzleSecretBuffer.encode(Common::kMacRoman);
menuClickMessage();
waitForMouseUp();
flashRect(arr_i16_1eb8[0], arr_i16_1eb8[1], arr_i16_1eb8[2], arr_i16_1eb8[3], 0xc8);
@@ -425,7 +425,7 @@ void FoolGame::metapuzzleOnShift() {
var_str_384 = _zbasic->str(OFF(17)); // the book of thoth
}
// 138:0d9e
- _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
var_i16_30 = _toolbox->StringWidth(var_str_384);
_toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
_toolbox->DrawString(var_str_384);
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index faf64489e6e..aefc238852c 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -43,30 +43,30 @@ void FoolGame::polyominoRun() {
// "the completed puzzle will reveal..."
hint = _zbasic->str(OFF(0)) + hint + _zbasic->str(OFF(1));
_zbasic->menu(8, 0xf, 1, hint);
- this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[8];
+ int16 gridIndex = 0;
+ int16 gridY = this->arr_i16_1eb8[8];
do {
// 133:009e
- this->var_i16_68a = this->arr_i16_1eb8[10];
+ int16 gridX = this->arr_i16_1eb8[10];
do {
// 133:00b2
- this->var_i16_484 += 1;
+ gridIndex++;
_toolbox->SetRect(
- _screenGrid[this->var_i16_484],
- this->var_i16_68a,
- this->var_i16_68c,
- this->var_i16_68a + this->arr_i16_1eb8[13],
- this->var_i16_68c + this->arr_i16_1eb8[12]
+ _screenGrid[gridIndex],
+ gridX,
+ gridY,
+ gridX + this->arr_i16_1eb8[13],
+ gridY + this->arr_i16_1eb8[12]
);
// 133:0112
} while (_zbasic->incrAndCheck(
- this->var_i16_68a,
+ gridX,
this->arr_i16_1eb8[11],
this->arr_i16_1eb8[6]
));
// 133:0142
} while (_zbasic->incrAndCheck(
- this->var_i16_68c,
+ gridY,
this->arr_i16_1eb8[9],
this->arr_i16_1eb8[7]
));
@@ -266,7 +266,7 @@ void FoolGame::polyominoRun() {
void FoolGame::polyominoOnClick() {
// 133:087c
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
debug(5, "FoolGame::polyominoOnClick: grid pos: (%d, %d)", this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
this->waitForMouseUp();
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index ee957d3893d..f3ab7337d6f 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -46,6 +46,8 @@ void FoolPrologue::run(bool finale) {
Common::MacFinderInfo finfo;
if (_toolbox->GetFInfo(Common::U32String("Prologue - Finale"), 0, finfo) == kNoErr) {
_zbasic->loadProgram(Common::Path("Prologue - Finale", ':'));
+ } else if (_toolbox->GetFInfo(Common::U32String("Prologue-Finale"), 0, finfo) == kNoErr) {
+ _zbasic->loadProgram(Common::Path("Prologue-Finale", ':'));
} else if (_toolbox->GetFInfo(Common::U32String("Prologue & Finale"), 0, finfo) == kNoErr) {
_zbasic->loadProgram(Common::Path("Prologue & Finale", ':'));
} else {
@@ -67,14 +69,14 @@ void FoolPrologue::run(bool finale) {
smallFOND->data()[3] = (byte)kPrologueFontSmall;
_toolbox->_injectFOND(exec, smallFOND->data(), smallFOND->size(), Common::String("Small Prologue"));
- sub_128_004(finale);
+ setup(finale);
delete _zbasic;
_zbasic = nullptr;
delete _toolbox;
_toolbox = nullptr;
}
-void FoolPrologue::sub_128_004(bool finale) {
+void FoolPrologue::setup(bool finale) {
var_i16_1aa = finale ? 2 : 1;
// 128:0004
@@ -180,7 +182,7 @@ void FoolPrologue::delay(int16 numTicks) {
void FoolPrologue::delayFromMarker(int16 numTicks) {
// 128:024a
- uint32 delay = (uint32)MAX<int>(var_i32_2 + numTicks + 1 - _toolbox->TickCount(), 0);
+ uint32 delay = (uint32)MAX<int>(_tickMarker + numTicks + 1 - _toolbox->TickCount(), 0);
// again, polling TickCount in a loop.
_toolbox->Delay(delay);
}
@@ -201,20 +203,22 @@ void FoolPrologue::drawTextCenter(const Common::U32String &str, int16 x, int16 y
void FoolPrologue::fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID) {
// 128:02f0
- _toolbox->SetRect(arr_rect_41af4, left, top, right, bottom);
- _toolbox->FillRect(arr_rect_41af4, _patterns[patternID]);
+ Common::Rect rect;
+ _toolbox->SetRect(rect, left, top, right, bottom);
+ _toolbox->FillRect(rect, _patterns[patternID]);
}
void FoolPrologue::zoomClose(int16 patternID, PatternMode mode) {
// 128:0354
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ Common::Rect rect;
+ _toolbox->SetRect(rect, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->PenPat(_patterns[patternID]);
_toolbox->PenMode(mode);
_toolbox->PenSize(6, 4);
for (int i = 0; i <= 130; i += 3) {
- _toolbox->FrameRect(arr_i16_1bc);
- _toolbox->InsetRect(arr_i16_1bc, 6, 4);
+ _toolbox->FrameRect(rect);
+ _toolbox->InsetRect(rect, 6, 4);
delay(0);
}
_toolbox->PenNormal();
@@ -234,7 +238,7 @@ void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
}
// 128:0428
for (int i = 1; i <= var_i16_18e; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->MoveTo(
arr_i16_1e8[i] - unk1,
arr_i16_1e8[i + 0x1f6] - unk1
@@ -250,7 +254,7 @@ void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
}
-void FoolPrologue::sub_128_50a(int16 screenPage, int16 left, int16 right, int16 updatePeriod) {
+void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16 right, int16 updatePeriod) {
// 128:050a
var_i32_40 = arr_i32_41296[screenPage];
var_i16_5c.left = left;
@@ -269,9 +273,9 @@ void FoolPrologue::sub_128_50a(int16 screenPage, int16 left, int16 right, int16
}
// 128:0584
for (int i = 0; i < SCREEN_HEIGHT; i++) {
- var_i32_2 = _toolbox->TickCount();
- var_i16_5c.top = arr_i16_412ea[i];
- var_i16_5c.bottom = arr_i16_412ea[i] + 1;
+ _tickMarker = _toolbox->TickCount();
+ var_i16_5c.top = _randScanline[i];
+ var_i16_5c.bottom = _randScanline[i] + 1;
_toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
if (i % updatePeriod == 0) {
delayFromMarker(0);
@@ -291,9 +295,9 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
_toolbox->PenPat(_patterns[patternID]);
// 128:0668
for (int i = 0; i < SCREEN_HEIGHT; i++) {
- var_i32_2 = _toolbox->TickCount();
- _toolbox->MoveTo(0, arr_i16_412ea[i]);
- _toolbox->LineTo(SCREEN_WIDTH, arr_i16_412ea[i]);
+ _tickMarker = _toolbox->TickCount();
+ _toolbox->MoveTo(0, _randScanline[i]);
+ _toolbox->LineTo(SCREEN_WIDTH, _randScanline[i]);
if (i % 5 == 0) {
delayFromMarker(0);
}
@@ -305,7 +309,7 @@ void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
var_i32_40 = arr_i32_41296[screenPage];
for (int i = 1; i <= 0x36; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
@@ -317,79 +321,77 @@ void FoolPrologue::zoomTransition(int16 screenPage) {
_toolbox->Delay(0);
}
-void FoolPrologue::sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9) {
+void FoolPrologue::zoomFlash(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 steps) {
// 128:0800
- arr_rect_41af4.top = unk1;
- arr_rect_41af4.left = unk2;
- arr_rect_41af4.bottom = unk3;
- arr_rect_41af4.right = unk4;
- arr_i16_41afc.top = unk5;
- arr_i16_41afc.left = unk6;
- arr_i16_41afc.bottom = unk7;
- arr_i16_41afc.right = unk8;
+ Common::Rect start; // arr_rect_41af4
+ Common::Rect end; // arr_rect_41afc
+ start.top = startTop;
+ start.left = startLeft;
+ start.bottom = startBottom;
+ start.right = startRight;
+ end.top = endTop;
+ end.left = endLeft;
+ end.bottom = endBottom;
+ end.right = endRight;
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
// 128:08bc
- arr_f64_41bbe[0] = (double)arr_rect_41af4.top;
- arr_f64_41bbe[1] = (double)arr_rect_41af4.left;
- arr_f64_41bbe[2] = (double)arr_rect_41af4.bottom;
- arr_f64_41bbe[3] = (double)arr_rect_41af4.right;
- arr_f64_41bbe[4] = (double)(arr_i16_41afc.top - arr_rect_41af4.top)/(double)(unk9);
- arr_f64_41bbe[5] = (double)(arr_i16_41afc.left - arr_rect_41af4.left)/(double)(unk9);
- arr_f64_41bbe[6] = (double)(arr_i16_41afc.bottom - arr_rect_41af4.bottom)/(double)(unk9);
- arr_f64_41bbe[7] = (double)(arr_i16_41afc.right - arr_rect_41af4.right)/(double)(unk9);
+ double buffer[16] = { 0 }; // arr_f64_41bbe
+ buffer[0] = (double)start.top;
+ buffer[1] = (double)start.left;
+ buffer[2] = (double)start.bottom;
+ buffer[3] = (double)start.right;
+ buffer[4] = (double)(end.top - start.top)/(double)(steps);
+ buffer[5] = (double)(end.left - start.left)/(double)(steps);
+ buffer[6] = (double)(end.bottom - start.bottom)/(double)(steps);
+ buffer[7] = (double)(end.right - start.right)/(double)(steps);
// 128:096e
- _toolbox->PaintRect(arr_rect_41af4);
- for (int i = 1; i <= (unk9 - 1); i++) {
- var_i32_2 = _toolbox->TickCount();
+ _toolbox->PaintRect(start);
+ for (int i = 1; i <= (steps - 1); i++) {
+ _tickMarker = _toolbox->TickCount();
// 128:098c
for (int j = 0; j <= 3; j++) {
- arr_f64_41bbe[j] += arr_f64_41bbe[j+4];
+ buffer[j] += buffer[j+4];
}
- arr_i16_41b0a.top = (int16)arr_f64_41bbe[0];
- arr_i16_41b0a.left = (int16)arr_f64_41bbe[1];
- arr_i16_41b0a.bottom = (int16)arr_f64_41bbe[2];
- arr_i16_41b0a.right = (int16)arr_f64_41bbe[3];
+ Common::Rect intermediate; // arr_rect_41b0a
+ intermediate.top = (int16)buffer[0];
+ intermediate.left = (int16)buffer[1];
+ intermediate.bottom = (int16)buffer[2];
+ intermediate.right = (int16)buffer[3];
// 128:0a2e
- _toolbox->PaintRect(arr_i16_41b0a);
+ _toolbox->PaintRect(intermediate);
delayFromMarker(0);
}
- _toolbox->PaintRect(arr_i16_41afc);
+ _toolbox->PaintRect(end);
_toolbox->PenNormal();
}
-void FoolPrologue::drawText(const Common::U32String &str, int16_t x, int16_t y) {
+void FoolPrologue::drawText(const Common::U32String &str, int16 x, int16 y) {
// 128:0a6c
_toolbox->MoveTo(x, y);
_toolbox->DrawString(str);
}
-void FoolPrologue::drawRainRecycle(int16_t unk) {
+void FoolPrologue::drawRainRecycle(int16 unk) {
// 128:0a8c
var_i16_1a4 = unk;
_toolbox->PenMode(kPatXor);
do {
// 128:0a96
drawRainDrop();
- arr_i16_1e8[var_i16_6] =
- arr_i16_1e8[0x2f1+var_i16_6]
- + arr_i16_1e8[var_i16_6];
-
- arr_i16_1e8[0xfb+var_i16_6] =
- arr_i16_1e8[0xfb+var_i16_6]
- + arr_i16_1e8[0x2f1+var_i16_6];
+ arr_i16_1e8[var_i16_6] = arr_i16_1e8[0x2f1+var_i16_6] + arr_i16_1e8[var_i16_6];
+ arr_i16_1e8[0xfb+var_i16_6] = arr_i16_1e8[0xfb+var_i16_6] + arr_i16_1e8[0x2f1+var_i16_6];
// 128:0b52
- if ((arr_i16_1e8[var_i16_6] > 0x1f4) || (arr_i16_1e8[var_i16_6 + 0xfb] > 0x140)) {
-
+ if ((arr_i16_1e8[var_i16_6] > 0x1f4) || (arr_i16_1e8[0xfb+var_i16_6] > 0x140)) {
// 128:0bae
arr_i16_1e8[var_i16_6] = _zbasic->rndInt(0x264) - 0xc8;
- arr_i16_1e8[0xfb + var_i16_6] = _zbasic->rndInt(0x1ba) - 0xc8;
- arr_i16_1e8[0x1f6 + var_i16_6] = _zbasic->rndInt(0x5) + 0x1;
- arr_i16_1e8[0x2f1 + var_i16_6] = _zbasic->rndInt(0xa) + 0x19;
+ arr_i16_1e8[0xfb+var_i16_6] = _zbasic->rndInt(0x1ba) - 0xc8;
+ arr_i16_1e8[0x1f6+var_i16_6] = _zbasic->rndInt(0x5) + 0x1;
+ arr_i16_1e8[0x2f1+var_i16_6] = _zbasic->rndInt(0xa) + 0x19;
}
// 128:0c56
drawRainDrop();
@@ -398,30 +400,27 @@ void FoolPrologue::drawRainRecycle(int16_t unk) {
var_i16_6 = 0;
_toolbox->Delay(0);
}
- } while (var_i32_2 + var_i16_1a4 > _toolbox->TickCount());
+ } while (_tickMarker + var_i16_1a4 > _toolbox->TickCount());
_toolbox->Delay(0);
}
-void FoolPrologue::sub_128_c8a() {
-
-}
-
void FoolPrologue::shuffleScanlines() {
_zbasic->unk_20();
- var_i32_1ac = (byte *)&arr_i16_41598[0];
- var_i32_1b0 = (byte *)&arr_i16_41846[0];
- var_i16_1b4 = var_i16_18e * 2;
+ int16 buf1[SCREEN_HEIGHT] = { 0 }; // arr_i16_41598
+ int16 buf2[SCREEN_HEIGHT] = { 0 }; // arr_i16_41846
+ byte *ptr1 = (byte *)&buf1[0]; // var_i32_1ac
+ byte *ptr2 = (byte *)&buf2[0]; // var_i32_1b0
// 128:0d00
- for (int i=0; i < var_i16_18e; i++) {
- arr_i16_41598[i] = i;
+ for (int i = 0; i < SCREEN_HEIGHT; i++) {
+ buf1[i] = i;
}
// 128:0d2a
- for (int i=var_i16_18e - 1; i >= 0; i--) {
- var_i16_1b6 = _zbasic->rndInt(i + 1) - 1;
- arr_i16_412ea[i] = arr_i16_41598[var_i16_1b6];
- var_i16_1b8 = var_i16_1b6 * 2 + 2;
- _zbasic->blockMove(var_i32_1ac + var_i16_1b8, var_i32_1b0 + var_i16_1b8, var_i16_1b4 - var_i16_1b8);
- _zbasic->blockMove(var_i32_1b0 + var_i16_1b8, var_i32_1ac + var_i16_1b8 - 2, var_i16_1b4 - var_i16_1b8);
+ for (int i = SCREEN_HEIGHT - 1; i >= 0; i--) {
+ int16 index = _zbasic->rndInt(i + 1) - 1;
+ _randScanline[i] = buf1[index];
+ int16 offset = index * 2 + 2;
+ _zbasic->blockMove(ptr1 + offset, ptr2 + offset, SCREEN_HEIGHT * 2 - offset);
+ _zbasic->blockMove(ptr2 + offset, ptr1 + offset - 2, SCREEN_HEIGHT * 2 - offset);
}
}
@@ -439,57 +438,57 @@ void FoolPrologue::drawClickMessageRightAlign() {
drawTextRight(_zbasic->str(4), 0x1fb, 0x154);
}
-void FoolPrologue::sub_128_e58() {
+void FoolPrologue::waitForClick() {
// 128:0e58
- sub_128_e80();
+ waitForMouseUp();
while (true) {
// was: 2
- var_i16_1ba = _toolbox->GetNextEvent(-1, var_ev_22);
- if (var_ev_22.what == kMouseDown)
+ var_i16_1ba = _toolbox->GetNextEvent(-1, _event);
+ if (_event.what == kMouseDown)
break;
- if ((var_ev_22.what == kScummVMQuitEvt) || (var_ev_22.what == kScummVMReturnToLauncherEvt)) {
+ if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
_quit = true;
return;
}
// wait until next redraw
- if (var_ev_22.what == kNullEvent)
+ if (_event.what == kNullEvent)
_toolbox->Delay(0);
}
- sub_128_e80();
+ waitForMouseUp();
}
-void FoolPrologue::sub_128_e80() {
+void FoolPrologue::waitForMouseUp() {
// 128:0e80
while (true) {
- var_i16_1ba = (int)_toolbox->GetNextEvent(-1, var_ev_22);
- if (var_ev_22.what == kUpdateEvt) {
- sub_128_ed2();
+ var_i16_1ba = (int)_toolbox->GetNextEvent(-1, _event);
+ if (_event.what == kUpdateEvt) {
+ onUpdateEvent();
}
- if (var_ev_22.what == kDiskEvt) {
- sub_128_ee0();
+ if (_event.what == kDiskEvt) {
+ onDiskEvent();
}
- if (var_ev_22.what == kScummVMQuitEvt || var_ev_22.what == kScummVMReturnToLauncherEvt) {
+ if (_event.what == kScummVMQuitEvt || _event.what == kScummVMReturnToLauncherEvt) {
_quit = true;
return;
}
// keep looping until mouse is seen as up??
// see I-252
- if ((var_ev_22.modifiers & kModMouseButtonUp) && (var_ev_22.what == kNullEvent)) {
+ if ((_event.modifiers & kModMouseButtonUp) && (_event.what == kNullEvent)) {
break;
}
// wait until next redraw
- if (var_ev_22.what == kNullEvent)
+ if (_event.what == kNullEvent)
_toolbox->Delay(0);
}
}
-void FoolPrologue::sub_128_ed2() {
+void FoolPrologue::onUpdateEvent() {
// 128:0ed2
_toolbox->BeginUpdate(var_window_24);
_toolbox->EndUpdate(var_window_24);
}
-void FoolPrologue::sub_128_ee0() {
+void FoolPrologue::onDiskEvent() {
// 128:0ee0
// done by using PEEKWORD into fixed offsets of the window pointer
//var_i16_1bc = &var_window_24; // +0
@@ -497,9 +496,6 @@ void FoolPrologue::sub_128_ee0() {
//_zbasic->unk11(var_i16_1be);
}
-void FoolPrologue::sub_128_f0a() {
- // _zbasic->pushOldCodeResource(0x80); // switch CODE resource?
-}
// Sources:
// QuickDraw types, Inside Macintosh I-201
@@ -529,56 +525,56 @@ void FoolPrologue::sub_129_004() {
// 0x000a: JSR - "PEEKLONG" # current A5
// 0x000e: SUBI.L - 0x72,D0
// 0x0014: JSR - "PEEKWORD" # quickdraw globals,
- var_i16_10 = g_engine->_wm._screenDims.width(); // window width?
- var_i16_12 = g_engine->_wm._screenDims.height(); // window height?
+ _windowWidth = g_engine->_wm._screenDims.width(); // window width?
+ _windowHeight = g_engine->_wm._screenDims.height(); // window height?
// 129:0034
// set left and top offsets based on a drawable area of 512x342
- var_i16_14 = (var_i16_10 - SCREEN_WIDTH)/2;
- var_i16_16 = (var_i16_12 - SCREEN_HEIGHT)/2;
+ _windowLeft = (_windowWidth - SCREEN_WIDTH)/2;
+ _windowTop = (_windowHeight - SCREEN_HEIGHT)/2;
// 129:0064
- _zbasic->window(1, "", 0, 0, var_i16_10, var_i16_12, kWindowDialogOneLine);
+ _zbasic->window(1, "", 0, 0, _windowWidth, _windowHeight, kWindowDialogOneLine);
_zbasic->coordinateWindow();
- var_i16_1c = { 0, 0, 0 };
+ RGBColor testColour = { 0, 0, 0 };
// code checks Rom85 for presence of 128K ROM before doing next bit
// 129:00a2
if (false) {
- var_i16_1c = { 0x4e20, 0x4e20, 0x4e20 };
- _toolbox->SetCPixel(0x64, 0x64, var_i16_1c);
- _toolbox->GetCPixel(0x64, 0x64, var_i16_1c);
+ testColour = { 0x4e20, 0x4e20, 0x4e20 };
+ _toolbox->SetCPixel(0x64, 0x64, testColour);
+ _toolbox->GetCPixel(0x64, 0x64, testColour);
}
// 129:00ee
// used for drawing on the menu bar
- var_i32_c = &arr_grafport_a8a;
- _toolbox->OpenPort(var_i32_c);
- //var_i32_c->portBits = _toolbox->_defaultMenuBits;
- //var_i32_c->portRect = _toolbox->_defaultMenuBits->getBounds();
+ _grafPtrMenu = &_grafPortMenu;
+ _toolbox->OpenPort(_grafPtrMenu);
+ //_grafPtrMenu->portBits = _toolbox->_defaultMenuBits;
+ //_grafPtrMenu->portRect = _toolbox->_defaultMenuBits->getBounds();
- var_i32_8 = &arr_grafport_9c0;
- _toolbox->OpenPort(var_i32_8);
+ _grafPtrWindow = &_grafPortWindow;
+ _toolbox->OpenPort(_grafPtrWindow);
- if ((var_i16_10 != SCREEN_WIDTH || var_i16_12 != SCREEN_HEIGHT)) {
+ if ((_windowWidth != SCREEN_WIDTH || _windowHeight != SCREEN_HEIGHT)) {
// 129:013a
- fillRect(0x14, 0, var_i16_12, var_i16_10, 2);
- _toolbox->SetRect(arr_i16_1bc, var_i16_14 - 2, var_i16_16 - 2, var_i16_14 + SCREEN_WIDTH + 2, var_i16_16 + SCREEN_HEIGHT + 2);
+ fillRect(MENU_HEIGHT, 0, _windowHeight, _windowWidth, 2);
+ _toolbox->SetRect(arr_i16_1bc, _windowLeft - 2, _windowTop - 2, _windowLeft + SCREEN_WIDTH + 2, _windowTop + SCREEN_HEIGHT + 2);
_toolbox->PenPat(_patterns[1]);
_toolbox->FrameRect(arr_i16_1bc);
}
// 129:01b0
- _toolbox->SetPort(var_i32_8);
+ _toolbox->SetPort(_grafPtrWindow);
_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->MovePortTo(var_i16_14, var_i16_16);
+ _toolbox->MovePortTo(_windowLeft, _windowTop);
_toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->ClipRect(arr_i16_1bc);
// 129:01f2
- if (var_i16_12 == SCREEN_HEIGHT) {
- _toolbox->SetRect(arr_i16_1bc, 0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
+ if (_windowHeight == SCREEN_HEIGHT) {
+ _toolbox->SetRect(arr_i16_1bc, 0, MENU_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->FillRect(arr_i16_1bc, _patterns[1]);
} else {
_toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -586,12 +582,12 @@ void FoolPrologue::sub_129_004() {
}
// 129:026c
- var_i32_32 = var_i32_8->portBits;
+ var_i32_32 = _grafPtrWindow->portBits;
var_i16_36 = 0x40;
- var_i16_38.top = -var_i16_16;
- var_i16_38.left = -var_i16_14;
- var_i16_38.bottom = var_i16_16 + SCREEN_HEIGHT;
- var_i16_38.right = var_i16_14 + SCREEN_WIDTH;
+ var_i16_38.top = -_windowTop;
+ var_i16_38.left = -_windowLeft;
+ var_i16_38.bottom = _windowTop + SCREEN_HEIGHT;
+ var_i16_38.right = _windowLeft + SCREEN_WIDTH;
var_i16_44 = 0x40;
var_i16_46.top = 0x0;
var_i16_46.left = 0x0;
@@ -622,7 +618,7 @@ void FoolPrologue::sub_129_004() {
drawTextCenter(_zbasic->str(8), 0x100, 0x96);
drawTextCenter(_zbasic->str(9), 0x100, 0xaa);
drawTextCenter(_zbasic->str(10), 0x100, 0xcb);
- sub_128_e58();
+ waitForClick();
if (_quit)
return;
@@ -645,7 +641,7 @@ void FoolPrologue::sub_129_004() {
// 1c4 == string
// 2c4 == unused
// 2c8 == volume number?
- var_i16_176 = _zbasic->finderInfo(var_i16_180, var_i16_1c4, var_i32_2c4, var_i16_2c8);
+ var_i16_176 = _zbasic->finderInfo(var_i16_180, var_i16_1c4, _tickMarkerc4, var_i16_2c8);
if (Common::U32String("") != var_i16_1c4) {
// 129:04de
// "and now it is time to show the finale" message
@@ -679,7 +675,7 @@ void FoolPrologue::sub_129_004() {
}
*/
// 129:05a6
- if (var_i16_1c.red + var_i16_1c.blue + var_i16_1c.green != 0) {
+ if (testColour.red + testColour.blue + testColour.green != 0) {
_toolbox->InitCursor();
_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, arr_i32_41296[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x00);
@@ -697,14 +693,14 @@ void FoolPrologue::sub_129_004() {
drawTextCenter(_zbasic->str(17), 0x100, 0xcb);
// 129:0730
- sub_128_e58();
+ waitForClick();
if (_quit)
return;
_zbasic->put(0x0, 0x14, arr_i32_41296[0], kSrcCopy);
var_i16_1aa = 0;
} else {
// 129:075c
- sub_128_e80();
+ waitForMouseUp();
}
// 129:0772
@@ -719,7 +715,8 @@ void FoolPrologue::sub_129_764() {
void FoolPrologue::prologueRun() {
// 130:0004
- var_i16_3ce = 5;
+ _prologueLoading = 5;
+ _prologuePicIndex = 0;
prologueDrawLoadingMsg();
var_i16_18e = SCREEN_HEIGHT;
// fill a buffer with random screen y-positions, to use for the scanline transition
@@ -734,13 +731,13 @@ void FoolPrologue::prologueRun() {
// - Release the resource
// "The Fool's Errand" title card
- glob_i32_2ce = _toolbox->GetPicture(0x47);
- var_i16_3ce = 10;
+ PicHandle picTitle = _toolbox->GetPicture(0x47);
+ _prologueLoading = 10;
prologueDrawLoadingMsg();
setPortBitsToPage(0xb);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x74, 0xaa, glob_i32_2ce);
- _toolbox->ReleaseResource(glob_i32_2ce);
+ _zbasic->picture(0x74, 0xaa, picTitle);
+ _toolbox->ReleaseResource(picTitle);
// 130:007a
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcBic);
@@ -765,7 +762,6 @@ void FoolPrologue::prologueRun() {
// 130:015c
for (int i = 3; i <= 5; i++) {
- //_zbasic->blockMove(arr_i32_41296[7], arr_i32_41296[i], 0x5580);
arr_i32_41296[i]->copyFrom(*arr_i32_41296[7]);
}
// high priestess skull
@@ -778,7 +774,6 @@ void FoolPrologue::prologueRun() {
// high priestess face
prologueBufferNextPicture();
- //_zbasic->blockMove(arr_i32_41296[0], arr_i32_41296[1], 0x5580);
arr_i32_41296[1]->copyFrom(*arr_i32_41296[0]);
setPortBitsToPage(1);
@@ -831,14 +826,14 @@ void FoolPrologue::prologueRun() {
_toolbox->SetPortBits(var_i32_32);
// 130:0380
- if ((var_i16_10 == SCREEN_WIDTH) && (var_i16_12 == SCREEN_HEIGHT)) {
+ if ((_windowWidth == SCREEN_WIDTH) && (_windowHeight == SCREEN_HEIGHT)) {
fillRect(0, 0, 0x14, SCREEN_WIDTH, 1);
} else {
- // FIXME: menu draw code not used
- /*_toolbox->SetPort(var_i32_c);
- fillRect(0, 0, 0x14, var_i16_10, 2);
+ // NOTE: menu draw code not used
+ _toolbox->SetPort(_grafPtrMenu);
+ fillRect(0, 0, 0x14, _windowWidth, 2);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(var_i32_8);*/
+ _toolbox->SetPort(_grafPtrWindow);
}
// We're done loading, start the intro.
@@ -861,30 +856,30 @@ void FoolPrologue::prologueRun() {
// 130:043c
for (int i = 1; i <= 2; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
drawRainRecycle(0xb4);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InvertRect(arr_i16_1bc);
delayFromMarker(1);
_toolbox->InvertRect(arr_i16_1bc);
// 130:04ca
for (int j = 0; j <= 3; j++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[8];
// 130:049e
_toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
drawRainRecycle(4);
var_i16_192 = 0;
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[3];
_toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
drawRainRecycle(5);
// 130:0518
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[4];
_toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
drawRainRecycle(5);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[5];
_toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
drawRainRecycle(5);
@@ -898,7 +893,7 @@ void FoolPrologue::prologueRun() {
// 130:05fc
blitPageToScreen(0);
drawRain();
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
drawRainRecycle(0xb4);
var_i32_40 = arr_i32_41296[1];
@@ -908,14 +903,14 @@ void FoolPrologue::prologueRun() {
int y = 0;
while (y != SCREEN_HEIGHT) {
var_i16_5c.right = SCREEN_WIDTH;
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
var_i16_192 = 1;
if (y < SCREEN_HEIGHT) {
y += 1;
}
- var_i16_5c.top = arr_i16_412ea[y];
- var_i16_5c.bottom = arr_i16_412ea[y] + 1;
+ var_i16_5c.top = _randScanline[y];
+ var_i16_5c.bottom = _randScanline[y] + 1;
// 130:068e
_toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
}
@@ -925,21 +920,21 @@ void FoolPrologue::prologueRun() {
// lightning flash over priestess face
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
drawRainRecycle(0xa);
blitPageToScreen(1);
// 130:06d4
for (int i = 1; i <= 4; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InvertRect(arr_i16_1bc);
drawRainRecycle(0x2);
}
// 130:0704
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InvertRect(arr_i16_1bc);
drawRainRecycle(0xf);
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
_toolbox->InvertRect(arr_i16_1bc);
drawRainRecycle(0x78);
@@ -948,7 +943,7 @@ void FoolPrologue::prologueRun() {
// 130:0740
drawRain();
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
drawRainRecycle(0xb4);
_toolbox->SetRect(arr_i32_1c4, 0, 0, 0x150, 0x96);
@@ -957,7 +952,7 @@ void FoolPrologue::prologueRun() {
// 130:0778
for (int j = 0; j <= 8; j++) {
for (int i = 3; i <= 5; i++) {
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i32_40 = arr_i32_41296[i];
_toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
drawRainRecycle(3);
@@ -969,9 +964,11 @@ void FoolPrologue::prologueRun() {
blitPageToScreen(6);
_toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i <= 0x2d; i++) {
- var_i32_2 = _toolbox->TickCount();
- // seizure warning
- _toolbox->InvertRect(arr_i16_1bc);
+ _tickMarker = _toolbox->TickCount();
+ // limit flashing to WCAG recommendation of 6/second
+ if (((i % 10) == 0) || ((i % 10) == 2)) {
+ _toolbox->InvertRect(arr_i16_1bc);
+ }
delayFromMarker(1);
}
@@ -996,7 +993,7 @@ void FoolPrologue::prologueRun() {
_toolbox->ReleaseResource(_pics[0xe]);
// start loading some new resources from the floppy disk into the screen buffers
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
// 130:0890
_zbasic->restore(0);
setPortBitsToPage(0);
@@ -1014,7 +1011,6 @@ void FoolPrologue::prologueRun() {
drawClickMessage();
// 130:0934
for (int i = 2; i <= 5; i++) {
- //_zbasic->blockMove(arr_i32_41296[1], arr_i32_41296[i], 0x5580);
arr_i32_41296[i]->copyFrom(*arr_i32_41296[1]);
}
// 130:0978
@@ -1037,7 +1033,6 @@ void FoolPrologue::prologueRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0x166, 0x77, _pics[0x11]);
drawClickMessage();
- //_zbasic->blockMove(arr_i32_41296[6], arr_i32_41296[7], 0x5580);
arr_i32_41296[7]->copyFrom(*arr_i32_41296[6]);
prologueRenderNextText();
_toolbox->ReleaseResource(_pics[0x11]);
@@ -1047,7 +1042,6 @@ void FoolPrologue::prologueRun() {
prologueRenderNextText();
_toolbox->ReleaseResource(_pics[0x12]);
setPortBitsToPage(8);
- //_zbasic->blockMove(arr_i32_41296[7], arr_i32_41296[8], 0x5580);
arr_i32_41296[8]->copyFrom(*arr_i32_41296[7]);
fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
_zbasic->picture(0x16d, 0x80, _pics[0x48]);
@@ -1056,7 +1050,7 @@ void FoolPrologue::prologueRun() {
// 130:0b74
delayFromMarker(0xd2);
- sub_128_e80();
+ waitForMouseUp();
if (_quit)
return;
scanlineTransition(1);
@@ -1067,15 +1061,15 @@ void FoolPrologue::prologueRun() {
zoomTransition(0);
// stall until mouse click
- sub_128_e58();
+ waitForClick();
if (_quit)
return;
// 130:0b98
var_i16_74 = 0;
var_i16_192 = 1;
- while (var_ev_22.what != kMouseDown) {
+ while (_event.what != kMouseDown) {
// 130:0ba4
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i16_74 += var_i16_192;
// 130:0bbe
if (var_i16_74 == 0x5) {
@@ -1087,11 +1081,11 @@ void FoolPrologue::prologueRun() {
blitPageToScreen(var_i16_74);
delayFromMarker(0xa);
// 130:0bee
- var_i16_1ba = _toolbox->GetNextEvent(2, var_ev_22);
+ var_i16_1ba = _toolbox->GetNextEvent(2, _event);
}
- while (!((var_ev_22.what == kNullEvent) && (var_ev_22.modifiers & kModMouseButtonUp))) {
+ while (!((_event.what == kNullEvent) && (_event.modifiers & kModMouseButtonUp))) {
// 130:0c0c
- var_i32_2 = _toolbox->TickCount();
+ _tickMarker = _toolbox->TickCount();
var_i16_74 += var_i16_192;
// 130:0c26
if (var_i16_74 == 0x5) {
@@ -1103,26 +1097,26 @@ void FoolPrologue::prologueRun() {
blitPageToScreen(var_i16_74);
delayFromMarker(0xa);
// 130:0c56
- var_i16_1ba = _toolbox->GetNextEvent(-1, var_ev_22);
- if (var_ev_22.what == kUpdateEvt) {
- sub_128_ed2();
+ var_i16_1ba = _toolbox->GetNextEvent(-1, _event);
+ if (_event.what == kUpdateEvt) {
+ onUpdateEvent();
}
- if (var_ev_22.what == kDiskEvt) {
- sub_128_ee0();
+ if (_event.what == kDiskEvt) {
+ onDiskEvent();
}
}
// 130:0ca8
// "who dares to interrupt my errand"
blitPageToScreen(0x6);
- sub_128_e58();
+ waitForClick();
if (_quit)
return;
- sub_128_50a(7, 0, SCREEN_WIDTH, 0);
+ scanlineBlitPageToScreen(7, 0, SCREEN_WIDTH, 0);
delay(0xa);
// "I dare"
blitPageToScreen(0x8);
- sub_128_e58();
+ waitForClick();
if (_quit)
return;
@@ -1137,10 +1131,10 @@ void FoolPrologue::prologueRun() {
void FoolPrologue::prologueBufferNextPicture() {
// 130:0cea
- var_i16_3d4 += 1;
- _pics[var_i16_3d4] = _toolbox->GetPicture(var_i16_3d4);
+ _prologuePicIndex += 1;
+ _pics[_prologuePicIndex] = _toolbox->GetPicture(_prologuePicIndex);
// 130:0d0a
- var_i16_3ce = var_i16_3d4 * 5 + 10;
+ _prologueLoading = _prologuePicIndex * 5 + 10;
prologueDrawLoadingMsg();
}
@@ -1148,19 +1142,19 @@ void FoolPrologue::prologueDrawLoadingMsg() {
// FIXME: we don't share the menu surface here yet
return;
// 130:0d28
- _toolbox->SetPort(var_i32_c);
+ _toolbox->SetPort(_grafPtrMenu);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// "loading prologue" message
- var_str_76 = _zbasic->str(19);
- var_str_76 += Common::U32String::format(" %d", var_i16_3ce);
- var_str_76 += _zbasic->str(20);
+ Common::U32String msg = _zbasic->str(19);
+ msg += Common::U32String::format(" %d", _prologueLoading);
+ msg += _zbasic->str(20);
// 130:0d70
// white out the contents of the top menu bar.
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
- fillRect(0, 0x7, 0x13, var_i16_10 - 7, 0);
- drawTextCenter(var_str_76, var_i16_10/2, 0xe);
+ fillRect(0, 0x7, 0x13, _windowWidth - 7, 0);
+ drawTextCenter(msg, _windowWidth/2, 0xe);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(var_i32_8);
+ _toolbox->SetPort(_grafPtrWindow);
_toolbox->Delay(0);
}
@@ -1196,8 +1190,8 @@ void FoolPrologue::drawRainDrop() {
void FoolPrologue::prologueRenderNextText() {
// 130:0f48
- var_i16_3d2 = _zbasic->readDataInt();
- for (int i = 1; i <= var_i16_3d2; i++) {
+ int16 count = _zbasic->readDataInt();
+ for (int i = 1; i <= count; i++) {
// 130:0f56
var_i16_176 = _zbasic->readDataInt();
var_i16_180 = _zbasic->readDataInt();
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 6ed99468712..c795d349205 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -47,7 +47,7 @@ public:
void run(bool finale);
- void sub_128_004(bool finale);
+ void setup(bool finale); // sub_128_004
void copyScreenToPage(int16 screenPage); // sub_128_1ba
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
@@ -57,22 +57,20 @@ public:
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_2f0
void zoomClose(int16 patternID, PatternMode mode); // sub_128_354
void drawTreasurePhaseIn(int16 unk1); // sub_128_3ee
- void sub_128_50a(int16 screenPage, int16 left, int16 right, int16 updatePeriod);
+ void scanlineBlitPageToScreen(int16 screenPage, int16 left, int16 right, int16 updatePeriod); // sub_128_50a
void blitPageToScreen(int16 screenPage); // sub_128_610
void scanlineTransition(int16 patternID); // sub_128_64a
void zoomTransition(int16 screenPage); // sub_128_6e4
- void sub_128_800(int16_t unk1, int16_t unk2, int16_t unk3, int16_t unk4, int16_t unk5, int16_t unk6, int16_t unk7, int16_t unk8, int16_t unk9);
- void drawText(const Common::U32String &str, int16_t x, int16_t y); // sub_128_a6c
- void drawRainRecycle(int16_t unk); // sub_128_a8c
- void sub_128_c8a();
+ void zoomFlash(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 steps); // sub_128_800
+ void drawText(const Common::U32String &str, int16 x, int16 y); // sub_128_a6c
+ void drawRainRecycle(int16 unk); // sub_128_a8c
void shuffleScanlines(); // sub_128_ccc
void drawClickMessage(); // sub_128_de2
void drawClickMessageRightAlign(); // sub_128_e1c
- void sub_128_e58();
- void sub_128_e80();
- void sub_128_ed2();
- void sub_128_ee0();
- void sub_128_f0a();
+ void waitForClick(); // sub_128_e58
+ void waitForMouseUp(); // sub_128_e80
+ void onUpdateEvent(); // sub_128_ed2
+ void onDiskEvent(); // sub_128_ee0
void sub_129_004();
void sub_129_764();
@@ -98,18 +96,17 @@ private:
bool _quit = false;
// last tick count
- uint32 var_i32_2;
+ uint32 _tickMarker; // var_i32_2
int16 var_i16_6;
- GrafPtr var_i32_8;
- GrafPtr var_i32_c;
+ GrafPtr _grafPtrWindow; // var_i32_8
+ GrafPtr _grafPtrMenu; // var_i32_c
- int16 var_i16_10;
- int16 var_i16_12;
- int16 var_i16_14;
- int16 var_i16_16;
- RGBColor var_i16_1c;
+ int16 _windowWidth; // var_i16_10
+ int16 _windowHeight; // var_i16_12
+ int16 _windowLeft; // var_i16_14
+ int16 _windowTop; // var_i16_16
- EventRecord var_ev_22;
+ EventRecord _event; // var_ev_22
WindowRecord var_window_24;
@@ -163,14 +160,8 @@ private:
int16 var_i16_2cc;
Common::U32String var_i16_2ce;
- int16 var_i16_3ce;
- int16 var_i16_3d2;
- int16 var_i16_3d4;
- PolyHandle var_i32_3d6;
- int16 var_i16_3da;
- int16 var_i16_3dc;
- int16 var_i16_3e0;
- int16 var_i16_3e2;
+ int16 _prologueLoading; // var_i16_3ce
+ int16 _prologuePicIndex; // var_i16_3d4
int16 var_i16_3e6;
int16 var_i16_3ec;
@@ -189,10 +180,8 @@ private:
int16 arr_i16_1e8[1004] = { 0 };
- GrafPort arr_grafport_9c0;
- GrafPort arr_grafport_a8a;
-
- byte arr_i32_b54[SCREEN_PAGE_SIZE*12];
+ GrafPort _grafPortWindow; // arr_i32_9c0
+ GrafPort _grafPortMenu; // arr_i32_a8a
BitMap arr_i32_1e3fc[16];
@@ -200,9 +189,7 @@ private:
BitMap arr_i32_41296[12];
- int16 arr_i16_412ea[SCREEN_HEIGHT] = { 0 };
- int16 arr_i16_41598[SCREEN_HEIGHT] = { 0 };
- int16 arr_i16_41846[SCREEN_HEIGHT] = { 0 };
+ int16 _randScanline[SCREEN_HEIGHT] = { 0 }; // arr_i16_412ea
int16 arr_i16_41af4[32];
Common::Rect arr_rect_41af4;
@@ -212,9 +199,6 @@ private:
double arr_f64_41bbe[16] = { 0 };
- PicHandle glob_i32_2ce;
-
-
};
} // End of namespace Fool
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 019f2541908..6b43aa01d73 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -75,13 +75,13 @@ void FoolGame::revealRun() {
this->arr_i16_1eb8[17] = (0x1c2 / this->arr_i16_1eb8[15]);
this->arr_i16_1eb8[18] = 0x100 - ((this->arr_i16_1eb8[15] * this->arr_i16_1eb8[17]) / 2);
- this->var_str_1272 = puzzlesReadString();
+ Common::U32String letters = puzzlesReadString().decode(Common::kMacRoman);
this->zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
this->zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
// 134:02f0
this->arr_i16_1eb8[19] = _zbasic->decodeInt(_activePuzzleBuffer);
this->var_i16_1aba = this->arr_i16_1eb8[18];
- _zbasic->text(_fontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
this->playTone(
@@ -100,7 +100,7 @@ void FoolGame::revealRun() {
_toolbox->FillRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19, _patterns[0]);
_toolbox->FrameRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
// 134:0448
- this->var_str_384 = _zbasic->midStr(this->var_str_1272, this->var_i16_7be, 1);
+ this->var_str_384 = _zbasic->midStr(letters, this->var_i16_7be, 1);
this->var_i16_7ba = _toolbox->StringWidth(this->var_str_384);
_toolbox->MoveTo(
_screenGrid[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index b1eba60492f..2345304cd15 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -191,7 +191,7 @@ void FoolGame::sentenceOnClick() {
if (buttonsRemaining) {
return;
}
- _zbasic->text(_fontChicago, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcBic);
drawTextCenter(_zbasic->str(OFF(4)), 0x124); // click mouse to reset puzzle
this->waitForMouseUp();
@@ -267,7 +267,7 @@ void FoolGame::sentenceUndo() {
void FoolGame::sentenceDrawButton(int16 gridIndex) {
// 135:0a34
- _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
Common::U32String buf = Common::U32String::format("%d", gridIndex) + _zbasic->str(OFF(6)); // ' '
int16 width = _toolbox->StringWidth(buf);
_toolbox->FillOval(_screenGrid[gridIndex], _patterns[0]);
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index 39e4d271be1..db3619398d9 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -36,21 +36,22 @@ void FoolGame::straightPathRun() {
for (int16 i = 0; i <= 0xe; i++) {
arr_i16_1eb8[i] = puzzlesReadShort();
}
- var_i16_484 = 0;
- var_i16_68c = arr_i16_1eb8[8];
+ int16 gridIndex = 0;
+ int16 gridX = arr_i16_1eb8[10];
+ int16 gridY = arr_i16_1eb8[8];
do {
- var_i16_68a = arr_i16_1eb8[10];
+ gridX = arr_i16_1eb8[10];
do {
- var_i16_484++;
+ gridIndex++;
_toolbox->SetRect(
- _screenGrid[var_i16_484],
- var_i16_68a,
- var_i16_68c,
- var_i16_68a + arr_i16_1eb8[13] - 1,
- var_i16_68c + arr_i16_1eb8[12] - 1
+ _screenGrid[gridIndex],
+ gridX,
+ gridY,
+ gridX + arr_i16_1eb8[13] - 1,
+ gridY + arr_i16_1eb8[12] - 1
);
- } while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
- } while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(gridX, arr_i16_1eb8[11], arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(gridY, arr_i16_1eb8[9], arr_i16_1eb8[7]));
// 143:0128
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
@@ -59,15 +60,15 @@ void FoolGame::straightPathRun() {
}
}
// 143:01a4
- var_str_1272.clear(); // was: str(366)
+ _straightPathGoal.clear(); // was: str(366)
arr_i16_1eb8[15] = puzzlesReadShort();
for (int16 i = 1; i <= arr_i16_1eb8[15]; i++) {
- var_i16_1a96 = puzzlesReadByte();
- var_i16_1a98 = puzzlesReadByte();
+ gridX = puzzlesReadByte();
+ gridY = puzzlesReadByte();
_zbasic->indexRawSet(puzzlesReadString(), 1, i);
- arr_i16_2f38[var_i16_1a96*32 + var_i16_1a98] = i;
- arr_i16_3b38[var_i16_1a96*32 + var_i16_1a98] = _zbasic->asc(_zbasic->leftStr(_zbasic->index(1, i), 1));
- var_str_1272 += _zbasic->index(1, i);
+ arr_i16_2f38[gridX*32 + gridX] = i;
+ arr_i16_3b38[gridX*32 + gridY] = _zbasic->asc(_zbasic->leftStr(_zbasic->index(1, i), 1));
+ _straightPathGoal += _zbasic->indexRaw(1, i);
// 143:0276
}
_zbasic->text(kFontPuzzle, arr_i16_1eb8[14], 0, kSrcOr);
@@ -81,25 +82,24 @@ void FoolGame::straightPathRun() {
temp.right = SCREEN_WIDTH;
_toolbox->FillRect(temp, _patterns[0]);
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
- var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
+ gridIndex = (j - 1)*arr_i16_1eb8[0] + i;
if (arr_i16_3b38[i*32 + j] == 0) {
// 143:03c4
arr_i16_3b38[i*32 + j] = _zbasic->rndInt(0x1a) + 0x40;
}
// 143:03f0
_toolbox->MoveTo(
- _screenGrid[var_i16_1574].left + arr_i16_1eb8[2] - 1,
- _screenGrid[var_i16_1574].top + arr_i16_1eb8[3]
+ _screenGrid[gridIndex].left + arr_i16_1eb8[2] - 1,
+ _screenGrid[gridIndex].top + arr_i16_1eb8[3]
);
- var_str_384 = _zbasic->chr(arr_i16_3b38[i*32 + j]);
- _toolbox->DrawString(var_str_384);
+ _toolbox->DrawString(_zbasic->chr(arr_i16_3b38[i*32 + j]));
}
}
straightPathDrawText();
// 143:04cc
- var_i16_1574 = 0;
+ _straightPathSelected = 0;
_stateFlags = kStateNull;
- _activePuzzleSolved = (var_str_1272 == _activePuzzleBuffer);
+ _activePuzzleSolved = (_straightPathGoal == _activePuzzleBuffer);
// JMP 0x582
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
@@ -112,7 +112,7 @@ void FoolGame::straightPathRun() {
if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
straightPathReset();
}
- if (var_str_1272 == _activePuzzleBuffer) {
+ if (_straightPathGoal == _activePuzzleBuffer) {
_activePuzzleSolved = true;
}
}
@@ -129,18 +129,20 @@ void FoolGame::straightPathRun() {
void FoolGame::straightPathOnClick() {
// 143:05c0
- sub_128_2be(var_i16_68a, var_i16_68c);
- if (var_i16_1574 > 0) {
- _toolbox->InvertRect(_screenGrid[var_i16_1574]);
- var_i16_1574 = 0;
+ int16 gridX = 0;
+ int16 gridY = 0;
+ getGridFromMouse(gridX, gridY);
+ if (_straightPathSelected > 0) {
+ _toolbox->InvertRect(_screenGrid[_straightPathSelected]);
+ _straightPathSelected = 0;
}
// 143:05fc
- if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1]))
+ if ((gridX < 1) || (gridX > arr_i16_1eb8[0]) || (gridY < 1) || (gridY > arr_i16_1eb8[1]))
return;
// 143:066c
_activePuzzleStatus++;
- if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] != _activePuzzleStatus) {
- _activePuzzleBuffer += _zbasic->chr(arr_i16_3b38[var_i16_68a*32 + var_i16_68c]);
+ if (arr_i16_2f38[gridX*32 + gridY] != _activePuzzleStatus) {
+ _activePuzzleBuffer += _zbasic->chr(arr_i16_3b38[gridX*32 + gridY]);
} else {
// 143:06d8
_activePuzzleBuffer += _zbasic->indexRaw(1, _activePuzzleStatus);
@@ -148,11 +150,11 @@ void FoolGame::straightPathOnClick() {
// 143:06fa
straightPathDrawText();
if (_activePuzzleStatus < arr_i16_1eb8[15]) {
- var_i16_1574 = (var_i16_68c - 1)*arr_i16_1eb8[0] + var_i16_68a;
- _toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _straightPathSelected = (gridY - 1)*arr_i16_1eb8[0] + gridX;
+ _toolbox->InvertRect(_screenGrid[_straightPathSelected]);
} else {
// 143:0766
- if (_activePuzzleBuffer != var_str_1272.encode(Common::kMacRoman)) {
+ if (_activePuzzleBuffer != _straightPathGoal) {
straightPathReset();
}
}
@@ -162,20 +164,21 @@ void FoolGame::straightPathOnClick() {
void FoolGame::straightPathReset() {
// 143:0784
- if (var_i16_1574 > 0) {
- _toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ if (_straightPathSelected > 0) {
+ _toolbox->InvertRect(_screenGrid[_straightPathSelected]);
}
// 143:07a4
for (int16 i = 0; i <= 0x14; i++) {
- var_i16_1574 = _zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
- _toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ int16 gridIndex = _zbasic->rndInt(arr_i16_1eb8[0] * arr_i16_1eb8[1]);
+ _toolbox->InvertRect(_screenGrid[gridIndex]);
+ _toolbox->Delay(0);
playTone(_zbasic->rndInt(0x2328) + 0xf, 0x28, true);
// 143:0812
- _toolbox->InvertRect(_screenGrid[var_i16_1574]);
+ _toolbox->InvertRect(_screenGrid[gridIndex]);
}
_activePuzzleStatus = 0;
_activePuzzleBuffer.clear(); // was: str(367)
- var_i16_1574 = 0;
+ _straightPathSelected = 0;
_keyLastPressed = 0;
straightPathClearText();
}
@@ -199,8 +202,8 @@ void FoolGame::straightPathSuccess() {
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
if (arr_i16_2f38[i*32 + j] == 0) {
- var_i16_1574 = (j - 1)*arr_i16_1eb8[0] + i;
- _toolbox->PaintRect(_screenGrid[var_i16_1574]);
+ int16 gridIndex = (j - 1)*arr_i16_1eb8[0] + i;
+ _toolbox->PaintRect(_screenGrid[gridIndex]);
}
// 143:0936
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 4132a02102d..f54de217a81 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -127,7 +127,7 @@ void FoolGame::sunMapRun() {
void FoolGame::sunMapOnClick() {
// 137:03e2
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) ||
(this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
return;
@@ -162,7 +162,7 @@ void FoolGame::sunMapDragSelect() {
// 137:0598
do {
this->getNextEvent(4);
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->var_i16_68a >= this->arr_i16_4758[0]) {
this->arr_i16_4758[2] = this->arr_i16_4758[0];
@@ -199,7 +199,7 @@ void FoolGame::sunMapMoveSelected() {
// 137:0880
do {
this->getNextEvent(2);
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (this->arr_i16_4758[0] >= 0) {
this->arr_i16_4758[4] = this->var_i16_68a;
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 473fdf72e2f..99d9502d52f 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -61,7 +61,7 @@ void FoolGame::highPriestessRun() {
}
// 140:007e
_toolbox->SetCursor(_cursors[0x10]);
- this->sub_140_2f92();
+ this->thothSetupMenu();
if (_activePuzzleStatus == 2) {
this->thothKey2nd();
if (!_activePuzzleSolved) {
@@ -327,15 +327,15 @@ void FoolGame::thothDrawEnchantment() {
_toolbox->PenNormal();
_toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
_toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
- _zbasic->text(_fontChicago, 0xc, 0, kSrcOr);
- this->var_str_384 = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(OFF(10))
- this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
+ _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ Common::U32String label = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(OFF(10))
+ int16 width = _toolbox->StringWidth(label);
// 140:0bd2
_toolbox->MoveTo(
- _screenGrid[this->arr_i16_1eb8[2]].left + 0x14 - (this->var_i16_484 / 2),
+ _screenGrid[this->arr_i16_1eb8[2]].left + 0x14 - (width / 2),
_screenGrid[this->arr_i16_1eb8[2]].top + 0x18
);
- _toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(label);
}
void FoolGame::sub_140_c4c() {
@@ -480,7 +480,7 @@ void FoolGame::thothKey1st() {
} else {
// 140:1446
showBehold(0, 0, _zbasic->str(OFF(21)));
- this->sub_140_2f92();
+ this->thothSetupMenu();
this->var_i16_7ce ^= 2;
this->var_i16_7b2 = 0xa;
_activePuzzleSolved = true;
@@ -946,7 +946,7 @@ void FoolGame::thothKeyLastOnClick() {
while (((_event.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1))) {
// 140:22bc
this->getNextEvent(-1); // was: 0
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
if ((this->var_i16_68a >= 0) && (this->var_i16_68c >= 0) && (this->var_i16_68a <= 0x13) && (this->var_i16_68c <= 0xd)) {
// 140:2316
this->arr_i16_1eb8[0] = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
@@ -1228,7 +1228,7 @@ void FoolGame::thothKeyLastSetup() {
this->copyScreen(0, this->arr_bmp_b3ec);
}
-void FoolGame::sub_140_2f92() {
+void FoolGame::thothSetupMenu() {
// 140:2f92
_zbasic->menu(8, 0, 1, _zbasic->str(OFF(25))); // the book of thoth
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(26))); // return to scroll
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index b97d5bdc1ae..38fb9411248 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -228,7 +228,7 @@ void FoolGame::wordSearchOnClick() {
while ((_event.modifiers & 0x80) == 0) {
// 131:08d4
this->getNextEvent(0);
- this->sub_128_2be(this->var_i16_68a, this->var_i16_68c);
+ this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
if (!((this->var_i16_68a == this->var_i16_1a96) && (this->var_i16_68c == this->var_i16_1a98))) {
// 131:0934
Commit: ff26de495f0ec6a2a5754974bd702be0243caf29
https://github.com/scummvm/scummvm/commit/ff26de495f0ec6a2a5754974bd702be0243caf29
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:33+02:00
Commit Message:
FOOL: Fix prologue and finale for all versions
Changed paths:
engines/fool/fool.h
engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
diff --git a/engines/fool/fool.h b/engines/fool/fool.h
index 74295a73c89..72fcfdbed9e 100644
--- a/engines/fool/fool.h
+++ b/engines/fool/fool.h
@@ -46,6 +46,12 @@ namespace Fool {
struct FoolGameDescription;
+enum FoolVersion {
+ kFool11 = 1,
+ kFool20 = 2,
+ kFool30 = 3,
+};
+
class FoolEngine : public Engine {
private:
const FOOLGameDescription *_gameDescription;
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index f0bbe8dd77c..a61bb61c6cf 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -25,10 +25,13 @@
#include "common/ustr.h"
#include "fool/fool.h"
+#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
+#define OFF(x) (_zstrOffset[kOffsetFinale] + (x))
+
namespace Fool {
// run finale
@@ -121,24 +124,24 @@ void FoolPrologue::finaleRun() {
for (int j = 1; j <= 0xe; j++) {
// 131:030c
- var_i16_18e = _zbasic->readDataInt();
- for (int i = 1; i <= var_i16_18e; i++) {
+ int16 count = _zbasic->readDataInt();
+ for (int i = 1; i <= count; i++) {
// 131:031a
- arr_i16_1e8[i] = _zbasic->readDataInt();
- arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
- arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
+ _treasure[i].xLeft = _zbasic->readDataInt();
+ _treasure[i].xRight = _zbasic->readDataInt();
+ _treasure[i].yPos = _zbasic->readDataInt();
}
// 131:0380
_toolbox->PenMode(kPatXor);
- drawTreasurePhaseIn(0x14);
- drawTreasurePhaseIn(0xa);
- drawTreasurePhaseIn(0x14);
- drawTreasurePhaseIn(0x5);
- drawTreasurePhaseIn(0xa);
- drawTreasurePhaseIn(0x5);
+ drawTreasurePhaseIn(0x14, count);
+ drawTreasurePhaseIn(0xa, count);
+ drawTreasurePhaseIn(0x14, count);
+ drawTreasurePhaseIn(0x5, count);
+ drawTreasurePhaseIn(0xa, count);
+ drawTreasurePhaseIn(0x5, count);
_toolbox->PenNormal();
- drawTreasurePhaseIn(0x0);
+ drawTreasurePhaseIn(0x0, count);
}
// 131:03c0
@@ -147,7 +150,7 @@ void FoolPrologue::finaleRun() {
// 131:0400
// well, that's that!
- drawText(Common::U32String::format("\"%s\"", _zbasic->str(22).encode().c_str()), 0x17c, 0xb4);
+ drawText(Common::U32String::format("\"%s\"", _zbasic->str(OFF(0)).encode().c_str()), 0x17c, 0xb4);
delay(0x1e);
// 131:041a
@@ -228,21 +231,23 @@ void FoolPrologue::finaleRun() {
if (var_i16_18e < 0x41) {
// 131:0770
var_i16_18e += 1;
- arr_i16_1e8[var_i16_18e] = _zbasic->rndInt(32);
- arr_i16_1e8[var_i16_18e+0xfb] = _zbasic->rndInt(windHeight);
- arr_i16_1e8[var_i16_18e+0x1f6] = _zbasic->rndInt(0xa) + 0xa;
+ _rain[var_i16_18e].xPos = _zbasic->rndInt(32);
+ _rain[var_i16_18e].yPos = _zbasic->rndInt(windHeight);
+ _rain[var_i16_18e].size = _zbasic->rndInt(0xa) + 0xa;
+ _rain[var_i16_18e].veloc = _rain[var_i16_18e].size*2;
finaleDrawWind(var_i16_18e);
}
// 131:07ea
for (int i = 1; i <= var_i16_18e; i++) {
finaleDrawWind(i);
- arr_i16_1e8[i] += arr_i16_1e8[0x1f6+i]*2;
+ _rain[i].xPos += _rain[i].veloc;
// 131:0870
- if (arr_i16_1e8[i] > SCREEN_WIDTH) {
- arr_i16_1e8[i] = 1;
- arr_i16_1e8[0xfb+i] = _zbasic->rndInt(windHeight);
- arr_i16_1e8[0x1f6+i] = _zbasic->rndInt(0xa) + 0xa;
+ if (_rain[i].xPos > SCREEN_WIDTH) {
+ _rain[i].xPos = 1;
+ _rain[i].yPos = _zbasic->rndInt(windHeight);
+ _rain[i].size = _zbasic->rndInt(0xa) + 0xa;
+ _rain[i].veloc = _rain[i].size*2;
}
// 131:0902
@@ -360,7 +365,7 @@ void FoolPrologue::finaleRun() {
// 131:0e08
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// Are you still angry with me?
- Common::U32String dialog = Common::U32String::format("\"%s\"", _zbasic->str(23).encode().c_str());
+ Common::U32String dialog = Common::U32String::format("\"%s\"", _zbasic->str(OFF(1)).encode().c_str());
drawText(
dialog,
0x1f4 - _toolbox->StringWidth(dialog),
@@ -398,27 +403,29 @@ void FoolPrologue::finaleRun() {
scanlineBlitPageToScreen(0x5, 0x64, 0x19c, 0x0);
delay(0x28);
- var_i16_5c.left = 0x118;
- var_i16_5c.right = 0x1d1;
- var_i16_5c.top = 0x19;
- var_i16_64.left = 0x118;
- var_i16_64.right = 0x1d1;
- var_i16_64.bottom = 0xdf;
+ Common::Rect srcRect; // var_rect_5c
+ Common::Rect dstRect; // var_rect_64
+ srcRect.left = 0x118;
+ srcRect.right = 0x1d1;
+ srcRect.top = 0x19;
+ dstRect.left = 0x118;
+ dstRect.right = 0x1d1;
+ dstRect.bottom = 0xdf;
// wadjet eye appears from horizon
for (int i = 0xdc; i >= 0x19; i -= 5) {
// 131:10de
_tickMarker = _toolbox->TickCount();
var_i32_4e->copyFrom(*arr_i32_41296[5]);
- var_i16_64.top = i;
- var_i16_5c.bottom = 0x19 + (0xdf - i);
+ dstRect.top = i;
+ srcRect.bottom = 0x19 + (0xdf - i);
// 131:1124
var_i32_40 = arr_i32_41296[6];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcBic, nullptr);
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcBic, nullptr);
var_i32_40 = arr_i32_41296[7];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcOr, nullptr);
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcOr, nullptr);
delayFromMarker(0x2);
- _toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_64, var_i16_64, kSrcCopy, nullptr);
+ _toolbox->CopyBits(var_i32_4e, var_i32_32, dstRect, dstRect, kSrcCopy, nullptr);
}
_toolbox->Delay(0);
@@ -440,7 +447,7 @@ void FoolPrologue::finaleRun() {
if (i == 0x4e) {
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// yes, apparently so
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(24).encode().c_str()), 0x1f4, 0xd2);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(2)).encode().c_str()), 0x1f4, 0xd2);
_zbasic->picture(0x198, 0x102, _pics[0x25]);
}
delayFromMarker(0x2);
@@ -466,20 +473,20 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0, 0, _pics[0x2f]);
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0xa);
- var_i16_5c.left = 0x18b;
- var_i16_5c.right = 0x1ef;
- var_i16_64.left = 0x18b;
- var_i16_64.right = 0x1ef;
+ srcRect.left = 0x18b;
+ srcRect.right = 0x1ef;
+ dstRect.left = 0x18b;
+ dstRect.right = 0x1ef;
// 131:13b8
// move the fool card up the screen
for (int i = 0xc0; i >= 0x15; i--) {
_tickMarker = _toolbox->TickCount();
- var_i16_5c.top = i;
- var_i16_5c.bottom = var_i16_5c.top + 0x96;
- var_i16_64.top = i - 1;
- var_i16_64.bottom = var_i16_64.top + 0x96;
- _toolbox->CopyBits(var_i32_32, var_i32_32, var_i16_5c, var_i16_64, kSrcCopy, nullptr);
+ srcRect.top = i;
+ srcRect.bottom = srcRect.top + 0x96;
+ dstRect.top = i - 1;
+ dstRect.bottom = dstRect.top + 0x96;
+ _toolbox->CopyBits(var_i32_32, var_i32_32, srcRect, dstRect, kSrcCopy, nullptr);
delayFromMarker(0);
}
@@ -498,10 +505,10 @@ void FoolPrologue::finaleRun() {
var_i16_6c.right = SCREEN_WIDTH;
var_i16_6c.top = 0x50;
var_i16_6c.bottom = SCREEN_HEIGHT;
- var_i16_5c.left = 0;
- var_i16_5c.right = 0x32;
- var_i16_5c.top = 0;
- var_i16_5c.bottom = 0x32;
+ srcRect.left = 0;
+ srcRect.right = 0x32;
+ srcRect.top = 0;
+ srcRect.bottom = 0x32;
int16 bindleHeight = 0x64;
// 131:14d8
@@ -512,11 +519,11 @@ void FoolPrologue::finaleRun() {
_tickMarker = _toolbox->TickCount();
var_i32_4e->copyFrom(*arr_i32_41296[6]);
bindleHeight += 5 + i*2;
- var_i16_64.left = 0x1e0;
- var_i16_64.right = var_i16_64.left + 0x32;
- var_i16_64.top = bindleHeight;
- var_i16_64.bottom = var_i16_64.top + 0x32;
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcXor, nullptr);
+ dstRect.left = 0x1e0;
+ dstRect.right = dstRect.left + 0x32;
+ dstRect.top = bindleHeight;
+ dstRect.bottom = dstRect.top + 0x32;
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcXor, nullptr);
// 131:1582
_toolbox->MoveTo(0x190 - i, bindleHeight - 0x1e + i*3);
_toolbox->LineTo(0x1f4, bindleHeight + 0xa - i);
@@ -554,7 +561,7 @@ void FoolPrologue::finaleRun() {
delayFromMarker(0x3c);
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// well, this won't do
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(25).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(3)).encode().c_str()), 0x181, 0x3c);
// 131:17c8
_tickMarker = _toolbox->TickCount();
@@ -570,10 +577,10 @@ void FoolPrologue::finaleRun() {
delay(1);
_zbasic->picture(0x193, 0x2d, _pics[0x31]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(26).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(4)).encode().c_str()), 0x181, 0x3c);
// am I to suffer this fate merely for uncovering
- drawTextRight(_zbasic->str(27), 0x181, 0x4d);
- drawTextRight(Common::U32String::format("%s\"", _zbasic->str(28).encode().c_str()), 0x181, 0x5e);
+ drawTextRight(_zbasic->str(OFF(5)), 0x181, 0x4d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(6)).encode().c_str()), 0x181, 0x5e);
for (int16 i = 0x30; i <= 0x31; i++) {
_toolbox->ReleaseResource(_pics[i]);
}
@@ -594,13 +601,13 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x193, 0x2d, _pics[0x32]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// for if that be true
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(29).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(7)).encode().c_str()), 0x181, 0x3c);
// I wish you had made the challenge more difficult
- drawTextRight(_zbasic->str(30), 0x181, 0x4d);
+ drawTextRight(_zbasic->str(OFF(8)), 0x181, 0x4d);
// after all, I am just a fool and I should not
- drawTextRight(_zbasic->str(31), 0x181, 0x5e);
+ drawTextRight(_zbasic->str(OFF(9)), 0x181, 0x5e);
// have been able to find them so easily
- drawTextRight(Common::U32String::format("%s\"", _zbasic->str(32).encode().c_str()), 0x181, 0x6f);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(10)).encode().c_str()), 0x181, 0x6f);
arr_rect_41af4.top = 6;
arr_rect_41af4.left = 0xd0;
arr_rect_41af4.bottom = 0x6c;
@@ -710,7 +717,7 @@ void FoolPrologue::finaleRun() {
// 131:21e0
_zbasic->picture(0x193, 0x2d, _pics[0x33]);
var_i16_1b6 = 0x14;
- dialog = _zbasic->str(33); // be content that you still live
+ dialog = _zbasic->str(OFF(11)); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
_tickMarker = _toolbox->TickCount();
_zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
@@ -760,8 +767,8 @@ void FoolPrologue::finaleRun() {
delay(0x1e);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// well I for one am not content
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(34).encode().c_str()), 0x181, 0x3c);
- drawTextRight(Common::U32String::format("%s\"", _zbasic->str(35).encode().c_str()), 0x181, 0x4d);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(12)).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(13)).encode().c_str()), 0x181, 0x4d);
drawClickMessageRightAlign();
waitForClick();
_zbasic->picture(0x193, 0x2d, _pics[0x36]);
@@ -770,20 +777,20 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0, 0x96, 0x18b, 2);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// show me one last puzzle if you dare
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(36).encode().c_str()), 0x181, 0x3c);
- drawTextRight(_zbasic->str(37), 0x181, 0x4d);
- drawTextRight(Common::U32String::format("%s\"", _zbasic->str(38).encode().c_str()), 0x181, 0x5e);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(14)).encode().c_str()), 0x181, 0x3c);
+ drawTextRight(_zbasic->str(OFF(15)), 0x181, 0x4d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(16)).encode().c_str()), 0x181, 0x5e);
waitForClick();
// 131:258a
var_i32_40 = arr_i32_41296[5];
for (int16 i = 1; i <= 0x1a; i++) {
- var_i16_5c.top = 0xab - (int16)(i*6.66f);
- var_i16_5c.left = 0x100 - i*0xa;
- var_i16_5c.bottom = 0xab + (int16)(i*6.66f);
- var_i16_5c.right = 0x100 + i*0xa;
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
+ srcRect.top = 0xab - (int16)(i*6.66f);
+ srcRect.left = 0x100 - i*0xa;
+ srcRect.bottom = 0xab + (int16)(i*6.66f);
+ srcRect.right = 0x100 + i*0xa;
+ _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
// 131:266e
@@ -860,8 +867,8 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// 131:2a22
// now what have I gotten myself into?
- drawText(Common::U32String::format("\"%s", _zbasic->str(39).encode().c_str()), 0x3c, 0x2d);
- drawText(Common::U32String::format("%s\"", _zbasic->str(40).encode().c_str()), 0x46, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(17)).encode().c_str()), 0x3c, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(18)).encode().c_str()), 0x46, 0x3e);
_tickMarker = _toolbox->TickCount();
for (int16 i = 6; i <= 0xa; i++) {
arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
@@ -887,12 +894,12 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcOr);
for (int16 i = 1; i <= 0xe; i++) {
// THEBOOKOFTHOTH
- drawText(_zbasic->midStr(_zbasic->str(41), i, 1), arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ drawText(_zbasic->midStr(_zbasic->str(OFF(19)), i, 1), arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
}
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// that's it! the answer is the book of thoth
- drawText(Common::U32String::format("\"%s", _zbasic->str(42).encode().c_str()), 0x32, 0x2d);
- drawText(Common::U32String::format("%s\"", _zbasic->str(43).encode().c_str()), 0x3c, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(20)).encode().c_str()), 0x32, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(21)).encode().c_str()), 0x3c, 0x3e);
// 131:2cf6
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0xd2);
@@ -924,18 +931,19 @@ void FoolPrologue::finaleRun() {
// 131:2e1a
_toolbox->MoveTo(0x46, 0x3e);
// wait, what's this?
- _toolbox->DrawString(Common::U32String::format("\"%s\"", _zbasic->str(44).encode().c_str()));
+ _toolbox->DrawString(Common::U32String::format("\"%s\"", _zbasic->str(OFF(22)).encode().c_str()));
delay(0x96);
blitPageToScreen(0x9);
// 131:2e58
for (int16 i = 1; i <= 0xe; i++) {
- dialog = _zbasic->midStr(_zbasic->str(45), i, 1);
+ // THEBOOKOFTHOTH
+ dialog = _zbasic->midStr(_zbasic->str(OFF(23)), i, 1);
for (int16 l = 0; l <= 1; l++) {
var_i16_18e = 0x21;
- for (int16 j = 0; j <= 1; j++) {
- arr_f64_41bbe[j] = arr_i16_1e8[j*0xfb + i];
- arr_f64_41bbe[j + 2] = (arr_i16_1e8[(j+2)*0xfb + i] - arr_i16_1e8[j*0xfb + i]) / var_i16_18e;
- }
+ arr_f64_41bbe[0] = arr_i16_1e8[i];
+ arr_f64_41bbe[2] = (arr_i16_1e8[0x1f6 + i] - arr_i16_1e8[i]) / var_i16_18e;
+ arr_f64_41bbe[1] = arr_i16_1e8[0xfb + i];
+ arr_f64_41bbe[3] = (arr_i16_1e8[0x2f1 + i] - arr_i16_1e8[0xfb + i]) / var_i16_18e;
// 131:2f66
if (l == 0) {
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcOr);
@@ -964,8 +972,8 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0xa);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// that's it! the answer is the book of thoth
- drawText(Common::U32String::format("\"%s", _zbasic->str(46).encode().c_str()), 0x32, 0x2d);
- drawText(Common::U32String::format("%s\"", _zbasic->str(47).encode().c_str()), 0x3c, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(24)).encode().c_str()), 0x32, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(25)).encode().c_str()), 0x3c, 0x3e);
arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0xa]);
setPortBitsToPage(0xb);
arr_rect_41af4.top = 0xa;
@@ -997,8 +1005,8 @@ void FoolPrologue::finaleRun() {
delayFromMarker(0x96);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// that's it! the answer is the book of thoth
- drawText(Common::U32String::format("\"%s", _zbasic->str(48).encode().c_str()), 0x32, 0x2d);
- drawText(Common::U32String::format("%s\"", _zbasic->str(49).encode().c_str()), 0x3c, 0x3e);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(26)).encode().c_str()), 0x32, 0x2d);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(27)).encode().c_str()), 0x3c, 0x3e);
// 131:341c
scanlineBlitPageToScreen(0xb, 0xb0, 0x1f6, 0);
scanlineBlitPageToScreen(0x5, 0xb0, 0x1f6, 0);
@@ -1030,25 +1038,25 @@ void FoolPrologue::finaleRun() {
_toolbox->SetPortBits(var_i32_32);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// the book of thoth?
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(50).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(28)).encode().c_str()), 0x1a4, 0x2d);
_tickMarker = _toolbox->TickCount();
arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
setPortBitsToPage(5);
_zbasic->picture(0x171, 0xb, _pics[0x5b]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// here is the book of thoth
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(51).encode().c_str()), 0x1a4, 0x2d);
- var_i16_5c.top = wadjetY;
- var_i16_5c.left = wadjetX;
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(29)).encode().c_str()), 0x1a4, 0x2d);
+ srcRect.top = wadjetY;
+ srcRect.left = wadjetX;
// 131:366e
- var_i16_5c.bottom = wadjetY + 100;
- var_i16_5c.right = wadjetX + 200;
+ srcRect.bottom = wadjetY + 100;
+ srcRect.right = wadjetX + 200;
var_i32_4e->copyFrom(*arr_i32_41296[4]);
var_i32_40 = arr_i32_41296[9];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_5c, kSrcBic, 0);
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, srcRect, kSrcBic, 0);
var_i32_40 = arr_i32_41296[0xa];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_5c, kSrcOr, 0);
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, srcRect, kSrcOr, 0);
for (int16 i = 6; i <= 8; i++) {
arr_i32_41296[i]->copyFrom(*var_i32_4e);
}
@@ -1057,49 +1065,49 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// here is the book of thoth
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(52).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(30)).encode().c_str()), 0x1a4, 0x2d);
setPortBitsToPage(7);
_zbasic->picture(0x181, 0xf, _pics[0x5a]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// and your answer is incorrect
- drawTextRight(Common::U32String::format("%s\"", _zbasic->str(53).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(31)).encode().c_str()), 0x1a4, 0x2d);
setPortBitsToPage(8);
// 131:3806
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// destroy him
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(54).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(32)).encode().c_str()), 0x1a4, 0x2d);
_toolbox->SetPortBits(var_i32_32);
delayFromMarker(0xb4);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// the book of thoth?
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(55).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(33)).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0x5);
- var_i16_5c.left = wadjetX;
- var_i16_5c.right = wadjetX + 0xc8;
- var_i16_64.left = wadjetX;
- var_i16_64.right = wadjetX + 0xc8;
- var_i16_5c.top = 0x19;
- var_i16_64.bottom = 0xdf;
+ srcRect.left = wadjetX;
+ srcRect.right = wadjetX + 0xc8;
+ dstRect.left = wadjetX;
+ dstRect.right = wadjetX + 0xc8;
+ srcRect.top = 0x19;
+ dstRect.bottom = 0xdf;
// 131:38f4
// wadjet eye rises over horizon
for (int16 i = 0xdc; i >= 0x19; i -= 5) {
_tickMarker = _toolbox->TickCount();
var_i32_4e->copyFrom(*arr_i32_41296[5]);
- var_i16_64.top = i;
- var_i16_5c.bottom = 0x19 + 0xdf - i;
+ dstRect.top = i;
+ srcRect.bottom = 0x19 + 0xdf - i;
var_i32_40 = arr_i32_41296[9];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcBic, 0);
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcBic, 0);
var_i32_40 = arr_i32_41296[10];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, var_i16_5c, var_i16_64, kSrcOr, 0);
+ _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcOr, 0);
delayFromMarker(2);
- _toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_64, var_i16_64, kSrcCopy, 0);
+ _toolbox->CopyBits(var_i32_4e, var_i32_32, dstRect, dstRect, kSrcCopy, 0);
}
// 131:39ba
@@ -1119,7 +1127,7 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// here is the book of thoth
- drawTextRight(Common::U32String::format("\"%s", _zbasic->str(56).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(34)).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0x7);
@@ -1133,7 +1141,7 @@ void FoolPrologue::finaleRun() {
delayFromMarker(0xc8);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// and your answer is incorrect
- drawTextRight(Common::U32String::format("%s\"", _zbasic->str(57).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(35)).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
blitPageToScreen(0xa);
@@ -1170,10 +1178,10 @@ void FoolPrologue::finaleRun() {
if (k == 7) {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// destroy him
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(58).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(36)).encode().c_str()), 0x1a4, 0x2d);
_zbasic->picture(0x181, 0xf, _pics[0x5a]); // angry priestess
// destroy him!!!
- drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(59).encode().c_str()), 0x1a4, 0x2d);
+ drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(37)).encode().c_str()), 0x1a4, 0x2d);
}
// 131:3db8
if (k < 8) {
@@ -1261,10 +1269,10 @@ void FoolPrologue::finaleRun() {
arr_f64_41bbe[3+4] = (double)(end.right - start.right)/segs;
// 131:420a
- var_i16_5c = start;
+ srcRect = start;
// 131:425a
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, 0);
+ _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, 0);
for (int16 j = 1; j <= segs - 1; j++) {
_tickMarker = _toolbox->TickCount();
@@ -1272,11 +1280,11 @@ void FoolPrologue::finaleRun() {
arr_f64_41bbe[i] += arr_f64_41bbe[i+4];
}
// 131:42e6
- var_i16_5c.top = (int16)arr_f64_41bbe[0];
- var_i16_5c.left = (int16)arr_f64_41bbe[1];
- var_i16_5c.bottom = (int16)arr_f64_41bbe[2];
- var_i16_5c.right = (int16)arr_f64_41bbe[3];
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, 0);
+ srcRect.top = (int16)arr_f64_41bbe[0];
+ srcRect.left = (int16)arr_f64_41bbe[1];
+ srcRect.bottom = (int16)arr_f64_41bbe[2];
+ srcRect.right = (int16)arr_f64_41bbe[3];
+ _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, 0);
delayFromMarker(0);
// 131:4362
}
@@ -1313,9 +1321,9 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x1b5, 0xba, _pics[0x3c]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// but the fool had gained the gift of wisdom
- drawText(_zbasic->str(60), 0xd2, 0x61);
+ drawText(_zbasic->str(OFF(38)), 0xd2, 0x61);
// and was able to trick the high priestess
- drawText(_zbasic->str(61), 0xd2, 0x72);
+ drawText(_zbasic->str(OFF(39)), 0xd2, 0x72);
drawClickMessageRightAlign();
_toolbox->SetPortBits(var_i32_32);
blitPageToScreen(0);
@@ -1326,17 +1334,17 @@ void FoolPrologue::finaleRun() {
// 131:45a4
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// he had remembered well the words
- drawText(_zbasic->str(62), 0xd2, 0x3f);
+ drawText(_zbasic->str(OFF(40)), 0xd2, 0x3f);
// of the magician
- drawText(_zbasic->str(63), 0xd2, 0x50);
+ drawText(_zbasic->str(OFF(41)), 0xd2, 0x50);
// the high priestess may have learned how
- drawText(Common::U32String::format("\"%s", _zbasic->str(64).encode().c_str()), 0xd7, 0x6d);
+ drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(42)).encode().c_str()), 0xd7, 0x6d);
// to command the sacred book of thoth
- drawText(_zbasic->str(65), 0xde, 0x7e);
+ drawText(_zbasic->str(OFF(43)), 0xde, 0x7e);
// but even she cannot force it to do
- drawText(_zbasic->str(66), 0xde, 0x8f);
+ drawText(_zbasic->str(OFF(44)), 0xde, 0x8f);
// anything inherently evil
- drawText(Common::U32String::format("%s\"", _zbasic->str(67).encode().c_str()), 0xde, 0xa0);
+ drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(45)).encode().c_str()), 0xde, 0xa0);
// 131:46aa
_toolbox->SetPortBits(var_i32_32);
waitForClick();
@@ -1348,11 +1356,11 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// some say that the story of the fool and his
- drawText(_zbasic->str(68), 0xd2, 0x5c);
+ drawText(_zbasic->str(OFF(46)), 0xd2, 0x5c);
// adventures inspired the creation of the
- drawText(_zbasic->str(69), 0xd2, 0x6d);
+ drawText(_zbasic->str(OFF(47)), 0xd2, 0x6d);
// modern day tarot deck
- drawText(_zbasic->str(70), 0xd2, 0x7e);
+ drawText(_zbasic->str(OFF(48)), 0xd2, 0x7e);
// 131:4780
_toolbox->SetPortBits(var_i32_32);
@@ -1365,7 +1373,7 @@ void FoolPrologue::finaleRun() {
fillRect(0x12c, 0x12c, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// but I doubt it
- drawText(Common::U32String::format("\"%s\"", _zbasic->str(71).encode().c_str()), 0x184, 0xb1);
+ drawText(Common::U32String::format("\"%s\"", _zbasic->str(OFF(49)).encode().c_str()), 0x184, 0xb1);
// 131:4848
_toolbox->SetPortBits(var_i32_32);
waitForClick();
@@ -1452,13 +1460,13 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcBic);
// the fool's errand
- drawTextCenter(_zbasic->str(72), 0x100, 0x19 + yPic + 0x19);
+ drawTextCenter(_zbasic->str(OFF(50)), 0x100, 0x19 + yPic + 0x19);
// (c) 1987 by cliff johnson. all rights reserved
- drawTextCenter(_zbasic->str(73), 0x100, 0x32 + yPic + 0x19);
+ drawTextCenter(_zbasic->str(OFF(51)), 0x100, 0x32 + yPic + 0x19);
// portions of this code are copyrighted 1985 zedcor inc
- drawTextCenter(_zbasic->str(74), 0x100, 0x4b + yPic + 0x19);
+ drawTextCenter(_zbasic->str(OFF(52)), 0x100, 0x4b + yPic + 0x19);
// the fool's errand is a registered trademark of cliff johnson
- drawTextCenter(_zbasic->str(75), 0x100, 0x64 + yPic + 0x19);
+ drawTextCenter(_zbasic->str(OFF(53)), 0x100, 0x64 + yPic + 0x19);
// 131:4c94
delayFromMarker(0x14);
_toolbox->SetPortBits(var_i32_32);
@@ -1472,10 +1480,10 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// and yes, the fool will return in
- drawTextCenter(_zbasic->str(76), 0x100, 0xa0);
+ drawTextCenter(_zbasic->str(OFF(54)), 0x100, 0xa0);
_zbasic->text(kPrologueFontFool, 0x18, 0, kSrcBic);
// the fool and his money
- drawTextCenter(_zbasic->str(77), 0x100, 0xc8);
+ drawTextCenter(_zbasic->str(OFF(55)), 0x100, 0xc8);
delayFromMarker(0x14);
_toolbox->SetPortBits(var_i32_32);
blitPageToScreen(0);
@@ -1492,7 +1500,7 @@ void FoolPrologue::finaleDrawLoadingMsg() {
_toolbox->SetPort(_grafPtrMenu);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Finale
- Common::U32String str = Common::U32String::format("%s%d%%", _zbasic->str(78).encode().c_str(), _prologueLoading);
+ Common::U32String str = Common::U32String::format("%s%d%%", _zbasic->str(OFF(56)).encode().c_str(), _prologueLoading);
// 131:4e08
fillRect(0, 0, 7, 0x13, _windowWidth - 7);
@@ -1506,19 +1514,19 @@ void FoolPrologue::finaleDrawFoolUhOh() {
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Uh oh . . .
- drawText(Common::U32String::format("\"%s\"", _zbasic->str(80).encode().c_str()), 0x1ae, 0xb4);
+ drawText(Common::U32String::format("\"%s\"", _zbasic->str(OFF(58)).encode().c_str()), 0x1ae, 0xb4);
}
void FoolPrologue::finaleStartText() {
// 131:4e98
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcXor);
- var_i16_3fc = 0xa0;
+ int16 yStart = 0xa0;
// "And so the fool heeded the advice of the magician..."
- drawText(_zbasic->str(81), 0x96, var_i16_3fc);
- drawText(_zbasic->str(82), 0xa0, var_i16_3fc + 0xf);
- drawText(_zbasic->str(83), 0xaa, var_i16_3fc + 0x1e);
- drawText(_zbasic->str(84), 0xc8, var_i16_3fc + 0x2d);
- drawText(_zbasic->str(85), 0xe6, var_i16_3fc + 0x3c);
+ drawText(_zbasic->str(OFF(59)), 0x96, yStart);
+ drawText(_zbasic->str(OFF(60)), 0xa0, yStart + 0xf);
+ drawText(_zbasic->str(OFF(61)), 0xaa, yStart + 0x1e);
+ drawText(_zbasic->str(OFF(62)), 0xc8, yStart + 0x2d);
+ drawText(_zbasic->str(OFF(63)), 0xe6, yStart + 0x3c);
drawClickMessage();
}
@@ -1526,14 +1534,14 @@ void FoolPrologue::finaleStartText() {
void FoolPrologue::finaleDrawWind(int16 offset) {
// 131:4f96
_toolbox->MoveTo(
- arr_i16_1e8[offset],
- arr_i16_1e8[offset+0xfb]
+ _rain[offset].xPos,
+ _rain[offset].yPos
);
// 131:4fd4
_toolbox->LineTo(
- arr_i16_1e8[offset] + arr_i16_1e8[offset+0x1f6],
- arr_i16_1e8[offset+0xfb]
+ _rain[offset].xPos + _rain[offset].size,
+ _rain[offset].yPos
);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 1bf20fce360..8843d5c57d1 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -43,15 +43,15 @@ namespace Fool {
// Offset adjustments for the ZBasic string table to align
// across game versions
static const int fool11ZStrOffset[] = {
- 128, 59, 81, 170, 186, 188, 192, 194, 202, 239, 258, 280, 315, 324,
+ 128, 59, 81, 170, 186, 188, 192, 194, 202, 239, 258, 280, 315, 324, 13, 21
};
static const int fool20ZStrOffset[] = {
- 102, 78, 103, 191, 207, 209, 213, 215, 223, 260, 279, 301, 336, 345,
+ 102, 78, 103, 191, 207, 209, 213, 215, 223, 260, 279, 301, 336, 345, 18, 22
};
static const int fool30ZStrOffset[] = {
- 97, 73, 98, 161, 177, 179, 183, 185, 193, 230, 251, 273, 308, 317,
+ 97, 73, 98, 161, 177, 179, 183, 185, 193, 230, 251, 273, 308, 317, 8, 12
};
// Fool's Errand v1.1 is missing FOND data, below is taken from 2.0
@@ -2379,8 +2379,8 @@ void FoolGame::menuAbout() {
void FoolGame::menuPrologue() {
// this is brand new
this->copyScreen(0, this->arr_bmp_138bc);
- FoolPrologue fp;
- fp.run(false);
+ FoolPrologue fp(_version, _zstrOffset);
+ fp.run(false, this->arr_bmp_138bc);
this->copyScreen(1, this->arr_bmp_138bc);
_toolbox->DrawMenuBar();
}
@@ -2388,8 +2388,8 @@ void FoolGame::menuPrologue() {
void FoolGame::menuFinale() {
// this is brand new
this->copyScreen(0, this->arr_bmp_138bc);
- FoolPrologue fp;
- fp.run(true);
+ FoolPrologue fp(_version, _zstrOffset);
+ fp.run(true, this->arr_bmp_138bc);
this->copyScreen(1, this->arr_bmp_138bc);
_toolbox->DrawMenuBar();
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 40ace5edc09..ef06ae08525 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -26,6 +26,7 @@
#include "common/str.h"
#include "common/ustr.h"
+#include "fool/fool.h"
#include "fool/toolbox.h"
namespace Fool {
@@ -54,12 +55,6 @@ enum FoolPuzzleFlags : uint16 {
kFlagMapTile = 0x08,
};
-enum FoolVersion {
- kFool11 = 1,
- kFool20 = 2,
- kFool30 = 3,
-};
-
enum FoolZStrOffset : uint16 {
kOffsetVersion = 0,
kOffsetAbout,
@@ -75,6 +70,8 @@ enum FoolZStrOffset : uint16 {
kOffsetThoth,
kOffsetHumbug,
kOffsetJustice,
+ kOffsetPrologue,
+ kOffsetFinale,
};
enum FoolFontID : uint16 {
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index f3ab7337d6f..a538bb6e758 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -25,13 +25,14 @@
#include "graphics/macgui/macwindow.h"
#include "fool/fool.h"
+#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
-namespace Fool {
-
+#define OFF(x) (_zstrOffset[kOffsetPrologue] + (x))
+namespace Fool {
// Based on m68k disassembly of the Fool's Errand v2.0, (c) 1988 Cliff Johnson.
@@ -39,7 +40,7 @@ namespace Fool {
// v2.0 - fixes full-screen rendering on higher-resolution displays
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
-void FoolPrologue::run(bool finale) {
+void FoolPrologue::run(bool finale, const BitMap &prevWindow) {
_toolbox = new Toolbox();
_zbasic = new ZBasic(_toolbox);
@@ -69,14 +70,14 @@ void FoolPrologue::run(bool finale) {
smallFOND->data()[3] = (byte)kPrologueFontSmall;
_toolbox->_injectFOND(exec, smallFOND->data(), smallFOND->size(), Common::String("Small Prologue"));
- setup(finale);
+ setup(finale, prevWindow);
delete _zbasic;
_zbasic = nullptr;
delete _toolbox;
_toolbox = nullptr;
}
-void FoolPrologue::setup(bool finale) {
+void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
var_i16_1aa = finale ? 2 : 1;
// 128:0004
@@ -114,10 +115,9 @@ void FoolPrologue::setup(bool finale) {
_patterns[4] = { { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 } };
// 128:017a
- // about message
- var_str_76 = _zbasic->str(0);
- var_str_76 = _zbasic->str(1);
- var_str_76 = _zbasic->str(2);
+ //var_str_76 = _zbasic->str(0);
+ //var_str_76 = _zbasic->str(1);
+ //var_str_76 = _zbasic->str(2);
// fill graphics pages with white
for (int16 i = 0; i < 12; i++) {
@@ -146,6 +146,11 @@ void FoolPrologue::setup(bool finale) {
sub_129_004();
if (_quit)
return;
+
+ if (prevWindow) {
+ _grafPtrWindow->portBits->copyFrom(*prevWindow);
+ }
+
var_i32_1a6 = _zbasic->mem(-1);
if (var_i16_1aa == 1) {
prologueRun();
@@ -224,30 +229,30 @@ void FoolPrologue::zoomClose(int16 patternID, PatternMode mode) {
_toolbox->PenNormal();
}
-void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
+void FoolPrologue::drawTreasurePhaseIn(int16 offset, int16 count) {
// 128:03ee
- var_i16_18c = 0x5;
- if (var_i16_18e > 0x28) {
- var_i16_18c = 0x8;
+ int period = 0x5;
+ if (count > 0x28) {
+ period = 0x8;
}
- if (var_i16_18e > 0x50) {
- var_i16_18c = 0xb;
+ if (count > 0x50) {
+ period = 0xb;
}
- if (var_i16_18e > 0x64) {
- var_i16_18c = 0xe;
+ if (count > 0x64) {
+ period = 0xe;
}
// 128:0428
- for (int i = 1; i <= var_i16_18e; i++) {
+ for (int i = 1; i <= count; i++) {
_tickMarker = _toolbox->TickCount();
_toolbox->MoveTo(
- arr_i16_1e8[i] - unk1,
- arr_i16_1e8[i + 0x1f6] - unk1
+ _treasure[i].xLeft - offset,
+ _treasure[i].yPos - offset
);
_toolbox->LineTo(
- arr_i16_1e8[i + 0xfb] + unk1,
- arr_i16_1e8[i + 0x1f6] - unk1
+ _treasure[i].xRight + offset,
+ _treasure[i].yPos - offset
);
- if (i % var_i16_18c == 0) {
+ if (i % period == 0) {
delayFromMarker(0);
};
}
@@ -257,8 +262,9 @@ void FoolPrologue::drawTreasurePhaseIn(int16 unk1) {
void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16 right, int16 updatePeriod) {
// 128:050a
var_i32_40 = arr_i32_41296[screenPage];
- var_i16_5c.left = left;
- var_i16_5c.right = right;
+ Common::Rect srcRect; // var_i16_5c
+ srcRect.left = left;
+ srcRect.right = right;
if (updatePeriod == 0) {
updatePeriod = 0x14;
}
@@ -274,9 +280,9 @@ void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16
// 128:0584
for (int i = 0; i < SCREEN_HEIGHT; i++) {
_tickMarker = _toolbox->TickCount();
- var_i16_5c.top = _randScanline[i];
- var_i16_5c.bottom = _randScanline[i] + 1;
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
+ srcRect.top = _randScanline[i];
+ srcRect.bottom = _randScanline[i] + 1;
+ _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, nullptr);
if (i % updatePeriod == 0) {
delayFromMarker(0);
}
@@ -308,13 +314,14 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
var_i32_40 = arr_i32_41296[screenPage];
+ Common::Rect srcRect; // var_rect_5c
for (int i = 1; i <= 0x36; i++) {
_tickMarker = _toolbox->TickCount();
- var_i16_5c.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
- var_i16_5c.left = (SCREEN_WIDTH/2) - i*5;
- var_i16_5c.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
- var_i16_5c.right = (SCREEN_WIDTH/2) + i*5;
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
+ srcRect.top = (SCREEN_HEIGHT/2) - (int)(i*3.33);
+ srcRect.left = (SCREEN_WIDTH/2) - i*5;
+ srcRect.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
+ srcRect.right = (SCREEN_WIDTH/2) + i*5;
+ _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
_toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
@@ -382,22 +389,22 @@ void FoolPrologue::drawRainRecycle(int16 unk) {
do {
// 128:0a96
drawRainDrop();
- arr_i16_1e8[var_i16_6] = arr_i16_1e8[0x2f1+var_i16_6] + arr_i16_1e8[var_i16_6];
- arr_i16_1e8[0xfb+var_i16_6] = arr_i16_1e8[0xfb+var_i16_6] + arr_i16_1e8[0x2f1+var_i16_6];
+ _rain[_rainIndex].xPos += _rain[_rainIndex].veloc;
+ _rain[_rainIndex].yPos += _rain[_rainIndex].veloc;
// 128:0b52
- if ((arr_i16_1e8[var_i16_6] > 0x1f4) || (arr_i16_1e8[0xfb+var_i16_6] > 0x140)) {
+ if ((_rain[_rainIndex].xPos > 0x1f4) || (_rain[_rainIndex].yPos > 0x140)) {
// 128:0bae
- arr_i16_1e8[var_i16_6] = _zbasic->rndInt(0x264) - 0xc8;
- arr_i16_1e8[0xfb+var_i16_6] = _zbasic->rndInt(0x1ba) - 0xc8;
- arr_i16_1e8[0x1f6+var_i16_6] = _zbasic->rndInt(0x5) + 0x1;
- arr_i16_1e8[0x2f1+var_i16_6] = _zbasic->rndInt(0xa) + 0x19;
+ _rain[_rainIndex].xPos = _zbasic->rndInt(0x264) - 0xc8;
+ _rain[_rainIndex].yPos = _zbasic->rndInt(0x1ba) - 0xc8;
+ _rain[_rainIndex].size = _zbasic->rndInt(0x5) + 0x1;
+ _rain[_rainIndex].veloc = _zbasic->rndInt(0xa) + 0x19;
}
// 128:0c56
drawRainDrop();
- var_i16_6 += 1;
- if (var_i16_6 > 0xb5) {
- var_i16_6 = 0;
+ _rainIndex += 1;
+ if (_rainIndex > 0xb5) {
+ _rainIndex = 0;
_toolbox->Delay(0);
}
} while (_tickMarker + var_i16_1a4 > _toolbox->TickCount());
@@ -599,10 +606,10 @@ void FoolPrologue::sub_129_004() {
var_i16_54.bottom = SCREEN_HEIGHT;
var_i16_54.right = SCREEN_WIDTH;
- var_i32_1c0 = _zbasic->mem(-1);
+ uint32 memFree = _zbasic->mem(-1);
// 129:02fe
- if (var_i32_1c0 < 0xd6d8) {
+ if (memFree < 0xd6d8) {
_toolbox->InitCursor();
_zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, arr_i32_41296[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x0);
@@ -736,12 +743,20 @@ void FoolPrologue::prologueRun() {
prologueDrawLoadingMsg();
setPortBitsToPage(0xb);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->picture(0x74, 0xaa, picTitle);
+ if (_version == kFool30) {
+ _zbasic->picture(0x4c, 0xc8, picTitle);
+ } else {
+ _zbasic->picture(0x74, 0xaa, picTitle);
+ }
_toolbox->ReleaseResource(picTitle);
// 130:007a
_zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcBic);
- drawTextCenter(_zbasic->str(18), 0x103, 0x10d);
+ if (_version == kFool30) {
+ drawTextCenter(_zbasic->str(OFF(0)), 0x103, 0x112);
+ } else {
+ drawTextCenter(_zbasic->str(OFF(0)), 0x103, 0x10d);
+ }
_toolbox->SetPortBits(var_i32_32);
// cliffside images with lightning
for (int i = 1; i <= 5; i++) {
@@ -902,17 +917,19 @@ void FoolPrologue::prologueRun() {
// 130:062c
int y = 0;
while (y != SCREEN_HEIGHT) {
- var_i16_5c.right = SCREEN_WIDTH;
+ Common::Rect scanline;
+ scanline.left = 0;
+ scanline.right = SCREEN_WIDTH;
_tickMarker = _toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
var_i16_192 = 1;
if (y < SCREEN_HEIGHT) {
y += 1;
}
- var_i16_5c.top = _randScanline[y];
- var_i16_5c.bottom = _randScanline[y] + 1;
+ scanline.top = _randScanline[y];
+ scanline.bottom = _randScanline[y] + 1;
// 130:068e
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_5c, var_i16_5c, kSrcCopy, nullptr);
+ _toolbox->CopyBits(var_i32_40, var_i32_32, scanline, scanline, kSrcCopy, nullptr);
}
// 130:06b0
drawRainRecycle(1);
@@ -1145,9 +1162,9 @@ void FoolPrologue::prologueDrawLoadingMsg() {
_toolbox->SetPort(_grafPtrMenu);
_zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
// "loading prologue" message
- Common::U32String msg = _zbasic->str(19);
+ Common::U32String msg = _zbasic->str(OFF(1));
msg += Common::U32String::format(" %d", _prologueLoading);
- msg += _zbasic->str(20);
+ msg += _zbasic->str(OFF(2));
// 130:0d70
// white out the contents of the top menu bar.
// the 7px offset on either side seems to be to avoid hitting the rounded screen corners?
@@ -1162,28 +1179,28 @@ void FoolPrologue::drawRain() {
// 130:0db0
_zbasic->unk_20();
_toolbox->PenMode(kPatXor);
- var_i16_6 = 0x1;
- while (var_i16_6 <= 0xb5) {
+ _rainIndex = 0x1;
+ while (_rainIndex <= 0xb5) {
// 130:0dc0
- arr_i16_1e8[var_i16_6] = _zbasic->rndInt(0x264) - 0x64;
- arr_i16_1e8[var_i16_6 + 0xfb] = _zbasic->rndInt(0x1ba) - 0x64;
- arr_i16_1e8[var_i16_6 + 0x1f6] = _zbasic->rndInt(0x5) + 1;
- arr_i16_1e8[var_i16_6 + 0x2f1] = _zbasic->rndInt(0xa) + 0x19;
+ _rain[_rainIndex].xPos = _zbasic->rndInt(0x264) - 0x64;
+ _rain[_rainIndex].yPos = _zbasic->rndInt(0x1ba) - 0x64;
+ _rain[_rainIndex].size = _zbasic->rndInt(0x5) + 1;
+ _rain[_rainIndex].veloc = _zbasic->rndInt(0xa) + 0x19;
// 130:0e68
drawRainDrop();
- var_i16_6 += 1;
+ _rainIndex += 1;
}
- var_i16_6 = 1;
+ _rainIndex = 1;
_toolbox->Delay(0);
}
void FoolPrologue::drawRainDrop() {
// 130:0e82
- _toolbox->MoveTo(arr_i16_1e8[var_i16_6], arr_i16_1e8[var_i16_6 + 0xfb]);
+ _toolbox->MoveTo(_rain[_rainIndex].xPos, _rain[_rainIndex].yPos);
// 130:0ec0
_toolbox->LineTo(
- arr_i16_1e8[var_i16_6] + arr_i16_1e8[var_i16_6 + 0x1f6],
- arr_i16_1e8[var_i16_6 + 0xfb] + arr_i16_1e8[var_i16_6 + 0x1f6]
+ _rain[_rainIndex].xPos + _rain[_rainIndex].size,
+ _rain[_rainIndex].yPos + _rain[_rainIndex].size
);
}
@@ -1201,7 +1218,7 @@ void FoolPrologue::prologueRenderNextText() {
while (var_i16_1ba > 0) {
// 130:0f78
- var_i16_1ba = _zbasic->instr(var_i16_1ba, var_str_76, _zbasic->str(21));
+ var_i16_1ba = _zbasic->instr(var_i16_1ba, var_str_76, Common::U32String("^")); // was: str(21)
if (var_i16_1ba > 0) {
var_str_76.replace(var_i16_1ba-1, 1, Common::U32String("\""));
}
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index c795d349205..aaa3190f207 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -25,6 +25,8 @@
#include "common/array.h"
#include "common/scummsys.h"
#include "common/str.h"
+
+#include "fool/fool.h"
#include "fool/toolbox.h"
#include "graphics/surface.h"
@@ -40,14 +42,27 @@ enum FoolPrologueFontID : uint16 {
kPrologueFontSmall = 241,
};
+struct Particle {
+ int16 xPos = 0;
+ int16 yPos = 0;
+ int16 size = 0;
+ int16 veloc = 0;
+};
+
+struct TreasureLine {
+ int16 xLeft = 0;
+ int16 xRight = 0;
+ int16 yPos = 0;
+};
+
class FoolPrologue {
public:
- FoolPrologue() {}
+ FoolPrologue(FoolVersion version, const int *zstrOffset): _version(version), _zstrOffset(zstrOffset) {}
~FoolPrologue() {}
- void run(bool finale);
+ void run(bool finale, const BitMap &prevWindow);
- void setup(bool finale); // sub_128_004
+ void setup(bool finale, const BitMap &prevWindow); // sub_128_004
void copyScreenToPage(int16 screenPage); // sub_128_1ba
void setPortBitsToPage(int16 screenPage); // sub_128_1f4
void delay(int16 numTicks); // sub_128_21e
@@ -56,7 +71,7 @@ public:
void drawTextCenter(const Common::U32String &str, int16 x, int16 y); // sub_128_2a6
void fillRect(int16 top, int16 left, int16 bottom, int16 right, int16 patternID); // sub_128_2f0
void zoomClose(int16 patternID, PatternMode mode); // sub_128_354
- void drawTreasurePhaseIn(int16 unk1); // sub_128_3ee
+ void drawTreasurePhaseIn(int16 offset, int16 count); // sub_128_3ee
void scanlineBlitPageToScreen(int16 screenPage, int16 left, int16 right, int16 updatePeriod); // sub_128_50a
void blitPageToScreen(int16 screenPage); // sub_128_610
void scanlineTransition(int16 patternID); // sub_128_64a
@@ -91,13 +106,15 @@ public:
void finaleCardRotate(); // sub_131_5038
private:
+ FoolVersion _version;
+ const int *_zstrOffset;
Toolbox *_toolbox;
ZBasic *_zbasic;
bool _quit = false;
// last tick count
uint32 _tickMarker; // var_i32_2
- int16 var_i16_6;
+ int16 _rainIndex; // var_i16_6
GrafPtr _grafPtrWindow; // var_i32_8
GrafPtr _grafPtrMenu; // var_i32_c
@@ -122,8 +139,6 @@ private:
int16 var_i16_52;
Common::Rect var_i16_54;
- Common::Rect var_i16_5c;
- Common::Rect var_i16_64;
Common::Rect var_i16_6c;
int16 var_i16_74;
@@ -132,7 +147,6 @@ private:
int16 var_i16_176;
int16 var_i16_180;
- int16 var_i16_18c;
int16 var_i16_18e;
int16 var_i16_192;
@@ -150,13 +164,8 @@ private:
int16 var_i16_1b8;
int16 var_i16_1ba;
- uint32 var_i32_1c0;
-
Common::U32String var_i16_1c4;
- uint32 var_i32_2c4;
- int16 var_i16_2c8;
- int16 var_i16_2ca;
int16 var_i16_2cc;
Common::U32String var_i16_2ce;
@@ -164,11 +173,6 @@ private:
int16 _prologuePicIndex; // var_i16_3d4
int16 var_i16_3e6;
- int16 var_i16_3ec;
- int16 var_i16_3ee;
-
- int16 var_i16_3fc;
-
// picture resource handles
PicHandle _pics[92] = { nullptr }; // arr_i32_0
@@ -180,6 +184,9 @@ private:
int16 arr_i16_1e8[1004] = { 0 };
+ Particle _rain[251]; // arr_i16_1e8
+ TreasureLine _treasure[251]; // arr_i16_1e8
+
GrafPort _grafPortWindow; // arr_i32_9c0
GrafPort _grafPortMenu; // arr_i32_a8a
Commit: 01560e161cb215081ec56c8618082daf975496a6
https://github.com/scummvm/scummvm/commit/01560e161cb215081ec56c8618082daf975496a6
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:33+02:00
Commit Message:
FOOL: Strip remaining uses of 'this'
Changed paths:
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_hermit.cpp
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_threeships.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/toolbox.cpp
engines/fool/toolbox.h
engines/fool/toolbox_pict.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_resman.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index 354ba35ff3c..b56ac0e18d1 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -42,8 +42,8 @@ void FoolGame::cardsRun() {
var_i16_2016 = 0;
// 139:0004
- this->fetchPuzzleData();
- this->var_i16_c00 = 1;
+ fetchPuzzleData();
+ var_i16_c00 = 1;
// set up card bounding boxes
_toolbox->SetRect(_screenGrid[1], 0x78, 0x19, 0xd1, 0xae);
_toolbox->SetRect(_screenGrid[2], 0xd3, 0x19, 0x12c, 0xae);
@@ -60,110 +60,110 @@ void FoolGame::cardsRun() {
_zbasic->indexSet(puzzlesReadString(), 1, i);
}
- this->var_i16_484 = 0x5e;
+ var_i16_484 = 0x5e;
for (int i = 0x17; i >= 0; i--) {
- this->var_i16_484++;
- this->arr_i32_192c0[i] = _toolbox->GetPicture(this->var_i16_484);
+ var_i16_484++;
+ arr_i32_192c0[i] = _toolbox->GetPicture(var_i16_484);
}
// 139:0184
- this->sub_128_bde(1, 1, 0, 1, 1, 1);
- this->fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
+ sub_128_bde(1, 1, 0, 1, 1, 1);
+ fillRect(0xb4, 0xb5, 0x156, 0x14b, 2);
// illustration of the card game
- _zbasic->picture(0xc3, 0xf3, this->arr_i32_192c0[0x17]);
+ _zbasic->picture(0xc3, 0xf3, arr_i32_192c0[0x17]);
if (_activePuzzleBuffer.empty()) {
// 139:01fa
_activePuzzleBuffer = _zbasic->encodeInt(0) + _zbasic->encodeInt(0) + _zbasic->encodeInt(0);
// card IDs
for (int16 i = 0; i <= 0x15; i++) {
- this->arr_i16_5cbc[i] = i;
+ arr_i16_5cbc[i] = i;
}
// 139:0244
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = _zbasic->rndInt(0x16) - 1;
- this->var_i16_7e4 = _zbasic->rndInt(0x16) - 1;
- _zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[this->var_i16_7e4]);
+ var_i16_484 = _zbasic->rndInt(0x16) - 1;
+ var_i16_7e4 = _zbasic->rndInt(0x16) - 1;
+ _zbasic->swapInt(arr_i16_5cbc[var_i16_484], arr_i16_5cbc[var_i16_7e4]);
}
// 139:029c
for (int i = 0; i <= 0x15; i++) {
- _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_5cbc[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(arr_i16_5cbc[i]);
}
}
// 139:02d8
// player scores
- this->arr_i16_1eb8[5] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 1, 2));
- this->arr_i16_1eb8[6] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 3, 2));
+ arr_i16_1eb8[5] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 1, 2));
+ arr_i16_1eb8[6] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 3, 2));
// 139:0320
- this->var_i16_2010 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 5, 2));
- if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->arr_i16_1eb8[5] = 0;
- this->arr_i16_1eb8[6] = 0;
- this->var_i16_2010 = 0;
+ var_i16_2010 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, 5, 2));
+ if ((arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
+ arr_i16_1eb8[5] = 0;
+ arr_i16_1eb8[6] = 0;
+ var_i16_2010 = 0;
}
// 139:039e
for (int i = 0; i <= 0x15; i++) {
- this->arr_i16_5cbc[i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, i*2 + 7, 2));
+ arr_i16_5cbc[i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, i*2 + 7, 2));
}
// 139:03ea
- this->arr_i16_5cbc[0x16] = 0x16;
- this->arr_rect_4338.top = 0xdb;
- this->arr_rect_4338.left = 0xe2;
- this->arr_rect_4338.bottom = 0xee;
- this->arr_rect_4338.right = 0x11e;
- this->var_i16_2012 = 0;
+ arr_i16_5cbc[0x16] = 0x16;
+ arr_rect_4338.top = 0xdb;
+ arr_rect_4338.left = 0xe2;
+ arr_rect_4338.bottom = 0xee;
+ arr_rect_4338.right = 0x11e;
+ var_i16_2012 = 0;
_stateFlags = 0;
- this->cardsDrawScores();
- if (this->var_i16_2010 == 0) {
- this->cardsShuffleDeck();
+ cardsDrawScores();
+ if (var_i16_2010 == 0) {
+ cardsShuffleDeck();
}
// 139:0456
- this->cardsDrawTable();
+ cardsDrawTable();
while ((_stateFlags & kStateReturn) == 0) {
// 139:045e
- this->var_i16_2014 = 0;
+ var_i16_2014 = 0;
_stateFlags = 0;
while (_stateFlags == 0) {
// 139:046e
- this->getNextEvent(-1);
+ getNextEvent(-1);
if ((_event.modifiers & kModMouseButtonUp) == 0) {
- this->cardsOnClick();
+ cardsOnClick();
}
- if (this->var_i16_2014 != 0) {
- this->sub_139_50e();
+ if (var_i16_2014 != 0) {
+ sub_139_50e();
}
}
// 139:04a4
if (_stateFlags == kStateUndo) {
- this->cardsReset();
+ cardsReset();
}
if (_stateFlags == kStateSaveGame) {
- this->cardsStoreState();
- this->saveGame();
+ cardsStoreState();
+ saveGame();
}
// 139:04c4
}
// 139:04d6
- this->cardsStoreState();
+ cardsStoreState();
// JMP 1d7e
// 139:1d7e
for (int i = 0; i <= 0x17; i++) {
- _toolbox->ReleaseResource(this->arr_i32_192c0[i]);
+ _toolbox->ReleaseResource(arr_i32_192c0[i]);
}
}
void FoolGame::cardsReset() {
- this->arr_i16_1eb8[5] = 0;
- this->arr_i16_1eb8[6] = 0;
- this->var_i16_2012 = 0;
- this->cardsDrawScores();
- this->cardsShuffleDeck();
- this->cardsDrawTable();
+ arr_i16_1eb8[5] = 0;
+ arr_i16_1eb8[6] = 0;
+ var_i16_2012 = 0;
+ cardsDrawScores();
+ cardsShuffleDeck();
+ cardsDrawTable();
}
void FoolGame::sub_139_50e() {
- this->var_i16_2014 = 0;
- this->cardsShuffleDeck();
- this->cardsDrawTable();
+ var_i16_2014 = 0;
+ cardsShuffleDeck();
+ cardsDrawTable();
}
void FoolGame::cardsShuffleDeck() {
@@ -171,58 +171,58 @@ void FoolGame::cardsShuffleDeck() {
_zbasic->unk_20();
for (int j = 0; j <= 2; j++) {
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = _zbasic->rndInt(0x16)-1;
- _zbasic->swapInt(this->arr_i16_5cbc[this->var_i16_484], this->arr_i16_5cbc[i]);
+ var_i16_484 = _zbasic->rndInt(0x16)-1;
+ _zbasic->swapInt(arr_i16_5cbc[var_i16_484], arr_i16_5cbc[i]);
}
}
}
void FoolGame::cardsDrawTable() {
- this->sub_139_17fc();
- this->drawTarotCard(5, 0, 0);
- this->drawTarotCard(4, 1, 0);
- this->drawTarotCard(7, 2, 0);
- this->drawTarotCard(6, 0x16, 0);
- this->drawTarotCard(1, 4, 0);
- this->drawTarotCard(2, 5, 0);
- this->drawTarotCard(3, 6, 0);
+ sub_139_17fc();
+ drawTarotCard(5, 0, 0);
+ drawTarotCard(4, 1, 0);
+ drawTarotCard(7, 2, 0);
+ drawTarotCard(6, 0x16, 0);
+ drawTarotCard(1, 4, 0);
+ drawTarotCard(2, 5, 0);
+ drawTarotCard(3, 6, 0);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
// 139:061a
- this->drawTextCenter(_zbasic->str(OFF(0)), 0xc3); // Select a card above
- this->drawTextCenter(_zbasic->str(OFF(1)), 0xd4); // or
- _toolbox->FillRoundRect(this->arr_rect_4338, 0xa, 0xa, _patterns[0]);
- _toolbox->FrameRoundRect(this->arr_rect_4338, 0xa, 0xa);
+ drawTextCenter(_zbasic->str(OFF(0)), 0xc3); // Select a card above
+ drawTextCenter(_zbasic->str(OFF(1)), 0xd4); // or
+ _toolbox->FillRoundRect(arr_rect_4338, 0xa, 0xa, _patterns[0]);
+ _toolbox->FrameRoundRect(arr_rect_4338, 0xa, 0xa);
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->drawTextCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
- this->var_i16_2016 = 1;
- this->var_i16_2010 = 1;
- this->waitForMouseUp();
+ drawTextCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
+ var_i16_2016 = 1;
+ var_i16_2010 = 1;
+ waitForMouseUp();
}
void FoolGame::cardsOnClick() {
// 139:06b0
- this->var_i16_1e00 = 0;
+ var_i16_1e00 = 0;
if (!((_event.where.x >= 0x78) && (_event.where.y >= 0x19) && (_event.where.x <= 0x187) && (_event.where.y <= 0xae))) {
// 139:06fc
// didn't click in the three cards area
- if (_toolbox->PtInRect(_event.where, this->arr_rect_4338)) {
- _toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
- this->waitForMouseUp();
- _toolbox->InvertRoundRect(this->arr_rect_4338, 0xa, 0xa);
- if (!_toolbox->PtInRect(_event.where, this->arr_rect_4338))
+ if (_toolbox->PtInRect(_event.where, arr_rect_4338)) {
+ _toolbox->InvertRoundRect(arr_rect_4338, 0xa, 0xa);
+ waitForMouseUp();
+ _toolbox->InvertRoundRect(arr_rect_4338, 0xa, 0xa);
+ if (!_toolbox->PtInRect(_event.where, arr_rect_4338))
return;
// 139:0778
// player clicked the yield button (bad choice)
- this->playTone(0x19, 0x64, 0x0);
- this->var_i16_2012 = -CARDS_YIELD_PENALTY;
- this->cardsDrawScores();
- this->var_i16_2014 = 1;
+ playTone(0x19, 0x64, 0x0);
+ var_i16_2012 = -CARDS_YIELD_PENALTY;
+ cardsDrawScores();
+ var_i16_2014 = 1;
} else {
// 139:079e
- this->playTone(0xf, 0x64, 0x1);
+ playTone(0xf, 0x64, 0x1);
for (int j = 0; j <= 1; j++) {
for (int16 i = 0; i <= 0x3; i++) {
- this->drawTarotCard(i, 0, 3);
+ drawTarotCard(i, 0, 3);
}
}
@@ -231,71 +231,71 @@ void FoolGame::cardsOnClick() {
} else {
// 139:07ea
// player picked a card
- this->fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
+ fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
if (_event.where.x < 0xd2) {
// 139:0818
- this->var_i16_1e00 = 4;
- this->drawTarotCard(1, 0, 1);
+ var_i16_1e00 = 4;
+ drawTarotCard(1, 0, 1);
}
// 139:082e
if ((_event.where.x >= 0xd2) && (_event.where.x <= 0x12d)) {
- this->var_i16_1e00 = 5;
- this->drawTarotCard(2, 0, 1);
+ var_i16_1e00 = 5;
+ drawTarotCard(2, 0, 1);
}
// 139:0868
if (_event.where.x > 0x12d) {
- this->var_i16_1e00 = 6;
- this->drawTarotCard(3, 0, 1);
+ var_i16_1e00 = 6;
+ drawTarotCard(3, 0, 1);
}
// 139:088a
- this->drawTarotCard(9, this->var_i16_1e00, 0);
+ drawTarotCard(9, var_i16_1e00, 0);
_zbasic->indexSet(
- _zbasic->chr(this->arr_i16_5cbc[0]+0x41) + _zbasic->chr(this->arr_i16_5cbc[2]+0x41) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00]+0x41),
+ _zbasic->chr(arr_i16_5cbc[0]+0x41) + _zbasic->chr(arr_i16_5cbc[2]+0x41) + _zbasic->chr(arr_i16_5cbc[var_i16_1e00]+0x41),
1,
0x26
);
- this->sub_139_19da();
- this->sub_139_191c();
- this->sub_139_a22();
+ sub_139_19da();
+ sub_139_191c();
+ sub_139_a22();
int16 strY = 0;
- if (this->var_i16_2018 == 0) {
+ if (var_i16_2018 == 0) {
// 139:0920
- this->cardsRevealHands();
+ cardsRevealHands();
strY = 0xc3;
} else {
// 139:092e
- this->cardsOpponentYields();
+ cardsOpponentYields();
strY = 0xd7;
}
// 139:0938
- this->var_i16_2010 = 0;
- if (this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) {
- this->sub_139_1d3e();
+ var_i16_2010 = 0;
+ if (arr_i16_1eb8[5] > CARDS_MAX_SCORE) {
+ sub_139_1d3e();
return;
}
// 139:095e
- this->sub_128_61ec();
+ sub_128_61ec();
// original code has the font ID as 1... maybe there's a fallback?
// this was intended to be Small
_zbasic->text(kFontSmall, 9, Graphics::kMacFontRegular, kSrcBic);
- this->drawTextCenter(_zbasic->str(OFF(3)), strY); // (click mouse to continue)
- this->var_i16_2014 = 0;
+ drawTextCenter(_zbasic->str(OFF(3)), strY); // (click mouse to continue)
+ var_i16_2014 = 0;
_stateFlags = 0;
- while ((_stateFlags == 0) && (this->var_i16_2014 == 0)) {
- this->getNextEvent(-1);
+ while ((_stateFlags == 0) && (var_i16_2014 == 0)) {
+ getNextEvent(-1);
if (_event.what == kMouseUp) {
- this->var_i16_2014 = 1;
+ var_i16_2014 = 1;
}
if (_stateFlags == kStateSaveGame) {
- this->cardsStoreState();
- this->saveGame();
+ cardsStoreState();
+ saveGame();
}
}
// 139:09d8
- if (((_stateFlags & kStateReturn) == 0) && (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
+ if (((_stateFlags & kStateReturn) == 0) && (arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
_stateFlags = kStateUndo;
- this->var_i16_2014 = 0;
+ var_i16_2014 = 0;
}
}
// 139:0a20
@@ -304,79 +304,79 @@ void FoolGame::cardsOnClick() {
void FoolGame::sub_139_a22() {
// 139:0a22
- this->var_str_201a = _zbasic->chr(this->arr_i16_5cbc[0] + 0x41) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41);
- this->var_i16_211a = this->var_i16_1e00;
- _zbasic->indexSet(_zbasic->chr(this->arr_i16_5cbc[1] + 0x41) + _zbasic->chr(this->arr_i16_5cbc[3] + 0x41), 1, 0x27);
- this->var_str_211c = _zbasic->index(1, 0x27);
- this->var_i16_2016 = 0x2;
- this->var_i16_221c = 0;
- this->var_i16_221e = 0;
+ var_str_201a = _zbasic->chr(arr_i16_5cbc[0] + 0x41) + _zbasic->chr(arr_i16_5cbc[var_i16_1e00] + 0x41);
+ var_i16_211a = var_i16_1e00;
+ _zbasic->indexSet(_zbasic->chr(arr_i16_5cbc[1] + 0x41) + _zbasic->chr(arr_i16_5cbc[3] + 0x41), 1, 0x27);
+ var_str_211c = _zbasic->index(1, 0x27);
+ var_i16_2016 = 0x2;
+ var_i16_221c = 0;
+ var_i16_221e = 0;
for (int16 i = 4; i <= 6; i++) {
// 139:0ae8
- if (i != this->var_i16_211a) {
- _zbasic->indexSet(this->var_str_211c + _zbasic->chr(this->arr_i16_5cbc[i] + 0x41), 1, 0x27);
- this->sub_139_19da();
- if (this->arr_i16_1eb8[2] >= this->var_i16_221c) {
+ if (i != var_i16_211a) {
+ _zbasic->indexSet(var_str_211c + _zbasic->chr(arr_i16_5cbc[i] + 0x41), 1, 0x27);
+ sub_139_19da();
+ if (arr_i16_1eb8[2] >= var_i16_221c) {
// 139:0b52
- this->var_i16_221c = this->arr_i16_1eb8[2];
- this->var_i16_1e00 = i;
+ var_i16_221c = arr_i16_1eb8[2];
+ var_i16_1e00 = i;
} else {
// 139:0b70
- if (this->arr_i16_1eb8[2] == this->var_i16_221c) {
- this->sub_139_191c();
- if (this->arr_i16_1eb8[4] > this->var_i16_221e) {
- this->var_i16_221e = this->arr_i16_1eb8[4];
- this->var_i16_1e00 = i;
+ if (arr_i16_1eb8[2] == var_i16_221c) {
+ sub_139_191c();
+ if (arr_i16_1eb8[4] > var_i16_221e) {
+ var_i16_221e = arr_i16_1eb8[4];
+ var_i16_1e00 = i;
}
}
}
}
// 139:0bc4
}
- _zbasic->indexSet(this->var_str_211c + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
+ _zbasic->indexSet(var_str_211c + _zbasic->chr(arr_i16_5cbc[var_i16_1e00] + 0x41), 1, 0x27);
// 139:0c0a
- this->arr_i16_1eb8[2] = this->var_i16_221c;
- this->sub_139_191c();
- this->var_i16_221c = 0;
+ arr_i16_1eb8[2] = var_i16_221c;
+ sub_139_191c();
+ var_i16_221c = 0;
// cycle backwards through the scoring combinations
for (int16 j = 8; j >= 1; j--) {
- this->var_i16_7a8 = 0;
+ var_i16_7a8 = 0;
// count the number of combination cards in the hand
for (int16 i = 1; i <= (int16)_zbasic->index(1, j + 0x15).size(); i++) {
if (_zbasic->instr(
1,
- this->var_str_201a,
+ var_str_201a,
_zbasic->midStr(_zbasic->index(1, j + 0x15), i, 1))
) {
- this->var_i16_7a8++;
+ var_i16_7a8++;
}
// 139:0c72
}
// 139:0c90
- if (this->var_i16_7a8 == 2) {
- this->var_i16_221c = j;
+ if (var_i16_7a8 == 2) {
+ var_i16_221c = j;
j = 1;
}
// 139:0ca6
}
// 139:0cb6
- this->var_i16_2018 = 0;
- if (this->var_i16_221c > this->arr_i16_1eb8[2]) {
- this->var_i16_2018 = 1;
+ var_i16_2018 = 0;
+ if (var_i16_221c > arr_i16_1eb8[2]) {
+ var_i16_2018 = 1;
}
// 139:0ce2
- if (this->var_i16_221c == this->arr_i16_1eb8[2]) {
- for (int16 i = 1; i <= (int16)this->var_str_201a.size(); i++) {
- this->var_i16_484 = 0x15 - (_zbasic->asc(_zbasic->midStr(this->var_str_201a, i, 1)) - 0x41);
- if (this->var_i16_484 > this->arr_i16_1eb8[4]) {
- this->var_i16_2018 = 1;
+ if (var_i16_221c == arr_i16_1eb8[2]) {
+ for (int16 i = 1; i <= (int16)var_str_201a.size(); i++) {
+ var_i16_484 = 0x15 - (_zbasic->asc(_zbasic->midStr(var_str_201a, i, 1)) - 0x41);
+ if (var_i16_484 > arr_i16_1eb8[4]) {
+ var_i16_2018 = 1;
}
// 139:0d5c
}
}
// 139:0d6e
- if ((this->var_i16_2018 == 1) && ((this->var_i16_221c + 1)*9 <= CARDS_YIELD_PENALTY)) {
- this->var_i16_2018 = 0;
+ if ((var_i16_2018 == 1) && ((var_i16_221c + 1)*9 <= CARDS_YIELD_PENALTY)) {
+ var_i16_2018 = 0;
}
// 139:0da6
@@ -385,46 +385,46 @@ void FoolGame::sub_139_a22() {
void FoolGame::cardsOpponentYields() {
// 139:0da8
// ol' mate gives up
- this->playTone(0x19, 0x64, 0x1);
- this->var_i16_2012 = -CARDS_YIELD_PENALTY;
- this->cardsDrawScores();
+ playTone(0x19, 0x64, 0x1);
+ var_i16_2012 = -CARDS_YIELD_PENALTY;
+ cardsDrawScores();
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->drawTextCenter(_zbasic->str(OFF(4)), 0xc4); // The Old Man yields
+ drawTextCenter(_zbasic->str(OFF(4)), 0xc4); // The Old Man yields
}
void FoolGame::cardsRevealHands() {
// 139:0dee
// remove the three cards from the top row
- this->drawTarotCard(1, 0, 1);
- this->drawTarotCard(2, 0, 1);
- this->drawTarotCard(3, 0, 1);
+ drawTarotCard(1, 0, 1);
+ drawTarotCard(2, 0, 1);
+ drawTarotCard(3, 0, 1);
// show ol' mate's draw from the pile
- this->drawTarotCard(8, this->var_i16_1e00, 0);
+ drawTarotCard(8, var_i16_1e00, 0);
- _zbasic->indexSet(_zbasic->index(1, 0x27) + _zbasic->chr(this->arr_i16_5cbc[this->var_i16_1e00] + 0x41), 1, 0x27);
+ _zbasic->indexSet(_zbasic->index(1, 0x27) + _zbasic->chr(arr_i16_5cbc[var_i16_1e00] + 0x41), 1, 0x27);
// 139:0e70
for (int16 i = 1; i <= 2; i++) {
_zbasic->indexSet(Common::U32String(), 1, i + 0x27); // was: str(OFF(5))
- if ((this->arr_i16_1eb8[i] > 0) && (this->arr_i16_1eb8[i] < 9)) {
+ if ((arr_i16_1eb8[i] > 0) && (arr_i16_1eb8[i] < 9)) {
// 139:0ed6
_zbasic->indexSet(
- _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i]) + _zbasic->str(OFF(6)), // X pair
+ _zbasic->index(1, 0x1d + arr_i16_1eb8[i]) + _zbasic->str(OFF(6)), // X pair
1,
i + 0x27
);
}
// 139:0f1e
- if (this->arr_i16_1eb8[i] > 8) {
+ if (arr_i16_1eb8[i] > 8) {
_zbasic->indexSet(
- _zbasic->index(1, 0x1d + this->arr_i16_1eb8[i] - 8) + _zbasic->str(OFF(7)), // X triplet
+ _zbasic->index(1, 0x1d + arr_i16_1eb8[i] - 8) + _zbasic->str(OFF(7)), // X triplet
1,
0x27 + i
);
}
// 139:0f84
_zbasic->indexSet(
- _zbasic->index(1,0x15 - this->arr_i16_1eb8[i + 2]),
+ _zbasic->index(1,0x15 - arr_i16_1eb8[i + 2]),
1,
i + 0x29
);
@@ -442,24 +442,24 @@ void FoolGame::cardsRevealHands() {
}
// 139:1028
// determine winner
- this->var_i16_2016 = 0;
- if (this->arr_i16_1eb8[1] > this->arr_i16_1eb8[2]) {
- this->var_i16_2016 = 1; // fool wins
+ var_i16_2016 = 0;
+ if (arr_i16_1eb8[1] > arr_i16_1eb8[2]) {
+ var_i16_2016 = 1; // fool wins
}
// 139:105e
- if (this->arr_i16_1eb8[1] < this->arr_i16_1eb8[2]) {
- this->var_i16_2016 = 2; // ol' mate wins
+ if (arr_i16_1eb8[1] < arr_i16_1eb8[2]) {
+ var_i16_2016 = 2; // ol' mate wins
}
- if (this->var_i16_2016 == 0) {
- if (this->arr_i16_1eb8[3] > this->arr_i16_1eb8[4]) {
- this->var_i16_2016 = 1; // fool wins
+ if (var_i16_2016 == 0) {
+ if (arr_i16_1eb8[3] > arr_i16_1eb8[4]) {
+ var_i16_2016 = 1; // fool wins
}
// 139:10c8
- if (this->arr_i16_1eb8[3] < this->arr_i16_1eb8[4]) {
- this->var_i16_2016 = 2; // ol' mate wins
+ if (arr_i16_1eb8[3] < arr_i16_1eb8[4]) {
+ var_i16_2016 = 2; // ol' mate wins
}
// 139:10f8
- if (this->arr_i16_1eb8[1] != 0) {
+ if (arr_i16_1eb8[1] != 0) {
for (int i = 1; i <= 2; i++) {
_zbasic->indexSet(
_zbasic->index(1, 0x27 + i) + _zbasic->str(OFF(9)) + _zbasic->index(1, 0x29 + i) + _zbasic->str(OFF(10)),
@@ -470,127 +470,127 @@ void FoolGame::cardsRevealHands() {
}
}
// 139:1174
- this->drawTarotCard(6, 3, 0);
+ drawTarotCard(6, 3, 0);
// calculate number of points gained by the winner
- this->var_i16_2012 = 9*(this->arr_i16_1eb8[this->var_i16_2016] + 1);
+ var_i16_2012 = 9*(arr_i16_1eb8[var_i16_2016] + 1);
- this->cardsDrawScores();
- if (this->var_i16_2016 == 1) {
- this->var_str_384 = _zbasic->str(OFF(11)); // The fool
+ cardsDrawScores();
+ if (var_i16_2016 == 1) {
+ var_str_384 = _zbasic->str(OFF(11)); // The fool
} else {
// 139:11ce
- this->var_str_384 = _zbasic->str(OFF(12)); // The Old Man
+ var_str_384 = _zbasic->str(OFF(12)); // The Old Man
}
// 139:11e2
- if ((this->arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (this->arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
- this->var_str_9f4 = _zbasic->str(OFF(13)); // the game!
+ if ((arr_i16_1eb8[5] > CARDS_MAX_SCORE) || (arr_i16_1eb8[6] > CARDS_MAX_SCORE)) {
+ var_str_9f4 = _zbasic->str(OFF(13)); // the game!
} else {
// 139:123e
- this->var_str_9f4 = Common::U32String::format(" %d", this->var_i16_2012) + _zbasic->str(OFF(14)); // X points
+ var_str_9f4 = Common::U32String::format(" %d", var_i16_2012) + _zbasic->str(OFF(14)); // X points
}
// 139:1264
- this->var_str_384 += _zbasic->str(OFF(15)) + this->var_str_9f4; // X wins Y
+ var_str_384 += _zbasic->str(OFF(15)) + var_str_9f4; // X wins Y
// winning hand
- this->var_str_167c = _zbasic->index(1, 0x28);
+ var_str_167c = _zbasic->index(1, 0x28);
// losing hand
- this->var_str_2222 = _zbasic->index(1, 0x29);
- if (this->var_i16_2016 == 2) {
- _zbasic->swapStr(this->var_str_167c, this->var_str_2222);
+ var_str_2222 = _zbasic->index(1, 0x29);
+ if (var_i16_2016 == 2) {
+ _zbasic->swapStr(var_str_167c, var_str_2222);
}
- this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
- this->var_i16_7e4 = _toolbox->StringWidth(this->var_str_167c);
- this->var_i16_9f2 = _toolbox->StringWidth(this->var_str_2222);
- this->var_i16_2322 = 0;
- if (this->var_i16_484 > this->var_i16_2322) {
- this->var_i16_2322 = this->var_i16_484;
+ var_i16_484 = _toolbox->StringWidth(var_str_384);
+ var_i16_7e4 = _toolbox->StringWidth(var_str_167c);
+ var_i16_9f2 = _toolbox->StringWidth(var_str_2222);
+ var_i16_2322 = 0;
+ if (var_i16_484 > var_i16_2322) {
+ var_i16_2322 = var_i16_484;
}
// 139:1318
- if (this->var_i16_7e4 > this->var_i16_2322) {
- this->var_i16_2322 = this->var_i16_7e4;
+ if (var_i16_7e4 > var_i16_2322) {
+ var_i16_2322 = var_i16_7e4;
}
- if (this->var_i16_9f2 > this->var_i16_2322) {
- this->var_i16_2322 = this->var_i16_9f2;
+ if (var_i16_9f2 > var_i16_2322) {
+ var_i16_2322 = var_i16_9f2;
}
// 139:1344
- this->var_i16_2322 = (this->var_i16_2322 / 2) + 0x14;
- this->fillRect(0x2e, 0x100 - this->var_i16_2322, 0x9a, 0x100 + this->var_i16_2322, 2);
+ var_i16_2322 = (var_i16_2322 / 2) + 0x14;
+ fillRect(0x2e, 0x100 - var_i16_2322, 0x9a, 0x100 + var_i16_2322, 2);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->drawTextCenter(this->var_str_384, 0x46);
- this->drawTextCenter(this->var_str_167c, 0x64);
- this->drawTextCenter(_zbasic->str(OFF(16)), 0x78); // beats
- this->drawTextCenter(this->var_str_2222, 0x8c);
- if (this->arr_i16_1eb8[1] != 0) {
- this->var_i16_68a = this->arr_i16_1eb8[1];
- if (this->var_i16_68a > 8) {
- this->var_i16_68a -= 8;
+ drawTextCenter(var_str_384, 0x46);
+ drawTextCenter(var_str_167c, 0x64);
+ drawTextCenter(_zbasic->str(OFF(16)), 0x78); // beats
+ drawTextCenter(var_str_2222, 0x8c);
+ if (arr_i16_1eb8[1] != 0) {
+ var_i16_68a = arr_i16_1eb8[1];
+ if (var_i16_68a > 8) {
+ var_i16_68a -= 8;
}
// 139:1420
if (_zbasic->instr(
1,
- _zbasic->index(1, 0x15 + this->var_i16_68a),
+ _zbasic->index(1, 0x15 + var_i16_68a),
_zbasic->midStr(_zbasic->index(1, 0x26), 1, 1)
) == 0) {
- this->drawTarotCard(5, 0, 2);
+ drawTarotCard(5, 0, 2);
}
// 139:1470
if (_zbasic->instr(
1,
- _zbasic->index(1, 0x15 + this->var_i16_68a),
+ _zbasic->index(1, 0x15 + var_i16_68a),
_zbasic->midStr(_zbasic->index(1, 0x26), 2, 1)
) == 0) {
- this->drawTarotCard(7, 0, 2);
+ drawTarotCard(7, 0, 2);
}
// 139:14c0
if (_zbasic->instr(
1,
- _zbasic->index(1, 0x15 + this->var_i16_68a),
+ _zbasic->index(1, 0x15 + var_i16_68a),
_zbasic->midStr(_zbasic->index(1, 0x26), 3, 1)
) == 0) {
- this->drawTarotCard(9, 0, 2);
+ drawTarotCard(9, 0, 2);
}
} else {
// 139:1514
- this->var_str_384 = _zbasic->chr((0x15 - this->arr_i16_1eb8[3]) + 0x41);
- if (_zbasic->midStr(_zbasic->index(1, 0x26), 1, 1) != this->var_str_384) {
- this->drawTarotCard(5, 0, 2);
+ var_str_384 = _zbasic->chr((0x15 - arr_i16_1eb8[3]) + 0x41);
+ if (_zbasic->midStr(_zbasic->index(1, 0x26), 1, 1) != var_str_384) {
+ drawTarotCard(5, 0, 2);
}
// 139:157e
- if (_zbasic->midStr(_zbasic->index(1, 0x26), 2, 1) != this->var_str_384) {
- this->drawTarotCard(7, 0, 2);
+ if (_zbasic->midStr(_zbasic->index(1, 0x26), 2, 1) != var_str_384) {
+ drawTarotCard(7, 0, 2);
}
- if (_zbasic->midStr(_zbasic->index(1, 0x26), 3, 1) != this->var_str_384) {
- this->drawTarotCard(9, 0, 2);
+ if (_zbasic->midStr(_zbasic->index(1, 0x26), 3, 1) != var_str_384) {
+ drawTarotCard(9, 0, 2);
}
}
// 139:15f2
- if (this->arr_i16_1eb8[2] != 0) {
- this->var_i16_68a = this->arr_i16_1eb8[2];
- if (this->var_i16_68a > 8) {
- this->var_i16_68a -= 8;
+ if (arr_i16_1eb8[2] != 0) {
+ var_i16_68a = arr_i16_1eb8[2];
+ if (var_i16_68a > 8) {
+ var_i16_68a -= 8;
}
- if (_zbasic->instr(1, _zbasic->index(1, 0x15 + this->var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 1, 1)) == 0) {
- this->drawTarotCard(4, 0, 2);
+ if (_zbasic->instr(1, _zbasic->index(1, 0x15 + var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 1, 1)) == 0) {
+ drawTarotCard(4, 0, 2);
}
// 139:1678
- if (_zbasic->instr(1, _zbasic->index(1, 0x15 + this->var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 2, 1)) == 0) {
- this->drawTarotCard(6, 0, 2);
+ if (_zbasic->instr(1, _zbasic->index(1, 0x15 + var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 2, 1)) == 0) {
+ drawTarotCard(6, 0, 2);
}
// 139:16c8
- if (_zbasic->instr(1, _zbasic->index(1, 0x15 + this->var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 3, 1)) == 0) {
- this->drawTarotCard(8, 0, 2);
+ if (_zbasic->instr(1, _zbasic->index(1, 0x15 + var_i16_68a), _zbasic->midStr(_zbasic->index(1, 0x27), 3, 1)) == 0) {
+ drawTarotCard(8, 0, 2);
}
} else {
// 139:171c
- this->var_str_384 = _zbasic->chr((0x15 - this->arr_i16_1eb8[4]) + 0x41);
- if (this->var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 1, 1)) {
- this->drawTarotCard(4, 0, 2);
+ var_str_384 = _zbasic->chr((0x15 - arr_i16_1eb8[4]) + 0x41);
+ if (var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 1, 1)) {
+ drawTarotCard(4, 0, 2);
}
// 139:1786
- if (this->var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 2, 1)) {
- this->drawTarotCard(6, 0, 2);
+ if (var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 2, 1)) {
+ drawTarotCard(6, 0, 2);
}
- if (this->var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 3, 1)) {
- this->drawTarotCard(8, 0, 2);
+ if (var_str_384 != _zbasic->midStr(_zbasic->index(1, 0x27), 3, 1)) {
+ drawTarotCard(8, 0, 2);
}
}
// 139:17fa
@@ -598,14 +598,14 @@ void FoolGame::cardsRevealHands() {
void FoolGame::sub_139_17fc() {
// 139:17fc
- this->fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
- this->fillRect(0x14, 0x5f, 0xaf, 0x1a4, 1);
- this->fillRect(0x2a, 0, 0x156, 0xb4, 1);
- this->fillRect(0x2a, 0x14c, 0x156, 0x200, 1);
+ fillRect(0xb4, 0xb5, 0xf3, 0x14b, 2);
+ fillRect(0x14, 0x5f, 0xaf, 0x1a4, 1);
+ fillRect(0x2a, 0, 0x156, 0xb4, 1);
+ fillRect(0x2a, 0x14c, 0x156, 0x200, 1);
// 139:1878
for (int i = 1; i <= 2; i++) {
- this->arr_i16_1eb8[i + 2] = 0;
- this->arr_i16_1eb8[i] = 0;
+ arr_i16_1eb8[i + 2] = 0;
+ arr_i16_1eb8[i] = 0;
_zbasic->indexSet(Common::U32String(), 1, 0x25 + i); // was: str(OFF(17))
_zbasic->indexSet(Common::U32String(), 1, 0x27 + i); // was: str(OFF(18))
_zbasic->indexSet(Common::U32String(), 1, 0x29 + i); // was: str(OFF(19))
@@ -614,12 +614,12 @@ void FoolGame::sub_139_17fc() {
void FoolGame::sub_139_191c() {
// 139:191c
- this->arr_i16_1eb8[this->var_i16_2016 + 2] = 0;
- for (int i = 1; i <= (int)_zbasic->index(1, this->var_i16_2016 + 0x25).size(); i++) {
- this->var_i16_484 = 0x15 - (_zbasic->asc(_zbasic->midStr(_zbasic->index(1, 0x25 + this->var_i16_2016), i, 1)) - 0x41);
+ arr_i16_1eb8[var_i16_2016 + 2] = 0;
+ for (int i = 1; i <= (int)_zbasic->index(1, var_i16_2016 + 0x25).size(); i++) {
+ var_i16_484 = 0x15 - (_zbasic->asc(_zbasic->midStr(_zbasic->index(1, 0x25 + var_i16_2016), i, 1)) - 0x41);
// 139:1974
- if (this->var_i16_484 > this->arr_i16_1eb8[2 + this->var_i16_2016]) {
- this->arr_i16_1eb8[2 + this->var_i16_2016] = this->var_i16_484;
+ if (var_i16_484 > arr_i16_1eb8[2 + var_i16_2016]) {
+ arr_i16_1eb8[2 + var_i16_2016] = var_i16_484;
}
// 139:19b8
}
@@ -627,26 +627,26 @@ void FoolGame::sub_139_191c() {
void FoolGame::sub_139_19da() {
// 139:19da
- this->arr_i16_1eb8[this->var_i16_2016] = 0;
+ arr_i16_1eb8[var_i16_2016] = 0;
for (int k = 1; k <= 2; k++) {
// cycle backward through the scoring combinations
for (int j = 8; j >= 1; j--) {
- this->var_i16_7a8 = 0;
+ var_i16_7a8 = 0;
for (int i = 1; i <= (int)_zbasic->index(1, j + 0x15).size(); i++) {
if (_zbasic->instr(
1,
- _zbasic->index(1, this->var_i16_2016 + 0x25),
+ _zbasic->index(1, var_i16_2016 + 0x25),
_zbasic->midStr(_zbasic->index(1, 0x15 + j), i, 1)
) != 0) {
- this->var_i16_7a8++;
+ var_i16_7a8++;
}
// 139:1a4c
}
// 139:1a6a
- if (((k == 2) && (this->var_i16_7a8 == 2)) ||
- ((k == 1) && (this->var_i16_7a8 == 3))) {
+ if (((k == 2) && (var_i16_7a8 == 2)) ||
+ ((k == 1) && (var_i16_7a8 == 3))) {
// 139:1ad6
- this->arr_i16_1eb8[this->var_i16_2016] = (this->var_i16_7a8 - 2)*8 + j;
+ arr_i16_1eb8[var_i16_2016] = (var_i16_7a8 - 2)*8 + j;
j = 1;
k = 2;
}
@@ -658,38 +658,38 @@ void FoolGame::sub_139_19da() {
void FoolGame::cardsDrawScores() {
// 139:1b12
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->arr_i16_1eb8[this->var_i16_2016 + 4] += this->var_i16_2012;
- if (this->arr_i16_1eb8[5] < CARDS_MIN_SCORE) {
- this->arr_i16_1eb8[5] = CARDS_MIN_SCORE;
+ arr_i16_1eb8[var_i16_2016 + 4] += var_i16_2012;
+ if (arr_i16_1eb8[5] < CARDS_MIN_SCORE) {
+ arr_i16_1eb8[5] = CARDS_MIN_SCORE;
}
// 139:1b88
- if (this->arr_i16_1eb8[6] < CARDS_MIN_SCORE) {
- this->arr_i16_1eb8[6] = CARDS_MIN_SCORE;
+ if (arr_i16_1eb8[6] < CARDS_MIN_SCORE) {
+ arr_i16_1eb8[6] = CARDS_MIN_SCORE;
}
// 139:1bb2
- this->fillRect(0x14, 0, 0x29, 0x5a, 2);
+ fillRect(0x14, 0, 0x29, 0x5a, 2);
// Old Man
- this->var_str_384 = _zbasic->str(OFF(20)) + Common::U32String::format(" %d", this->arr_i16_1eb8[6]);
- this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
- _toolbox->MoveTo(0x2d - (this->var_i16_484 / 2), 0x23);
- _toolbox->DrawString(this->var_str_384);
+ var_str_384 = _zbasic->str(OFF(20)) + Common::U32String::format(" %d", arr_i16_1eb8[6]);
+ var_i16_484 = _toolbox->StringWidth(var_str_384);
+ _toolbox->MoveTo(0x2d - (var_i16_484 / 2), 0x23);
+ _toolbox->DrawString(var_str_384);
// 139:1c30
- this->fillRect(0x14, 0x1a6, 0x29, 0x200, 2);
- this->var_str_384 = _zbasic->str(OFF(21)) + Common::U32String::format(" %d", this->arr_i16_1eb8[5]);
- this->var_i16_484 = _toolbox->StringWidth(this->var_str_384);
- _toolbox->MoveTo(0x1d3 - (this->var_i16_484 / 2), 0x23);
- _toolbox->DrawString(this->var_str_384);
+ fillRect(0x14, 0x1a6, 0x29, 0x200, 2);
+ var_str_384 = _zbasic->str(OFF(21)) + Common::U32String::format(" %d", arr_i16_1eb8[5]);
+ var_i16_484 = _toolbox->StringWidth(var_str_384);
+ _toolbox->MoveTo(0x1d3 - (var_i16_484 / 2), 0x23);
+ _toolbox->DrawString(var_str_384);
}
void FoolGame::cardsStoreState() {
// 139:1cba
- _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[5]) +
- _zbasic->encodeInt(this->arr_i16_1eb8[6]) +
- _zbasic->encodeInt(this->var_i16_2010);
+ _activePuzzleBuffer = _zbasic->encodeInt(arr_i16_1eb8[5]) +
+ _zbasic->encodeInt(arr_i16_1eb8[6]) +
+ _zbasic->encodeInt(var_i16_2010);
// 139:1d00
for (int i = 0; i <= 0x15; i++) {
- _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_5cbc[i]);
+ _activePuzzleBuffer += _zbasic->encodeInt(arr_i16_5cbc[i]);
}
}
@@ -699,9 +699,9 @@ void FoolGame::sub_139_1d3e() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->waitForMouseUp();
- this->menuClickMessage();
- this->flashRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
+ waitForMouseUp();
+ menuClickMessage();
+ flashRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
}
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 96f5c1f5a98..87cd187391a 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -31,21 +31,21 @@ namespace Fool {
// Death challenge
void FoolGame::deathRun() {
// 141:0004
- _zbasic->get(0x6c, 0x127, 0x84, 0x127, this->arr_bmp_c38c);
- this->drawPuzzleButton(Common::U32String("~")); // was: str(334)
- _toolbox->InvertRect(this->arr_rect_1910c);
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
- _zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
- this->deathDrawZoom();
- this->fillRect(0x14f, 0, 0x156, 0x7, 0x2);
- this->fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x127, arr_bmp_c38c);
+ drawPuzzleButton(Common::U32String("~")); // was: str(334)
+ _toolbox->InvertRect(arr_rect_1910c);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_b3ec);
+ _zbasic->put(0x6c, 0x127, arr_bmp_c38c, kSrcCopy);
+ deathDrawZoom();
+ fillRect(0x14f, 0, 0x156, 0x7, 0x2);
+ fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
_deathBlackEye.top = 0x1e;
_deathBlackEye.left = 0x190;
_deathBlackEye.bottom = 0x2e;
_deathBlackEye.right = 0x1a8;
// 141:0122
- _zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, this->arr_bmp_bbbc);
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, arr_bmp_bbbc);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
_event.where.y = 0x14;
// JMP 0x3c2
while (true) {
@@ -53,12 +53,12 @@ void FoolGame::deathRun() {
// JMP 0x232
while (_event.where.y >= 0x14) {
// 141:01cc
- this->getNextEvent(-1);
- this->deathMoveBlackEye();
+ getNextEvent(-1);
+ deathMoveBlackEye();
if (_toolbox->PtInRect(_event.where, _deathBlackEye)) {
- this->deathCaught();
+ deathCaught();
// 141:09f6
- this->deathDrawWhiteEye();
+ deathDrawWhiteEye();
return;
}
// 141:0200
@@ -66,53 +66,53 @@ void FoolGame::deathRun() {
_stateFlags = kStateNull;
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
if ((_stateFlags & kStateReturn)) {
// 141:09f6
- this->deathDrawWhiteEye();
+ deathDrawWhiteEye();
return;
}
}
// 141:023a
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_c38c);
- this->drawPuzzleButton(Common::U32String("~")); // was: str(335))
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_c38c);
+ drawPuzzleButton(Common::U32String("~")); // was: str(335))
_deathWhiteEyeNeedsDraw = true;
// JMP 0x2be
while (_event.where.y < 0x14) {
// cursor is over the top menu, safe
// 141:0282
- this->deathMoveBlackEye();
- this->getNextEvent(-1);
+ deathMoveBlackEye();
+ getNextEvent(-1);
if (_stateFlags == kStateUndo) {
_stateFlags = kStateNull;
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
}
// 141:02c6
- this->getNextEvent(0);
- if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
- this->var_i32_692 = _toolbox->TickCount();
+ getNextEvent(0);
+ if (_toolbox->PtInRect(_event.where, arr_rect_1910c)) {
+ var_i32_692 = _toolbox->TickCount();
// 141:02fa
do {
- this->getNextEvent(0);
+ getNextEvent(0);
if (((_event.modifiers & kModMouseButtonUp) == 0) &&
- _toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
+ _toolbox->PtInRect(_event.where, arr_rect_1910c)) {
// JMP 0x9a2
// 141:09a2
- this->deathDrawWhiteEye();
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_bbbc, kSrcCopy);
- this->deathDrawZoom();
+ deathDrawWhiteEye();
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_bbbc, kSrcCopy);
+ deathDrawZoom();
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->deathDrawWhiteEye();
+ deathDrawWhiteEye();
return;
}
// 141:0342
- } while (_toolbox->TickCount() <= (this->var_i32_692 + 0x2d));
+ } while (_toolbox->TickCount() <= (var_i32_692 + 0x2d));
}
// 141:035a
// mouse moved out from menu, zap the white eye
@@ -126,40 +126,40 @@ void FoolGame::deathRun() {
_toolbox->Delay(0);
}
// 141:03bc
- this->deathDrawWhiteEye();
+ deathDrawWhiteEye();
_toolbox->PenNormal();
}
// 141:03c2
- this->deathMoveBlackEye();
+ deathMoveBlackEye();
}
void FoolGame::deathMoveBlackEye() {
// 141:03ca
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
- this->var_i16_68a = _event.where.x - 0xc - _deathBlackEye.left;
- this->var_i16_68c = _event.where.y - 8 - _deathBlackEye.top;
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ var_i16_68a = _event.where.x - 0xc - _deathBlackEye.left;
+ var_i16_68c = _event.where.y - 8 - _deathBlackEye.top;
// 141:0452
- if (this->var_i16_68c < -4) {
- this->var_i16_68c = -4;
+ if (var_i16_68c < -4) {
+ var_i16_68c = -4;
}
- if (this->var_i16_68c > 4) {
- this->var_i16_68c = 4;
+ if (var_i16_68c > 4) {
+ var_i16_68c = 4;
}
- if (this->var_i16_68a < -6) {
- this->var_i16_68a = -6;
+ if (var_i16_68a < -6) {
+ var_i16_68a = -6;
}
- if (this->var_i16_68a > 6) {
- this->var_i16_68a = 6;
+ if (var_i16_68a > 6) {
+ var_i16_68a = 6;
}
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
// 141:04ce
Common::Rect newPos; // arr_rect_1ec0
- newPos.top = _deathBlackEye.top + this->var_i16_68c;
- newPos.left = _deathBlackEye.left + this->var_i16_68a;
- newPos.bottom = _deathBlackEye.bottom + this->var_i16_68c;
- newPos.right = _deathBlackEye.right + this->var_i16_68a;
+ newPos.top = _deathBlackEye.top + var_i16_68c;
+ newPos.left = _deathBlackEye.left + var_i16_68a;
+ newPos.bottom = _deathBlackEye.bottom + var_i16_68c;
+ newPos.right = _deathBlackEye.right + var_i16_68a;
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
// 141:05a2
if (newPos.top < 0x14) {
newPos.top = 0x14;
@@ -179,16 +179,16 @@ void FoolGame::deathMoveBlackEye() {
newPos.left = 0x1e8;
newPos.right = 0x200;
}
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
// 141:06bc
if (!((_deathBlackEye.top == newPos.top) &&
((_deathBlackEye.left == newPos.left)))) {
// 141:0722
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_bbbc, kSrcCopy);
_deathBlackEye = newPos;
- _zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, this->arr_bmp_bbbc);
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, this->arr_bmp_b3ec, kSrcCopy);
- this->delay(1);
+ _zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, arr_bmp_bbbc);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ delay(1);
}
// 141:0880
}
@@ -196,7 +196,7 @@ void FoolGame::deathMoveBlackEye() {
void FoolGame::deathDrawWhiteEye() {
// 141:0882
if (_deathWhiteEyeNeedsDraw) {
- _zbasic->put(0x6c, 0x127, this->arr_bmp_c38c, kSrcCopy);
+ _zbasic->put(0x6c, 0x127, arr_bmp_c38c, kSrcCopy);
}
// 141:08b0
_deathWhiteEyeNeedsDraw = false;
@@ -204,18 +204,18 @@ void FoolGame::deathDrawWhiteEye() {
void FoolGame::deathCaught() {
// 141:08b8
- this->deathDrawWhiteEye();
- this->toggleMouseCursor(false);
- this->zoomRect(_deathBlackEye.top, _deathBlackEye.left, _deathBlackEye.bottom, _deathBlackEye.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
- this->toggleMouseCursor(true);
+ deathDrawWhiteEye();
+ toggleMouseCursor(false);
+ zoomRect(_deathBlackEye.top, _deathBlackEye.left, _deathBlackEye.bottom, _deathBlackEye.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ toggleMouseCursor(true);
}
void FoolGame::deathDrawZoom() {
// 141:0934
for (int i = 1; i <= 2; i++) {
- this->zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
- this->fillRect(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ fillRect(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
}
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 8843d5c57d1..1939ef9fa08 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -170,13 +170,13 @@ void FoolGame::foolRun() {
}
// Define the bitmap surfaces (normally pointers to raw memory)
- this->arr_bmp_5dfc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_bbbc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_c38c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_fa3c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_109dc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
- this->arr_bmp_138bc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_5dfc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_bbbc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_c38c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_fa3c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_109dc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ arr_bmp_138bc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
// 128:0004
_zbasic->unk_331(0xdac0, 0);
@@ -186,16 +186,16 @@ void FoolGame::foolRun() {
_toolbox->SetRect(_screenClipRect, 0, MENU_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
// copyright + zbasic notice
- //this->var_str_384 = _zbasic->str(0);
- //this->var_str_384 = _zbasic->str(1);
- //this->var_str_384 = _zbasic->str(2);
+ //var_str_384 = _zbasic->str(0);
+ //var_str_384 = _zbasic->str(1);
+ //var_str_384 = _zbasic->str(2);
// 128:0086
// 128:0086: MOVEQ - 0x0,D0
// 128:0088: SNE - -0x98c(A5)
_zbasic->unk_44(0);
- this->var_i16_484 = 0;
+ var_i16_484 = 0;
// 128:0096: LEA - [0x3818],A0
// 128:009a: MOVE.L - A0,-0x8ee(A5)
@@ -210,8 +210,8 @@ void FoolGame::foolRun() {
// 128:0442: JMP - [0x45e]
// 128:045e: JMP - [0x478]
// 128:0478
- //this->var_str_69a.clear(); // was: str(6);
- //this->var_i32_79a = &this->var_str_69a;
+ //var_str_69a.clear(); // was: str(6);
+ //var_i32_79a = &var_str_69a;
// 128:0496: JMP - [0x4d6]
// 128:04d6: JMP - [0x50a]
// 128:050a: JMP - [0x558]
@@ -232,31 +232,31 @@ void FoolGame::foolRun() {
// 128:1c46: JMP - [0x1c7a]
// 128:1c7a
- this->sub_129_068();
- this->var_i32_7c8 = _zbasic->mem(-1);
+ sub_129_068();
+ var_i32_7c8 = _zbasic->mem(-1);
// 128:1c88: JMP - [0x1ee2]
while (_stateFlags != kStateQuit) {
do {
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_quit)
return;
if ((_event.where.y >= 0x8c) && (_event.where.y <= 0x11d)) {
- this->var_i16_7cc = -1;
+ var_i16_7cc = -1;
}
// 128:1cbe
if (_event.where.y > 0x11d) {
- this->var_i16_7cc = 1;
+ var_i16_7cc = 1;
}
// 128:1cce
if ((_event.where.x <= 0x8c) || (_event.where.y < 0xdc)) {
- this->var_i16_7cc = 0;
+ var_i16_7cc = 0;
}
// 128:1cf6
- if (this->var_i16_7cc != this->var_i16_7b2) {
- this->var_i16_7b2 = this->var_i16_7cc;
- if (this->var_i16_7b2 == 0) {
- if ((this->var_i16_7ce & 2) == 0) {
+ if (var_i16_7cc != var_i16_7b2) {
+ var_i16_7b2 = var_i16_7cc;
+ if (var_i16_7b2 == 0) {
+ if ((var_i16_7ce & 2) == 0) {
_toolbox->InitCursor();
} else {
_toolbox->SetCursor(_cursors[0x10]);
@@ -264,12 +264,12 @@ void FoolGame::foolRun() {
// 128:1d42
} else {
// 128:1d46
- if (this->var_i16_7b2 == -1) {
+ if (var_i16_7b2 == -1) {
// arrow pointing up
_toolbox->SetCursor(_cursors[0x2]);
}
// 128:1d5e
- if (this->var_i16_7b2 == 1) {
+ if (var_i16_7b2 == 1) {
// arrow pointing down
_toolbox->SetCursor(_cursors[0x1]);
}
@@ -277,7 +277,7 @@ void FoolGame::foolRun() {
}
// 128:1d76
if (_event.what == kMouseDown) {
- this->sub_128_1f76();
+ sub_128_1f76();
}
if ((_storyCurrentChapter == 0x10) &&
(_puzzleCompletionStatus[0x10] < 0x64) &&
@@ -293,45 +293,45 @@ void FoolGame::foolRun() {
} while (_stateFlags == 0);
if (_stateFlags & kStateReturn) {
- this->clearStateBits(kStateReturn);
+ clearStateBits(kStateReturn);
}
if (_stateFlags & kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
if (_stateFlags & kStateNewGame) {
- this->newGame();
+ newGame();
}
if (_stateFlags & kStateOpenGame) {
- this->openGame();
+ openGame();
}
if (_stateFlags & kStateChapterSelect) {
- this->menuChapterSelect();
+ menuChapterSelect();
}
if (_stateFlags & 0x200) {
- this->sub_128_1f44();
+ sub_128_1f44();
}
if (_stateFlags & kStatePuzzleSelect) {
- this->puzzleRun();
+ puzzleRun();
}
if (_stateFlags & kStateMetapuzzleSelect) {
- this->metapuzzleRun();
+ metapuzzleRun();
}
if (_stateFlags & kStatePrintStory) {
- this->printStory();
+ printStory();
}
if (_stateFlags & kStateMetapuzzleComplete) {
- this->sub_144_004();
+ sub_144_004();
}
// 128:1ee2
}
// 128:1eec
- this->sub_128_1f1e();
+ sub_128_1f1e();
_zbasic->unk_158();
_zbasic->unk_4();
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
fillRect(0, 0, MENU_HEIGHT, _windowWidth, 2);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(var_i32_0);
}
void FoolGame::copyScreen(int16 put, BitMap &bmp) {
@@ -351,83 +351,83 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
void FoolGame::openSaveFileDialog(const Common::U32String &title, const Common::U32String &filename) {
// 128:011c
- this->var_str_384 = _zbasic->str(3);
+ var_str_384 = _zbasic->str(3);
- this->var_i16_586 = 0;
+ var_i16_586 = 0;
- this->copyScreen(0, this->arr_bmp_138bc);
+ copyScreen(0, arr_bmp_138bc);
// 128:015a
- _event.where.y = this->var_i16_58 + 0x3d;
- _event.where.x = this->var_i16_56 + 0x68;
+ _event.where.y = var_i16_58 + 0x3d;
+ _event.where.x = var_i16_56 + 0x68;
// 128:017e
- _toolbox->SFPutFile(_event.where, title, filename, 0, this->var_sfr_5e);
- this->sub_128_6244();
+ _toolbox->SFPutFile(_event.where, title, filename, 0, var_sfr_5e);
+ sub_128_6244();
- this->copyScreen(1, this->arr_bmp_138bc);
+ copyScreen(1, arr_bmp_138bc);
// 128:01b0
- if (this->var_sfr_5e.good == 1) {
- this->var_str_486 = this->var_sfr_5e.fName;
- this->var_i16_586 = this->var_sfr_5e.vRefNum;
+ if (var_sfr_5e.good == 1) {
+ var_str_486 = var_sfr_5e.fName;
+ var_i16_586 = var_sfr_5e.vRefNum;
}
}
void FoolGame::sub_128_1e4(const Common::String &osType) {
// 128:01e4
- this->var_str_588 = _zbasic->str(4);
- this->var_i16_688 = 0;
+ var_str_588 = _zbasic->str(4);
+ var_i16_688 = 0;
- this->copyScreen(0, this->arr_bmp_138bc);
+ copyScreen(0, arr_bmp_138bc);
// 128:0218
- _event.where.y = this->var_i16_58 + 0x3d;
- _event.where.x = this->var_i16_56 + 0x53;
+ _event.where.y = var_i16_58 + 0x3d;
+ _event.where.x = var_i16_56 + 0x53;
// 128:023c
// get offset of bytes in string and pretend it's an OSType
- // this->var_i32_168 = *(this->var_str_172 + 1);
+ // var_i32_168 = *(var_str_172 + 1);
SFTypeList typeList = { { 0 } };
typeList.types[0] = osType.at(0) << 24;
typeList.types[0] += osType.at(1) << 16;
typeList.types[0] += osType.at(2) << 8;
typeList.types[0] += osType.at(3) << 0;
- _toolbox->SFGetFile(_event.where, _zbasic->str(5), 0, 1, typeList, 0, this->var_sfr_5e);
- this->sub_128_6244();
- this->copyScreen(1, this->arr_bmp_138bc);
+ _toolbox->SFGetFile(_event.where, _zbasic->str(5), 0, 1, typeList, 0, var_sfr_5e);
+ sub_128_6244();
+ copyScreen(1, arr_bmp_138bc);
- if (this->var_sfr_5e.good == 1) {
+ if (var_sfr_5e.good == 1) {
// 128:02a2
- this->var_str_588 += this->var_sfr_5e.fName;
- this->var_i16_688 = this->var_sfr_5e.vRefNum;
+ var_str_588 += var_sfr_5e.fName;
+ var_i16_688 = var_sfr_5e.vRefNum;
}
}
void FoolGame::getGridFromMouse(int16 &gridX, int16 &gridY) {
// 128:02be
// convert mouse coordinates to grid coordinates
- gridX = (_event.where.x - this->arr_i16_1eb8[4]) / (this->arr_i16_1eb8[6]);
+ gridX = (_event.where.x - arr_i16_1eb8[4]) / (arr_i16_1eb8[6]);
- gridY = (_event.where.y - this->arr_i16_1eb8[5]) / (this->arr_i16_1eb8[7]);
+ gridY = (_event.where.y - arr_i16_1eb8[5]) / (arr_i16_1eb8[7]);
}
void FoolGame::sub_128_342(int16 unk2, int16 unk1) {
// 128:0342
- this->var_i16_68c = unk1;
- this->var_i16_68a = unk2;
- if (this->var_i16_68a < 1) {
- this->var_i16_68a = 1;
+ var_i16_68c = unk1;
+ var_i16_68a = unk2;
+ if (var_i16_68a < 1) {
+ var_i16_68a = 1;
}
// 128:035c
- if (this->var_i16_68a > this->arr_i16_1eb8[0]) {
- this->var_i16_68a = this->arr_i16_1eb8[0];
+ if (var_i16_68a > arr_i16_1eb8[0]) {
+ var_i16_68a = arr_i16_1eb8[0];
}
- if (this->var_i16_68c < 1) {
- this->var_i16_68c = 1;
+ if (var_i16_68c < 1) {
+ var_i16_68c = 1;
}
- if (this->var_i16_68c > this->arr_i16_1eb8[1]) {
- this->var_i16_68c = this->arr_i16_1eb8[1];
+ if (var_i16_68c > arr_i16_1eb8[1]) {
+ var_i16_68c = arr_i16_1eb8[1];
}
}
@@ -444,43 +444,43 @@ void FoolGame::delayFromMarker(int16 numTicks) {
// 128:0402
do {
_toolbox->Delay(0);
- } while (_toolbox->TickCount() < (this->var_i32_692 + numTicks));
+ } while (_toolbox->TickCount() < (var_i32_692 + numTicks));
}
int16 FoolGame::puzzlesReadByte() {
// 128:0428
// read a byte
- int16 data = *(byte *)(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- debugC(8, kDebugLoading, "Read[%04x]: %02x", this->_puzzleDataPtr, data);
- this->_puzzleDataPtr += 1;
+ int16 data = *(byte *)(&_puzzleDataBuffer->data()[_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %02x", _puzzleDataPtr, data);
+ _puzzleDataPtr += 1;
return data;
}
int16 FoolGame::puzzlesReadShort() {
// 128:0446
// read a short
- int16 data = READ_BE_INT16(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- debugC(8, kDebugLoading, "Read[%04x]: %04x", this->_puzzleDataPtr, data);
- this->_puzzleDataPtr += 2;
+ int16 data = READ_BE_INT16(&_puzzleDataBuffer->data()[_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %04x", _puzzleDataPtr, data);
+ _puzzleDataPtr += 2;
return data;
}
int32 FoolGame::puzzlesReadLong() {
// 128:0462
// read a long
- int32 data = READ_BE_INT32(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- debugC(8, kDebugLoading, "Read[%04x]: %08x", this->_puzzleDataPtr, data);
- this->_puzzleDataPtr += 4;
+ int32 data = READ_BE_INT32(&_puzzleDataBuffer->data()[_puzzleDataPtr]);
+ debugC(8, kDebugLoading, "Read[%04x]: %08x", _puzzleDataPtr, data);
+ _puzzleDataPtr += 4;
return data;
}
Common::String FoolGame::puzzlesReadString() {
// 128:049a
// read a pascal string
- this->var_i16_79e = *(byte *)(&_puzzleDataBuffer->data()[this->_puzzleDataPtr]);
- Common::String result((const char *)&_puzzleDataBuffer->data()[this->_puzzleDataPtr+1], this->var_i16_79e);
- debugC(8, kDebugLoading, "Read[%04x]: %s", this->_puzzleDataPtr, result.c_str());
- this->_puzzleDataPtr += this->var_i16_79e + 1;
+ var_i16_79e = *(byte *)(&_puzzleDataBuffer->data()[_puzzleDataPtr]);
+ Common::String result((const char *)&_puzzleDataBuffer->data()[_puzzleDataPtr+1], var_i16_79e);
+ debugC(8, kDebugLoading, "Read[%04x]: %s", _puzzleDataPtr, result.c_str());
+ _puzzleDataPtr += var_i16_79e + 1;
return result;
}
@@ -488,15 +488,15 @@ void FoolGame::toggleMouseCursor(bool visible) {
// toggle the mouse cursor off or on
// 128:04da
if (!visible) {
- if (this->_mouseVisible) {
+ if (_mouseVisible) {
_toolbox->HideCursor();
}
} else {
- if (!this->_mouseVisible) {
+ if (!_mouseVisible) {
_toolbox->ShowCursor();
}
}
- this->_mouseVisible = visible;
+ _mouseVisible = visible;
}
void FoolGame::playTone(int16 freq, int16 duration, bool wait) {
@@ -516,9 +516,9 @@ void FoolGame::playTone(int16 freq, int16 duration, bool wait) {
void FoolGame::drawPuzzleButton(const Common::U32String &symbol) {
// 128:055c
_toolbox->PenNormal();
- _toolbox->SetRect(this->arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
- _toolbox->EraseRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- _toolbox->FrameRoundRect(this->arr_rect_1910c, 0x8, 0x7);
+ _toolbox->SetRect(arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
+ _toolbox->EraseRoundRect(arr_rect_1910c, 0x8, 0x7);
+ _toolbox->FrameRoundRect(arr_rect_1910c, 0x8, 0x7);
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
int16 width = _toolbox->StringWidth(symbol);
_toolbox->MoveTo(0x78 - (width / 2), 0x133);
@@ -561,7 +561,7 @@ void FoolGame::drawTarotCard(int16 rectID, int16 deckPos, int16 type) {
_toolbox->PenPat(_patterns[2]);
_toolbox->FrameRoundRect(_screenGrid[rectID], 0xf, 0xf);
// 128:079e
- _zbasic->picture(_screenGrid[rectID].left + 3, _screenGrid[rectID].top + 3, this->arr_i32_192c0[this->arr_i16_5cbc[deckPos]]);
+ _zbasic->picture(_screenGrid[rectID].left + 3, _screenGrid[rectID].top + 3, arr_i32_192c0[arr_i16_5cbc[deckPos]]);
}
// 128:0806
if (type == 1) {
@@ -612,25 +612,25 @@ void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int1
_toolbox->PenMode(mode);
// 128:0a42
// unrolled loop
- this->arr_bcd_5dbc[0] = (float)(start.top);
- this->arr_bcd_5dbc[1] = (float)(start.left);
- this->arr_bcd_5dbc[2] = (float)(start.bottom);
- this->arr_bcd_5dbc[3] = (float)(start.right);
- this->arr_bcd_5dbc[4] = (float)((end.top) - (start.top))/(float)(steps);
- this->arr_bcd_5dbc[5] = (float)((end.left) - (start.left))/(float)(steps);
- this->arr_bcd_5dbc[6] = (float)((end.bottom) - (start.bottom))/(float)(steps);
- this->arr_bcd_5dbc[7] = (float)((end.right) - (start.right))/(float)(steps);
+ arr_bcd_5dbc[0] = (float)(start.top);
+ arr_bcd_5dbc[1] = (float)(start.left);
+ arr_bcd_5dbc[2] = (float)(start.bottom);
+ arr_bcd_5dbc[3] = (float)(start.right);
+ arr_bcd_5dbc[4] = (float)((end.top) - (start.top))/(float)(steps);
+ arr_bcd_5dbc[5] = (float)((end.left) - (start.left))/(float)(steps);
+ arr_bcd_5dbc[6] = (float)((end.bottom) - (start.bottom))/(float)(steps);
+ arr_bcd_5dbc[7] = (float)((end.right) - (start.right))/(float)(steps);
// 128:0af0
_toolbox->PaintRect(start);
for (int i = 1; i < steps-1; i++) {
for (int j = 0; j <= 3; j++) {
- this->arr_bcd_5dbc[j] = (float)this->arr_bcd_5dbc[j] + (float)this->arr_bcd_5dbc[j+4];
+ arr_bcd_5dbc[j] = (float)arr_bcd_5dbc[j] + (float)arr_bcd_5dbc[j+4];
}
Common::Rect temp; // arr_rect_5b92
- temp.top = (int)this->arr_bcd_5dbc[0];
- temp.left = (int)this->arr_bcd_5dbc[1];
- temp.bottom = (int)this->arr_bcd_5dbc[2];
- temp.right = (int)this->arr_bcd_5dbc[3];
+ temp.top = (int)arr_bcd_5dbc[0];
+ temp.left = (int)arr_bcd_5dbc[1];
+ temp.bottom = (int)arr_bcd_5dbc[2];
+ temp.right = (int)arr_bcd_5dbc[3];
// 128:0ba6
_toolbox->PaintRect(temp);
// new: force a redraw delay
@@ -643,13 +643,13 @@ void FoolGame::zoomRect(int16 startTop, int16 startLeft, int16 startBottom, int1
void FoolGame::sub_128_bde(int16 unk6, int16 unk5, int16 unk4, int16 unk3, int16 unk2, int16 unk1) {
// 128:0bde
- this->arr_i16_4758[0] = unk6;
- this->arr_i16_4758[1] = unk5;
- this->arr_i16_4758[2] = unk4;
- this->arr_i16_4758[3] = unk3;
- this->arr_i16_4758[4] = unk2;
- this->arr_i16_4758[5] = unk1;
- this->storyDrawZoom();
+ arr_i16_4758[0] = unk6;
+ arr_i16_4758[1] = unk5;
+ arr_i16_4758[2] = unk4;
+ arr_i16_4758[3] = unk3;
+ arr_i16_4758[4] = unk2;
+ arr_i16_4758[5] = unk1;
+ storyDrawZoom();
}
void FoolGame::getNextEvent(uint32 unk1) {
@@ -660,9 +660,9 @@ void FoolGame::getNextEvent(uint32 unk1) {
if (_event.what == kNullEvent)
_toolbox->Delay(0);
- this->var_i16_78a = _toolbox->GetNextEvent(unk1, _event);
+ var_i16_78a = _toolbox->GetNextEvent(unk1, _event);
if ((_event.what == kMouseDown) && (_event.where.y < MENU_HEIGHT)) {
- this->onClickMenu();
+ onClickMenu();
}
// 128:0caa
_toolbox->GlobalToLocal(_event.where);
@@ -670,23 +670,23 @@ void FoolGame::getNextEvent(uint32 unk1) {
// the original just checked the command key,
// non-mac PCs expect the control key to work
if ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0) {
- this->sub_128_5f9e();
+ sub_128_5f9e();
} else {
- this->onMenuKey();
+ onMenuKey();
}
}
// 128:0ce0
if ((_event.what == kAutoKey) && ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0)) {
- this->sub_128_5f9e();
+ sub_128_5f9e();
}
if (_event.what == kUpdateEvt) {
- this->onUpdateEvent();
+ onUpdateEvent();
}
if (_event.what == kDiskEvt) {
- this->onDiskEvent();
+ onDiskEvent();
}
if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
- this->menuQuit();
+ menuQuit();
}
}
@@ -710,7 +710,7 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
// originally this mask was 0, but we change it here to
// intercept all events, and fall back to NullEvent +
// wait for vsync if no events were received.
- this->var_i16_78a = _toolbox->GetNextEvent(-1, _event);
+ var_i16_78a = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kNullEvent) {
_toolbox->Delay(0);
ticks += 1;
@@ -722,39 +722,39 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount, bool beep) {
// 128:0dfe
- _toolbox->SetPort(this->var_i32_4);
- this->var_i16_7b2 = 0xa;
+ _toolbox->SetPort(var_i32_4);
+ var_i16_7b2 = 0xa;
_toolbox->InitCursor();
- this->toggleMouseCursor(true);
+ toggleMouseCursor(true);
if (beep) {
- this->playTone(0x19, 0x64, false);
+ playTone(0x19, 0x64, false);
}
// 128:0e46
- this->copyScreen(0, this->arr_bmp_138bc);
+ copyScreen(0, arr_bmp_138bc);
_zbasic->text(font, 0xc, Graphics::kMacFontRegular, kSrcBic);
- this->var_i16_7b4 = buttonCount*0x46;
- this->var_i16_7b6 = 0;
+ var_i16_7b4 = buttonCount*0x46;
+ var_i16_7b6 = 0;
for (int i = 0; i <= lineCount; i++) {
// 128:0e86
- this->var_i16_7ba = _toolbox->StringWidth(_modalText[i]);
- if (this->var_i16_7ba > this->var_i16_7b4) {
- this->var_i16_7b4 = this->var_i16_7ba;
+ var_i16_7ba = _toolbox->StringWidth(_modalText[i]);
+ if (var_i16_7ba > var_i16_7b4) {
+ var_i16_7b4 = var_i16_7ba;
}
- this->var_i16_7b6 += 0x11;
+ var_i16_7b6 += 0x11;
}
// 128:0ed6
if (buttonCount >= 0) {
- this->var_i16_7bc = 0xa4 + (this->var_i16_7b6 / 2);
- this->var_i16_7b6 += 0x28;
+ var_i16_7bc = 0xa4 + (var_i16_7b6 / 2);
+ var_i16_7b6 += 0x28;
} else {
- this->var_i16_7b6 += 0xd;
+ var_i16_7b6 += 0xd;
}
// 128:0f08
- this->var_i16_7b4 = (this->var_i16_7b4 / 2) + 0xf;
- this->var_i16_7b6 = (this->var_i16_7b6 / 2);
+ var_i16_7b4 = (var_i16_7b4 / 2) + 0xf;
+ var_i16_7b6 = (var_i16_7b6 / 2);
_toolbox->PenNormal();
Common::Rect bounds; // arr_rect_5b7c
- _toolbox->SetRect(bounds, 0xf5-this->var_i16_7b4, 0xa0-this->var_i16_7b6, 0x10b+this->var_i16_7b4, 0xb6+this->var_i16_7b6);
+ _toolbox->SetRect(bounds, 0xf5-var_i16_7b4, 0xa0-var_i16_7b6, 0x10b+var_i16_7b4, 0xb6+var_i16_7b6);
_toolbox->PenPat(_patterns[0]);
_toolbox->FrameRect(bounds);
_toolbox->InsetRect(bounds, 1, 1);
@@ -769,10 +769,10 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
_toolbox->InsetRect(bounds, 5, 5);
_toolbox->FillRect(bounds, _patterns[2]);
_toolbox->PenNormal();
- int16 strY = 0xbe - this->var_i16_7b6;
+ int16 strY = 0xbe - var_i16_7b6;
// 128:1056
for (int i = 0; i <= lineCount; i++) {
- this->drawTextCenter(_modalText[i], strY);
+ drawTextCenter(_modalText[i], strY);
// 128:1086
// 128:1086: CLR.W - -0x772(A5)
strY += 0x11;
@@ -789,28 +789,28 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
Common::Rect button3 = Common::Rect(0, 0, 0, 0); // arr_rect_5b8c
// 128:10e2
if (buttonCount == 1) {
- _toolbox->SetRect(button1, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button1, 0xe2, var_i16_7bc, 0x11e, var_i16_7bc+0x14);
// 128:1122
} else if (buttonCount == 2) {
- _toolbox->SetRect(button1, 0xbf, this->var_i16_7bc, 0xfb, this->var_i16_7bc+0x14);
- _toolbox->SetRect(button2, 0x105, this->var_i16_7bc, 0x141, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button1, 0xbf, var_i16_7bc, 0xfb, var_i16_7bc+0x14);
+ _toolbox->SetRect(button2, 0x105, var_i16_7bc, 0x141, var_i16_7bc+0x14);
// 128:1182
} else if (buttonCount == 3) {
- _toolbox->SetRect(button1, 0x9c, this->var_i16_7bc, 0xd8, this->var_i16_7bc+0x14);
- _toolbox->SetRect(button2, 0xe2, this->var_i16_7bc, 0x11e, this->var_i16_7bc+0x14);
- _toolbox->SetRect(button3, 0x128, this->var_i16_7bc, 0x164, this->var_i16_7bc+0x14);
+ _toolbox->SetRect(button1, 0x9c, var_i16_7bc, 0xd8, var_i16_7bc+0x14);
+ _toolbox->SetRect(button2, 0xe2, var_i16_7bc, 0x11e, var_i16_7bc+0x14);
+ _toolbox->SetRect(button3, 0x128, var_i16_7bc, 0x164, var_i16_7bc+0x14);
}
// 128:1208
if (buttonCount >= 1) {
_toolbox->EraseRoundRect(button1, 0xa, 0xa);
_toolbox->FrameRoundRect(button1, 0xa, 0xa);
- this->var_str_172 = _modalText[(lineCount + 1)];
- this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
+ var_str_172 = _modalText[(lineCount + 1)];
+ var_i16_30 = _toolbox->StringWidth(var_str_172);
// 128:1274
- this->var_i16_30 = button1.left + ((button1.right - button1.left) / 2) - (this->var_i16_30 / 2);
+ var_i16_30 = button1.left + ((button1.right - button1.left) / 2) - (var_i16_30 / 2);
// 128:12d4
- _toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
- _toolbox->DrawString(this->var_str_172);
+ _toolbox->MoveTo(var_i16_30, var_i16_7bc + 0xe);
+ _toolbox->DrawString(var_str_172);
if (buttonCount > 1) {
_toolbox->InsetRect(button1, -2, -2);
_toolbox->PenPat(_patterns[0]);
@@ -823,30 +823,30 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
if (buttonCount >= 2) {
_toolbox->EraseRoundRect(button2, 0xa, 0xa);
_toolbox->FrameRoundRect(button2, 0xa, 0xa);
- this->var_str_172 = _modalText[(lineCount+2)];
- this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
- this->var_i16_30 = button2.left + ((button2.right - button2.left)/2) - (this->var_i16_30 / 2);
+ var_str_172 = _modalText[(lineCount+2)];
+ var_i16_30 = _toolbox->StringWidth(var_str_172);
+ var_i16_30 = button2.left + ((button2.right - button2.left)/2) - (var_i16_30 / 2);
// 128:1418
- _toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
- _toolbox->DrawString(this->var_str_172);
+ _toolbox->MoveTo(var_i16_30, var_i16_7bc + 0xe);
+ _toolbox->DrawString(var_str_172);
}
// 128:1432
if (buttonCount == 3) {
_toolbox->EraseRoundRect(button3, 0xa, 0xa);
_toolbox->FrameRoundRect(button3, 0xa, 0xa);
- this->var_str_172 = _modalText[lineCount+3];
- this->var_i16_30 = _toolbox->StringWidth(this->var_str_172);
- this->var_i16_30 = (button3.left + ((button3.right - button3.left)/2)) - (this->var_i16_30/2);
+ var_str_172 = _modalText[lineCount+3];
+ var_i16_30 = _toolbox->StringWidth(var_str_172);
+ var_i16_30 = (button3.left + ((button3.right - button3.left)/2)) - (var_i16_30/2);
- _toolbox->MoveTo(this->var_i16_30, this->var_i16_7bc + 0xe);
- _toolbox->DrawString(this->var_str_172);
+ _toolbox->MoveTo(var_i16_30, var_i16_7bc + 0xe);
+ _toolbox->DrawString(var_str_172);
}
// 128:1518
- this->sub_128_61ec();
+ sub_128_61ec();
_savePromptChoice = 0;
// 128:1522
do {
- this->var_i16_7a8 = _toolbox->GetNextEvent(0xa, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(0xa, _event);
_toolbox->GlobalToLocal(_event.where);
if (_event.what == kMouseDown) {
// 128:154a
@@ -867,14 +867,14 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
if (_savePromptChoice > 0) {
// 128:15d2
- this->var_i16_30 = (_savePromptChoice - 1)*4;
+ var_i16_30 = (_savePromptChoice - 1)*4;
do {
_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1624
while ((_event.what != kMouseUp) && (_toolbox->PtInRect(_event.where, target))) {
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent) {
_toolbox->Delay(0);
@@ -884,7 +884,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
while ((_event.what != kMouseUp) && (!_toolbox->PtInRect(_event.where, target))) {
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent) {
_toolbox->Delay(0);
@@ -896,7 +896,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
if (!_toolbox->PtInRect(_event.where, target)) {
_savePromptChoice = 0;
}
- this->sub_128_61ec();
+ sub_128_61ec();
}
}
// 128:172c
@@ -911,9 +911,9 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
// 128:175c
} while (_savePromptChoice == 0);
- this->sub_128_61ec();
- this->copyScreen(1, this->arr_bmp_138bc);
- _toolbox->SetPort(this->var_i32_0);
+ sub_128_61ec();
+ copyScreen(1, arr_bmp_138bc);
+ _toolbox->SetPort(var_i32_0);
}
// 128:1784
@@ -921,28 +921,28 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &message) {
// behold the Nth key of thoth animation
- this->var_i16_32 = unk1;
- this->var_i16_30 = unk2;
- if (this->var_i16_30 > 0) {
- if ((_puzzleFlags[this->var_i16_30] & kFlagMenuDiamond)) {
- _puzzleFlags[this->var_i16_30] ^= kFlagMenuDiamond;
- _puzzleFlags[this->var_i16_30] |= kFlagMenuEnabled;
+ var_i16_32 = unk1;
+ var_i16_30 = unk2;
+ if (var_i16_30 > 0) {
+ if ((_puzzleFlags[var_i16_30] & kFlagMenuDiamond)) {
+ _puzzleFlags[var_i16_30] ^= kFlagMenuDiamond;
+ _puzzleFlags[var_i16_30] |= kFlagMenuEnabled;
}
// 128:1818
- int menuNo = 3 + ((this->var_i16_30 - 1) / 0x10);
- int itemNo = 1 + ((this->var_i16_30 - 1) % 0x10);
+ int menuNo = 3 + ((var_i16_30 - 1) / 0x10);
+ int itemNo = 1 + ((var_i16_30 - 1) % 0x10);
// add the wadjet eye next to the chapter name
- _zbasic->menu(menuNo, itemNo, 1, _puzzleName[this->var_i16_30] + Common::U32String(" ~ ")); // was: str(9)
+ _zbasic->menu(menuNo, itemNo, 1, _puzzleName[var_i16_30] + Common::U32String(" ~ ")); // was: str(9)
}
// 128:188a
- this->toggleMouseCursor(false);
- _zbasic->picture(0, MENU_HEIGHT, this->var_pic_7c2);
+ toggleMouseCursor(false);
+ _zbasic->picture(0, MENU_HEIGHT, var_pic_7c2);
_zbasic->text(kFontFool, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
Common::Rect rect;
for (int j = 0; j <= 1; j++) {
// 128:18c4
for (int i = 0; i <= 0x64; i += 4) {
- this->var_i32_692 = _toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
_toolbox->SetRect(
rect,
(0x105 - (int)(i*2.2f)),
@@ -952,7 +952,7 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
);
// 128:1982
_toolbox->InvertRect(rect);
- this->delayFromMarker(0);
+ delayFromMarker(0);
}
// 128:19a4
}
@@ -962,20 +962,20 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
_toolbox->PenMode(kPatXor);
_toolbox->FrameRect(rect);
_toolbox->PenMode(kPatCopy);
- this->var_i16_484 = _toolbox->StringWidth(message);
+ var_i16_484 = _toolbox->StringWidth(message);
// 128:19ec
- _toolbox->MoveTo(0x105 - (this->var_i16_484/2), 0x12e);
+ _toolbox->MoveTo(0x105 - (var_i16_484/2), 0x12e);
_toolbox->DrawString(message);
// loop count was 0x4d
for (int i = 0; i <= 0x24; i++) {
- this->var_i32_692 = _toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(rect);
// this was 1, however the flashing was far too intense
- this->delayFromMarker(8);
+ delayFromMarker(8);
}
for (int i = 1; i <= 0x24; i++) {
// 128:1a4c
- this->var_i32_692 = _toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
rect.top -= (int)(i*0.4f);
rect.left -= (int)(i*0.1f);
rect.bottom += (int)(i*0.05f);
@@ -985,22 +985,22 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
rect.top = MENU_HEIGHT;
}
// 128:1bac
- if (this->var_i16_32 == 0) {
+ if (var_i16_32 == 0) {
_toolbox->InvertRect(rect);
}
// 128:1bc2
- if (this->var_i16_32 == 1) {
+ if (var_i16_32 == 1) {
_toolbox->FillRect(rect, _patterns[3]);
}
// 128:1be6
- if (this->var_i16_32 == 2) {
+ if (var_i16_32 == 2) {
_toolbox->FillRect(rect, _patterns[0x47]);
}
// 128:1c0a
// was 1
- this->delayFromMarker(2);
+ delayFromMarker(2);
}
- this->toggleMouseCursor(true);
+ toggleMouseCursor(true);
_toolbox->PenNormal();
}
@@ -1019,41 +1019,41 @@ void FoolGame::clearStateBits(uint16 bits) {
void FoolGame::sub_128_1ef8() {
// 128:1ef8
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
fillRect(0, 0, MENU_HEIGHT, _windowWidth, 2);
- _toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(var_i32_0);
}
void FoolGame::sub_128_1f1e() {
// 128:1f1e
_toolbox->InitCursor();
- this->toggleMouseCursor(false);
- this->sub_128_bde(1, 1, kSrcCopy, 1, 1, 1);
+ toggleMouseCursor(false);
+ sub_128_bde(1, 1, kSrcCopy, 1, 1, 1);
}
void FoolGame::sub_128_1f44() {
// 128:1f44
- this->sub_128_61ec();
+ sub_128_61ec();
_storyCurrentPage = 0;
- this->clearStateBits(0x200);
- this->sub_128_5fea();
- this->copyScreen(1, this->arr_bmp_5dfc);
- this->storyRenderPage();
- _toolbox->SetPort(this->var_i32_0);
+ clearStateBits(0x200);
+ sub_128_5fea();
+ copyScreen(1, arr_bmp_5dfc);
+ storyRenderPage();
+ _toolbox->SetPort(var_i32_0);
}
void FoolGame::sub_128_1f76() {
// 128:1f76
// hold down mouse on scroll
- if (this->var_i16_7cc != 0) {
+ if (var_i16_7cc != 0) {
do {
- this->var_i32_692 = _toolbox->TickCount();
- this->sub_128_20d0();
+ var_i32_692 = _toolbox->TickCount();
+ sub_128_20d0();
// original was 5 ticks
- this->delayFromMarker(10);
+ delayFromMarker(10);
// new: empty the event queue, so feedback is instant
_toolbox->FlushEvents(-1, 0);
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
} while ((_event.modifiers & kModMouseButtonUp) == 0);
} else {
// 128:1fee
@@ -1061,9 +1061,9 @@ void FoolGame::sub_128_1f76() {
return;
}
// 128:2042
- if (this->var_i16_7d6 != 0) {
- if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
- this->sub_128_2078();
+ if (var_i16_7d6 != 0) {
+ if (_toolbox->PtInRect(_event.where, arr_rect_1910c)) {
+ sub_128_2078();
}
}
// 128:2076
@@ -1074,11 +1074,11 @@ void FoolGame::sub_128_1f76() {
void FoolGame::sub_128_2078() {
// clicking the story button
// 128:2078
- _toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- this->waitForMouseUp();
- _toolbox->InvertRoundRect(this->arr_rect_1910c, 0x8, 0x7);
- if (_toolbox->PtInRect(_event.where, this->arr_rect_1910c)) {
- this->sub_128_21c8();
+ _toolbox->InvertRoundRect(arr_rect_1910c, 0x8, 0x7);
+ waitForMouseUp();
+ _toolbox->InvertRoundRect(arr_rect_1910c, 0x8, 0x7);
+ if (_toolbox->PtInRect(_event.where, arr_rect_1910c)) {
+ sub_128_21c8();
}
}
@@ -1086,7 +1086,7 @@ void FoolGame::sub_128_20d0() {
// 128:20d0
// change page on scroll
do {
- _storyNextPage += this->var_i16_7cc;
+ _storyNextPage += var_i16_7cc;
if (_storyNextPage < 1) {
_storyNextPage = 1;
return;
@@ -1096,11 +1096,11 @@ void FoolGame::sub_128_20d0() {
return;
}
} while (_pageVisible[_storyNextPage] == 0);
- this->storyRenderPage();
+ storyRenderPage();
}
void FoolGame::menuChapterSelect() {
- this->clearStateBits(kStateChapterSelect);
+ clearStateBits(kStateChapterSelect);
// 128:2132
for (int i = _selectedMenuChapter; i <= _storyPageCount; i++) {
if (_selectedMenuChapter == _pageToChapter[i]) {
@@ -1111,16 +1111,16 @@ void FoolGame::menuChapterSelect() {
}
// 128:2170
_storyCurrentChapter = _pageToChapter[_storyNextPage];
- if (this->var_i16_7ce & 4) {
- this->var_i16_7ce ^= 4;
+ if (var_i16_7ce & 4) {
+ var_i16_7ce ^= 4;
if (_puzzleType[_storyCurrentChapter] > 0) {
// 128:21bc
- this->sub_128_21c8();
+ sub_128_21c8();
return;
}
}
// 128:21c2
- this->storyRenderPage();
+ storyRenderPage();
}
void FoolGame::sub_128_21c8() {
@@ -1135,15 +1135,15 @@ void FoolGame::sub_128_21c8() {
void FoolGame::storyRenderPage() {
// 128:2202
if (_storyNextPage != _storyCurrentPage) {
- if ((_pageLines[_storyNextPage] < 0xe) && (this->var_i16_7de > 0)) {
- this->fillRect(1, kPatBic, this->var_i16_7de, 0x37, 0x11d, 0x1db);
+ if ((_pageLines[_storyNextPage] < 0xe) && (var_i16_7de > 0)) {
+ fillRect(1, kPatBic, var_i16_7de, 0x37, 0x11d, 0x1db);
// 128:226e
// grab the last N-1 lines of text from the screen
- _zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, this->arr_bmp_b3ec);
- this->var_i16_7e0 = 1;
+ _zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, arr_bmp_b3ec);
+ var_i16_7e0 = 1;
} else {
// 128:22d4
- this->var_i16_7e0 = 0;
+ var_i16_7e0 = 0;
}
}
// 128:22da
@@ -1151,10 +1151,10 @@ void FoolGame::storyRenderPage() {
fillRect(0x127, 0x69, 0x138, 0x190, 0);
_storyCurrentChapter = _pageToChapter[_storyNextPage];
// if we've solved a puzzle, fill the scroll with crazy patterns
- if ((this->var_i16_7ce & 0x8) != 0) {
- this->var_i16_7ce ^= 0x8;
- this->sub_128_bde(1, 0, kSrcCopy, 0, 1, 0);
- this->sub_128_bde(1, 0, kSrcCopy, 0, 0, 0);
+ if ((var_i16_7ce & 0x8) != 0) {
+ var_i16_7ce ^= 0x8;
+ sub_128_bde(1, 0, kSrcCopy, 0, 1, 0);
+ sub_128_bde(1, 0, kSrcCopy, 0, 0, 0);
}
// 128:235e
if (_puzzleType[_storyCurrentChapter] > 0) {
@@ -1168,15 +1168,15 @@ void FoolGame::storyRenderPage() {
iconStr = Common::U32String("*"); // was: str(12)
}
// 128:23e8
- this->drawPuzzleButton(iconStr);
+ drawPuzzleButton(iconStr);
// 128:23f0: CLR.W - -0x772(A5)
- this->var_i16_7d6 = 1;
+ var_i16_7d6 = 1;
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
_toolbox->MoveTo(0x8a, 0x133);
_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
- this->var_i16_7d6 = 0;
+ var_i16_7d6 = 0;
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
_toolbox->MoveTo(0x70, 0x133);
_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
@@ -1190,9 +1190,9 @@ void FoolGame::storyRenderPage() {
if (_storyNextPage != _storyCurrentPage) {
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
- if (this->var_i16_7e0 != 0) {
+ if (var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
- _zbasic->put(0x3c, 0x32, this->arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(0x3c, 0x32, arr_bmp_b3ec, kSrcCopy);
}
// 128:252a
// y-position where the story text should start
@@ -1201,10 +1201,10 @@ void FoolGame::storyRenderPage() {
if (_pageLines[_storyNextPage] < 0xf) {
_toolbox->MoveTo(0xfa, strY-0xf);
_toolbox->DrawString(Common::U32String("â")); // was: str(14)
- this->var_i16_7de = strY - 0x1e;
+ var_i16_7de = strY - 0x1e;
} else {
// 128:25a6
- this->var_i16_7de = strY - 0xf;
+ var_i16_7de = strY - 0xf;
}
// 128:25b6
// printing the story to the screen
@@ -1228,7 +1228,7 @@ void FoolGame::storyRenderPage() {
void FoolGame::menuClickMessage() {
// 128:2664
// hide menu and replace with "click mouse to continue" message
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
Common::U32String message = Common::U32String("Click Mouse to Continue"); // was: str(15)
@@ -1236,44 +1236,44 @@ void FoolGame::menuClickMessage() {
_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
_toolbox->DrawString(message);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(var_i32_0);
}
void FoolGame::sub_128_26f6() {
// 128:26f6
for (int i = 0; i <= 0x28; i++) {
- this->arr_i16_1eb8[i] = 0;
+ arr_i16_1eb8[i] = 0;
}
}
void FoolGame::fetchPuzzleData() {
int position = _puzzleDataOffsets[_activePuzzle] - 1;
// record index
- this->var_i16_484 = (int16)(position / 1000);
+ var_i16_484 = (int16)(position / 1000);
// offset at record
- this->var_i16_7e4 = (int16)(position % 1000);
- _zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
- this->_puzzleDataPtr = 0;
+ var_i16_7e4 = (int16)(position % 1000);
+ _zbasic->record(1, var_i16_484, var_i16_7e4);
+ _puzzleDataPtr = 0;
int length = _puzzleDataOffsets[_activePuzzle + 1] - _puzzleDataOffsets[_activePuzzle];
debugC(8, kDebugLoading, "fetchPuzzleData: seek puzzles to puzzle %d at position %x (rec: %d, offset: %d), length %x",
_activePuzzle,
position,
- this->var_i16_484,
- this->var_i16_7e4,
+ var_i16_484,
+ var_i16_7e4,
length
);
- this->arr_bytes_109dc = _zbasic->readFile(1, length);
- this->_puzzleDataBuffer = this->arr_bytes_109dc;
+ arr_bytes_109dc = _zbasic->readFile(1, length);
+ _puzzleDataBuffer = arr_bytes_109dc;
}
// new game
void FoolGame::menuNewGame() {
// 128:27d6
- this->savePrompt();
+ savePrompt();
if (_savePromptChoice == 3)
return;
- if (this->var_i16_7ce & 1) {
+ if (var_i16_7ce & 1) {
setStateBits(kStateNewGame | kStateReturn);
} else {
setStateBits(kStateNewGame);
@@ -1283,65 +1283,65 @@ void FoolGame::menuNewGame() {
void FoolGame::sub_128_2808() {
// 128:2808
- this->var_i16_7e6 = 0;
+ var_i16_7e6 = 0;
// 128:280e: LEA - [0x3808],A0
// 128:2812: MOVE.L - A0,-0x8ee(A5)
- _zbasic->openR(2, this->var_str_588, 0x400, this->var_i16_688);
- this->var_str_7e8 = _zbasic->readFileStr(2, 0x11);
- if (this->var_str_7e8 == Common::U32String("The Fool's Errand")) { // str(16)
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_i16_8e8 = _zbasic->readFileInt(2);
+ _zbasic->openR(2, var_str_588, 0x400, var_i16_688);
+ var_str_7e8 = _zbasic->readFileStr(2, 0x11);
+ if (var_str_7e8 == Common::U32String("The Fool's Errand")) { // str(16)
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_i16_8e8 = _zbasic->readFileInt(2);
- this->var_str_7e8 = _zbasic->readFileStr(2, this->var_i16_8e8);
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
+ var_str_7e8 = _zbasic->readFileStr(2, var_i16_8e8);
}
// 128:28c8
for (int i = 1; i <= 0x51; i++) {
- this->var_i16_8e8 = _zbasic->readFileInt(2);
+ var_i16_8e8 = _zbasic->readFileInt(2);
}
} else {
// 128:28ec
- this->var_i16_7e6 = 1;
+ var_i16_7e6 = 1;
}
_zbasic->close(2);
// 128:28f8: LEA - [0x3818],A0
// 128:28fc: MOVE.L - A0,-0x8ee(A5)
- if (this->var_i16_7e6 != 0) {
- _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", this->var_str_588.encode().c_str()); // was: str(17), str(18)
+ if (var_i16_7e6 != 0) {
+ _modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", var_str_588.encode().c_str()); // was: str(17), str(18)
_modalText[1] = Common::U32String("Okay"); // was: str(19)
- this->showChoiceModal(kFontChicago, 0, 1, 1);
- this->var_str_588.clear(); // was: str(20)
- this->var_i16_7e6 = 0;
+ showChoiceModal(kFontChicago, 0, 1, 1);
+ var_str_588.clear(); // was: str(20)
+ var_i16_7e6 = 0;
}
}
void FoolGame::menuOpenGame() {
// 128:2988
// File -> Open
- this->sub_128_1e4(Common::String("FOOL")); // was: str(21)
- if (this->var_str_588.empty()) { // was: str(22)
+ sub_128_1e4(Common::String("FOOL")); // was: str(21)
+ if (var_str_588.empty()) { // was: str(22)
return;
}
- this->sub_128_2808();
- if (this->var_str_588.empty()) { // was: str(23)
+ sub_128_2808();
+ if (var_str_588.empty()) { // was: str(23)
return;
}
- this->savePrompt();
+ savePrompt();
// 128:29d4
if (_savePromptChoice != 3) {
- if ((this->var_i16_7ce & 1) != 0) {
+ if ((var_i16_7ce & 1) != 0) {
setStateBits(kStateOpenGame | kStateReturn);
} else {
// 128:29fa
setStateBits(kStateOpenGame);
}
- this->cursorWatch();
+ cursorWatch();
}
}
@@ -1355,15 +1355,15 @@ void FoolGame::saveGameAs() {
// 128:2a0e
if (_saveFileName.empty()) { // was: str(24)
// 128:2a28
- this->openSaveFileDialog(Common::U32String("Name of game?"), Common::U32String()); // was: str(25), str(26)
+ openSaveFileDialog(Common::U32String("Name of game?"), Common::U32String()); // was: str(25), str(26)
} else {
// 128:2a48
- this->openSaveFileDialog(Common::U32String("New Name?"), _saveFileName); // was: str(27)
+ openSaveFileDialog(Common::U32String("New Name?"), _saveFileName); // was: str(27)
}
// 128:2a60
- if (!this->var_str_486.empty()) { // was: str(28)
- _saveFileName = this->var_str_486;
- this->var_i16_9ec = this->var_i16_586;
+ if (!var_str_486.empty()) { // was: str(28)
+ _saveFileName = var_str_486;
+ var_i16_9ec = var_i16_586;
// 128:2a90
}
}
@@ -1371,8 +1371,8 @@ void FoolGame::saveGameAs() {
void FoolGame::menuSaveGameAs() {
// 128:2a92
// File -> Save As
- this->saveGameAs();
- if (!this->var_str_486.empty()) { // was: str(29)
+ saveGameAs();
+ if (!var_str_486.empty()) { // was: str(29)
setStateBits(kStateSaveGame);
}
@@ -1381,11 +1381,11 @@ void FoolGame::menuSaveGameAs() {
// quit
void FoolGame::menuQuit() {
// 128:2ab6
- this->savePrompt();
+ savePrompt();
if (_savePromptChoice == 3) {
return;
}
- if ((this->var_i16_7ce & 1) != 0) {
+ if ((var_i16_7ce & 1) != 0) {
setStateBits(kStateQuit | kStateReturn);
} else {
setStateBits(kStateQuit);
@@ -1395,7 +1395,7 @@ void FoolGame::menuQuit() {
// print story
void FoolGame::menuPrintStory() {
// 128:2ae8
- if (this->var_i16_7ce & 1) {
+ if (var_i16_7ce & 1) {
_stateFlags = kStatePrintStory | kStateReturn;
} else {
_stateFlags = kStatePrintStory;
@@ -1413,29 +1413,29 @@ void FoolGame::printStory() {
void FoolGame::newGame() {
// 128:2bc6
- this->clearStateBits(kStateNewGame);
- this->cursorWatch();
- this->sub_128_3744();
+ clearStateBits(kStateNewGame);
+ cursorWatch();
+ sub_128_3744();
_saveFileName.clear(); // was: str(33);
- this->var_i16_9ec = 0;
+ var_i16_9ec = 0;
// set up the initially visible story chapters
- this->arr_i16_4758[0] = 0x103;
- this->arr_i16_4758[1] = 0;
- this->arr_i16_4758[2] = 0x1e;
- this->arr_i16_4758[3] = 0x1fc;
- this->arr_i16_4758[4] = (int16)0xa050;
- this->arr_i16_4758[5] = 0x3f7;
- this->var_i16_484 = 0;
+ arr_i16_4758[0] = 0x103;
+ arr_i16_4758[1] = 0;
+ arr_i16_4758[2] = 0x1e;
+ arr_i16_4758[3] = 0x1fc;
+ arr_i16_4758[4] = (int16)0xa050;
+ arr_i16_4758[5] = 0x3f7;
+ var_i16_484 = 0;
for (int j = 0; j <= 0x5; j++) {
// 128:2c5e
for (int i = 0; i <= 0xf; i++) {
- this->var_i16_484++;
- if (this->arr_i16_4758[j] & _bitLUT[i]) {
- _pageVisible[this->var_i16_484] = 1;
+ var_i16_484++;
+ if (arr_i16_4758[j] & _bitLUT[i]) {
+ _pageVisible[var_i16_484] = 1;
} else {
// 128:2ca6
- _pageVisible[this->var_i16_484] = 0;
+ _pageVisible[var_i16_484] = 0;
}
// 128:2cb6
}
@@ -1448,26 +1448,26 @@ void FoolGame::newGame() {
// 128:2cf6
// shuffle around the pieces of the sun's map
for (int i = 1; i <= 0x64; i++) {
- this->var_i16_484 = _zbasic->rndInt(0x51);
- this->var_i16_7e4 = _zbasic->rndInt(0x51);
- _zbasic->swapInt(_sunMapTileID[this->var_i16_484], _sunMapTileID[this->var_i16_7e4]);
+ var_i16_484 = _zbasic->rndInt(0x51);
+ var_i16_7e4 = _zbasic->rndInt(0x51);
+ _zbasic->swapInt(_sunMapTileID[var_i16_484], _sunMapTileID[var_i16_7e4]);
_puzzleCompletionStatus[i] = 0;
_puzzleFlags[i] = kFlagMenuDisabled;
}
// 128:2d6a
- this->var_i16_484 = 0;
+ var_i16_484 = 0;
for (int i = 1; i <= _storyPageCount; i++) {
- if (_pageToChapter[i] == this->var_i16_484+1) {
+ if (_pageToChapter[i] == var_i16_484+1) {
// 128:2d9c
- this->var_i16_484++;
+ var_i16_484++;
if (_pageVisible[i] == 1) {
- if (_puzzleUnlockChapter[this->var_i16_484] != 0) {
- this->var_i16_9f2 = kFlagMenuDiamond;
+ if (_puzzleUnlockChapter[var_i16_484] != 0) {
+ var_i16_9f2 = kFlagMenuDiamond;
} else {
- this->var_i16_9f2 = kFlagMenuEnabled;
+ var_i16_9f2 = kFlagMenuEnabled;
}
// 128:2de2
- _puzzleFlags[this->var_i16_484] = this->var_i16_9f2 + 4;
+ _puzzleFlags[var_i16_484] = var_i16_9f2 + 4;
}
// 128:2e02
}
@@ -1476,28 +1476,28 @@ void FoolGame::newGame() {
// 128:2e14
_zbasic->indexClear(0x2);
_storyNextPage = 1;
- this->var_i16_7ce = 0;
+ var_i16_7ce = 0;
_activePuzzle = 0;
_sunMapRestored = 0;
- this->var_i16_7b2 = 0;
- this->sub_128_3032();
+ var_i16_7b2 = 0;
+ sub_128_3032();
// 128:2e3c
}
void FoolGame::openGame() {
// 128:2e3e
// save game loading code?
- this->clearStateBits(kStateOpenGame);
- this->cursorWatch();
- this->sub_128_3744();
- _saveFileName = this->var_str_588;
- this->var_i16_9ec = this->var_i16_688;
- this->var_i16_7e6 = 0;
+ clearStateBits(kStateOpenGame);
+ cursorWatch();
+ sub_128_3744();
+ _saveFileName = var_str_588;
+ var_i16_9ec = var_i16_688;
+ var_i16_7e6 = 0;
// FIXME: disk error handler??
// 128:2e68: LEA - [0x3808],A0
// 128:2e6c: MOVE.L - A0,-0x8ee(A5)
// 128:2e70: SF - 0x8,D0
- _zbasic->openR(2, _saveFileName, 0x400, this->var_i16_9ec);
+ _zbasic->openR(2, _saveFileName, 0x400, var_i16_9ec);
Common::String magic = _zbasic->readFileStr(2, 0x11);
if (!magic.equals("The Fool's Errand")) {
@@ -1506,7 +1506,7 @@ void FoolGame::openGame() {
}
_storyNextPage = _zbasic->readFileInt(2);
_activePuzzle = _zbasic->readFileInt(2);
- this->var_i16_7ce = _zbasic->readFileInt(2);
+ var_i16_7ce = _zbasic->readFileInt(2);
_sunMapRestored = _zbasic->readFileInt(2);
for (int i = 1; i <= 0x64; i++) {
_puzzleFlags[i] = _zbasic->readFileInt(2);
@@ -1529,18 +1529,18 @@ void FoolGame::openGame() {
debugCN(5, kDebugLoading, "\n");
// 128:2f84
_zbasic->close(2);
- if (this->var_i16_7e6 != 0) {
+ if (var_i16_7e6 != 0) {
_modalText[0] = Common::U32String::format("The file '%s' cannot be opened.", _saveFileName.encode().c_str()); // was: str(34), str(35)
_modalText[1] = Common::U32String("Okay"); // was: str(36)
- this->var_i16_7e6 = 0;
- if ((this->var_i16_7ce & 1) == 0) {
+ var_i16_7e6 = 0;
+ if ((var_i16_7ce & 1) == 0) {
setStateBits(kStateNewGame | kStateReturn);
} else {
setStateBits(kStateNewGame);
}
} else {
// 128:302c
- this->sub_128_3032();
+ sub_128_3032();
}
}
@@ -1548,28 +1548,28 @@ void FoolGame::openGame() {
void FoolGame::sub_128_3032() {
_storyCurrentChapter = 0;
_stateFlags = kStateNull;
- this->var_i16_484 = 0;
- this->var_i16_68c = 3;
+ var_i16_484 = 0;
+ var_i16_68c = 3;
// render chapter menu headings
for (int j = 3; j <= 7; j++) {
- this->var_str_384 = Common::U32String("-") + _zbasic->chr(0x7d+j) + Common::U32String("-"); // was: str(37)
- _zbasic->menu(j, 0, 1, this->var_str_384);
+ var_str_384 = Common::U32String("-") + _zbasic->chr(0x7d+j) + Common::U32String("-"); // was: str(37)
+ _zbasic->menu(j, 0, 1, var_str_384);
for (int i = 1; i <= 0x10; i++) {
- this->var_i16_484++;
- this->var_i16_9f2 = _puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
- if (_puzzleCompletionStatus[this->var_i16_484] == 0x63) {
- this->var_str_384 = Common::U32String(" ~ "); // wadjet eye for puzzles with enchantment
+ var_i16_484++;
+ var_i16_9f2 = _puzzleFlags[var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled);
+ if (_puzzleCompletionStatus[var_i16_484] == 0x63) {
+ var_str_384 = Common::U32String(" ~ "); // wadjet eye for puzzles with enchantment
} else {
// 128:30e4
- this->var_str_384 = Common::U32String(" "); // was: str(40)
+ var_str_384 = Common::U32String(" "); // was: str(40)
}
// 128:30f8
- this->var_str_9f4 = _puzzleName[this->var_i16_484] + this->var_str_384;
+ var_str_9f4 = _puzzleName[var_i16_484] + var_str_384;
if ((j == 3) && (i == 1)) { // add shortcut modifier for the sun's map
- this->var_str_9f4 = Common::U32String("/M") + this->var_str_9f4;
+ var_str_9f4 = Common::U32String("/M") + var_str_9f4;
}
// 128:315e
- _zbasic->menu(j, i, this->var_i16_9f2, this->var_str_9f4);
+ _zbasic->menu(j, i, var_i16_9f2, var_str_9f4);
}
// 128:3180
}
@@ -1578,7 +1578,7 @@ void FoolGame::sub_128_3032() {
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
int16 strY = 0x3c;
- this->var_i16_7de = 0x2d;
+ var_i16_7de = 0x2d;
// draw the first page of text
for (int i = 1; i <= 0xf; i++) {
// 128:31ec
@@ -1587,11 +1587,11 @@ void FoolGame::sub_128_3032() {
strY += 0xf;
}
// 128:3228
- this->copyScreen(0, this->arr_bmp_5dfc);
+ copyScreen(0, arr_bmp_5dfc);
_storyCurrentPage = 1;
- this->storyRenderPage();
- if ((this->var_i16_7ce & 1) == 0) {
- this->cursorExplodingWatch();
+ storyRenderPage();
+ if ((var_i16_7ce & 1) == 0) {
+ cursorExplodingWatch();
} else {
if ((_activePuzzle > 0) && (_activePuzzle <= 0x50)) {
setStateBits(kStatePuzzleSelect);
@@ -1600,7 +1600,7 @@ void FoolGame::sub_128_3032() {
}
}
// 128:3294
- this->menuToggleSound();
+ menuToggleSound();
if (_sunMapRestored == 0) {
_zbasic->menu(2, 7, 0, Common::U32String());
} else {
@@ -1618,7 +1618,7 @@ void FoolGame::menuToggleSound() {
void FoolGame::savePrompt() {
// 128:32fa
- if (this->var_i16_7ce == 666) {
+ if (var_i16_7ce == 666) {
return;
}
_savePromptChoice = 0;
@@ -1634,12 +1634,12 @@ void FoolGame::savePrompt() {
_modalText[1] = Common::U32String("Yes");
_modalText[2] = Common::U32String("No");
_modalText[3] = Common::U32String("Cancel");
- this->showChoiceModal(kFontChicago, 0, 3, 0);
+ showChoiceModal(kFontChicago, 0, 3, 0);
if (_savePromptChoice > 1) {
_saveFileName = previous;
return;
}
- this->saveGameAs();
+ saveGameAs();
if (_saveFileName.empty()) { // was: str(47)
// 128:33da
_savePromptChoice = 3;
@@ -1668,38 +1668,38 @@ void FoolGame::autoSaveGame() {
void FoolGame::saveGame() {
// write save file
- this->clearStateBits(kStateSaveGame);
- if (this->var_i16_7ce == 666)
+ clearStateBits(kStateSaveGame);
+ if (var_i16_7ce == 666)
return;
// 128:3548
if (_saveFileName.empty()) { // was: str(57)
- this->saveGameAs();
+ saveGameAs();
if (_saveFileName.empty()) { // was: str(58)
return;
}
}
// 128:3580
- if ((this->var_i16_7ce & 1) != 0) {
- this->puzzleSaveContext();
+ if ((var_i16_7ce & 1) != 0) {
+ puzzleSaveContext();
}
// 128:3594
do {
if (!_isAutoSaving) {
- this->cursorWatch();
+ cursorWatch();
}
// 128:3598
- this->var_i16_7e6 = 0;
+ var_i16_7e6 = 0;
// 128:359e: LEA - [0x3808],A0
// 128:35a2: MOVE.L - A0,-0x8ee(A5)
_zbasic->defOpen(Common::U32String("FOOLgf87")); // str(59)
- _zbasic->openW(2, _saveFileName, 0x400, this->var_i16_9ec);
+ _zbasic->openW(2, _saveFileName, 0x400, var_i16_9ec);
- if (this->var_i16_7e6 != 0xa) {
- this->var_str_af4 = Common::U32String("The Fool's Errand"); // str(60)
- _zbasic->writeFileStr(2, this->var_str_af4.encode(Common::kMacRoman));
+ if (var_i16_7e6 != 0xa) {
+ var_str_af4 = Common::U32String("The Fool's Errand"); // str(60)
+ _zbasic->writeFileStr(2, var_str_af4.encode(Common::kMacRoman));
_zbasic->writeFileInt(2, _storyNextPage);
_zbasic->writeFileInt(2, _activePuzzle);
- _zbasic->writeFileInt(2, this->var_i16_7ce);
+ _zbasic->writeFileInt(2, var_i16_7ce);
_zbasic->writeFileInt(2, _sunMapRestored);
for (int i = 1; i <= 0x64; i++) {
_zbasic->writeFileInt(2, _puzzleFlags[i]);
@@ -1716,11 +1716,11 @@ void FoolGame::saveGame() {
_zbasic->close(2);
}
// 128:36fe
- if (this->var_i16_7e6 != 0) {
+ if (var_i16_7e6 != 0) {
// problem with saving
- this->sub_128_388a();
+ sub_128_388a();
do {
- this->saveGameAs();
+ saveGameAs();
} while (_saveFileName.empty()); // was: str(61)
// 128:3726: BRA - [0x3594]
@@ -1733,7 +1733,7 @@ void FoolGame::saveGame() {
// 128:372e: MOVE.L - A0,-0x8ee(A5)
if (_stateFlags == kStateNull) {
if (!_isAutoSaving) {
- this->cursorExplodingWatchShort();
+ cursorExplodingWatchShort();
}
_toolbox->InitCursor();
}
@@ -1753,7 +1753,7 @@ void FoolGame::sub_128_3744() {
void FoolGame::cursorWatch() {
// 128:3774
_toolbox->SetCursor(_cursors[3]);
- this->var_i16_7b2 = 0xa;
+ var_i16_7b2 = 0xa;
}
void FoolGame::cursorExplodingWatch() {
@@ -1761,30 +1761,30 @@ void FoolGame::cursorExplodingWatch() {
for (int j = 0; j <= 1; j++) {
for (int i = 3; i <= 6; i++) {
_toolbox->SetCursor(_cursors[i]);
- this->delay(3);
+ delay(3);
}
// 128:37c2
}
for (int i = 7; i <= 0xf; i++) {
_toolbox->SetCursor(_cursors[i]);
- this->delay(4);
+ delay(4);
}
- this->var_i16_7b2 = 0xa;
+ var_i16_7b2 = 0xa;
}
void FoolGame::cursorExplodingWatchShort() {
// 128:37ce
for (int i = 7; i <= 0xf; i++) {
_toolbox->SetCursor(_cursors[i]);
- this->delay(4);
+ delay(4);
}
- this->var_i16_7b2 = 0xa;
+ var_i16_7b2 = 0xa;
}
void FoolGame::sub_128_388a() {
// 128:388a
- if ((this->var_i16_7e6 & 0xff) == 2) {
+ if ((var_i16_7e6 & 0xff) == 2) {
// problem with saving
}
warning("STUB: %s", __func__);
@@ -1794,22 +1794,22 @@ void FoolGame::puzzleRun() {
// 128:39a0
fillRect(0x127, 0x69, 0x138, 0x190, 0);
_stateFlags = kStateNull;
- this->var_i16_c00 = 0;
- this->var_i16_7d6 = 0;
- this->var_i16_7b2 = 0xa;
+ var_i16_c00 = 0;
+ var_i16_7d6 = 0;
+ var_i16_7b2 = 0xa;
_activePuzzle = _storyCurrentChapter;
- this->var_i16_7ce |= 1;
+ var_i16_7ce |= 1;
_toolbox->InitCursor();
- this->copyScreen(0, this->arr_bmp_5dfc);
+ copyScreen(0, arr_bmp_5dfc);
// 128:39fa
- if (this->arr_i16_15e8[_storyCurrentChapter] > 0) {
- this->sub_128_41d8();
+ if (arr_i16_15e8[_storyCurrentChapter] > 0) {
+ sub_128_41d8();
}
// 128:3a12
- this->puzzleSetupMenu();
- this->sub_128_26f6();
- this->sub_128_61ec();
- this->puzzleLoadContext();
+ puzzleSetupMenu();
+ sub_128_26f6();
+ sub_128_61ec();
+ puzzleLoadContext();
// 128:3a22
// 128:3a38: JSR - "ZBASIC_115"
debugC(5, kDebugLoading, "puzzleRun: chapter 0x%x, puzzle module %d", _storyCurrentChapter, _puzzleType[_storyCurrentChapter]-1);
@@ -1818,68 +1818,68 @@ void FoolGame::puzzleRun() {
case 1:
case 2:
case 3:
- this->jumbleRun();
+ jumbleRun();
break;
case 4:
- this->wordSearchRun();
+ wordSearchRun();
break;
case 5:
- this->jigsawRun();
+ jigsawRun();
break;
case 6:
- this->polyominoRun();
+ polyominoRun();
break;
case 7:
- this->revealRun();
+ revealRun();
break;
case 8:
- this->sentenceRun();
+ sentenceRun();
break;
case 9:
- this->mazeRun();
+ mazeRun();
break;
case 10:
- this->jumbleRun();
+ jumbleRun();
break;
case 11:
- this->sunMapRun();
+ sunMapRun();
break;
case 12:
- this->cardsRun();
+ cardsRun();
break;
case 13:
- this->highPriestessRun();
+ highPriestessRun();
break;
case 14:
- this->deathRun();
+ deathRun();
break;
case 15:
- this->shipsRun();
+ shipsRun();
break;
case 16:
- this->humbugRun();
+ humbugRun();
break;
case 17:
- this->justiceRun();
+ justiceRun();
break;
case 18:
- this->hermitRun();
+ hermitRun();
break;
default:
warning("%s: broke out of switch", __func__);
break;
}
// 128:3a8a
- this->sub_128_5fea();
+ sub_128_5fea();
if (_sunMapRestored == 1) {
setStateBits(0x100);
return;
}
// 128:3aa4
- this->puzzleSaveContext();
+ puzzleSaveContext();
if ((_stateFlags & kStateQuit) == 0) {
_toolbox->PenNormal();
- this->copyScreen(1, this->arr_bmp_5dfc);
+ copyScreen(1, arr_bmp_5dfc);
MenuHandle menu = _toolbox->GetMHandle(8);
_toolbox->DeleteMenu(8);
_toolbox->DisposeMenu(menu);
@@ -1888,7 +1888,7 @@ void FoolGame::puzzleRun() {
// 128:3aea
_zbasic->indexClear(1);
if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x63) {
- this->storyUnlockChapter();
+ storyUnlockChapter();
autoSaveGame(); // autosave on progress
}
if (_puzzleCompletionStatus[_storyCurrentChapter] == 0x64) {
@@ -1924,7 +1924,7 @@ void FoolGame::puzzleRun() {
}
}
// 128:3cae
- this->var_i16_7ce |= 8;
+ var_i16_7ce |= 8;
} else {
// 128:3cc0
if ((_puzzleFlags[_storyCurrentChapter] & 2) != 0) {
@@ -1932,27 +1932,27 @@ void FoolGame::puzzleRun() {
_puzzleFlags[_storyCurrentChapter] |= 1;
}
// 128:3d3a
- this->var_i16_484 = 3 + ((_storyCurrentChapter - 1) / 0x10);
- this->var_i16_7e4 = 1 + ((_storyCurrentChapter - 1) % 0x10);
- _zbasic->menu(this->var_i16_484, this->var_i16_7e4, 1, Common::U32String());
- this->storyUnlockChapter();
+ var_i16_484 = 3 + ((_storyCurrentChapter - 1) / 0x10);
+ var_i16_7e4 = 1 + ((_storyCurrentChapter - 1) % 0x10);
+ _zbasic->menu(var_i16_484, var_i16_7e4, 1, Common::U32String());
+ storyUnlockChapter();
}
autoSaveGame();
}
// 128:3d82
- this->var_i16_c02 = 0;
- this->var_i16_c00 = 0;
- _toolbox->SetPort(this->var_i32_0);
+ var_i16_c02 = 0;
+ var_i16_c00 = 0;
+ _toolbox->SetPort(var_i32_0);
if ((_stateFlags & (kStateQuit | kStateOpenGame | kStateNewGame)) == 0) {
- if ((this->var_i16_7ce & 1) == 0) {
- this->var_i16_7ce ^= 1;
+ if ((var_i16_7ce & 1) == 0) {
+ var_i16_7ce ^= 1;
}
if ((_stateFlags & kStateChapterSelect) == 0) {
- this->storyRenderPage();
+ storyRenderPage();
}
}
// 128:3de0
- this->sub_128_61ec();
+ sub_128_61ec();
// 128:3de4
}
@@ -1961,7 +1961,7 @@ void FoolGame::storyUnlockChapter() {
if ((_puzzleUnlockChapter[_storyCurrentChapter] > 0) &&
((_puzzleFlags[_puzzleUnlockChapter[_storyCurrentChapter]] & 3) == 0)) {
_storyNextPage = 0;
- this->var_i16_7ce |= 8;
+ var_i16_7ce |= 8;
for (int i = 1; i <= _storyPageCount; i++ ) {
// 128:3e56
if (_pageToChapter[i] == _puzzleUnlockChapter[_storyCurrentChapter]) {
@@ -1981,14 +1981,14 @@ void FoolGame::storyUnlockChapter() {
int16 menuNo = 3 + ((_storyCurrentChapter - 1) / 0x10);
int16 itemNo = 1 + ((_storyCurrentChapter - 1) % 0x10);
if (_puzzleUnlockChapter[_storyCurrentChapter] == 0) {
- this->var_i16_9f2 = 1;
+ var_i16_9f2 = 1;
_puzzleCompletionStatus[_storyCurrentChapter] = 0x64;
} else {
// 128:3f66
- this->var_i16_9f2 = 2;
+ var_i16_9f2 = 2;
}
- _puzzleFlags[_storyCurrentChapter] |= (this->var_i16_9f2 + 4);
- _zbasic->menu(menuNo, itemNo, this->var_i16_9f2, Common::U32String());
+ _puzzleFlags[_storyCurrentChapter] |= (var_i16_9f2 + 4);
+ _zbasic->menu(menuNo, itemNo, var_i16_9f2, Common::U32String());
}
// 128:3fb4
}
@@ -2061,28 +2061,28 @@ void FoolGame::puzzleSaveContext() {
void FoolGame::sub_128_41d8() {
// 128:41d8
for (int i = 0; i <= 5; i++) {
- this->arr_i16_4758[i] = this->arr_i16_16b2[i + (this->arr_i16_15e8[_activePuzzle]*8)];
+ arr_i16_4758[i] = arr_i16_16b2[i + (arr_i16_15e8[_activePuzzle]*8)];
}
// 128:422e
if ((_activePuzzle == 0x34) && (_puzzleCompletionStatus[0x34] > 1)) {
// 128:4262
if (_puzzleCompletionStatus[0x34] == 2) {
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 2;
- this->arr_i16_4758[2] = 0xa;
+ arr_i16_4758[0] = 0;
+ arr_i16_4758[1] = 2;
+ arr_i16_4758[2] = 0xa;
}
// 128:42aa
if (_puzzleCompletionStatus[0x34] == 3) {
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 3;
- this->arr_i16_4758[2] = 0;
+ arr_i16_4758[0] = 0;
+ arr_i16_4758[1] = 3;
+ arr_i16_4758[2] = 0;
}
// 128:42f0
if (_puzzleCompletionStatus[0x34] >= 4) {
if (_sunMapRestored == 0) {
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 0x47;
- this->arr_i16_4758[2] = 0;
+ arr_i16_4758[0] = 0;
+ arr_i16_4758[1] = 0x47;
+ arr_i16_4758[2] = 0;
} else {
// 128:4346
return;
@@ -2092,25 +2092,25 @@ void FoolGame::sub_128_41d8() {
}
// 128:4348
if ((_activePuzzle == 0x17) && (_puzzleCompletionStatus[0x17] == 0x63)) {
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 2;
- this->arr_i16_4758[1] = 0xa;
+ arr_i16_4758[0] = 0;
+ arr_i16_4758[1] = 2;
+ arr_i16_4758[1] = 0xa;
}
// 128:43aa
if ((_activePuzzle == 0x3f) && (_puzzleCompletionStatus[0x3f] == 0x63)) {
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 3;
- this->arr_i16_4758[2] = 0;
+ arr_i16_4758[0] = 0;
+ arr_i16_4758[1] = 3;
+ arr_i16_4758[2] = 0;
}
// 128:440a
if (_activePuzzle == 0x48) {
if (_puzzleCompletionStatus[0x48] == 0x63) {
- this->arr_i16_4758[0] = 0;
- this->arr_i16_4758[1] = 0x47;
- this->arr_i16_4758[2] = 0;
+ arr_i16_4758[0] = 0;
+ arr_i16_4758[1] = 0x47;
+ arr_i16_4758[2] = 0;
} else {
// 128:4462
- this->arr_i16_4758[1] = 0x31;
+ arr_i16_4758[1] = 0x31;
}
}
storyDrawZoom();
@@ -2118,98 +2118,98 @@ void FoolGame::sub_128_41d8() {
void FoolGame::storyDrawZoom() {
// 128:4472
- if (this->arr_i16_4758[1] == 0) {
- this->arr_i16_4758[1] = _activePuzzle;
+ if (arr_i16_4758[1] == 0) {
+ arr_i16_4758[1] = _activePuzzle;
}
- if (this->arr_i16_4758[2] == 0) {
- this->arr_i16_4758[2] = 0x8;
+ if (arr_i16_4758[2] == 0) {
+ arr_i16_4758[2] = 0x8;
}
- if (this->arr_i16_4758[0] == 0) {
+ if (arr_i16_4758[0] == 0) {
// user clicked the puzzle button, zoom-fill with pattern
- zoomRect(0x130, 0x76, 0x130, 0x76, MENU_HEIGHT, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_4758[1], (PatternMode)this->arr_i16_4758[2], 0x19);
+ zoomRect(0x130, 0x76, 0x130, 0x76, MENU_HEIGHT, 0, SCREEN_HEIGHT, SCREEN_WIDTH, arr_i16_4758[1], (PatternMode)arr_i16_4758[2], 0x19);
return;
}
// 128:4520
_toolbox->PenNormal();
- _toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
- _toolbox->PenMode((PatternMode)this->arr_i16_4758[2]);
- if (this->arr_i16_4758[5] == 0) {
+ _toolbox->PenPat(_patterns[arr_i16_4758[1]]);
+ _toolbox->PenMode((PatternMode)arr_i16_4758[2]);
+ if (arr_i16_4758[5] == 0) {
// 128:456a
- this->arr_i16_4758[12] = 0x1d;
- this->arr_i16_4758[6] = 0x4;
- this->arr_i16_4758[7] = 0x7;
+ arr_i16_4758[12] = 0x1d;
+ arr_i16_4758[6] = 0x4;
+ arr_i16_4758[7] = 0x7;
}
// 128:459a
- if (this->arr_i16_4758[5] == 1) {
- this->arr_i16_4758[12] = 0x2a;
- this->arr_i16_4758[6] = 0x4;
- this->arr_i16_4758[7] = 0x6;
+ if (arr_i16_4758[5] == 1) {
+ arr_i16_4758[12] = 0x2a;
+ arr_i16_4758[6] = 0x4;
+ arr_i16_4758[7] = 0x6;
}
// 128:45e4
- _toolbox->PenSize(this->arr_i16_4758[7], this->arr_i16_4758[6]);
- if ((this->arr_i16_4758[4] == 0) && (this->arr_i16_4758[5] == 0)) {
- this->arr_i16_4758[8] = 0xa7;
- this->arr_i16_4758[9] = 0x109;
- this->arr_i16_4758[10] = 0xa7;
- this->arr_i16_4758[11] = 0x109;
+ _toolbox->PenSize(arr_i16_4758[7], arr_i16_4758[6]);
+ if ((arr_i16_4758[4] == 0) && (arr_i16_4758[5] == 0)) {
+ arr_i16_4758[8] = 0xa7;
+ arr_i16_4758[9] = 0x109;
+ arr_i16_4758[10] = 0xa7;
+ arr_i16_4758[11] = 0x109;
}
// 128:467c
- if ((this->arr_i16_4758[4] == 0) && (this->arr_i16_4758[5] == 1)) {
- this->arr_i16_4758[8] = 0xb5;
- this->arr_i16_4758[9] = 0x100;
- this->arr_i16_4758[10] = 0xb5;
- this->arr_i16_4758[11] = 0x100;
+ if ((arr_i16_4758[4] == 0) && (arr_i16_4758[5] == 1)) {
+ arr_i16_4758[8] = 0xb5;
+ arr_i16_4758[9] = 0x100;
+ arr_i16_4758[10] = 0xb5;
+ arr_i16_4758[11] = 0x100;
}
// 128:46f6
- if (this->arr_i16_4758[4] == 1) {
- this->arr_i16_4758[6] *= -1;
- this->arr_i16_4758[7] *= -1;
+ if (arr_i16_4758[4] == 1) {
+ arr_i16_4758[6] *= -1;
+ arr_i16_4758[7] *= -1;
}
// 128:4754
- if ((this->arr_i16_4758[4] == 1) && (this->arr_i16_4758[5] == 0)) {
- this->arr_i16_4758[8] = 0x2b;
- this->arr_i16_4758[9] = 0x31;
- this->arr_i16_4758[10] = 0x123;
- this->arr_i16_4758[11] = 0x1e1;
+ if ((arr_i16_4758[4] == 1) && (arr_i16_4758[5] == 0)) {
+ arr_i16_4758[8] = 0x2b;
+ arr_i16_4758[9] = 0x31;
+ arr_i16_4758[10] = 0x123;
+ arr_i16_4758[11] = 0x1e1;
}
// 128:47ce
- if ((this->arr_i16_4758[4] == 1) && (this->arr_i16_4758[5] == 1)) {
- this->arr_i16_4758[8] = 0x10;
- this->arr_i16_4758[9] = -0x7;
- this->arr_i16_4758[10] = 0x15a;
- this->arr_i16_4758[11] = 0x207;
+ if ((arr_i16_4758[4] == 1) && (arr_i16_4758[5] == 1)) {
+ arr_i16_4758[8] = 0x10;
+ arr_i16_4758[9] = -0x7;
+ arr_i16_4758[10] = 0x15a;
+ arr_i16_4758[11] = 0x207;
}
// 128:4850
- if ((this->arr_i16_15e8[_activePuzzle] == 0xd) || (this->arr_i16_15e8[_activePuzzle] == 0xe)) {
+ if ((arr_i16_15e8[_activePuzzle] == 0xd) || (arr_i16_15e8[_activePuzzle] == 0xe)) {
fillRect(0x14f, 0, SCREEN_HEIGHT, 0x7, 1);
fillRect(0x14f, 0x1f9, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
}
// 128:48d6
- for (int i = 0; i <= this->arr_i16_4758[12]; i++) {
- this->arr_i16_4758[8] -= this->arr_i16_4758[6];
- this->arr_i16_4758[9] -= this->arr_i16_4758[7];
- this->arr_i16_4758[10] += this->arr_i16_4758[6];
- this->arr_i16_4758[11] += this->arr_i16_4758[7];
- if (this->arr_i16_4758[8] < 0x14) {
- this->arr_i16_4758[8] = 0x14;
+ for (int i = 0; i <= arr_i16_4758[12]; i++) {
+ arr_i16_4758[8] -= arr_i16_4758[6];
+ arr_i16_4758[9] -= arr_i16_4758[7];
+ arr_i16_4758[10] += arr_i16_4758[6];
+ arr_i16_4758[11] += arr_i16_4758[7];
+ if (arr_i16_4758[8] < 0x14) {
+ arr_i16_4758[8] = 0x14;
}
// 128:49e2
- if (this->arr_i16_4758[3] == 0) {
- this->arr_i16_4758[1] += 1;
- if (this->arr_i16_4758[1] > 0x50) {
- this->arr_i16_4758[1] = 1;
+ if (arr_i16_4758[3] == 0) {
+ arr_i16_4758[1] += 1;
+ if (arr_i16_4758[1] > 0x50) {
+ arr_i16_4758[1] = 1;
}
// 128:4a42
- _toolbox->PenPat(_patterns[this->arr_i16_4758[1]]);
+ _toolbox->PenPat(_patterns[arr_i16_4758[1]]);
}
// 128:4a64
// FIXME: These can sometimes be invalid.
// Create manually to avoid the assert crash in the constructor.
Common::Rect temp;
- temp.left = this->arr_i16_4758[9];
- temp.top = this->arr_i16_4758[8];
- temp.right = this->arr_i16_4758[11];
- temp.bottom = this->arr_i16_4758[10];
+ temp.left = arr_i16_4758[9];
+ temp.top = arr_i16_4758[8];
+ temp.right = arr_i16_4758[11];
+ temp.bottom = arr_i16_4758[10];
_toolbox->FrameRect(temp);
// add fake delay for drawing visibility
if ((i % 4) == 0) {
@@ -2299,34 +2299,34 @@ void FoolGame::menuAbout() {
modalLines = 5;
}
// 128:4e42
- _toolbox->SetPort(this->var_i32_4);
- this->var_i16_7b2 = 0xa;
+ _toolbox->SetPort(var_i32_4);
+ var_i16_7b2 = 0xa;
_toolbox->InitCursor();
- this->toggleMouseCursor(true);
- this->copyScreen(0, this->arr_bmp_138bc);
+ toggleMouseCursor(true);
+ copyScreen(0, arr_bmp_138bc);
_zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- this->var_i16_7b4 = 0;
- this->var_i16_7b6 = 0;
- this->var_i16_7b8 = 0;
+ var_i16_7b4 = 0;
+ var_i16_7b6 = 0;
+ var_i16_7b8 = 0;
for (int i = 0; i <= modalLines; i++) {
- this->var_i16_7ba = _toolbox->StringWidth(_modalText[i]);
- if (this->var_i16_7ba > this->var_i16_7b4) {
- this->var_i16_7b4 = this->var_i16_7ba;
+ var_i16_7ba = _toolbox->StringWidth(_modalText[i]);
+ if (var_i16_7ba > var_i16_7b4) {
+ var_i16_7b4 = var_i16_7ba;
}
// 128:4ec4
- this->var_i16_7b6 += 0x11;
+ var_i16_7b6 += 0x11;
}
// 128:4eda
- this->var_i16_7b6 += 0xd;
- this->var_i16_7b4 = (this->var_i16_7b4/2) + 0xf;
- this->var_i16_7b6 = (this->var_i16_7b6/2);
+ var_i16_7b6 += 0xd;
+ var_i16_7b4 = (var_i16_7b4/2) + 0xf;
+ var_i16_7b6 = (var_i16_7b6/2);
Common::Rect bounds; // arr_rect_5b7c
_toolbox->SetRect(
bounds,
- 0xf5 - this->var_i16_7b4,
- 0x6e - this->var_i16_7b6,
- 0x10b + this->var_i16_7b4,
- 0xcf + this->var_i16_7b6
+ 0xf5 - var_i16_7b4,
+ 0x6e - var_i16_7b6,
+ 0x10b + var_i16_7b4,
+ 0xcf + var_i16_7b6
);
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[0]);
@@ -2348,49 +2348,49 @@ void FoolGame::menuAbout() {
_toolbox->SetRect(
bounds,
0xb5,
- 0x82 - this->var_i16_7b6,
+ 0x82 - var_i16_7b6,
0xd5,
- 0x82 - this->var_i16_7b6 + 0x20
+ 0x82 - var_i16_7b6 + 0x20
);
- _toolbox->PlotIcon(bounds, this->var_i32_c);
+ _toolbox->PlotIcon(bounds, var_i32_c);
// These strings don't appear in the v1.1 about box
- _toolbox->MoveTo(0xde, 0x8c - this->var_i16_7b6);
+ _toolbox->MoveTo(0xde, 0x8c - var_i16_7b6);
_toolbox->DrawString(Common::U32String("the fool's errand")); // was: str(100)
- _toolbox->MoveTo(0xee, 0x9b - this->var_i16_7b6);
+ _toolbox->MoveTo(0xee, 0x9b - var_i16_7b6);
_toolbox->DrawString(Common::U32String("by Cliff Johnson")); // was: str(101)
// 128:509a
- int16 strY = 0xbe - this->var_i16_7b6;
+ int16 strY = 0xbe - var_i16_7b6;
for (int i = 0; i <= modalLines; i++) {
- this->drawTextCenter(_modalText[i], strY);
+ drawTextCenter(_modalText[i], strY);
strY += 0x11;
}
// 128:50f4
_zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, kSrcOr);
strY += 0xe;
- this->drawTextCenter(_zbasic->str(_zstrOffset[kOffsetVersion]), strY); // version string
- this->menuClickMessage();
- this->waitForClick();
+ drawTextCenter(_zbasic->str(_zstrOffset[kOffsetVersion]), strY); // version string
+ menuClickMessage();
+ waitForClick();
_toolbox->DrawMenuBar();
- this->copyScreen(0x1, this->arr_bmp_138bc);
- _toolbox->SetPort(this->var_i32_0);
+ copyScreen(0x1, arr_bmp_138bc);
+ _toolbox->SetPort(var_i32_0);
}
void FoolGame::menuPrologue() {
// this is brand new
- this->copyScreen(0, this->arr_bmp_138bc);
+ copyScreen(0, arr_bmp_138bc);
FoolPrologue fp(_version, _zstrOffset);
- fp.run(false, this->arr_bmp_138bc);
- this->copyScreen(1, this->arr_bmp_138bc);
+ fp.run(false, arr_bmp_138bc);
+ copyScreen(1, arr_bmp_138bc);
_toolbox->DrawMenuBar();
}
void FoolGame::menuFinale() {
// this is brand new
- this->copyScreen(0, this->arr_bmp_138bc);
+ copyScreen(0, arr_bmp_138bc);
FoolPrologue fp(_version, _zstrOffset);
- fp.run(true, this->arr_bmp_138bc);
- this->copyScreen(1, this->arr_bmp_138bc);
+ fp.run(true, arr_bmp_138bc);
+ copyScreen(1, arr_bmp_138bc);
_toolbox->DrawMenuBar();
}
@@ -2400,21 +2400,21 @@ void FoolGame::onClickMenu() {
return;
_event.what = kNullEvent;
if (_menuHidesPlayfield) {
- this->thothHidePlayfield();
+ thothHidePlayfield();
}
uint32 menuData = _toolbox->MenuSelect(_event.where);
_selectedMenuID = (uint16)(menuData >> 16);
_selectedMenuItem = (uint16)(menuData & 0xffff);
if (_selectedMenuID > 0) {
// 128:5b8c
- this->onMenuSelect();
+ onMenuSelect();
_toolbox->HiliteMenu(0);
}
// 128:5b94
if (_menuHidesPlayfield) {
- this->thothShowPlayfield();
+ thothShowPlayfield();
}
- this->sub_128_61ec();
+ sub_128_61ec();
}
void FoolGame::onMenuKey() {
@@ -2426,88 +2426,88 @@ void FoolGame::onMenuKey() {
_selectedMenuItem = (uint16)(menuData & 0xffff);
if (_selectedMenuID > 0) {
if (_menuHidesPlayfield) {
- this->thothHidePlayfield();
+ thothHidePlayfield();
}
- this->onMenuSelect();
+ onMenuSelect();
if (_menuHidesPlayfield) {
- this->thothShowPlayfield();
+ thothShowPlayfield();
}
_toolbox->HiliteMenu(0);
}
// 128:5c1a
- this->sub_128_61ec();
+ sub_128_61ec();
}
void FoolGame::onMenuSelect() {
_stateFlags = kStateNull;
if (_selectedMenuID == 1) { // Eye menu
if (_selectedMenuItem == 2) {
- this->menuAbout();
+ menuAbout();
} else if (_selectedMenuItem == 3) {
- this->menuPrologue();
+ menuPrologue();
} else if (_selectedMenuItem == 4) {
- this->menuFinale();
+ menuFinale();
}
}
if (_selectedMenuID == 2) { // File menu
if (_selectedMenuItem == 1) {
- this->menuNewGame();
+ menuNewGame();
} else if (_selectedMenuItem == 2) {
// 128:5c5c
- this->menuOpenGame();
+ menuOpenGame();
} else if (_selectedMenuItem == 3) {
// 128:5c6c
- this->menuSaveGame();
+ menuSaveGame();
} else if (_selectedMenuItem == 4) {
- this->menuSaveGameAs();
+ menuSaveGameAs();
} else if (_selectedMenuItem == 6) {
_soundEnabled = !_soundEnabled;
// 128:5cbc
- this->menuToggleSound();
+ menuToggleSound();
// 128:5cc4
} else if (_selectedMenuItem == 7) {
- this->menuPrintStory();
+ menuPrintStory();
} else if (_selectedMenuItem == 9) {
- this->menuQuit();
+ menuQuit();
}
}
// 128:5cea
if ((_selectedMenuID >= 3) && (_selectedMenuID <= 7)) { // Chapter menus
- this->var_i16_e1a = 0;
+ var_i16_e1a = 0;
_selectedMenuChapter = _selectedMenuItem + (_selectedMenuID - 3)*0x10;
if ((_selectedMenuChapter == 1) && (_event.what == kKeyDown)) {
- this->var_i16_e1a = 1;
+ var_i16_e1a = 1;
}
// 128:5d56
if ((_event.modifiers & kModLOptionKeyDown) != 0) {
- this->var_i16_e1a = 1;
+ var_i16_e1a = 1;
} else {
// 128:5d74
do {
- this->var_i16_7a8 = _toolbox->GetNextEvent(1 << kKeyDown, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(1 << kKeyDown, _event);
_toolbox->GlobalToLocal(_event.where);
if ((_event.modifiers & kModLOptionKeyDown) != 0) {
- this->var_i16_e1a = 1;
+ var_i16_e1a = 1;
}
} while (_event.what != kNullEvent);
}
// 128:5dae
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 0) && (_storyCurrentChapter != _selectedMenuChapter)) {
+ if (((var_i16_7ce & 1) == 0) && (var_i16_e1a == 0) && (_storyCurrentChapter != _selectedMenuChapter)) {
setStateBits(kStateChapterSelect);
}
// 128:5df6
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1)) {
+ if (((var_i16_7ce & 1) == 0) && (var_i16_e1a == 1)) {
setStateBits(kStateChapterSelect);
}
// 128:5e38
- if (((this->var_i16_7ce & 1) != 0) && (this->var_i16_e1a == 0)) {
+ if (((var_i16_7ce & 1) != 0) && (var_i16_e1a == 0)) {
setStateBits(kStateChapterSelect | kStateReturn);
}
// 128:5e5e
- if (((this->var_i16_7ce & 1) == 0) && (this->var_i16_e1a == 1) && (_storyCurrentChapter != _selectedMenuChapter)) {
+ if (((var_i16_7ce & 1) == 0) && (var_i16_e1a == 1) && (_storyCurrentChapter != _selectedMenuChapter)) {
setStateBits(kStateChapterSelect | kStateReturn);
- this->var_i16_7ce |= 0x4;
+ var_i16_7ce |= 0x4;
}
}
// 128:5eaa
@@ -2517,7 +2517,7 @@ void FoolGame::onMenuSelect() {
setStateBits(kStateReturn);
}
// 128:5ec6
- if ((_selectedMenuItem == 3) && (this->var_i16_c00 == 1)) {
+ if ((_selectedMenuItem == 3) && (var_i16_c00 == 1)) {
setStateBits(kStateUndo);
}
}
@@ -2526,24 +2526,24 @@ void FoolGame::onMenuSelect() {
void FoolGame::thothHidePlayfield() {
// 128:5ef0
- this->copyScreen(0, this->arr_bmp_b3ec);
- _zbasic->picture(0, MENU_HEIGHT, this->var_pic_7c2);
+ copyScreen(0, arr_bmp_b3ec);
+ _zbasic->picture(0, MENU_HEIGHT, var_pic_7c2);
}
void FoolGame::thothShowPlayfield() {
// 128:5f16
if (_stateFlags == kStateSaveGame) {
- if (this->arr_i16_1eb8[0] < 1) {
- this->arr_i16_1eb8[0] = 1;
+ if (arr_i16_1eb8[0] < 1) {
+ arr_i16_1eb8[0] = 1;
}
// 128:5f4c
- _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[0]);
- this->saveGame();
+ _activePuzzleBuffer = _zbasic->encodeInt(arr_i16_1eb8[0]);
+ saveGame();
}
// 128:5f70
if ((_stateFlags & kStateReturn) == 0) {
- this->waitForMouseUp();
- this->copyScreen(1, this->arr_bmp_b3ec);
+ waitForMouseUp();
+ copyScreen(1, arr_bmp_b3ec);
}
}
@@ -2556,7 +2556,7 @@ void FoolGame::onUpdateEvent() {
// 128:5fb4
_toolbox->BeginUpdate(*_event.windowPtr);
_toolbox->EndUpdate(*_event.windowPtr);
- if ((this->var_i16_7ce & 1) != 0) {
+ if ((var_i16_7ce & 1) != 0) {
setStateBits(0x200 | kStateReturn);
} else {
setStateBits(0x200);
@@ -2565,31 +2565,31 @@ void FoolGame::onUpdateEvent() {
void FoolGame::sub_128_5fea() {
if (_screenOversized) {
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
_toolbox->PenNormal();
- fillRect(MENU_HEIGHT, 0, _windowHeight, this->var_i16_56-3, 2);
- fillRect(MENU_HEIGHT, 0, this->var_i16_58+0x11, _windowWidth, 2);
- fillRect(MENU_HEIGHT, this->var_i16_56+0x203, _windowHeight, _windowWidth, 2);
- fillRect(this->var_i16_58 + 0x159, 0, _windowHeight, _windowWidth, 2);
+ fillRect(MENU_HEIGHT, 0, _windowHeight, var_i16_56-3, 2);
+ fillRect(MENU_HEIGHT, 0, var_i16_58+0x11, _windowWidth, 2);
+ fillRect(MENU_HEIGHT, var_i16_56+0x203, _windowHeight, _windowWidth, 2);
+ fillRect(var_i16_58 + 0x159, 0, _windowHeight, _windowWidth, 2);
Common::Rect bounds; // arr_rect_5b7c
- _toolbox->SetRect(bounds, this->var_i16_56-2, this->var_i16_58+0x12, this->var_i16_56+0x202, this->var_i16_58+0x158);
+ _toolbox->SetRect(bounds, var_i16_56-2, var_i16_58+0x12, var_i16_56+0x202, var_i16_58+0x158);
_toolbox->PenPat(_patterns[1]);
_toolbox->FrameRect(bounds);
- _toolbox->SetRect(bounds, this->var_i16_56-1, this->var_i16_58+0x13, this->var_i16_56+0x201, this->var_i16_58+0x157);
+ _toolbox->SetRect(bounds, var_i16_56-1, var_i16_58+0x13, var_i16_56+0x201, var_i16_58+0x157);
_toolbox->PenPat(_patterns[2]);
_toolbox->FrameRect(bounds);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(var_i32_0);
}
// 128:6152
}
void FoolGame::onDiskEvent() {
// 128:6154
- this->var_i16_e1c = _event.message >> 16;
- this->var_i16_e1e = _event.message & 0xffff;
- if (this->var_i16_e1c != 0) {
- _zbasic->unk_11(this->var_i16_e1e);
+ var_i16_e1c = _event.message >> 16;
+ var_i16_e1e = _event.message & 0xffff;
+ if (var_i16_e1c != 0) {
+ _zbasic->unk_11(var_i16_e1e);
}
}
@@ -2599,7 +2599,7 @@ void FoolGame::waitForMouseUp() {
// wait until mouse button is up
do {
// was originally a mask of 6
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent)
_toolbox->Delay(0);
@@ -2608,27 +2608,27 @@ void FoolGame::waitForMouseUp() {
void FoolGame::waitForClick() {
// 128:61c2
- this->waitForMouseUp();
+ waitForMouseUp();
do {
// was originally a mask of 2
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
if (_event.what == kNullEvent)
_toolbox->Delay(0);
} while ((_event.what != kMouseDown));
- this->waitForMouseUp();
+ waitForMouseUp();
}
void FoolGame::sub_128_61ec() {
// 128:61ec
do {
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
- this->onUpdateEvent();
+ onUpdateEvent();
}
if (_event.what == kDiskEvt) {
- this->onDiskEvent();
+ onDiskEvent();
}
if (_event.what == kNullEvent)
_toolbox->Delay(0);
@@ -2638,14 +2638,14 @@ void FoolGame::sub_128_61ec() {
void FoolGame::sub_128_6244() {
do {
- this->var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
_toolbox->BeginUpdate(*_event.windowPtr);
_toolbox->EndUpdate(*_event.windowPtr);
}
// 128:6272
if (_event.what == kDiskEvt) {
- this->onDiskEvent();
+ onDiskEvent();
}
_toolbox->Delay(0);
} while ((_event.what == kNullEvent) && ((_event.modifiers & kModMouseButtonUp) == 0));
@@ -2656,16 +2656,16 @@ void FoolGame::sub_128_6244() {
// 128:62ae
void FoolGame::sub_129_004() {
- this->var_i16_7e6 = 0;
+ var_i16_7e6 = 0;
// 129:000a: LEA - 0x3ea(A5),A0
// 129:000e: MOVE.L - A0,-0x8ee(A5)
// 129:0012: SF - 0x8,D0
- _zbasic->openR(1, Common::U32String("Fool's Puzzles"), 0x3e8, this->var_i16_e20); // was: str(110)
- if (this->var_i16_7e6 == 0) {
- this->var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(111)
- this->var_i16_f22 = this->var_i16_e20;
+ _zbasic->openR(1, Common::U32String("Fool's Puzzles"), 0x3e8, var_i16_e20); // was: str(110)
+ if (var_i16_7e6 == 0) {
+ var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(111)
+ var_i16_f22 = var_i16_e20;
_zbasic->close(1);
- this->var_i16_7e6 = 0;
+ var_i16_7e6 = 0;
}
// 129:005e: LEA - 0x3f2(A5),A0
@@ -2673,11 +2673,11 @@ void FoolGame::sub_129_004() {
}
void FoolGame::sub_129_068() {
- this->var_i16_7ce = 666;
- this->var_i16_372 = { 0, 0, 0 };
+ var_i16_7ce = 666;
+ var_i16_372 = { 0, 0, 0 };
_soundEnabled = true;
- this->_mouseVisible = true;
- this->toggleMouseCursor(false);
+ _mouseVisible = true;
+ toggleMouseCursor(false);
for (size_t i = 0; i <= 3; i++) {
_patterns[1].data[2*i] = 0xaa;
_patterns[1].data[2*i+1] = 0x55;
@@ -2696,10 +2696,10 @@ void FoolGame::sub_129_068() {
// 129:00fa: SUBI.L - 0x74,D0
// 129:0100: JSR - "PEEKWORD"
_windowHeight = g_engine->_wm._screenDims.height(); // window height?
- this->var_i16_56 = (_windowWidth - SCREEN_WIDTH)/2;
- this->var_i16_58 = (_windowHeight - SCREEN_HEIGHT)/2;
+ var_i16_56 = (_windowWidth - SCREEN_WIDTH)/2;
+ var_i16_58 = (_windowHeight - SCREEN_HEIGHT)/2;
// 129:0138
- if ((this->var_i16_56 == 0) && (this->var_i16_58 == 0)) {
+ if ((var_i16_56 == 0) && (var_i16_58 == 0)) {
_screenOversized = false;
} else {
_screenOversized = true;
@@ -2717,9 +2717,9 @@ void FoolGame::sub_129_068() {
// 129:01a4: JSR - "PEEKWORD"
// 129:01a8: CMPI.L - 0x3fff,D0
if (true) {
- this->var_i16_372 = { 0x4e20, 0x4e20, 0x4e20 };
- _toolbox->SetCPixel(0x64, 0x64, this->var_i16_372);
- _toolbox->GetCPixel(0x64, 0x64, this->var_i16_372);
+ var_i16_372 = { 0x4e20, 0x4e20, 0x4e20 };
+ _toolbox->SetCPixel(0x64, 0x64, var_i16_372);
+ _toolbox->GetCPixel(0x64, 0x64, var_i16_372);
}
@@ -2730,44 +2730,44 @@ void FoolGame::sub_129_068() {
fillRect(0, 0, _windowHeight, _windowWidth, 1);
}
// 129:023e
- _toolbox->GetPort(this->var_i32_f24);
+ _toolbox->GetPort(var_i32_f24);
- this->var_i32_8 = &this->arr_grafport_19042;
- _toolbox->OpenPort(this->var_i32_8);
+ var_i32_8 = &arr_grafport_19042;
+ _toolbox->OpenPort(var_i32_8);
// this grafport is used for drawing on the menu bar area;
// on normal hardware this isn't a problem, as the changes are
// made directly to the screen framebuffer.
// in ScummVM, the window and the menu bar are widgets, with surfaces
// that are composed to the screen framebuffer.
// as such, to avoid a clash, we need to draw onto the menu bar widget.
- this->var_i32_8->portBits = _toolbox->_defaultMenuBits;
- this->var_i32_8->portRect = _toolbox->_defaultMenuBits->getBounds();
+ var_i32_8->portBits = _toolbox->_defaultMenuBits;
+ var_i32_8->portRect = _toolbox->_defaultMenuBits->getBounds();
// Thoth, on the other hand, expects to be able to draw to the screen.
- this->var_i32_8_thoth = &this->arr_grafport_19042_thoth;
- _toolbox->OpenPort(this->var_i32_8_thoth);
+ var_i32_8_thoth = &arr_grafport_19042_thoth;
+ _toolbox->OpenPort(var_i32_8_thoth);
_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ _toolbox->MovePortTo(var_i16_56, var_i16_58);
_toolbox->ClipRect(_screenClipRect);
- this->var_i32_4 = &this->arr_grafport_18f78;
- _toolbox->OpenPort(this->var_i32_4);
+ var_i32_4 = &arr_grafport_18f78;
+ _toolbox->OpenPort(var_i32_4);
_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ _toolbox->MovePortTo(var_i16_56, var_i16_58);
_toolbox->ClipRect(_screenClipRect);
- this->var_i32_0 = &this->arr_grafport_18eae;
- _toolbox->OpenPort(this->var_i32_0);
+ var_i32_0 = &arr_grafport_18eae;
+ _toolbox->OpenPort(var_i32_0);
_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->MovePortTo(this->var_i16_56, this->var_i16_58);
+ _toolbox->MovePortTo(var_i16_56, var_i16_58);
_toolbox->ClipRect(_screenClipRect);
- this->sub_128_5fea();
+ sub_128_5fea();
// 129:02c8
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1);
if (false) {
- //if (this->var_i16_372.red + this->var_i16_372.blue + this->var_i16_372.green != 0) {
+ //if (var_i16_372.red + var_i16_372.blue + var_i16_372.green != 0) {
// we're in colour mode, chide the user.
// removed in v3.0
// was: str(113) to str(116)
@@ -2775,13 +2775,13 @@ void FoolGame::sub_129_068() {
_modalText[1] = Common::U32String("2 color black and white");
_modalText[2] = Common::U32String("and start the game again.");
_modalText[3] = Common::U32String("Okay");
- this->showChoiceModal(kFontChicago, 2, 1, 0);
+ showChoiceModal(kFontChicago, 2, 1, 0);
_zbasic->unk_4();
}
// 129:0390
- this->sub_128_61ec();
- this->var_i32_37c = _zbasic->mem(-1);
- if (this->var_i32_37c < 0x1d4c0) {
+ sub_128_61ec();
+ var_i32_37c = _zbasic->mem(-1);
+ if (var_i32_37c < 0x1d4c0) {
// not enough memory, chide the user
// was: str(117) to str(123)
_modalText[0] = Common::U32String("There is not enough available memory");
@@ -2791,106 +2791,106 @@ void FoolGame::sub_129_068() {
_modalText[4] = Common::U32String("for possible solutions.");
_modalText[5] = Common::U32String();
_modalText[6] = Common::U32String("Quit");
- this->showChoiceModal(kFontChicago, 5, 1, 1);
+ showChoiceModal(kFontChicago, 5, 1, 1);
_zbasic->unk_4();
}
// 129:0496
- this->var_i16_7e4 = 1;
- this->var_str_e22.clear(); // was: str(124);
+ var_i16_7e4 = 1;
+ var_str_e22.clear(); // was: str(124);
_saveFileName.clear(); // was: str(125);
- this->var_i16_484 = _zbasic->finderInfo(this->var_i16_7e4, this->var_str_588, this->var_i32_f28, this->var_i16_688);
+ var_i16_484 = _zbasic->finderInfo(var_i16_7e4, var_str_588, var_i32_f28, var_i16_688);
- if (!this->var_str_588.empty()) { // was: str(126)
- if (this->var_str_588 == Common::U32String("Fool's Puzzles")) { // was: str(127)
- this->var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(128)
- this->var_i16_f22 = this->var_i16_688;
+ if (!var_str_588.empty()) { // was: str(126)
+ if (var_str_588 == Common::U32String("Fool's Puzzles")) { // was: str(127)
+ var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(128)
+ var_i16_f22 = var_i16_688;
} else {
// 129:052e
- this->sub_128_2808();
- if (!this->var_str_588.empty()) { // was: str(129)
+ sub_128_2808();
+ if (!var_str_588.empty()) { // was: str(129)
// 129:054c
- _saveFileName = this->var_str_588;
- this->var_i16_9ec = this->var_i16_688;
+ _saveFileName = var_str_588;
+ var_i16_9ec = var_i16_688;
}
}
}
// 129:0562
- this->var_i16_f2c = this->getVolRefNum(); // volume ref num
- this->var_i16_e20 = this->var_i16_f2c;
- if (this->var_str_e22.empty()) { // was: str(130)
- this->sub_129_004();
+ var_i16_f2c = getVolRefNum(); // volume ref num
+ var_i16_e20 = var_i16_f2c;
+ if (var_str_e22.empty()) { // was: str(130)
+ sub_129_004();
}
// 129:058c
- if (this->var_str_e22.empty()) { // was: str(131)
- for (this->var_i16_f2e = 1; this->var_i16_f2e < 0x3e8; this->var_i16_f2e++) {
- this->var_str_f30 = _zbasic->files(-this->var_i16_f2e, Common::U32String(), Common::U32String(), this->var_i16_e20); // was: str(132)
- if ((this->var_i16_e20 == 0) || (this->var_str_f30.empty())) { // was: str(133)
- this->var_i16_f2e = 0x3e8;
+ if (var_str_e22.empty()) { // was: str(131)
+ for (var_i16_f2e = 1; var_i16_f2e < 0x3e8; var_i16_f2e++) {
+ var_str_f30 = _zbasic->files(-var_i16_f2e, Common::U32String(), Common::U32String(), var_i16_e20); // was: str(132)
+ if ((var_i16_e20 == 0) || (var_str_f30.empty())) { // was: str(133)
+ var_i16_f2e = 0x3e8;
}
// 129:0606
- this->sub_129_004();
- if (!this->var_str_e22.empty()) { // was: str(134)
- this->var_i16_f2e = 0x3e8;
+ sub_129_004();
+ if (!var_str_e22.empty()) { // was: str(134)
+ var_i16_f2e = 0x3e8;
}
}
}
// 129:0636
- if (this->var_str_e22.empty()) { // was: str(135)
+ if (var_str_e22.empty()) { // was: str(135)
do {
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcBic);
fillRect(0x17, 0x92, 0x31, 0x16e, 2);
- //this->var_i16_7a2 = 0x28;
+ //var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
// 129:0690: CLR.W - -0x772(A5)
- this->toggleMouseCursor(true);
- this->sub_128_1e4(Common::String("PUZZ")); // was: str(137)
+ toggleMouseCursor(true);
+ sub_128_1e4(Common::String("PUZZ")); // was: str(137)
// 129:06a6: CLR.W - -0x772(A5)
fillRect(0x17, 0x92, 0x31, 0x16e, 1);
- this->toggleMouseCursor(false);
- if (this->var_str_588.empty()) { // was: str(138)
+ toggleMouseCursor(false);
+ if (var_str_588.empty()) { // was: str(138)
_zbasic->unk_4();
}
- this->var_str_e22 = this->var_str_588;
- this->var_i16_f22 = this->var_i16_688;
- } while (this->var_str_e22 != Common::U32String("Fool's Puzzles")); // was: str(139)
+ var_str_e22 = var_str_588;
+ var_i16_f22 = var_i16_688;
+ } while (var_str_e22 != Common::U32String("Fool's Puzzles")); // was: str(139)
}
// 129:0718
- this->setVolRefNum(this->var_i16_f22);
- this->var_i16_1030 = _toolbox->OpenResFile(Common::Path(this->var_str_e22, ':'));
- _toolbox->UseResFile(this->var_i16_1030);
- this->var_i16_484 = this->setVolRefNum(this->var_i16_f2c);
+ setVolRefNum(var_i16_f22);
+ var_i16_1030 = _toolbox->OpenResFile(Common::Path(var_str_e22, ':'));
+ _toolbox->UseResFile(var_i16_1030);
+ var_i16_484 = setVolRefNum(var_i16_f2c);
for (int i = 0; i <= 1; i++) {
// scroll background
- this->arr_i32_192c0[i] = _toolbox->GetPicture(i + 0x54);
- PicHandle h = this->arr_i32_192c0[i];
+ arr_i32_192c0[i] = _toolbox->GetPicture(i + 0x54);
+ PicHandle h = arr_i32_192c0[i];
_toolbox->DetachResource(h);
}
// 129:07a2
- _zbasic->picture(0, MENU_HEIGHT, this->arr_i32_192c0[0]);
- _zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, this->arr_bmp_5dfc);
- _zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, this->arr_bmp_b3ec);
- _zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, this->arr_bmp_109dc);
+ _zbasic->picture(0, MENU_HEIGHT, arr_i32_192c0[0]);
+ _zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, arr_bmp_5dfc);
+ _zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, arr_bmp_b3ec);
+ _zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, arr_bmp_109dc);
// 129:0846
// unfurl the scroll by blitting the lower half a bunch of times
for (int i = 0; i <= 0x15; i++) {
- this->var_i16_484 = _zbasic->readDataInt();
- _zbasic->put(0, this->var_i16_484, this->arr_bmp_5dfc, kSrcCopy);
- this->delay(2);
+ var_i16_484 = _zbasic->readDataInt();
+ _zbasic->put(0, var_i16_484, arr_bmp_5dfc, kSrcCopy);
+ delay(2);
}
// 129:0888
- _zbasic->put(0, 0x14f, this->arr_bmp_b3ec, kSrcCopy);
- _zbasic->put(0x1f9, 0x14f, this->arr_bmp_109dc, kSrcCopy);
- _zbasic->picture(0x39, 0x29, this->arr_i32_192c0[1]);
+ _zbasic->put(0, 0x14f, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(0x1f9, 0x14f, arr_bmp_109dc, kSrcCopy);
+ _zbasic->picture(0x39, 0x29, arr_i32_192c0[1]);
// 129:08ee
for (int i = 0; i <= 1; i++) {
- _toolbox->ReleaseResource(this->arr_i32_192c0[i]);
+ _toolbox->ReleaseResource(arr_i32_192c0[i]);
}
// 129:091a
- this->var_i32_692 = _toolbox->TickCount();
- this->menuLoadingMessage(40);
+ var_i32_692 = _toolbox->TickCount();
+ menuLoadingMessage(40);
// load sun's map tiles
//byte fakePal[768];
@@ -2904,27 +2904,27 @@ void FoolGame::sub_129_068() {
_toolbox->DetachResource(_sunMapTilePic[i]);
}
// 129:097c
- this->menuLoadingMessage(60);
+ menuLoadingMessage(60);
// wadjet eye
- this->var_pic_7c2 = _toolbox->GetPicture(0x56);
- _toolbox->DetachResource(this->var_pic_7c2);
+ var_pic_7c2 = _toolbox->GetPicture(0x56);
+ _toolbox->DetachResource(var_pic_7c2);
_metapuzzleWheelPic = _toolbox->GetPicture(0xac);
_toolbox->DetachResource(_metapuzzleWheelPic);
// icon of a scroll
- this->var_i32_c = _toolbox->GetIcon(0x101);
- _toolbox->DetachResource(this->var_i32_c);
+ var_i32_c = _toolbox->GetIcon(0x101);
+ _toolbox->DetachResource(var_i32_c);
// 129:09c2: SF - 0x8,D0
- _zbasic->openR(1, Common::U32String("Fool's Puzzles"), 1000, this->var_i16_f22); // was: str(140)
- this->var_i32_1036 = _zbasic->readFileDblInt(1);
+ _zbasic->openR(1, Common::U32String("Fool's Puzzles"), 1000, var_i16_f22); // was: str(140)
+ var_i32_1036 = _zbasic->readFileDblInt(1);
- this->_puzzleDataPtr = 0;
+ _puzzleDataPtr = 0;
// read into pointer
- this->_puzzleDataBuffer = _zbasic->readFile(1, this->var_i32_1036);
+ _puzzleDataBuffer = _zbasic->readFile(1, var_i32_1036);
// 129:0a0a
- this->menuLoadingMessage(80);
+ menuLoadingMessage(80);
for (int i = 1; i <= 0x64; i++) {
_puzzleDataOffsets[i] = puzzlesReadLong();
}
@@ -2956,28 +2956,28 @@ void FoolGame::sub_129_068() {
}
// 129:0b02
for (int i = 1; i <= 0x51; i++) {
- this->arr_i16_4c7c[i] = puzzlesReadByte();
+ arr_i16_4c7c[i] = puzzlesReadByte();
}
// 129:0b30
for (int i = 1; i <= 0xc; i++) {
for (int j = 0; j <= 3; j++) {
- this->arr_i16_4d20[i*4 + j] = puzzlesReadShort();
+ arr_i16_4d20[i*4 + j] = puzzlesReadShort();
}
}
// 129:0b78
- this->var_i16_103a = puzzlesReadShort();
+ var_i16_103a = puzzlesReadShort();
// story menu entries + endgame puzzles
- for (int i = 1; i <= this->var_i16_103a; i++) {
+ for (int i = 1; i <= var_i16_103a; i++) {
_puzzleType[i] = puzzlesReadShort();
- this->arr_i16_15e8[i] = puzzlesReadShort();
+ arr_i16_15e8[i] = puzzlesReadShort();
_puzzleUnlockChapter[i] = puzzlesReadShort();
_puzzleName[i] = puzzlesReadString().decode(Common::kMacRoman);
}
// 129:0c0a
- this->var_i16_103a = puzzlesReadShort();
- for (int i = 1; i <= this->var_i16_103a; i++) {
+ var_i16_103a = puzzlesReadShort();
+ for (int i = 1; i <= var_i16_103a; i++) {
for (int j = 0; j <= 5; j++) {
- this->arr_i16_16b2[i*8+j] = puzzlesReadShort();
+ arr_i16_16b2[i*8+j] = puzzlesReadShort();
}
}
// 129:0c5e
@@ -2991,22 +2991,22 @@ void FoolGame::sub_129_068() {
_pageLineRanges[i*2 + 1] = puzzlesReadShort();
}
// 129:0ce0
- this->var_i16_103a = puzzlesReadShort();
- for (int i = 1; i <= this->var_i16_103a; i++) {
+ var_i16_103a = puzzlesReadShort();
+ for (int i = 1; i <= var_i16_103a; i++) {
_puzzleMenuInstructions[i*2] = puzzlesReadShort();
_puzzleMenuInstructions[i*2 + 1] = puzzlesReadShort();
}
// 129:0d3c
// story text
- this->var_i16_103c = puzzlesReadShort();
- this->var_i16_68a = 1;
+ var_i16_103c = puzzlesReadShort();
+ var_i16_68a = 1;
Common::fill(_pageLineFace, _pageLineFace + 1301, 0);
Common::fill(_pageLineBreak, _pageLineBreak + 1301, 0);
- for (int i = 1; i <= this->var_i16_103c; i++) {
- this->var_i16_103e = puzzlesReadByte();
+ for (int i = 1; i <= var_i16_103c; i++) {
+ var_i16_103e = puzzlesReadByte();
// indent at start of story paragraph
- if (this->var_i16_103e & 0x8) {
- this->var_i16_103e ^= 0x8;
+ if (var_i16_103e & 0x8) {
+ var_i16_103e ^= 0x8;
// 129:0d7e
_zbasic->indexRawSet(_zbasic->space(4).encode(Common::kMacRoman) + puzzlesReadString(), 0, i);
} else {
@@ -3016,38 +3016,38 @@ void FoolGame::sub_129_068() {
// 129:0db8
// 0x4 == newline
// 0x1 == normal formatting
- if ((this->var_i16_103e == 1) || (this->var_i16_103e == 4)) {
+ if ((var_i16_103e == 1) || (var_i16_103e == 4)) {
_pageLineFace[i] = Graphics::kMacFontRegular;
}
// 129:0dea
// 0x2 = bold formatting
- if ((this->var_i16_103e == 2) || (this->var_i16_103e == 5)) {
+ if ((var_i16_103e == 2) || (var_i16_103e == 5)) {
_pageLineFace[i] = Graphics::kMacFontBold;
}
// 129:0e1e
// 0x3 = outlined
- if ((this->var_i16_103e == 3) || (this->var_i16_103e == 6)) {
+ if ((var_i16_103e == 3) || (var_i16_103e == 6)) {
_pageLineFace[i] = Graphics::kMacFontBold | Graphics::kMacFontOutline | Graphics::kMacFontShadow;
}
// 129:0e52
- if (this->var_i16_103e > 3) {
+ if (var_i16_103e > 3) {
_pageLineBreak[i] = 1;
}
// 129:0e6e
}
// 129:0e80
- this->menuLoadingMessage(100);
- this->var_i16_103a = puzzlesReadShort();
- for (int i = this->var_i16_103c + 1; i <= this->var_i16_103a; i++) {
+ menuLoadingMessage(100);
+ var_i16_103a = puzzlesReadShort();
+ for (int i = var_i16_103c + 1; i <= var_i16_103a; i++) {
_zbasic->indexRawSet(puzzlesReadString(), 0, i);
}
// 129:0ec2
for (int j = 1; j <= 0x50; j++) {
- this->var_i16_1040 = 0;
+ var_i16_1040 = 0;
for (int i = 1; i <= _storyPageCount; i++) {
if (_pageToChapter[i] == j) {
- this->var_i16_1040++;
+ var_i16_1040++;
}
// 129:0ef4
if (_pageToChapter[i] > j) {
@@ -3055,13 +3055,13 @@ void FoolGame::sub_129_068() {
}
// 129:0f16
}
- if (this->var_i16_1040 > 1) {
- this->var_i16_484 = 0;
+ if (var_i16_1040 > 1) {
+ var_i16_484 = 0;
for (int i = 1; i <= _storyPageCount; i++) {
if (_pageToChapter[i] == j) {
- this->var_i16_484++;
+ var_i16_484++;
// - X of N
- _pageNumberText[i] = Common::U32String::format(" - %d of %d", this->var_i16_484, this->var_i16_1040); // was: str(141), str(142)
+ _pageNumberText[i] = Common::U32String::format(" - %d of %d", var_i16_484, var_i16_1040); // was: str(141), str(142)
}
// 129:0fb6
if (_pageToChapter[i] > j) {
@@ -3085,12 +3085,12 @@ void FoolGame::sub_129_068() {
// 129:107a
}
// 129:108c
- _toolbox->UseResFile(this->var_i16_1030);
- this->delayFromMarker(0xc8);
- this->var_i16_7ce = 0;
- this->var_i16_7b2 = 0xa;
+ _toolbox->UseResFile(var_i16_1030);
+ delayFromMarker(0xc8);
+ var_i16_7ce = 0;
+ var_i16_7b2 = 0xa;
_toolbox->InitCursor();
- this->toggleMouseCursor(true);
+ toggleMouseCursor(true);
// The menus are so different between versions, it's easiest to hardcode the v2.0 ones.
// Apple menu
_zbasic->menu(1, 0, 1, Common::U32String("~")); // wadjet eye, was: str(143)
@@ -3113,7 +3113,7 @@ void FoolGame::sub_129_068() {
_zbasic->menu(2, 8, 0, Common::U32String("-"));
_zbasic->menu(2, 9, 1, Common::U32String("/QQuit"));
- this->sub_128_6244();
+ sub_128_6244();
// 129:11f6
if (_saveFileName.empty()) { // was: str(157)
// cold start
@@ -3121,8 +3121,8 @@ void FoolGame::sub_129_068() {
} else {
// loading a save game
_stateFlags = kStateOpenGame;
- this->var_str_588 = _saveFileName;
- this->var_i16_688 = this->var_i16_9ec;
+ var_str_588 = _saveFileName;
+ var_i16_688 = var_i16_9ec;
}
// 129:1236
// JMP - [0x19f6]
@@ -3132,7 +3132,7 @@ void FoolGame::sub_129_068() {
void FoolGame::menuLoadingMessage(int16 percent) {
// 129:123a
// draw the loading text on the menu bar
- _toolbox->SetPort(this->var_i32_8);
+ _toolbox->SetPort(var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
// Loading Game text during initial puzzle load
@@ -3141,7 +3141,7 @@ void FoolGame::menuLoadingMessage(int16 percent) {
_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xe);
_toolbox->DrawString(message);
_toolbox->_defaultMenu->setOverlayDirty(true);
- _toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(var_i32_0);
_toolbox->Delay(0);
}
diff --git a/engines/fool/fool_hermit.cpp b/engines/fool/fool_hermit.cpp
index 053043d2335..0a0c71236a1 100644
--- a/engines/fool/fool_hermit.cpp
+++ b/engines/fool/fool_hermit.cpp
@@ -58,7 +58,7 @@ void FoolGame::hermitRun() {
if (_activePuzzleStatus > 0x64) {
_hermitPathStage = _activePuzzleStatus - 0x64;
}
- this->thothKeyLast();
+ thothKeyLast();
if (_hermitPathStage == 6) {
_activePuzzleStatus = 0x63;
} else {
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 2ab524c4011..1645a998216 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -34,29 +34,29 @@ namespace Fool {
void FoolGame::humbugRun() {
// 142:0004
if (_activePuzzleStatus < 0x63) {
- this->humbugPlayTrail();
+ humbugPlayTrail();
if (!_activePuzzleSolved) {
return;
}
- this->humbugSuccess();
+ humbugSuccess();
if (_puzzleCompletionStatus[0x34] > 2) {
_activePuzzleStatus = 0x64;
return;
}
// 142:004e
_activePuzzleStatus = 0x63;
- this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
// behold the 2nd key of thoth
- this->showBehold(0x17, 0, _zbasic->str(OFF(0)));
+ showBehold(0x17, 0, _zbasic->str(OFF(0)));
}
// 142:00b2
if (_activePuzzleStatus == 0x63) {
- this->humbugShowThoth();
+ humbugShowThoth();
}
if (_activePuzzleStatus >= 0x64) {
- this->humbugPlayTrail();
+ humbugPlayTrail();
if (_activePuzzleSolved) {
- this->humbugSuccess();
+ humbugSuccess();
}
}
// 142:00e2
@@ -74,19 +74,19 @@ void FoolGame::humbugPlayTrail() {
_zbasic->menu(8, 4, 1, _zbasic->str(OFF(4))); // if the two become one.
}
// 142:0166
- this->fetchPuzzleData();
- this->toggleMouseCursor(false);
+ fetchPuzzleData();
+ toggleMouseCursor(false);
_zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
- this->drawPuzzleButton(_zbasic->str(OFF(5))); // ~
+ drawPuzzleButton(_zbasic->str(OFF(5))); // ~
// eye button
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_b3ec);
for (int16 i = 1; i <= 0xa42; i++) {
_humbugTrail[i].x = puzzlesReadShort();
_humbugTrail[i].y = puzzlesReadShort();
_zbasic->put(
_humbugTrail[i].x,
_humbugTrail[i].y,
- this->arr_bmp_b3ec,
+ arr_bmp_b3ec,
kSrcCopy
);
// Simulate slow draw speed
@@ -94,30 +94,30 @@ void FoolGame::humbugPlayTrail() {
_toolbox->Delay(0);
}
// 142:026e
- this->toggleMouseCursor(true);
+ toggleMouseCursor(true);
_zbasic->put(
- _humbugTrail[this->_humbugTrailIndex].x,
- _humbugTrail[this->_humbugTrailIndex].y,
- this->arr_bmp_b3ec,
+ _humbugTrail[_humbugTrailIndex].x,
+ _humbugTrail[_humbugTrailIndex].y,
+ arr_bmp_b3ec,
kSrcCopy
);
- this->_humbugTrailIndex = 1;
+ _humbugTrailIndex = 1;
_stateFlags = kStateNull;
_activePuzzleSolved = false;
- this->var_i16_1ab6 = 0;
- this->var_i16_1ab8 = 0;
+ var_i16_1ab6 = 0;
+ var_i16_1ab8 = 0;
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 142:02ee
- this->getNextEvent(-1);
- if (!((this->var_i16_1ab6 == _event.where.x) && (this->var_i16_1ab8 == _event.where.y))) {
- this->humbugMoveMouse();
+ getNextEvent(-1);
+ if (!((var_i16_1ab6 == _event.where.x) && (var_i16_1ab8 == _event.where.y))) {
+ humbugMoveMouse();
}
- if (this->_humbugTrailIndex >= 0xa42) {
+ if (_humbugTrailIndex >= 0xa42) {
_activePuzzleSolved = true;
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
// 142:0346
}
@@ -125,60 +125,60 @@ void FoolGame::humbugPlayTrail() {
void FoolGame::humbugMoveMouse() {
// 142:0370
- int16 trailMax = this->_humbugTrailIndex + 0x19;
+ int16 trailMax = _humbugTrailIndex + 0x19;
if (trailMax > 0xa42) {
trailMax = 0xa42;
}
- int16 trailMin = this->_humbugTrailIndex - 0x19;
+ int16 trailMin = _humbugTrailIndex - 0x19;
if (trailMin < 1) {
trailMin = 1;
}
- this->var_i16_1a9c = 0;
+ var_i16_1a9c = 0;
for (int16 i = trailMax; i >= trailMin; i--) {
int16 dx = _event.where.x - _humbugTrail[i].x;
int16 dy = _event.where.y - _humbugTrail[i].y;
if ((dx >= -5) && (dx <= 0x1e) && (dy >= -5) && (dy <= 0x19)) {
- this->var_i16_1a9c = i + 0xa;
+ var_i16_1a9c = i + 0xa;
}
// 142:0470
}
// 142:0484
- if (this->var_i16_1a9c >= 0xa42) {
- this->var_i16_1a9c = 0xa42;
+ if (var_i16_1a9c >= 0xa42) {
+ var_i16_1a9c = 0xa42;
}
- if (this->var_i16_1a9c != 0) {
- int16 incr = (this->_humbugTrailIndex < this->var_i16_1a9c) ? 1 : -1;
- int16 index = this->_humbugTrailIndex;
+ if (var_i16_1a9c != 0) {
+ int16 incr = (_humbugTrailIndex < var_i16_1a9c) ? 1 : -1;
+ int16 index = _humbugTrailIndex;
do {
_zbasic->put(
_humbugTrail[index].x,
_humbugTrail[index].y,
- this->arr_bmp_b3ec,
+ arr_bmp_b3ec,
kSrcCopy
);
// 142:051c
- } while (_zbasic->incrAndCheck(index, this->var_i16_1a9c, incr));
- this->_humbugTrailIndex = this->var_i16_1a9c;
- this->var_i16_1ab6 = _event.where.x;
- this->var_i16_1ab8 = _event.where.y;
+ } while (_zbasic->incrAndCheck(index, var_i16_1a9c, incr));
+ _humbugTrailIndex = var_i16_1a9c;
+ var_i16_1ab6 = _event.where.x;
+ var_i16_1ab8 = _event.where.y;
} else {
// 142:054a
- int16 rewindTo = this->_humbugTrailIndex - 0xa;
+ int16 rewindTo = _humbugTrailIndex - 0xa;
if (rewindTo < 1) {
rewindTo = 1;
}
- for (int16 i = this->_humbugTrailIndex; i >= rewindTo; i--) {
+ for (int16 i = _humbugTrailIndex; i >= rewindTo; i--) {
_zbasic->put(
_humbugTrail[i].x,
_humbugTrail[i].y,
- this->arr_bmp_b3ec,
+ arr_bmp_b3ec,
kSrcCopy
);
// 142:05c8
}
- this->_humbugTrailIndex -= 0xa;
- if (this->_humbugTrailIndex < 1) {
- this->_humbugTrailIndex = 1;
+ _humbugTrailIndex -= 0xa;
+ if (_humbugTrailIndex < 1) {
+ _humbugTrailIndex = 1;
}
}
// 142:05f0
@@ -186,46 +186,46 @@ void FoolGame::humbugMoveMouse() {
void FoolGame::humbugSuccess() {
// 142:05f2
- this->zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
}
void FoolGame::humbugShowThoth() {
// 142:0630
_zbasic->menu(8, 0, 1, _zbasic->str(OFF(6))); // the 2nd key of thoth
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(7))); // return to scroll
- this->thothKey2nd();
+ thothKey2nd();
if (_activePuzzleSolved) {
// 142:066e
_toolbox->PenNormal();
_zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
for (int16 i = 1; i <= 4; i++) {
Common::Rect temp;
- temp.top = this->arr_i16_2f38[i*32];
- temp.left = this->arr_i16_2f38[i*32+1];
- temp.bottom = this->arr_i16_2f38[i*32+2];
- temp.right = this->arr_i16_2f38[i*32+3];
+ temp.top = arr_i16_2f38[i*32];
+ temp.left = arr_i16_2f38[i*32+1];
+ temp.bottom = arr_i16_2f38[i*32+2];
+ temp.right = arr_i16_2f38[i*32+3];
_toolbox->FillRect(temp, _patterns[2]);
_toolbox->FrameRect(temp);
Common::U32String idStr = Common::U32String::format(" %d ", i);
int16 width = _toolbox->StringWidth(idStr);
- int16 xOffset = (this->arr_i16_2f38[i*32+3] - this->arr_i16_2f38[i*32+1])/2;
+ int16 xOffset = (arr_i16_2f38[i*32+3] - arr_i16_2f38[i*32+1])/2;
// 142:0756
_toolbox->MoveTo(
- this->arr_i16_2f38[i*32+1] + xOffset - (width / 2),
- this->arr_i16_2f38[i*32 + 2] - 0x1e
+ arr_i16_2f38[i*32+1] + xOffset - (width / 2),
+ arr_i16_2f38[i*32 + 2] - 0x1e
);
_toolbox->DrawString(idStr);
}
// 142:07ca
_zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
- this->waitForMouseUp();
- this->menuClickMessage();
+ waitForMouseUp();
+ menuClickMessage();
int16 tickCounter = 0;
int16 idCounter = 0;
while (_event.modifiers & kModMouseButtonUp) {
// 142:07f8
- this->getNextEvent(-1); // was: 0
+ getNextEvent(-1); // was: 0
tickCounter++;
if (tickCounter == 0x64) {
tickCounter = 0;
@@ -234,10 +234,10 @@ void FoolGame::humbugShowThoth() {
idCounter = 1;
}
Common::Rect temp;
- temp.top = this->arr_i16_2f38[idCounter*32];
- temp.left = this->arr_i16_2f38[idCounter*32+1];
- temp.bottom = this->arr_i16_2f38[idCounter*32+2];
- temp.right = this->arr_i16_2f38[idCounter*32+3];
+ temp.top = arr_i16_2f38[idCounter*32];
+ temp.left = arr_i16_2f38[idCounter*32+1];
+ temp.bottom = arr_i16_2f38[idCounter*32+2];
+ temp.right = arr_i16_2f38[idCounter*32+3];
_toolbox->InvertRect(temp);
}
}
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index a95bc826b1e..7ccdcb546d1 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -35,77 +35,77 @@ namespace Fool {
// jigsaw puzzle game
void FoolGame::jigsawRun() {
// 132:0004
- this->var_i16_c00 = 1;
- this->fetchPuzzleData();
+ var_i16_c00 = 1;
+ fetchPuzzleData();
int16 picID = puzzlesReadShort();
for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = puzzlesReadShort();
+ arr_i16_1eb8[i] = puzzlesReadShort();
}
// 132:0044
// puzzle dimensions
- this->_jigsawPieceCount = this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1];
- for (int i = 1; i <= this->_jigsawPieceCount; i++) {
- this->arr_i16_3738[i] = puzzlesReadByte();
+ _jigsawPieceCount = arr_i16_1eb8[0] * arr_i16_1eb8[1];
+ for (int i = 1; i <= _jigsawPieceCount; i++) {
+ arr_i16_3738[i] = puzzlesReadByte();
}
// 132:00a2
- this->arr_i32_192c0[0] = _toolbox->GetPicture(picID);
- _zbasic->picture(0, 0x14, this->arr_i32_192c0[0]);
- _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
- this->var_i16_1aa0 = 4 + ((this->arr_i16_1eb8[12] + 1)*2) * ((this->arr_i16_1eb8[13]+0x10)/0x10);
+ arr_i32_192c0[0] = _toolbox->GetPicture(picID);
+ _zbasic->picture(0, 0x14, arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(arr_i32_192c0[0]);
+ var_i16_1aa0 = 4 + ((arr_i16_1eb8[12] + 1)*2) * ((arr_i16_1eb8[13]+0x10)/0x10);
// 132:0136
- this->var_i16_1aa0 = (this->var_i16_1aa0 / 2) + 1;
- this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[8];
+ var_i16_1aa0 = (var_i16_1aa0 / 2) + 1;
+ var_i16_484 = 0;
+ var_i16_68c = arr_i16_1eb8[8];
do {
- this->var_i16_68a = this->arr_i16_1eb8[10];
+ var_i16_68a = arr_i16_1eb8[10];
do {
- this->var_i16_484++;
+ var_i16_484++;
_toolbox->SetRect(
- _screenGrid[this->var_i16_484],
- this->var_i16_68a + 1,
- this->var_i16_68c + 1,
- this->var_i16_68a + this->arr_i16_1eb8[13],
- this->var_i16_68c + this->arr_i16_1eb8[12]
+ _screenGrid[var_i16_484],
+ var_i16_68a + 1,
+ var_i16_68c + 1,
+ var_i16_68a + arr_i16_1eb8[13],
+ var_i16_68c + arr_i16_1eb8[12]
);
- //this->var_i16_1aa2 = 0x2af8 + this->var_i16_1aa0*(this->arr_i16_3738[this->var_i16_484] - 1);
+ //var_i16_1aa2 = 0x2af8 + var_i16_1aa0*(arr_i16_3738[var_i16_484] - 1);
// 132:0216
- _jigsawPieces[this->arr_i16_3738[this->var_i16_484]] = BitMap(new Graphics::ManagedSurface());
+ _jigsawPieces[arr_i16_3738[var_i16_484]] = BitMap(new Graphics::ManagedSurface());
_zbasic->get(
- _screenGrid[this->var_i16_484].left,
- _screenGrid[this->var_i16_484].top,
- _screenGrid[this->var_i16_484].right,
- _screenGrid[this->var_i16_484].bottom,
- _jigsawPieces[this->arr_i16_3738[this->var_i16_484]]
+ _screenGrid[var_i16_484].left,
+ _screenGrid[var_i16_484].top,
+ _screenGrid[var_i16_484].right,
+ _screenGrid[var_i16_484].bottom,
+ _jigsawPieces[arr_i16_3738[var_i16_484]]
);
} while (_zbasic->incrAndCheck(
- this->var_i16_68a,
- this->arr_i16_1eb8[11],
- this->arr_i16_1eb8[6]
+ var_i16_68a,
+ arr_i16_1eb8[11],
+ arr_i16_1eb8[6]
));
// 132:02dc
} while (_zbasic->incrAndCheck(
- this->var_i16_68c,
- this->arr_i16_1eb8[9],
- this->arr_i16_1eb8[7]
+ var_i16_68c,
+ arr_i16_1eb8[9],
+ arr_i16_1eb8[7]
));
// 132:030c
- this->var_i16_484 = 0;
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->var_i16_484++;
- this->arr_i16_2f38[i*32 + j] = this->var_i16_484;
+ var_i16_484 = 0;
+ for (int j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= arr_i16_1eb8[0]; i++) {
+ var_i16_484++;
+ arr_i16_2f38[i*32 + j] = var_i16_484;
}
}
// 132:0376
// rearrange picture tiles to match state
if (!_activePuzzleBuffer.empty()) { // was: str(OFF(0))
- for (int i = 1; i <= this->_jigsawPieceCount; i++) {
+ for (int i = 1; i <= _jigsawPieceCount; i++) {
Common::String tileData = _zbasic->midStr(_activePuzzleBuffer, i*2 - 1, 2);
- this->arr_i16_3738[i] = _zbasic->decodeInt(tileData);
+ arr_i16_3738[i] = _zbasic->decodeInt(tileData);
_zbasic->put(
_screenGrid[i].left,
_screenGrid[i].top,
- _jigsawPieces[this->arr_i16_3738[i]],
+ _jigsawPieces[arr_i16_3738[i]],
kSrcCopy
);
// 132:0452
@@ -115,7 +115,7 @@ void FoolGame::jigsawRun() {
_stateFlags = kStateNull;
_zbasic->menu(8, 3, 0, Common::U32String());
_toolbox->InitCursor();
- this->jigsawCheckIfSolved();
+ jigsawCheckIfSolved();
// JMP 0x4d8
// 132:04d8
@@ -125,33 +125,33 @@ void FoolGame::jigsawRun() {
// 132:049c
while ((_stateFlags == kStateNull) && !_activePuzzleSolved) {
// 132:0488
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->jigsawOnClick();
+ jigsawOnClick();
}
}
// 132:04b8
if (_stateFlags == kStateUndo) {
- this->jigsawCancelSelect();
+ jigsawCancelSelect();
}
if (_stateFlags == kStateSaveGame) {
- this->jigsawStoreState();
- this->saveGame();
+ jigsawStoreState();
+ saveGame();
}
}
// 132:0500
if (_activePuzzleSolved) {
- this->jigsawSuccess();
+ jigsawSuccess();
}
- this->jigsawStoreState();
+ jigsawStoreState();
// JMP 0x14a6
// 132:14a6
}
void FoolGame::jigsawOnClick() {
// 132:0518
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- if ((this->var_i16_68a < 1) || ((this->var_i16_68a - (this->arr_i16_1eb8[0])) > 0) || (this->var_i16_68c < 1) || ((this->var_i16_68c - (this->arr_i16_1eb8[1])) > 0)) {
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ if ((var_i16_68a < 1) || ((var_i16_68a - (arr_i16_1eb8[0])) > 0) || (var_i16_68c < 1) || ((var_i16_68c - (arr_i16_1eb8[1])) > 0)) {
return;
}
// 132:059c
@@ -161,27 +161,27 @@ void FoolGame::jigsawOnClick() {
_toolbox->PenSize(3, 3);
_toolbox->PenMode(kPatXor);
// 132:05c4
- this->arr_i16_4758[0] = this->var_i16_68a;
- this->arr_i16_4758[1] = this->var_i16_68c;
+ arr_i16_4758[0] = var_i16_68a;
+ arr_i16_4758[1] = var_i16_68c;
// change select area while mouse button held down
- this->jigsawDragSelect();
+ jigsawDragSelect();
// leave an XOR outline on the page for the selected block
- Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
+ Common::Rect temp(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]);
_toolbox->FrameRect(temp);
- this->arr_i16_4758[0] -= this->var_i16_68a;
- this->arr_i16_4758[1] -= this->var_i16_68c;
+ arr_i16_4758[0] -= var_i16_68a;
+ arr_i16_4758[1] -= var_i16_68c;
// 132:0642
// move select area to new target
- this->jigsawMoveSelected();
+ jigsawMoveSelected();
// remove XOR outline
- temp = Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
+ temp = Common::Rect(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]);
_toolbox->FrameRect(temp);
- this->jigsawDropSelected();
- this->jigsawCheckIfSolved();
- this->waitForMouseUp();
+ jigsawDropSelected();
+ jigsawCheckIfSolved();
+ waitForMouseUp();
_zbasic->menu(8, 3, 1, Common::U32String());
_menuDisabled = false;
}
@@ -190,37 +190,37 @@ void FoolGame::jigsawDragSelect() {
// 132:067a
// change select area while mouse button held down
do {
- this->getNextEvent(4);
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
- if (this->var_i16_68a >= this->arr_i16_4758[0]) {
- this->arr_i16_4758[2] = this->arr_i16_4758[0];
- this->arr_i16_4758[3] = this->var_i16_68a;
+ getNextEvent(4);
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ sub_128_342(var_i16_68a, var_i16_68c);
+ if (var_i16_68a >= arr_i16_4758[0]) {
+ arr_i16_4758[2] = arr_i16_4758[0];
+ arr_i16_4758[3] = var_i16_68a;
} else {
// 132:06fc
- this->arr_i16_4758[2] = this->var_i16_68a;
- this->arr_i16_4758[3] = this->arr_i16_4758[0];
+ arr_i16_4758[2] = var_i16_68a;
+ arr_i16_4758[3] = arr_i16_4758[0];
}
// 132:072c
- if (this->var_i16_68c >= this->arr_i16_4758[1]) {
- this->arr_i16_4758[6] = this->arr_i16_4758[1];
- this->arr_i16_4758[7] = this->var_i16_68c;
+ if (var_i16_68c >= arr_i16_4758[1]) {
+ arr_i16_4758[6] = arr_i16_4758[1];
+ arr_i16_4758[7] = var_i16_68c;
} else {
- this->arr_i16_4758[6] = this->var_i16_68c;
- this->arr_i16_4758[7] = this->arr_i16_4758[1];
+ arr_i16_4758[6] = var_i16_68c;
+ arr_i16_4758[7] = arr_i16_4758[1];
}
// 132:07b0
- this->arr_i16_4758[11] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
+ arr_i16_4758[11] = _screenGrid[arr_i16_2f38[arr_i16_4758[2]*32 + arr_i16_4758[6]]].top;
// 132:080e
- this->arr_i16_4758[12] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
- this->arr_i16_4758[13] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
- this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
- Common::Rect temp(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]);
+ arr_i16_4758[12] = _screenGrid[arr_i16_2f38[arr_i16_4758[2]*32 + arr_i16_4758[6]]].left;
+ arr_i16_4758[13] = _screenGrid[arr_i16_2f38[arr_i16_4758[3]*32 + arr_i16_4758[7]]].bottom;
+ arr_i16_4758[14] = _screenGrid[arr_i16_2f38[arr_i16_4758[3]*32 + arr_i16_4758[7]]].right;
+ Common::Rect temp(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]);
// 132:092e
_toolbox->FrameRect(temp);
- this->delay(2);
+ delay(2);
_toolbox->FrameRect(temp);
- this->delay(1);
+ delay(1);
} while (_event.what != kMouseUp);
}
@@ -229,57 +229,57 @@ void FoolGame::jigsawMoveSelected() {
// move select area to new target
warning("call: %s", __func__);
do {
- this->getNextEvent(2);
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
- if (this->arr_i16_4758[0] >= 0) {
- this->arr_i16_4758[4] = this->var_i16_68a;
- this->arr_i16_4758[5] = this->var_i16_68a + this->arr_i16_4758[0];
+ getNextEvent(2);
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ sub_128_342(var_i16_68a, var_i16_68c);
+ if (arr_i16_4758[0] >= 0) {
+ arr_i16_4758[4] = var_i16_68a;
+ arr_i16_4758[5] = var_i16_68a + arr_i16_4758[0];
} else {
// 132:09e2
- this->arr_i16_4758[4] = this->var_i16_68a + this->arr_i16_4758[0];
- this->arr_i16_4758[5] = this->var_i16_68a;
+ arr_i16_4758[4] = var_i16_68a + arr_i16_4758[0];
+ arr_i16_4758[5] = var_i16_68a;
}
// 132:0a1e
- if (this->arr_i16_4758[1] >= 0) {
- this->arr_i16_4758[8] = this->var_i16_68c;
- this->arr_i16_4758[9] = this->var_i16_68c + this->arr_i16_4758[1];
+ if (arr_i16_4758[1] >= 0) {
+ arr_i16_4758[8] = var_i16_68c;
+ arr_i16_4758[9] = var_i16_68c + arr_i16_4758[1];
} else {
// 132:0a70
- this->arr_i16_4758[8] = this->var_i16_68c + this->arr_i16_4758[1];
- this->arr_i16_4758[9] = this->var_i16_68c;
+ arr_i16_4758[8] = var_i16_68c + arr_i16_4758[1];
+ arr_i16_4758[9] = var_i16_68c;
}
// 132:0aac
- if (this->arr_i16_4758[4] < 1) {
- this->arr_i16_4758[4] = 1;
- this->arr_i16_4758[5] = 1 + ABS(this->arr_i16_4758[0]);
+ if (arr_i16_4758[4] < 1) {
+ arr_i16_4758[4] = 1;
+ arr_i16_4758[5] = 1 + ABS(arr_i16_4758[0]);
}
// 132:0b10
- if (this->arr_i16_4758[8] < 1) {
- this->arr_i16_4758[8] = 1;
- this->arr_i16_4758[9] = 1 + ABS(this->arr_i16_4758[1]);
+ if (arr_i16_4758[8] < 1) {
+ arr_i16_4758[8] = 1;
+ arr_i16_4758[9] = 1 + ABS(arr_i16_4758[1]);
}
// 132:0b74
- if ((this->arr_i16_4758[5] - this->arr_i16_1eb8[0]) > 0) {
- this->arr_i16_4758[4] = this->arr_i16_1eb8[0] - ABS(this->arr_i16_4758[0]);
- this->arr_i16_4758[5] = this->arr_i16_1eb8[0];
+ if ((arr_i16_4758[5] - arr_i16_1eb8[0]) > 0) {
+ arr_i16_4758[4] = arr_i16_1eb8[0] - ABS(arr_i16_4758[0]);
+ arr_i16_4758[5] = arr_i16_1eb8[0];
}
// 132:0c02
- if ((this->arr_i16_4758[9] - this->arr_i16_1eb8[1]) > 0) {
- this->arr_i16_4758[8] = this->arr_i16_1eb8[1] - ABS(this->arr_i16_4758[1]);
- this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
+ if ((arr_i16_4758[9] - arr_i16_1eb8[1]) > 0) {
+ arr_i16_4758[8] = arr_i16_1eb8[1] - ABS(arr_i16_4758[1]);
+ arr_i16_4758[9] = arr_i16_1eb8[1];
}
// 132:0c90
- this->arr_rect_4776.top = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
- this->arr_rect_4776.left = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
+ arr_rect_4776.top = _screenGrid[arr_i16_2f38[arr_i16_4758[4]*32 + arr_i16_4758[8]]].top;
+ arr_rect_4776.left = _screenGrid[arr_i16_2f38[arr_i16_4758[4]*32 + arr_i16_4758[8]]].left;
// 132:0d4e
- this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
- this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
+ arr_rect_4776.bottom = _screenGrid[arr_i16_2f38[arr_i16_4758[5]*32 + arr_i16_4758[9]]].bottom;
+ arr_rect_4776.right = _screenGrid[arr_i16_2f38[arr_i16_4758[5]*32 + arr_i16_4758[9]]].right;
// 132:0e0e
- _toolbox->FrameRect(this->arr_rect_4776);
- this->delay(2);
- _toolbox->FrameRect(this->arr_rect_4776);
- this->delay(1);
+ _toolbox->FrameRect(arr_rect_4776);
+ delay(2);
+ _toolbox->FrameRect(arr_rect_4776);
+ delay(1);
}
while (!((_event.what == kMouseDown) && (_event.where.y > 0x14)));
}
@@ -287,17 +287,17 @@ void FoolGame::jigsawMoveSelected() {
void FoolGame::jigsawCancelSelect() {
// 132:0e5a
_stateFlags = kStateNull;
- _zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
- _zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
- _zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
- _zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
+ _zbasic->swapInt(arr_i16_4758[2], arr_i16_4758[4]);
+ _zbasic->swapInt(arr_i16_4758[3], arr_i16_4758[5]);
+ _zbasic->swapInt(arr_i16_4758[6], arr_i16_4758[8]);
+ _zbasic->swapInt(arr_i16_4758[7], arr_i16_4758[9]);
jigsawDropSelected();
}
void FoolGame::jigsawDropSelected() {
// 132:0ed8
// skip the tile pointer to past the end of the list
- this->var_i16_1aa4 = this->_jigsawPieceCount;
+ var_i16_1aa4 = _jigsawPieceCount;
// arr_i16_4758[2]: src_left
// arr_i16_4758[3]: src_right
@@ -309,64 +309,64 @@ void FoolGame::jigsawDropSelected() {
// arr_i16_4758[9]: dest_bottom
// iterate through src tile positions
- for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
- for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
- this->var_i16_1aa4++;
+ for (int j = arr_i16_4758[6]; j <= arr_i16_4758[7]; j++) {
+ for (int i = arr_i16_4758[2]; i <= arr_i16_4758[3]; i++) {
+ var_i16_1aa4++;
// buffer 1: make a copy of source tile positions
- this->arr_i16_3738[this->var_i16_1aa4] = this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]];
- debug(8, "(%d, %d) [src]: %d -> buffer 1", i, j, this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]);
+ arr_i16_3738[var_i16_1aa4] = arr_i16_3738[arr_i16_2f38[i*32 + j]];
+ debug(8, "(%d, %d) [src]: %d -> buffer 1", i, j, arr_i16_3738[arr_i16_2f38[i*32 + j]]);
// 132:0f54
// buffer 0: zero out source tiles
- this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] = 0;
+ arr_i16_3738[arr_i16_2f38[i*32 + j]] = 0;
}
}
// 132:0fbc
// tile pointer to buffer 2
- this->var_i16_1aa6 = this->var_i16_1aa4;
- this->var_i16_1aa4 = this->_jigsawPieceCount;
+ var_i16_1aa6 = var_i16_1aa4;
+ var_i16_1aa4 = _jigsawPieceCount;
// 132:0fc8
// iterate through dest tile positions
- for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
- for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
- this->var_i16_1aa4++;
+ for (int j = arr_i16_4758[8]; j <= arr_i16_4758[9]; j++) {
+ for (int i = arr_i16_4758[4]; i <= arr_i16_4758[5]; i++) {
+ var_i16_1aa4++;
// if the dest tile isn't part of the src tile set, copy to buffer 2
- if (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] > 0) {
- this->var_i16_1aa6++;
- debug(8, "(%d, %d) [dest]: %d -> buffer 2", i, j, this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]);
- this->arr_i16_3738[this->var_i16_1aa6] = this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]];
+ if (arr_i16_3738[arr_i16_2f38[i*32 + j]] > 0) {
+ var_i16_1aa6++;
+ debug(8, "(%d, %d) [dest]: %d -> buffer 2", i, j, arr_i16_3738[arr_i16_2f38[i*32 + j]]);
+ arr_i16_3738[var_i16_1aa6] = arr_i16_3738[arr_i16_2f38[i*32 + j]];
}
// 132:1076
// write src tile from buffer 1 to dest position
- this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
- debug(8, "(%d, %d) [dest]: %d <- buffer 1", i, j, this->arr_i16_3738[this->var_i16_1aa4]);
+ arr_i16_3738[arr_i16_2f38[i*32 + j]] = arr_i16_3738[var_i16_1aa4];
+ debug(8, "(%d, %d) [dest]: %d <- buffer 1", i, j, arr_i16_3738[var_i16_1aa4]);
// 132:10ba
- // 0x2af8, this->var_i16_1aa0 * (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] - 1)
+ // 0x2af8, var_i16_1aa0 * (arr_i16_3738[arr_i16_2f38[i*32 + j]] - 1)
// blit tiles to screen
_zbasic->put(
- _screenGrid[this->arr_i16_2f38[i*32 + j]].left,
- _screenGrid[this->arr_i16_2f38[i*32 + j]].top,
- _jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
+ _screenGrid[arr_i16_2f38[i*32 + j]].left,
+ _screenGrid[arr_i16_2f38[i*32 + j]].top,
+ _jigsawPieces[arr_i16_3738[arr_i16_2f38[i*32 + j]]],
kSrcCopy
);
}
}
// 132:11c8
// tile pointer to buffer 2
- this->var_i16_1aa6 = this->var_i16_1aa4;
+ var_i16_1aa6 = var_i16_1aa4;
// iterate through source tile positions
- for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
- for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
+ for (int j = arr_i16_4758[6]; j <= arr_i16_4758[7]; j++) {
+ for (int i = arr_i16_4758[2]; i <= arr_i16_4758[3]; i++) {
// if the source tile has been zeroed out, fill it with tile from buffer 2
- if (this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]] == 0) {
- this->var_i16_1aa6++;
- debug(8, "(%d, %d) [src]: %d <- buffer 2", i, j, this->arr_i16_3738[this->var_i16_1aa6]);
- this->arr_i16_3738[this->arr_i16_2f38[i*32+j]] = this->arr_i16_3738[this->var_i16_1aa6];
+ if (arr_i16_3738[arr_i16_2f38[i*32 + j]] == 0) {
+ var_i16_1aa6++;
+ debug(8, "(%d, %d) [src]: %d <- buffer 2", i, j, arr_i16_3738[var_i16_1aa6]);
+ arr_i16_3738[arr_i16_2f38[i*32+j]] = arr_i16_3738[var_i16_1aa6];
_zbasic->put(
- _screenGrid[this->arr_i16_2f38[i*32+j]].left,
- _screenGrid[this->arr_i16_2f38[i*32+j]].top,
- _jigsawPieces[this->arr_i16_3738[this->arr_i16_2f38[i*32 + j]]],
+ _screenGrid[arr_i16_2f38[i*32+j]].left,
+ _screenGrid[arr_i16_2f38[i*32+j]].top,
+ _jigsawPieces[arr_i16_3738[arr_i16_2f38[i*32 + j]]],
kSrcCopy
);
}
@@ -379,8 +379,8 @@ void FoolGame::jigsawStoreState() {
// convert jigsaw positions to string
// 132:1384
_activePuzzleBuffer.clear(); // was: str(OFF(1))
- for (int i = 1; i <= this->_jigsawPieceCount; i++) {
- _activePuzzleBuffer += _zbasic->encodeInt(this->arr_i16_3738[i]);
+ for (int i = 1; i <= _jigsawPieceCount; i++) {
+ _activePuzzleBuffer += _zbasic->encodeInt(arr_i16_3738[i]);
}
}
@@ -389,10 +389,10 @@ void FoolGame::jigsawCheckIfSolved() {
// check if puzzle is solved
// 132:13ea
_activePuzzleSolved = true;
- for (int i = 1; i <= this->_jigsawPieceCount; i++) {
- if (this->arr_i16_3738[i] != i) {
+ for (int i = 1; i <= _jigsawPieceCount; i++) {
+ if (arr_i16_3738[i] != i) {
_activePuzzleSolved = false;
- i = this->_jigsawPieceCount;
+ i = _jigsawPieceCount;
}
// 132:1420
}
@@ -407,15 +407,15 @@ void FoolGame::jigsawSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
for (int j = 0; j <= 1; j++) {
- for (int i = 1; i <= this->_jigsawPieceCount; i++) {
+ for (int i = 1; i <= _jigsawPieceCount; i++) {
_toolbox->InvertRect(_screenGrid[i]);
- this->delay(1);
+ delay(1);
}
}
}
// 132:149c
- this->menuClickMessage();
- this->waitForClick();
+ menuClickMessage();
+ waitForClick();
}
};
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 1691ef90954..a6f90852dc5 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -33,12 +33,12 @@ namespace Fool {
void FoolGame::jumbleRun() {
// 130:0004
_activePuzzleSolved = false;
- this->fetchPuzzleData();
+ fetchPuzzleData();
_jumbleSubPuzzleCount = puzzlesReadShort();
debugC(5, kDebugLoading, "FoolGame::jumbleRun: racking %d subpuzzles", _jumbleSubPuzzleCount);
for (_jumbleCurrentSubPuzzle = 1; _jumbleCurrentSubPuzzle <= _jumbleSubPuzzleCount; _jumbleCurrentSubPuzzle++) {
- this->var_i16_105a = puzzlesReadShort();
+ var_i16_105a = puzzlesReadShort();
debugC(5, kDebugLoading, "FoolGame::jumbleRun: subpuzzle %d", _jumbleCurrentSubPuzzle);
// load grid information block
// 0x0: grid width (squares)
@@ -55,77 +55,77 @@ void FoolGame::jumbleRun() {
// 0xb: grid right bound (px)
// 0xc: grid square inner height (px)
// 0xd: grid square inner width (px)
- if ((this->var_i16_105a & 0x1) == 1) {
+ if ((var_i16_105a & 0x1) == 1) {
for (int i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = puzzlesReadShort();
+ arr_i16_1eb8[i] = puzzlesReadShort();
}
}
// 130:0066
- this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[8];
+ var_i16_484 = 0;
+ var_i16_68c = arr_i16_1eb8[8];
do {
- this->var_i16_68a = this->arr_i16_1eb8[10];
+ var_i16_68a = arr_i16_1eb8[10];
do {
- this->var_i16_484++;
+ var_i16_484++;
_toolbox->SetRect(
- _screenGrid[this->var_i16_484],
- this->var_i16_68a,
- this->var_i16_68c,
- this->var_i16_68a + this->arr_i16_1eb8[13],
- this->var_i16_68c + this->arr_i16_1eb8[12]
+ _screenGrid[var_i16_484],
+ var_i16_68a,
+ var_i16_68c,
+ var_i16_68a + arr_i16_1eb8[13],
+ var_i16_68c + arr_i16_1eb8[12]
);
// 130:00f6
- } while (_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[11], this->arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
// 130:0126
- } while (_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
// 130:0156
- if ((this->var_i16_105a & 0x2) == 2) {
- this->var_i16_105c = puzzlesReadShort();
- this->var_i16_105e = puzzlesReadShort();
- this->var_i16_1060 = puzzlesReadShort();
+ if ((var_i16_105a & 0x2) == 2) {
+ var_i16_105c = puzzlesReadShort();
+ var_i16_105e = puzzlesReadShort();
+ var_i16_1060 = puzzlesReadShort();
int16 picX = puzzlesReadShort();
int16 picY = puzzlesReadShort();
int16 picID = puzzlesReadShort();
if (picID > 0) {
- this->arr_i32_192c0[0] = _toolbox->GetPicture(picID);
- _zbasic->picture(picX, picY, this->arr_i32_192c0[0]);
- _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
+ arr_i32_192c0[0] = _toolbox->GetPicture(picID);
+ _zbasic->picture(picX, picY, arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(arr_i32_192c0[0]);
}
}
// 130:01f0
_jumbleGameType = puzzlesReadShort();
if (_jumbleGameType == 6) {
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_2f38[i*32 + j] = puzzlesReadByte();
- this->arr_i16_3b38[i*32 + j] = 0;
+ for (int j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= arr_i16_1eb8[0]; i++) {
+ arr_i16_2f38[i*32 + j] = puzzlesReadByte();
+ arr_i16_3b38[i*32 + j] = 0;
}
}
} else {
// 130:028a
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_2f38[i*32 + j] = 0;
- this->arr_i16_3b38[i*32 + j] = 0;
+ for (int j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= arr_i16_1eb8[0]; i++) {
+ arr_i16_2f38[i*32 + j] = 0;
+ arr_i16_3b38[i*32 + j] = 0;
}
}
}
// 130:0306
- this->var_i16_103a = puzzlesReadShort();
- if (this->var_i16_103a > 0) {
+ var_i16_103a = puzzlesReadShort();
+ if (var_i16_103a > 0) {
_toolbox->PenNormal();
- _toolbox->PenPat(_patterns[this->var_i16_1060]);
- this->var_i16_484 = 0;
- for (int j = 1; j <= this->var_i16_103a; j++) {
- this->var_i16_106a = puzzlesReadShort();
- if (this->var_i16_106a == 0) {
- this->var_i16_484 += 0x10;
+ _toolbox->PenPat(_patterns[var_i16_1060]);
+ var_i16_484 = 0;
+ for (int j = 1; j <= var_i16_103a; j++) {
+ var_i16_106a = puzzlesReadShort();
+ if (var_i16_106a == 0) {
+ var_i16_484 += 0x10;
} else {
// 130:035a
for (int i = 0; i <= 0xf; i++) {
- this->var_i16_484++;
- if (this->var_i16_106a & _bitLUT[i]) {
- _toolbox->PaintRect(_screenGrid[this->var_i16_484]);
+ var_i16_484++;
+ if (var_i16_106a & _bitLUT[i]) {
+ _toolbox->PaintRect(_screenGrid[var_i16_484]);
}
}
// 130:039e
@@ -135,87 +135,87 @@ void FoolGame::jumbleRun() {
}
}
// 130:03ba
- if (this->var_i16_105e == 2) {
- this->var_i16_106c = kSrcBic;
+ if (var_i16_105e == 2) {
+ var_i16_106c = kSrcBic;
} else {
- this->var_i16_106c = kSrcOr;
+ var_i16_106c = kSrcOr;
}
// 130:03d4
if (_jumbleGameType == 4) {
- this->fillRect(0x63, 0xae, 0x108, 0x153, 2);
+ fillRect(0x63, 0xae, 0x108, 0x153, 2);
}
// 130:03fe
//if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle)
- this->_jumblePosition = 0;
- this->var_str_1070.clear(); // was: str(168)
- this->var_str_1170.clear(); // was: str(169)
- this->var_i16_1270 = puzzlesReadShort();
- for (this->var_i16_103a = 1; this->var_i16_103a <= this->var_i16_1270; this->var_i16_103a++) {
+ _jumblePosition = 0;
+ var_str_1070.clear(); // was: str(168)
+ var_str_1170.clear(); // was: str(169)
+ var_i16_1270 = puzzlesReadShort();
+ for (var_i16_103a = 1; var_i16_103a <= var_i16_1270; var_i16_103a++) {
Common::U32String data = puzzlesReadString().decode(Common::kMacRoman);
- this->var_i16_1372 = data.size();
- this->var_str_1170 += data;
+ var_i16_1372 = data.size();
+ var_str_1170 += data;
// 130:047e
if (_activePuzzleStatus > _jumbleCurrentSubPuzzle) {
- this->var_str_1070 += data;
+ var_str_1070 += data;
} else {
// 130:04ac
if ((_activePuzzleStatus == _jumbleCurrentSubPuzzle) && !_activePuzzleBuffer.empty()) { // was: str(170)
// 130:04dc
- this->var_str_1070 = _activePuzzleBuffer;
+ var_str_1070 = _activePuzzleBuffer;
} else {
// 130:04f0
if ((_jumbleGameType == 1) || (_jumbleGameType == 5)) {
// 130:0514
- this->var_str_384 = data;
- this->sub_130_25d8();
+ var_str_384 = data;
+ sub_130_25d8();
}
// 130:0528
if (_jumbleGameType == 2) {
- this->var_str_384 = data;
- this->sub_130_2790();
+ var_str_384 = data;
+ sub_130_2790();
}
// 130:0548
if ((_jumbleGameType == 3) || (_jumbleGameType == 6)) {
- this->var_str_9f4 = _zbasic->space(this->var_i16_1372);
+ var_str_9f4 = _zbasic->space(var_i16_1372);
}
// 130:0580
// word square
if (_jumbleGameType == 4) {
- this->var_str_384 = _zbasic->leftStr(data, 4);
- this->sub_130_25d8();
- this->var_str_1374 = this->var_str_9f4;
- this->var_str_384 = _zbasic->rightStr(data, 4);
- this->sub_130_25d8();
- this->var_str_1474 = this->var_str_9f4;
- this->var_str_9f4 = this->var_str_1374 + _zbasic->midStr(data, 5, 1) + this->var_str_1474;
+ var_str_384 = _zbasic->leftStr(data, 4);
+ sub_130_25d8();
+ var_str_1374 = var_str_9f4;
+ var_str_384 = _zbasic->rightStr(data, 4);
+ sub_130_25d8();
+ var_str_1474 = var_str_9f4;
+ var_str_9f4 = var_str_1374 + _zbasic->midStr(data, 5, 1) + var_str_1474;
}
// 130:0610
- this->var_str_1070 += this->var_str_9f4;
+ var_str_1070 += var_str_9f4;
}
}
// 130:0628
- for (this->var_i16_484 = 1; this->var_i16_484 <= this->var_i16_1372; this->var_i16_484++) {
- this->_jumblePosition++;
- this->arr_i16_3738[this->_jumblePosition] = puzzlesReadShort();
- this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
- this->sub_130_20fe();
- this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] = this->var_i16_103a;
- this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] = this->_jumblePosition;
- this->sub_130_1c6c();
- this->var_str_d12 = _zbasic->midStr(this->var_str_1070, this->_jumblePosition, 1);
+ for (var_i16_484 = 1; var_i16_484 <= var_i16_1372; var_i16_484++) {
+ _jumblePosition++;
+ arr_i16_3738[_jumblePosition] = puzzlesReadShort();
+ _jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
+ sub_130_20fe();
+ arr_i16_2f38[var_i16_68a*32 + var_i16_68c] = var_i16_103a;
+ arr_i16_3b38[var_i16_68a*32 + var_i16_68c] = _jumblePosition;
+ sub_130_1c6c();
+ var_str_d12 = _zbasic->midStr(var_str_1070, _jumblePosition, 1);
// 130:06d4
if ((_activePuzzle <= 0x50) || (_activePuzzle == 0x55)) {
- this->jumbleDrawLetter();
+ jumbleDrawLetter();
} else {
// 130:0700
- this->sub_130_1e76();
+ sub_130_1e76();
}
}
// 130:0716
- _zbasic->indexRawSet(puzzlesReadString(), 1, this->var_i16_103a);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, var_i16_103a);
}
// 130:073e
- this->var_i16_1576 = this->var_str_1170.size();
+ var_i16_1576 = var_str_1170.size();
if ((_activePuzzle == 0x51) || (_activePuzzle == 0x54)) {
// 130:076e
_toolbox->PenNormal();
@@ -239,31 +239,31 @@ void FoolGame::jumbleRun() {
_toolbox->PenNormal();
}
// 130:07f2
- this->var_i16_103a = puzzlesReadShort();
- if (this->var_i16_103a > 0) {
- for (this->var_i16_68a = 1; this->var_i16_68a <= this->var_i16_103a; this->var_i16_68a++) {
- this->var_i16_484 = puzzlesReadShort();
- this->var_i16_7e4 = puzzlesReadShort();
- this->var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
+ var_i16_103a = puzzlesReadShort();
+ if (var_i16_103a > 0) {
+ for (var_i16_68a = 1; var_i16_68a <= var_i16_103a; var_i16_68a++) {
+ var_i16_484 = puzzlesReadShort();
+ var_i16_7e4 = puzzlesReadShort();
+ var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
_zbasic->text(kFontFool, 0xc, 0, kSrcOr);
- if (this->var_i16_7e4 > 0) {
- _toolbox->MoveTo(this->var_i16_484, this->var_i16_7e4);
- _toolbox->DrawString(this->var_str_1578);
+ if (var_i16_7e4 > 0) {
+ _toolbox->MoveTo(var_i16_484, var_i16_7e4);
+ _toolbox->DrawString(var_str_1578);
} else {
- this->sub_130_2226();
+ sub_130_2226();
}
}
}
// 130:086a
- this->var_i16_1678 = 0;
- this->var_str_1578.clear(); // was: str(171);
+ var_i16_1678 = 0;
+ var_str_1578.clear(); // was: str(171);
if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
// all puzzles done, load the success animation list
- this->arr_i16_4338[0] = puzzlesReadShort();
- if (this->arr_i16_4338[0] > 0) {
+ arr_i16_4338[0] = puzzlesReadShort();
+ if (arr_i16_4338[0] > 0) {
// 130:08be
- for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
- this->arr_i16_4338[i] = puzzlesReadShort();
+ for (int i = 1; i <= arr_i16_4338[0]; i++) {
+ arr_i16_4338[i] = puzzlesReadShort();
}
}
}
@@ -271,13 +271,13 @@ void FoolGame::jumbleRun() {
if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle) {
switch (_jumbleGameType-1) {
case 0:
- this->sub_130_d2e();
+ sub_130_d2e();
break;
case 1:
- this->jumbleRunSubstitution();
+ jumbleRunSubstitution();
break;
case 2:
- this->sub_130_1004();
+ sub_130_1004();
break;
case 3:
case 4: // word square
@@ -290,24 +290,24 @@ void FoolGame::jumbleRun() {
break;
}
if ((_stateFlags & kStateReturn) != 0) {
- this->jumbleStoreState();
+ jumbleStoreState();
_jumbleCurrentSubPuzzle = _jumbleSubPuzzleCount;
} else {
// 130:0956
if (_activePuzzle <= 0x50) {
- if ((this->var_i16_1678 > 0) && (!this->var_str_1578.empty())) { // was: str(172)
+ if ((var_i16_1678 > 0) && (!var_str_1578.empty())) { // was: str(172)
// 130:098c
- this->var_str_1578.clear(); // was: str(173)
- this->sub_130_2226();
+ var_str_1578.clear(); // was: str(173)
+ sub_130_2226();
}
// 130:09a4
for (int i = 1; i <= 3; i++) {
- this->playTone(_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
+ playTone(_zbasic->rndInt(0x1f4) + 0x19, 0x42, 0);
}
for (int j = 0; j <= 1; j++) {
- for (int i = 1; i <= this->var_i16_1576; i++) {
- _toolbox->Delay((0xc - (this->var_i16_1576 / 0xa))*60/1000);
- _toolbox->InvertRect(_screenGrid[ABS(this->arr_i16_3738[i])]);
+ for (int i = 1; i <= var_i16_1576; i++) {
+ _toolbox->Delay((0xc - (var_i16_1576 / 0xa))*60/1000);
+ _toolbox->InvertRect(_screenGrid[ABS(arr_i16_3738[i])]);
}
}
if (_jumbleCurrentSubPuzzle == _jumbleSubPuzzleCount) {
@@ -324,71 +324,71 @@ void FoolGame::jumbleRun() {
}
// if we're here, the puzzle is solved
_toolbox->PenNormal();
- this->menuClickMessage();
- this->waitForMouseUp();
- this->sub_128_61ec();
+ menuClickMessage();
+ waitForMouseUp();
+ sub_128_61ec();
// 130:0a90
if (_activePuzzle != 0x55) {
// 130:0b68
while ((_event.modifiers & kModMouseButtonUp) != 0) {
// 130:0aa0
- if (this->arr_i16_4338[0] > 0) {
+ if (arr_i16_4338[0] > 0) {
// strobe the squares in the victory list
- if (this->arr_i16_4338[0] == 1) {
+ if (arr_i16_4338[0] == 1) {
// originally was 0x64, lock to 200ms
- this->var_i16_7e4 = 0xc8;
+ var_i16_7e4 = 0xc8;
} else {
// originally was 0xd, lock to 2 frames
- this->var_i16_7e4 = 0x22;
+ var_i16_7e4 = 0x22;
}
- this->var_i16_68a = 0;
+ var_i16_68a = 0;
do {
int ticks = (int)_toolbox->TickCount();
- this->var_i16_68a++;
- _toolbox->InvertRect(_screenGrid[this->arr_i16_4338[this->var_i16_68a]]);
+ var_i16_68a++;
+ _toolbox->InvertRect(_screenGrid[arr_i16_4338[var_i16_68a]]);
// mask was originally 0
- this->getNextEvent(-1);
- int delta = MAX(0, this->var_i16_7e4*60/1000 - ((int)_toolbox->TickCount() - ticks));
+ getNextEvent(-1);
+ int delta = MAX(0, var_i16_7e4*60/1000 - ((int)_toolbox->TickCount() - ticks));
_toolbox->Delay(delta);
- } while (!((this->var_i16_68a == this->arr_i16_4338[0]) || ((_event.modifiers & kModMouseButtonUp) == 0)));
+ } while (!((var_i16_68a == arr_i16_4338[0]) || ((_event.modifiers & kModMouseButtonUp) == 0)));
} else {
// 130:0b62
// mask was originally 0
- this->getNextEvent(-1);
+ getNextEvent(-1);
}
}
// 130:0b7a
} else {
// 130:0b7e
- this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
+ fillRect(0x131, 0, 0x156, 0x10e, 0x47);
_activePuzzleSolved = false;
- this->var_i16_bfc = 0;
+ var_i16_bfc = 0;
do {
- for (int i = 1; i <= this->arr_i16_4338[0]; i++) {
+ for (int i = 1; i <= arr_i16_4338[0]; i++) {
_toolbox->Delay(0xd*60/1000);
- _toolbox->InvertRect(_screenGrid[this->arr_i16_4338[i]]);
- this->getNextEvent(0);
+ _toolbox->InvertRect(_screenGrid[arr_i16_4338[i]]);
+ getNextEvent(0);
if ((_event.modifiers & kModMouseButtonUp) == 0) {
_activePuzzleSolved = true;
}
}
// 130:0c14
- if (this->var_i16_bfc == 0) {
- this->var_i16_bfc = 1;
+ if (var_i16_bfc == 0) {
+ var_i16_bfc = 1;
} else {
- this->var_i16_bfc = 0;
+ var_i16_bfc = 0;
}
- } while (!((_activePuzzleSolved) && (this->var_i16_bfc == 1)));
+ } while (!((_activePuzzleSolved) && (var_i16_bfc == 1)));
}
// 130:0c4e
- this->jumbleStoreState();
+ jumbleStoreState();
}
void FoolGame::sub_130_c56() {
warning(__func__);
// 130:0c56
- this->jumbleStoreState();
- this->saveGame();
+ jumbleStoreState();
+ saveGame();
_stateFlags = kStateNull;
}
@@ -402,11 +402,11 @@ void FoolGame::jumbleStoreState() {
// 130:0c98
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = _jumbleCurrentSubPuzzle;
- if ((_jumbleGameType == 2) && (!this->var_str_1578.empty())) { // was: str(175)
- _activePuzzleBuffer = this->var_str_1070 + _zbasic->leftStr(this->var_str_1578, this->var_i16_167a-2);
+ if ((_jumbleGameType == 2) && (!var_str_1578.empty())) { // was: str(175)
+ _activePuzzleBuffer = var_str_1070 + _zbasic->leftStr(var_str_1578, var_i16_167a-2);
} else {
// 130:0cfe
- _activePuzzleBuffer = this->var_str_1070;
+ _activePuzzleBuffer = var_str_1070;
}
// 130:0d0e
} else {
@@ -422,16 +422,16 @@ void FoolGame::jumbleStoreState() {
void FoolGame::sub_130_d2e() {
warning(__func__);
// 130:0d2e
- this->sub_130_1426();
- this->sub_128_61ec();
+ sub_130_1426();
+ sub_128_61ec();
_stateFlags = kStateNull;
- while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
- this->getNextEvent(-1);
+ while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170)) {
+ getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->jumbleOnClick();
+ jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- this->sub_130_c56();
+ sub_130_c56();
}
}
}
@@ -441,114 +441,114 @@ void FoolGame::jumbleRunSubstitution() {
// 130:0d90
// substitution cipher
if (!_zbasic->index(1, 1).empty()) { // was: str(177)
- if (this->var_str_1070.size() == this->var_str_1170.size()) {
- this->var_i16_1372 = _zbasic->index(1, 1).size();
- this->var_str_1578 = _zbasic->space(this->var_i16_1372);
- for (int i = 1; i<= this->var_i16_1372; i++) {
- this->var_str_167c = _zbasic->midStr(_zbasic->index(1, 1), i, 1);
- this->var_i16_7e4 = _zbasic->asc(_zbasic->ucase(this->var_str_167c)) - 0x40;
- if ((this->var_i16_7e4 >= 1) && (this->var_i16_7e4 <= 0x1a)) {
- this->var_str_d12 = _zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4] + 0x40);
+ if (var_str_1070.size() == var_str_1170.size()) {
+ var_i16_1372 = _zbasic->index(1, 1).size();
+ var_str_1578 = _zbasic->space(var_i16_1372);
+ for (int i = 1; i<= var_i16_1372; i++) {
+ var_str_167c = _zbasic->midStr(_zbasic->index(1, 1), i, 1);
+ var_i16_7e4 = _zbasic->asc(_zbasic->ucase(var_str_167c)) - 0x40;
+ if ((var_i16_7e4 >= 1) && (var_i16_7e4 <= 0x1a)) {
+ var_str_d12 = _zbasic->chr(arr_i16_5cbc[var_i16_7e4] + 0x40);
} else {
// 130:0e88
- this->var_str_d12 = this->var_str_167c;
+ var_str_d12 = var_str_167c;
}
// 130:0e98
- _zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
+ _zbasic->midStrSet(var_str_1578, i, 1, var_str_d12);
}
} else {
// 130:0ece
- this->var_i16_484 = this->var_str_1070.size();
- this->var_i16_7e4 = this->var_str_1170.size();
- this->var_str_1578 = _zbasic->rightStr(this->var_str_1070, this->var_i16_484 - this->var_i16_7e4);
- this->var_str_1070 = _zbasic->leftStr(this->var_str_1070, this->var_i16_7e4);
+ var_i16_484 = var_str_1070.size();
+ var_i16_7e4 = var_str_1170.size();
+ var_str_1578 = _zbasic->rightStr(var_str_1070, var_i16_484 - var_i16_7e4);
+ var_str_1070 = _zbasic->leftStr(var_str_1070, var_i16_7e4);
}
// 130:0f24
- this->var_str_1578 += Common::U32String(" = ") + _zbasic->index(1, 1); // ABC = XYZ
- this->var_i16_167a = _zbasic->instr(1, this->var_str_1578, Common::U32String("=")); // was: str(179)
- this->sub_130_2226();
+ var_str_1578 += Common::U32String(" = ") + _zbasic->index(1, 1); // ABC = XYZ
+ var_i16_167a = _zbasic->instr(1, var_str_1578, Common::U32String("=")); // was: str(179)
+ sub_130_2226();
} else {
// 130:0f72
- this->var_str_1578.clear(); // was: str(180);
+ var_str_1578.clear(); // was: str(180);
}
// 130:0f86
- this->_jumblePosition = 1;
- this->sub_130_1c1a();
- this->sub_128_61ec();
+ _jumblePosition = 1;
+ sub_130_1c1a();
+ sub_128_61ec();
_stateFlags = kStateNull;
_keyLastPressed = 0;
// 130:0fa0
- while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170)) {
// 130:0fa4
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_keyLastPressed != 0) {
- this->jumbleOnKey();
+ jumbleOnKey();
}
if (_event.what == kMouseDown) {
- this->jumbleOnClick();
+ jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- this->sub_130_c56();
+ sub_130_c56();
}
}
// 130:0ffe
- this->jumbleSelectSquare();
+ jumbleSelectSquare();
}
void FoolGame::sub_130_1004() {
warning(__func__);
// 130:1004
- this->_jumblePosition = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(181)
- if (this->_jumblePosition == 0) {
- this->_jumblePosition = 1;
+ _jumblePosition = _zbasic->instr(1, var_str_1070, Common::U32String(" ")); // was: str(181)
+ if (_jumblePosition == 0) {
+ _jumblePosition = 1;
}
- this->sub_130_20d2();
- this->sub_128_61ec();
+ sub_130_20d2();
+ sub_128_61ec();
_stateFlags = kStateNull;
_keyLastPressed = 0;
// 130:1042
- while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
- this->getNextEvent(-1);
+ while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170)) {
+ getNextEvent(-1);
if (_keyLastPressed != 0) {
- this->jumbleOnKey();
+ jumbleOnKey();
}
if (_event.what == kMouseDown) {
- this->jumbleOnClick();
+ jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- this->sub_130_c56();
+ sub_130_c56();
}
}
- this->jumbleSelectSquare();
+ jumbleSelectSquare();
}
void FoolGame::jumbleRunWordSquare() {
warning(__func__);
// 130:10a6
// word square
- this->sub_130_1426();
+ sub_130_1426();
if (_jumbleGameType != 5) {
- this->var_str_177c = _zbasic->midStr(this->var_str_1170, 1, 1) + _zbasic->midStr(this->var_str_1170, 4, 1) + _zbasic->midStr(this->var_str_1170, 7, 1);
- this->var_str_177c += _zbasic->midStr(this->var_str_1170, 2, 1) + _zbasic->midStr(this->var_str_1170, 5, 1) + _zbasic->midStr(this->var_str_1170, 8, 1);
- this->var_str_177c += _zbasic->midStr(this->var_str_1170, 3, 1) + _zbasic->midStr(this->var_str_1170, 6, 1) + _zbasic->midStr(this->var_str_1170, 9, 1);
+ var_str_177c = _zbasic->midStr(var_str_1170, 1, 1) + _zbasic->midStr(var_str_1170, 4, 1) + _zbasic->midStr(var_str_1170, 7, 1);
+ var_str_177c += _zbasic->midStr(var_str_1170, 2, 1) + _zbasic->midStr(var_str_1170, 5, 1) + _zbasic->midStr(var_str_1170, 8, 1);
+ var_str_177c += _zbasic->midStr(var_str_1170, 3, 1) + _zbasic->midStr(var_str_1170, 6, 1) + _zbasic->midStr(var_str_1170, 9, 1);
} else {
// 130:1196
- this->var_str_177c = _zbasic->midStr(this->var_str_1170, 3, 2) + _zbasic->midStr(this->var_str_1170, 1, 2) + _zbasic->midStr(this->var_str_1170, 5, 1);
- this->var_str_177c += _zbasic->midStr(this->var_str_1170, 8, 2) + _zbasic->midStr(this->var_str_1170, 6, 2);
+ var_str_177c = _zbasic->midStr(var_str_1170, 3, 2) + _zbasic->midStr(var_str_1170, 1, 2) + _zbasic->midStr(var_str_1170, 5, 1);
+ var_str_177c += _zbasic->midStr(var_str_1170, 8, 2) + _zbasic->midStr(var_str_1170, 6, 2);
}
// 130:1212
- this->sub_128_61ec();
+ sub_128_61ec();
_stateFlags = kStateNull;
// 130:121c
- while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170) && (this->var_str_1070 != this->var_str_177c)) {
- this->getNextEvent(-1);
+ while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170) && (var_str_1070 != var_str_177c)) {
+ getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->jumbleOnClick();
+ jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- this->sub_130_c56();
+ sub_130_c56();
}
}
}
@@ -557,61 +557,61 @@ void FoolGame::jumbleRunHiddenMessage() {
warning(__func__);
// 130:1282
// hidden message, change the mouse cursor
- this->_jumblePosition = _zbasic->instr(1, this->var_str_1070, Common::U32String(" ")); // was: str(182)
- if (this->_jumblePosition == 0) {
- this->_jumblePosition = 1;
+ _jumblePosition = _zbasic->instr(1, var_str_1070, Common::U32String(" ")); // was: str(182)
+ if (_jumblePosition == 0) {
+ _jumblePosition = 1;
}
- this->sub_130_20d2();
- this->sub_128_61ec();
- this->var_i16_7b2 = 0;
+ sub_130_20d2();
+ sub_128_61ec();
+ var_i16_7b2 = 0;
_stateFlags = kStateNull;
_keyLastPressed = 0;
_toolbox->InitCursor();
- while (((_stateFlags & kStateReturn) == 0) && (this->var_str_1070 != this->var_str_1170)) {
+ while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170)) {
// 130:12cc
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_keyLastPressed != 0) {
- this->jumbleOnKey();
+ jumbleOnKey();
}
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
+ getGridFromMouse(var_i16_68a, var_i16_68c);
if (_event.what == kMouseDown) {
- this->jumbleOnClick();
+ jumbleOnClick();
}
- if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
- this->var_i16_187c = 0;
+ if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
+ var_i16_187c = 0;
} else {
- this->var_i16_187c = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
+ var_i16_187c = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
}
// 130:139e
- if (this->var_i16_187c != this->var_i16_7b2) {
- if (this->var_i16_187c < 0x11) {
+ if (var_i16_187c != var_i16_7b2) {
+ if (var_i16_187c < 0x11) {
_toolbox->InitCursor();
} else {
- _toolbox->SetCursor(_cursors[this->var_i16_187c]);
+ _toolbox->SetCursor(_cursors[var_i16_187c]);
}
// 130:13dc
- this->var_i16_7b2 = this->var_i16_187c;
+ var_i16_7b2 = var_i16_187c;
}
// 130:13e2
- this->var_i16_7b2 = this->var_i16_187c;
+ var_i16_7b2 = var_i16_187c;
if (_stateFlags == kStateSaveGame) {
- this->sub_130_c56();
+ sub_130_c56();
}
}
// 130:141e
- this->jumbleSelectSquare();
+ jumbleSelectSquare();
_toolbox->InitCursor();
}
void FoolGame::sub_130_1426() {
warning(__func__);
// 130:1426
- this->var_i16_187e = 0;
- this->var_i16_1880 = 0;
+ var_i16_187e = 0;
+ var_i16_1880 = 0;
if (!_zbasic->index(1, 1).empty()) { // was: str(183)
- this->var_i16_1678 = 1;
- this->var_str_1578 = _zbasic->index(1, 1);
- this->sub_130_2226();
+ var_i16_1678 = 1;
+ var_str_1578 = _zbasic->index(1, 1);
+ sub_130_2226();
}
// 130:1474
}
@@ -619,37 +619,37 @@ void FoolGame::sub_130_1426() {
void FoolGame::jumbleOnClick() {
warning(__func__);
// 130:1476
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
// 130:14fa
if (_event.where.x > 0x14) {
- this->playTone(0xf, 0x42, 0x1);
+ playTone(0xf, 0x42, 0x1);
}
return;
}
// 130:1518
- if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] < 1) {
- this->playTone(0xf, 0x42, 0x1);
+ if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] < 1) {
+ playTone(0xf, 0x42, 0x1);
return;
}
// 130:1558
- if ((_jumbleGameType == 6) && (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] >= 0x11)) {
- this->playTone(0xf, 0x42, 0x1);
+ if ((_jumbleGameType == 6) && (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] >= 0x11)) {
+ playTone(0xf, 0x42, 0x1);
return;
}
// 130:15b0
switch (_jumbleGameType - 1) {
case 0:
- this->sub_130_172c();
+ sub_130_172c();
break;
case 1: // the knight of wands
case 2:
case 6:
- this->sub_130_20aa();
+ sub_130_20aa();
break;
case 3:
case 4: // word square
- this->sub_130_172c();
+ sub_130_172c();
break;
default:
warning("jumbleOnClick: unhandled case %d", _jumbleGameType-1);
@@ -661,16 +661,16 @@ void FoolGame::jumbleOnKey() {
warning(__func__);
// 130:15da
if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
- this->jumbleSelectSquare();
- this->jumbleNextPosition();
- this->sub_130_20d2();
+ jumbleSelectSquare();
+ jumbleNextPosition();
+ sub_130_20d2();
_keyLastPressed = 0;
return;
}
if (_keyLastPressed == 8) {
- this->jumbleSelectSquare();
- this->jumblePreviousPosition();
- this->sub_130_20d2();
+ jumbleSelectSquare();
+ jumblePreviousPosition();
+ sub_130_20d2();
_keyLastPressed = 0;
return;
}
@@ -684,29 +684,29 @@ void FoolGame::jumbleOnKey() {
}
} else {
// 130:1690
- this->var_i16_1882 = 0;
+ var_i16_1882 = 0;
if ((_keyLastPressed < 0x41) || (_keyLastPressed > 0x5a)) {
- this->var_i16_1882 = 1;
+ var_i16_1882 = 1;
}
if (_keyLastPressed == 0x20) {
- this->var_i16_1882 = 0;
+ var_i16_1882 = 0;
}
- if (this->var_i16_1882 != 0)
+ if (var_i16_1882 != 0)
return;
}
// 130:16dc
- this->var_str_d12 = _zbasic->chr(_keyLastPressed);
+ var_str_d12 = _zbasic->chr(_keyLastPressed);
// 130:16f2
_keyLastPressed = 0;
if (_jumbleGameType != 2) {
// 130:1706
if (!((_jumbleGameType == 3) || (_jumbleGameType == 6))) {
- this->sub_130_172c();
+ sub_130_172c();
} else {
- this->sub_130_201a();
+ sub_130_201a();
}
} else {
- this->sub_130_1a16();
+ sub_130_1a16();
}
}
@@ -714,197 +714,197 @@ void FoolGame::sub_130_172c() {
warning(__func__);
// 130:172c
// word square, disallow clicking the centre tile
- if ((_jumbleGameType == 4) && (this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c] == 5)) {
- this->jumbleClickFixedSquare();
+ if ((_jumbleGameType == 4) && (arr_i16_3b38[var_i16_68a*32 + var_i16_68c] == 5)) {
+ jumbleClickFixedSquare();
return;
}
// 130:1776
- if (!((this->var_i16_1678 == this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]) && (this->var_i16_187e > 0))) {
+ if (!((var_i16_1678 == arr_i16_2f38[var_i16_68a*32 + var_i16_68c]) && (var_i16_187e > 0))) {
// 130:17c4
- this->sub_130_19ac();
- this->var_i16_187e = ABS(this->arr_i16_3738[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]]);
- this->var_i16_1884 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
- _toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
- this->sub_130_2178();
+ sub_130_19ac();
+ var_i16_187e = ABS(arr_i16_3738[arr_i16_3b38[var_i16_68a*32 + var_i16_68c]]);
+ var_i16_1884 = arr_i16_3b38[var_i16_68a*32 + var_i16_68c];
+ _toolbox->InvertRect(_screenGrid[var_i16_187e]);
+ sub_130_2178();
return;
}
// 130:1844
- this->var_i16_1880 = ABS(this->arr_i16_3738[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]]);
- if (this->var_i16_187e == this->var_i16_1880) {
- this->sub_130_19ac();
+ var_i16_1880 = ABS(arr_i16_3738[arr_i16_3b38[var_i16_68a*32 + var_i16_68c]]);
+ if (var_i16_187e == var_i16_1880) {
+ sub_130_19ac();
return;
}
// 130:189a
- _toolbox->InvertRect(_screenGrid[this->var_i16_1880]);
- this->var_i16_1886 = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
- this->var_str_1374 = _zbasic->midStr(this->var_str_1070, this->var_i16_1884, 1);
- this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->var_i16_1886, 1);
- _zbasic->midStrSet(this->var_str_1070, this->var_i16_1884, 1, this->var_str_1474);
- _zbasic->midStrSet(this->var_str_1070, this->var_i16_1886, 1, this->var_str_1374);
- this->_jumbleSelected = this->var_i16_187e;
- this->_jumblePosition = this->var_i16_1884;
- this->var_str_d12 = this->var_str_1474;
- this->sub_130_1c6c();
- this->jumbleDrawLetter();
- this->_jumbleSelected = this->var_i16_1880;
- this->_jumblePosition = this->var_i16_1886;
- this->var_str_d12 = this->var_str_1374;
- this->sub_130_1c6c();
- this->jumbleDrawLetter();
- this->var_i16_187e = 0;
- this->var_i16_1880 = 0;
+ _toolbox->InvertRect(_screenGrid[var_i16_1880]);
+ var_i16_1886 = arr_i16_3b38[var_i16_68a*32 + var_i16_68c];
+ var_str_1374 = _zbasic->midStr(var_str_1070, var_i16_1884, 1);
+ var_str_1474 = _zbasic->midStr(var_str_1070, var_i16_1886, 1);
+ _zbasic->midStrSet(var_str_1070, var_i16_1884, 1, var_str_1474);
+ _zbasic->midStrSet(var_str_1070, var_i16_1886, 1, var_str_1374);
+ _jumbleSelected = var_i16_187e;
+ _jumblePosition = var_i16_1884;
+ var_str_d12 = var_str_1474;
+ sub_130_1c6c();
+ jumbleDrawLetter();
+ _jumbleSelected = var_i16_1880;
+ _jumblePosition = var_i16_1886;
+ var_str_d12 = var_str_1374;
+ sub_130_1c6c();
+ jumbleDrawLetter();
+ var_i16_187e = 0;
+ var_i16_1880 = 0;
}
void FoolGame::sub_130_19ac() {
warning(__func__);
// 130:19ac
- if (this->var_i16_187e > 0) {
- _toolbox->InvertRect(_screenGrid[this->var_i16_187e]);
+ if (var_i16_187e > 0) {
+ _toolbox->InvertRect(_screenGrid[var_i16_187e]);
}
- this->var_i16_187e = 0;
- this->var_i16_1880 = 0;
+ var_i16_187e = 0;
+ var_i16_1880 = 0;
}
void FoolGame::jumbleClickFixedSquare() {
warning(__func__);
// 130:19da
// fixed tile
- this->sub_130_19ac();
- this->playTone(0x19, 0x64, 0);
+ sub_130_19ac();
+ playTone(0x19, 0x64, 0);
for (int i = 0; i <= 0x19; i++) {
_toolbox->InvertRect(_screenGrid[13]);
- this->delay(1);
+ delay(1);
}
}
void FoolGame::sub_130_1a16() {
warning(__func__);
// 130:1a16
- this->var_str_1374 = this->var_str_d12;
- this->var_str_1474 = _zbasic->midStr(this->var_str_1070, this->_jumblePosition, 1);
- if (this->var_str_1374 == this->var_str_1474)
+ var_str_1374 = var_str_d12;
+ var_str_1474 = _zbasic->midStr(var_str_1070, _jumblePosition, 1);
+ if (var_str_1374 == var_str_1474)
return;
// 130:1a5c
- this->jumbleSelectSquare();
- for (int16 i = 1; i <= this->var_i16_1576; i++) {
+ jumbleSelectSquare();
+ for (int16 i = 1; i <= var_i16_1576; i++) {
// 130:1a66
- this->var_str_384 = _zbasic->midStr(this->var_str_1070, i, 1);
- if ((this->var_str_384 == this->var_str_1374) || (this->var_str_384 == this->var_str_1474)) {
- if (this->var_str_384 == this->var_str_1374) {
- this->var_str_d12 = this->var_str_1474;
+ var_str_384 = _zbasic->midStr(var_str_1070, i, 1);
+ if ((var_str_384 == var_str_1374) || (var_str_384 == var_str_1474)) {
+ if (var_str_384 == var_str_1374) {
+ var_str_d12 = var_str_1474;
} else {
// 130:1ad8
- this->var_str_d12 = this->var_str_1374;
+ var_str_d12 = var_str_1374;
}
// 130:1ae8
- _zbasic->midStrSet(this->var_str_1070, i, 1, this->var_str_d12);
- this->_jumbleSelected = ABS(this->arr_i16_3738[i]);
- this->sub_130_1c6c();
- this->jumbleDrawLetter();
+ _zbasic->midStrSet(var_str_1070, i, 1, var_str_d12);
+ _jumbleSelected = ABS(arr_i16_3738[i]);
+ sub_130_1c6c();
+ jumbleDrawLetter();
}
// 130:1b2e
}
// 130:1b40
- if (!this->var_str_1578.empty()) { // was: str(184)
- for (int16 i = 1; i <= this->var_i16_167a - 2; i++) {
- this->var_str_d12 = _zbasic->midStr(this->var_str_1578, i, 1);
- if ((this->var_str_d12 == this->var_str_1374) || (this->var_str_d12 == this->var_str_1474)) {
+ if (!var_str_1578.empty()) { // was: str(184)
+ for (int16 i = 1; i <= var_i16_167a - 2; i++) {
+ var_str_d12 = _zbasic->midStr(var_str_1578, i, 1);
+ if ((var_str_d12 == var_str_1374) || (var_str_d12 == var_str_1474)) {
// 130:1ba8
- if (this->var_str_d12 == this->var_str_1374) {
- this->var_str_d12 = this->var_str_1474;
+ if (var_str_d12 == var_str_1374) {
+ var_str_d12 = var_str_1474;
} else {
// 130:1bd2
- this->var_str_d12 = this->var_str_1374;
+ var_str_d12 = var_str_1374;
}
// 130:1be2
- _zbasic->midStrSet(this->var_str_1578, i, 1, this->var_str_d12);
+ _zbasic->midStrSet(var_str_1578, i, 1, var_str_d12);
}
// 130:1c02
}
- this->sub_130_2226();
+ sub_130_2226();
}
// 130:1c1a
- this->sub_130_1c1a();
+ sub_130_1c1a();
}
void FoolGame::sub_130_1c1a() {
warning(__func__);
// 130:1c1a
- this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
- _toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
+ _jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
+ _toolbox->InvertRect(_screenGrid[_jumbleSelected]);
}
void FoolGame::jumbleSelectSquare() {
warning(__func__);
// 130:1c52
- _toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
+ _toolbox->InvertRect(_screenGrid[_jumbleSelected]);
}
void FoolGame::sub_130_1c6c() {
warning(__func__);
_toolbox->PenNormal();
- _toolbox->FillRect(_screenGrid[this->_jumbleSelected], _patterns[this->var_i16_105e]);
- _toolbox->PenPat(_patterns[this->var_i16_105c]);
- _toolbox->FrameRect(_screenGrid[this->_jumbleSelected]);
- if (this->arr_i16_3738[this->_jumblePosition] >= 0) {
+ _toolbox->FillRect(_screenGrid[_jumbleSelected], _patterns[var_i16_105e]);
+ _toolbox->PenPat(_patterns[var_i16_105c]);
+ _toolbox->FrameRect(_screenGrid[_jumbleSelected]);
+ if (arr_i16_3738[_jumblePosition] >= 0) {
return;
}
// 130:1ce2
if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
return;
}
- this->arr_i16_4758[0] = _screenGrid[this->_jumbleSelected].top + 2;
- this->arr_i16_4758[1] = _screenGrid[this->_jumbleSelected].left + 2;
- this->arr_i16_4758[2] = _screenGrid[this->_jumbleSelected].bottom - 2;
- this->arr_i16_4758[3] = _screenGrid[this->_jumbleSelected].right - 2;
+ arr_i16_4758[0] = _screenGrid[_jumbleSelected].top + 2;
+ arr_i16_4758[1] = _screenGrid[_jumbleSelected].left + 2;
+ arr_i16_4758[2] = _screenGrid[_jumbleSelected].bottom - 2;
+ arr_i16_4758[3] = _screenGrid[_jumbleSelected].right - 2;
Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
_toolbox->FrameRect(temp);
}
void FoolGame::jumbleDrawLetter() {
warning(__func__);
// 130:1dcc
- _zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ _zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], 0, var_i16_106c);
_toolbox->MoveTo(
- _screenGrid[this->_jumbleSelected].left + this->arr_i16_1eb8[2],
- _screenGrid[this->_jumbleSelected].top + this->arr_i16_1eb8[3]
+ _screenGrid[_jumbleSelected].left + arr_i16_1eb8[2],
+ _screenGrid[_jumbleSelected].top + arr_i16_1eb8[3]
);
- _toolbox->DrawString(this->var_str_d12);
+ _toolbox->DrawString(var_str_d12);
}
void FoolGame::sub_130_1e5c() {
warning(__func__);
// 130:1e5c
_toolbox->PenNormal();
- _toolbox->InvertRect(_screenGrid[this->_jumbleSelected]);
- this->sub_130_1e76();
+ _toolbox->InvertRect(_screenGrid[_jumbleSelected]);
+ sub_130_1e76();
}
void FoolGame::sub_130_1e76() {
warning(__func__);
// 130:1e76
- this->arr_i16_4758[0] = _screenGrid[this->_jumbleSelected].top + 3;
- this->arr_i16_4758[1] = _screenGrid[this->_jumbleSelected].left + 3;
- this->arr_i16_4758[2] = _screenGrid[this->_jumbleSelected].bottom - 3;
- this->arr_i16_4758[3] = _screenGrid[this->_jumbleSelected].right - 3;
+ arr_i16_4758[0] = _screenGrid[_jumbleSelected].top + 3;
+ arr_i16_4758[1] = _screenGrid[_jumbleSelected].left + 3;
+ arr_i16_4758[2] = _screenGrid[_jumbleSelected].bottom - 3;
+ arr_i16_4758[3] = _screenGrid[_jumbleSelected].right - 3;
Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
- _toolbox->FillRect(temp, _patterns[this->var_i16_105e]);
- _zbasic->text(kFontPuzzle, this->arr_i16_1eb8[0xe], 0, this->var_i16_106c);
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
+ _toolbox->FillRect(temp, _patterns[var_i16_105e]);
+ _zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], 0, var_i16_106c);
// 130:1f70
_toolbox->MoveTo(
- _screenGrid[this->_jumbleSelected].left + this->arr_i16_1eb8[2],
- _screenGrid[this->_jumbleSelected].top + this->arr_i16_1eb8[3]
+ _screenGrid[_jumbleSelected].left + arr_i16_1eb8[2],
+ _screenGrid[_jumbleSelected].top + arr_i16_1eb8[3]
);
- _toolbox->DrawString(this->var_str_d12);
- if (this->arr_i16_3738[this->_jumblePosition] < 0)
+ _toolbox->DrawString(var_str_d12);
+ if (arr_i16_3738[_jumblePosition] < 0)
return;
// 130:1ff4
_toolbox->PenNormal();
@@ -916,73 +916,73 @@ void FoolGame::sub_130_1e76() {
void FoolGame::sub_130_201a() {
warning(__func__);
// 130:201a
- _zbasic->midStrSet(this->var_str_1070, this->_jumblePosition, 1, this->var_str_d12);
+ _zbasic->midStrSet(var_str_1070, _jumblePosition, 1, var_str_d12);
if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
- this->sub_130_1e5c();
+ sub_130_1e5c();
} else {
// 130:2066
- this->sub_130_1c6c();
- this->jumbleDrawLetter();
+ sub_130_1c6c();
+ jumbleDrawLetter();
}
// 130:206e
- this->jumbleNextPosition();
- this->sub_130_20d2();
+ jumbleNextPosition();
+ sub_130_20d2();
}
void FoolGame::jumbleNextPosition() {
warning(__func__);
// 130:2078
- this->_jumblePosition++;
- if (this->_jumblePosition > this->var_i16_1576) {
- this->_jumblePosition = 1;
+ _jumblePosition++;
+ if (_jumblePosition > var_i16_1576) {
+ _jumblePosition = 1;
}
}
void FoolGame::jumblePreviousPosition() {
warning(__func__);
// 130:2094
- this->_jumblePosition--;
- if (this->_jumblePosition < 1) {
- this->_jumblePosition = this->var_i16_1576;
+ _jumblePosition--;
+ if (_jumblePosition < 1) {
+ _jumblePosition = var_i16_1576;
}
}
void FoolGame::sub_130_20aa() {
warning(__func__);
// 130:20aa
- this->jumbleSelectSquare();
- this->_jumblePosition = this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c];
- this->sub_130_20d2();
+ jumbleSelectSquare();
+ _jumblePosition = arr_i16_3b38[var_i16_68a*32 + var_i16_68c];
+ sub_130_20d2();
}
void FoolGame::sub_130_20d2() {
warning(__func__);
// 130:20d2
- this->_jumbleSelected = ABS(this->arr_i16_3738[this->_jumblePosition]);
- this->jumbleSelectSquare();
- this->sub_130_20fe();
- this->sub_130_2178();
+ _jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
+ jumbleSelectSquare();
+ sub_130_20fe();
+ sub_130_2178();
}
void FoolGame::sub_130_20fe() {
warning(__func__);
// 130:20fe
- this->var_i16_1888 = ABS(this->arr_i16_3738[this->_jumblePosition]) - 1;
- this->var_i16_68a = (this->var_i16_1888 % this->arr_i16_1eb8[0]) + 1;
- this->var_i16_68c = (this->var_i16_1888 / this->arr_i16_1eb8[0]) + 1;
+ var_i16_1888 = ABS(arr_i16_3738[_jumblePosition]) - 1;
+ var_i16_68a = (var_i16_1888 % arr_i16_1eb8[0]) + 1;
+ var_i16_68c = (var_i16_1888 / arr_i16_1eb8[0]) + 1;
}
void FoolGame::sub_130_2178() {
warning(__func__);
// 130:2178
- if ((this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == this->var_i16_1678) || (_jumbleGameType == 2))
+ if ((arr_i16_2f38[var_i16_68a*32 + var_i16_68c] == var_i16_1678) || (_jumbleGameType == 2))
return;
- this->var_i16_1678 = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
- if (!_zbasic->index(1, this->var_i16_1678).empty()) { // was: str(185)
- this->var_str_1578 = _zbasic->index(1, this->var_i16_1678);
- this->sub_130_2226();
+ var_i16_1678 = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
+ if (!_zbasic->index(1, var_i16_1678).empty()) { // was: str(185)
+ var_str_1578 = _zbasic->index(1, var_i16_1678);
+ sub_130_2226();
}
// 130:2224
}
@@ -991,121 +991,121 @@ void FoolGame::sub_130_2226() {
warning(__func__);
// 130:2226
if (_activePuzzle == 0x14) { // the blacksmith
- this->sub_130_23cc();
+ sub_130_23cc();
return;
}
if (_activePuzzle == 0x3c) { // the boat
- this->sub_130_22ee();
+ sub_130_22ee();
return;
}
if (_activePuzzle == 0x35) { // the sentry
- this->sub_130_24aa();
+ sub_130_24aa();
return;
}
if (_activePuzzle == 0x55) { // final puzzle
- this->sub_130_2548();
+ sub_130_2548();
return;
}
// 130:2266
- this->fillRect(0x124, 0x64, 0x139, 0x1ef, 0);
- if (this->var_str_1578.empty()) // was: str(186)
+ fillRect(0x124, 0x64, 0x139, 0x1ef, 0);
+ if (var_str_1578.empty()) // was: str(186)
return;
// 130:22a0
_zbasic->text(kFontFool, 0xc, 0, kSrcOr);
- this->var_i16_484 = _toolbox->StringWidth(this->var_str_1578);
- _toolbox->MoveTo(0x127 - (this->var_i16_484 / 2), 0x133);
- _toolbox->DrawString(this->var_str_1578);
+ var_i16_484 = _toolbox->StringWidth(var_str_1578);
+ _toolbox->MoveTo(0x127 - (var_i16_484 / 2), 0x133);
+ _toolbox->DrawString(var_str_1578);
}
void FoolGame::sub_130_22ee() {
warning(__func__);
// 130:22ee
- this->fillRect(0x131, 0x84, 0x156, 0x17e, this->var_i16_1060);
- if (this->var_str_1578.empty()) // was: str(187)
+ fillRect(0x131, 0x84, 0x156, 0x17e, var_i16_1060);
+ if (var_str_1578.empty()) // was: str(187)
return;
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
- this->fillRect(0x13c, 0xf6 - (this->var_i16_7ba / 2), 0x150, 0x10a + (this->var_i16_7ba / 2), 2);
- _toolbox->MoveTo(0x100 - (this->var_i16_7ba / 2), 0x14a);
- _toolbox->DrawString(this->var_str_1578);
+ var_i16_7ba = _toolbox->StringWidth(var_str_1578);
+ fillRect(0x13c, 0xf6 - (var_i16_7ba / 2), 0x150, 0x10a + (var_i16_7ba / 2), 2);
+ _toolbox->MoveTo(0x100 - (var_i16_7ba / 2), 0x14a);
+ _toolbox->DrawString(var_str_1578);
}
void FoolGame::sub_130_23cc() {
warning(__func__);
// 130:23cc
- this->fillRect(0x12c, 0x8c, 0x156, 0x186, this->var_i16_1060);
- if (this->var_str_1578.empty()) // was: str(188)
+ fillRect(0x12c, 0x8c, 0x156, 0x186, var_i16_1060);
+ if (var_str_1578.empty()) // was: str(188)
return;
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
- this->fillRect(0x130, 0x100 - (this->var_i16_7ba / 2), 0x144, 0x114 + (this->var_i16_7ba / 2), 2);
- _toolbox->MoveTo(0x10a - (this->var_i16_7ba / 2), 0x13e);
- _toolbox->DrawString(this->var_str_1578);
+ var_i16_7ba = _toolbox->StringWidth(var_str_1578);
+ fillRect(0x130, 0x100 - (var_i16_7ba / 2), 0x144, 0x114 + (var_i16_7ba / 2), 2);
+ _toolbox->MoveTo(0x10a - (var_i16_7ba / 2), 0x13e);
+ _toolbox->DrawString(var_str_1578);
}
void FoolGame::sub_130_24aa() {
warning(__func__);
// 130:24aa
- this->fillRect(0x125, 0x20, 0x136, 0x15e, 2);
- if (this->var_str_1578.empty()) // was: str(189)
+ fillRect(0x125, 0x20, 0x136, 0x15e, 2);
+ if (var_str_1578.empty()) // was: str(189)
return;
_zbasic->text(kFontFool, 0xc, 0, kSrcBic);
- this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
- _toolbox->MoveTo(0xc4 - (this->var_i16_7ba / 2), 0x131);
- _toolbox->DrawString(this->var_str_1578);
+ var_i16_7ba = _toolbox->StringWidth(var_str_1578);
+ _toolbox->MoveTo(0xc4 - (var_i16_7ba / 2), 0x131);
+ _toolbox->DrawString(var_str_1578);
}
void FoolGame::sub_130_2548() {
warning(__func__);
// 130:2548
_zbasic->text(kFontFool, 0xc, 0, kSrcOr);
- this->fillRect(0x131, 0, 0x156, 0x10e, 0x47);
- if (this->var_str_1578.empty()) // was: str(190)
+ fillRect(0x131, 0, 0x156, 0x10e, 0x47);
+ if (var_str_1578.empty()) // was: str(190)
return;
- this->var_i16_7ba = _toolbox->StringWidth(this->var_str_1578);
- this->fillRect(0x13e, 0xc, 0x14e, 0x16 + this->var_i16_7ba, 0);
+ var_i16_7ba = _toolbox->StringWidth(var_str_1578);
+ fillRect(0x13e, 0xc, 0x14e, 0x16 + var_i16_7ba, 0);
_toolbox->MoveTo(0x16, 0x14a);
- _toolbox->DrawString(this->var_str_1578);
+ _toolbox->DrawString(var_str_1578);
}
void FoolGame::sub_130_25d8() {
warning(__func__);
// 130:25d8
_zbasic->unk_20();
- this->var_i16_188a = this->var_str_384.size();
- this->var_str_9f4 = _zbasic->space(this->var_i16_188a);
- for (int16 i = 1; i <= this->var_i16_188a; i++) {
- this->arr_i16_5bbc[i] = i;
+ var_i16_188a = var_str_384.size();
+ var_str_9f4 = _zbasic->space(var_i16_188a);
+ for (int16 i = 1; i <= var_i16_188a; i++) {
+ arr_i16_5bbc[i] = i;
}
- this->var_i16_188c = 0;
- for (int16 i = this->var_i16_188a; i >= 1; i--) {
+ var_i16_188c = 0;
+ for (int16 i = var_i16_188a; i >= 1; i--) {
do {
- this->var_i16_7e4 = _zbasic->rndInt(i);
+ var_i16_7e4 = _zbasic->rndInt(i);
// 130:2640
if (i == 1) {
// 130:266e
- if (this->arr_i16_5bbc[this->var_i16_7e4] == i) {
- this->var_i16_188c = 1;
+ if (arr_i16_5bbc[var_i16_7e4] == i) {
+ var_i16_188c = 1;
}
break;
}
// 130:264c
- } while (this->arr_i16_5bbc[this->var_i16_7e4] == i);
+ } while (arr_i16_5bbc[var_i16_7e4] == i);
// 130:2690
- this->arr_i16_5cbc[i] = this->arr_i16_5bbc[this->var_i16_7e4];
- for (int16 j = this->var_i16_7e4; j <= i; j++) {
- this->arr_i16_5bbc[j] = this->arr_i16_5bbc[j+1];
+ arr_i16_5cbc[i] = arr_i16_5bbc[var_i16_7e4];
+ for (int16 j = var_i16_7e4; j <= i; j++) {
+ arr_i16_5bbc[j] = arr_i16_5bbc[j+1];
}
// 130:26f2
}
// 130:2712
- if (this->var_i16_188c != 0) {
- _zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
+ if (var_i16_188c != 0) {
+ _zbasic->swapInt(arr_i16_5cbc[1], arr_i16_5cbc[2]);
}
// 130:273c
- for (int16 i = 1; i <= this->var_i16_188a; i++) {
- _zbasic->midStrSet(this->var_str_9f4, i, 1, _zbasic->midStr(this->var_str_384, this->arr_i16_5cbc[i], 1));
+ for (int16 i = 1; i <= var_i16_188a; i++) {
+ _zbasic->midStrSet(var_str_9f4, i, 1, _zbasic->midStr(var_str_384, arr_i16_5cbc[i], 1));
}
}
@@ -1113,39 +1113,39 @@ void FoolGame::sub_130_2790() {
warning(__func__);
_zbasic->unk_20();
for (int16 i = 1; i <= 0x1a; i++) {
- this->arr_i16_5bbc[i] = i;
+ arr_i16_5bbc[i] = i;
}
- this->var_i16_188c = 0;
+ var_i16_188c = 0;
for (int16 i = 0x1a; i > 0; i--) {
// 130:27c4
do {
- this->var_i16_7e4 = _zbasic->rndInt(i);
+ var_i16_7e4 = _zbasic->rndInt(i);
// 130:27d2
if (i == 1) {
// 130:2800
- if (this->arr_i16_5bbc[this->var_i16_7e4] == i) {
+ if (arr_i16_5bbc[var_i16_7e4] == i) {
// 130:281c
- this->var_i16_188c = 1;
+ var_i16_188c = 1;
}
break;
}
// 130:27de
- } while (this->arr_i16_5bbc[this->var_i16_7e4] == i);
+ } while (arr_i16_5bbc[var_i16_7e4] == i);
// 130:2822
- this->arr_i16_5cbc[i] = this->arr_i16_5bbc[this->var_i16_7e4];
- for (int16 j = this->var_i16_7e4; j <= i; j++) {
- this->arr_i16_5bbc[j] = this->arr_i16_5bbc[j+1];
+ arr_i16_5cbc[i] = arr_i16_5bbc[var_i16_7e4];
+ for (int16 j = var_i16_7e4; j <= i; j++) {
+ arr_i16_5bbc[j] = arr_i16_5bbc[j+1];
}
}
// 130:28a4
- if (this->var_i16_188c != 0) {
- _zbasic->swapInt(this->arr_i16_5cbc[1], this->arr_i16_5cbc[2]);
+ if (var_i16_188c != 0) {
+ _zbasic->swapInt(arr_i16_5cbc[1], arr_i16_5cbc[2]);
}
- this->var_i16_188a = this->var_str_384.size();
- this->var_str_9f4 = _zbasic->space(this->var_i16_188a);
- for (int16 i = 1; i <= this->var_i16_188a; i++) {
- this->var_i16_7e4 = _zbasic->asc(_zbasic->midStr(this->var_str_384, i, 1)) - 0x40;
- _zbasic->midStrSet(this->var_str_9f4, i, 1, _zbasic->chr(this->arr_i16_5cbc[this->var_i16_7e4]+0x40));
+ var_i16_188a = var_str_384.size();
+ var_str_9f4 = _zbasic->space(var_i16_188a);
+ for (int16 i = 1; i <= var_i16_188a; i++) {
+ var_i16_7e4 = _zbasic->asc(_zbasic->midStr(var_str_384, i, 1)) - 0x40;
+ _zbasic->midStrSet(var_str_9f4, i, 1, _zbasic->chr(arr_i16_5cbc[var_i16_7e4]+0x40));
}
}
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index d624a7cdd05..88661388cc2 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -53,7 +53,7 @@ void FoolGame::mazeRun() {
// 136:00ca
} while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
} while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
- if (this->arr_i16_1eb8[20] != 0) {
+ if (arr_i16_1eb8[20] != 0) {
var_i32_1ac0 = _toolbox->GetPicture(arr_i16_1eb8[20]);
_zbasic->picture(arr_i16_1eb8[18], arr_i16_1eb8[19], var_i32_1ac0);
}
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index aefc238852c..7915a34665f 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -33,10 +33,10 @@ namespace Fool {
// polyomino puzzle
void FoolGame::polyominoRun() {
// 133:0004
- this->fetchPuzzleData();
- this->var_i16_c00 = 1;
+ fetchPuzzleData();
+ var_i16_c00 = 1;
for (int i = 0; i <= 0x11; i++) {
- this->arr_i16_1eb8[i] = puzzlesReadShort();
+ arr_i16_1eb8[i] = puzzlesReadShort();
}
// 133:003c
Common::U32String hint = puzzlesReadString().decode(Common::kMacRoman);
@@ -44,10 +44,10 @@ void FoolGame::polyominoRun() {
hint = _zbasic->str(OFF(0)) + hint + _zbasic->str(OFF(1));
_zbasic->menu(8, 0xf, 1, hint);
int16 gridIndex = 0;
- int16 gridY = this->arr_i16_1eb8[8];
+ int16 gridY = arr_i16_1eb8[8];
do {
// 133:009e
- int16 gridX = this->arr_i16_1eb8[10];
+ int16 gridX = arr_i16_1eb8[10];
do {
// 133:00b2
gridIndex++;
@@ -55,56 +55,56 @@ void FoolGame::polyominoRun() {
_screenGrid[gridIndex],
gridX,
gridY,
- gridX + this->arr_i16_1eb8[13],
- gridY + this->arr_i16_1eb8[12]
+ gridX + arr_i16_1eb8[13],
+ gridY + arr_i16_1eb8[12]
);
// 133:0112
} while (_zbasic->incrAndCheck(
gridX,
- this->arr_i16_1eb8[11],
- this->arr_i16_1eb8[6]
+ arr_i16_1eb8[11],
+ arr_i16_1eb8[6]
));
// 133:0142
} while (_zbasic->incrAndCheck(
gridY,
- this->arr_i16_1eb8[9],
- this->arr_i16_1eb8[7]
+ arr_i16_1eb8[9],
+ arr_i16_1eb8[7]
));
// 133:0172
- this->var_i16_484 = 0;
- for (int j = 1; j <= this->arr_i16_1eb8[1]; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ var_i16_484 = 0;
+ for (int j = 1; j <= arr_i16_1eb8[1]; j++) {
+ for (int i = 1; i <= arr_i16_1eb8[0]; i++) {
// 133:0184
- this->var_i16_484++;
+ var_i16_484++;
// collision map: 2D grid where element is occupying polyomino ID
- this->arr_i16_2f38[i*32 + j] = 0;
+ arr_i16_2f38[i*32 + j] = 0;
- this->arr_i16_3b38[i*32 + j] = this->var_i16_484;
+ arr_i16_3b38[i*32 + j] = var_i16_484;
}
}
// 133:01fa
for (int i = 0x12; i <= 0x19; i++) {
- this->arr_i16_1eb8[i] = puzzlesReadShort();
+ arr_i16_1eb8[i] = puzzlesReadShort();
}
// 133:0228
- _toolbox->SetPort(this->var_i32_f24);
+ _toolbox->SetPort(var_i32_f24);
_zbasic->text(kFontPuzzle, 0x18, Graphics::kMacFontRegular, kSrcOr);
// for each polyomino
- for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
+ for (int j = 1; j <= arr_i16_1eb8[0x10]; j++) {
// read number of coordinate parts
- this->var_i16_103a = puzzlesReadShort();
+ var_i16_103a = puzzlesReadShort();
for (int i = 0; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = puzzlesReadShort();
+ arr_i16_47d8[j*8 + i] = puzzlesReadShort();
}
// 133:0284
for (int i = 5; i <= 6; i++) {
- this->arr_i16_47d8[j*8 + i] = this->arr_i16_47d8[j*8 + i - 2];
+ arr_i16_47d8[j*8 + i] = arr_i16_47d8[j*8 + i - 2];
}
if (debugLevelSet(5)) {
debug(5,"FoolGame::polyominoRun: adding polyomino %d:", j);
for (int i = 0; i < 4; i++) {
- uint16 data = (this->arr_i16_47d8[j*8] >> (i*4)) & 0xf;
+ uint16 data = (arr_i16_47d8[j*8] >> (i*4)) & 0xf;
debug(5, "%s%s%s%s",
data & 0x1 ? "#" : " ",
data & 0x2 ? "#" : " ",
@@ -113,365 +113,365 @@ void FoolGame::polyominoRun() {
);
}
debug(5, "%d, %d, start position %d, %d",
- this->arr_i16_47d8[j*8 + 1],
- this->arr_i16_47d8[j*8 + 2],
- this->arr_i16_47d8[j*8 + 3],
- this->arr_i16_47d8[j*8 + 4]
+ arr_i16_47d8[j*8 + 1],
+ arr_i16_47d8[j*8 + 2],
+ arr_i16_47d8[j*8 + 3],
+ arr_i16_47d8[j*8 + 4]
);
}
// 133:02de
if (!_activePuzzleBuffer.empty()) { // was: str(OFF(2))
if (j == 1) {
- this->var_i16_1aa8 = 1;
+ var_i16_1aa8 = 1;
}
for (int i = 3; i <= 4; i++) {
- this->arr_i16_47d8[j*8 + i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, this->var_i16_1aa8, 2));
- this->var_i16_1aa8 += 2;
+ arr_i16_47d8[j*8 + i] = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1aa8, 2));
+ var_i16_1aa8 += 2;
}
}
// 133:0356
// read coordinates. these are unsigned bytes in pixel units
- for (int i = 0; i <= this->var_i16_103a; i++) {
- this->arr_i16_4338[i] = puzzlesReadByte();
+ for (int i = 0; i <= var_i16_103a; i++) {
+ arr_i16_4338[i] = puzzlesReadByte();
}
// 133:0388
// create polyomino polygons from coordinates
PolyHandle poly = _toolbox->OpenPoly(); // var_poly_1aac
- _toolbox->MoveTo(this->arr_i16_4338[1], this->arr_i16_4338[0]);
- for (int i = 2; i <= this->var_i16_103a; i += 2) {
- _toolbox->LineTo(this->arr_i16_4338[i+1], this->arr_i16_4338[i]);
+ _toolbox->MoveTo(arr_i16_4338[1], arr_i16_4338[0]);
+ for (int i = 2; i <= var_i16_103a; i += 2) {
+ _toolbox->LineTo(arr_i16_4338[i+1], arr_i16_4338[i]);
}
_toolbox->ClosePoly();
// 133:0408
// load in letter placement information
- this->var_i16_103a = puzzlesReadShort();
- if (this->var_i16_103a >= 3) {
- for (int i = 1; i <= this->var_i16_103a; i++) {
- this->arr_i16_3738[i] = puzzlesReadByte();
+ var_i16_103a = puzzlesReadShort();
+ if (var_i16_103a >= 3) {
+ for (int i = 1; i <= var_i16_103a; i++) {
+ arr_i16_3738[i] = puzzlesReadByte();
}
}
// 133:044a
- this->arr_i16_1eb8[0x1a] = puzzlesReadShort(); // polygon fill pattern index
- this->arr_i16_1eb8[0x1b] = puzzlesReadShort(); // text source mode
+ arr_i16_1eb8[0x1a] = puzzlesReadShort(); // polygon fill pattern index
+ arr_i16_1eb8[0x1b] = puzzlesReadShort(); // text source mode
_toolbox->PenNormal();
// 133:0476: JSR - "PICTURE_ON"
// picture handle 0: XOR text + polyomino
PicHandle handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_toolbox->PenMode(kPatXor);
- if (this->var_i16_103a >= 3) {
+ if (var_i16_103a >= 3) {
_toolbox->TextMode(kSrcXor);
- for (int i = 1; i <= this->var_i16_103a; i += 3) {
- _toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
- this->var_str_384 = _zbasic->chr(this->arr_i16_3738[i+2]);
- _toolbox->DrawString(this->var_str_384);
+ for (int i = 1; i <= var_i16_103a; i += 3) {
+ _toolbox->MoveTo(arr_i16_3738[i], arr_i16_3738[i+1]);
+ var_str_384 = _zbasic->chr(arr_i16_3738[i+2]);
+ _toolbox->DrawString(var_str_384);
}
}
// 133:050a
_toolbox->InvertPoly(poly);
_toolbox->ClosePicture();
- this->_polyominoPics[j*4] = handle;
+ _polyominoPics[j*4] = handle;
_toolbox->PenNormal();
// 133:0530: JSR - "PICTURE_ON"
// picture handle 1:
handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _toolbox->FillPoly(poly, _patterns[this->arr_i16_1eb8[0x1a]]);
- _toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
+ _toolbox->FillPoly(poly, _patterns[arr_i16_1eb8[0x1a]]);
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[0xf]]);
_toolbox->FramePoly(poly);
// 133:0582
- if (this->var_i16_103a >= 3) {
- _toolbox->TextMode((SourceMode)this->arr_i16_1eb8[0x1b]);
- for (int i = 1; i <= this->var_i16_103a; i += 3) {
- _toolbox->MoveTo(this->arr_i16_3738[i], this->arr_i16_3738[i+1]);
- this->var_str_384 = _zbasic->chr(this->arr_i16_3738[i+2]);
- _toolbox->DrawString(this->var_str_384);
+ if (var_i16_103a >= 3) {
+ _toolbox->TextMode((SourceMode)arr_i16_1eb8[0x1b]);
+ for (int i = 1; i <= var_i16_103a; i += 3) {
+ _toolbox->MoveTo(arr_i16_3738[i], arr_i16_3738[i+1]);
+ var_str_384 = _zbasic->chr(arr_i16_3738[i+2]);
+ _toolbox->DrawString(var_str_384);
}
}
// 133:061a
_toolbox->FramePoly(poly);
_toolbox->ClosePicture();
// 133:0622
- this->_polyominoPics[j*4 + 1] = handle;
+ _polyominoPics[j*4 + 1] = handle;
_toolbox->PenNormal();
// 133:0642: JSR - "PICTURE_ON"
// picture handle 2: draw the shape without letters
handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _toolbox->PenPat(_patterns[this->arr_i16_1eb8[0xf]]);
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[0xf]]);
_toolbox->FramePoly(poly);
_toolbox->PaintPoly(poly);
_toolbox->ClosePicture();
- this->_polyominoPics[j*4 + 2] = handle;
+ _polyominoPics[j*4 + 2] = handle;
// clear polygon data
_toolbox->KillPoly(poly);
// 133:0698
}
// 133:06b4
- _toolbox->SetPort(this->var_i32_0);
- this->var_i16_484 = 0;
- for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
- for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
- this->var_i16_484++;
- this->arr_i16_4338[this->var_i16_484] = puzzlesReadByte();
+ _toolbox->SetPort(var_i32_0);
+ var_i16_484 = 0;
+ for (int j = arr_i16_1eb8[0x16]; j <= arr_i16_1eb8[0x17]; j++) {
+ for (int i = arr_i16_1eb8[0x18]; i <= arr_i16_1eb8[0x19]; i++) {
+ var_i16_484++;
+ arr_i16_4338[var_i16_484] = puzzlesReadByte();
}
}
// 133:073c
- this->sub_128_bde(1, this->arr_i16_1eb8[0xf], 0, 1, 1, 1);
- this->var_i16_1ab0 = 0;
- for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
- this->polyominoMove(
- this->arr_i16_47d8[this->var_i16_7cc*8 + 3],
- this->arr_i16_47d8[this->var_i16_7cc*8 + 4]
+ sub_128_bde(1, arr_i16_1eb8[0xf], 0, 1, 1, 1);
+ var_i16_1ab0 = 0;
+ for (var_i16_7cc = 1; var_i16_7cc <= arr_i16_1eb8[0x10]; var_i16_7cc++) {
+ polyominoMove(
+ arr_i16_47d8[var_i16_7cc*8 + 3],
+ arr_i16_47d8[var_i16_7cc*8 + 4]
);
}
- this->var_i16_1ab0 = 1;
- this->polyominoDrawFrame();
- this->polyominoCheckIfSolved();
+ var_i16_1ab0 = 1;
+ polyominoDrawFrame();
+ polyominoCheckIfSolved();
_stateFlags = kStateNull;
do {
do {
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == 1) {
- this->polyominoOnClick();
+ polyominoOnClick();
}
// 133:0800
} while ((_stateFlags == kStateNull) && (!_activePuzzleSolved));
// 133:081c
if (_stateFlags == kStateUndo) {
- this->polyominoReset();
+ polyominoReset();
}
if (_stateFlags == kStateSaveGame) {
- this->polyominoStoreState();
- this->saveGame();
+ polyominoStoreState();
+ saveGame();
}
} while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved));
// 133:0864
if (_activePuzzleSolved) {
- this->polyominoSuccess();
+ polyominoSuccess();
}
- this->polyominoStoreState();
+ polyominoStoreState();
//133:0878: JMP - [0x1502]
// exiting game, delete picture handles
- for (int j = 1; j <= this->arr_i16_1eb8[0x10]; j++) {
+ for (int j = 1; j <= arr_i16_1eb8[0x10]; j++) {
for (int i = 0; i <= 2; i++) {
- _toolbox->KillPicture(this->_polyominoPics[j*4 + i]);
+ _toolbox->KillPicture(_polyominoPics[j*4 + i]);
}
}
}
void FoolGame::polyominoOnClick() {
// 133:087c
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- debug(5, "FoolGame::polyominoOnClick: grid pos: (%d, %d)", this->var_i16_68a, this->var_i16_68c);
- if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) || (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
- this->waitForMouseUp();
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ debug(5, "FoolGame::polyominoOnClick: grid pos: (%d, %d)", var_i16_68a, var_i16_68c);
+ if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
+ waitForMouseUp();
return;
}
// 133:0904
// get polyomino from collision map
- this->var_i16_7cc = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
- debug(5, "FoolGame::polyominoOnClick: selected polyomino: %d", this->var_i16_7cc);
+ var_i16_7cc = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
+ debug(5, "FoolGame::polyominoOnClick: selected polyomino: %d", var_i16_7cc);
// if no polyomino, ignore
- if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] == 0) {
- this->waitForMouseUp();
+ if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] == 0) {
+ waitForMouseUp();
return;
}
// 133:0950
// if polyomino is part of the fixed list, act as if it were an invalid move
- if (this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c] <= this->arr_i16_1eb8[0x11]) {
- this->polyominoOnClickFixed();
+ if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] <= arr_i16_1eb8[0x11]) {
+ polyominoOnClickFixed();
return;
}
// 133:0990
- this->var_i16_106a = 0;
- int16 polyGridPosX = this->arr_i16_47d8[this->var_i16_7cc*8 + 3];
- int16 polyGridPosY = this->arr_i16_47d8[this->var_i16_7cc*8 + 4];
+ var_i16_106a = 0;
+ int16 polyGridPosX = arr_i16_47d8[var_i16_7cc*8 + 3];
+ int16 polyGridPosY = arr_i16_47d8[var_i16_7cc*8 + 4];
debug(5, "FoolGame::polyominoOnClick: polyGridPosX: %d, polyGridPosY: %d", polyGridPosX, polyGridPosY);
for (int j = polyGridPosY; j <= polyGridPosY + 3; j++) {
// 133:09dc
for (int i = polyGridPosX; i <= polyGridPosX + 3; i++) {
- if (this->arr_i16_47d8[this->var_i16_7cc*8] & _bitLUT[this->var_i16_106a]) {
+ if (arr_i16_47d8[var_i16_7cc*8] & _bitLUT[var_i16_106a]) {
// erase grabbed polyomino from collision map
- this->arr_i16_2f38[i*32 + j] = 0;
+ arr_i16_2f38[i*32 + j] = 0;
}
// 133:0a36
- this->var_i16_106a++;
+ var_i16_106a++;
}
}
// 133:0a60
- this->var_i16_1ab2 = polyGridPosX - this->var_i16_68a;
- this->var_i16_1ab4 = polyGridPosY - this->var_i16_68c;
- this->_polyominoPosX = _screenGrid[this->arr_i16_3b38[polyGridPosX*32 + polyGridPosY]].left;
- this->_polyominoPosY = _screenGrid[this->arr_i16_3b38[polyGridPosX*32 + polyGridPosY]].top;
- debug(5, "FoolGame::polyominoOnClick: Unblit solid and blit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
- _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4 + 2]);
+ var_i16_1ab2 = polyGridPosX - var_i16_68a;
+ var_i16_1ab4 = polyGridPosY - var_i16_68c;
+ _polyominoPosX = _screenGrid[arr_i16_3b38[polyGridPosX*32 + polyGridPosY]].left;
+ _polyominoPosY = _screenGrid[arr_i16_3b38[polyGridPosX*32 + polyGridPosY]].top;
+ debug(5, "FoolGame::polyominoOnClick: Unblit solid and blit ghost (%d, %d)", _polyominoPosX, _polyominoPosY);
+ _zbasic->picture(_polyominoPosX, _polyominoPosY, _polyominoPics[var_i16_7cc*4 + 2]);
// 133:0b1c
- this->polyominoDrawFrame();
- this->toggleMouseCursor(false);
- this->var_i16_1ab6 = this->_polyominoPosX;
- this->var_i16_1ab8 = this->_polyominoPosY;
- _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
+ polyominoDrawFrame();
+ toggleMouseCursor(false);
+ var_i16_1ab6 = _polyominoPosX;
+ var_i16_1ab8 = _polyominoPosY;
+ _zbasic->picture(_polyominoPosX, _polyominoPosY, _polyominoPics[var_i16_7cc*4]);
// 133:0b5a: JMP - [0xde0]
while (_event.what != 2) {
// 133:0b5e
// 133:0d3a
- while ((this->var_i16_1ab6 == this->_polyominoPosX) && (this->var_i16_1ab8 == this->_polyominoPosY) && (_event.what != 2)) {
+ while ((var_i16_1ab6 == _polyominoPosX) && (var_i16_1ab8 == _polyominoPosY) && (_event.what != 2)) {
// 133:0b62
- this->getNextEvent(4);
+ getNextEvent(4);
- this->var_i16_68a = this->var_i16_1ab2 + ((_event.where.x - this->arr_i16_1eb8[4]) / this->arr_i16_1eb8[6]);
- this->var_i16_68c = this->var_i16_1ab4 + ((_event.where.y - this->arr_i16_1eb8[5]) / this->arr_i16_1eb8[7]);
+ var_i16_68a = var_i16_1ab2 + ((_event.where.x - arr_i16_1eb8[4]) / arr_i16_1eb8[6]);
+ var_i16_68c = var_i16_1ab4 + ((_event.where.y - arr_i16_1eb8[5]) / arr_i16_1eb8[7]);
- if (this->var_i16_68a < 1) {
- this->var_i16_68a = 1;
+ if (var_i16_68a < 1) {
+ var_i16_68a = 1;
}
// 133:0bf8
- if (this->var_i16_68a > (0x12 - this->arr_i16_47d8[this->var_i16_7cc*8 + 1])) {
- this->var_i16_68a = 0x12 - this->arr_i16_47d8[this->var_i16_7cc*8 + 1];
+ if (var_i16_68a > (0x12 - arr_i16_47d8[var_i16_7cc*8 + 1])) {
+ var_i16_68a = 0x12 - arr_i16_47d8[var_i16_7cc*8 + 1];
}
// 133:0c58
- if (this->var_i16_68c < 1) {
- this->var_i16_68c = 1;
+ if (var_i16_68c < 1) {
+ var_i16_68c = 1;
}
// 133:0c68
- if (this->var_i16_68c > (0xb - this->arr_i16_47d8[this->var_i16_7cc*8 + 2])) {
- this->var_i16_68c = 0xb - this->arr_i16_47d8[this->var_i16_7cc*8 + 2];
+ if (var_i16_68c > (0xb - arr_i16_47d8[var_i16_7cc*8 + 2])) {
+ var_i16_68c = 0xb - arr_i16_47d8[var_i16_7cc*8 + 2];
}
// 133:0cc8
- this->var_i16_1ab6 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].left;
- this->var_i16_1ab8 = _screenGrid[this->arr_i16_3b38[this->var_i16_68a*32 + this->var_i16_68c]].top;
- //debug(5, "FoolGame::polyominoOnClick: Move to (%d, %d) -> (%d, %d)", this->var_i16_68a, this->var_i16_68c, this->var_i16_1ab6, this->var_i16_1ab8);
+ var_i16_1ab6 = _screenGrid[arr_i16_3b38[var_i16_68a*32 + var_i16_68c]].left;
+ var_i16_1ab8 = _screenGrid[arr_i16_3b38[var_i16_68a*32 + var_i16_68c]].top;
+ //debug(5, "FoolGame::polyominoOnClick: Move to (%d, %d) -> (%d, %d)", var_i16_68a, var_i16_68c, var_i16_1ab6, var_i16_1ab8);
}
// 133:0d78
if (_event.what != 2) {
- debug(5, "FoolGame::polyominoOnClick: Unblit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
+ debug(5, "FoolGame::polyominoOnClick: Unblit ghost (%d, %d)", _polyominoPosX, _polyominoPosY);
// XOR out original position
- _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
+ _zbasic->picture(_polyominoPosX, _polyominoPosY, _polyominoPics[var_i16_7cc*4]);
// drag to cursor position
- this->_polyominoPosX = this->var_i16_1ab6;
- this->_polyominoPosY = this->var_i16_1ab8;
+ _polyominoPosX = var_i16_1ab6;
+ _polyominoPosY = var_i16_1ab8;
// XOR out new position
- debug(5, "FoolGame::polyominoOnClick: Blit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
- _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
+ debug(5, "FoolGame::polyominoOnClick: Blit ghost (%d, %d)", _polyominoPosX, _polyominoPosY);
+ _zbasic->picture(_polyominoPosX, _polyominoPosY, _polyominoPics[var_i16_7cc*4]);
}
// 133:0de0
}
// 133:0dea
- this->var_i16_106a = 0;
- this->var_i16_1a9c = 0;
+ var_i16_106a = 0;
+ var_i16_1a9c = 0;
// store polyomino as bitfield.
- for (int j = this->var_i16_68c; j <= this->var_i16_68c + 3; j++) {
- for (int i = this->var_i16_68a; i <= this->var_i16_68a + 3; i++) {
- if (this->arr_i16_2f38[i*32 + j] > 0) {
- this->var_i16_1a9c |= _bitLUT[this->var_i16_106a];
+ for (int j = var_i16_68c; j <= var_i16_68c + 3; j++) {
+ for (int i = var_i16_68a; i <= var_i16_68a + 3; i++) {
+ if (arr_i16_2f38[i*32 + j] > 0) {
+ var_i16_1a9c |= _bitLUT[var_i16_106a];
}
// 133:0e44
- this->var_i16_106a++;
+ var_i16_106a++;
}
// 133:0e5a
}
// 133:0e6c
- if ((this->var_i16_1a9c & this->arr_i16_47d8[this->var_i16_7cc*8]) != 0) {
- this->polyominoCancelMove();
+ if ((var_i16_1a9c & arr_i16_47d8[var_i16_7cc*8]) != 0) {
+ polyominoCancelMove();
} else {
- this->polyominoMove(this->var_i16_68a, this->var_i16_68c);
+ polyominoMove(var_i16_68a, var_i16_68c);
}
// 133:0ea2
- this->polyominoDrawFrame();
- this->polyominoCheckIfSolved();
- this->toggleMouseCursor(true);
+ polyominoDrawFrame();
+ polyominoCheckIfSolved();
+ toggleMouseCursor(true);
}
void FoolGame::polyominoCancelMove() {
// 133:0eb2
- this->playTone(0x14, 0x64, 0);
+ playTone(0x14, 0x64, 0);
polyominoMove(
- this->arr_i16_47d8[this->var_i16_7cc*8 + 3],
- this->arr_i16_47d8[this->var_i16_7cc*8 + 4]
+ arr_i16_47d8[var_i16_7cc*8 + 3],
+ arr_i16_47d8[var_i16_7cc*8 + 4]
);
}
void FoolGame::polyominoMove(int16 x, int16 y) {
// 133:0f04
- this->var_i16_106a = 0;
+ var_i16_106a = 0;
// polyominos are max 4x4
// add the polyomino to the collision map
for (int j = y; j <= y + 3; j++) {
for (int i = x; i <= x + 3; i++) {
- if ((this->arr_i16_47d8[this->var_i16_7cc*8] & _bitLUT[this->var_i16_106a]) != 0) {
- this->arr_i16_2f38[i*32 + j] = this->var_i16_7cc;
+ if ((arr_i16_47d8[var_i16_7cc*8] & _bitLUT[var_i16_106a]) != 0) {
+ arr_i16_2f38[i*32 + j] = var_i16_7cc;
}
// 133:0f6c
- this->var_i16_106a++;
+ var_i16_106a++;
}
}
// 133:0f96
// set the polyomino position
- this->arr_i16_47d8[this->var_i16_7cc*8 + 3] = x;
- this->arr_i16_47d8[this->var_i16_7cc*8 + 4] = y;
+ arr_i16_47d8[var_i16_7cc*8 + 3] = x;
+ arr_i16_47d8[var_i16_7cc*8 + 4] = y;
// 133:0fce
- if (this->var_i16_1ab0 != 0) {
- debug(5, "FoolGame::polyominoMove: Blit ghost (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
- _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4]);
+ if (var_i16_1ab0 != 0) {
+ debug(5, "FoolGame::polyominoMove: Blit ghost (%d, %d)", _polyominoPosX, _polyominoPosY);
+ _zbasic->picture(_polyominoPosX, _polyominoPosY, _polyominoPics[var_i16_7cc*4]);
}
// 133:1002
- this->_polyominoPosX = _screenGrid[this->arr_i16_3b38[x*32 + y]].left;
- this->_polyominoPosY = _screenGrid[this->arr_i16_3b38[x*32 + y]].top;
- debug(5, "FoolGame::polyominoMove: Blit solid (%d, %d)", this->_polyominoPosX, this->_polyominoPosY);
- _zbasic->picture(this->_polyominoPosX, this->_polyominoPosY, this->_polyominoPics[this->var_i16_7cc*4 + 1]);
+ _polyominoPosX = _screenGrid[arr_i16_3b38[x*32 + y]].left;
+ _polyominoPosY = _screenGrid[arr_i16_3b38[x*32 + y]].top;
+ debug(5, "FoolGame::polyominoMove: Blit solid (%d, %d)", _polyominoPosX, _polyominoPosY);
+ _zbasic->picture(_polyominoPosX, _polyominoPosY, _polyominoPics[var_i16_7cc*4 + 1]);
}
void FoolGame::polyominoOnClickFixed() {
// 133:10a0
- int16 posX = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].left;
- int16 posY = _screenGrid[this->arr_i16_3b38[this->arr_i16_47d8[this->var_i16_7cc*8 + 3]*32 + this->arr_i16_47d8[this->var_i16_7cc*8 + 4]]].top;
+ int16 posX = _screenGrid[arr_i16_3b38[arr_i16_47d8[var_i16_7cc*8 + 3]*32 + arr_i16_47d8[var_i16_7cc*8 + 4]]].left;
+ int16 posY = _screenGrid[arr_i16_3b38[arr_i16_47d8[var_i16_7cc*8 + 3]*32 + arr_i16_47d8[var_i16_7cc*8 + 4]]].top;
// play bass tone
- this->playTone(0x14, 0x64, 0);
+ playTone(0x14, 0x64, 0);
// why do this???
// best guess: flashing the shape a few times before knocking it back
// 133:1188
debug(5, "FoolGame::polyominoOnClickFixed: Draw pic 0 (%d, %d)", posX, posY);
for (int i = 0; i <= 9; i++) {
- _zbasic->picture(posX, posY, this->_polyominoPics[this->var_i16_7cc*4]);
+ _zbasic->picture(posX, posY, _polyominoPics[var_i16_7cc*4]);
_toolbox->Delay(0);
}
// 133:11c2
- this->polyominoDrawFrame();
- this->waitForMouseUp();
+ polyominoDrawFrame();
+ waitForMouseUp();
}
void FoolGame::polyominoReset() {
// 133:11cc
// zero out collision grid
- for (int j = 1; j <= this->arr_i16_1eb8[1] + 1; j++) {
- for (int i = 1; i <= this->arr_i16_1eb8[0] + 1; i++) {
- this->arr_i16_2f38[i*32 + j] = 0;
+ for (int j = 1; j <= arr_i16_1eb8[1] + 1; j++) {
+ for (int i = 1; i <= arr_i16_1eb8[0] + 1; i++) {
+ arr_i16_2f38[i*32 + j] = 0;
}
}
// 133:122e
- this->fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, this->arr_i16_1eb8[0xf]);
- this->var_i16_1ab0 = 0;
- for (this->var_i16_7cc = 1; this->var_i16_7cc <= this->arr_i16_1eb8[0x10]; this->var_i16_7cc++) {
- this->polyominoMove(
- this->arr_i16_47d8[this->var_i16_7cc*8 + 5],
- this->arr_i16_47d8[this->var_i16_7cc*8 + 6]
+ fillRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, arr_i16_1eb8[0xf]);
+ var_i16_1ab0 = 0;
+ for (var_i16_7cc = 1; var_i16_7cc <= arr_i16_1eb8[0x10]; var_i16_7cc++) {
+ polyominoMove(
+ arr_i16_47d8[var_i16_7cc*8 + 5],
+ arr_i16_47d8[var_i16_7cc*8 + 6]
);
}
// 133:12c2
- this->var_i16_1ab0 = 1;
- this->polyominoDrawFrame();
+ var_i16_1ab0 = 1;
+ polyominoDrawFrame();
_stateFlags = kStateNull;
}
@@ -480,10 +480,10 @@ void FoolGame::polyominoDrawFrame() {
_toolbox->PenNormal();
_toolbox->PenSize(3, 3);
Common::Rect temp;
- temp.top = this->arr_i16_1eb8[0x12];
- temp.left = this->arr_i16_1eb8[0x13];
- temp.bottom = this->arr_i16_1eb8[0x14];
- temp.right = this->arr_i16_1eb8[0x15];
+ temp.top = arr_i16_1eb8[0x12];
+ temp.left = arr_i16_1eb8[0x13];
+ temp.bottom = arr_i16_1eb8[0x14];
+ temp.right = arr_i16_1eb8[0x15];
_toolbox->FrameRect(temp);
_toolbox->PenNormal();
}
@@ -492,14 +492,14 @@ void FoolGame::polyominoCheckIfSolved() {
// 133:12f2
_activePuzzleSolved = true;
int16 index = 0;
- for (int j = this->arr_i16_1eb8[0x16]; j <= this->arr_i16_1eb8[0x17]; j++) {
- for (int i = this->arr_i16_1eb8[0x18]; i <= this->arr_i16_1eb8[0x19]; i++) {
+ for (int j = arr_i16_1eb8[0x16]; j <= arr_i16_1eb8[0x17]; j++) {
+ for (int i = arr_i16_1eb8[0x18]; i <= arr_i16_1eb8[0x19]; i++) {
index++;
- if (this->arr_i16_2f38[i*32 + j] != this->arr_i16_4338[index]) {
+ if (arr_i16_2f38[i*32 + j] != arr_i16_4338[index]) {
// 133:1368
_activePuzzleSolved = false;
- j = this->arr_i16_1eb8[0x17];
- i = this->arr_i16_1eb8[0x19];
+ j = arr_i16_1eb8[0x17];
+ i = arr_i16_1eb8[0x19];
}
// 133:1396
}
@@ -515,17 +515,17 @@ void FoolGame::polyominoSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->menuClickMessage();
- this->waitForMouseUp();
- this->flashRect(this->arr_i16_1eb8[0x12], this->arr_i16_1eb8[0x13], this->arr_i16_1eb8[0x14], this->arr_i16_1eb8[0x15], 0x96);
+ menuClickMessage();
+ waitForMouseUp();
+ flashRect(arr_i16_1eb8[0x12], arr_i16_1eb8[0x13], arr_i16_1eb8[0x14], arr_i16_1eb8[0x15], 0x96);
}
void FoolGame::polyominoStoreState() {
// 133:1452
_activePuzzleBuffer.clear(); // was: str(OFF(3))
- for (int i = 1; i <= this->arr_i16_1eb8[0x10]; i++) {
- Common::String val1 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 3]);
- Common::String val2 = _zbasic->encodeInt(this->arr_i16_47d8[i*8 + 4]);
+ for (int i = 1; i <= arr_i16_1eb8[0x10]; i++) {
+ Common::String val1 = _zbasic->encodeInt(arr_i16_47d8[i*8 + 3]);
+ Common::String val2 = _zbasic->encodeInt(arr_i16_47d8[i*8 + 4]);
_activePuzzleBuffer += val1 + val2;
}
}
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 6b43aa01d73..2720304cb6c 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -33,88 +33,88 @@ namespace Fool {
// mask reveal puzzle
void FoolGame::revealRun() {
// 134:0004
- this->fetchPuzzleData();
- this->var_i16_c00 = 1;
- this->arr_i16_1eb8[15] = puzzlesReadShort();
- this->arr_i16_1eb8[16] = puzzlesReadShort();
- this->arr_i16_1eb8[21] = puzzlesReadShort();
- debugC(5, kDebugLoading, "%d, %d, %04x", this->arr_i16_1eb8[15], this->arr_i16_1eb8[16], this->arr_i16_1eb8[21]);
- this->var_str_384 = puzzlesReadString();
- this->var_str_384 = _zbasic->str(OFF(0)) + this->var_str_384 + _zbasic->str(OFF(1));
- _zbasic->menu(8, 6, 1, this->var_str_384);
- for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- this->arr_i16_3738[i] = puzzlesReadByte();
+ fetchPuzzleData();
+ var_i16_c00 = 1;
+ arr_i16_1eb8[15] = puzzlesReadShort();
+ arr_i16_1eb8[16] = puzzlesReadShort();
+ arr_i16_1eb8[21] = puzzlesReadShort();
+ debugC(5, kDebugLoading, "%d, %d, %04x", arr_i16_1eb8[15], arr_i16_1eb8[16], arr_i16_1eb8[21]);
+ var_str_384 = puzzlesReadString();
+ var_str_384 = _zbasic->str(OFF(0)) + var_str_384 + _zbasic->str(OFF(1));
+ _zbasic->menu(8, 6, 1, var_str_384);
+ for (int i = 1; i <= arr_i16_1eb8[15]; i++) {
+ arr_i16_3738[i] = puzzlesReadByte();
}
// 134:00ce
// rack up polygon information
- _toolbox->SetPort(this->var_i32_f24);
- this->arr_i16_1eb8[20] = 0;
+ _toolbox->SetPort(var_i32_f24);
+ arr_i16_1eb8[20] = 0;
- for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- this->var_i16_103a = puzzlesReadShort();
+ for (int i = 1; i <= arr_i16_1eb8[15]; i++) {
+ var_i16_103a = puzzlesReadShort();
_revealPoly[i] = _toolbox->OpenPoly();
// 134:010e
- for (int j = 5; j <= this->var_i16_103a - 1; j += 2) {
- this->var_i16_484 = puzzlesReadShort();
- this->var_i16_7e4 = puzzlesReadShort();
+ for (int j = 5; j <= var_i16_103a - 1; j += 2) {
+ var_i16_484 = puzzlesReadShort();
+ var_i16_7e4 = puzzlesReadShort();
if (j == 5) {
- _toolbox->MoveTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
+ _toolbox->MoveTo(var_i16_7e4, var_i16_484 + 0xf);
} else {
- _toolbox->LineTo(this->var_i16_7e4, this->var_i16_484 + 0xf);
+ _toolbox->LineTo(var_i16_7e4, var_i16_484 + 0xf);
}
// 134:015c
}
_toolbox->ClosePoly();
- if (i <= this->arr_i16_1eb8[16]) {
- this->arr_i16_1eb8[20] |= _bitLUT[i - 1];
+ if (i <= arr_i16_1eb8[16]) {
+ arr_i16_1eb8[20] |= _bitLUT[i - 1];
}
// 134:01ce
}
// 134:01ea
- _toolbox->SetPort(this->var_i32_0);
+ _toolbox->SetPort(var_i32_0);
- this->arr_i16_1eb8[17] = (0x1c2 / this->arr_i16_1eb8[15]);
- this->arr_i16_1eb8[18] = 0x100 - ((this->arr_i16_1eb8[15] * this->arr_i16_1eb8[17]) / 2);
+ arr_i16_1eb8[17] = (0x1c2 / arr_i16_1eb8[15]);
+ arr_i16_1eb8[18] = 0x100 - ((arr_i16_1eb8[15] * arr_i16_1eb8[17]) / 2);
Common::U32String letters = puzzlesReadString().decode(Common::kMacRoman);
- this->zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- this->zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
+ zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
// 134:02f0
- this->arr_i16_1eb8[19] = _zbasic->decodeInt(_activePuzzleBuffer);
- this->var_i16_1aba = this->arr_i16_1eb8[18];
+ arr_i16_1eb8[19] = _zbasic->decodeInt(_activePuzzleBuffer);
+ var_i16_1aba = arr_i16_1eb8[18];
_zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
- for (this->var_i16_7be = 1; this->var_i16_7be <= this->arr_i16_1eb8[15]; this->var_i16_7be++) {
+ for (var_i16_7be = 1; var_i16_7be <= arr_i16_1eb8[15]; var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
- this->playTone(
+ playTone(
_zbasic->rndInt(0x3e8) + 0x19,
0x28,
1
);
// 134:0352
- _screenGrid[this->var_i16_7be].top = 0x10f;
- _screenGrid[this->var_i16_7be].left = this->var_i16_1aba;
- _screenGrid[this->var_i16_7be].bottom = 0x137;
- _screenGrid[this->var_i16_7be].right = this->var_i16_1aba + this->arr_i16_1eb8[17];
+ _screenGrid[var_i16_7be].top = 0x10f;
+ _screenGrid[var_i16_7be].left = var_i16_1aba;
+ _screenGrid[var_i16_7be].bottom = 0x137;
+ _screenGrid[var_i16_7be].right = var_i16_1aba + arr_i16_1eb8[17];
- this->var_i16_1aba += this->arr_i16_1eb8[17];
+ var_i16_1aba += arr_i16_1eb8[17];
// 134:03fc
- _toolbox->FillRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19, _patterns[0]);
- _toolbox->FrameRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
+ _toolbox->FillRoundRect(_screenGrid[var_i16_7be], 0x19, 0x19, _patterns[0]);
+ _toolbox->FrameRoundRect(_screenGrid[var_i16_7be], 0x19, 0x19);
// 134:0448
- this->var_str_384 = _zbasic->midStr(letters, this->var_i16_7be, 1);
- this->var_i16_7ba = _toolbox->StringWidth(this->var_str_384);
+ var_str_384 = _zbasic->midStr(letters, var_i16_7be, 1);
+ var_i16_7ba = _toolbox->StringWidth(var_str_384);
_toolbox->MoveTo(
- _screenGrid[this->var_i16_7be].left + (this->arr_i16_1eb8[17] / 2) - (this->var_i16_7ba / 2),
+ _screenGrid[var_i16_7be].left + (arr_i16_1eb8[17] / 2) - (var_i16_7ba / 2),
0x127
);
- _toolbox->DrawString(this->var_str_384);
+ _toolbox->DrawString(var_str_384);
// 134:04d6
- if (this->arr_i16_1eb8[19] & _bitLUT[this->arr_i16_3738[this->var_i16_7be] - 1]) {
- this->revealSelectButton();
+ if (arr_i16_1eb8[19] & _bitLUT[arr_i16_3738[var_i16_7be] - 1]) {
+ revealSelectButton();
}
}
// 134:0538
_stateFlags = kStateNull;
- if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
+ if (arr_i16_1eb8[20] == arr_i16_1eb8[19]) {
_activePuzzleSolved = true;
} else {
// 134:0572
@@ -128,76 +128,76 @@ void FoolGame::revealRun() {
// 134:057e
while ((_stateFlags == 0) && (!_activePuzzleSolved)) {
// 134:0582
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->revealOnClick();
+ revealOnClick();
}
- if (this->arr_i16_1eb8[20] == this->arr_i16_1eb8[19]) {
+ if (arr_i16_1eb8[20] == arr_i16_1eb8[19]) {
_activePuzzleSolved = true;
}
}
// 134:05e2
if (_stateFlags == kStateUndo) {
- this->revealReset();
+ revealReset();
}
if (_stateFlags == kStateSaveGame) {
- _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[19]);
- this->saveGame();
+ _activePuzzleBuffer = _zbasic->encodeInt(arr_i16_1eb8[19]);
+ saveGame();
}
// 134:061e
}
// 134:0648
if (_activePuzzleSolved) {
- this->revealSuccess();
+ revealSuccess();
}
- _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[19]);
+ _activePuzzleBuffer = _zbasic->encodeInt(arr_i16_1eb8[19]);
// 134:0678: JMP - [0x8ae]
- for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
+ for (int i = 1; i <= arr_i16_1eb8[15]; i++) {
_toolbox->KillPoly(_revealPoly[i]);
}
}
void FoolGame::revealOnClick() {
// 134:067c
- this->var_i16_7be = 0;
- for (int j = 1; j <= this->arr_i16_1eb8[15]; j++) {
+ var_i16_7be = 0;
+ for (int j = 1; j <= arr_i16_1eb8[15]; j++) {
if (_toolbox->PtInRect(_event.where, _screenGrid[j])) {
- this->var_i16_7be = j;
- j = this->arr_i16_1eb8[15];
+ var_i16_7be = j;
+ j = arr_i16_1eb8[15];
}
}
// 134:06d0
- if (this->var_i16_7be == 0) {
+ if (var_i16_7be == 0) {
return;
}
// 134:06f4
- this->revealSelectButton();
- this->arr_i16_1eb8[19] ^= _bitLUT[this->arr_i16_3738[this->var_i16_7be]-1];
- debugC(5, kDebugLoading, "reveal: %d, %04x, %04x", this->var_i16_7be, this->arr_i16_1eb8[19], this->arr_i16_1eb8[20]);
- this->waitForMouseUp();
+ revealSelectButton();
+ arr_i16_1eb8[19] ^= _bitLUT[arr_i16_3738[var_i16_7be]-1];
+ debugC(5, kDebugLoading, "reveal: %d, %04x, %04x", var_i16_7be, arr_i16_1eb8[19], arr_i16_1eb8[20]);
+ waitForMouseUp();
}
void FoolGame::revealSelectButton() {
// 134:074a
// invert the button
- _toolbox->InvertRoundRect(_screenGrid[this->var_i16_7be], 0x19, 0x19);
- _toolbox->PenPat(_patterns[this->arr_i16_1eb8[21]]);
+ _toolbox->InvertRoundRect(_screenGrid[var_i16_7be], 0x19, 0x19);
+ _toolbox->PenPat(_patterns[arr_i16_1eb8[21]]);
// fill the polygon
_toolbox->PenMode(kPatXor);
- _toolbox->PaintPoly(_revealPoly[this->arr_i16_3738[this->var_i16_7be]]);
+ _toolbox->PaintPoly(_revealPoly[arr_i16_3738[var_i16_7be]]);
_toolbox->PenNormal();
}
void FoolGame::revealReset() {
// 134:07bc
- this->fillRect(0x37, 0x13, 0xff, 0x1ee, 0);
- for (int i = 1; i <= this->arr_i16_1eb8[15]; i++) {
- if (this->arr_i16_1eb8[19] & _bitLUT[this->arr_i16_3738[i]-1]) {
+ fillRect(0x37, 0x13, 0xff, 0x1ee, 0);
+ for (int i = 1; i <= arr_i16_1eb8[15]; i++) {
+ if (arr_i16_1eb8[19] & _bitLUT[arr_i16_3738[i]-1]) {
_toolbox->InvertRoundRect(_screenGrid[i], 0x19, 0x19);
}
}
// 134:085c
- this->arr_i16_1eb8[19] = 0;
+ arr_i16_1eb8[19] = 0;
_stateFlags = kStateNull;
}
@@ -206,9 +206,9 @@ void FoolGame::revealSuccess() {
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
}
- this->menuClickMessage();
- this->waitForMouseUp();
- this->flashRect(0x37, 0x13, 0xff, 0x1ee, 0xc8);
+ menuClickMessage();
+ waitForMouseUp();
+ flashRect(0x37, 0x13, 0xff, 0x1ee, 0xc8);
}
}
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 2345304cd15..4d968c38547 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -34,67 +34,67 @@ namespace Fool {
// sentence join game
void FoolGame::sentenceRun() {
// 135:0004
- this->fetchPuzzleData();
- this->var_i16_c00 = 1;
- this->arr_i16_3738[0] = 0xbf;
- this->arr_i16_3738[2] = 0xe1;
- this->arr_i16_3738[4] = 0xbf;
- this->arr_i16_3738[5] = 0;
- this->arr_i16_3738[6] = 0xe1;
- this->arr_i16_3738[7] = SCREEN_WIDTH;
- this->arr_i16_3738[8] = 0xf2;
- this->arr_i16_3738[0xa] = SCREEN_HEIGHT;
- this->arr_i16_3738[0xc] = MENU_HEIGHT;
- this->arr_i16_3738[0xd] = 0;
- this->arr_i16_3738[0xe] = SCREEN_HEIGHT;
- this->arr_i16_3738[0xf] = SCREEN_WIDTH;
+ fetchPuzzleData();
+ var_i16_c00 = 1;
+ arr_i16_3738[0] = 0xbf;
+ arr_i16_3738[2] = 0xe1;
+ arr_i16_3738[4] = 0xbf;
+ arr_i16_3738[5] = 0;
+ arr_i16_3738[6] = 0xe1;
+ arr_i16_3738[7] = SCREEN_WIDTH;
+ arr_i16_3738[8] = 0xf2;
+ arr_i16_3738[0xa] = SCREEN_HEIGHT;
+ arr_i16_3738[0xc] = MENU_HEIGHT;
+ arr_i16_3738[0xd] = 0;
+ arr_i16_3738[0xe] = SCREEN_HEIGHT;
+ arr_i16_3738[0xf] = SCREEN_WIDTH;
// 135:00ce
- this->arr_i32_192c0[0] = _toolbox->GetPicture(puzzlesReadShort());
- this->arr_i16_1eb8[0] = puzzlesReadShort();
+ arr_i32_192c0[0] = _toolbox->GetPicture(puzzlesReadShort());
+ arr_i16_1eb8[0] = puzzlesReadShort();
_zbasic->indexRawSet(puzzlesReadString(), 1, 0);
_sentenceGoal = puzzlesReadString().decode(Common::kMacRoman);
Common::U32String menuStr = puzzlesReadString().decode(Common::kMacRoman);
menuStr = _zbasic->str(OFF(0)) + menuStr + _zbasic->str(OFF(1)); // to reveal XXXXX
// 135:0152
_zbasic->menu(8, 7, 1, menuStr);
- this->arr_i16_1eb8[1] = 0x1c2 / this->arr_i16_1eb8[0];
- this->arr_i16_1eb8[2] = (SCREEN_WIDTH/2) - ((this->arr_i16_1eb8[0] * this->arr_i16_1eb8[1]) / 2);
+ arr_i16_1eb8[1] = 0x1c2 / arr_i16_1eb8[0];
+ arr_i16_1eb8[2] = (SCREEN_WIDTH/2) - ((arr_i16_1eb8[0] * arr_i16_1eb8[1]) / 2);
// 135:01e2
- int16 buttonGridX = this->arr_i16_1eb8[2];
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_4338[i] = 0;
- this->arr_i16_4338[i + this->arr_i16_1eb8[0]] = puzzlesReadByte();
+ int16 buttonGridX = arr_i16_1eb8[2];
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ arr_i16_4338[i] = 0;
+ arr_i16_4338[i + arr_i16_1eb8[0]] = puzzlesReadByte();
_zbasic->indexRawSet(puzzlesReadString(), 1, i);
// 135:0254
- _zbasic->indexRawSet(puzzlesReadString(), 1, i + this->arr_i16_1eb8[0]);
+ _zbasic->indexRawSet(puzzlesReadString(), 1, i + arr_i16_1eb8[0]);
_screenGrid[i].top = 0xf2;
_screenGrid[i].left = buttonGridX;
_screenGrid[i].bottom = SCREEN_HEIGHT;
- _screenGrid[i].right = buttonGridX + this->arr_i16_1eb8[1];
+ _screenGrid[i].right = buttonGridX + arr_i16_1eb8[1];
// 135:030c
- buttonGridX += this->arr_i16_1eb8[1];
+ buttonGridX += arr_i16_1eb8[1];
}
// 135:0348
- _zbasic->picture(0, MENU_HEIGHT, this->arr_i32_192c0[0]);
- _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
- Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
+ _zbasic->picture(0, MENU_HEIGHT, arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(arr_i32_192c0[0]);
+ Common::Rect temp(arr_i16_3738[5], arr_i16_3738[4], arr_i16_3738[7], arr_i16_3738[6]);
_toolbox->FillRect(temp, _patterns[2]);
- this->arr_i16_1eb8[4] = 0;
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ arr_i16_1eb8[4] = 0;
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
// 135:03a4
if (_activePuzzleBuffer.empty()) { // was: str(OFF(2))
- this->arr_i16_4338[i] = 1;
+ arr_i16_4338[i] = 1;
} else {
// 135:03d4
- this->arr_i16_4338[i] = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, i, 1));
+ arr_i16_4338[i] = _zbasic->castInt(_zbasic->midStr(_activePuzzleBuffer, i, 1));
}
// 135:0408
- if (this->arr_i16_4338[i] == 1) {
- this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, true);
- this->sentenceDrawButton(i);
+ if (arr_i16_4338[i] == 1) {
+ playTone(_zbasic->rndInt(1000) + 0x19, 0x28, true);
+ sentenceDrawButton(i);
}
// 135:044a
}
@@ -103,18 +103,18 @@ void FoolGame::sentenceRun() {
_sentenceBuffer = _zbasic->index(1, 0);
} else {
// 135:049a
- this->var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+1, 2));
- _sentenceBuffer = _zbasic->midStr(_activePuzzleBuffer, this->arr_i16_1eb8[0]+3, this->var_i16_1372).decode(Common::kMacRoman);
+ var_i16_1372 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, arr_i16_1eb8[0]+1, 2));
+ _sentenceBuffer = _zbasic->midStr(_activePuzzleBuffer, arr_i16_1eb8[0]+3, var_i16_1372).decode(Common::kMacRoman);
}
// 135:04f2
- this->sentenceDrawBuffer();
+ sentenceDrawBuffer();
_stateFlags = kStateNull;
_activePuzzleSolved = _sentenceBuffer == _sentenceGoal;
// 135:0520
do {
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->sentenceOnClick();
+ sentenceOnClick();
}
// 135:0538
if (_sentenceBuffer == _sentenceGoal) {
@@ -128,7 +128,7 @@ void FoolGame::sentenceRun() {
// 135:0566
if (_stateFlags == kStateSaveGame) {
sentenceStoreState();
- this->saveGame();
+ saveGame();
}
// 135:0578
} while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved));
@@ -142,20 +142,20 @@ void FoolGame::sentenceRun() {
void FoolGame::sentenceOnClick() {
// 135:05b6
- this->var_i16_1abc = 0;
- if ((_event.where.x < this->arr_i16_1eb8[2]) || (_event.where.y < 0xf2))
+ var_i16_1abc = 0;
+ if ((_event.where.x < arr_i16_1eb8[2]) || (_event.where.y < 0xf2))
return;
// determine which button was clicked on
- int16 index = ((_event.where.x - this->arr_i16_1eb8[2]) / this->arr_i16_1eb8[1]) + 1;
+ int16 index = ((_event.where.x - arr_i16_1eb8[2]) / arr_i16_1eb8[1]) + 1;
// 135:0632
- if ((index > this->arr_i16_1eb8[0]) || (this->arr_i16_4338[index] == 0))
+ if ((index > arr_i16_1eb8[0]) || (arr_i16_4338[index] == 0))
return;
// 135:0676
- this->arr_i16_4338[index] = 0;
+ arr_i16_4338[index] = 0;
_toolbox->FillOval(_screenGrid[index], _patterns[2]);
// 135:06aa
- switch (this->arr_i16_4338[index + this->arr_i16_1eb8[0]]-1) {
+ switch (arr_i16_4338[index + arr_i16_1eb8[0]]-1) {
case 0:
sentenceAddLeft(index);
break;
@@ -175,15 +175,15 @@ void FoolGame::sentenceOnClick() {
warning("sentenceOnClick: breaking out of switch");
break;
}
- this->sentenceDrawBuffer();
- this->waitForMouseUp();
+ sentenceDrawBuffer();
+ waitForMouseUp();
if (_sentenceBuffer == _sentenceGoal) {
return;
}
// 135:0714
bool buttonsRemaining = false;
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- if (this->arr_i16_4338[i] != 0) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ if (arr_i16_4338[i] != 0) {
buttonsRemaining = true;
}
}
@@ -194,12 +194,12 @@ void FoolGame::sentenceOnClick() {
_zbasic->text(kFontChicago, 0xc, 0, kSrcBic);
drawTextCenter(_zbasic->str(OFF(4)), 0x124); // click mouse to reset puzzle
- this->waitForMouseUp();
- this->var_i16_1abc = 1;
+ waitForMouseUp();
+ var_i16_1abc = 1;
_stateFlags = kNullEvent;
// 135:07a0
while ((_event.modifiers & kModMouseButtonUp) && (_stateFlags == kNullEvent)) {
- this->getNextEvent(-1);
+ getNextEvent(-1);
}
// 135:07c8
if (_stateFlags == kNullEvent) {
@@ -221,24 +221,24 @@ void FoolGame::sentenceAddLeftRight(int16 index) {
// 135:0813
_sentenceBuffer = _zbasic->index(1, index)
+ _sentenceBuffer
- + _zbasic->index(1, index + this->arr_i16_1eb8[0]);
+ + _zbasic->index(1, index + arr_i16_1eb8[0]);
}
void FoolGame::sentenceReplace(int16 index) {
// 135:086a
- this->var_i16_9f2 = _zbasic->index(1, index).size();
+ var_i16_9f2 = _zbasic->index(1, index).size();
while (true) {
// 135:0884
int16 length = _sentenceBuffer.size();
- this->var_i16_1abe = _zbasic->instr(1, _sentenceBuffer, _zbasic->index(1, index));
- if (this->var_i16_1abe == 0)
+ var_i16_1abe = _zbasic->instr(1, _sentenceBuffer, _zbasic->index(1, index));
+ if (var_i16_1abe == 0)
return;
// 135:08bc
- if ((length - this->var_i16_1abe + 1 - this->var_i16_9f2) < 0)
+ if ((length - var_i16_1abe + 1 - var_i16_9f2) < 0)
return;
- _sentenceBuffer = _zbasic->leftStr(_sentenceBuffer, this->var_i16_1abe - 1)
- + _zbasic->index(1, index + this->arr_i16_1eb8[0])
- + _zbasic->rightStr(_sentenceBuffer, length - this->var_i16_1abe + 1 - this->var_i16_9f2);
+ _sentenceBuffer = _zbasic->leftStr(_sentenceBuffer, var_i16_1abe - 1)
+ + _zbasic->index(1, index + arr_i16_1eb8[0])
+ + _zbasic->rightStr(_sentenceBuffer, length - var_i16_1abe + 1 - var_i16_9f2);
}
// should never reach here
}
@@ -254,15 +254,15 @@ void FoolGame::sentenceReverse() {
void FoolGame::sentenceUndo() {
// 135:09ba
- this->arr_i16_1eb8[4] = 0;
- Common::Rect temp(this->arr_i16_3738[5], this->arr_i16_3738[4], this->arr_i16_3738[7], this->arr_i16_3738[6]);
+ arr_i16_1eb8[4] = 0;
+ Common::Rect temp(arr_i16_3738[5], arr_i16_3738[4], arr_i16_3738[7], arr_i16_3738[6]);
_toolbox->FillRect(temp, _patterns[2]);
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->arr_i16_4338[i] = 1;
- this->sentenceDrawButton(i);
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ arr_i16_4338[i] = 1;
+ sentenceDrawButton(i);
}
_sentenceBuffer = _zbasic->index(1, 0);
- this->sentenceDrawBuffer();
+ sentenceDrawBuffer();
}
void FoolGame::sentenceDrawButton(int16 gridIndex) {
@@ -272,7 +272,7 @@ void FoolGame::sentenceDrawButton(int16 gridIndex) {
int16 width = _toolbox->StringWidth(buf);
_toolbox->FillOval(_screenGrid[gridIndex], _patterns[0]);
_toolbox->FrameOval(_screenGrid[gridIndex]);
- _toolbox->MoveTo(_screenGrid[gridIndex].left + (this->arr_i16_1eb8[1] / 2) - (width / 2), 0x129);
+ _toolbox->MoveTo(_screenGrid[gridIndex].left + (arr_i16_1eb8[1] / 2) - (width / 2), 0x129);
_toolbox->DrawString(buf);
}
@@ -280,15 +280,15 @@ void FoolGame::sentenceDrawBuffer() {
// 135:0b16
_zbasic->text(kFontLarge, 0x18, 0, kSrcOr);
int16 width = _toolbox->StringWidth(_sentenceBuffer);
- if (width < this->arr_i16_1eb8[4]) {
- width = this->arr_i16_1eb8[4];
+ if (width < arr_i16_1eb8[4]) {
+ width = arr_i16_1eb8[4];
} else {
- this->arr_i16_1eb8[4] = width;
+ arr_i16_1eb8[4] = width;
}
// 135:0b80
- this->arr_i16_3738[1] = 0xf6 - (width / 2);
- this->arr_i16_3738[3] = 0x109 + (width / 2);
- Common::Rect temp(this->arr_i16_3738[1], this->arr_i16_3738[0], this->arr_i16_3738[3], this->arr_i16_3738[2]);
+ arr_i16_3738[1] = 0xf6 - (width / 2);
+ arr_i16_3738[3] = 0x109 + (width / 2);
+ Common::Rect temp(arr_i16_3738[1], arr_i16_3738[0], arr_i16_3738[3], arr_i16_3738[2]);
_toolbox->FillRect(temp, _patterns[0]);
_toolbox->MoveTo(0x100 - (width / 2), 0xd9);
_toolbox->DrawString(_sentenceBuffer);
@@ -297,34 +297,34 @@ void FoolGame::sentenceDrawBuffer() {
void FoolGame::sentenceStoreState() {
// 135:0c1c
_activePuzzleBuffer.clear(); // was: str(OFF(7))
- if (this->var_i16_1abc != 0) {
- this->var_i16_1abc = 0;
+ if (var_i16_1abc != 0) {
+ var_i16_1abc = 0;
return;
}
// 135:0c44
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- Common::U32String buf = Common::U32String::format("%d", this->arr_i16_4338[i]);
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ Common::U32String buf = Common::U32String::format("%d", arr_i16_4338[i]);
buf = _zbasic->rightStr(buf, 1);
_activePuzzleBuffer += buf;
}
// 135:0cba
Common::String temp = _sentenceBuffer.encode(Common::kMacRoman);
- this->var_i16_1372 = (int16)temp.size();
- _activePuzzleBuffer += _zbasic->encodeInt(this->var_i16_1372) + temp;
+ var_i16_1372 = (int16)temp.size();
+ _activePuzzleBuffer += _zbasic->encodeInt(var_i16_1372) + temp;
}
void FoolGame::sentenceSuccess() {
// 135:0cee
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
- this->playTone(_zbasic->rndInt(1000) + 0x19, 0x28, false);
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
+ playTone(_zbasic->rndInt(1000) + 0x19, 0x28, false);
}
}
// 135:0d40
- this->menuClickMessage();
- this->waitForMouseUp();
- this->flashRect(this->arr_i16_3738[0], this->arr_i16_3738[1], this->arr_i16_3738[2], this->arr_i16_3738[3], 0x64);
+ menuClickMessage();
+ waitForMouseUp();
+ flashRect(arr_i16_3738[0], arr_i16_3738[1], arr_i16_3738[2], arr_i16_3738[3], 0x64);
}
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index f54de217a81..9d10a5f7e8d 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -31,72 +31,72 @@ namespace Fool {
// The Sun's map
void FoolGame::sunMapRun() {
// 137:0004
- this->var_i16_c00 = 1;
- this->fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
- this->arr_i16_1eb8[0] = 9;
- this->arr_i16_1eb8[1] = 9;
- this->arr_i16_1eb8[4] = 0x4b;
- this->arr_i16_1eb8[5] = -9;
- this->arr_i16_1eb8[6] = 0x23;
- this->arr_i16_1eb8[7] = 0x23;
- this->var_i16_484 = 0;
+ var_i16_c00 = 1;
+ fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ arr_i16_1eb8[0] = 9;
+ arr_i16_1eb8[1] = 9;
+ arr_i16_1eb8[4] = 0x4b;
+ arr_i16_1eb8[5] = -9;
+ arr_i16_1eb8[6] = 0x23;
+ arr_i16_1eb8[7] = 0x23;
+ var_i16_484 = 0;
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
for (int16 i = 0x6e; i <= 0x186; i += 0x23) {
- this->var_i16_484++;
- _toolbox->SetRect(_screenGrid[this->var_i16_484], i, j, i+0x24, j+0x24);
+ var_i16_484++;
+ _toolbox->SetRect(_screenGrid[var_i16_484], i, j, i+0x24, j+0x24);
}
}
// 137:00fa
- this->var_i16_484 = 0;
+ var_i16_484 = 0;
for (int16 j = 1; j <= 9; j++) {
for (int16 i = 1; i <= 9; i++) {
- this->var_i16_484++;
- this->arr_i16_2f38[i*32 + j] = this->var_i16_484;
+ var_i16_484++;
+ arr_i16_2f38[i*32 + j] = var_i16_484;
}
}
// 137:0148
for (int i = 1; i <= 0x51; i++) {
- this->var_i16_484 = this->arr_i16_4c7c[i];
- if ((_puzzleFlags[this->var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled)) != 0) {
- this->arr_i32_192c0[i] = _sunMapTilePic[i];
+ var_i16_484 = arr_i16_4c7c[i];
+ if ((_puzzleFlags[var_i16_484] & (kFlagMenuDiamond | kFlagMenuEnabled)) != 0) {
+ arr_i32_192c0[i] = _sunMapTilePic[i];
} else {
// 137:01b2
- this->arr_i32_192c0[i] = _sunMapTilePic[0x52];
+ arr_i32_192c0[i] = _sunMapTilePic[0x52];
}
// 137:01d8
- if ((_puzzleFlags[this->var_i16_484] & 4) != 0) {
- _puzzleFlags[this->var_i16_484] ^= 4;
+ if ((_puzzleFlags[var_i16_484] & 4) != 0) {
+ _puzzleFlags[var_i16_484] ^= 4;
_puzzleFlags[i] |= kFlagMapTile;
}
// 137:0252
if ((_puzzleFlags[i] & kFlagMapTile) != 0) {
- this->arr_i32_192c0[i] = _sunMapTilePic[0x53];
+ arr_i32_192c0[i] = _sunMapTilePic[0x53];
}
// 137:0294
}
// 137:02a2
- this->fillRect(0x14, 0x67, 0x156, 0x1b1, 2);
+ fillRect(0x14, 0x67, 0x156, 0x1b1, 2);
for (int i = 1; i <= 0x51; i++) {
- _zbasic->picture(_screenGrid[i].left, _screenGrid[i].top, this->arr_i32_192c0[_sunMapTileID[i]]);
+ _zbasic->picture(_screenGrid[i].left, _screenGrid[i].top, arr_i32_192c0[_sunMapTileID[i]]);
}
// 137:0336
_stateFlags = kStateNull;
_zbasic->menu(8, 3, 0, Common::U32String());
_toolbox->InitCursor();
- this->sunMapCheckIfSolved();
+ sunMapCheckIfSolved();
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == kMouseDown) {
- this->sunMapOnClick();
+ sunMapOnClick();
}
}
// 137:038a
if (_stateFlags == kStateUndo) {
- this->sunMapUndoMove();
+ sunMapUndoMove();
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
}
// 137:03ce
@@ -104,7 +104,7 @@ void FoolGame::sunMapRun() {
return;
}
// JMP 0x1618
- this->var_i16_68c = 0;
+ var_i16_68c = 0;
for (int j = 0; j <= 5; j++) {
for (int i = 1; i <= 0x51; i++) {
_toolbox->InvertRect(_screenGrid[i]);
@@ -127,9 +127,9 @@ void FoolGame::sunMapRun() {
void FoolGame::sunMapOnClick() {
// 137:03e2
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- if ((this->var_i16_68a < 1) || (this->var_i16_68a > this->arr_i16_1eb8[0]) ||
- (this->var_i16_68c < 1) || (this->var_i16_68c > this->arr_i16_1eb8[1])) {
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) ||
+ (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
return;
}
// 137:0466
@@ -138,22 +138,22 @@ void FoolGame::sunMapOnClick() {
_toolbox->PenNormal();
_toolbox->PenSize(3, 3);
_toolbox->PenMode(kPatXor);
- this->arr_i16_4758[0] = this->var_i16_68a;
- this->arr_i16_4758[1] = this->var_i16_68c;
- if (_puzzleFlags[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] & kFlagMapTile) {
- this->sunMapRevealPiece();
+ arr_i16_4758[0] = var_i16_68a;
+ arr_i16_4758[1] = var_i16_68c;
+ if (_puzzleFlags[_sunMapTileID[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]]] & kFlagMapTile) {
+ sunMapRevealPiece();
return;
}
- this->sunMapDragSelect();
+ sunMapDragSelect();
// 137:0506
- _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->arr_i16_4758[0] -= this->var_i16_68a;
- this->arr_i16_4758[1] -= this->var_i16_68c;
- this->sunMapMoveSelected();
- _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->sunMapDropSelected();
- this->sunMapCheckIfSolved();
- this->waitForMouseUp();
+ _toolbox->FrameRect(Common::Rect(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]));
+ arr_i16_4758[0] -= var_i16_68a;
+ arr_i16_4758[1] -= var_i16_68c;
+ sunMapMoveSelected();
+ _toolbox->FrameRect(Common::Rect(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]));
+ sunMapDropSelected();
+ sunMapCheckIfSolved();
+ waitForMouseUp();
_zbasic->menu(8, 3, 1, Common::U32String());
_menuDisabled = false;
}
@@ -161,36 +161,36 @@ void FoolGame::sunMapOnClick() {
void FoolGame::sunMapDragSelect() {
// 137:0598
do {
- this->getNextEvent(4);
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
- if (this->var_i16_68a >= this->arr_i16_4758[0]) {
- this->arr_i16_4758[2] = this->arr_i16_4758[0];
- this->arr_i16_4758[3] = this->var_i16_68a;
+ getNextEvent(4);
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ sub_128_342(var_i16_68a, var_i16_68c);
+ if (var_i16_68a >= arr_i16_4758[0]) {
+ arr_i16_4758[2] = arr_i16_4758[0];
+ arr_i16_4758[3] = var_i16_68a;
} else {
// 137:061a
- this->arr_i16_4758[2] = this->var_i16_68a;
- this->arr_i16_4758[3] = this->arr_i16_4758[0];
+ arr_i16_4758[2] = var_i16_68a;
+ arr_i16_4758[3] = arr_i16_4758[0];
}
// 137:064a
- if (this->var_i16_68c >= this->arr_i16_4758[1]) {
- this->arr_i16_4758[6] = this->arr_i16_4758[1];
- this->arr_i16_4758[7] = this->var_i16_68c;
+ if (var_i16_68c >= arr_i16_4758[1]) {
+ arr_i16_4758[6] = arr_i16_4758[1];
+ arr_i16_4758[7] = var_i16_68c;
} else {
// 137:069e
- this->arr_i16_4758[6] = this->var_i16_68c;
- this->arr_i16_4758[7] = this->arr_i16_4758[1];
+ arr_i16_4758[6] = var_i16_68c;
+ arr_i16_4758[7] = arr_i16_4758[1];
}
// 137:06ce
- this->arr_i16_4758[11] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].top;
- this->arr_i16_4758[12] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[2]*32 + this->arr_i16_4758[6]]].left;
- this->arr_i16_4758[13] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].bottom;
- this->arr_i16_4758[14] = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[3]*32 + this->arr_i16_4758[7]]].right;
+ arr_i16_4758[11] = _screenGrid[arr_i16_2f38[arr_i16_4758[2]*32 + arr_i16_4758[6]]].top;
+ arr_i16_4758[12] = _screenGrid[arr_i16_2f38[arr_i16_4758[2]*32 + arr_i16_4758[6]]].left;
+ arr_i16_4758[13] = _screenGrid[arr_i16_2f38[arr_i16_4758[3]*32 + arr_i16_4758[7]]].bottom;
+ arr_i16_4758[14] = _screenGrid[arr_i16_2f38[arr_i16_4758[3]*32 + arr_i16_4758[7]]].right;
// 137:084c
- _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->delay(2);
- _toolbox->FrameRect(Common::Rect(this->arr_i16_4758[12], this->arr_i16_4758[11], this->arr_i16_4758[14], this->arr_i16_4758[13]));
- this->delay(1);
+ _toolbox->FrameRect(Common::Rect(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]));
+ delay(2);
+ _toolbox->FrameRect(Common::Rect(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]));
+ delay(1);
} while (_event.what != kMouseUp);
// 137:087e
}
@@ -198,110 +198,110 @@ void FoolGame::sunMapDragSelect() {
void FoolGame::sunMapMoveSelected() {
// 137:0880
do {
- this->getNextEvent(2);
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- this->sub_128_342(this->var_i16_68a, this->var_i16_68c);
- if (this->arr_i16_4758[0] >= 0) {
- this->arr_i16_4758[4] = this->var_i16_68a;
- this->arr_i16_4758[5] = this->var_i16_68a + this->arr_i16_4758[0];
+ getNextEvent(2);
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ sub_128_342(var_i16_68a, var_i16_68c);
+ if (arr_i16_4758[0] >= 0) {
+ arr_i16_4758[4] = var_i16_68a;
+ arr_i16_4758[5] = var_i16_68a + arr_i16_4758[0];
} else {
// 137:0900
- this->arr_i16_4758[4] = this->var_i16_68a + this->arr_i16_4758[0];
- this->arr_i16_4758[5] = this->var_i16_68a;
+ arr_i16_4758[4] = var_i16_68a + arr_i16_4758[0];
+ arr_i16_4758[5] = var_i16_68a;
}
// 137:093c
- if (this->arr_i16_4758[1] >= 0) {
- this->arr_i16_4758[8] = this->var_i16_68c;
- this->arr_i16_4758[9] = this->var_i16_68c + this->arr_i16_4758[1];
+ if (arr_i16_4758[1] >= 0) {
+ arr_i16_4758[8] = var_i16_68c;
+ arr_i16_4758[9] = var_i16_68c + arr_i16_4758[1];
} else {
// 137:098e
- this->arr_i16_4758[8] = this->var_i16_68c + this->arr_i16_4758[1];
- this->arr_i16_4758[9] = this->var_i16_68c;
+ arr_i16_4758[8] = var_i16_68c + arr_i16_4758[1];
+ arr_i16_4758[9] = var_i16_68c;
}
// 137:09ca
- if (this->arr_i16_4758[4] < 1) {
- this->arr_i16_4758[4] = 1;
- this->arr_i16_4758[5] = 1 + ABS(this->arr_i16_4758[0]);
+ if (arr_i16_4758[4] < 1) {
+ arr_i16_4758[4] = 1;
+ arr_i16_4758[5] = 1 + ABS(arr_i16_4758[0]);
}
// 137:0a2e
- if (this->arr_i16_4758[8] < 1) {
- this->arr_i16_4758[8] = 1;
- this->arr_i16_4758[9] = 1 + ABS(this->arr_i16_4758[1]);
+ if (arr_i16_4758[8] < 1) {
+ arr_i16_4758[8] = 1;
+ arr_i16_4758[9] = 1 + ABS(arr_i16_4758[1]);
}
// 137:0a92
- if (this->arr_i16_4758[5] > this->arr_i16_1eb8[0]) {
- this->arr_i16_4758[4] = this->arr_i16_1eb8[0] - ABS(this->arr_i16_4758[0]);
- this->arr_i16_4758[5] = this->arr_i16_1eb8[0];
+ if (arr_i16_4758[5] > arr_i16_1eb8[0]) {
+ arr_i16_4758[4] = arr_i16_1eb8[0] - ABS(arr_i16_4758[0]);
+ arr_i16_4758[5] = arr_i16_1eb8[0];
}
// 137:0b20
- if (this->arr_i16_4758[9] > this->arr_i16_1eb8[1]) {
- this->arr_i16_4758[8] = this->arr_i16_1eb8[1] - ABS(this->arr_i16_4758[1]);
- this->arr_i16_4758[9] = this->arr_i16_1eb8[1];
+ if (arr_i16_4758[9] > arr_i16_1eb8[1]) {
+ arr_i16_4758[8] = arr_i16_1eb8[1] - ABS(arr_i16_4758[1]);
+ arr_i16_4758[9] = arr_i16_1eb8[1];
}
// 137:0bae
- this->arr_rect_4776.top = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].top;
- this->arr_rect_4776.left = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[4]*32 + this->arr_i16_4758[8]]].left;
- this->arr_rect_4776.bottom = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].bottom;
- this->arr_rect_4776.right = _screenGrid[this->arr_i16_2f38[this->arr_i16_4758[5]*32 + this->arr_i16_4758[9]]].right;
- _toolbox->FrameRect(this->arr_rect_4776);
- this->delay(2);
- _toolbox->FrameRect(this->arr_rect_4776);
- this->delay(1);
+ arr_rect_4776.top = _screenGrid[arr_i16_2f38[arr_i16_4758[4]*32 + arr_i16_4758[8]]].top;
+ arr_rect_4776.left = _screenGrid[arr_i16_2f38[arr_i16_4758[4]*32 + arr_i16_4758[8]]].left;
+ arr_rect_4776.bottom = _screenGrid[arr_i16_2f38[arr_i16_4758[5]*32 + arr_i16_4758[9]]].bottom;
+ arr_rect_4776.right = _screenGrid[arr_i16_2f38[arr_i16_4758[5]*32 + arr_i16_4758[9]]].right;
+ _toolbox->FrameRect(arr_rect_4776);
+ delay(2);
+ _toolbox->FrameRect(arr_rect_4776);
+ delay(1);
} while (_event.what != kMouseDown);
}
void FoolGame::sunMapUndoMove() {
// 137:0d60
_stateFlags = kStateNull;
- _zbasic->swapInt(this->arr_i16_4758[2], this->arr_i16_4758[4]);
- _zbasic->swapInt(this->arr_i16_4758[3], this->arr_i16_4758[5]);
- _zbasic->swapInt(this->arr_i16_4758[6], this->arr_i16_4758[8]);
- _zbasic->swapInt(this->arr_i16_4758[7], this->arr_i16_4758[9]);
- this->sunMapDropSelected();
+ _zbasic->swapInt(arr_i16_4758[2], arr_i16_4758[4]);
+ _zbasic->swapInt(arr_i16_4758[3], arr_i16_4758[5]);
+ _zbasic->swapInt(arr_i16_4758[6], arr_i16_4758[8]);
+ _zbasic->swapInt(arr_i16_4758[7], arr_i16_4758[9]);
+ sunMapDropSelected();
}
void FoolGame::sunMapDropSelected() {
// 137:0dde
- this->var_i16_1aa4 = 0x51;
- for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
- for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
- this->var_i16_1aa4++;
- this->arr_i16_3738[this->var_i16_1aa4] = _sunMapTileID[this->arr_i16_2f38[i*32 + j]];
+ var_i16_1aa4 = 0x51;
+ for (int j = arr_i16_4758[6]; j <= arr_i16_4758[7]; j++) {
+ for (int i = arr_i16_4758[2]; i <= arr_i16_4758[3]; i++) {
+ var_i16_1aa4++;
+ arr_i16_3738[var_i16_1aa4] = _sunMapTileID[arr_i16_2f38[i*32 + j]];
// 137:0e5a
- _sunMapTileID[this->arr_i16_2f38[i*32 + j]] = 0;
+ _sunMapTileID[arr_i16_2f38[i*32 + j]] = 0;
}
}
// 137:0ec2
- this->var_i16_1aa6 = this->var_i16_1aa4;
- this->var_i16_1aa4 = 0x51;
- for (int j = this->arr_i16_4758[8]; j <= this->arr_i16_4758[9]; j++) {
- for (int i = this->arr_i16_4758[4]; i <= this->arr_i16_4758[5]; i++) {
- this->var_i16_1aa4++;
- if (_sunMapTileID[this->arr_i16_2f38[i*32 + j]] > 0) {
- this->var_i16_1aa6++;
- this->arr_i16_3738[this->var_i16_1aa6] = _sunMapTileID[this->arr_i16_2f38[i*32 + j]];
+ var_i16_1aa6 = var_i16_1aa4;
+ var_i16_1aa4 = 0x51;
+ for (int j = arr_i16_4758[8]; j <= arr_i16_4758[9]; j++) {
+ for (int i = arr_i16_4758[4]; i <= arr_i16_4758[5]; i++) {
+ var_i16_1aa4++;
+ if (_sunMapTileID[arr_i16_2f38[i*32 + j]] > 0) {
+ var_i16_1aa6++;
+ arr_i16_3738[var_i16_1aa6] = _sunMapTileID[arr_i16_2f38[i*32 + j]];
}
// 137:0f7c
- _sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa4];
+ _sunMapTileID[arr_i16_2f38[i*32 + j]] = arr_i16_3738[var_i16_1aa4];
_zbasic->picture(
- _screenGrid[this->arr_i16_2f38[i*32 + j]].left,
- _screenGrid[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
+ _screenGrid[arr_i16_2f38[i*32 + j]].left,
+ _screenGrid[arr_i16_2f38[i*32 + j]].top,
+ arr_i32_192c0[_sunMapTileID[arr_i16_2f38[i*32 + j]]]
);
}
}
- this->var_i16_1aa6 = this->var_i16_1aa4;
- for (int j = this->arr_i16_4758[6]; j <= this->arr_i16_4758[7]; j++) {
- for (int i = this->arr_i16_4758[2]; i <= this->arr_i16_4758[3]; i++) {
- if (_sunMapTileID[this->arr_i16_2f38[i*32 + j]] == 0) {
+ var_i16_1aa6 = var_i16_1aa4;
+ for (int j = arr_i16_4758[6]; j <= arr_i16_4758[7]; j++) {
+ for (int i = arr_i16_4758[2]; i <= arr_i16_4758[3]; i++) {
+ if (_sunMapTileID[arr_i16_2f38[i*32 + j]] == 0) {
// 137:1114
- this->var_i16_1aa6++;
- _sunMapTileID[this->arr_i16_2f38[i*32 + j]] = this->arr_i16_3738[this->var_i16_1aa6];
+ var_i16_1aa6++;
+ _sunMapTileID[arr_i16_2f38[i*32 + j]] = arr_i16_3738[var_i16_1aa6];
_zbasic->picture(
- _screenGrid[this->arr_i16_2f38[i*32 + j]].left,
- _screenGrid[this->arr_i16_2f38[i*32 + j]].top,
- this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[i*32 + j]]]
+ _screenGrid[arr_i16_2f38[i*32 + j]].left,
+ _screenGrid[arr_i16_2f38[i*32 + j]].top,
+ arr_i32_192c0[_sunMapTileID[arr_i16_2f38[i*32 + j]]]
);
}
// 137:1214
@@ -323,8 +323,8 @@ void FoolGame::sunMapCheckIfSolved() {
// 137:128e
if (_activePuzzleSolved) {
for (int i = 1; i <= 0x51; i++) {
- this->var_i16_484 = this->arr_i16_4c7c[i];
- if ((_puzzleFlags[this->var_i16_484] & kFlagMapTile) || (_puzzleFlags[this->var_i16_484] == kFlagMenuDisabled)) {
+ var_i16_484 = arr_i16_4c7c[i];
+ if ((_puzzleFlags[var_i16_484] & kFlagMapTile) || (_puzzleFlags[var_i16_484] == kFlagMenuDisabled)) {
_activePuzzleSolved = false;
i = 0x51;
}
@@ -339,36 +339,36 @@ void FoolGame::sunMapCheckIfSolved() {
void FoolGame::sunMapRevealPiece() {
// 137:131a
- _puzzleFlags[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] ^= kFlagMapTile;
- this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]] = _sunMapTilePic[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]]];
+ _puzzleFlags[_sunMapTileID[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]]] ^= kFlagMapTile;
+ arr_i32_192c0[_sunMapTileID[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]]] = _sunMapTilePic[_sunMapTileID[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]]];
// 137:142c
// unrolled loop
- this->arr_i16_4758[0] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top;
- this->arr_i16_4758[1] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left;
- this->arr_i16_4758[2] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].bottom;
- this->arr_i16_4758[3] = _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].right;
+ arr_i16_4758[0] = _screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]].top;
+ arr_i16_4758[1] = _screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]].left;
+ arr_i16_4758[2] = _screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]].bottom;
+ arr_i16_4758[3] = _screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]].right;
// 137:1490
for (int16 i = 0; i <= 0xf; i++) {
- this->arr_i16_4758[0] += i;
- this->arr_i16_4758[1] += i;
- this->arr_i16_4758[2] -= i;
- this->arr_i16_4758[3] -= i;
+ arr_i16_4758[0] += i;
+ arr_i16_4758[1] += i;
+ arr_i16_4758[2] -= i;
+ arr_i16_4758[3] -= i;
Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
_toolbox->FrameRect(temp);
- this->delay(1);
+ delay(1);
}
// 137:1550
_zbasic->picture(
- _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].left,
- _screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]].top,
- this->arr_i32_192c0[_sunMapTileID[this->arr_i16_2f38[this->var_i16_68a*32+this->var_i16_68c]]]
+ _screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]].left,
+ _screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]].top,
+ arr_i32_192c0[_sunMapTileID[arr_i16_2f38[var_i16_68a*32+var_i16_68c]]]
);
- this->waitForMouseUp();
- this->sunMapCheckIfSolved();
+ waitForMouseUp();
+ sunMapCheckIfSolved();
_menuDisabled = false;
}
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 99d9502d52f..0e5cdb83810 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -34,17 +34,17 @@ namespace Fool {
void FoolGame::highPriestessRun() {
// 140:0004
if (_activePuzzleStatus < 0x64) {
- this->thothAdjustPuzzleData();
+ thothAdjustPuzzleData();
}
- if ((this->var_i16_7ce & 2) != 0) {
+ if ((var_i16_7ce & 2) != 0) {
_toolbox->SetCursor(_cursors[0x10]);
}
if (_activePuzzleStatus == 0) {
_menuHidesPlayfield = true;
- this->thoth99Enchantments();
+ thoth99Enchantments();
_menuHidesPlayfield = false;
if (!_activePuzzleSolved) {
- this->sub_140_3412();
+ sub_140_3412();
return;
}
// 140:0056
@@ -52,20 +52,20 @@ void FoolGame::highPriestessRun() {
}
// 140:005c
if (_activePuzzleStatus == 1) {
- this->thothKey1st();
+ thothKey1st();
if (!_activePuzzleSolved) {
- this->sub_140_3412();
+ sub_140_3412();
return;
}
_activePuzzleStatus = 2;
}
// 140:007e
_toolbox->SetCursor(_cursors[0x10]);
- this->thothSetupMenu();
+ thothSetupMenu();
if (_activePuzzleStatus == 2) {
- this->thothKey2nd();
+ thothKey2nd();
if (!_activePuzzleSolved) {
- this->sub_140_3412();
+ sub_140_3412();
return;
}
_activePuzzleStatus = 3;
@@ -73,13 +73,13 @@ void FoolGame::highPriestessRun() {
// is the humbug marked with the wadjet eye? if so, unmark
// 140:00ce
_puzzleCompletionStatus[0x17] = 0x64;
- this->var_str_384 = _puzzleName[0x17] + _zbasic->str(OFF(0)); // ' '
- _zbasic->menu(0x4, 0x7, 0x1, this->var_str_384);
+ var_str_384 = _puzzleName[0x17] + _zbasic->str(OFF(0)); // ' '
+ _zbasic->menu(0x4, 0x7, 0x1, var_str_384);
}
}
// 140:0116
if (_activePuzzleStatus == 3) {
- this->thothKey3rd();
+ thothKey3rd();
if (!_activePuzzleSolved) {
return;
}
@@ -87,16 +87,16 @@ void FoolGame::highPriestessRun() {
if (_puzzleCompletionStatus[0x3f] == 0x63) {
// is justice marked with the wadjet eye? if so, unmark
_puzzleCompletionStatus[0x3f] = 0x64;
- this->var_str_384 = _puzzleName[0x3f] + _zbasic->str(OFF(1)); // ' '
- _zbasic->menu(6, 0xf, 1, this->var_str_384);
+ var_str_384 = _puzzleName[0x3f] + _zbasic->str(OFF(1)); // ' '
+ _zbasic->menu(6, 0xf, 1, var_str_384);
}
}
// 140:019c
if (_activePuzzleStatus == 4) {
_hermitPathStage = 6;
- this->thothKeyLast();
+ thothKeyLast();
if (!_activePuzzleSolved) {
- this->sub_140_3412();
+ sub_140_3412();
return;
}
_activePuzzleStatus = 0x64;
@@ -104,30 +104,30 @@ void FoolGame::highPriestessRun() {
if (_puzzleCompletionStatus[0x48] == 0x63) {
// is the hermit marked with the wadjet eye? if so, unmark
_puzzleCompletionStatus[0x48] = 0x64;
- this->var_str_384 = _puzzleName[0x48] + _zbasic->str(OFF(2)); // ' '
- _zbasic->menu(7, 8, 1, this->var_str_384);
+ var_str_384 = _puzzleName[0x48] + _zbasic->str(OFF(2)); // ' '
+ _zbasic->menu(7, 8, 1, var_str_384);
}
}
// 140:024c
if (_sunMapRestored == 0) {
// show the fake puzzle picture
_toolbox->PenNormal();
- this->arr_i32_192c0[0] = _toolbox->GetPicture(0x78);
- _zbasic->picture(0, 0, this->arr_i32_192c0[0]);
- _toolbox->ReleaseResource(this->arr_i32_192c0[0]);
- this->waitForClick();
+ arr_i32_192c0[0] = _toolbox->GetPicture(0x78);
+ _zbasic->picture(0, 0, arr_i32_192c0[0]);
+ _toolbox->ReleaseResource(arr_i32_192c0[0]);
+ waitForClick();
}
// 140:02a2
if (!_screenOversized) {
- _toolbox->SetPort(this->var_i32_8_thoth);
+ _toolbox->SetPort(var_i32_8_thoth);
} else {
- this->sub_128_1ef8();
+ sub_128_1ef8();
}
// 140:02b4
- this->var_i16_68a = 1;
+ var_i16_68a = 1;
for (int16 i = 1; i <= 0x155; i++) {
- _zbasic->get(1, i, SCREEN_WIDTH, i + 1, this->arr_bmp_fa3c);
- _zbasic->put(_zbasic->rndInt(0x14) - 0xa, i, this->arr_bmp_fa3c, kSrcCopy);
+ _zbasic->get(1, i, SCREEN_WIDTH, i + 1, arr_bmp_fa3c);
+ _zbasic->put(_zbasic->rndInt(0x14) - 0xa, i, arr_bmp_fa3c, kSrcCopy);
if (i % 2 == 0) {
_toolbox->Delay(0);
}
@@ -138,69 +138,69 @@ void FoolGame::highPriestessRun() {
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 0; i <= 0x22; i++) {
- this->var_i32_692 = _toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(area);
- this->delayFromMarker(1);
+ delayFromMarker(1);
}
// 140:037e
- this->var_i16_484 = 0x96;
+ var_i16_484 = 0x96;
for (int16 i = 0x37; i <= 0x122; i++) {
if (i < 0x69) {
- this->var_i16_484 -= 3;
+ var_i16_484 -= 3;
}
if (i > 0xf0) {
- this->var_i16_484 += 3;
+ var_i16_484 += 3;
}
- _toolbox->MoveTo(this->var_i16_484 + 0x5f - _zbasic->rndInt(0x32), i);
- _toolbox->LineTo(0x1a1 - this->var_i16_484 + _zbasic->rndInt(0x32), i);
+ _toolbox->MoveTo(var_i16_484 + 0x5f - _zbasic->rndInt(0x32), i);
+ _toolbox->LineTo(0x1a1 - var_i16_484 + _zbasic->rndInt(0x32), i);
if (i % 2 == 0) {
_toolbox->Delay(0);
}
}
// 140:03f0
_zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
- this->drawTextCenter(_zbasic->str(OFF(3)), 0x96); // you cannot claim
- this->drawTextCenter(_zbasic->str(OFF(4)), 0xb9); // the book of thoth
- this->drawTextCenter(_zbasic->str(OFF(5)), 0xdc); // so easily
- _toolbox->SetPort(this->var_i32_0);
- this->waitForClick();
+ drawTextCenter(_zbasic->str(OFF(3)), 0x96); // you cannot claim
+ drawTextCenter(_zbasic->str(OFF(4)), 0xb9); // the book of thoth
+ drawTextCenter(_zbasic->str(OFF(5)), 0xdc); // so easily
+ _toolbox->SetPort(var_i32_0);
+ waitForClick();
}
// 140:0450
- this->sub_140_32ac();
- this->sub_140_3412();
+ sub_140_32ac();
+ sub_140_3412();
return;
}
void FoolGame::thoth99Enchantments() {
// 140:0458
- this->toggleMouseCursor(false);
+ toggleMouseCursor(false);
if (_activePuzzleBuffer.empty()) { // was: str(OFF(6))
- this->arr_i16_1eb8[0] = 0x63;
+ arr_i16_1eb8[0] = 0x63;
} else {
- this->arr_i16_1eb8[0] = _zbasic->decodeInt(_activePuzzleBuffer);
+ arr_i16_1eb8[0] = _zbasic->decodeInt(_activePuzzleBuffer);
}
// 140:04a2
- if (this->arr_i16_1eb8[0] < 1) {
- this->arr_i16_1eb8[0] = 1;
+ if (arr_i16_1eb8[0] < 1) {
+ arr_i16_1eb8[0] = 1;
}
- if (this->arr_i16_1eb8[0] == 0x63) {
+ if (arr_i16_1eb8[0] == 0x63) {
_zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
- this->drawTextCenter(_zbasic->str(OFF(7)), 0xaf); // you dare to challenge
- this->drawTextCenter(_zbasic->str(OFF(8)), 0xd2); // the high priestess
- this->delay(0xb4);
+ drawTextCenter(_zbasic->str(OFF(7)), 0xaf); // you dare to challenge
+ drawTextCenter(_zbasic->str(OFF(8)), 0xd2); // the high priestess
+ delay(0xb4);
}
// 140:0532
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
_screenGrid[i].top = puzzlesReadShort();
_screenGrid[i].left = puzzlesReadShort();
_screenGrid[i].bottom = _screenGrid[i].top + 0x28;
_screenGrid[i].right = _screenGrid[i].left + 0x28;
}
// 140:060c
- _zbasic->picture(0, 0x14, this->var_pic_7c2);
- this->copyScreen(0, this->arr_bmp_b3ec);
- for (int16 i = 1; i <= this->arr_i16_1eb8[0]; i++) {
+ _zbasic->picture(0, 0x14, var_pic_7c2);
+ copyScreen(0, arr_bmp_b3ec);
+ for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
_toolbox->PenSize(5, 5);
_toolbox->PenMode(kPatXor);
for (int16 j = 0; j <= 1; j++) {
@@ -211,129 +211,129 @@ void FoolGame::thoth99Enchantments() {
}
_toolbox->PenNormal();
// 140:06cc
- this->arr_i16_1eb8[2] = i;
- this->thothDrawEnchantment();
+ arr_i16_1eb8[2] = i;
+ thothDrawEnchantment();
}
// 140:06fc
_toolbox->PenNormal();
- this->sub_140_e3c();
- this->arr_i16_4758[4] = 0x14;
- this->arr_i16_4758[5] = 0;
- this->arr_i16_4758[6] = SCREEN_HEIGHT;
- this->arr_i16_4758[7] = SCREEN_WIDTH;
- this->arr_i16_1eb8[1] = 0;
+ sub_140_e3c();
+ arr_i16_4758[4] = 0x14;
+ arr_i16_4758[5] = 0;
+ arr_i16_4758[6] = SCREEN_HEIGHT;
+ arr_i16_4758[7] = SCREEN_WIDTH;
+ arr_i16_1eb8[1] = 0;
_zbasic->unk_20();
- this->toggleMouseCursor(true);
+ toggleMouseCursor(true);
_stateFlags = kStateNull;
_activePuzzleSolved = false;
- this->var_i16_2326 = 0;
- this->var_i16_2328 = 0;
+ var_i16_2326 = 0;
+ var_i16_2328 = 0;
// new value: number of updates before a screen flash
- this->arr_i16_1eb8[3] = 0;
+ arr_i16_1eb8[3] = 0;
uint32 phase2Timer = _toolbox->TickCount();
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:0752
- this->var_i32_692 = _toolbox->TickCount();
- this->arr_i16_1eb8[1]++;
- this->arr_i16_1eb8[3]++;
- if (this->arr_i16_1eb8[1] >= this->arr_i16_1eb8[0]) {
- this->arr_i16_1eb8[1] = 0;
+ var_i32_692 = _toolbox->TickCount();
+ arr_i16_1eb8[1]++;
+ arr_i16_1eb8[3]++;
+ if (arr_i16_1eb8[1] >= arr_i16_1eb8[0]) {
+ arr_i16_1eb8[1] = 0;
}
// flash the screen. normally this happens after running through all the
// remaining enchantments, so it increases in intensity as you clear them.
// limit the amount of continuous full-screen flashing to WCAG
// recommendation of 3/second
- if (this->arr_i16_1eb8[3] >= MAX(this->arr_i16_1eb8[0], (int16)10)) {
- this->arr_i16_1eb8[3] = 0;
+ if (arr_i16_1eb8[3] >= MAX(arr_i16_1eb8[0], (int16)10)) {
+ arr_i16_1eb8[3] = 0;
Common::Rect temp;
- temp.top = this->arr_i16_4758[4];
- temp.left = this->arr_i16_4758[5];
- temp.bottom = this->arr_i16_4758[6];
- temp.right = this->arr_i16_4758[7];
+ temp.top = arr_i16_4758[4];
+ temp.left = arr_i16_4758[5];
+ temp.bottom = arr_i16_4758[6];
+ temp.right = arr_i16_4758[7];
_toolbox->InvertRect(temp);
}
// 140:07c4
// Phase 1: enchantments 99 to 34 are inverting and don't move
- if (this->arr_i16_1eb8[0] >= 0x21) {
- if ((this->arr_i16_1eb8[1] % 0xa) == 0) {
- this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0];
+ if (arr_i16_1eb8[0] >= 0x21) {
+ if ((arr_i16_1eb8[1] % 0xa) == 0) {
+ arr_i16_1eb8[2] = arr_i16_1eb8[0];
} else {
// 140:0826
- this->arr_i16_1eb8[2] = _zbasic->rndInt(this->arr_i16_1eb8[0]);
+ arr_i16_1eb8[2] = _zbasic->rndInt(arr_i16_1eb8[0]);
}
// 140:084a
- this->thothDrawEnchantment();
+ thothDrawEnchantment();
// Phase 2: enchantments 33 to 2 erase themselves and move around
} else {
// 140:0852
- this->arr_i16_1eb8[2] = this->arr_i16_1eb8[0] - this->arr_i16_1eb8[1];
- if (this->arr_i16_1eb8[2] == this->arr_i16_1eb8[0]) {
- if ((this->var_i16_2328 == 1) && (_toolbox->TickCount() > (phase2Timer + 0x28))) {
- this->var_i16_2328 = 0;
+ arr_i16_1eb8[2] = arr_i16_1eb8[0] - arr_i16_1eb8[1];
+ if (arr_i16_1eb8[2] == arr_i16_1eb8[0]) {
+ if ((var_i16_2328 == 1) && (_toolbox->TickCount() > (phase2Timer + 0x28))) {
+ var_i16_2328 = 0;
}
- if (this->var_i16_2328 == 0) {
+ if (var_i16_2328 == 0) {
phase2Timer = _toolbox->TickCount();
- this->var_i16_2328 = 1;
- this->thothMoveEnchantment();
+ var_i16_2328 = 1;
+ thothMoveEnchantment();
}
// 140:090c
} else {
// 140:0910
- this->thothMoveEnchantment();
+ thothMoveEnchantment();
}
}
do {
- this->getNextEvent(-1);
+ getNextEvent(-1);
if ((_event.modifiers & kModMouseButtonUp) == 0) {
- this->sub_140_c4c();
+ sub_140_c4c();
}
// 140:0934
- if (this->var_i16_2326 != 0) {
- this->thothScrambleScreen();
+ if (var_i16_2326 != 0) {
+ thothScrambleScreen();
}
} while (_event.what != 0);
// 140:094a
- this->delayFromMarker(1);
+ delayFromMarker(1);
}
// 140:097a
if (_activePuzzleSolved) {
- this->sub_140_f84();
+ sub_140_f84();
_activePuzzleBuffer.clear(); // was: str(OFF(9))
} else {
// 140:09a4
- if (this->arr_i16_1eb8[0] < 1) {
- this->arr_i16_1eb8[0] = 1;
+ if (arr_i16_1eb8[0] < 1) {
+ arr_i16_1eb8[0] = 1;
}
- _activePuzzleBuffer = _zbasic->encodeInt(this->arr_i16_1eb8[0]);
+ _activePuzzleBuffer = _zbasic->encodeInt(arr_i16_1eb8[0]);
}
// 140:09ee
}
void FoolGame::thothMoveEnchantment() {
// 140:09f0
- _toolbox->FillRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14, _patterns[2]);
- _screenGrid[this->arr_i16_1eb8[2]].top = _zbasic->rndInt(0x11a) + 0x14;
- _screenGrid[this->arr_i16_1eb8[2]].left = _zbasic->rndInt(0x1da);
- _screenGrid[this->arr_i16_1eb8[2]].bottom = _screenGrid[this->arr_i16_1eb8[2]].top + 0x28;
- _screenGrid[this->arr_i16_1eb8[2]].right = _screenGrid[this->arr_i16_1eb8[2]].left + 0x28;
- this->thothDrawEnchantment();
+ _toolbox->FillRoundRect(_screenGrid[arr_i16_1eb8[2]], 0x14, 0x14, _patterns[2]);
+ _screenGrid[arr_i16_1eb8[2]].top = _zbasic->rndInt(0x11a) + 0x14;
+ _screenGrid[arr_i16_1eb8[2]].left = _zbasic->rndInt(0x1da);
+ _screenGrid[arr_i16_1eb8[2]].bottom = _screenGrid[arr_i16_1eb8[2]].top + 0x28;
+ _screenGrid[arr_i16_1eb8[2]].right = _screenGrid[arr_i16_1eb8[2]].left + 0x28;
+ thothDrawEnchantment();
}
void FoolGame::thothDrawEnchantment() {
// 140:0b2c
_toolbox->PenNormal();
- _toolbox->EraseRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
- _toolbox->FrameRoundRect(_screenGrid[this->arr_i16_1eb8[2]], 0x14, 0x14);
+ _toolbox->EraseRoundRect(_screenGrid[arr_i16_1eb8[2]], 0x14, 0x14);
+ _toolbox->FrameRoundRect(_screenGrid[arr_i16_1eb8[2]], 0x14, 0x14);
_zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
- Common::U32String label = Common::U32String::format(" %d ", this->arr_i16_1eb8[2]); // was: str(OFF(10))
+ Common::U32String label = Common::U32String::format(" %d ", arr_i16_1eb8[2]); // was: str(OFF(10))
int16 width = _toolbox->StringWidth(label);
// 140:0bd2
_toolbox->MoveTo(
- _screenGrid[this->arr_i16_1eb8[2]].left + 0x14 - (width / 2),
- _screenGrid[this->arr_i16_1eb8[2]].top + 0x18
+ _screenGrid[arr_i16_1eb8[2]].left + 0x14 - (width / 2),
+ _screenGrid[arr_i16_1eb8[2]].top + 0x18
);
_toolbox->DrawString(label);
}
@@ -342,66 +342,66 @@ void FoolGame::sub_140_c4c() {
// 140:0c4c
if (_activePuzzleSolved)
return;
- if (_toolbox->PtInRect(_event.where, _screenGrid[this->arr_i16_1eb8[0]])) {
- this->arr_i16_1eb8[0]--;
- if (this->arr_i16_1eb8[0] <= 0) {
+ if (_toolbox->PtInRect(_event.where, _screenGrid[arr_i16_1eb8[0]])) {
+ arr_i16_1eb8[0]--;
+ if (arr_i16_1eb8[0] <= 0) {
_activePuzzleSolved = true;
return;
}
- this->var_i16_484 = this->arr_i16_1eb8[0] + 1;
- _toolbox->FillRoundRect(_screenGrid[this->var_i16_484], 0x14, 0x14, _patterns[2]);
- this->zoomRect(
- _screenGrid[this->var_i16_484].top,
- _screenGrid[this->var_i16_484].left,
- _screenGrid[this->var_i16_484].bottom,
- _screenGrid[this->var_i16_484].right,
+ var_i16_484 = arr_i16_1eb8[0] + 1;
+ _toolbox->FillRoundRect(_screenGrid[var_i16_484], 0x14, 0x14, _patterns[2]);
+ zoomRect(
+ _screenGrid[var_i16_484].top,
+ _screenGrid[var_i16_484].left,
+ _screenGrid[var_i16_484].bottom,
+ _screenGrid[var_i16_484].right,
0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatXor, 0xd
);
- this->arr_i16_1eb8[1] = 0;
- this->sub_140_e3c();
- this->var_i16_2326 = 0;
- this->var_i16_2328 = 0;
+ arr_i16_1eb8[1] = 0;
+ sub_140_e3c();
+ var_i16_2326 = 0;
+ var_i16_2328 = 0;
} else {
// 140:0dcc
- this->var_i16_2326 = 1;
+ var_i16_2326 = 1;
}
}
void FoolGame::thothScrambleScreen() {
// 140:0dd4
- if (this->var_i16_2326 < 0) {
- this->var_i16_2326 = 0;
+ if (var_i16_2326 < 0) {
+ var_i16_2326 = 0;
}
- _toolbox->InvertRect(this->thothRandomSquare());
- _toolbox->InvertRect(this->thothRandomHRect());
- _toolbox->InvertRect(this->thothRandomVRect());
+ _toolbox->InvertRect(thothRandomSquare());
+ _toolbox->InvertRect(thothRandomHRect());
+ _toolbox->InvertRect(thothRandomVRect());
Common::Rect temp;
- temp.top = this->arr_i16_4758[4];
- temp.left = this->arr_i16_4758[5];
- temp.bottom = this->arr_i16_4758[6];
- temp.right = this->arr_i16_4758[7];
+ temp.top = arr_i16_4758[4];
+ temp.left = arr_i16_4758[5];
+ temp.bottom = arr_i16_4758[6];
+ temp.right = arr_i16_4758[7];
_toolbox->InvertRect(temp);
- this->var_i16_2326++;
- if (this->var_i16_2326 >= 4)
- this->var_i16_2326 = 0;
+ var_i16_2326++;
+ if (var_i16_2326 >= 4)
+ var_i16_2326 = 0;
}
void FoolGame::sub_140_e3c() {
// 140:0e3c
- if (this->arr_i16_1eb8[0] == 1) {
+ if (arr_i16_1eb8[0] == 1) {
_zbasic->menu(8, 0, 1, _zbasic->str(OFF(11))); // the last enchantment
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(12))); // run for your life
} else {
// 140:0e8a
- this->var_str_384 = Common::U32String::format(" %d", this->arr_i16_1eb8[0]);
- this->var_str_9f4 = _zbasic->str(OFF(13)) + this->var_str_384 + _zbasic->str(OFF(14)); // the X enchantments
- _zbasic->menu(8, 0, 1, this->var_str_9f4);
+ var_str_384 = Common::U32String::format(" %d", arr_i16_1eb8[0]);
+ var_str_9f4 = _zbasic->str(OFF(13)) + var_str_384 + _zbasic->str(OFF(14)); // the X enchantments
+ _zbasic->menu(8, 0, 1, var_str_9f4);
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(15))); // run for your life
_zbasic->menu(8, 2, 1, _zbasic->str(OFF(16))); // -
_zbasic->menu(8, 3, 1, _zbasic->str(OFF(17))); // or press each button
_zbasic->menu(8, 4, 1, _zbasic->str(OFF(18))); // in descending order
- this->var_str_9f4 = _zbasic->str(OFF(19)) + this->var_str_384 + _zbasic->str(OFF(20)); // from X to 1
- _zbasic->menu(8, 5, 1, this->var_str_9f4);
+ var_str_9f4 = _zbasic->str(OFF(19)) + var_str_384 + _zbasic->str(OFF(20)); // from X to 1
+ _zbasic->menu(8, 5, 1, var_str_9f4);
}
// 140:0f82
return;
@@ -411,44 +411,44 @@ void FoolGame::sub_140_f84() {
// 140:0f84
_toolbox->PenNormal();
_toolbox->PenSize(5, 5);
- this->arr_i16_4758[4] = (_screenGrid[1].top / 0x19) + 1;
- this->arr_i16_4758[5] = (_screenGrid[1].left / 0x19) + 1;
+ arr_i16_4758[4] = (_screenGrid[1].top / 0x19) + 1;
+ arr_i16_4758[5] = (_screenGrid[1].left / 0x19) + 1;
// 140:0fea
- this->arr_i16_4758[6] = ((SCREEN_HEIGHT - _screenGrid[1].bottom) / 0x19) + 1;
- this->arr_i16_4758[7] = ((SCREEN_WIDTH - _screenGrid[1].right) / 0x19) + 1;
+ arr_i16_4758[6] = ((SCREEN_HEIGHT - _screenGrid[1].bottom) / 0x19) + 1;
+ arr_i16_4758[7] = ((SCREEN_WIDTH - _screenGrid[1].right) / 0x19) + 1;
// 140:1066
// unrolled loop
Common::Rect area = _screenGrid[1];
// 140:10aa
for (int16 i = 0; i <= 0x1a; i++) {
- area.top -= this->arr_i16_4758[4];
- area.left -= this->arr_i16_4758[5];
- area.bottom += this->arr_i16_4758[6];
- area.right += this->arr_i16_4758[7];
+ area.top -= arr_i16_4758[4];
+ area.left -= arr_i16_4758[5];
+ area.bottom += arr_i16_4758[6];
+ area.right += arr_i16_4758[7];
_toolbox->FrameRect(area);
- this->delay(1);
+ delay(1);
}
// 140:11ae
// unrolled loop
area = _screenGrid[1];
// 140:11f2
for (int16 i = 0; i <= 0x1a; i++) {
- area.top -= this->arr_i16_4758[4];
- area.left -= this->arr_i16_4758[5];
- area.bottom += this->arr_i16_4758[6];
- area.right += this->arr_i16_4758[7];
+ area.top -= arr_i16_4758[4];
+ area.left -= arr_i16_4758[5];
+ area.bottom += arr_i16_4758[6];
+ area.right += arr_i16_4758[7];
_toolbox->InvertRect(area);
- this->delay(1);
+ delay(1);
}
// 140:12f6
- this->sub_140_3296();
+ sub_140_3296();
}
void FoolGame::thothKey1st() {
// 140:12fc
- this->fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
- _zbasic->picture(0, 0x14, this->var_pic_7c2);
- if ((this->var_i16_7ce & 2) != 0) {
+ fillRect(0, 0, 0x14, SCREEN_WIDTH, 2);
+ _zbasic->picture(0, 0x14, var_pic_7c2);
+ if ((var_i16_7ce & 2) != 0) {
_toolbox->SetCursor(_cursors[0x10]);
}
// 140:1346
@@ -463,26 +463,26 @@ void FoolGame::thothKey1st() {
(_event.where.y <= 0xac)
)) {
// 140:1366
- this->getNextEvent(-1); // was: 0
+ getNextEvent(-1); // was: 0
_toolbox->MoveTo(0x105, 0xa2);
_toolbox->LineTo(_event.where.x, _event.where.y);
- this->delay(2);
+ delay(2);
_toolbox->MoveTo(0x105, 0xa2);
_toolbox->LineTo(_event.where.x, _event.where.y);
}
// 140:13dc
_toolbox->PenNormal();
- if ((this->var_i16_7ce & 2) == 0) {
+ if ((var_i16_7ce & 2) == 0) {
_stateFlags = kStateReturn;
- this->zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
- this->delay(0x3c);
+ zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
+ delay(0x3c);
_activePuzzleSolved = false;
} else {
// 140:1446
showBehold(0, 0, _zbasic->str(OFF(21)));
- this->thothSetupMenu();
- this->var_i16_7ce ^= 2;
- this->var_i16_7b2 = 0xa;
+ thothSetupMenu();
+ var_i16_7ce ^= 2;
+ var_i16_7b2 = 0xa;
_activePuzzleSolved = true;
}
// 140:1484
@@ -491,65 +491,65 @@ void FoolGame::thothKey1st() {
void FoolGame::thothKey2nd() {
// 140:1486
if (_activePuzzle != 0x34) {
- this->thothAdjustPuzzleData();
+ thothAdjustPuzzleData();
}
// FIXME: this looks lethal
// 140:1494: MOVE.L - var_i32_232a,D0
// 140:1498: ADDI.L - 0x0000018c,D0
// 140:149e: MOVE.L - D0,var_i32_696
- this->_puzzleDataBuffer = this->var_bytes_232a;
- this->_puzzleDataPtr = this->var_ptr_232a + 0x18c;
+ _puzzleDataBuffer = var_bytes_232a;
+ _puzzleDataPtr = var_ptr_232a + 0x18c;
for (int16 j = 1; j <= 7; j++) {
for (int16 i = 0; i <= 3; i++) {
- this->arr_i16_2f38[j*32+i] = puzzlesReadShort();
+ arr_i16_2f38[j*32+i] = puzzlesReadShort();
}
}
_activePuzzleSolved = false;
- this->var_i16_103a = 0;
+ var_i16_103a = 0;
_stateFlags = kStateNull;
- this->var_i16_232e = 0;
+ var_i16_232e = 0;
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:1506
// was: SetRect
- this->arr_i16_4758[4] = 0x14;
- this->arr_i16_4758[5] = 0;
- this->arr_i16_4758[6] = SCREEN_HEIGHT;
- this->arr_i16_4758[7] = SCREEN_WIDTH;
+ arr_i16_4758[4] = 0x14;
+ arr_i16_4758[5] = 0;
+ arr_i16_4758[6] = SCREEN_HEIGHT;
+ arr_i16_4758[7] = SCREEN_WIDTH;
Common::Rect playArea(0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT);
- this->var_i16_232e++;
- if (this->var_i16_232e < 1) {
- this->var_i16_232e = 1;
+ var_i16_232e++;
+ if (var_i16_232e < 1) {
+ var_i16_232e = 1;
}
- if (this->var_i16_232e > 6) {
- this->var_i16_232e = 1;
+ if (var_i16_232e > 6) {
+ var_i16_232e = 1;
}
// 140:1546
- switch (this->var_i16_232e-1) {
+ switch (var_i16_232e-1) {
case 0:
// 140:31b0
- _toolbox->InvertRect(this->thothRandomSquare());
+ _toolbox->InvertRect(thothRandomSquare());
break;
case 1:
// 140:31c4
- _toolbox->InvertRect(this->thothRandomHRect());
+ _toolbox->InvertRect(thothRandomHRect());
break;
case 2:
// 140:31d8
- _toolbox->InvertRect(this->thothRandomVRect());
+ _toolbox->InvertRect(thothRandomVRect());
_toolbox->InvertRect(playArea);
break;
case 3:
// 140:31fa
- _toolbox->FillRect(this->thothRandomSquare(), _patterns[2]);
+ _toolbox->FillRect(thothRandomSquare(), _patterns[2]);
break;
case 4:
// 140:321a
- _toolbox->FillRect(this->thothRandomHRect(), _patterns[2]);
+ _toolbox->FillRect(thothRandomHRect(), _patterns[2]);
break;
case 5:
// 140:323a
- _toolbox->FillRect(this->thothRandomVRect(), _patterns[2]);
+ _toolbox->FillRect(thothRandomVRect(), _patterns[2]);
break;
default:
warning("thothKey2nd: breaking out of switch statement");
@@ -557,22 +557,22 @@ void FoolGame::thothKey2nd() {
}
if (_activePuzzle != 0x34) {
Common::Rect temp;
- temp.top = this->arr_i16_2f38[(this->var_i16_103a + 1)*32];
- temp.left = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+1];
- temp.bottom = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+2];
- temp.right = this->arr_i16_2f38[(this->var_i16_103a + 1)*32+3];
+ temp.top = arr_i16_2f38[(var_i16_103a + 1)*32];
+ temp.left = arr_i16_2f38[(var_i16_103a + 1)*32+1];
+ temp.bottom = arr_i16_2f38[(var_i16_103a + 1)*32+2];
+ temp.right = arr_i16_2f38[(var_i16_103a + 1)*32+3];
_toolbox->FillRect(temp, _patterns[1]);
}
// 140:159e
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == 1) {
- this->sub_140_15fc();
+ sub_140_15fc();
}
- if (this->var_i16_103a == 4) {
+ if (var_i16_103a == 4) {
_activePuzzleSolved = true;
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
// 140:15d0
@@ -582,28 +582,28 @@ void FoolGame::thothKey2nd() {
void FoolGame::sub_140_15fc() {
// 140:15fc
- this->var_i16_7e4 = 0;
+ var_i16_7e4 = 0;
for (int16 i = 1; i <= 7; i++) {
Common::Rect temp;
- temp.top = this->arr_i16_2f38[i*32];
- temp.left = this->arr_i16_2f38[i*32+1];
- temp.bottom = this->arr_i16_2f38[i*32+2];
- temp.right = this->arr_i16_2f38[i*32+3];
+ temp.top = arr_i16_2f38[i*32];
+ temp.left = arr_i16_2f38[i*32+1];
+ temp.bottom = arr_i16_2f38[i*32+2];
+ temp.right = arr_i16_2f38[i*32+3];
if (_toolbox->PtInRect(_event.where, temp)) {
- this->var_i16_7e4 = i;
+ var_i16_7e4 = i;
}
}
- this->var_i16_103a++;
- if (this->var_i16_7e4 != this->var_i16_103a) {
- this->var_i16_103a = 0;
- this->playTone(0xf, 0x64, 0x1);
+ var_i16_103a++;
+ if (var_i16_7e4 != var_i16_103a) {
+ var_i16_103a = 0;
+ playTone(0xf, 0x64, 0x1);
for (int16 i = 0; i <= 9; i++) {
Common::Rect temp;
- temp.top = this->arr_i16_4758[4];
- temp.left = this->arr_i16_4758[5];
- temp.bottom = this->arr_i16_4758[6];
- temp.right = this->arr_i16_4758[7];
+ temp.top = arr_i16_4758[4];
+ temp.left = arr_i16_4758[5];
+ temp.bottom = arr_i16_4758[6];
+ temp.right = arr_i16_4758[7];
_toolbox->InvertRect(temp);
}
} else {
@@ -611,68 +611,68 @@ void FoolGame::sub_140_15fc() {
if (_activePuzzle == 0x34) {
for (int16 i = 0; i <= 7; i++) {
Common::Rect temp;
- temp.top = this->arr_i16_2f38[32*i];
- temp.left = this->arr_i16_2f38[32*i+1];
- temp.bottom = this->arr_i16_2f38[32*i+2];
- temp.right = this->arr_i16_2f38[32*i+3];
+ temp.top = arr_i16_2f38[32*i];
+ temp.left = arr_i16_2f38[32*i+1];
+ temp.bottom = arr_i16_2f38[32*i+2];
+ temp.right = arr_i16_2f38[32*i+3];
_toolbox->EraseRect(temp);
}
// 140:16ce
for (int16 i = 1; i <= 0xc; i++) {
for (int16 j = 1; j <= 7; j++) {
Common::Rect temp;
- temp.top = this->arr_i16_2f38[32*j];
- temp.left = this->arr_i16_2f38[32*j+1];
- temp.bottom = this->arr_i16_2f38[32*j+2];
- temp.right = this->arr_i16_2f38[32*j+3];
+ temp.top = arr_i16_2f38[32*j];
+ temp.left = arr_i16_2f38[32*j+1];
+ temp.bottom = arr_i16_2f38[32*j+2];
+ temp.right = arr_i16_2f38[32*j+3];
_toolbox->InvertRect(temp);
}
- this->delay(2);
+ delay(2);
}
// 140:1710
Common::Rect temp;
- temp.top = this->arr_i16_2f38[32*this->var_i16_7e4];
- temp.left = this->arr_i16_2f38[32*this->var_i16_7e4+1];
- temp.bottom = this->arr_i16_2f38[32*this->var_i16_7e4+2];
- temp.right = this->arr_i16_2f38[32*this->var_i16_7e4+3];
+ temp.top = arr_i16_2f38[32*var_i16_7e4];
+ temp.left = arr_i16_2f38[32*var_i16_7e4+1];
+ temp.bottom = arr_i16_2f38[32*var_i16_7e4+2];
+ temp.right = arr_i16_2f38[32*var_i16_7e4+3];
for (int16 i = 1; i <= 0x19; i++) {
_toolbox->InvertRect(temp);
}
// 140:173a
- if (this->var_i16_103a < 4) {
- this->var_i16_2330 = 2;
- this->var_i16_1dee = kPatXor;
+ if (var_i16_103a < 4) {
+ var_i16_2330 = 2;
+ var_i16_1dee = kPatXor;
} else {
// 140:1756
- this->var_i16_2330 = 3;
- this->var_i16_1dee = kPatCopy;
+ var_i16_2330 = 3;
+ var_i16_1dee = kPatCopy;
}
// 140:1762
- this->zoomRect(
- this->arr_i16_2f38[32*this->var_i16_7e4],
- this->arr_i16_2f38[32*this->var_i16_7e4+1],
- this->arr_i16_2f38[32*this->var_i16_7e4+2],
- this->arr_i16_2f38[32*this->var_i16_7e4+3],
+ zoomRect(
+ arr_i16_2f38[32*var_i16_7e4],
+ arr_i16_2f38[32*var_i16_7e4+1],
+ arr_i16_2f38[32*var_i16_7e4+2],
+ arr_i16_2f38[32*var_i16_7e4+3],
0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH,
- this->var_i16_2330, this->var_i16_1dee, 0x19
+ var_i16_2330, var_i16_1dee, 0x19
);
} else {
// 140:1804
for (int16 i = 0; i <= 3; i++) {
- this->arr_i16_4758[i] = this->arr_i16_2f38[32*this->var_i16_103a + i];
+ arr_i16_4758[i] = arr_i16_2f38[32*var_i16_103a + i];
}
// 140:184e
for (int16 i = 0; i <= 0x24; i++) {
- this->arr_i16_4758[0]++;
- this->arr_i16_4758[1]++;
- this->arr_i16_4758[2]--;
- this->arr_i16_4758[3]--;
+ arr_i16_4758[0]++;
+ arr_i16_4758[1]++;
+ arr_i16_4758[2]--;
+ arr_i16_4758[3]--;
Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
_toolbox->InvertRect(temp);
}
}
@@ -684,17 +684,17 @@ void FoolGame::sub_140_15fc() {
void FoolGame::thothKey3rd() {
// 140:18fa
if (_activePuzzle != 0x34) {
- this->thothAdjustPuzzleData();
+ thothAdjustPuzzleData();
}
// FIXME: this looks lethal
// 140:1908: MOVE.L - var_i32_232a,D0
// 140:190c: ADDI.L - 0x000001c4,D0
// 140:1912: MOVE.L - D0,var_i32_696
- this->_puzzleDataBuffer = this->var_bytes_232a;
- this->_puzzleDataPtr = this->var_ptr_232a + 0x1c4;
+ _puzzleDataBuffer = var_bytes_232a;
+ _puzzleDataPtr = var_ptr_232a + 0x1c4;
for (int16 i = 0; i <= 3; i++) {
for (int16 j = 0; j <= 3; j++) {
- this->arr_i16_2f38[i*32 + j] = puzzlesReadShort();
+ arr_i16_2f38[i*32 + j] = puzzlesReadShort();
}
}
// 140:195e
@@ -709,40 +709,40 @@ void FoolGame::thothKey3rd() {
_screenGrid[1].left = 0x1f1;
_screenGrid[2].bottom = 0x23;
_screenGrid[3].top = 0x147;
- this->arr_i16_4338[1] = 0;
- this->arr_i16_4338[9] = 2;
+ arr_i16_4338[1] = 0;
+ arr_i16_4338[9] = 2;
for (int16 i = 0x14; i <= 0x1a; i++) {
- this->arr_i16_4338[i - 0x12] = i;
- this->arr_i16_4338[0x1a - i + 0xa] = i;
+ arr_i16_4338[i - 0x12] = i;
+ arr_i16_4338[0x1a - i + 0xa] = i;
}
// 140:1a9c
- this->var_i16_103a = 0;
- this->var_i16_232e = 0;
+ var_i16_103a = 0;
+ var_i16_232e = 0;
_stateFlags = kStateNull;
_activePuzzleSolved = false;
// 140:1b98
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:1ab8
if (_activePuzzle == 0x34) { // in high priestess, no hints
- this->var_i16_232e++;
- if (this->var_i16_232e < 1) {
- this->var_i16_232e = 1;
+ var_i16_232e++;
+ if (var_i16_232e < 1) {
+ var_i16_232e = 1;
}
- if (this->var_i16_232e > 3) {
- this->var_i16_232e = 1;
+ if (var_i16_232e > 3) {
+ var_i16_232e = 1;
}
- switch (this->var_i16_232e-1) {
+ switch (var_i16_232e-1) {
case 0:
// 140:325a
- _toolbox->InvertRect(this->thothRandomSquare());
+ _toolbox->InvertRect(thothRandomSquare());
break;
case 1:
// 140:326e
- _toolbox->InvertRect(this->thothRandomHRect());
+ _toolbox->InvertRect(thothRandomHRect());
break;
case 2:
// 140:3282
- _toolbox->InvertRect(this->thothRandomVRect());
+ _toolbox->InvertRect(thothRandomVRect());
break;
default:
warning("thothKey3rd: broke out of switch");
@@ -750,26 +750,26 @@ void FoolGame::thothKey3rd() {
}
} else { // in justice, animate the grab bar
// 140:1b08
- this->var_i16_232e++;
- if (this->var_i16_232e < 1) {
- this->var_i16_232e = 1;
+ var_i16_232e++;
+ if (var_i16_232e < 1) {
+ var_i16_232e = 1;
}
- if (this->var_i16_232e > 0x10) {
- this->var_i16_232e = 1;
+ if (var_i16_232e > 0x10) {
+ var_i16_232e = 1;
}
- _toolbox->FillRect(_screenGrid[this->var_i16_103a], _patterns[this->arr_i16_4338[this->var_i16_232e]]);
+ _toolbox->FillRect(_screenGrid[var_i16_103a], _patterns[arr_i16_4338[var_i16_232e]]);
}
// 140:1b66
- this->getNextEvent(-1);
+ getNextEvent(-1);
if (_event.what == 1) {
- this->thothKey3rdOnClick();
+ thothKey3rdOnClick();
}
// 140:1b7a
- if (this->var_i16_103a == 4) {
+ if (var_i16_103a == 4) {
_activePuzzleSolved = true;
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
}
// 140:1bc2
@@ -777,65 +777,65 @@ void FoolGame::thothKey3rd() {
void FoolGame::thothKey3rdOnClick() {
// 140:1bc4
- this->var_i16_2332 = 1;
+ var_i16_2332 = 1;
if (_activePuzzle == 0x34) {
if ((_event.where.x >= 0xf) && (_event.where.y >= 0x2d) && (_event.where.x <= 0x1f1) && (_event.where.y <= 0x147)) {
- this->var_i16_2332 = 0;
+ var_i16_2332 = 0;
}
} else {
// 140:1c22
- if (_toolbox->PtInRect(_event.where, _screenGrid[this->var_i16_103a]) == 0) {
- this->var_i16_2332 = 0;
+ if (_toolbox->PtInRect(_event.where, _screenGrid[var_i16_103a]) == 0) {
+ var_i16_2332 = 0;
}
}
// 140:1c58
- if (this->var_i16_2332 == 0) {
- this->sub_140_1f68();
+ if (var_i16_2332 == 0) {
+ sub_140_1f68();
return;
}
// 140:1c66
Common::Rect area(-1, 0x14, SCREEN_WIDTH + 1, SCREEN_HEIGHT + 1);
if (_event.where.x < 0xf) {
area.right = 0xf;
- this->var_i16_1de6 = 0;
+ var_i16_1de6 = 0;
}
// 140:1cc6
if (_event.where.x > 0x1f1) {
area.left = 0x1f1;
- this->var_i16_1de6 = 1;
+ var_i16_1de6 = 1;
}
// 140:1ce6
if (_event.where.y < 0x2d) {
area.bottom = 0x2d;
- this->var_i16_1de6 = 2;
+ var_i16_1de6 = 2;
}
// 140:1d06
if (_event.where.y > 0x147) {
area.top = 0x147;
- this->var_i16_1de6 = 3;
+ var_i16_1de6 = 3;
}
// 140:1d26
while ((_event.modifiers & kModMouseButtonUp) == 0) {
// 140:1d2a
// was: 0
- this->getNextEvent(-1);
- if (this->var_i16_1de6 == 0) {
+ getNextEvent(-1);
+ if (var_i16_1de6 == 0) {
area.right = _event.where.x + 0xa;
}
- if (this->var_i16_1de6 == 1) {
+ if (var_i16_1de6 == 1) {
area.left = _event.where.x - 0xa;
}
- if (this->var_i16_1de6 == 2) {
+ if (var_i16_1de6 == 2) {
area.bottom = _event.where.y + 0xa;
}
- if (this->var_i16_1de6 == 3) {
+ if (var_i16_1de6 == 3) {
area.top = _event.where.y - 0xa;
}
// 140:1dc6
if (area.top < 0x14) {
area.top = 0x14;
}
- _toolbox->FillRect(area, _patterns[this->arr_i16_2f38[this->var_i16_1de6*32+ this->var_i16_103a]]);
+ _toolbox->FillRect(area, _patterns[arr_i16_2f38[var_i16_1de6*32+ var_i16_103a]]);
// 140:1e2e
if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
_event.modifiers = kModMouseButtonUp;
@@ -844,19 +844,19 @@ void FoolGame::thothKey3rdOnClick() {
}
// 140:1ec4
if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
- if (this->var_i16_1de6 == this->var_i16_103a) {
- this->sub_140_205e();
+ if (var_i16_1de6 == var_i16_103a) {
+ sub_140_205e();
return;
}
}
// 140:1f62
- this->sub_140_1f68();
+ sub_140_1f68();
}
void FoolGame::sub_140_1f68() {
// 140:1f68
- this->playTone(0xf, 0x64, 1);
- this->var_i16_103a = 0;
+ playTone(0xf, 0x64, 1);
+ var_i16_103a = 0;
_toolbox->PenSize(0x14, 0x14);
_toolbox->PenPat(_patterns[3]);
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -870,13 +870,13 @@ void FoolGame::sub_140_1f68() {
}
// 140:2056
_toolbox->PenNormal();
- this->waitForMouseUp();
+ waitForMouseUp();
}
void FoolGame::sub_140_205e() {
// 140:205e
- this->var_i16_103a++;
- this->waitForMouseUp();
+ var_i16_103a++;
+ waitForMouseUp();
_toolbox->PenNormal();
}
@@ -884,22 +884,22 @@ void FoolGame::thothKeyLast() {
// 140:206a
_activePuzzleSolved = false;
_stateFlags = kStateNull;
- this->thothKeyLastSetup();
- this->sub_140_2978();
- this->copyScreen(1, this->arr_bmp_b3ec);
- this->arr_i16_1eb8[1] = -1;
- this->var_i16_1de6 = this->arr_i16_3b38[_hermitPathStage];
- warning("thothKeyLast: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1));
+ thothKeyLastSetup();
+ sub_140_2978();
+ copyScreen(1, arr_bmp_b3ec);
+ arr_i16_1eb8[1] = -1;
+ var_i16_1de6 = arr_i16_3b38[_hermitPathStage];
+ warning("thothKeyLast: 1de6: %d, target: %d", var_i16_1de6, (arr_i16_3b38[0x20 + _hermitPathStage] + 1));
// JMP 0x228c
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:20c2
do {
if (_activePuzzle != 0x34) { // we're in the hermit, print the shape
- int hermitPathStartIndex = this->arr_i16_3b38[_hermitPathStage]; // var_i16_2334
- int hermitPathEndIndex = this->arr_i16_3b38[_hermitPathStage + 0x20]; // var_i16_2336
+ int hermitPathStartIndex = arr_i16_3b38[_hermitPathStage]; // var_i16_2334
+ int hermitPathEndIndex = arr_i16_3b38[_hermitPathStage + 0x20]; // var_i16_2336
do {
- this->getNextEvent(-1);
- _toolbox->FillRect(_screenGrid[this->arr_i16_3738[hermitPathStartIndex]], _patterns[this->var_i16_2338]);
+ getNextEvent(-1);
+ _toolbox->FillRect(_screenGrid[arr_i16_3738[hermitPathStartIndex]], _patterns[var_i16_2338]);
hermitPathStartIndex++;
// we're updating the screen in the event handler, this has no effect
/*if (_hermitPathStage == 5) {
@@ -920,21 +920,21 @@ void FoolGame::thothKeyLast() {
}
}
// 140:21e8
- this->copyScreen(1, this->arr_bmp_b3ec);
+ copyScreen(1, arr_bmp_b3ec);
} else { // we're in the high priestess, show nothing but random filled squares
// 140:21fe
- this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
- this->var_i16_68a = _zbasic->rndInt(0x14) - 1;
- this->var_i16_68c = _zbasic->rndInt(0xe) - 1;
+ var_i16_484 = _zbasic->rndInt(0x4e) + 2;
+ var_i16_68a = _zbasic->rndInt(0x14) - 1;
+ var_i16_68c = _zbasic->rndInt(0xe) - 1;
// 140:2222
- _toolbox->FillRect(_screenGrid[this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c]], _patterns[this->var_i16_484]);
- this->getNextEvent(-1);
+ _toolbox->FillRect(_screenGrid[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]], _patterns[var_i16_484]);
+ getNextEvent(-1);
}
if (_event.what == 1) {
- this->thothKeyLastOnClick();
+ thothKeyLastOnClick();
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
// 140:228c
} while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved);
@@ -943,58 +943,58 @@ void FoolGame::thothKeyLast() {
void FoolGame::thothKeyLastOnClick() {
// 140:22b8
- while (((_event.modifiers & kModMouseButtonUp) == 0) && (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1))) {
+ while (((_event.modifiers & kModMouseButtonUp) == 0) && (var_i16_1de6 != (arr_i16_3b38[0x20 + _hermitPathStage] + 1))) {
// 140:22bc
- this->getNextEvent(-1); // was: 0
- this->getGridFromMouse(this->var_i16_68a, this->var_i16_68c);
- if ((this->var_i16_68a >= 0) && (this->var_i16_68c >= 0) && (this->var_i16_68a <= 0x13) && (this->var_i16_68c <= 0xd)) {
+ getNextEvent(-1); // was: 0
+ getGridFromMouse(var_i16_68a, var_i16_68c);
+ if ((var_i16_68a >= 0) && (var_i16_68c >= 0) && (var_i16_68a <= 0x13) && (var_i16_68c <= 0xd)) {
// 140:2316
- this->arr_i16_1eb8[0] = this->arr_i16_2f38[this->var_i16_68a*32 + this->var_i16_68c];
- if (this->arr_i16_1eb8[0] != this->arr_i16_1eb8[1]) {
+ arr_i16_1eb8[0] = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
+ if (arr_i16_1eb8[0] != arr_i16_1eb8[1]) {
// 140:2372
- if (this->arr_i16_1eb8[0] != this->arr_i16_3738[this->var_i16_1de6]) {
- this->thothBadSelect();
+ if (arr_i16_1eb8[0] != arr_i16_3738[var_i16_1de6]) {
+ thothBadSelect();
return;
}
// 140:23aa
- this->arr_i16_1eb8[1] = this->arr_i16_1eb8[0];
- this->playTone(0x32 + (this->var_i16_1de6 * 5), 0x28, 0);
- _toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[2]);
- this->var_i16_1de6++;
- warning("thothKeyLastOnClick: 1de6: %d, target: %d", this->var_i16_1de6, (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1));
+ arr_i16_1eb8[1] = arr_i16_1eb8[0];
+ playTone(0x32 + (var_i16_1de6 * 5), 0x28, 0);
+ _toolbox->FillRect(_screenGrid[arr_i16_1eb8[0]], _patterns[2]);
+ var_i16_1de6++;
+ warning("thothKeyLastOnClick: 1de6: %d, target: %d", var_i16_1de6, (arr_i16_3b38[0x20 + _hermitPathStage] + 1));
}
}
// 140:2422
}
// 140:2472
- if (this->var_i16_1de6 != (this->arr_i16_3b38[0x20 + _hermitPathStage] + 1)) {
- this->thothBadSelect();
+ if (var_i16_1de6 != (arr_i16_3b38[0x20 + _hermitPathStage] + 1)) {
+ thothBadSelect();
} else {
- this->hermitNextStage();
+ hermitNextStage();
}
}
void FoolGame::thothBadSelect() {
// 140:24ae
- this->playTone(0x14, 0x64, 0x0);
+ playTone(0x14, 0x64, 0x0);
while ((_event.modifiers & kModMouseButtonUp) == 0) {
// 140:24c4
- this->getNextEvent(-1);
- this->var_i16_484 = _zbasic->rndInt(0x50);
- _toolbox->FillRect(_screenGrid[this->arr_i16_1eb8[0]], _patterns[this->var_i16_484]);
+ getNextEvent(-1);
+ var_i16_484 = _zbasic->rndInt(0x50);
+ _toolbox->FillRect(_screenGrid[arr_i16_1eb8[0]], _patterns[var_i16_484]);
}
// 140:2520
if (_activePuzzle != 0x34) {
- this->copyScreen(1, this->arr_bmp_b3ec);
+ copyScreen(1, arr_bmp_b3ec);
} else {
- for (int16 i = this->var_i16_1de6; i >= this->arr_i16_3b38[_hermitPathStage]; i--) {
- this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
- _toolbox->FillRect(_screenGrid[this->arr_i16_3738[i]], _patterns[this->var_i16_484]);
+ for (int16 i = var_i16_1de6; i >= arr_i16_3b38[_hermitPathStage]; i--) {
+ var_i16_484 = _zbasic->rndInt(0x4e) + 2;
+ _toolbox->FillRect(_screenGrid[arr_i16_3738[i]], _patterns[var_i16_484]);
}
}
// 140:25b4
- this->arr_i16_1eb8[1] = -1;
- this->var_i16_1de6 = this->arr_i16_3b38[_hermitPathStage];
+ arr_i16_1eb8[1] = -1;
+ var_i16_1de6 = arr_i16_3b38[_hermitPathStage];
}
void FoolGame::hermitNextStage() {
@@ -1005,24 +1005,24 @@ void FoolGame::hermitNextStage() {
}
// 140:25f6
if (_hermitPathStage < 5) {
- this->hermitScreenFlash();
+ hermitScreenFlash();
}
if (_hermitPathStage == 4) {
- this->hermitScreenZoom();
+ hermitScreenZoom();
}
if (_hermitPathStage == 5) {
- this->hermitScreenBehold();
+ hermitScreenBehold();
}
if (_hermitPathStage == 6) {
- this->sub_140_2968();
+ sub_140_2968();
}
if (!_activePuzzleSolved) {
_hermitPathStage++;
if (_hermitPathStage == 6) {
- this->thothKeyLastSetup();
+ thothKeyLastSetup();
}
- this->sub_140_2978();
- this->copyScreen(1, this->arr_bmp_b3ec);
+ sub_140_2978();
+ copyScreen(1, arr_bmp_b3ec);
}
// 140:2660
}
@@ -1034,13 +1034,13 @@ void FoolGame::hermitScreenFlash() {
// recommendation of 3/second
for (int16 i = 0; i <= 6; i++) { // was: 0x10
_toolbox->InvertRect(area);
- this->delay(10); // was: 1
+ delay(10); // was: 1
}
}
void FoolGame::hermitScreenZoom() {
// 140:26ca
- this->toggleMouseCursor(false);
+ toggleMouseCursor(false);
_toolbox->PenSize(0xa, 0x7);
for (int16 j = 0; j <= 2; j++) {
@@ -1052,7 +1052,7 @@ void FoolGame::hermitScreenZoom() {
area.bottom -= 7;
area.right -= 0xa;
_toolbox->InvertRect(area);
- this->delay(1);
+ delay(1);
}
for (int16 i = 0; i <= 0x13; i++) {
area.top -= 7;
@@ -1060,25 +1060,25 @@ void FoolGame::hermitScreenZoom() {
area.bottom += 7;
area.right += 0xa;
_toolbox->InvertRect(area);
- this->delay(1);
+ delay(1);
}
}
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
- this->var_i16_1de6 = 0;
- this->toggleMouseCursor(true);
+ var_i16_1de6 = 0;
+ toggleMouseCursor(true);
}
void FoolGame::hermitScreenBehold() {
// 140:28bc
if (_puzzleCompletionStatus[0x68] > 4) {
- this->waitForMouseUp();
- this->menuClickMessage();
- this->flashRect(0x29, 0x37, 0x142, 0x1c9, 0x96);
+ waitForMouseUp();
+ menuClickMessage();
+ flashRect(0x29, 0x37, 0x142, 0x1c9, 0x96);
_activePuzzleSolved = true;
} else {
// 140:290c
- this->zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
+ zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
// behold the last key of thoth
showBehold(0x48, 2, _zbasic->str(OFF(22)));
}
@@ -1087,105 +1087,105 @@ void FoolGame::hermitScreenBehold() {
void FoolGame::sub_140_2968() {
// 140:2968
- this->menuClickMessage();
- this->waitForClick();
+ menuClickMessage();
+ waitForClick();
_activePuzzleSolved = true;
}
void FoolGame::sub_140_2978() {
// 140:2978
- this->waitForMouseUp();
+ waitForMouseUp();
if (_hermitPathStage < 6) {
- this->var_i16_2338 = 1;
+ var_i16_2338 = 1;
} else {
- this->var_i16_2338 = 2;
+ var_i16_2338 = 2;
}
}
void FoolGame::thothKeyLastSetup() {
// 140:2998
if (_hermitPathStage != 6) {
- this->fetchPuzzleData();
- this->arr_i16_1eb8[4] = 0x37;
- this->arr_i16_1eb8[5] = 0x29;
- this->arr_i16_1eb8[6] = 0x14;
- this->arr_i16_1eb8[7] = 0x14;
- this->arr_i16_1eb8[8] = 0x29;
- this->arr_i16_1eb8[9] = 0x12d;
- this->arr_i16_1eb8[10] = 0x37;
- this->arr_i16_1eb8[11] = 0x1bd;
- this->arr_i16_1eb8[12] = 0x15;
- this->arr_i16_1eb8[13] = 0x15;
+ fetchPuzzleData();
+ arr_i16_1eb8[4] = 0x37;
+ arr_i16_1eb8[5] = 0x29;
+ arr_i16_1eb8[6] = 0x14;
+ arr_i16_1eb8[7] = 0x14;
+ arr_i16_1eb8[8] = 0x29;
+ arr_i16_1eb8[9] = 0x12d;
+ arr_i16_1eb8[10] = 0x37;
+ arr_i16_1eb8[11] = 0x1bd;
+ arr_i16_1eb8[12] = 0x15;
+ arr_i16_1eb8[13] = 0x15;
for (int16 i = 0; i <= 0x13; i++) {
- this->arr_i16_5bbc[i] = puzzlesReadShort();
+ arr_i16_5bbc[i] = puzzlesReadShort();
}
for (int16 i = 0; i <= 0xd; i++) {
- this->arr_i16_5cbc[i] = puzzlesReadShort();
+ arr_i16_5cbc[i] = puzzlesReadShort();
}
// 140:2aa4
for (int16 i = 0; i <= 0xcd; i++) {
- this->arr_i16_3738[i] = puzzlesReadShort();
- this->arr_i16_3738[i] = (this->arr_i16_3738[i]/4) + 1;
+ arr_i16_3738[i] = puzzlesReadShort();
+ arr_i16_3738[i] = (arr_i16_3738[i]/4) + 1;
}
// 140:2b06
for (int16 i = 1; i <= 6; i++) {
- this->arr_i16_3b38[i] = puzzlesReadShort();
- this->arr_i16_3b38[0x20 + i] = puzzlesReadShort();
+ arr_i16_3b38[i] = puzzlesReadShort();
+ arr_i16_3b38[0x20 + i] = puzzlesReadShort();
}
// 140:2b54
} else { // last key of thoth
// 140:2b58
if (_activePuzzle != 0x34) { // in the hermit
- this->thothAdjustPuzzleData();
+ thothAdjustPuzzleData();
}
// FIXME: some kind of manual bodge for the puzzle data loader,
// this looks lethal
// 140:2b66: MOVE.L - var_i32_232a,D0
// 140:2b6a: ADDI.L - 0x000001e4,D0
// 140:2b70: MOVE.L - D0,var_i32_696
- this->_puzzleDataBuffer = this->var_bytes_232a;
- this->_puzzleDataPtr = this->var_ptr_232a + 0x1e4;
+ _puzzleDataBuffer = var_bytes_232a;
+ _puzzleDataPtr = var_ptr_232a + 0x1e4;
for (int16 i = 0; i <= 0xe; i++) {
- this->arr_i16_1eb8[i] = puzzlesReadShort();
+ arr_i16_1eb8[i] = puzzlesReadShort();
}
for (int16 i = 0; i <= 0x13; i++) {
- this->arr_i16_5bbc[i] = puzzlesReadShort();
+ arr_i16_5bbc[i] = puzzlesReadShort();
}
for (int16 i = 0; i <= 0xd; i++) {
- this->arr_i16_5cbc[i] = puzzlesReadShort();
+ arr_i16_5cbc[i] = puzzlesReadShort();
}
// 140:2bfe
for (int16 i = 0x9c; i <= 0xcd; i++) {
- this->arr_i16_3738[i] = puzzlesReadShort();
+ arr_i16_3738[i] = puzzlesReadShort();
}
- this->arr_i16_3b38[6] = 0x9c;
- this->arr_i16_3b38[6+0x20] = 0xcd;
+ arr_i16_3b38[6] = 0x9c;
+ arr_i16_3b38[6+0x20] = 0xcd;
}
// 140:2c58
- this->var_i16_484 = 0;
- this->var_i16_68c = this->arr_i16_1eb8[8];
+ var_i16_484 = 0;
+ var_i16_68c = arr_i16_1eb8[8];
do {
- this->var_i16_68a = this->arr_i16_1eb8[0xa];
+ var_i16_68a = arr_i16_1eb8[0xa];
do {
- this->var_i16_484++;
+ var_i16_484++;
_toolbox->SetRect(
- _screenGrid[this->var_i16_484],
- this->var_i16_68a,
- this->var_i16_68c,
- this->var_i16_68a + this->arr_i16_1eb8[0xd],
- this->var_i16_68c + this->arr_i16_1eb8[0xc]
+ _screenGrid[var_i16_484],
+ var_i16_68a,
+ var_i16_68c,
+ var_i16_68a + arr_i16_1eb8[0xd],
+ var_i16_68c + arr_i16_1eb8[0xc]
);
// 140:2ce4
- } while (_zbasic->incrAndCheck(this->var_i16_68a, this->arr_i16_1eb8[0xb], this->arr_i16_1eb8[6]));
- } while (_zbasic->incrAndCheck(this->var_i16_68c, this->arr_i16_1eb8[9], this->arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[0xb], arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
// 140:2d46
- this->var_i16_484 = 0;
+ var_i16_484 = 0;
for (int16 j = 0; j <= 0xd; j++) {
for (int16 i = 0; i <= 0x13; i++) {
- this->var_i16_484++;
- this->arr_i16_2f38[i*32 + j] = this->var_i16_484;
+ var_i16_484++;
+ arr_i16_2f38[i*32 + j] = var_i16_484;
}
}
// 140:2d94
@@ -1193,8 +1193,8 @@ void FoolGame::thothKeyLastSetup() {
_toolbox->PenPat(_patterns[1]);
for (int16 j = 0; j <= 0x13; j++) {
for (int16 i = 0; i <= 0xd; i++) {
- _toolbox->EraseRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
- _toolbox->FrameRect(_screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[j]*32 + this->arr_i16_5cbc[i]]]);
+ _toolbox->EraseRect(_screenGrid[arr_i16_2f38[arr_i16_5bbc[j]*32 + arr_i16_5cbc[i]]]);
+ _toolbox->FrameRect(_screenGrid[arr_i16_2f38[arr_i16_5bbc[j]*32 + arr_i16_5cbc[i]]]);
if (((i + j*0xd) % 6) == 0)
_toolbox->Delay(0);
}
@@ -1202,19 +1202,19 @@ void FoolGame::thothKeyLastSetup() {
} else {
// 140:2e7a
for (int16 k = 0; k <= 0x13; k++) {
- this->var_i16_68a = k;
+ var_i16_68a = k;
for (int16 j = 0; j <= 0xd; j++) {
// 140:2e8c
- this->var_i16_484 = _zbasic->rndInt(0x4e) + 2;
+ var_i16_484 = _zbasic->rndInt(0x4e) + 2;
_toolbox->FillRect(
- _screenGrid[this->arr_i16_2f38[this->arr_i16_5bbc[this->var_i16_68a]*32 + this->arr_i16_5cbc[j]]],
- _patterns[this->var_i16_484]
+ _screenGrid[arr_i16_2f38[arr_i16_5bbc[var_i16_68a]*32 + arr_i16_5cbc[j]]],
+ _patterns[var_i16_484]
);
if (((j + k*0xd) % 6) == 0)
_toolbox->Delay(0);
- this->var_i16_68a++;
- if (this->var_i16_68a > 0x13) {
- this->var_i16_68a = 0;
+ var_i16_68a++;
+ if (var_i16_68a > 0x13) {
+ var_i16_68a = 0;
}
// 140:2f12
}
@@ -1225,7 +1225,7 @@ void FoolGame::thothKeyLastSetup() {
_zbasic->menu(8, 0, 1, _zbasic->str(OFF(23))); // the last key of thoth
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(24))); // return to scroll
}
- this->copyScreen(0, this->arr_bmp_b3ec);
+ copyScreen(0, arr_bmp_b3ec);
}
void FoolGame::thothSetupMenu() {
@@ -1277,16 +1277,16 @@ Common::Rect FoolGame::thothRandomVRect() {
void FoolGame::sub_140_3296() {
// 140:3296
if (!_screenOversized) {
- _toolbox->SetPort(this->var_i32_8_thoth);
+ _toolbox->SetPort(var_i32_8_thoth);
} else {
- this->sub_128_1ef8();
+ sub_128_1ef8();
}
- this->sub_140_32ac();
+ sub_140_32ac();
}
void FoolGame::sub_140_32ac() {
// 140:33ac
- this->toggleMouseCursor(false);
+ toggleMouseCursor(false);
_toolbox->PenNormal();
for (int16 j = 0; j <= 0x22; j++) {
for (int16 i = -5; i <= 0x159; i += 0xa) {
@@ -1297,33 +1297,33 @@ void FoolGame::sub_140_32ac() {
// 140:3300
Common::Rect area(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 1; i <= 0xd; i++) {
- this->var_i32_692 = _toolbox->TickCount();
+ var_i32_692 = _toolbox->TickCount();
_toolbox->InvertRect(area);
- this->delayFromMarker(1);
+ delayFromMarker(1);
}
// 140:334a
_toolbox->FillRect(area, _patterns[2]);
- this->toggleMouseCursor(true);
- _toolbox->SetPort(this->var_i32_0);
+ toggleMouseCursor(true);
+ _toolbox->SetPort(var_i32_0);
}
void FoolGame::thothAdjustPuzzleData() {
// 140:3372
// change puzzle data pointer to use high priestess data
- this->var_i16_484 = (_puzzleDataOffsets[0x34] - 1) / 1000;
- this->var_i16_7e4 = (_puzzleDataOffsets[0x34] - 1) % 1000;
- _zbasic->record(1, this->var_i16_484, this->var_i16_7e4);
- //this->_puzzleDataBuffer = this->arr_bytes_109dc;
- this->_puzzleDataBuffer = _zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
- this->_puzzleDataPtr = 0;
- this->var_bytes_232a = this->_puzzleDataBuffer;
- this->var_ptr_232a = this->_puzzleDataPtr;
+ var_i16_484 = (_puzzleDataOffsets[0x34] - 1) / 1000;
+ var_i16_7e4 = (_puzzleDataOffsets[0x34] - 1) % 1000;
+ _zbasic->record(1, var_i16_484, var_i16_7e4);
+ //_puzzleDataBuffer = arr_bytes_109dc;
+ _puzzleDataBuffer = _zbasic->readFile(1, _puzzleDataOffsets[0x35] - _puzzleDataOffsets[0x34]);
+ _puzzleDataPtr = 0;
+ var_bytes_232a = _puzzleDataBuffer;
+ var_ptr_232a = _puzzleDataPtr;
}
void FoolGame::sub_140_3412() {
// 140:3412
_toolbox->PenNormal();
- if ((this->var_i16_7ce & 2) == 0) {
+ if ((var_i16_7ce & 2) == 0) {
_toolbox->InitCursor();
}
}
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
index 7cf21ffb86b..7d18086e205 100644
--- a/engines/fool/fool_threeships.cpp
+++ b/engines/fool/fool_threeships.cpp
@@ -34,49 +34,49 @@ namespace Fool {
void FoolGame::shipsRun() {
// 128:5140
fillRect(0x127, 0x6c, 0x137, 0x84, 0);
- this->waitForMouseUp();
- this->drawPuzzleButton(_zbasic->str(OFF(0))); // "?"
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_b3ec);
+ waitForMouseUp();
+ drawPuzzleButton(_zbasic->str(OFF(0))); // "?"
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_b3ec);
fillRect(0x127, 0x6c, 0x137, 0x84, 0);
- _zbasic->get(0x6c, 0x127, 0x84, 0x137, this->arr_bmp_bbbc);
+ _zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_bbbc);
// 138:51f0
- this->var_i16_d08 = _zbasic->rndInt(5) + 5;
- this->var_i16_d0a = _zbasic->rndInt(5) - 0xa;
+ var_i16_d08 = _zbasic->rndInt(5) + 5;
+ var_i16_d0a = _zbasic->rndInt(5) - 0xa;
for (int16 i = 0; i <= 5; i++) {
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- _toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
- this->sub_128_5a6c();
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
+ _toolbox->OffsetRect(arr_rect_1910c, var_i16_d08, var_i16_d0a);
+ sub_128_5a6c();
}
// 128:5274
- this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
- this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
- this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
- this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+ arr_rect_19114.top = arr_rect_1910c.top - 0xa;
+ arr_rect_19114.left = arr_rect_1910c.left - 0xa;
+ arr_rect_19114.bottom = arr_rect_1910c.bottom + 0xa;
+ arr_rect_19114.right = arr_rect_1910c.right + 0xa;
// 128:530c
_activePuzzleSolved = false;
_keyLastPressed = 0;
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
- this->getNextEvent(-1);
- if (_toolbox->PtInRect(_event.where, this->arr_rect_19114) != 0) {
- this->sub_128_55ac();
+ getNextEvent(-1);
+ if (_toolbox->PtInRect(_event.where, arr_rect_19114) != 0) {
+ sub_128_55ac();
}
// 128:5348
- this->var_i16_d0e = _event.where.y;
- this->var_i16_d10 = _event.where.x;
+ var_i16_d0e = _event.where.y;
+ var_i16_d10 = _event.where.x;
if (_keyLastPressed > 0) {
- this->sub_128_57a2();
+ sub_128_57a2();
}
if (_stateFlags == kStateSaveGame) {
- this->saveGame();
+ saveGame();
}
}
// 128:5396
if (_activePuzzleSolved) {
- this->waitForMouseUp();
- this->playTone(0x14, 0x64, 0);
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
+ waitForMouseUp();
+ playTone(0x14, 0x64, 0);
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
_event.where.x += 5;
_event.where.y -= 5;
if (_activePuzzleStatus < 0x64) {
@@ -84,32 +84,32 @@ void FoolGame::shipsRun() {
}
for (int16 i = 1; i <= 1; i++) {
// 128:541c
- this->arr_i16_4758[0] = _event.where.y;
- this->arr_i16_4758[1] = _event.where.x;
- this->arr_i16_4758[2] = _event.where.y;
- this->arr_i16_4758[3] = _event.where.x;
+ arr_i16_4758[0] = _event.where.y;
+ arr_i16_4758[1] = _event.where.x;
+ arr_i16_4758[2] = _event.where.y;
+ arr_i16_4758[3] = _event.where.x;
for (int16 j = 1; j <= 0x19; j++) {
// 128:5462
- this->arr_i16_4758[0]--;
- this->arr_i16_4758[1]--;
- this->arr_i16_4758[2]++;
- this->arr_i16_4758[3]++;
+ arr_i16_4758[0]--;
+ arr_i16_4758[1]--;
+ arr_i16_4758[2]++;
+ arr_i16_4758[3]++;
Common::Rect temp;
- temp.top = this->arr_i16_4758[0];
- temp.left = this->arr_i16_4758[1];
- temp.bottom = this->arr_i16_4758[2];
- temp.right = this->arr_i16_4758[3];
+ temp.top = arr_i16_4758[0];
+ temp.left = arr_i16_4758[1];
+ temp.bottom = arr_i16_4758[2];
+ temp.right = arr_i16_4758[3];
_toolbox->InvertOval(temp);
}
}
// 128:5514
- this->delay(0x3c);
+ delay(0x3c);
if (_activePuzzleStatus < 0x64) {
// 128:5526
- this->waitForMouseUp();
+ waitForMouseUp();
_activePuzzleStatus = 0x64;
- this->var_i16_7ce |= 2;
- this->zoomRect(
+ var_i16_7ce |= 2;
+ zoomRect(
_event.where.y - 5,
_event.where.x - 5,
_event.where.y + 5,
@@ -123,7 +123,7 @@ void FoolGame::shipsRun() {
0x42
);
// behold the 1st key of thoth
- this->showBehold(0, 0, _zbasic->str(OFF(1)));
+ showBehold(0, 0, _zbasic->str(OFF(1)));
}
// 128:55aa
}
@@ -133,113 +133,113 @@ void FoolGame::shipsRun() {
void FoolGame::sub_128_55ac() {
// 128:55ac
- if ((this->var_i16_d10 == _event.where.x) && (this->var_i16_d0e == _event.where.y)) {
+ if ((var_i16_d10 == _event.where.x) && (var_i16_d0e == _event.where.y)) {
return;
}
- this->var_i16_d08 = _zbasic->rndInt(5) + 5;
- this->var_i16_d0a = _zbasic->rndInt(5) + 5;
+ var_i16_d08 = _zbasic->rndInt(5) + 5;
+ var_i16_d0a = _zbasic->rndInt(5) + 5;
if (_zbasic->maybe()) {
- this->var_i16_d08 *= -1;
+ var_i16_d08 *= -1;
}
// 128:560a
if (_zbasic->maybe()) {
- this->var_i16_d0a *= -1;
+ var_i16_d0a *= -1;
}
// 128:5620
- if (this->arr_rect_1910c.top < 0x50) {
- this->var_i16_d0a = 0xa;
+ if (arr_rect_1910c.top < 0x50) {
+ var_i16_d0a = 0xa;
}
// 128:5640
- if (this->arr_rect_1910c.left < 0x3c) {
- this->var_i16_d08 = 0xa;
+ if (arr_rect_1910c.left < 0x3c) {
+ var_i16_d08 = 0xa;
}
- if (this->arr_rect_1910c.bottom > 0x104) {
- this->var_i16_d0a = -0xa;
+ if (arr_rect_1910c.bottom > 0x104) {
+ var_i16_d0a = -0xa;
}
- if (this->arr_rect_1910c.right > 0x1a4) {
- this->var_i16_d08 = -0xa;
+ if (arr_rect_1910c.right > 0x1a4) {
+ var_i16_d08 = -0xa;
}
// 128:56a0
- for (this->var_i16_68a = 0; this->var_i16_68a <= 0x5; this->var_i16_68a++) {
- _zbasic->put(this->arr_rect_1910c.left, this->arr_rect_1910c.top, this->arr_bmp_bbbc, kSrcCopy);
- _toolbox->OffsetRect(this->arr_rect_1910c, this->var_i16_d08, this->var_i16_d0a);
- this->sub_128_5a6c();
+ for (var_i16_68a = 0; var_i16_68a <= 0x5; var_i16_68a++) {
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
+ _toolbox->OffsetRect(arr_rect_1910c, var_i16_d08, var_i16_d0a);
+ sub_128_5a6c();
}
// 128:5708
- this->arr_rect_19114.top = this->arr_rect_1910c.top - 0xa;
- this->arr_rect_19114.left = this->arr_rect_1910c.left - 0xa;
- this->arr_rect_19114.bottom = this->arr_rect_1910c.bottom + 0xa;
- this->arr_rect_19114.right = this->arr_rect_1910c.right + 0xa;
+ arr_rect_19114.top = arr_rect_1910c.top - 0xa;
+ arr_rect_19114.left = arr_rect_1910c.left - 0xa;
Commit: 3ddae716dd3e3a2f285dcec682987a3aae3bd2f6
https://github.com/scummvm/scummvm/commit/3ddae716dd3e3a2f285dcec682987a3aae3bd2f6
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:33+02:00
Commit Message:
FOOL: Remove all generic var names in prologue/finale
Changed paths:
engines/fool/fool_finale.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/utils.cpp
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index a61bb61c6cf..5a3fcdbbaf9 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -36,6 +36,8 @@ namespace Fool {
// run finale
void FoolPrologue::finaleRun() {
+
+
// 131:0004
_prologueLoading = 45;
finaleDrawLoadingMsg();
@@ -98,10 +100,10 @@ void FoolPrologue::finaleRun() {
}
}
// 131:026e
- var_i16_18e = SCREEN_HEIGHT;
+ //var_i16_18e = SCREEN_HEIGHT;
shuffleScanlines();
- var_i32_1a6 = _zbasic->mem(-1);
- _toolbox->SetPortBits(var_i32_32);
+ _zbasic->mem(-1);
+ _toolbox->SetPortBits(_dstPage);
if (!((_windowWidth == SCREEN_WIDTH) && (_windowHeight == SCREEN_HEIGHT))) {
// 131:02ac
fillRect(0, 0, MENU_HEIGHT, SCREEN_WIDTH, 1);
@@ -174,15 +176,15 @@ void FoolPrologue::finaleRun() {
// 131:04da
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[5];
- _toolbox->CopyBits(var_i32_32, var_i32_40, var_i16_38, var_i16_38, kSrcCopy, nullptr);
+ _srcPage = _screenPages[5];
+ _toolbox->CopyBits(_dstPage, _srcPage, _pageRect, _pageRect, kSrcCopy, nullptr);
setPortBitsToPage(5);
fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
finaleDrawFoolUhOh();
// 131:0538
- _toolbox->CopyBits(var_i32_32, var_i32_4e, var_i16_38, var_i16_38, kSrcCopy, nullptr);
- _toolbox->SetPortBits(var_i32_4e);
+ _toolbox->CopyBits(_dstPage, _bgPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->SetPortBits(_bgPage);
// 131:0554
fillRect(0, 0, 0xa0, 0x15e, 0);
@@ -191,18 +193,18 @@ void FoolPrologue::finaleRun() {
// 131:05b0
setPortBitsToPage(6);
- _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
setPortBitsToPage(7);
- _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
setPortBitsToPage(8);
- _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
setPortBitsToPage(9);
- _toolbox->CopyBits(var_i32_4e, var_i32_40, var_i16_38, var_i16_38, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
// 131:0630
// tree morphing into priestess
- _toolbox->SetPortBits(var_i32_32);
- _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, arr_i32_3bca4);
+ _toolbox->SetPortBits(_dstPage);
+ _zbasic->get(0x1bc, 0xc1, 0x1f2, 0x11b, _foolSlice);
delayFromMarker(0x3c);
fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
scanlineBlitPageToScreen(0x6, 0, SCREEN_WIDTH, 0x3);
@@ -222,23 +224,23 @@ void FoolPrologue::finaleRun() {
// 131:0730
int16 windHeight = 0; // windHeight
- var_i16_18e = 0;
+ int16 windCount = 0;
for (int j = 1; j <= 0x63; j++) {
if (windHeight < SCREEN_HEIGHT) {
// 131:074e
windHeight += _zbasic->maybe() ? 0x4 : 0x5;
}
- if (var_i16_18e < 0x41) {
+ if (windCount < 0x41) {
// 131:0770
- var_i16_18e += 1;
- _rain[var_i16_18e].xPos = _zbasic->rndInt(32);
- _rain[var_i16_18e].yPos = _zbasic->rndInt(windHeight);
- _rain[var_i16_18e].size = _zbasic->rndInt(0xa) + 0xa;
- _rain[var_i16_18e].veloc = _rain[var_i16_18e].size*2;
- finaleDrawWind(var_i16_18e);
+ windCount++;
+ _rain[windCount].xPos = _zbasic->rndInt(32);
+ _rain[windCount].yPos = _zbasic->rndInt(windHeight);
+ _rain[windCount].size = _zbasic->rndInt(0xa) + 0xa;
+ _rain[windCount].veloc = _rain[windCount].size*2;
+ finaleDrawWind(windCount);
}
// 131:07ea
- for (int i = 1; i <= var_i16_18e; i++) {
+ for (int i = 1; i <= windCount; i++) {
finaleDrawWind(i);
_rain[i].xPos += _rain[i].veloc;
@@ -259,7 +261,8 @@ void FoolPrologue::finaleRun() {
// 131:0926
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ Common::Rect temp;
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->PenPat(_patterns[3]);
_zbasic->picture(0x6d, 0x49, _pics[0x1c]);
_zbasic->picture(0x65, 0x48, _pics[0x1d]);
@@ -270,7 +273,10 @@ void FoolPrologue::finaleRun() {
_toolbox->PaintPoly(zapShape);
for (int i = 0; i <= 0x21; i++) {
_tickMarker = _toolbox->TickCount();
- _toolbox->InvertRect(arr_i16_1bc);
+ // limit flashing to WCAG recommendation
+ if ((i % 10) == 0) {
+ _toolbox->InvertRect(temp);
+ }
delayFromMarker(0);
}
@@ -284,12 +290,10 @@ void FoolPrologue::finaleRun() {
// horrible flashing fool duplication spree
for (int i = 1; i <= 0x63; i++) {
_tickMarker = _toolbox->TickCount();
- var_i16_74 = _zbasic->rndInt(0x1ca);
- var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->put(var_i16_74, var_i16_192, arr_i32_3bca4, (i % 2) ? kSrcCopy : kNotSrcCopy);
+ _zbasic->put(_zbasic->rndInt(0x1ca), _zbasic->rndInt(0xfc), _foolSlice, (i % 2) ? kSrcCopy : kNotSrcCopy);
// limit flashing to WCAG recommendation
if ((i % 10) == 0) {
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp);
}
delayFromMarker(0);
}
@@ -300,14 +304,14 @@ void FoolPrologue::finaleRun() {
// 131:0af6
while (_toolbox->TickCount() < (_tickMarker + 0x78)) {
- var_i16_74 = _zbasic->rndInt(0x1ca);
- var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->get(var_i16_74, var_i16_192, var_i16_74 + 0x36, var_i16_192 + 0x5a, arr_i32_3bca4);
+ int16 xPos = _zbasic->rndInt(0x1ca);
+ int16 yPos = _zbasic->rndInt(0xfc);
+ _zbasic->get(xPos, yPos, xPos + 0x36, yPos + 0x5a, _foolSlice);
// 131:0b54
- var_i16_74 = _zbasic->rndInt(0x1ca);
- var_i16_192 = _zbasic->rndInt(0xfc);
- _zbasic->put(var_i16_74, var_i16_192, arr_i32_3bca4, kSrcCopy);
+ xPos = _zbasic->rndInt(0x1ca);
+ yPos = _zbasic->rndInt(0xfc);
+ _zbasic->put(xPos, yPos, _foolSlice, kSrcCopy);
_toolbox->Delay(0);
}
@@ -318,7 +322,7 @@ void FoolPrologue::finaleRun() {
copyScreenToPage(5);
// fade in the fool
_zbasic->picture(0x198, 0x102, _pics[0x25]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delay(0x3c);
scanlineBlitPageToScreen(5, 0, SCREEN_WIDTH, 0);
@@ -335,7 +339,7 @@ void FoolPrologue::finaleRun() {
// 131:0c6c
// high priestess becomes giant
for (int i = 0x6; i <= 0xa; i++) {
- arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
+ _screenPages[i]->copyFrom(*_screenPages[5]);
}
setPortBitsToPage(0x6);
_zbasic->picture(0x6, 0x8f, _pics[0x20]);
@@ -352,7 +356,7 @@ void FoolPrologue::finaleRun() {
for (int i = 0x20; i <= 0x23; i++) {
_toolbox->ReleaseResource(_pics[i]);
}
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0x64);
_zbasic->picture(0x198, 0x102, _pics[0x25]);
for (int i = 0x6; i <= 0xa; i++) {
@@ -374,7 +378,7 @@ void FoolPrologue::finaleRun() {
_tickMarker = _toolbox->TickCount();
// 131:0e76
- arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
+ _screenPages[5]->copyFrom(*_screenPages[4]);
setPortBitsToPage(0x5);
_zbasic->picture(0x73, 0x28, _pics[0x24]);
_zbasic->picture(0x191, 0x102, _pics[0x27]);
@@ -385,10 +389,10 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0x7);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0x118, 0x19, _pics[0x2a]); // wadjet eye
- arr_i32_41296[8]->copyFrom(*arr_i32_41296[5]);
+ _screenPages[8]->copyFrom(*_screenPages[5]);
setPortBitsToPage(0x8);
_zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
- arr_i32_41296[9]->copyFrom(*arr_i32_41296[4]);
+ _screenPages[9]->copyFrom(*_screenPages[4]);
setPortBitsToPage(0x9);
_zbasic->picture(0x18f, 0xc0, _pics[0x2b]);
setPortBitsToPage(0xa);
@@ -397,7 +401,7 @@ void FoolPrologue::finaleRun() {
// 131:1056
_toolbox->ReleaseResource(_pics[0x24]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0x78);
fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
scanlineBlitPageToScreen(0x5, 0x64, 0x19c, 0x0);
@@ -416,16 +420,16 @@ void FoolPrologue::finaleRun() {
for (int i = 0xdc; i >= 0x19; i -= 5) {
// 131:10de
_tickMarker = _toolbox->TickCount();
- var_i32_4e->copyFrom(*arr_i32_41296[5]);
+ _bgPage->copyFrom(*_screenPages[5]);
dstRect.top = i;
srcRect.bottom = 0x19 + (0xdf - i);
// 131:1124
- var_i32_40 = arr_i32_41296[6];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcBic, nullptr);
- var_i32_40 = arr_i32_41296[7];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcOr, nullptr);
+ _srcPage = _screenPages[6];
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcBic, nullptr);
+ _srcPage = _screenPages[7];
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcOr, nullptr);
delayFromMarker(0x2);
- _toolbox->CopyBits(var_i32_4e, var_i32_32, dstRect, dstRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_bgPage, _dstPage, dstRect, dstRect, kSrcCopy, nullptr);
}
_toolbox->Delay(0);
@@ -434,7 +438,7 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0x5);
fillRect(0xc8, 0x145, 0xd7, SCREEN_WIDTH, 2);
_zbasic->picture(0x18f, 0xc0, _pics[0x2b]); // fool card
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
_toolbox->PenSize(0x5, 0x5);
@@ -471,7 +475,7 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0, 0, _pics[0x2f]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0xa);
srcRect.left = 0x18b;
srcRect.right = 0x1ef;
@@ -486,7 +490,7 @@ void FoolPrologue::finaleRun() {
srcRect.bottom = srcRect.top + 0x96;
dstRect.top = i - 1;
dstRect.bottom = dstRect.top + 0x96;
- _toolbox->CopyBits(var_i32_32, var_i32_32, srcRect, dstRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_dstPage, _dstPage, srcRect, dstRect, kSrcCopy, nullptr);
delayFromMarker(0);
}
@@ -501,10 +505,12 @@ void FoolPrologue::finaleRun() {
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
_toolbox->PenSize(0x3, 0x3);
- var_i16_6c.left = 0x190;
- var_i16_6c.right = SCREEN_WIDTH;
- var_i16_6c.top = 0x50;
- var_i16_6c.bottom = SCREEN_HEIGHT;
+
+ Common::Rect bindleRect; // var_i16_6c
+ bindleRect.left = 0x190;
+ bindleRect.right = SCREEN_WIDTH;
+ bindleRect.top = 0x50;
+ bindleRect.bottom = SCREEN_HEIGHT;
srcRect.left = 0;
srcRect.right = 0x32;
srcRect.top = 0;
@@ -513,40 +519,41 @@ void FoolPrologue::finaleRun() {
// 131:14d8
// fool drops bindle
- var_i32_40 = arr_i32_41296[5];
- _toolbox->SetPortBits(var_i32_4e);
+ _srcPage = _screenPages[5];
+ _toolbox->SetPortBits(_bgPage);
for (int i = 1; i <= 0xf; i++) {
_tickMarker = _toolbox->TickCount();
- var_i32_4e->copyFrom(*arr_i32_41296[6]);
+ _bgPage->copyFrom(*_screenPages[6]);
bindleHeight += 5 + i*2;
dstRect.left = 0x1e0;
dstRect.right = dstRect.left + 0x32;
dstRect.top = bindleHeight;
dstRect.bottom = dstRect.top + 0x32;
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcXor, nullptr);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcXor, nullptr);
// 131:1582
_toolbox->MoveTo(0x190 - i, bindleHeight - 0x1e + i*3);
_toolbox->LineTo(0x1f4, bindleHeight + 0xa - i);
- _toolbox->CopyBits(var_i32_4e, var_i32_32, var_i16_6c, var_i16_6c, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_bgPage, _dstPage, bindleRect, bindleRect, kSrcCopy, nullptr);
delayFromMarker(0x1);
}
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
_toolbox->PenNormal();
_toolbox->PenMode(kPatXor);
// 131:1606
+ Particle splash[251];
for (int j = 0; j <= 1; j++) {
for (int i = 1; i <= 0xfa; i++) {
_tickMarker = _toolbox->TickCount();
if (j == 0) {
- arr_i16_1e8[i] = 0x1f4 - i + _zbasic->rndInt(i);
- arr_i16_1e8[i+0xfb] = SCREEN_HEIGHT - _zbasic->rndInt(i);
+ splash[i].xPos = 0x1f4 - i + _zbasic->rndInt(i);
+ splash[i].yPos = SCREEN_HEIGHT - _zbasic->rndInt(i);
}
// 131:1692
- _toolbox->MoveTo(arr_i16_1e8[i], arr_i16_1e8[i+0xfb]);
- _toolbox->LineTo(arr_i16_1e8[i], arr_i16_1e8[i+0xfb]);
+ _toolbox->MoveTo(splash[i].xPos, splash[i].yPos);
+ _toolbox->LineTo(splash[i].xPos, splash[i].yPos);
if (i % 0x19 == 0) {
delayFromMarker(0x1);
}
@@ -590,7 +597,7 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(5);
_zbasic->picture(0, 0, _pics[0x37]);
_toolbox->ReleaseResource(_pics[0x37]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
}
}
// 131:19be
@@ -608,64 +615,65 @@ void FoolPrologue::finaleRun() {
drawTextRight(_zbasic->str(OFF(9)), 0x181, 0x5e);
// have been able to find them so easily
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(10)).encode().c_str()), 0x181, 0x6f);
- arr_rect_41af4.top = 6;
- arr_rect_41af4.left = 0xd0;
- arr_rect_41af4.bottom = 0x6c;
- arr_rect_41af4.right = 0x133;
- arr_i16_41afc.top = 0xa;
- arr_i16_41afc.left = 0xb4;
- arr_i16_41afc.bottom = 0x14c;
- arr_i16_41afc.right = 0x1f6;
- arr_i16_41b04[0] = 2;
- arr_i16_41b04[1] = 0xa;
- arr_i16_41b04[2] = 0xd;
+
+ Common::Rect circleStart, circleEnd;
+ float circleMid[8] = { 0 }; // arr_f64_41bbe
+ circleStart.top = 6;
+ circleStart.left = 0xd0;
+ circleStart.bottom = 0x6c;
+ circleStart.right = 0x133;
+ circleEnd.top = 0xa;
+ circleEnd.left = 0xb4;
+ circleEnd.bottom = 0x14c;
+ circleEnd.right = 0x1f6;
+ int16 steps = 0xd;
// 131:1b6e
// unroll loops
- arr_f64_41bbe[0] = (float)arr_rect_41af4.top;
- arr_f64_41bbe[0+4] = (float)(arr_i16_41afc.top - arr_rect_41af4.top) / arr_i16_41b04[2];
- arr_f64_41bbe[1] = (float)arr_rect_41af4.left;
- arr_f64_41bbe[1+4] = (float)(arr_i16_41afc.left - arr_rect_41af4.left) / arr_i16_41b04[2];
- arr_f64_41bbe[2] = (float)arr_rect_41af4.bottom;
- arr_f64_41bbe[2+4] = (float)(arr_i16_41afc.bottom - arr_rect_41af4.bottom) / arr_i16_41b04[2];
- arr_f64_41bbe[3] = (float)arr_rect_41af4.right;
- arr_f64_41bbe[3+4] = (float)(arr_i16_41afc.right - arr_rect_41af4.right) / arr_i16_41b04[2];
+ circleMid[0] = (float)circleStart.top;
+ circleMid[0+4] = (float)(circleEnd.top - circleStart.top) / steps;
+ circleMid[1] = (float)circleStart.left;
+ circleMid[1+4] = (float)(circleEnd.left - circleStart.left) / steps;
+ circleMid[2] = (float)circleStart.bottom;
+ circleMid[2+4] = (float)(circleEnd.bottom - circleStart.bottom) / steps;
+ circleMid[3] = (float)circleStart.right;
+ circleMid[3+4] = (float)(circleEnd.right - circleStart.right) / steps;
// 131:1c24
_toolbox->PenPat(_patterns[1]);
_toolbox->PenMode(kPatXor);
// pre-draw the puzzle circles coming off the high priestess' head
for (int16 j = 6; j <= 9; j++) {
- arr_i32_41296[j]->copyFrom(*arr_i32_41296[j - 1]);
+ _screenPages[j]->copyFrom(*_screenPages[j - 1]);
// 131:1c7a
setPortBitsToPage(j);
if (j == 6) {
- _toolbox->PaintOval(arr_rect_41af4);
+ _toolbox->PaintOval(circleStart);
}
// 131:1c9c
for (int16 i = 0; i <= 2; i++) {
// unrolled loop
- arr_f64_41bbe[0] += arr_f64_41bbe[0+4];
- arr_i16_41b0a.top = (int16)arr_f64_41bbe[0];
- arr_f64_41bbe[1] += arr_f64_41bbe[1+4];
- arr_i16_41b0a.left = (int16)arr_f64_41bbe[1];
- arr_f64_41bbe[2] += arr_f64_41bbe[2+4];
- arr_i16_41b0a.bottom = (int16)arr_f64_41bbe[2];
- arr_f64_41bbe[3] += arr_f64_41bbe[3+4];
- arr_i16_41b0a.right = (int16)arr_f64_41bbe[3];
+ circleMid[0] += circleMid[0+4];
+ temp.top = (int16)circleMid[0];
+ circleMid[1] += circleMid[1+4];
+ temp.left = (int16)circleMid[1];
+ circleMid[2] += circleMid[2+4];
+ temp.bottom = (int16)circleMid[2];
+ circleMid[3] += circleMid[3+4];
+ temp.right = (int16)circleMid[3];
// 131:1d44
- _toolbox->PaintOval(arr_i16_41b0a);
+ _toolbox->PaintOval(temp);
}
}
- arr_i32_41296[10]->copyFrom(*arr_i32_41296[9]);
+ _screenPages[10]->copyFrom(*_screenPages[9]);
// 131:1d98
setPortBitsToPage(0xa);
- _toolbox->PaintOval(arr_i16_41afc);
+ _toolbox->PaintOval(circleEnd);
setPortBitsToPage(5);
- _toolbox->SetRect(arr_i16_1bc, 0xae, 0x8c, 0xb6, 0x94);
- _toolbox->InvertOval(arr_i16_1bc);
- _toolbox->SetRect(arr_i16_1bc, 0x151, 0x86, 0x159, 0x8e);
- _toolbox->InvertOval(arr_i16_1bc);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetRect(temp, 0xae, 0x8c, 0xb6, 0x94);
+ _toolbox->InvertOval(temp);
+ _toolbox->SetRect(temp, 0x151, 0x86, 0x159, 0x8e);
+ _toolbox->InvertOval(temp);
+ _toolbox->SetPortBits(_dstPage);
drawClickMessageRightAlign();
waitForClick();
@@ -673,32 +681,34 @@ void FoolPrologue::finaleRun() {
// card gets vivisected
fillRect(0, 0, 0x96, 0x18b, 2);
fillRect(0x12c, 0x15e, 0x156, 0x200, 2);
- var_i16_18e = 0;
+ int16 cardSliceOffset = 0;
+ Particle cardSliceShift[15];
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
_zbasic->get(
0x190,
i + 0xa,
0x1ea,
i + 0x14,
- arr_i32_1e3fc[i/0xa]
+ _cardSlices[i/0xa]
);
- arr_i16_1e8[i + 0] = 0x190;
- var_i16_18e++;
- if (var_i16_18e > 4) {
- var_i16_18e = 1;
+ cardSliceShift[i/0xa].xPos = 0x190;
+ cardSliceOffset++;
+ if (cardSliceOffset > 4) {
+ cardSliceOffset = 1;
}
- arr_i16_1e8[i + 0xfb] = var_i16_18e;
+ cardSliceShift[i/0xa].veloc = cardSliceOffset;
}
// 131:1f1a
for (int16 j = 1; j <= 0xf; j++) {
if (j < 9) {
- _toolbox->InvertRect(var_i16_38);
+ _toolbox->InvertRect(_pageRect);
}
_tickMarker = _toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
- arr_i16_1e8[i] -= arr_i16_1e8[0xfb + i]*j;
- _zbasic->put(arr_i16_1e8[i], i + 0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ int16 index = i / 0xa;
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kNotSrcXor);
+ cardSliceShift[index].xPos -= cardSliceShift[index].veloc*j;
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kSrcCopy);
// 131:2062
}
// 131:2072
@@ -707,55 +717,56 @@ void FoolPrologue::finaleRun() {
for (int16 j = 1; j <= 0xf; j++) {
_tickMarker = _toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
- _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kNotSrcXor);
- arr_i16_1e8[i] += arr_i16_1e8[0xfb + i]*j;
- _zbasic->put(arr_i16_1e8[i], i+0xa, arr_i32_1e3fc[i/0xa], kSrcCopy);
+ int16 index = i / 0xa;
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kNotSrcXor);
+ cardSliceShift[index].xPos += cardSliceShift[index].veloc*j;
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kSrcCopy);
}
delayFromMarker(2);
}
// 131:21e0
_zbasic->picture(0x193, 0x2d, _pics[0x33]);
- var_i16_1b6 = 0x14;
+ int16 yPos = 0x14;
dialog = _zbasic->str(OFF(11)); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
_tickMarker = _toolbox->TickCount();
_zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
- var_i16_1b6 += i;
- drawText(dialog, 5 + i*2, var_i16_1b6);
+ yPos += i;
+ drawText(dialog, 5 + i*2, yPos);
delayFromMarker(3);
}
// 131:2282
_zbasic->picture(0x193, 0x2d, _pics[0x34]);
_tickMarker = _toolbox->TickCount();
setPortBitsToPage(4);
- _toolbox->SetRect(arr_i16_1bc, 0, 0, 0x200, 0xdf);
- _toolbox->InvertRect(arr_i16_1bc);
- _toolbox->SetRect(arr_i16_1bc, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, 0xdf);
+ _toolbox->InvertRect(temp);
+ _toolbox->SetRect(temp, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->PenMode(kPatOr);
_toolbox->PenPat(_patterns[1]);
- _toolbox->PaintRect(arr_i16_1bc);
+ _toolbox->PaintRect(temp);
// 131:2316
- arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0x4].get());
+ _screenPages[0xb]->copyFrom(*_screenPages[0x4].get());
setPortBitsToPage(0xb);
_zbasic->picture(0xb5, 0xa, _pics[0x38]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0x1e);
_toolbox->PenNormal();
- var_i16_3e6 = 0x17c;
+ int16 xPos = 0x17c;
for (int16 j = 0; j <= 0x14a; j++) {
_tickMarker = _toolbox->TickCount();
if (j > 0xb4) {
- var_i16_3e6 = SCREEN_WIDTH;
+ xPos = SCREEN_WIDTH;
}
// 131:2398
for (int16 i = 0xa; i <= 0x14; i += 5) {
_toolbox->MoveTo(0, j + _zbasic->rndInt(i));
- _toolbox->LineTo(var_i16_3e6, j + _zbasic->rndInt(i));
+ _toolbox->LineTo(xPos, j + _zbasic->rndInt(i));
// 131:23d8
}
_toolbox->MoveTo(0, j);
- _toolbox->LineTo(var_i16_3e6, j);
+ _toolbox->LineTo(xPos, j);
if ((j % 4) == 0) {
delayFromMarker(0);
}
@@ -783,50 +794,51 @@ void FoolPrologue::finaleRun() {
waitForClick();
// 131:258a
- var_i32_40 = arr_i32_41296[5];
+ _srcPage = _screenPages[5];
for (int16 i = 1; i <= 0x1a; i++) {
srcRect.top = 0xab - (int16)(i*6.66f);
srcRect.left = 0x100 - i*0xa;
srcRect.bottom = 0xab + (int16)(i*6.66f);
srcRect.right = 0x100 + i*0xa;
- _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
// 131:266e
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
- _toolbox->SetRect(arr_i16_1bc, 0xae, 0x8c, 0xb6, 0x94);
- _toolbox->SetRect(arr_i32_1c4, 0x151, 0x86, 0x159, 0x8e);
- _toolbox->InsetRect(arr_i16_1bc, 3, 3);
- _toolbox->InsetRect(arr_i32_1c4, 3, 3);
- _toolbox->FillOval(arr_i16_1bc, _patterns[0]);
- _toolbox->FillOval(arr_i32_1c4, _patterns[0]);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ Common::Rect eye1, eye2;
+ _toolbox->SetRect(eye1, 0xae, 0x8c, 0xb6, 0x94);
+ _toolbox->SetRect(eye2, 0x151, 0x86, 0x159, 0x8e);
+ _toolbox->InsetRect(eye1, 3, 3);
+ _toolbox->InsetRect(eye2, 3, 3);
+ _toolbox->FillOval(eye1, _patterns[0]);
+ _toolbox->FillOval(eye2, _patterns[0]);
_toolbox->Delay(0);
// 131:2720
for (int i = 1; i <= 3; i++) {
_tickMarker = _toolbox->TickCount();
- _toolbox->InsetRect(arr_i16_1bc, -1, -1);
- _toolbox->InsetRect(arr_i32_1c4, -1, -1);
- _toolbox->FillOval(arr_i16_1bc, _patterns[0]);
- _toolbox->FillOval(arr_i32_1c4, _patterns[0]);
+ _toolbox->InsetRect(eye1, -1, -1);
+ _toolbox->InsetRect(eye2, -1, -1);
+ _toolbox->FillOval(eye1, _patterns[0]);
+ _toolbox->FillOval(eye2, _patterns[0]);
delayFromMarker(1);
}
// 131:27a2
copyScreenToPage(5);
- _toolbox->SetRect(arr_i16_1bc, 0xd0, 6, 0x133, 0x6c);
+ _toolbox->SetRect(temp, 0xd0, 6, 0x133, 0x6c);
_toolbox->PenMode(kPatXor);
_toolbox->PenSize(3, 3);
- var_i16_18e = 10;
+ int16 endAngle = 10;
for (int16 i = 355; i >= 180; i -= 5) {
_tickMarker = _toolbox->TickCount();
- _toolbox->FrameArc(arr_i16_1bc, i, var_i16_18e);
- var_i16_18e += 10;
+ _toolbox->FrameArc(temp, i, endAngle);
+ endAngle += 10;
delayFromMarker(1);
}
// 131:281c
for (int16 i = 0; i <= 6; i++) {
_tickMarker = _toolbox->TickCount();
- _toolbox->FrameOval(arr_i16_1bc);
+ _toolbox->FrameOval(temp);
delayFromMarker(1);
}
// 131:284c
@@ -836,27 +848,30 @@ void FoolPrologue::finaleRun() {
delayFromMarker(1);
}
// 131:2878
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- for (int16 i = 0; i <= 0x1e; i++) {
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ for (int16 i = 0; i <= 32; i++) { // was: 30
_tickMarker = _toolbox->TickCount();
- _toolbox->InvertRect(arr_i16_1bc);
+ // limit flashing to WCAG recommendation
+ if ((i % 8) == 0) {
+ _toolbox->InvertRect(temp);
+ }
delayFromMarker(1);
}
// 131:28c2
scanlineBlitPageToScreen(0xb, 0, SCREEN_WIDTH, 1);
- arr_i32_41296[5]->copyFrom(*arr_i32_41296[11]);
+ _screenPages[5]->copyFrom(*_screenPages[11]);
setPortBitsToPage(5);
_zbasic->picture(0x16, 0xde, _pics[0x4b]);
// 131:2926
for (int16 i = 6; i <= 7; i++) {
- arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
+ _screenPages[i]->copyFrom(*_screenPages[5]);
}
setPortBitsToPage(6);
_zbasic->picture(0x10, 0x54, _pics[0x4c]);
setPortBitsToPage(7);
_zbasic->picture(0x10, 0x54, _pics[0x4c]);
_zbasic->picture(0x2, 0x50, _pics[0x52]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delay(0x1e);
scanlineBlitPageToScreen(0x6, 0, SCREEN_WIDTH, 1);
delay(0x1e);
@@ -871,7 +886,7 @@ void FoolPrologue::finaleRun() {
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(18)).encode().c_str()), 0x46, 0x3e);
_tickMarker = _toolbox->TickCount();
for (int16 i = 6; i <= 0xa; i++) {
- arr_i32_41296[i]->copyFrom(*arr_i32_41296[5]);
+ _screenPages[i]->copyFrom(*_screenPages[5]);
}
setPortBitsToPage(6);
_zbasic->picture(0x15, 0x55, _pics[0x4d]);
@@ -884,24 +899,25 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0xa);
_zbasic->picture(0x1d, 0x58, _pics[0x51]);
// 131:2b7c
+ Line smears[251]; // arr_i16_1e8
for (int16 i = 1; i <= 0xe; i++) {
- arr_i16_1e8[i] = _zbasic->readDataInt();
- arr_i16_1e8[i + 0xfb] = _zbasic->readDataInt();
- arr_i16_1e8[i + 0x1f6] = _zbasic->readDataInt();
- arr_i16_1e8[i + 0x2f1] = _zbasic->readDataInt();
+ smears[i].xStart = _zbasic->readDataInt();
+ smears[i].yStart = _zbasic->readDataInt();
+ smears[i].xEnd = _zbasic->readDataInt();
+ smears[i].yEnd = _zbasic->readDataInt();
}
// 131:2c02
_zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcOr);
for (int16 i = 1; i <= 0xe; i++) {
// THEBOOKOFTHOTH
- drawText(_zbasic->midStr(_zbasic->str(OFF(19)), i, 1), arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ drawText(_zbasic->midStr(_zbasic->str(OFF(19)), i, 1), smears[i].xStart, smears[i].yStart);
}
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
// that's it! the answer is the book of thoth
drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(20)).encode().c_str()), 0x32, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(21)).encode().c_str()), 0x3c, 0x3e);
// 131:2cf6
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0xd2);
drawClickMessageRightAlign();
waitForClick();
@@ -939,28 +955,29 @@ void FoolPrologue::finaleRun() {
// THEBOOKOFTHOTH
dialog = _zbasic->midStr(_zbasic->str(OFF(23)), i, 1);
for (int16 l = 0; l <= 1; l++) {
- var_i16_18e = 0x21;
- arr_f64_41bbe[0] = arr_i16_1e8[i];
- arr_f64_41bbe[2] = (arr_i16_1e8[0x1f6 + i] - arr_i16_1e8[i]) / var_i16_18e;
- arr_f64_41bbe[1] = arr_i16_1e8[0xfb + i];
- arr_f64_41bbe[3] = (arr_i16_1e8[0x2f1 + i] - arr_i16_1e8[0xfb + i]) / var_i16_18e;
+ steps = 0x21;
+ float smearMid[4] = { 0 }; // arr_f64_41bbe
+ smearMid[0] = (float)smears[i].xStart;
+ smearMid[2] = (float)(smears[i].xEnd - smears[i].xStart) / steps;
+ smearMid[1] = (float)smears[i].yStart;
+ smearMid[3] = (float)(smears[i].yEnd - smears[i].yStart) / steps;
// 131:2f66
if (l == 0) {
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcOr);
- drawText(dialog, arr_i16_1e8[i], arr_i16_1e8[i + 0xfb]);
+ drawText(dialog, smears[i].xStart, smears[i].yStart);
}
// 131:2fc4
_zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcXor);
- for (int16 k = 1; k <= var_i16_18e-1; k++) {
- arr_f64_41bbe[0] += arr_f64_41bbe[0 + 2];
- int16 x = (int16)arr_f64_41bbe[0];
- arr_f64_41bbe[1] += arr_f64_41bbe[1 + 2];
- int16 y = (int16)arr_f64_41bbe[1];
+ for (int16 k = 1; k <= steps-1; k++) {
+ smearMid[0] += smearMid[0 + 2];
+ int16 x = (int16)smearMid[0];
+ smearMid[1] += smearMid[1 + 2];
+ int16 y = (int16)smearMid[1];
// 131:3078
drawText(dialog, x, y);
}
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
- drawText(dialog, arr_i16_1e8[0x1f6 + i], arr_i16_1e8[0x2f1 + i]);
+ drawText(dialog, smears[i].xEnd, smears[i].yEnd);
delay(1);
}
}
@@ -974,20 +991,20 @@ void FoolPrologue::finaleRun() {
// that's it! the answer is the book of thoth
drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(24)).encode().c_str()), 0x32, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(25)).encode().c_str()), 0x3c, 0x3e);
- arr_i32_41296[0xb]->copyFrom(*arr_i32_41296[0xa]);
+ _screenPages[0xb]->copyFrom(*_screenPages[0xa]);
setPortBitsToPage(0xb);
- arr_rect_41af4.top = 0xa;
- arr_rect_41af4.left = 0xb4;
- arr_rect_41af4.bottom = 0x14c;
- arr_rect_41af4.right = 0x1f6;
- _toolbox->InvertOval(arr_rect_41af4);
+ temp.top = 0xa;
+ temp.left = 0xb4;
+ temp.bottom = 0x14c;
+ temp.right = 0x1f6;
+ _toolbox->InvertOval(temp);
for (int16 i = 5; i <= 0x9; i++) {
- arr_i32_41296[i]->copyFrom(*arr_i32_41296[4]);
+ _screenPages[i]->copyFrom(*_screenPages[4]);
}
// 131:327e
setPortBitsToPage(4);
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, 0xdf);
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, 0xdf);
+ _toolbox->InvertRect(temp);
_zbasic->picture(0xd, 0xf0, _pics[0x58]);
_zbasic->picture(0x186, 0xc, _pics[0x59]);
setPortBitsToPage(5);
@@ -1001,7 +1018,7 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(9);
_zbasic->picture(0xf, 0xf3, _pics[0x57]);
// 131:339c
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0x96);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
// that's it! the answer is the book of thoth
@@ -1016,10 +1033,10 @@ void FoolPrologue::finaleRun() {
delay(3);
}
_zbasic->picture(0xd, 0xf0, _pics[0x58]);
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, 0xdf);
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, 0xdf);
// lightning flash in sky
for (int16 i = 0x1b; i >= 0; i--) {
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp);
// this is fudged considerably
// 131:34c4
_toolbox->Delay(i/4);
@@ -1035,12 +1052,12 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0xa);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(wadjetX, wadjetY, _pics[0x2a]); // wadjet eye
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// the book of thoth?
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(28)).encode().c_str()), 0x1a4, 0x2d);
_tickMarker = _toolbox->TickCount();
- arr_i32_41296[5]->copyFrom(*arr_i32_41296[4]);
+ _screenPages[5]->copyFrom(*_screenPages[4]);
setPortBitsToPage(5);
_zbasic->picture(0x171, 0xb, _pics[0x5b]);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
@@ -1052,13 +1069,13 @@ void FoolPrologue::finaleRun() {
// 131:366e
srcRect.bottom = wadjetY + 100;
srcRect.right = wadjetX + 200;
- var_i32_4e->copyFrom(*arr_i32_41296[4]);
- var_i32_40 = arr_i32_41296[9];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, srcRect, kSrcBic, 0);
- var_i32_40 = arr_i32_41296[0xa];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, srcRect, kSrcOr, 0);
+ _bgPage->copyFrom(*_screenPages[4]);
+ _srcPage = _screenPages[9];
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, srcRect, kSrcBic, 0);
+ _srcPage = _screenPages[0xa];
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, srcRect, kSrcOr, 0);
for (int16 i = 6; i <= 8; i++) {
- arr_i32_41296[i]->copyFrom(*var_i32_4e);
+ _screenPages[i]->copyFrom(*_bgPage);
}
setPortBitsToPage(6);
_zbasic->picture(0x171, 0xb, _pics[0x5b]);
@@ -1077,7 +1094,7 @@ void FoolPrologue::finaleRun() {
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
// destroy him
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(32)).encode().c_str()), 0x1a4, 0x2d);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0xb4);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
@@ -1096,18 +1113,18 @@ void FoolPrologue::finaleRun() {
// wadjet eye rises over horizon
for (int16 i = 0xdc; i >= 0x19; i -= 5) {
_tickMarker = _toolbox->TickCount();
- var_i32_4e->copyFrom(*arr_i32_41296[5]);
+ _bgPage->copyFrom(*_screenPages[5]);
dstRect.top = i;
srcRect.bottom = 0x19 + 0xdf - i;
- var_i32_40 = arr_i32_41296[9];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcBic, 0);
+ _srcPage = _screenPages[9];
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcBic, 0);
- var_i32_40 = arr_i32_41296[10];
- _toolbox->CopyBits(var_i32_40, var_i32_4e, srcRect, dstRect, kSrcOr, 0);
+ _srcPage = _screenPages[10];
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcOr, 0);
delayFromMarker(2);
- _toolbox->CopyBits(var_i32_4e, var_i32_32, dstRect, dstRect, kSrcCopy, 0);
+ _toolbox->CopyBits(_bgPage, _dstPage, dstRect, dstRect, kSrcCopy, 0);
}
// 131:39ba
@@ -1122,7 +1139,7 @@ void FoolPrologue::finaleRun() {
_toolbox->ReleaseResource(_pics[0x5b]);
// 131:3a20
- arr_i32_41296[10]->copyFrom(*arr_i32_41296[8]);
+ _screenPages[10]->copyFrom(*_screenPages[8]);
delayFromMarker(0x3c);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
@@ -1151,26 +1168,26 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0, 0xaa, _pics[0x39]); // treasure pile
// 131:3b8a
fillRect(0x124, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- arr_i32_41296[8]->copyFrom(*arr_i32_41296[7]);
- arr_i32_41296[9]->copyFrom(*arr_i32_41296[8]);
- _toolbox->InvertRect(var_i16_38);
+ _screenPages[8]->copyFrom(*_screenPages[7]);
+ _screenPages[9]->copyFrom(*_screenPages[8]);
+ _toolbox->InvertRect(_pageRect);
setPortBitsToPage(0x9);
_zbasic->picture(0x5d, 0x22, _pics[0x3a]); // priestess card
_zbasic->picture(0x1b3, 0xb5, _pics[0x3b]); // fool head
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0x5a);
for (int16 k = 0; k <= 8; k++) {
for (int16 j = 1; j <= 8; j++) {
- _toolbox->SetRect(arr_i16_1bc, 0xe9, 0x58, 0xe9, 0x58);
+ _toolbox->SetRect(temp, 0xe9, 0x58, 0xe9, 0x58);
_tickMarker = _toolbox->TickCount();
for (int16 i = 1; i <= j; i++) {
- _toolbox->InsetRect(arr_i16_1bc, -1, -1);
- _toolbox->InvertOval(arr_i16_1bc);
+ _toolbox->InsetRect(temp, -1, -1);
+ _toolbox->InvertOval(temp);
}
// 131:3cbe
for (int16 i = 1; i <= j; i++) {
- _toolbox->InsetRect(arr_i16_1bc, 1, 1);
- _toolbox->InvertOval(arr_i16_1bc);
+ _toolbox->InsetRect(temp, 1, 1);
+ _toolbox->InvertOval(temp);
}
delayFromMarker(1);
}
@@ -1188,12 +1205,12 @@ void FoolPrologue::finaleRun() {
for (int16 j = 8; j >= 1; j--) {
_tickMarker = _toolbox->TickCount();
for (int16 i = 1; i <= j; i++) {
- _toolbox->InsetRect(arr_i16_1bc, -1, -1);
- _toolbox->InvertOval(arr_i16_1bc);
+ _toolbox->InsetRect(temp, -1, -1);
+ _toolbox->InvertOval(temp);
}
for (int16 i = 1; i <= j; i++) {
- _toolbox->InsetRect(arr_i16_1bc, 1, 1);
- _toolbox->InvertOval(arr_i16_1bc);
+ _toolbox->InsetRect(temp, 1, 1);
+ _toolbox->InvertOval(temp);
}
delayFromMarker(1);
}
@@ -1234,20 +1251,16 @@ void FoolPrologue::finaleRun() {
// 131:3fd8
_toolbox->MoveTo(0x34, 0xf2);
_toolbox->LineTo(beamX, beamY);
- arr_rect_41af4.top = 0;
- arr_rect_41af4.left = 0;
- arr_rect_41af4.bottom = SCREEN_HEIGHT;
- arr_rect_41af4.right = SCREEN_WIDTH;
for (int16 i = 0x1e; i >= 0xa; i -= 5) {
zoomFlash(beamY - 3, beamX - 3, beamY + 3, beamX + 3, 0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, i);
}
for (int16 k = 7; k <= 8; k++) {
// 131:4088
- int16 segs = (k == 7) ? 0x19 : 0x23;
+ steps = (k == 7) ? 0x19 : 0x23;
// 131:40a2
- var_i32_40 = arr_i32_41296[k];
+ _srcPage = _screenPages[k];
Common::Rect start; // arr_rect_41af4
Common::Rect end; // arr_rect_41afc
start.top = beamY - 3;
@@ -1259,57 +1272,58 @@ void FoolPrologue::finaleRun() {
end.bottom = SCREEN_HEIGHT;
end.right = SCREEN_WIDTH;
// unroll loop
- arr_f64_41bbe[0] = (double)start.top;
- arr_f64_41bbe[0+4] = (double)(end.top - start.top)/segs;
- arr_f64_41bbe[1] = (double)start.left;
- arr_f64_41bbe[1+4] = (double)(end.left - start.left)/segs;
- arr_f64_41bbe[2] = (double)start.bottom;
- arr_f64_41bbe[2+4] = (double)(end.bottom - start.bottom)/segs;
- arr_f64_41bbe[3] = (double)start.right;
- arr_f64_41bbe[3+4] = (double)(end.right - start.right)/segs;
+ float mid[8] = { 0 }; // arr_f64_41bbe
+ mid[0] = (float)start.top;
+ mid[0+4] = (float)(end.top - start.top)/steps;
+ mid[1] = (float)start.left;
+ mid[1+4] = (float)(end.left - start.left)/steps;
+ mid[2] = (float)start.bottom;
+ mid[2+4] = (float)(end.bottom - start.bottom)/steps;
+ mid[3] = (float)start.right;
+ mid[3+4] = (float)(end.right - start.right)/steps;
// 131:420a
srcRect = start;
// 131:425a
- _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, 0);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, 0);
- for (int16 j = 1; j <= segs - 1; j++) {
+ for (int16 j = 1; j <= steps - 1; j++) {
_tickMarker = _toolbox->TickCount();
for (int16 i = 0; i <= 3; i++) {
- arr_f64_41bbe[i] += arr_f64_41bbe[i+4];
+ mid[i] += mid[i+4];
}
// 131:42e6
- srcRect.top = (int16)arr_f64_41bbe[0];
- srcRect.left = (int16)arr_f64_41bbe[1];
- srcRect.bottom = (int16)arr_f64_41bbe[2];
- srcRect.right = (int16)arr_f64_41bbe[3];
- _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, 0);
+ srcRect.top = (int16)mid[0];
+ srcRect.left = (int16)mid[1];
+ srcRect.bottom = (int16)mid[2];
+ srcRect.right = (int16)mid[3];
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, 0);
delayFromMarker(0);
// 131:4362
}
// 131:4376
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, 0);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, 0);
}
// 131:439a
_zbasic->picture(0x1b3, 0xb5, _pics[0x3b]);
- arr_i16_41af4[0] = 0;
- arr_i16_41af4[1] = 0;
- arr_i16_41af4[2] = SCREEN_WIDTH;
- arr_i16_41af4[3] = 0;
- arr_i16_41af4[4] = SCREEN_WIDTH;
- arr_i16_41af4[5] = SCREEN_HEIGHT;
- arr_i16_41af4[6] = 0;
- arr_i16_41af4[7] = SCREEN_HEIGHT;
- arr_i16_41af4[8] = 0xb5;
- arr_i16_41af4[9] = 0x22;
- arr_i16_41af4[10] = 0xb5;
- arr_i16_41af4[11] = 0xb5;
- arr_i16_41af4[12] = 0x5d;
- arr_i16_41af4[13] = 0xb5;
- arr_i16_41af4[14] = 0x5d;
- arr_i16_41af4[15] = 0x22;
+ _cardLines[0] = 0;
+ _cardLines[1] = 0;
+ _cardLines[2] = SCREEN_WIDTH;
+ _cardLines[3] = 0;
+ _cardLines[4] = SCREEN_WIDTH;
+ _cardLines[5] = SCREEN_HEIGHT;
+ _cardLines[6] = 0;
+ _cardLines[7] = SCREEN_HEIGHT;
+ _cardLines[8] = 0xb5;
+ _cardLines[9] = 0x22;
+ _cardLines[10] = 0xb5;
+ _cardLines[11] = 0xb5;
+ _cardLines[12] = 0x5d;
+ _cardLines[13] = 0xb5;
+ _cardLines[14] = 0x5d;
+ _cardLines[15] = 0x22;
finaleCardRotate();
finaleCardRotate();
@@ -1325,7 +1339,7 @@ void FoolPrologue::finaleRun() {
// and was able to trick the high priestess
drawText(_zbasic->str(OFF(39)), 0xd2, 0x72);
drawClickMessageRightAlign();
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
blitPageToScreen(0);
setPortBitsToPage(0);
_zbasic->picture(0x1b8, 0xb3, _pics[0x3d]);
@@ -1346,7 +1360,7 @@ void FoolPrologue::finaleRun() {
// anything inherently evil
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(45)).encode().c_str()), 0xde, 0xa0);
// 131:46aa
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
waitForClick();
blitPageToScreen(0);
copyScreenToPage(0);
@@ -1363,7 +1377,7 @@ void FoolPrologue::finaleRun() {
drawText(_zbasic->str(OFF(48)), 0xd2, 0x7e);
// 131:4780
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
waitForClick();
blitPageToScreen(0);
copyScreenToPage(0);
@@ -1375,38 +1389,38 @@ void FoolPrologue::finaleRun() {
// but I doubt it
drawText(Common::U32String::format("\"%s\"", _zbasic->str(OFF(49)).encode().c_str()), 0x184, 0xb1);
// 131:4848
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
waitForClick();
blitPageToScreen(0);
_tickMarker = _toolbox->TickCount();
setPortBitsToPage(0);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
delayFromMarker(0x78);
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
_toolbox->PenSize(4, 3);
- _toolbox->SetRect(arr_i16_1bc, 0, 0, 0x201, 0x156);
+ _toolbox->SetRect(temp, 0, 0, 0x201, 0x156);
for (int16 i = 0; i <= 0x200; i++) {
if ((i % 4) == 0) {
_tickMarker = _toolbox->TickCount();
}
// 131:48ea
if ((i % 2) == 0) {
- arr_i16_1bc.top = (int16)(i/2.5);
+ temp.top = (int16)(i/2.5);
}
// 131:4936
- arr_i16_1bc.left = i;
+ temp.left = i;
if ((i % 10) == 0) {
- arr_i16_1bc.bottom = SCREEN_HEIGHT - (i/10);
+ temp.bottom = SCREEN_HEIGHT - (i/10);
}
// 131:498a
if (i > 0x1bd) {
- arr_i16_1bc.right -= 1;
+ temp.right -= 1;
}
// 131:49b6
- _toolbox->FrameRect(arr_i16_1bc);
+ _toolbox->FrameRect(temp);
if ((i % 4) == 3) {
delayFromMarker(0);
}
@@ -1420,8 +1434,8 @@ void FoolPrologue::finaleRun() {
int16 yPic = 0x5a;
for (int16 j = 0x40; j <= 0x45; j++) {
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[0];
- _toolbox->SetPortBits(var_i32_40);
+ _srcPage = _screenPages[0];
+ _toolbox->SetPortBits(_srcPage);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->picture(0x78, yPic, _pics[j]);
int16 textCount = _zbasic->readDataInt();
@@ -1442,7 +1456,7 @@ void FoolPrologue::finaleRun() {
}
// 131:4b2a
delayFromMarker(0x14);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
blitPageToScreen(0);
if (j == 0x40) {
delay(0xd2);
@@ -1455,8 +1469,8 @@ void FoolPrologue::finaleRun() {
}
// 131:4b86
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[0];
- _toolbox->SetPortBits(var_i32_40);
+ _srcPage = _screenPages[0];
+ _toolbox->SetPortBits(_srcPage);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontSmall, 9, 0, kSrcBic);
// the fool's errand
@@ -1469,13 +1483,13 @@ void FoolPrologue::finaleRun() {
drawTextCenter(_zbasic->str(OFF(53)), 0x100, 0x64 + yPic + 0x19);
// 131:4c94
delayFromMarker(0x14);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
blitPageToScreen(0);
delay(0xb4);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[0];
- _toolbox->SetPortBits(var_i32_40);
+ _srcPage = _screenPages[0];
+ _toolbox->SetPortBits(_srcPage);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
_zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
@@ -1485,7 +1499,7 @@ void FoolPrologue::finaleRun() {
// the fool and his money
drawTextCenter(_zbasic->str(OFF(55)), 0x100, 0xc8);
delayFromMarker(0x14);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
blitPageToScreen(0);
delay(0xd2);
for (int16 i = 0x40; i <= 0x47; i++) {
@@ -1550,39 +1564,40 @@ void FoolPrologue::finaleCardRotate() {
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
_toolbox->PenMode(kPatXor);
- var_i16_18e = 0x21;
+ int16 steps = 0x21;
+ float cardLinesMid[16] = { 0 }; // arr_f64_41bbe
for (int16 i = 0; i <= 7; i++) {
- arr_f64_41bbe[i] = (double)arr_i16_41af4[i];
- arr_f64_41bbe[i+8] = (double)(arr_i16_41af4[i+8] - arr_i16_41af4[i])/var_i16_18e;
+ cardLinesMid[i] = (float)_cardLines[i];
+ cardLinesMid[i+8] = (float)(_cardLines[i+8] - _cardLines[i])/steps;
}
// 131:5106
- _toolbox->MoveTo(arr_i16_41af4[0], arr_i16_41af4[1]);
- _toolbox->LineTo(arr_i16_41af4[2], arr_i16_41af4[3]);
- _toolbox->LineTo(arr_i16_41af4[4], arr_i16_41af4[5]);
- _toolbox->LineTo(arr_i16_41af4[6], arr_i16_41af4[7]);
- _toolbox->LineTo(arr_i16_41af4[0], arr_i16_41af4[1]);
+ _toolbox->MoveTo(_cardLines[0], _cardLines[1]);
+ _toolbox->LineTo(_cardLines[2], _cardLines[3]);
+ _toolbox->LineTo(_cardLines[4], _cardLines[5]);
+ _toolbox->LineTo(_cardLines[6], _cardLines[7]);
+ _toolbox->LineTo(_cardLines[0], _cardLines[1]);
- for (int16 i = 1; i <= var_i16_18e - 1; i++) {
+ for (int16 i = 1; i <= steps - 1; i++) {
// 131:51ca
_tickMarker = _toolbox->TickCount();
for (int16 j = 0; j <= 7; j++) {
- arr_f64_41bbe[j] += arr_f64_41bbe[j+8];
- arr_i16_41af4[j + 0x10] = (int16)arr_f64_41bbe[j];
+ cardLinesMid[j] += cardLinesMid[j+8];
+ _cardLines[j + 0x10] = (int16)cardLinesMid[j];
}
// 131:5276
- _toolbox->MoveTo(arr_i16_41af4[0x10], arr_i16_41af4[0x11]);
- _toolbox->LineTo(arr_i16_41af4[0x12], arr_i16_41af4[0x13]);
- _toolbox->LineTo(arr_i16_41af4[0x14], arr_i16_41af4[0x15]);
- _toolbox->LineTo(arr_i16_41af4[0x16], arr_i16_41af4[0x17]);
- _toolbox->LineTo(arr_i16_41af4[0x10], arr_i16_41af4[0x11]);
+ _toolbox->MoveTo(_cardLines[0x10], _cardLines[0x11]);
+ _toolbox->LineTo(_cardLines[0x12], _cardLines[0x13]);
+ _toolbox->LineTo(_cardLines[0x14], _cardLines[0x15]);
+ _toolbox->LineTo(_cardLines[0x16], _cardLines[0x17]);
+ _toolbox->LineTo(_cardLines[0x10], _cardLines[0x11]);
delayFromMarker(1);
}
// 131:534e
- _toolbox->MoveTo(arr_i16_41af4[0x8], arr_i16_41af4[0x9]);
- _toolbox->LineTo(arr_i16_41af4[0xa], arr_i16_41af4[0xb]);
- _toolbox->LineTo(arr_i16_41af4[0xc], arr_i16_41af4[0xd]);
- _toolbox->LineTo(arr_i16_41af4[0xe], arr_i16_41af4[0xf]);
- _toolbox->LineTo(arr_i16_41af4[0x8], arr_i16_41af4[0x9]);
+ _toolbox->MoveTo(_cardLines[0x8], _cardLines[0x9]);
+ _toolbox->LineTo(_cardLines[0xa], _cardLines[0xb]);
+ _toolbox->LineTo(_cardLines[0xc], _cardLines[0xd]);
+ _toolbox->LineTo(_cardLines[0xe], _cardLines[0xf]);
+ _toolbox->LineTo(_cardLines[0x8], _cardLines[0x9]);
}
} // End of namespace Fool
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index a538bb6e758..652f32100c1 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -78,7 +78,7 @@ void FoolPrologue::run(bool finale, const BitMap &prevWindow) {
}
void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
- var_i16_1aa = finale ? 2 : 1;
+ _mode = finale ? 2 : 1;
// 128:0004
_zbasic->coordinateWindow();
@@ -90,19 +90,19 @@ void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
// b54 must be the 1-bit screen buffer
// 41296 is an array of pointers to screen pages within the buffer
for (int i = 0; i < 16; i++) {
- arr_i32_1e3fc[i] = BitMap(new Graphics::ManagedSurface());
- arr_i32_1e3fc[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ _cardSlices[i] = BitMap(new Graphics::ManagedSurface());
+ _cardSlices[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
for (int i = 0; i < 12; i++) {
- //arr_i32_41296[i] = &arr_i32_b54[SCREEN_PAGE_SIZE*i];
- arr_i32_41296[i] = BitMap(new Graphics::ManagedSurface());
- arr_i32_41296[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ //_screenPages[i] = &arr_i32_b54[SCREEN_PAGE_SIZE*i];
+ _screenPages[i] = BitMap(new Graphics::ManagedSurface());
+ _screenPages[i]->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
}
- arr_i32_3bca4 = BitMap(new Graphics::ManagedSurface());
- arr_i32_3bca4->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+ _foolSlice = BitMap(new Graphics::ManagedSurface());
+ _foolSlice->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
// 128:0066
- var_i32_4e = arr_i32_41296[11];
+ _bgPage = _screenPages[11];
// 128:0078
// pattern buffer
_patterns[0] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; // solid white
@@ -143,7 +143,7 @@ void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
// JMP 0xa88
// JMP 0xc8a
// 128:0c8a
- sub_129_004();
+ setupWindow();
if (_quit)
return;
@@ -151,15 +151,15 @@ void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
_grafPtrWindow->portBits->copyFrom(*prevWindow);
}
- var_i32_1a6 = _zbasic->mem(-1);
- if (var_i16_1aa == 1) {
+ _zbasic->mem(-1);
+ if (_mode == 1) {
prologueRun();
- var_i32_1a6 = _zbasic->mem(-1);
+ _zbasic->mem(-1);
}
// 128:0cb0
- if (var_i16_1aa == 2) {
+ if (_mode == 2) {
finaleRun();
- var_i32_1a6 = _zbasic->mem(-1);
+ _zbasic->mem(-1);
}
// 128:0cc8
//_zbasic->unk4(); // exit command?
@@ -168,14 +168,14 @@ void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
void FoolPrologue::copyScreenToPage(int16 screenPage) {
// 128:01ba
- var_i32_40 = arr_i32_41296[screenPage];
- _toolbox->CopyBits(var_i32_32, var_i32_40, var_i16_38, var_i16_38, kSrcCopy, nullptr);
+ _srcPage = _screenPages[screenPage];
+ _toolbox->CopyBits(_dstPage, _srcPage, _pageRect, _pageRect, kSrcCopy, nullptr);
}
void FoolPrologue::setPortBitsToPage(int16 screenPage) {
// 128:01f4
- var_i32_40 = arr_i32_41296[screenPage];
- _toolbox->SetPortBits(var_i32_40);
+ _srcPage = _screenPages[screenPage];
+ _toolbox->SetPortBits(_srcPage);
}
void FoolPrologue::delay(int16 numTicks) {
@@ -261,7 +261,7 @@ void FoolPrologue::drawTreasurePhaseIn(int16 offset, int16 count) {
void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16 right, int16 updatePeriod) {
// 128:050a
- var_i32_40 = arr_i32_41296[screenPage];
+ _srcPage = _screenPages[screenPage];
Common::Rect srcRect; // var_i16_5c
srcRect.left = left;
srcRect.right = right;
@@ -282,7 +282,7 @@ void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16
_tickMarker = _toolbox->TickCount();
srcRect.top = _randScanline[i];
srcRect.bottom = _randScanline[i] + 1;
- _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, nullptr);
if (i % updatePeriod == 0) {
delayFromMarker(0);
}
@@ -291,8 +291,8 @@ void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16
void FoolPrologue::blitPageToScreen(int16 screenPage) {
// 128:0610
- var_i32_40 = arr_i32_41296[screenPage];
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
+ _srcPage = _screenPages[screenPage];
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, nullptr);
}
void FoolPrologue::scanlineTransition(int16 patternID) {
@@ -313,7 +313,7 @@ void FoolPrologue::scanlineTransition(int16 patternID) {
void FoolPrologue::zoomTransition(int16 screenPage) {
// 128:06e4
- var_i32_40 = arr_i32_41296[screenPage];
+ _srcPage = _screenPages[screenPage];
Common::Rect srcRect; // var_rect_5c
for (int i = 1; i <= 0x36; i++) {
_tickMarker = _toolbox->TickCount();
@@ -321,10 +321,10 @@ void FoolPrologue::zoomTransition(int16 screenPage) {
srcRect.left = (SCREEN_WIDTH/2) - i*5;
srcRect.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
srcRect.right = (SCREEN_WIDTH/2) + i*5;
- _toolbox->CopyBits(var_i32_40, var_i32_32, srcRect, srcRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
- _toolbox->CopyBits(var_i32_40, var_i32_32, var_i16_38, var_i16_38, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, nullptr);
_toolbox->Delay(0);
}
@@ -382,9 +382,8 @@ void FoolPrologue::drawText(const Common::U32String &str, int16 x, int16 y) {
_toolbox->DrawString(str);
}
-void FoolPrologue::drawRainRecycle(int16 unk) {
+void FoolPrologue::drawRainRecycle(int16 ticks) {
// 128:0a8c
- var_i16_1a4 = unk;
_toolbox->PenMode(kPatXor);
do {
// 128:0a96
@@ -407,7 +406,7 @@ void FoolPrologue::drawRainRecycle(int16 unk) {
_rainIndex = 0;
_toolbox->Delay(0);
}
- } while (_tickMarker + var_i16_1a4 > _toolbox->TickCount());
+ } while (_tickMarker + ticks > _toolbox->TickCount());
_toolbox->Delay(0);
}
@@ -450,7 +449,7 @@ void FoolPrologue::waitForClick() {
waitForMouseUp();
while (true) {
// was: 2
- var_i16_1ba = _toolbox->GetNextEvent(-1, _event);
+ _toolbox->GetNextEvent(-1, _event);
if (_event.what == kMouseDown)
break;
if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
@@ -467,7 +466,7 @@ void FoolPrologue::waitForClick() {
void FoolPrologue::waitForMouseUp() {
// 128:0e80
while (true) {
- var_i16_1ba = (int)_toolbox->GetNextEvent(-1, _event);
+ _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
onUpdateEvent();
}
@@ -491,15 +490,15 @@ void FoolPrologue::waitForMouseUp() {
void FoolPrologue::onUpdateEvent() {
// 128:0ed2
- _toolbox->BeginUpdate(var_window_24);
- _toolbox->EndUpdate(var_window_24);
+ _toolbox->BeginUpdate(_windowRecord);
+ _toolbox->EndUpdate(_windowRecord);
}
void FoolPrologue::onDiskEvent() {
// 128:0ee0
// done by using PEEKWORD into fixed offsets of the window pointer
- //var_i16_1bc = &var_window_24; // +0
- //var_i16_1be = &var_window_24; // +2
+ //var_i16_1bc = &_windowRecord; // +0
+ //var_i16_1be = &_windowRecord; // +2
//_zbasic->unk11(var_i16_1be);
}
@@ -526,7 +525,8 @@ void FoolPrologue::onDiskEvent() {
// - Rect screenBits.bounds = 0x76
// LONGINT randSeed = 0x7e
-void FoolPrologue::sub_129_004() {
+void FoolPrologue::setupWindow() {
+ // 129:0004
// get the screen width and height from QuickDraw
// 0x0004: MOVE.L - 0x904,D0
// 0x000a: JSR - "PEEKLONG" # current A5
@@ -564,54 +564,44 @@ void FoolPrologue::sub_129_004() {
_grafPtrWindow = &_grafPortWindow;
_toolbox->OpenPort(_grafPtrWindow);
+ Common::Rect temp;
if ((_windowWidth != SCREEN_WIDTH || _windowHeight != SCREEN_HEIGHT)) {
// 129:013a
fillRect(MENU_HEIGHT, 0, _windowHeight, _windowWidth, 2);
- _toolbox->SetRect(arr_i16_1bc, _windowLeft - 2, _windowTop - 2, _windowLeft + SCREEN_WIDTH + 2, _windowTop + SCREEN_HEIGHT + 2);
+ _toolbox->SetRect(temp, _windowLeft - 2, _windowTop - 2, _windowLeft + SCREEN_WIDTH + 2, _windowTop + SCREEN_HEIGHT + 2);
_toolbox->PenPat(_patterns[1]);
- _toolbox->FrameRect(arr_i16_1bc);
+ _toolbox->FrameRect(temp);
}
// 129:01b0
_toolbox->SetPort(_grafPtrWindow);
_toolbox->PortSize(SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->MovePortTo(_windowLeft, _windowTop);
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->ClipRect(arr_i16_1bc);
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->ClipRect(temp);
// 129:01f2
if (_windowHeight == SCREEN_HEIGHT) {
- _toolbox->SetRect(arr_i16_1bc, 0, MENU_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->FillRect(arr_i16_1bc, _patterns[1]);
+ _toolbox->SetRect(temp, 0, MENU_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->FillRect(temp, _patterns[1]);
} else {
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->FillRect(arr_i16_1bc, _patterns[1]);
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->FillRect(temp, _patterns[1]);
}
// 129:026c
- var_i32_32 = _grafPtrWindow->portBits;
- var_i16_36 = 0x40;
- var_i16_38.top = -_windowTop;
- var_i16_38.left = -_windowLeft;
- var_i16_38.bottom = _windowTop + SCREEN_HEIGHT;
- var_i16_38.right = _windowLeft + SCREEN_WIDTH;
- var_i16_44 = 0x40;
- var_i16_46.top = 0x0;
- var_i16_46.left = 0x0;
- var_i16_46.bottom = SCREEN_HEIGHT;
- var_i16_46.right = SCREEN_WIDTH;
- var_i16_52 = 0x40;
- var_i16_54.top = 0x0;
- var_i16_54.left = 0x0;
- var_i16_54.bottom = SCREEN_HEIGHT;
- var_i16_54.right = SCREEN_WIDTH;
+ _dstPage = _grafPtrWindow->portBits;
+ _pageRect.top = -_windowTop;
+ _pageRect.left = -_windowLeft;
+ _pageRect.bottom = _windowTop + SCREEN_HEIGHT;
+ _pageRect.right = _windowLeft + SCREEN_WIDTH;
uint32 memFree = _zbasic->mem(-1);
// 129:02fe
if (memFree < 0xd6d8) {
_toolbox->InitCursor();
- _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, arr_i32_41296[0], true);
+ _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, _screenPages[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x0);
fillRect(0x46, 0x64, 0xdc, 0x19c, 2);
fillRect(0x4b, 0x69, 0xd7, 0x197, 1);
@@ -629,12 +619,11 @@ void FoolPrologue::sub_129_004() {
if (_quit)
return;
- _zbasic->put(0x0, 0x14, arr_i32_41296[0], kSrcCopy);
- var_i16_1aa = 0;
+ _zbasic->put(0x0, 0x14, _screenPages[0], kSrcCopy);
+ _mode = 0;
} else {
// 129:04a0
- var_i16_180 = 1;
// this next blob of code is for determining whether to
// open the prologue or the finale.
// both are in the same EXE, however the finale is accessed
@@ -643,7 +632,8 @@ void FoolPrologue::sub_129_004() {
// we don't need to worry about files as we add a start trigger
// in the game's menu.
/*
- var_i16_1aa = 1;
+ //var_i16_180 = 1;
+ _mode = 1;
// 180 == number, possibly file number
// 1c4 == string
// 2c4 == unused
@@ -675,16 +665,16 @@ void FoolPrologue::sub_129_004() {
// 129:0582
if ((var_i16_2ce == var_str_76) &&
var_i16_2cc == 0) {
- var_i16_1aa = 2;
+ _mode = 2;
} else {
- var_i16_1aa = 0;
+ _mode = 0;
}
}
*/
// 129:05a6
if (testColour.red + testColour.blue + testColour.green != 0) {
_toolbox->InitCursor();
- _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, arr_i32_41296[0], true);
+ _zbasic->get(0x0, 0x14, SCREEN_WIDTH, SCREEN_HEIGHT, _screenPages[0], true);
_zbasic->sound(0x19, 0x64, 0xff, 0x00);
fillRect(0x64, 0x82, 0xdc, 0x17e, 2);
fillRect(0x69, 0x87, 0xd7, 0x179, 1);
@@ -696,15 +686,15 @@ void FoolPrologue::sub_129_004() {
drawTextCenter(_zbasic->str(14), 0x100, 0x96);
// if this is the finale
- drawTextCenter(var_i16_1aa == 2 ? _zbasic->str(16): _zbasic->str(15), 0x100, 0xaa);
+ drawTextCenter(_mode == 2 ? _zbasic->str(16): _zbasic->str(15), 0x100, 0xaa);
drawTextCenter(_zbasic->str(17), 0x100, 0xcb);
// 129:0730
waitForClick();
if (_quit)
return;
- _zbasic->put(0x0, 0x14, arr_i32_41296[0], kSrcCopy);
- var_i16_1aa = 0;
+ _zbasic->put(0x0, 0x14, _screenPages[0], kSrcCopy);
+ _mode = 0;
} else {
// 129:075c
waitForMouseUp();
@@ -714,9 +704,9 @@ void FoolPrologue::sub_129_004() {
}
}
-void FoolPrologue::sub_129_764() {
+void FoolPrologue::unk1() {
// 129:0764
- var_i16_2cc = 1;
+ // var_i16_2cc = 1;
_zbasic->unk_130(0);
}
@@ -725,7 +715,7 @@ void FoolPrologue::prologueRun() {
_prologueLoading = 5;
_prologuePicIndex = 0;
prologueDrawLoadingMsg();
- var_i16_18e = SCREEN_HEIGHT;
+ //var_i16_18e = SCREEN_HEIGHT;
// fill a buffer with random screen y-positions, to use for the scanline transition
shuffleScanlines();
@@ -757,7 +747,7 @@ void FoolPrologue::prologueRun() {
} else {
drawTextCenter(_zbasic->str(OFF(0)), 0x103, 0x10d);
}
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
// cliffside images with lightning
for (int i = 1; i <= 5; i++) {
prologueBufferNextPicture();
@@ -777,7 +767,7 @@ void FoolPrologue::prologueRun() {
// 130:015c
for (int i = 3; i <= 5; i++) {
- arr_i32_41296[i]->copyFrom(*arr_i32_41296[7]);
+ _screenPages[i]->copyFrom(*_screenPages[7]);
}
// high priestess skull
prologueBufferNextPicture();
@@ -789,7 +779,7 @@ void FoolPrologue::prologueRun() {
// high priestess face
prologueBufferNextPicture();
- arr_i32_41296[1]->copyFrom(*arr_i32_41296[0]);
+ _screenPages[1]->copyFrom(*_screenPages[0]);
setPortBitsToPage(1);
// 130:0202
@@ -809,16 +799,12 @@ void FoolPrologue::prologueRun() {
// priestess shooting lightning
prologueBufferNextPicture();
- if (j == 9) {
- var_i16_74 = 0;
- } else {
- var_i16_74 = 0x81;
- }
+ int16 xPos = (j == 9) ? 0 : 0x81;
// 130:029a
setPortBitsToPage(j - 6);
_zbasic->picture(0, 0, _pics[j]);
- _zbasic->picture(var_i16_74, 0x96, _pics[j - 6]);
+ _zbasic->picture(xPos, 0x96, _pics[j - 6]);
_toolbox->ReleaseResource(_pics[j]);
_toolbox->ReleaseResource(_pics[j - 6]);
}
@@ -838,7 +824,7 @@ void FoolPrologue::prologueRun() {
// fool looking up at sun
_pics[0x48] = _toolbox->GetPicture(0x48);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
// 130:0380
if ((_windowWidth == SCREEN_WIDTH) && (_windowHeight == SCREEN_HEIGHT)) {
@@ -866,42 +852,45 @@ void FoolPrologue::prologueRun() {
// animate rain
drawRain();
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->SetRect(arr_i32_1c4, 0, 0x96, SCREEN_WIDTH, 0x118);
+ Common::Rect temp1; // arr_rect_1bc
+ Common::Rect temp2; // arr_rect_1c4
+ _toolbox->SetRect(temp1, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _toolbox->SetRect(temp2, 0, 0x96, SCREEN_WIDTH, 0x118);
// 130:043c
for (int i = 1; i <= 2; i++) {
_tickMarker = _toolbox->TickCount();
drawRainRecycle(0xb4);
+ // 130:0456
_tickMarker = _toolbox->TickCount();
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp1);
delayFromMarker(1);
- _toolbox->InvertRect(arr_i16_1bc);
- // 130:04ca
+ _toolbox->InvertRect(temp1);
+ _tickMarker = _toolbox->TickCount();
+ _srcPage = _screenPages[8];
+ // 130:049e
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ drawRainRecycle(4);
+
for (int j = 0; j <= 3; j++) {
+ // 130:04ca
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[8];
- // 130:049e
- _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
- drawRainRecycle(4);
- var_i16_192 = 0;
- _tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[3];
- _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ _srcPage = _screenPages[3];
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
drawRainRecycle(5);
// 130:0518
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[4];
- _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ _srcPage = _screenPages[4];
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
drawRainRecycle(5);
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[5];
- _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ _srcPage = _screenPages[5];
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
drawRainRecycle(5);
}
// 130:05b6
- var_i32_40 = arr_i32_41296[7];
- _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ _srcPage = _screenPages[7];
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
}
@@ -910,7 +899,7 @@ void FoolPrologue::prologueRun() {
drawRain();
_tickMarker = _toolbox->TickCount();
drawRainRecycle(0xb4);
- var_i32_40 = arr_i32_41296[1];
+ _srcPage = _screenPages[1];
// scanline fade in priestess face
@@ -922,14 +911,13 @@ void FoolPrologue::prologueRun() {
scanline.right = SCREEN_WIDTH;
_tickMarker = _toolbox->TickCount();
for (int j = 1; j < 0x7; j++) {
- var_i16_192 = 1;
if (y < SCREEN_HEIGHT) {
y += 1;
}
scanline.top = _randScanline[y];
scanline.bottom = _randScanline[y] + 1;
// 130:068e
- _toolbox->CopyBits(var_i32_40, var_i32_32, scanline, scanline, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, scanline, scanline, kSrcCopy, nullptr);
}
// 130:06b0
drawRainRecycle(1);
@@ -943,16 +931,16 @@ void FoolPrologue::prologueRun() {
// 130:06d4
for (int i = 1; i <= 4; i++) {
_tickMarker = _toolbox->TickCount();
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp1);
drawRainRecycle(0x2);
}
// 130:0704
_tickMarker = _toolbox->TickCount();
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp1);
drawRainRecycle(0xf);
_tickMarker = _toolbox->TickCount();
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp1);
drawRainRecycle(0x78);
// cut to shot of cliff
@@ -963,15 +951,15 @@ void FoolPrologue::prologueRun() {
_tickMarker = _toolbox->TickCount();
drawRainRecycle(0xb4);
- _toolbox->SetRect(arr_i32_1c4, 0, 0, 0x150, 0x96);
+ _toolbox->SetRect(temp2, 0, 0, 0x150, 0x96);
// priestess zap
// 130:0778
for (int j = 0; j <= 8; j++) {
for (int i = 3; i <= 5; i++) {
_tickMarker = _toolbox->TickCount();
- var_i32_40 = arr_i32_41296[i];
- _toolbox->CopyBits(var_i32_40, var_i32_32, arr_i32_1c4, arr_i32_1c4, kSrcCopy, nullptr);
+ _srcPage = _screenPages[i];
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
drawRainRecycle(3);
}
}
@@ -979,12 +967,13 @@ void FoolPrologue::prologueRun() {
// cut to closeup of priestess mid-zap
// 130:07ec
blitPageToScreen(6);
- _toolbox->SetRect(arr_i16_1bc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- for (int i = 0; i <= 0x2d; i++) {
+ Common::Rect temp;
+ _toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ for (int i = 0; i <= 41; i++) { // was: 45
_tickMarker = _toolbox->TickCount();
// limit flashing to WCAG recommendation of 6/second
if (((i % 10) == 0) || ((i % 10) == 2)) {
- _toolbox->InvertRect(arr_i16_1bc);
+ _toolbox->InvertRect(temp);
}
delayFromMarker(1);
}
@@ -1028,21 +1017,21 @@ void FoolPrologue::prologueRun() {
drawClickMessage();
// 130:0934
for (int i = 2; i <= 5; i++) {
- arr_i32_41296[i]->copyFrom(*arr_i32_41296[1]);
+ _screenPages[i]->copyFrom(*_screenPages[1]);
}
// 130:0978
// draw the sun pulsing to pages 1-5
for (int i = 1; i <= 5; i++) {
setPortBitsToPage(i);
_toolbox->PenPat(_patterns[1]);
- _toolbox->SetRect(arr_i16_1bc, 0x3c, 0x3c, 0x8c, 0x8c);
- _toolbox->FrameOval(arr_i16_1bc);
+ _toolbox->SetRect(temp1, 0x3c, 0x3c, 0x8c, 0x8c);
+ _toolbox->FrameOval(temp1);
_toolbox->PenPat(_patterns[4]);
// 130:09d0
- _toolbox->InsetRect(arr_i16_1bc, -i, -i);
+ _toolbox->InsetRect(temp1, -i, -i);
for (int j = 2; j <= 0xd; j++) {
- _toolbox->InsetRect(arr_i16_1bc, -j, -j);
- _toolbox->FrameOval(arr_i16_1bc);
+ _toolbox->InsetRect(temp1, -j, -j);
+ _toolbox->FrameOval(temp1);
}
}
// 130:0a42
@@ -1050,7 +1039,7 @@ void FoolPrologue::prologueRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(0x166, 0x77, _pics[0x11]);
drawClickMessage();
- arr_i32_41296[7]->copyFrom(*arr_i32_41296[6]);
+ _screenPages[7]->copyFrom(*_screenPages[6]);
prologueRenderNextText();
_toolbox->ReleaseResource(_pics[0x11]);
setPortBitsToPage(7);
@@ -1059,11 +1048,11 @@ void FoolPrologue::prologueRun() {
prologueRenderNextText();
_toolbox->ReleaseResource(_pics[0x12]);
setPortBitsToPage(8);
- arr_i32_41296[8]->copyFrom(*arr_i32_41296[7]);
+ _screenPages[8]->copyFrom(*_screenPages[7]);
fillRect(0x73, 0x163, 0xfa, 0x1e0, 0);
_zbasic->picture(0x16d, 0x80, _pics[0x48]);
_toolbox->ReleaseResource(_pics[0x48]);
- _toolbox->SetPortBits(var_i32_32);
+ _toolbox->SetPortBits(_dstPage);
// 130:0b74
delayFromMarker(0xd2);
@@ -1082,39 +1071,39 @@ void FoolPrologue::prologueRun() {
if (_quit)
return;
// 130:0b98
- var_i16_74 = 0;
- var_i16_192 = 1;
+ int16 pageIndex = 0;
+ int16 increment = 1;
while (_event.what != kMouseDown) {
// 130:0ba4
_tickMarker = _toolbox->TickCount();
- var_i16_74 += var_i16_192;
+ pageIndex += increment;
// 130:0bbe
- if (var_i16_74 == 0x5) {
- var_i16_192 = -1;
+ if (pageIndex == 0x5) {
+ increment = -1;
}
- if (var_i16_74 == 1) {
- var_i16_192 = 1;
+ if (pageIndex == 1) {
+ increment = 1;
}
- blitPageToScreen(var_i16_74);
+ blitPageToScreen(pageIndex);
delayFromMarker(0xa);
// 130:0bee
- var_i16_1ba = _toolbox->GetNextEvent(2, _event);
+ _toolbox->GetNextEvent(2, _event);
}
while (!((_event.what == kNullEvent) && (_event.modifiers & kModMouseButtonUp))) {
// 130:0c0c
_tickMarker = _toolbox->TickCount();
- var_i16_74 += var_i16_192;
+ pageIndex += increment;
// 130:0c26
- if (var_i16_74 == 0x5) {
- var_i16_192 = -1;
+ if (pageIndex == 0x5) {
+ increment = -1;
}
- if (var_i16_74 == 1) {
- var_i16_192 = 1;
+ if (pageIndex == 1) {
+ increment = 1;
}
- blitPageToScreen(var_i16_74);
+ blitPageToScreen(pageIndex);
delayFromMarker(0xa);
// 130:0c56
- var_i16_1ba = _toolbox->GetNextEvent(-1, _event);
+ _toolbox->GetNextEvent(-1, _event);
if (_event.what == kUpdateEvt) {
onUpdateEvent();
}
@@ -1210,22 +1199,22 @@ void FoolPrologue::prologueRenderNextText() {
int16 count = _zbasic->readDataInt();
for (int i = 1; i <= count; i++) {
// 130:0f56
- var_i16_176 = _zbasic->readDataInt();
- var_i16_180 = _zbasic->readDataInt();
- var_str_76 = _zbasic->readDataStr();
- var_i16_1ba = 1;
+ int16 xPos = _zbasic->readDataInt();
+ int16 yPos = _zbasic->readDataInt();
+ Common::U32String text = _zbasic->readDataStr();
+ int16 caratPos = 1;
// JMP 0xfc2
- while (var_i16_1ba > 0) {
+ while (caratPos > 0) {
// 130:0f78
- var_i16_1ba = _zbasic->instr(var_i16_1ba, var_str_76, Common::U32String("^")); // was: str(21)
- if (var_i16_1ba > 0) {
- var_str_76.replace(var_i16_1ba-1, 1, Common::U32String("\""));
+ caratPos = _zbasic->instr(caratPos, text, Common::U32String("^")); // was: str(21)
+ if (caratPos > 0) {
+ text.replace(caratPos - 1, 1, Common::U32String("\""));
}
}
// 130:0fc8
_zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
- drawText(var_str_76, var_i16_176, var_i16_180);
+ drawText(text, xPos, yPos);
}
}
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index aaa3190f207..4345f57c077 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -49,6 +49,13 @@ struct Particle {
int16 veloc = 0;
};
+struct Line {
+ int16 xStart = 0;
+ int16 yStart = 0;
+ int16 xEnd = 0;
+ int16 yEnd = 0;
+};
+
struct TreasureLine {
int16 xLeft = 0;
int16 xRight = 0;
@@ -78,7 +85,7 @@ public:
void zoomTransition(int16 screenPage); // sub_128_6e4
void zoomFlash(int16 startTop, int16 startLeft, int16 startBottom, int16 startRight, int16 endTop, int16 endLeft, int16 endBottom, int16 endRight, int16 steps); // sub_128_800
void drawText(const Common::U32String &str, int16 x, int16 y); // sub_128_a6c
- void drawRainRecycle(int16 unk); // sub_128_a8c
+ void drawRainRecycle(int16 ticks); // sub_128_a8c
void shuffleScanlines(); // sub_128_ccc
void drawClickMessage(); // sub_128_de2
void drawClickMessageRightAlign(); // sub_128_e1c
@@ -87,8 +94,8 @@ public:
void onUpdateEvent(); // sub_128_ed2
void onDiskEvent(); // sub_128_ee0
- void sub_129_004();
- void sub_129_764();
+ void setupWindow(); // sub_129_004
+ void unk1(); // sub_129_764
void prologueRun(); // sub_130_004
void prologueBufferNextPicture(); // sub_130_cea
@@ -125,86 +132,40 @@ private:
EventRecord _event; // var_ev_22
- WindowRecord var_window_24;
-
- BitMap var_i32_32;
-
- int16 var_i16_36;
- Common::Rect var_i16_38;
- BitMap var_i32_40;
- int16 var_i16_44;
- Common::Rect var_i16_46;
- BitMap var_i32_4e;
-
- int16 var_i16_52;
- Common::Rect var_i16_54;
-
- Common::Rect var_i16_6c;
-
- int16 var_i16_74;
-
- Common::U32String var_str_76;
+ WindowRecord _windowRecord; // var_window_24
- int16 var_i16_176;
- int16 var_i16_180;
- int16 var_i16_18e;
+ BitMap _dstPage; // var_i32_32
- int16 var_i16_192;
-
- int16 var_i16_1a4;
- uint32 var_i32_1a6;
+ Common::Rect _pageRect; // var_rect_38
+ BitMap _srcPage; // var_i32_40
+ BitMap _bgPage; // var_i32_4e
// 1 for prologue, 2 for finale
- int16 var_i16_1aa;
- byte *var_i32_1ac;
- byte *var_i32_1b0;
-
- int16 var_i16_1b4;
- int16 var_i16_1b6;
- int16 var_i16_1b8;
- int16 var_i16_1ba;
-
- Common::U32String var_i16_1c4;
-
- int16 var_i16_2cc;
- Common::U32String var_i16_2ce;
+ int16 _mode; // var_i16_1aa
int16 _prologueLoading; // var_i16_3ce
int16 _prologuePicIndex; // var_i16_3d4
- int16 var_i16_3e6;
// picture resource handles
PicHandle _pics[92] = { nullptr }; // arr_i32_0
Pattern _patterns[5]; // arr_pat_194
-
- Common::Rect arr_i16_1bc;
- Common::Rect arr_i32_1c4;
-
- int16 arr_i16_1e8[1004] = { 0 };
-
Particle _rain[251]; // arr_i16_1e8
TreasureLine _treasure[251]; // arr_i16_1e8
GrafPort _grafPortWindow; // arr_i32_9c0
GrafPort _grafPortMenu; // arr_i32_a8a
- BitMap arr_i32_1e3fc[16];
+ BitMap _cardSlices[16]; // arr_i32_1e3fc
- BitMap arr_i32_3bca4;
+ BitMap _foolSlice; // arr_i32_3bca4
- BitMap arr_i32_41296[12];
+ BitMap _screenPages[12]; // arr_i32_41296
int16 _randScanline[SCREEN_HEIGHT] = { 0 }; // arr_i16_412ea
- int16 arr_i16_41af4[32];
- Common::Rect arr_rect_41af4;
- Common::Rect arr_i16_41afc;
- int16 arr_i16_41b04[3];
- Common::Rect arr_i16_41b0a;
-
- double arr_f64_41bbe[16] = { 0 };
+ int16 _cardLines[32]; // arr_i16_41af4
};
diff --git a/engines/fool/utils.cpp b/engines/fool/utils.cpp
index 3ceefbd2a0e..2bcaafd4dbc 100644
--- a/engines/fool/utils.cpp
+++ b/engines/fool/utils.cpp
@@ -186,7 +186,7 @@ Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const
uint32 white = g_engine->_wm._colorWhite;
if (mode == kSrcCopy && !mask) {
// fast blit
- dst->blitFrom(*src, srcRect, Common::Point(srcRect.left + dstPos.x, srcRect.top + dstPos.y));
+ dst->simpleBlitFrom(*src, srcRect, Common::Point(srcRect.left + dstPos.x, srcRect.top + dstPos.y));
} else {
// per-pixel blit
for (int y = srcRect.top; y < srcRect.bottom; y++) {
Commit: e0e4897d8e5f464188b2fc2d346d230f41d9adc3
https://github.com/scummvm/scummvm/commit/e0e4897d8e5f464188b2fc2d346d230f41d9adc3
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:34+02:00
Commit Message:
FOOL: Return to story after finale plays
Changed paths:
engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jumble.cpp
engines/fool/fool_metapuzzle.cpp
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index 5a3fcdbbaf9..a8528722ff2 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -603,6 +603,9 @@ void FoolPrologue::finaleRun() {
// 131:19be
drawClickMessageRightAlign();
waitForClick();
+ if (_quit)
+ return;
+
drawClickMessageRightAlign();
fillRect(0, 0, 0x96, 0x18b, 2);
_zbasic->picture(0x193, 0x2d, _pics[0x32]);
@@ -676,13 +679,15 @@ void FoolPrologue::finaleRun() {
_toolbox->SetPortBits(_dstPage);
drawClickMessageRightAlign();
waitForClick();
+ if (_quit)
+ return;
// 131:1e18
// card gets vivisected
fillRect(0, 0, 0x96, 0x18b, 2);
fillRect(0x12c, 0x15e, 0x156, 0x200, 2);
int16 cardSliceOffset = 0;
- Particle cardSliceShift[15];
+ Particle cardSliceShift[16];
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
_zbasic->get(
0x190,
@@ -782,6 +787,9 @@ void FoolPrologue::finaleRun() {
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(13)).encode().c_str()), 0x181, 0x4d);
drawClickMessageRightAlign();
waitForClick();
+ if (_quit)
+ return;
+
_zbasic->picture(0x193, 0x2d, _pics[0x36]);
// 131:24da
@@ -792,6 +800,8 @@ void FoolPrologue::finaleRun() {
drawTextRight(_zbasic->str(OFF(15)), 0x181, 0x4d);
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(16)).encode().c_str()), 0x181, 0x5e);
waitForClick();
+ if (_quit)
+ return;
// 131:258a
_srcPage = _screenPages[5];
@@ -921,6 +931,9 @@ void FoolPrologue::finaleRun() {
delayFromMarker(0xd2);
drawClickMessageRightAlign();
waitForClick();
+ if (_quit)
+ return;
+
drawClickMessageRightAlign();
blitPageToScreen(6);
delay(3);
@@ -1362,6 +1375,8 @@ void FoolPrologue::finaleRun() {
// 131:46aa
_toolbox->SetPortBits(_dstPage);
waitForClick();
+ if (_quit)
+ return;
blitPageToScreen(0);
copyScreenToPage(0);
setPortBitsToPage(0);
@@ -1379,6 +1394,8 @@ void FoolPrologue::finaleRun() {
// 131:4780
_toolbox->SetPortBits(_dstPage);
waitForClick();
+ if (_quit)
+ return;
blitPageToScreen(0);
copyScreenToPage(0);
setPortBitsToPage(0);
@@ -1391,6 +1408,8 @@ void FoolPrologue::finaleRun() {
// 131:4848
_toolbox->SetPortBits(_dstPage);
waitForClick();
+ if (_quit)
+ return;
blitPageToScreen(0);
_tickMarker = _toolbox->TickCount();
setPortBitsToPage(0);
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 1939ef9fa08..cebefa88996 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -170,7 +170,7 @@ void FoolGame::foolRun() {
}
// Define the bitmap surfaces (normally pointers to raw memory)
- arr_bmp_5dfc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
+ _scrollPage = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
arr_bmp_b3ec = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
arr_bmp_bbbc = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
arr_bmp_c38c = BitMap(new Graphics::ManagedSurface(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()));
@@ -304,6 +304,11 @@ void FoolGame::foolRun() {
if (_stateFlags & kStateOpenGame) {
openGame();
}
+ // this branch was originally on the end, but we
+ // want to kick back to the story afterward
+ if (_stateFlags & kStateMetapuzzleComplete) {
+ metapuzzleComplete();
+ }
if (_stateFlags & kStateChapterSelect) {
menuChapterSelect();
}
@@ -319,9 +324,6 @@ void FoolGame::foolRun() {
if (_stateFlags & kStatePrintStory) {
printStory();
}
- if (_stateFlags & kStateMetapuzzleComplete) {
- sub_144_004();
- }
// 128:1ee2
}
// 128:1eec
@@ -1037,7 +1039,7 @@ void FoolGame::sub_128_1f44() {
_storyCurrentPage = 0;
clearStateBits(0x200);
sub_128_5fea();
- copyScreen(1, arr_bmp_5dfc);
+ copyScreen(1, _scrollPage);
storyRenderPage();
_toolbox->SetPort(var_i32_0);
}
@@ -1480,7 +1482,7 @@ void FoolGame::newGame() {
_activePuzzle = 0;
_sunMapRestored = 0;
var_i16_7b2 = 0;
- sub_128_3032();
+ menuSetup();
// 128:2e3c
}
@@ -1540,12 +1542,12 @@ void FoolGame::openGame() {
}
} else {
// 128:302c
- sub_128_3032();
+ menuSetup();
}
}
-void FoolGame::sub_128_3032() {
+void FoolGame::menuSetup() {
_storyCurrentChapter = 0;
_stateFlags = kStateNull;
var_i16_484 = 0;
@@ -1587,7 +1589,7 @@ void FoolGame::sub_128_3032() {
strY += 0xf;
}
// 128:3228
- copyScreen(0, arr_bmp_5dfc);
+ copyScreen(0, _scrollPage);
_storyCurrentPage = 1;
storyRenderPage();
if ((var_i16_7ce & 1) == 0) {
@@ -1606,6 +1608,8 @@ void FoolGame::sub_128_3032() {
} else {
_zbasic->menu(2, 7, 1, Common::U32String());
}
+ // new: enable the "Show Finale" about menu option if game is finished
+ _zbasic->menu(1, 4, (_puzzleCompletionStatus[0x55] >= 0x64) ? 1 : 0, Common::U32String());
}
void FoolGame::menuToggleSound() {
@@ -1800,7 +1804,7 @@ void FoolGame::puzzleRun() {
_activePuzzle = _storyCurrentChapter;
var_i16_7ce |= 1;
_toolbox->InitCursor();
- copyScreen(0, arr_bmp_5dfc);
+ copyScreen(0, _scrollPage);
// 128:39fa
if (arr_i16_15e8[_storyCurrentChapter] > 0) {
sub_128_41d8();
@@ -1879,7 +1883,7 @@ void FoolGame::puzzleRun() {
puzzleSaveContext();
if ((_stateFlags & kStateQuit) == 0) {
_toolbox->PenNormal();
- copyScreen(1, arr_bmp_5dfc);
+ copyScreen(1, _scrollPage);
MenuHandle menu = _toolbox->GetMHandle(8);
_toolbox->DeleteMenu(8);
_toolbox->DisposeMenu(menu);
@@ -2288,7 +2292,8 @@ void FoolGame::menuAbout() {
modalLines = 7;
}
// 128:4dc0
- } else {
+ } else if (_puzzleCompletionStatus[0x55] < 0x64) {
+ // metapuzzle not solved
// 128:4dc4
// The sun's map is restored.
_modalText[2] = _zbasic->str(aboutOff+18);
@@ -2297,6 +2302,13 @@ void FoolGame::menuAbout() {
_modalText[4] = _zbasic->str(aboutOff+20);
_modalText[5] = _zbasic->str(aboutOff+21);
modalLines = 5;
+ } else {
+ // new: metapuzzle solved
+ // The sun's map is restored.
+ _modalText[2] = _zbasic->str(aboutOff+18);
+ _modalText[3] = _zbasic->str(aboutOff+19);
+ _modalText[4] = Common::U32String("The Book of Thoth is solved.");
+ modalLines = 4;
}
// 128:4e42
_toolbox->SetPort(var_i32_4);
@@ -2868,14 +2880,14 @@ void FoolGame::sub_129_068() {
}
// 129:07a2
_zbasic->picture(0, MENU_HEIGHT, arr_i32_192c0[0]);
- _zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, arr_bmp_5dfc);
+ _zbasic->get(0x0, 0x59, SCREEN_WIDTH, 0xb4, _scrollPage);
_zbasic->get(0x0, 0x14f, 0x7, SCREEN_HEIGHT, arr_bmp_b3ec);
_zbasic->get(0x1f9, 0x14f, SCREEN_WIDTH, SCREEN_HEIGHT, arr_bmp_109dc);
// 129:0846
// unfurl the scroll by blitting the lower half a bunch of times
for (int i = 0; i <= 0x15; i++) {
var_i16_484 = _zbasic->readDataInt();
- _zbasic->put(0, var_i16_484, arr_bmp_5dfc, kSrcCopy);
+ _zbasic->put(0, var_i16_484, _scrollPage, kSrcCopy);
delay(2);
}
// 129:0888
@@ -3098,7 +3110,7 @@ void FoolGame::sub_129_068() {
_zbasic->menu(1, 2, 1, Common::U32String("/FAbout Fool's Errand"));
// this is brand new
_zbasic->menu(1, 3, 1, Common::U32String("Show Prologue"));
- _zbasic->menu(1, 4, 1, Common::U32String("Show Finale"));
+ _zbasic->menu(1, 4, 0, Common::U32String("Show Finale"));
_zbasic->menu(1, 5, 0, Common::U32String("-"));
// File menu
@@ -3146,11 +3158,10 @@ void FoolGame::menuLoadingMessage(int16 percent) {
}
-void FoolGame::sub_144_004() {
+void FoolGame::metapuzzleComplete() {
// 144:0004
- _toolbox->ReleaseResource(var_pic_7c2);
+ //_toolbox->ReleaseResource(var_pic_7c2);
var_i32_7c8 = _zbasic->mem(-1);
- _stateFlags = kStateQuit;
if (!_screenOversized) {
_toolbox->SetPort(var_i32_8);
fillRect(0, 0, MENU_HEIGHT, SCREEN_WIDTH, 0x47);
@@ -3173,7 +3184,9 @@ void FoolGame::sub_144_004() {
_toolbox->SetPort(var_i32_0);
}
// 144:0082
- _zbasic->get(1, var_i16_42+1, SCREEN_WIDTH, SCREEN_HEIGHT-1, arr_bmp_5dfc);
+ // original used _scrollPage for the screen capture,
+ // on the grounds that the game was about to exit
+ _zbasic->get(1, var_i16_42+1, SCREEN_WIDTH, SCREEN_HEIGHT-1, arr_bmp_bbbc);
for (int16 i = 0xa; i <= 0xf0; i += 0xa) {
var_i32_692 = _toolbox->TickCount();
_zbasic->put(
@@ -3181,7 +3194,7 @@ void FoolGame::sub_144_004() {
var_i16_42 + (int16)(i*0.6f),
SCREEN_WIDTH - i,
SCREEN_HEIGHT - (int16)(i*0.6f),
- arr_bmp_5dfc, kSrcCopy);
+ arr_bmp_bbbc, kSrcCopy);
// 144:015a
delayFromMarker(0xf);
}
@@ -3199,7 +3212,10 @@ void FoolGame::sub_144_004() {
var_i16_44 + (int16)(i*0.7f)
);
_toolbox->InvertRect(temp);
- delayFromMarker(1);
+ // fudge to avoid flickering
+ if ((i % 5) == 0) {
+ delayFromMarker(1);
+ }
}
// 144:0238
for (int16 i = 0; i <= 0xe; i++) {
@@ -3219,20 +3235,38 @@ void FoolGame::sub_144_004() {
_modalText[3] = Common::U32String();
_modalText[4] = Common::U32String("Congratulations!");
_modalText[5] = Common::U32String("You may now view the finale.");
- _modalText[7] = Common::U32String("Okay");
- showChoiceModal(kFontFool, 6, 1, 0);
- if (!_screenOversized) {
- _toolbox->ClearMenuBar();
- _toolbox->DrawMenuBar();
- }
- sub_128_1f1e();
- toggleMouseCursor(true);
+ _modalText[6] = Common::U32String("Okay");
+ showChoiceModal(kFontFool, 5, 1, 0);
+
+ //if (!_screenOversized) {
+ // _toolbox->ClearMenuBar();
+ // _toolbox->DrawMenuBar();
+ //}
+ //sub_128_1f1e();
+ //toggleMouseCursor(true);
+
// 144:03e2
// write the finale file to the disk. we don't need to do this
//if (_saveFileName.empty()) {
// sub_144_5ca();
//}
//sub_144_406();
+
+ // kick back to the start of the story
+ clearStateBits(kStateMetapuzzleComplete);
+ setStateBits(kStateChapterSelect);
+ _selectedMenuChapter = 1;
+ // enable the Show Finale menu choice
+ _zbasic->menu(1, 4, 1, Common::U32String());
+ menuFinale();
+ // cleanup that's usually at the end of metapuzzleRun, but
+ // delayed so the screen buffer is still full of
+ // book of thoth
+ MenuHandle menu = _toolbox->GetMHandle(8);
+ _toolbox->DeleteMenu(8);
+ _toolbox->DisposeMenu(menu);
+ _toolbox->DrawMenuBar();
+ copyScreen(1, _scrollPage);
}
};
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index ef06ae08525..d8136aa732a 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -143,7 +143,7 @@ public:
void newGame(); // sub_128_2bc6
void openGame(); // sub_128_2e3e
- void sub_128_3032();
+ void menuSetup(); // sub_128_3032
void menuToggleSound(); // sub_128_32c8
void savePrompt(); // sub_128_32fa
void autoSaveGame();
@@ -442,7 +442,7 @@ public:
void straightPathClearText(); // sub_143_890
void straightPathSuccess(); // sub_143_8b0
- void sub_144_004();
+ void metapuzzleComplete(); // sub_144_004
private:
@@ -765,7 +765,7 @@ private:
int16 arr_i16_5cbc[128];
int16 _mazeInvItemCount[128]; // arr_i16_5cbc
float arr_bcd_5dbc[8];
- BitMap arr_bmp_5dfc; // 22000, close to a screen page
+ BitMap _scrollPage; // arr_bmp_5dfc 22000, close to a screen page
BitMap _jigsawPieces[128];
Common::Point _humbugTrail[0xa43];
BitMap arr_bmp_b3ec;
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index a6f90852dc5..7d0674dcbad 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -23,7 +23,6 @@
#include "fool/fool_game.h"
#include "fool/toolbox.h"
#include "fool/zbasic.h"
-#include <climits>
namespace Fool {
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 86176321150..691b76e2347 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -41,7 +41,7 @@ void FoolGame::metapuzzleRun() {
} else {
// 138:0024
var_i16_7ce |= 1;
- copyScreen(0, arr_bmp_5dfc);
+ copyScreen(0, _scrollPage);
fillRect(0x127, 0x69, 0x138, 0x190, 0);
fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
fillRect(0x14, 0x67, SCREEN_HEIGHT, 0x1b1, 2);
@@ -93,7 +93,7 @@ void FoolGame::metapuzzleRun() {
_toolbox->DeleteMenu(8);
_toolbox->DisposeMenu(menu);
_toolbox->DrawMenuBar();
- copyScreen(1, arr_bmp_5dfc);
+ copyScreen(1, _scrollPage);
if ((_stateFlags & (kStateNewGame | kStateOpenGame | kStateQuit)) == 0) {
if ((var_i16_7ce & 1) != 0) {
var_i16_7ce ^= 1;
@@ -168,7 +168,8 @@ void FoolGame::sub_138_21e() {
// any progress is good progress
autoSaveGame();
if ((_activePuzzle == 0x55) && (_puzzleCompletionStatus[0x55] == 0x64)) {
- _stateFlags = kStateMetapuzzleComplete | kStateQuit | kStateReturn;
+ //_stateFlags = kStateMetapuzzleComplete | kStateQuit | kStateReturn;
+ _stateFlags = kStateMetapuzzleComplete | kStateReturn;
}
if (_stateFlags <= 1) {
_stateFlags = kStateNull;
Commit: 7581d3b88465ad9b0a9c07d2794c8a4299732a2b
https://github.com/scummvm/scummvm/commit/7581d3b88465ad9b0a9c07d2794c8a4299732a2b
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:34+02:00
Commit Message:
FOOL: Cleanup based on feedback
Changed paths:
R engines/fool/console.cpp
R engines/fool/console.h
engines/fool/detection.cpp
engines/fool/detection.h
engines/fool/fool.cpp
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_game.cpp
engines/fool/fool_hermit.cpp
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_threeships.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/messages.cpp
engines/fool/module.mk
engines/fool/siphash/halfsip.cpp
engines/fool/siphash/halfsip.h
engines/fool/toolbox.cpp
engines/fool/toolbox_fileman.cpp
engines/fool/toolbox_menu.cpp
engines/fool/toolbox_pict.cpp
engines/fool/toolbox_quickdraw.cpp
engines/fool/toolbox_resman.cpp
engines/fool/toolbox_sound.cpp
engines/fool/toolbox_text.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/console.cpp b/engines/fool/console.cpp
deleted file mode 100644
index 3363b8777b3..00000000000
--- a/engines/fool/console.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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 "fool/console.h"
-
-namespace Fool {
-
-Console::Console() : GUI::Debugger() {
- registerCmd("test", WRAP_METHOD(Console, Cmd_test));
-}
-
-Console::~Console() {
-}
-
-bool Console::Cmd_test(int argc, const char **argv) {
- debugPrintf("Test\n");
- return true;
-}
-
-} // End of namespace Fool
diff --git a/engines/fool/console.h b/engines/fool/console.h
deleted file mode 100644
index 0c16428c175..00000000000
--- a/engines/fool/console.h
+++ /dev/null
@@ -1,40 +0,0 @@
-
-/* 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 FOOL_CONSOLE_H
-#define FOOL_CONSOLE_H
-
-#include "gui/debugger.h"
-
-namespace Fool {
-
-class Console : public GUI::Debugger {
-private:
- bool Cmd_test(int argc, const char **argv);
-public:
- Console();
- ~Console() override;
-};
-
-} // End of namespace Fool
-
-#endif // FOOL_CONSOLE_H
diff --git a/engines/fool/detection.cpp b/engines/fool/detection.cpp
index 271f002e0d8..6ac53ffb036 100644
--- a/engines/fool/detection.cpp
+++ b/engines/fool/detection.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "advancedDetector.h"
#include "base/plugins.h"
#include "common/config-manager.h"
#include "common/file.h"
diff --git a/engines/fool/detection.h b/engines/fool/detection.h
index 3c6c29e4756..fdb8f13eb52 100644
--- a/engines/fool/detection.h
+++ b/engines/fool/detection.h
@@ -33,8 +33,8 @@ struct FOOLGameDescription {
};
enum FoolDebugChannels {
- kDebugGraphics = 1 << 0,
- kDebugLoading = 1 << 1,
+ kDebugGraphics = 1,
+ kDebugLoading,
};
extern const PlainGameDescriptor foolGames[];
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index dfd539a60c1..8cfbd193773 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -31,7 +31,6 @@
#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
#include "fool/detection.h"
-#include "fool/console.h"
#include "fool/toolbox.h"
namespace Fool {
@@ -57,9 +56,6 @@ Common::String FoolEngine::getGameId() const {
Common::Error FoolEngine::run() {
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
- // Set the engine's debugger console
- setDebugger(new Console());
-
_screen.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_wm.setScreen(&_screen);
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index b56ac0e18d1..b38c6507286 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -704,5 +704,4 @@ void FoolGame::sub_139_1d3e() {
flashRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xc8);
}
-
-};
+} // End of namespace Fool
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 87cd187391a..77b5246d5bb 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -219,4 +219,4 @@ void FoolGame::deathDrawZoom() {
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index cebefa88996..e73dc8462bf 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -3269,4 +3269,4 @@ void FoolGame::metapuzzleComplete() {
copyScreen(1, _scrollPage);
}
-};
+} // End of namespace Fool
diff --git a/engines/fool/fool_hermit.cpp b/engines/fool/fool_hermit.cpp
index 0a0c71236a1..bb0b53a61db 100644
--- a/engines/fool/fool_hermit.cpp
+++ b/engines/fool/fool_hermit.cpp
@@ -81,4 +81,4 @@ void FoolGame::hermitRun() {
// 142:1404
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 1645a998216..021c7492745 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -245,4 +245,4 @@ void FoolGame::humbugShowThoth() {
// 142:0850
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 7ccdcb546d1..c4a7e7217e4 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -418,4 +418,4 @@ void FoolGame::jigsawSuccess() {
waitForClick();
}
-};
+} // End of namespace Fool
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 7d0674dcbad..f6855ef3224 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -1149,4 +1149,4 @@ void FoolGame::sub_130_2790() {
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index 4f7cfa0ec9a..d3c2c98e17b 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -271,4 +271,4 @@ void FoolGame::justiceResetGrid() {
zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 88661388cc2..11ec01a2223 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -1577,4 +1577,4 @@ void FoolGame::sub_136_3a70() {
// 136:3c72
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 691b76e2347..15b8a8f67b5 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -467,4 +467,4 @@ void FoolGame::metapuzzleOnShift() {
sub_128_61ec();
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 7915a34665f..8277efb7830 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -531,5 +531,4 @@ void FoolGame::polyominoStoreState() {
}
-
-};
+} // End of namespace Fool
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index 2720304cb6c..d75d7b46d54 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -211,4 +211,4 @@ void FoolGame::revealSuccess() {
flashRect(0x37, 0x13, 0xff, 0x1ee, 0xc8);
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index 4d968c38547..b339763a2c4 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -328,4 +328,4 @@ void FoolGame::sentenceSuccess() {
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index db3619398d9..3c698202cd4 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -214,4 +214,4 @@ void FoolGame::straightPathSuccess() {
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 9d10a5f7e8d..1ea7fb9484c 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -373,4 +373,4 @@ void FoolGame::sunMapRevealPiece() {
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 0e5cdb83810..08b8877cdbd 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -1328,4 +1328,4 @@ void FoolGame::sub_140_3412() {
}
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
index 7d18086e205..339ce0ecfd1 100644
--- a/engines/fool/fool_threeships.cpp
+++ b/engines/fool/fool_threeships.cpp
@@ -242,4 +242,4 @@ void FoolGame::sub_128_5a6c() {
delayFromMarker(0);
}
-}
+} // End of namespace Fool
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 8ac7eb5df9b..4f1b8709479 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -402,5 +402,4 @@ void FoolGame::wordSearchSuccess() {
}
-
-};
+} // End of namespace Fool
diff --git a/engines/fool/messages.cpp b/engines/fool/messages.cpp
index 9884ea13f1a..1711ffbfd43 100644
--- a/engines/fool/messages.cpp
+++ b/engines/fool/messages.cpp
@@ -38,4 +38,4 @@ MouseMessage::MouseMessage(Common::EventType type,
}
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index cde2852cc2a..c49571cb576 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -32,7 +32,6 @@ MODULE_OBJS = \
toolbox_sound.o \
toolbox_text.o \
zbasic.o \
- console.o \
messages.o \
metaengine.o \
utils.o
diff --git a/engines/fool/siphash/halfsip.cpp b/engines/fool/siphash/halfsip.cpp
index 50e75fd15a9..879038ec398 100644
--- a/engines/fool/siphash/halfsip.cpp
+++ b/engines/fool/siphash/halfsip.cpp
@@ -13,10 +13,8 @@
this software. If not, see
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/
+#include "common/system.h"
#include "fool/siphash/halfsip.h"
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
/* default: SipHash-2-4 */
#ifndef cROUNDS
diff --git a/engines/fool/siphash/halfsip.h b/engines/fool/siphash/halfsip.h
index 023dd4d7874..a5b8f28f822 100644
--- a/engines/fool/siphash/halfsip.h
+++ b/engines/fool/siphash/halfsip.h
@@ -20,9 +20,6 @@
namespace Fool {
-#include <inttypes.h>
-#include <string.h>
-
int halfsiphash(const void* in, const size_t inlen, const void* k, uint8_t* out, const size_t outlen);
};
diff --git a/engines/fool/toolbox.cpp b/engines/fool/toolbox.cpp
index 25ca5acdd74..6136c10e6e9 100644
--- a/engines/fool/toolbox.cpp
+++ b/engines/fool/toolbox.cpp
@@ -358,4 +358,4 @@ uint32 Toolbox::TickCount() {
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_fileman.cpp b/engines/fool/toolbox_fileman.cpp
index 5d6c59f8188..f98c2c864f5 100644
--- a/engines/fool/toolbox_fileman.cpp
+++ b/engines/fool/toolbox_fileman.cpp
@@ -73,4 +73,4 @@ void Toolbox::SFPutFile(const Common::Point &where, const Common::U32String &pro
reply.good = !fileName.empty() ? 1 : 0;
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_menu.cpp b/engines/fool/toolbox_menu.cpp
index 2c6f8b521da..c1398f41946 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/engines/fool/toolbox_menu.cpp
@@ -272,4 +272,4 @@ void Toolbox::SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_pict.cpp b/engines/fool/toolbox_pict.cpp
index 6f6f90ca9fe..68ed5c1ec99 100644
--- a/engines/fool/toolbox_pict.cpp
+++ b/engines/fool/toolbox_pict.cpp
@@ -638,4 +638,4 @@ PicHandle Toolbox::OpenPicture(const Common::Rect &picFrame) {
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_quickdraw.cpp b/engines/fool/toolbox_quickdraw.cpp
index 73343a98123..c119c10f818 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/engines/fool/toolbox_quickdraw.cpp
@@ -847,4 +847,4 @@ void Toolbox::ShowPen() {
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_resman.cpp b/engines/fool/toolbox_resman.cpp
index 8a63e14762f..906d8303228 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/engines/fool/toolbox_resman.cpp
@@ -206,4 +206,4 @@ void Toolbox::UseResFile(int16 refNum) {
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_sound.cpp b/engines/fool/toolbox_sound.cpp
index b9ab2abd137..59dd5332a05 100644
--- a/engines/fool/toolbox_sound.cpp
+++ b/engines/fool/toolbox_sound.cpp
@@ -74,4 +74,4 @@ int16 Toolbox::GetSoundVol() {
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/toolbox_text.cpp b/engines/fool/toolbox_text.cpp
index aec09ad2f08..1dea9394b4b 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/engines/fool/toolbox_text.cpp
@@ -110,4 +110,4 @@ void Toolbox::TextSize(uint16 size) {
}
}
-} // namespace Fool
+} // End of namespace Fool
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index dc201643e62..819b6f126eb 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -848,4 +848,4 @@ void ZBasic::setMenuFont(uint16 font, uint16 size) {
_menu->setFont(font, size);
}
-} // namespace Fool
+} // End of namespace Fool
Commit: 61e2c400552a54e313bae9e39723923cee886909
https://github.com/scummvm/scummvm/commit/61e2c400552a54e313bae9e39723923cee886909
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:34+02:00
Commit Message:
GRAPHICS: Move MacToolbox into common code
Changed paths:
A graphics/mactoolbox/siphash/LICENSE_CC0
A graphics/mactoolbox/siphash/halfsip.cpp
A graphics/mactoolbox/siphash/halfsip.h
A graphics/mactoolbox/toolbox.cpp
A graphics/mactoolbox/toolbox.h
A graphics/mactoolbox/toolbox_fileman.cpp
A graphics/mactoolbox/toolbox_menu.cpp
A graphics/mactoolbox/toolbox_pict.cpp
A graphics/mactoolbox/toolbox_quickdraw.cpp
A graphics/mactoolbox/toolbox_resman.cpp
A graphics/mactoolbox/toolbox_sound.cpp
A graphics/mactoolbox/toolbox_text.cpp
A graphics/mactoolbox/utils.cpp
A graphics/mactoolbox/utils.h
R engines/fool/siphash/LICENSE_CC0
R engines/fool/siphash/halfsip.cpp
R engines/fool/siphash/halfsip.h
R engines/fool/toolbox.cpp
R engines/fool/toolbox.h
R engines/fool/toolbox_fileman.cpp
R engines/fool/toolbox_menu.cpp
R engines/fool/toolbox_pict.cpp
R engines/fool/toolbox_quickdraw.cpp
R engines/fool/toolbox_resman.cpp
R engines/fool/toolbox_sound.cpp
R engines/fool/toolbox_text.cpp
R engines/fool/utils.cpp
R engines/fool/utils.h
common/debug.cpp
common/debug.h
engines/fool/fool.cpp
engines/fool/fool_cards.cpp
engines/fool/fool_death.cpp
engines/fool/fool_finale.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_hermit.cpp
engines/fool/fool_humbug.cpp
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_justice.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_metapuzzle.cpp
engines/fool/fool_polyomino.cpp
engines/fool/fool_prologue.cpp
engines/fool/fool_prologue.h
engines/fool/fool_reveal.cpp
engines/fool/fool_sentence.cpp
engines/fool/fool_straightpath.cpp
engines/fool/fool_sun.cpp
engines/fool/fool_thoth.cpp
engines/fool/fool_threeships.cpp
engines/fool/fool_wordsearch.cpp
engines/fool/module.mk
engines/fool/zbasic.cpp
engines/fool/zbasic.h
graphics/module.mk
diff --git a/common/debug.cpp b/common/debug.cpp
index aee96c512e8..0f81cf68d72 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -38,6 +38,7 @@ const DebugChannelDef gDebugChannels[] = {
{ kDebugGlobalDetection, "detection", "debug messages for advancedDetector" },
{ kDebugLevelMainGUI, "maingui", "debug messages for GUI" },
{ kDebugLevelMacGUI, "macgui", "debug messages for MacGUI" },
+ { kDebugLevelMacToolbox, "mactoolbox","debug messages for MacToolbox" },
{ kDebugLevelGGraphics, "ggraphics", "debug messages for global graphics" },
{ kDebugLevelGVideo, "gvideo", "debug messages for global video" },
{ kDebugLevelGAudio, "gaudio", "debug messages for global audio" },
diff --git a/common/debug.h b/common/debug.h
index 35d9b93e9bb..1624b1ccff9 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -167,6 +167,7 @@ enum GlobalDebugLevels {
kDebugLevelEventRec,
kDebugLevelMainGUI,
kDebugLevelMacGUI,
+ kDebugLevelMacToolbox,
kDebugLevelGGraphics,
kDebugLevelGVideo,
kDebugLevelGAudio,
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index 8cfbd193773..f007fb1163d 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -25,13 +25,13 @@
#include "common/events.h"
#include "common/system.h"
#include "engines/util.h"
+#include "graphics/mactoolbox/toolbox.h"
#include "graphics/palette.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
#include "fool/detection.h"
-#include "fool/toolbox.h"
namespace Fool {
diff --git a/engines/fool/fool_cards.cpp b/engines/fool/fool_cards.cpp
index b38c6507286..b8876896343 100644
--- a/engines/fool/fool_cards.cpp
+++ b/engines/fool/fool_cards.cpp
@@ -19,9 +19,10 @@
*
*/
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -125,7 +126,7 @@ void FoolGame::cardsRun() {
while (_stateFlags == 0) {
// 139:046e
getNextEvent(-1);
- if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
cardsOnClick();
}
if (var_i16_2014 != 0) {
@@ -186,13 +187,13 @@ void FoolGame::cardsDrawTable() {
drawTarotCard(1, 4, 0);
drawTarotCard(2, 5, 0);
drawTarotCard(3, 6, 0);
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
// 139:061a
drawTextCenter(_zbasic->str(OFF(0)), 0xc3); // Select a card above
drawTextCenter(_zbasic->str(OFF(1)), 0xd4); // or
_toolbox->FillRoundRect(arr_rect_4338, 0xa, 0xa, _patterns[0]);
_toolbox->FrameRoundRect(arr_rect_4338, 0xa, 0xa);
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
drawTextCenter(_zbasic->str(OFF(2)), 0xe9); // Yield
var_i16_2016 = 1;
var_i16_2010 = 1;
@@ -278,13 +279,13 @@ void FoolGame::cardsOnClick() {
sub_128_61ec();
// original code has the font ID as 1... maybe there's a fallback?
// this was intended to be Small
- _zbasic->text(kFontSmall, 9, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontSmall, 9, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
drawTextCenter(_zbasic->str(OFF(3)), strY); // (click mouse to continue)
var_i16_2014 = 0;
_stateFlags = 0;
while ((_stateFlags == 0) && (var_i16_2014 == 0)) {
getNextEvent(-1);
- if (_event.what == kMouseUp) {
+ if (_event.what == Graphics::MacToolbox::kMouseUp) {
var_i16_2014 = 1;
}
if (_stateFlags == kStateSaveGame) {
@@ -388,7 +389,7 @@ void FoolGame::cardsOpponentYields() {
playTone(0x19, 0x64, 0x1);
var_i16_2012 = -CARDS_YIELD_PENALTY;
cardsDrawScores();
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
drawTextCenter(_zbasic->str(OFF(4)), 0xc4); // The Old Man yields
}
@@ -514,7 +515,7 @@ void FoolGame::cardsRevealHands() {
// 139:1344
var_i16_2322 = (var_i16_2322 / 2) + 0x14;
fillRect(0x2e, 0x100 - var_i16_2322, 0x9a, 0x100 + var_i16_2322, 2);
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
drawTextCenter(var_str_384, 0x46);
drawTextCenter(var_str_167c, 0x64);
drawTextCenter(_zbasic->str(OFF(16)), 0x78); // beats
@@ -657,7 +658,7 @@ void FoolGame::sub_139_19da() {
void FoolGame::cardsDrawScores() {
// 139:1b12
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
arr_i16_1eb8[var_i16_2016 + 4] += var_i16_2012;
if (arr_i16_1eb8[5] < CARDS_MIN_SCORE) {
arr_i16_1eb8[5] = CARDS_MIN_SCORE;
diff --git a/engines/fool/fool_death.cpp b/engines/fool/fool_death.cpp
index 77b5246d5bb..debcadffecd 100644
--- a/engines/fool/fool_death.cpp
+++ b/engines/fool/fool_death.cpp
@@ -19,15 +19,14 @@
*
*/
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
-
-
// Death challenge
void FoolGame::deathRun() {
// 141:0004
@@ -35,7 +34,7 @@ void FoolGame::deathRun() {
drawPuzzleButton(Common::U32String("~")); // was: str(334)
_toolbox->InvertRect(arr_rect_1910c);
_zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_b3ec);
- _zbasic->put(0x6c, 0x127, arr_bmp_c38c, kSrcCopy);
+ _zbasic->put(0x6c, 0x127, arr_bmp_c38c, Graphics::MacToolbox::kSrcCopy);
deathDrawZoom();
fillRect(0x14f, 0, 0x156, 0x7, 0x2);
fillRect(0x14f, 0x1f9, 0x156, 0x200, 2);
@@ -45,7 +44,7 @@ void FoolGame::deathRun() {
_deathBlackEye.right = 0x1a8;
// 141:0122
_zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, arr_bmp_bbbc);
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
_event.where.y = 0x14;
// JMP 0x3c2
while (true) {
@@ -98,12 +97,12 @@ void FoolGame::deathRun() {
// 141:02fa
do {
getNextEvent(0);
- if (((_event.modifiers & kModMouseButtonUp) == 0) &&
+ if (((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) &&
_toolbox->PtInRect(_event.where, arr_rect_1910c)) {
// JMP 0x9a2
// 141:09a2
deathDrawWhiteEye();
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
deathDrawZoom();
if (_activePuzzleStatus < 0x64) {
_activePuzzleStatus = 0x64;
@@ -117,7 +116,7 @@ void FoolGame::deathRun() {
// 141:035a
// mouse moved out from menu, zap the white eye
_toolbox->PenNormal();
- _toolbox->PenMode(kNotPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kNotPatXor);
_toolbox->PenPat(_patterns[1]);
_toolbox->PenSize(0x17, 0x10);
for (int i = 0; i <= 5; i++) {
@@ -135,7 +134,7 @@ void FoolGame::deathRun() {
void FoolGame::deathMoveBlackEye() {
// 141:03ca
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
var_i16_68a = _event.where.x - 0xc - _deathBlackEye.left;
var_i16_68c = _event.where.y - 8 - _deathBlackEye.top;
// 141:0452
@@ -151,7 +150,7 @@ void FoolGame::deathMoveBlackEye() {
if (var_i16_68a > 6) {
var_i16_68a = 6;
}
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
// 141:04ce
Common::Rect newPos; // arr_rect_1ec0
newPos.top = _deathBlackEye.top + var_i16_68c;
@@ -159,7 +158,7 @@ void FoolGame::deathMoveBlackEye() {
newPos.bottom = _deathBlackEye.bottom + var_i16_68c;
newPos.right = _deathBlackEye.right + var_i16_68a;
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
// 141:05a2
if (newPos.top < 0x14) {
newPos.top = 0x14;
@@ -179,15 +178,15 @@ void FoolGame::deathMoveBlackEye() {
newPos.left = 0x1e8;
newPos.right = 0x200;
}
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
// 141:06bc
if (!((_deathBlackEye.top == newPos.top) &&
((_deathBlackEye.left == newPos.left)))) {
// 141:0722
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
_deathBlackEye = newPos;
_zbasic->get(_deathBlackEye.left, _deathBlackEye.top, _deathBlackEye.right, _deathBlackEye.bottom, arr_bmp_bbbc);
- _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(_deathBlackEye.left, _deathBlackEye.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
delay(1);
}
// 141:0880
@@ -196,7 +195,7 @@ void FoolGame::deathMoveBlackEye() {
void FoolGame::deathDrawWhiteEye() {
// 141:0882
if (_deathWhiteEyeNeedsDraw) {
- _zbasic->put(0x6c, 0x127, arr_bmp_c38c, kSrcCopy);
+ _zbasic->put(0x6c, 0x127, arr_bmp_c38c, Graphics::MacToolbox::kSrcCopy);
}
// 141:08b0
_deathWhiteEyeNeedsDraw = false;
@@ -206,16 +205,16 @@ void FoolGame::deathCaught() {
// 141:08b8
deathDrawWhiteEye();
toggleMouseCursor(false);
- zoomRect(_deathBlackEye.top, _deathBlackEye.left, _deathBlackEye.bottom, _deathBlackEye.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ zoomRect(_deathBlackEye.top, _deathBlackEye.left, _deathBlackEye.bottom, _deathBlackEye.right, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, Graphics::MacToolbox::kNotPatXor, 0x19);
toggleMouseCursor(true);
}
void FoolGame::deathDrawZoom() {
// 141:0934
for (int i = 1; i <= 2; i++) {
- zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ zoomRect(0x130, 0x76, 0x130, 0x76, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, Graphics::MacToolbox::kNotPatXor, 0x1a);
}
- fillRect(1, kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ fillRect(1, Graphics::MacToolbox::kNotPatXor, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
}
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index a8528722ff2..52a1fa058b2 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -22,12 +22,12 @@
#include "common/str.h"
#include "common/str-enc.h"
-
#include "common/ustr.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
#define OFF(x) (_zstrOffset[kOffsetFinale] + (x))
@@ -135,7 +135,7 @@ void FoolPrologue::finaleRun() {
}
// 131:0380
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
drawTreasurePhaseIn(0x14, count);
drawTreasurePhaseIn(0xa, count);
drawTreasurePhaseIn(0x14, count);
@@ -148,7 +148,7 @@ void FoolPrologue::finaleRun() {
// 131:03c0
delay(0x1e);
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// 131:0400
// well, that's that!
@@ -177,13 +177,13 @@ void FoolPrologue::finaleRun() {
_tickMarker = _toolbox->TickCount();
_srcPage = _screenPages[5];
- _toolbox->CopyBits(_dstPage, _srcPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_dstPage, _srcPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, nullptr);
setPortBitsToPage(5);
fillRect(0xaa, 0x177, 0xb9, 0x200, 0);
finaleDrawFoolUhOh();
// 131:0538
- _toolbox->CopyBits(_dstPage, _bgPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_dstPage, _bgPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, nullptr);
_toolbox->SetPortBits(_bgPage);
// 131:0554
@@ -193,13 +193,13 @@ void FoolPrologue::finaleRun() {
// 131:05b0
setPortBitsToPage(6);
- _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcOr, nullptr);
setPortBitsToPage(7);
- _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcOr, nullptr);
setPortBitsToPage(8);
- _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcOr, nullptr);
setPortBitsToPage(9);
- _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, kSrcOr, nullptr);
+ _toolbox->CopyBits(_bgPage, _srcPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcOr, nullptr);
// 131:0630
// tree morphing into priestess
@@ -219,7 +219,7 @@ void FoolPrologue::finaleRun() {
// the wind picks up
_toolbox->PenNormal();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_zbasic->unk_20();
// 131:0730
@@ -290,7 +290,7 @@ void FoolPrologue::finaleRun() {
// horrible flashing fool duplication spree
for (int i = 1; i <= 0x63; i++) {
_tickMarker = _toolbox->TickCount();
- _zbasic->put(_zbasic->rndInt(0x1ca), _zbasic->rndInt(0xfc), _foolSlice, (i % 2) ? kSrcCopy : kNotSrcCopy);
+ _zbasic->put(_zbasic->rndInt(0x1ca), _zbasic->rndInt(0xfc), _foolSlice, (i % 2) ? Graphics::MacToolbox::kSrcCopy : Graphics::MacToolbox::kNotSrcCopy);
// limit flashing to WCAG recommendation
if ((i % 10) == 0) {
_toolbox->InvertRect(temp);
@@ -311,7 +311,7 @@ void FoolPrologue::finaleRun() {
// 131:0b54
xPos = _zbasic->rndInt(0x1ca);
yPos = _zbasic->rndInt(0xfc);
- _zbasic->put(xPos, yPos, _foolSlice, kSrcCopy);
+ _zbasic->put(xPos, yPos, _foolSlice, Graphics::MacToolbox::kSrcCopy);
_toolbox->Delay(0);
}
@@ -367,7 +367,7 @@ void FoolPrologue::finaleRun() {
delay(0x3c);
// 131:0e08
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
// Are you still angry with me?
Common::U32String dialog = Common::U32String::format("\"%s\"", _zbasic->str(OFF(1)).encode().c_str());
drawText(
@@ -425,11 +425,11 @@ void FoolPrologue::finaleRun() {
srcRect.bottom = 0x19 + (0xdf - i);
// 131:1124
_srcPage = _screenPages[6];
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcBic, nullptr);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, Graphics::MacToolbox::kSrcBic, nullptr);
_srcPage = _screenPages[7];
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcOr, nullptr);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, Graphics::MacToolbox::kSrcOr, nullptr);
delayFromMarker(0x2);
- _toolbox->CopyBits(_bgPage, _dstPage, dstRect, dstRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_bgPage, _dstPage, dstRect, dstRect, Graphics::MacToolbox::kSrcCopy, nullptr);
}
_toolbox->Delay(0);
@@ -440,7 +440,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x18f, 0xc0, _pics[0x2b]); // fool card
_toolbox->SetPortBits(_dstPage);
_toolbox->PenNormal();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_toolbox->PenSize(0x5, 0x5);
// 131:1208
@@ -449,7 +449,7 @@ void FoolPrologue::finaleRun() {
_toolbox->MoveTo(0x172, 0x33);
_toolbox->LineTo(i, 0x14a);
if (i == 0x4e) {
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
// yes, apparently so
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(2)).encode().c_str()), 0x1f4, 0xd2);
_zbasic->picture(0x198, 0x102, _pics[0x25]);
@@ -490,7 +490,7 @@ void FoolPrologue::finaleRun() {
srcRect.bottom = srcRect.top + 0x96;
dstRect.top = i - 1;
dstRect.bottom = dstRect.top + 0x96;
- _toolbox->CopyBits(_dstPage, _dstPage, srcRect, dstRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_dstPage, _dstPage, srcRect, dstRect, Graphics::MacToolbox::kSrcCopy, nullptr);
delayFromMarker(0);
}
@@ -503,7 +503,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x193, 0x2d, _pics[0x2e]);
copyScreenToPage(0x6);
_toolbox->PenNormal();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_toolbox->PenSize(0x3, 0x3);
Common::Rect bindleRect; // var_i16_6c
@@ -529,17 +529,17 @@ void FoolPrologue::finaleRun() {
dstRect.right = dstRect.left + 0x32;
dstRect.top = bindleHeight;
dstRect.bottom = dstRect.top + 0x32;
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcXor, nullptr);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, Graphics::MacToolbox::kSrcXor, nullptr);
// 131:1582
_toolbox->MoveTo(0x190 - i, bindleHeight - 0x1e + i*3);
_toolbox->LineTo(0x1f4, bindleHeight + 0xa - i);
- _toolbox->CopyBits(_bgPage, _dstPage, bindleRect, bindleRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_bgPage, _dstPage, bindleRect, bindleRect, Graphics::MacToolbox::kSrcCopy, nullptr);
delayFromMarker(0x1);
}
_toolbox->SetPortBits(_dstPage);
_toolbox->PenNormal();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
// 131:1606
Particle splash[251];
for (int j = 0; j <= 1; j++) {
@@ -566,7 +566,7 @@ void FoolPrologue::finaleRun() {
}
delayFromMarker(0x3c);
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
// well, this won't do
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(3)).encode().c_str()), 0x181, 0x3c);
@@ -583,7 +583,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x193, 0x2d, _pics[0x30]);
delay(1);
_zbasic->picture(0x193, 0x2d, _pics[0x31]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(4)).encode().c_str()), 0x181, 0x3c);
// am I to suffer this fate merely for uncovering
drawTextRight(_zbasic->str(OFF(5)), 0x181, 0x4d);
@@ -609,7 +609,7 @@ void FoolPrologue::finaleRun() {
drawClickMessageRightAlign();
fillRect(0, 0, 0x96, 0x18b, 2);
_zbasic->picture(0x193, 0x2d, _pics[0x32]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
// for if that be true
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(7)).encode().c_str()), 0x181, 0x3c);
// I wish you had made the challenge more difficult
@@ -643,7 +643,7 @@ void FoolPrologue::finaleRun() {
circleMid[3+4] = (float)(circleEnd.right - circleStart.right) / steps;
// 131:1c24
_toolbox->PenPat(_patterns[1]);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
// pre-draw the puzzle circles coming off the high priestess' head
for (int16 j = 6; j <= 9; j++) {
_screenPages[j]->copyFrom(*_screenPages[j - 1]);
@@ -711,9 +711,9 @@ void FoolPrologue::finaleRun() {
_tickMarker = _toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
int16 index = i / 0xa;
- _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kNotSrcXor);
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], Graphics::MacToolbox::kNotSrcXor);
cardSliceShift[index].xPos -= cardSliceShift[index].veloc*j;
- _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kSrcCopy);
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], Graphics::MacToolbox::kSrcCopy);
// 131:2062
}
// 131:2072
@@ -723,9 +723,9 @@ void FoolPrologue::finaleRun() {
_tickMarker = _toolbox->TickCount();
for (int16 i = 0xa; i <= 0x96; i += 0xa) {
int16 index = i / 0xa;
- _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kNotSrcXor);
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], Graphics::MacToolbox::kNotSrcXor);
cardSliceShift[index].xPos += cardSliceShift[index].veloc*j;
- _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], kSrcCopy);
+ _zbasic->put(cardSliceShift[index].xPos, i + 0xa, _cardSlices[index], Graphics::MacToolbox::kSrcCopy);
}
delayFromMarker(2);
}
@@ -736,7 +736,7 @@ void FoolPrologue::finaleRun() {
dialog = _zbasic->str(OFF(11)); // be content that you still live
for (int16 i = 1; i <= 0x18; i++) {
_tickMarker = _toolbox->TickCount();
- _zbasic->text(kPrologueFontFool, i, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, i, 0, Graphics::MacToolbox::kSrcXor);
yPos += i;
drawText(dialog, 5 + i*2, yPos);
delayFromMarker(3);
@@ -748,7 +748,7 @@ void FoolPrologue::finaleRun() {
_toolbox->SetRect(temp, 0, 0, SCREEN_WIDTH, 0xdf);
_toolbox->InvertRect(temp);
_toolbox->SetRect(temp, 0, 0xdf, SCREEN_WIDTH, SCREEN_HEIGHT);
- _toolbox->PenMode(kPatOr);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatOr);
_toolbox->PenPat(_patterns[1]);
_toolbox->PaintRect(temp);
// 131:2316
@@ -781,7 +781,7 @@ void FoolPrologue::finaleRun() {
// 131:2422
_zbasic->picture(0x193, 0x2d, _pics[0x35]);
delay(0x1e);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
// well I for one am not content
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(12)).encode().c_str()), 0x181, 0x3c);
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(13)).encode().c_str()), 0x181, 0x4d);
@@ -794,7 +794,7 @@ void FoolPrologue::finaleRun() {
// 131:24da
fillRect(0, 0, 0x96, 0x18b, 2);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
// show me one last puzzle if you dare
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(14)).encode().c_str()), 0x181, 0x3c);
drawTextRight(_zbasic->str(OFF(15)), 0x181, 0x4d);
@@ -811,11 +811,11 @@ void FoolPrologue::finaleRun() {
srcRect.left = 0x100 - i*0xa;
srcRect.bottom = 0xab + (int16)(i*6.66f);
srcRect.right = 0x100 + i*0xa;
- _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, Graphics::MacToolbox::kSrcCopy, nullptr);
_toolbox->Delay(0);
}
// 131:266e
- _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, nullptr);
Common::Rect eye1, eye2;
_toolbox->SetRect(eye1, 0xae, 0x8c, 0xb6, 0x94);
_toolbox->SetRect(eye2, 0x151, 0x86, 0x159, 0x8e);
@@ -836,7 +836,7 @@ void FoolPrologue::finaleRun() {
// 131:27a2
copyScreenToPage(5);
_toolbox->SetRect(temp, 0xd0, 6, 0x133, 0x6c);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_toolbox->PenSize(3, 3);
int16 endAngle = 10;
for (int16 i = 355; i >= 180; i -= 5) {
@@ -889,7 +889,7 @@ void FoolPrologue::finaleRun() {
delay(0x48);
blitPageToScreen(6);
delay(0x1e);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// 131:2a22
// now what have I gotten myself into?
drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(17)).encode().c_str()), 0x3c, 0x2d);
@@ -917,12 +917,12 @@ void FoolPrologue::finaleRun() {
smears[i].yEnd = _zbasic->readDataInt();
}
// 131:2c02
- _zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcOr);
+ _zbasic->text(kPrologueFontSmall, 0x9, 0, Graphics::MacToolbox::kSrcOr);
for (int16 i = 1; i <= 0xe; i++) {
// THEBOOKOFTHOTH
drawText(_zbasic->midStr(_zbasic->str(OFF(19)), i, 1), smears[i].xStart, smears[i].yStart);
}
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// that's it! the answer is the book of thoth
drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(20)).encode().c_str()), 0x32, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(21)).encode().c_str()), 0x3c, 0x3e);
@@ -956,7 +956,7 @@ void FoolPrologue::finaleRun() {
_pics[i] = _toolbox->GetPicture(i);
}
delayFromMarker(0x96);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// 131:2e1a
_toolbox->MoveTo(0x46, 0x3e);
// wait, what's this?
@@ -976,11 +976,11 @@ void FoolPrologue::finaleRun() {
smearMid[3] = (float)(smears[i].yEnd - smears[i].yStart) / steps;
// 131:2f66
if (l == 0) {
- _zbasic->text(kPrologueFontSmall, 9, 0, kSrcOr);
+ _zbasic->text(kPrologueFontSmall, 9, 0, Graphics::MacToolbox::kSrcOr);
drawText(dialog, smears[i].xStart, smears[i].yStart);
}
// 131:2fc4
- _zbasic->text(kPrologueFontSmall, 0x9, 0, kSrcXor);
+ _zbasic->text(kPrologueFontSmall, 0x9, 0, Graphics::MacToolbox::kSrcXor);
for (int16 k = 1; k <= steps-1; k++) {
smearMid[0] += smearMid[0 + 2];
int16 x = (int16)smearMid[0];
@@ -989,7 +989,7 @@ void FoolPrologue::finaleRun() {
// 131:3078
drawText(dialog, x, y);
}
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
drawText(dialog, smears[i].xEnd, smears[i].yEnd);
delay(1);
}
@@ -1000,7 +1000,7 @@ void FoolPrologue::finaleRun() {
_tickMarker = _toolbox->TickCount();
copyScreenToPage(0xa);
setPortBitsToPage(0xa);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
// that's it! the answer is the book of thoth
drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(24)).encode().c_str()), 0x32, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(25)).encode().c_str()), 0x3c, 0x3e);
@@ -1033,7 +1033,7 @@ void FoolPrologue::finaleRun() {
// 131:339c
_toolbox->SetPortBits(_dstPage);
delayFromMarker(0x96);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
// that's it! the answer is the book of thoth
drawText(Common::U32String::format("\"%s", _zbasic->str(OFF(26)).encode().c_str()), 0x32, 0x2d);
drawText(Common::U32String::format("%s\"", _zbasic->str(OFF(27)).encode().c_str()), 0x3c, 0x3e);
@@ -1066,14 +1066,14 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0);
_zbasic->picture(wadjetX, wadjetY, _pics[0x2a]); // wadjet eye
_toolbox->SetPortBits(_dstPage);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// the book of thoth?
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(28)).encode().c_str()), 0x1a4, 0x2d);
_tickMarker = _toolbox->TickCount();
_screenPages[5]->copyFrom(*_screenPages[4]);
setPortBitsToPage(5);
_zbasic->picture(0x171, 0xb, _pics[0x5b]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// here is the book of thoth
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(29)).encode().c_str()), 0x1a4, 0x2d);
srcRect.top = wadjetY;
@@ -1084,32 +1084,32 @@ void FoolPrologue::finaleRun() {
srcRect.right = wadjetX + 200;
_bgPage->copyFrom(*_screenPages[4]);
_srcPage = _screenPages[9];
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, srcRect, kSrcBic, 0);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, srcRect, Graphics::MacToolbox::kSrcBic, 0);
_srcPage = _screenPages[0xa];
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, srcRect, kSrcOr, 0);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, srcRect, Graphics::MacToolbox::kSrcOr, 0);
for (int16 i = 6; i <= 8; i++) {
_screenPages[i]->copyFrom(*_bgPage);
}
setPortBitsToPage(6);
_zbasic->picture(0x171, 0xb, _pics[0x5b]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// here is the book of thoth
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(30)).encode().c_str()), 0x1a4, 0x2d);
setPortBitsToPage(7);
_zbasic->picture(0x181, 0xf, _pics[0x5a]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// and your answer is incorrect
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(31)).encode().c_str()), 0x1a4, 0x2d);
setPortBitsToPage(8);
// 131:3806
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// destroy him
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(32)).encode().c_str()), 0x1a4, 0x2d);
_toolbox->SetPortBits(_dstPage);
delayFromMarker(0xb4);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// the book of thoth?
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(33)).encode().c_str()), 0x1a4, 0x2d);
@@ -1131,13 +1131,13 @@ void FoolPrologue::finaleRun() {
srcRect.bottom = 0x19 + 0xdf - i;
_srcPage = _screenPages[9];
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcBic, 0);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, Graphics::MacToolbox::kSrcBic, 0);
_srcPage = _screenPages[10];
- _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, kSrcOr, 0);
+ _toolbox->CopyBits(_srcPage, _bgPage, srcRect, dstRect, Graphics::MacToolbox::kSrcOr, 0);
delayFromMarker(2);
- _toolbox->CopyBits(_bgPage, _dstPage, dstRect, dstRect, kSrcCopy, 0);
+ _toolbox->CopyBits(_bgPage, _dstPage, dstRect, dstRect, Graphics::MacToolbox::kSrcCopy, 0);
}
// 131:39ba
@@ -1155,7 +1155,7 @@ void FoolPrologue::finaleRun() {
_screenPages[10]->copyFrom(*_screenPages[8]);
delayFromMarker(0x3c);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// here is the book of thoth
drawTextRight(Common::U32String::format("\"%s", _zbasic->str(OFF(34)).encode().c_str()), 0x1a4, 0x2d);
@@ -1169,7 +1169,7 @@ void FoolPrologue::finaleRun() {
_pics[0x47] = _toolbox->GetPicture(0x47);
delayFromMarker(0xc8);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// and your answer is incorrect
drawTextRight(Common::U32String::format("%s\"", _zbasic->str(OFF(35)).encode().c_str()), 0x1a4, 0x2d);
delay(0xf);
@@ -1206,7 +1206,7 @@ void FoolPrologue::finaleRun() {
}
// 131:3d0c
if (k == 7) {
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcXor);
// destroy him
drawTextRight(Common::U32String::format("\"%s\"", _zbasic->str(OFF(36)).encode().c_str()), 0x1a4, 0x2d);
_zbasic->picture(0x181, 0xf, _pics[0x5a]); // angry priestess
@@ -1233,7 +1233,7 @@ void FoolPrologue::finaleRun() {
// 131:3e6c
_toolbox->PenPat(_patterns[2]);
_toolbox->PenSize(5, 5);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
int16 beamX = 0xe5;
int16 beamY = 0x58;
for (int16 i = 1; i <= 0x13; i++) {
@@ -1299,7 +1299,7 @@ void FoolPrologue::finaleRun() {
srcRect = start;
// 131:425a
- _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, 0);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, Graphics::MacToolbox::kSrcCopy, 0);
for (int16 j = 1; j <= steps - 1; j++) {
_tickMarker = _toolbox->TickCount();
@@ -1311,12 +1311,12 @@ void FoolPrologue::finaleRun() {
srcRect.left = (int16)mid[1];
srcRect.bottom = (int16)mid[2];
srcRect.right = (int16)mid[3];
- _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, 0);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, Graphics::MacToolbox::kSrcCopy, 0);
delayFromMarker(0);
// 131:4362
}
// 131:4376
- _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, 0);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, 0);
}
// 131:439a
@@ -1346,7 +1346,7 @@ void FoolPrologue::finaleRun() {
copyScreenToPage(0);
setPortBitsToPage(0);
_zbasic->picture(0x1b5, 0xba, _pics[0x3c]);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// but the fool had gained the gift of wisdom
drawText(_zbasic->str(OFF(38)), 0xd2, 0x61);
// and was able to trick the high priestess
@@ -1359,7 +1359,7 @@ void FoolPrologue::finaleRun() {
fillRect(0, 0xc8, 0xa5, SCREEN_WIDTH, 0);
// 131:45a4
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// he had remembered well the words
drawText(_zbasic->str(OFF(40)), 0xd2, 0x3f);
// of the magician
@@ -1382,7 +1382,7 @@ void FoolPrologue::finaleRun() {
setPortBitsToPage(0);
_zbasic->picture(0x1c4, 0xb3, _pics[0x3e]);
fillRect(0, 0xc8, 0xa5, SCREEN_WIDTH, 0);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// some say that the story of the fool and his
drawText(_zbasic->str(OFF(46)), 0xd2, 0x5c);
@@ -1402,7 +1402,7 @@ void FoolPrologue::finaleRun() {
_zbasic->picture(0x1be, 0xb4, _pics[0x3f]);
fillRect(0, 0xc8, 0x96, SCREEN_WIDTH, 0);
fillRect(0x12c, 0x12c, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
// but I doubt it
drawText(Common::U32String::format("\"%s\"", _zbasic->str(OFF(49)).encode().c_str()), 0x184, 0xb1);
// 131:4848
@@ -1463,7 +1463,7 @@ void FoolPrologue::finaleRun() {
for (int16 i = 1; i <= textCount; i++) {
int16 textSize = _zbasic->readDataInt();
Common::U32String label = _zbasic->readDataStr();
- _zbasic->text(kPrologueFontFool, textSize, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, textSize, 0, Graphics::MacToolbox::kSrcBic);
if (textSize == 0xc) {
yOffset += 0x19;
} else {
@@ -1491,7 +1491,7 @@ void FoolPrologue::finaleRun() {
_srcPage = _screenPages[0];
_toolbox->SetPortBits(_srcPage);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->text(kPrologueFontSmall, 9, 0, kSrcBic);
+ _zbasic->text(kPrologueFontSmall, 9, 0, Graphics::MacToolbox::kSrcBic);
// the fool's errand
drawTextCenter(_zbasic->str(OFF(50)), 0x100, 0x19 + yPic + 0x19);
// (c) 1987 by cliff johnson. all rights reserved
@@ -1511,10 +1511,10 @@ void FoolPrologue::finaleRun() {
_toolbox->SetPortBits(_srcPage);
fillRect(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->text(kPrologueFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
// and yes, the fool will return in
drawTextCenter(_zbasic->str(OFF(54)), 0x100, 0xa0);
- _zbasic->text(kPrologueFontFool, 0x18, 0, kSrcBic);
+ _zbasic->text(kPrologueFontFool, 0x18, 0, Graphics::MacToolbox::kSrcBic);
// the fool and his money
drawTextCenter(_zbasic->str(OFF(55)), 0x100, 0xc8);
delayFromMarker(0x14);
@@ -1531,7 +1531,7 @@ void FoolPrologue::finaleDrawLoadingMsg() {
// FIXME: we don't share the menu surface here yet
return;
_toolbox->SetPort(_grafPtrMenu);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// Loading Finale
Common::U32String str = Common::U32String::format("%s%d%%", _zbasic->str(OFF(56)).encode().c_str(), _prologueLoading);
// 131:4e08
@@ -1544,7 +1544,7 @@ void FoolPrologue::finaleDrawLoadingMsg() {
void FoolPrologue::finaleDrawFoolUhOh() {
// 131:4e48
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// Uh oh . . .
drawText(Common::U32String::format("\"%s\"", _zbasic->str(OFF(58)).encode().c_str()), 0x1ae, 0xb4);
@@ -1552,7 +1552,7 @@ void FoolPrologue::finaleDrawFoolUhOh() {
void FoolPrologue::finaleStartText() {
// 131:4e98
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcXor);
int16 yStart = 0xa0;
// "And so the fool heeded the advice of the magician..."
drawText(_zbasic->str(OFF(59)), 0x96, yStart);
@@ -1582,7 +1582,7 @@ void FoolPrologue::finaleCardRotate() {
// 131:5038
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
int16 steps = 0x21;
float cardLinesMid[16] = { 0 }; // arr_f64_41bbe
for (int16 i = 0; i <= 7; i++) {
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index e73dc8462bf..16b6313ecb0 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -23,10 +23,12 @@
#include "common/memstream.h"
#include "common/ustr.h"
#include "common/util.h"
+#include "graphics/mactoolbox/toolbox.h"
+#include "gui/filebrowser-dialog.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -88,15 +90,30 @@ static const byte fondSmall[] = {
0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 126, 9
};
+Common::String getFileNameFromModal(bool save, const Common::String &suggested, const Common::String &title) {
+ Common::String prefix = g_engine->getGameId() + '-';
+ Common::String mask = prefix + "*";
+ GUI::FileBrowserDialog browser(title.c_str(), "fool", save ? GUI::kFBModeSave : GUI::kFBModeLoad, mask.c_str(), suggested.c_str());
+ if (browser.runModal() <= 0) {
+ return Common::String();
+ }
+ Common::String result = browser.getResult();
+ if (!result.empty() && !result.hasPrefixIgnoreCase(prefix))
+ result = prefix + result;
+ return result;
+}
+
void FoolGame::run() {
- _toolbox = new Toolbox();
+ _toolbox = new Toolbox(&g_engine->_wm);
_zbasic = new ZBasic(_toolbox);
+ _toolbox->_setFileModalCallback(getFileNameFromModal);
+
Common::MacFinderInfo finfo;
- if (_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == kNoErr) {
+ if (_toolbox->GetFInfo(Common::U32String("The Fool's Errand"), 0, finfo) == Graphics::MacToolbox::kNoErr) {
_zbasic->loadProgram(Common::Path("The Fool's Errand", ':'));
// v1.0 filename ends with "tm"
- } else if (_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == kNoErr) {
+ } else if (_toolbox->GetFInfo(Common::U32String("xn--The Fool's Errand-306j"), 0, finfo) == Graphics::MacToolbox::kNoErr) {
_zbasic->loadProgram(Common::Path("xn--The Fool's Errand-306j", ':'));
} else {
error("FoolGame::run: Fool's Errand program not found");
@@ -276,7 +293,7 @@ void FoolGame::foolRun() {
}
}
// 128:1d76
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
sub_128_1f76();
}
if ((_storyCurrentChapter == 0x10) &&
@@ -347,7 +364,7 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
// 128:00e6
if (put == 1) {
- _zbasic->put(0, 0, bmp, kSrcCopy);
+ _zbasic->put(0, 0, bmp, Graphics::MacToolbox::kSrcCopy);
}
}
@@ -389,7 +406,7 @@ void FoolGame::sub_128_1e4(const Common::String &osType) {
// 128:023c
// get offset of bytes in string and pretend it's an OSType
// var_i32_168 = *(var_str_172 + 1);
- SFTypeList typeList = { { 0 } };
+ Graphics::MacToolbox::SFTypeList typeList = { { 0 } };
typeList.types[0] = osType.at(0) << 24;
typeList.types[0] += osType.at(1) << 16;
typeList.types[0] += osType.at(2) << 8;
@@ -521,7 +538,7 @@ void FoolGame::drawPuzzleButton(const Common::U32String &symbol) {
_toolbox->SetRect(arr_rect_1910c, 0x6c, 0x127, 0x84, 0x137);
_toolbox->EraseRoundRect(arr_rect_1910c, 0x8, 0x7);
_toolbox->FrameRoundRect(arr_rect_1910c, 0x8, 0x7);
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
int16 width = _toolbox->StringWidth(symbol);
_toolbox->MoveTo(0x78 - (width / 2), 0x133);
_toolbox->DrawString(symbol);
@@ -529,14 +546,14 @@ void FoolGame::drawPuzzleButton(const Common::U32String &symbol) {
int16 FoolGame::getVolRefNum() {
// 128:05fe
- ParamBlockRec pb;
+ Graphics::MacToolbox::ParamBlockRec pb;
_toolbox->PBGetVol(pb);
return pb.ioVRefNum;
}
OSErr FoolGame::setVolRefNum(int16 volRefNum) {
// 128:064c
- ParamBlockRec pb;
+ Graphics::MacToolbox::ParamBlockRec pb;
pb.ioVRefNum = volRefNum;
return _toolbox->PBSetVol(pb);
}
@@ -571,7 +588,7 @@ void FoolGame::drawTarotCard(int16 rectID, int16 deckPos, int16 type) {
_toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
if (type == 2) {
- _toolbox->PenMode(kPatOr);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatOr);
_toolbox->PenPat(_patterns[1]);
_toolbox->PaintRoundRect(_screenGrid[rectID], 0xc, 0xc);
}
@@ -659,35 +676,35 @@ void FoolGame::getNextEvent(uint32 unk1) {
// This function is usually called at the start of an event processing loop,
// so yield to the event pump/display update when necessary.
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
var_i16_78a = _toolbox->GetNextEvent(unk1, _event);
- if ((_event.what == kMouseDown) && (_event.where.y < MENU_HEIGHT)) {
+ if ((_event.what == Graphics::MacToolbox::kMouseDown) && (_event.where.y < MENU_HEIGHT)) {
onClickMenu();
}
// 128:0caa
_toolbox->GlobalToLocal(_event.where);
- if (_event.what == kKeyDown) {
+ if (_event.what == Graphics::MacToolbox::kKeyDown) {
// the original just checked the command key,
// non-mac PCs expect the control key to work
- if ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0) {
+ if ((_event.modifiers & (Graphics::MacToolbox::kModCommandKeyDown | Graphics::MacToolbox::kModLControlKeyDown)) == 0) {
sub_128_5f9e();
} else {
onMenuKey();
}
}
// 128:0ce0
- if ((_event.what == kAutoKey) && ((_event.modifiers & (kModCommandKeyDown | kModLControlKeyDown)) == 0)) {
+ if ((_event.what == Graphics::MacToolbox::kAutoKey) && ((_event.modifiers & (Graphics::MacToolbox::kModCommandKeyDown | Graphics::MacToolbox::kModLControlKeyDown)) == 0)) {
sub_128_5f9e();
}
- if (_event.what == kUpdateEvt) {
+ if (_event.what == Graphics::MacToolbox::kUpdateEvt) {
onUpdateEvent();
}
- if (_event.what == kDiskEvt) {
+ if (_event.what == Graphics::MacToolbox::kDiskEvt) {
onDiskEvent();
}
- if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
+ if ((_event.what == Graphics::MacToolbox::kScummVMQuitEvt) || (_event.what == Graphics::MacToolbox::kScummVMReturnToLauncherEvt)) {
menuQuit();
}
}
@@ -700,7 +717,7 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
bounds.left = left;
bounds.bottom = bottom;
bounds.right = right;
- while (_event.modifiers & kModMouseButtonUp) {
+ while (_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) {
// 128:0d94
do {
// FIXME: Flashing far too intense
@@ -713,12 +730,12 @@ void FoolGame::flashRect(int16 top, int16 left, int16 bottom, int16 right, int16
// intercept all events, and fall back to NullEvent +
// wait for vsync if no events were received.
var_i16_78a = _toolbox->GetNextEvent(-1, _event);
- if (_event.what == kNullEvent) {
+ if (_event.what == Graphics::MacToolbox::kNullEvent) {
_toolbox->Delay(0);
ticks += 1;
}
- } while (!((ticks >= (millis*60/1000)) || ((_event.modifiers & kModMouseButtonUp) == 0)));
- } while ((_event.modifiers & kModMouseButtonUp) != 0);
+ } while (!((ticks >= (millis*60/1000)) || ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0)));
+ } while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) != 0);
}
}
@@ -733,7 +750,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
}
// 128:0e46
copyScreen(0, arr_bmp_138bc);
- _zbasic->text(font, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(font, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
var_i16_7b4 = buttonCount*0x46;
var_i16_7b6 = 0;
for (int i = 0; i <= lineCount; i++) {
@@ -782,7 +799,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
// 128:10a0
if (buttonCount != 0) {
_toolbox->PenNormal();
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// 128:10c0
// loop to zero out three button rects
@@ -850,7 +867,7 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
do {
var_i16_7a8 = _toolbox->GetNextEvent(0xa, _event);
_toolbox->GlobalToLocal(_event.where);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
// 128:154a
_savePromptChoice = 0;
Common::Rect target;
@@ -874,26 +891,26 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1624
- while ((_event.what != kMouseUp) && (_toolbox->PtInRect(_event.where, target))) {
+ while ((_event.what != Graphics::MacToolbox::kMouseUp) && (_toolbox->PtInRect(_event.where, target))) {
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
- if (_event.what == kNullEvent) {
+ if (_event.what == Graphics::MacToolbox::kNullEvent) {
_toolbox->Delay(0);
}
}
_toolbox->InvertRoundRect(target, 0xa, 0xa);
// 128:1686
- while ((_event.what != kMouseUp) && (!_toolbox->PtInRect(_event.where, target))) {
+ while ((_event.what != Graphics::MacToolbox::kMouseUp) && (!_toolbox->PtInRect(_event.where, target))) {
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
- if (_event.what == kNullEvent) {
+ if (_event.what == Graphics::MacToolbox::kNullEvent) {
_toolbox->Delay(0);
}
}
// 128:16ea
- } while (_event.what != kMouseUp);
+ } while (_event.what != Graphics::MacToolbox::kMouseUp);
if (!_toolbox->PtInRect(_event.where, target)) {
_savePromptChoice = 0;
@@ -902,13 +919,13 @@ void FoolGame::showChoiceModal(uint16 font, int16 lineCount, int16 buttonCount,
}
}
// 128:172c
- if (_event.what == kKeyDown) {
+ if (_event.what == Graphics::MacToolbox::kKeyDown) {
_keyLastPressed = _event.message & 0xff;
if (_keyLastPressed == 0xd) {
_savePromptChoice = 1;
}
}
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
// 128:175c
} while (_savePromptChoice == 0);
@@ -939,7 +956,7 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
// 128:188a
toggleMouseCursor(false);
_zbasic->picture(0, MENU_HEIGHT, var_pic_7c2);
- _zbasic->text(kFontFool, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, kSrcBic);
+ _zbasic->text(kFontFool, 0x18, Graphics::kMacFontShadow | Graphics::kMacFontOutline, Graphics::MacToolbox::kSrcBic);
Common::Rect rect;
for (int j = 0; j <= 1; j++) {
// 128:18c4
@@ -961,9 +978,9 @@ void FoolGame::showBehold(int16 unk2, int16 unk1, const Common::U32String &messa
// 128:19b2
_toolbox->PenNormal();
_toolbox->PaintRect(rect);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_toolbox->FrameRect(rect);
- _toolbox->PenMode(kPatCopy);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatCopy);
var_i16_484 = _toolbox->StringWidth(message);
// 128:19ec
_toolbox->MoveTo(0x105 - (var_i16_484/2), 0x12e);
@@ -1030,7 +1047,7 @@ void FoolGame::sub_128_1f1e() {
// 128:1f1e
_toolbox->InitCursor();
toggleMouseCursor(false);
- sub_128_bde(1, 1, kSrcCopy, 1, 1, 1);
+ sub_128_bde(1, 1, Graphics::MacToolbox::kSrcCopy, 1, 1, 1);
}
void FoolGame::sub_128_1f44() {
@@ -1056,7 +1073,7 @@ void FoolGame::sub_128_1f76() {
// new: empty the event queue, so feedback is instant
_toolbox->FlushEvents(-1, 0);
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
- } while ((_event.modifiers & kModMouseButtonUp) == 0);
+ } while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0);
} else {
// 128:1fee
if ((_storyCurrentChapter == 0x10) && (_puzzleCompletionStatus[0x10] < 0x64) && (_event.where.y > 0x113) && (_event.where.x < 0x8c)) {
@@ -1138,7 +1155,7 @@ void FoolGame::storyRenderPage() {
// 128:2202
if (_storyNextPage != _storyCurrentPage) {
if ((_pageLines[_storyNextPage] < 0xe) && (var_i16_7de > 0)) {
- fillRect(1, kPatBic, var_i16_7de, 0x37, 0x11d, 0x1db);
+ fillRect(1, Graphics::MacToolbox::kPatBic, var_i16_7de, 0x37, 0x11d, 0x1db);
// 128:226e
// grab the last N-1 lines of text from the screen
_zbasic->get(0x3c, 0x122 - (0xf - _pageLines[_storyNextPage]) * 0xf, 0x1d6, 0x11d, arr_bmp_b3ec);
@@ -1155,8 +1172,8 @@ void FoolGame::storyRenderPage() {
// if we've solved a puzzle, fill the scroll with crazy patterns
if ((var_i16_7ce & 0x8) != 0) {
var_i16_7ce ^= 0x8;
- sub_128_bde(1, 0, kSrcCopy, 0, 1, 0);
- sub_128_bde(1, 0, kSrcCopy, 0, 0, 0);
+ sub_128_bde(1, 0, Graphics::MacToolbox::kSrcCopy, 0, 1, 0);
+ sub_128_bde(1, 0, Graphics::MacToolbox::kSrcCopy, 0, 0, 0);
}
// 128:235e
if (_puzzleType[_storyCurrentChapter] > 0) {
@@ -1173,28 +1190,28 @@ void FoolGame::storyRenderPage() {
drawPuzzleButton(iconStr);
// 128:23f0: CLR.W - -0x772(A5)
var_i16_7d6 = 1;
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
_toolbox->MoveTo(0x8a, 0x133);
_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
} else {
// 128:2430
var_i16_7d6 = 0;
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
_toolbox->MoveTo(0x70, 0x133);
_toolbox->DrawString(_puzzleName[_storyCurrentChapter]);
}
// 128:2468
if (!_pageNumberText[_storyNextPage].empty()) { // was: str(13)
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
_toolbox->DrawString(_pageNumberText[_storyNextPage]);
}
// 128:24be
if (_storyNextPage != _storyCurrentPage) {
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0);
if (var_i16_7e0 != 0) {
// Paste the previous lines of text, if we copied them
- _zbasic->put(0x3c, 0x32, arr_bmp_b3ec, kSrcCopy);
+ _zbasic->put(0x3c, 0x32, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
}
// 128:252a
// y-position where the story text should start
@@ -1232,7 +1249,7 @@ void FoolGame::menuClickMessage() {
// hide menu and replace with "click mouse to continue" message
_toolbox->SetPort(var_i32_8);
fillRect(0, 7, 0x13, _windowWidth-7, 0);
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
Common::U32String message = Common::U32String("Click Mouse to Continue"); // was: str(15)
int16 width = _toolbox->StringWidth(message);
_toolbox->MoveTo((_windowWidth / 2) - (width / 2), 0xf);
@@ -1578,7 +1595,7 @@ void FoolGame::menuSetup() {
// 128:318e
fillRect(0x1e, 0x37, 0x32, 0xc8, 0);
fillRect(0x2f, 0x37, 0x11f, 0x1db, 0x0);
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
int16 strY = 0x3c;
var_i16_7de = 0x2d;
// draw the first page of text
@@ -2316,7 +2333,7 @@ void FoolGame::menuAbout() {
_toolbox->InitCursor();
toggleMouseCursor(true);
copyScreen(0, arr_bmp_138bc);
- _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
var_i16_7b4 = 0;
var_i16_7b6 = 0;
var_i16_7b8 = 0;
@@ -2378,7 +2395,7 @@ void FoolGame::menuAbout() {
strY += 0x11;
}
// 128:50f4
- _zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontSmall, 0x9, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
strY += 0xe;
drawTextCenter(_zbasic->str(_zstrOffset[kOffsetVersion]), strY); // version string
menuClickMessage();
@@ -2410,7 +2427,7 @@ void FoolGame::onClickMenu() {
// 128:5b30
if (_menuDisabled)
return;
- _event.what = kNullEvent;
+ _event.what = Graphics::MacToolbox::kNullEvent;
if (_menuHidesPlayfield) {
thothHidePlayfield();
}
@@ -2487,21 +2504,21 @@ void FoolGame::onMenuSelect() {
if ((_selectedMenuID >= 3) && (_selectedMenuID <= 7)) { // Chapter menus
var_i16_e1a = 0;
_selectedMenuChapter = _selectedMenuItem + (_selectedMenuID - 3)*0x10;
- if ((_selectedMenuChapter == 1) && (_event.what == kKeyDown)) {
+ if ((_selectedMenuChapter == 1) && (_event.what == Graphics::MacToolbox::kKeyDown)) {
var_i16_e1a = 1;
}
// 128:5d56
- if ((_event.modifiers & kModLOptionKeyDown) != 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModLOptionKeyDown) != 0) {
var_i16_e1a = 1;
} else {
// 128:5d74
do {
- var_i16_7a8 = _toolbox->GetNextEvent(1 << kKeyDown, _event);
+ var_i16_7a8 = _toolbox->GetNextEvent(1 << Graphics::MacToolbox::kKeyDown, _event);
_toolbox->GlobalToLocal(_event.where);
- if ((_event.modifiers & kModLOptionKeyDown) != 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModLOptionKeyDown) != 0) {
var_i16_e1a = 1;
}
- } while (_event.what != kNullEvent);
+ } while (_event.what != Graphics::MacToolbox::kNullEvent);
}
// 128:5dae
if (((var_i16_7ce & 1) == 0) && (var_i16_e1a == 0) && (_storyCurrentChapter != _selectedMenuChapter)) {
@@ -2613,9 +2630,9 @@ void FoolGame::waitForMouseUp() {
// was originally a mask of 6
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
- } while ((_event.modifiers & kModMouseButtonUp) == 0);
+ } while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0);
}
void FoolGame::waitForClick() {
@@ -2625,9 +2642,9 @@ void FoolGame::waitForClick() {
// was originally a mask of 2
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
_toolbox->GlobalToLocal(_event.where);
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
- } while ((_event.what != kMouseDown));
+ } while ((_event.what != Graphics::MacToolbox::kMouseDown));
waitForMouseUp();
}
@@ -2636,31 +2653,31 @@ void FoolGame::sub_128_61ec() {
// 128:61ec
do {
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
- if (_event.what == kUpdateEvt) {
+ if (_event.what == Graphics::MacToolbox::kUpdateEvt) {
onUpdateEvent();
}
- if (_event.what == kDiskEvt) {
+ if (_event.what == Graphics::MacToolbox::kDiskEvt) {
onDiskEvent();
}
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
- } while (!((_event.what == kNullEvent) && (_event.modifiers & kModMouseButtonUp)));
+ } while (!((_event.what == Graphics::MacToolbox::kNullEvent) && (_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp)));
_keyLastPressed = 0;
}
void FoolGame::sub_128_6244() {
do {
var_i16_7a8 = _toolbox->GetNextEvent(-1, _event);
- if (_event.what == kUpdateEvt) {
+ if (_event.what == Graphics::MacToolbox::kUpdateEvt) {
_toolbox->BeginUpdate(*_event.windowPtr);
_toolbox->EndUpdate(*_event.windowPtr);
}
// 128:6272
- if (_event.what == kDiskEvt) {
+ if (_event.what == Graphics::MacToolbox::kDiskEvt) {
onDiskEvent();
}
_toolbox->Delay(0);
- } while ((_event.what == kNullEvent) && ((_event.modifiers & kModMouseButtonUp) == 0));
+ } while ((_event.what == Graphics::MacToolbox::kNullEvent) && ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0));
// SEGMENT_RETURN
}
@@ -2850,7 +2867,7 @@ void FoolGame::sub_129_068() {
// 129:0636
if (var_str_e22.empty()) { // was: str(135)
do {
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
fillRect(0x17, 0x92, 0x31, 0x16e, 2);
//var_i16_7a2 = 0x28;
// prompt to locate the fool's puzzles file
@@ -2887,12 +2904,12 @@ void FoolGame::sub_129_068() {
// unfurl the scroll by blitting the lower half a bunch of times
for (int i = 0; i <= 0x15; i++) {
var_i16_484 = _zbasic->readDataInt();
- _zbasic->put(0, var_i16_484, _scrollPage, kSrcCopy);
+ _zbasic->put(0, var_i16_484, _scrollPage, Graphics::MacToolbox::kSrcCopy);
delay(2);
}
// 129:0888
- _zbasic->put(0, 0x14f, arr_bmp_b3ec, kSrcCopy);
- _zbasic->put(0x1f9, 0x14f, arr_bmp_109dc, kSrcCopy);
+ _zbasic->put(0, 0x14f, arr_bmp_b3ec, Graphics::MacToolbox::kSrcCopy);
+ _zbasic->put(0x1f9, 0x14f, arr_bmp_109dc, Graphics::MacToolbox::kSrcCopy);
_zbasic->picture(0x39, 0x29, arr_i32_192c0[1]);
// 129:08ee
@@ -3146,7 +3163,7 @@ void FoolGame::menuLoadingMessage(int16 percent) {
// draw the loading text on the menu bar
_toolbox->SetPort(var_i32_8);
fillRect(0, 7, 0x13, _windowWidth - 7, 0);
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// Loading Game text during initial puzzle load
Common::U32String message = Common::U32String::format("Loading Game - %d%%", percent); // was: str(158)
int16 width = _toolbox->StringWidth(message);
@@ -3194,7 +3211,7 @@ void FoolGame::metapuzzleComplete() {
var_i16_42 + (int16)(i*0.6f),
SCREEN_WIDTH - i,
SCREEN_HEIGHT - (int16)(i*0.6f),
- arr_bmp_bbbc, kSrcCopy);
+ arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
// 144:015a
delayFromMarker(0xf);
}
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index d8136aa732a..f7c5f660cb2 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -24,15 +24,34 @@
#include "common/rect.h"
#include "common/str.h"
-
#include "common/ustr.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool.h"
-#include "fool/toolbox.h"
namespace Fool {
class ZBasic;
+using Graphics::MacToolbox::BitMap;
+using Graphics::MacToolbox::Cursor;
+using Graphics::MacToolbox::EventRecord;
+using Graphics::MacToolbox::Handle;
+using Graphics::MacToolbox::GrafPort;
+using Graphics::MacToolbox::GrafPtr;
+using Graphics::MacToolbox::MenuHandle;
+using Graphics::MacToolbox::OSErr;
+using Graphics::MacToolbox::OSType;
+using Graphics::MacToolbox::Pattern;
+using Graphics::MacToolbox::PatternMode;
+using Graphics::MacToolbox::PicHandle;
+using Graphics::MacToolbox::PolyHandle;
+using Graphics::MacToolbox::RGBColor;
+using Graphics::MacToolbox::SFReply;
+using Graphics::MacToolbox::SourceMode;
+using Graphics::MacToolbox::Toolbox;
+using Graphics::MacToolbox::WindowRecord;
+
enum FoolStateBits : uint16 {
kStateNull = 0x00,
kStateReturn = 0x01,
diff --git a/engines/fool/fool_hermit.cpp b/engines/fool/fool_hermit.cpp
index bb0b53a61db..c20f5647a8a 100644
--- a/engines/fool/fool_hermit.cpp
+++ b/engines/fool/fool_hermit.cpp
@@ -19,9 +19,10 @@
*
*/
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
diff --git a/engines/fool/fool_humbug.cpp b/engines/fool/fool_humbug.cpp
index 021c7492745..76f4985c758 100644
--- a/engines/fool/fool_humbug.cpp
+++ b/engines/fool/fool_humbug.cpp
@@ -19,9 +19,10 @@
*
*/
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -45,7 +46,7 @@ void FoolGame::humbugRun() {
}
// 142:004e
_activePuzzleStatus = 0x63;
- zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
+ zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, Graphics::MacToolbox::kPatCopy, 0x19);
// behold the 2nd key of thoth
showBehold(0x17, 0, _zbasic->str(OFF(0)));
}
@@ -76,7 +77,7 @@ void FoolGame::humbugPlayTrail() {
// 142:0166
fetchPuzzleData();
toggleMouseCursor(false);
- _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcOr);
drawPuzzleButton(_zbasic->str(OFF(5))); // ~
// eye button
_zbasic->get(0x6c, 0x127, 0x84, 0x137, arr_bmp_b3ec);
@@ -87,7 +88,7 @@ void FoolGame::humbugPlayTrail() {
_humbugTrail[i].x,
_humbugTrail[i].y,
arr_bmp_b3ec,
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
// Simulate slow draw speed
if ((i % 42) == 0)
@@ -99,7 +100,7 @@ void FoolGame::humbugPlayTrail() {
_humbugTrail[_humbugTrailIndex].x,
_humbugTrail[_humbugTrailIndex].y,
arr_bmp_b3ec,
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
_humbugTrailIndex = 1;
_stateFlags = kStateNull;
@@ -154,7 +155,7 @@ void FoolGame::humbugMoveMouse() {
_humbugTrail[index].x,
_humbugTrail[index].y,
arr_bmp_b3ec,
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
// 142:051c
} while (_zbasic->incrAndCheck(index, var_i16_1a9c, incr));
@@ -172,7 +173,7 @@ void FoolGame::humbugMoveMouse() {
_humbugTrail[i].x,
_humbugTrail[i].y,
arr_bmp_b3ec,
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
// 142:05c8
}
@@ -186,7 +187,7 @@ void FoolGame::humbugMoveMouse() {
void FoolGame::humbugSuccess() {
// 142:05f2
- zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x19);
+ zoomRect(0x137, 0xc6, 0x147, 0xdd, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, Graphics::MacToolbox::kNotPatXor, 0x19);
}
void FoolGame::humbugShowThoth() {
@@ -197,7 +198,7 @@ void FoolGame::humbugShowThoth() {
if (_activePuzzleSolved) {
// 142:066e
_toolbox->PenNormal();
- _zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x19, Graphics::MacToolbox::kSrcBic);
for (int16 i = 1; i <= 4; i++) {
Common::Rect temp;
temp.top = arr_i16_2f38[i*32];
@@ -217,13 +218,13 @@ void FoolGame::humbugShowThoth() {
_toolbox->DrawString(idStr);
}
// 142:07ca
- _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcOr);
waitForMouseUp();
menuClickMessage();
int16 tickCounter = 0;
int16 idCounter = 0;
- while (_event.modifiers & kModMouseButtonUp) {
+ while (_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) {
// 142:07f8
getNextEvent(-1); // was: 0
tickCounter++;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index c4a7e7217e4..223edeee767 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -19,11 +19,10 @@
*
*/
+#include "graphics/mactoolbox/toolbox.h"
#include "graphics/managed_surface.h"
-#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -106,7 +105,7 @@ void FoolGame::jigsawRun() {
_screenGrid[i].left,
_screenGrid[i].top,
_jigsawPieces[arr_i16_3738[i]],
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
// 132:0452
}
@@ -126,7 +125,7 @@ void FoolGame::jigsawRun() {
while ((_stateFlags == kStateNull) && !_activePuzzleSolved) {
// 132:0488
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
jigsawOnClick();
}
}
@@ -159,7 +158,7 @@ void FoolGame::jigsawOnClick() {
_zbasic->menu(8, 3, 0, Common::U32String());
_toolbox->PenNormal();
_toolbox->PenSize(3, 3);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
// 132:05c4
arr_i16_4758[0] = var_i16_68a;
arr_i16_4758[1] = var_i16_68c;
@@ -221,7 +220,7 @@ void FoolGame::jigsawDragSelect() {
delay(2);
_toolbox->FrameRect(temp);
delay(1);
- } while (_event.what != kMouseUp);
+ } while (_event.what != Graphics::MacToolbox::kMouseUp);
}
void FoolGame::jigsawMoveSelected() {
@@ -281,7 +280,7 @@ void FoolGame::jigsawMoveSelected() {
_toolbox->FrameRect(arr_rect_4776);
delay(1);
}
- while (!((_event.what == kMouseDown) && (_event.where.y > 0x14)));
+ while (!((_event.what == Graphics::MacToolbox::kMouseDown) && (_event.where.y > 0x14)));
}
void FoolGame::jigsawCancelSelect() {
@@ -348,7 +347,7 @@ void FoolGame::jigsawDropSelected() {
_screenGrid[arr_i16_2f38[i*32 + j]].left,
_screenGrid[arr_i16_2f38[i*32 + j]].top,
_jigsawPieces[arr_i16_3738[arr_i16_2f38[i*32 + j]]],
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
}
}
@@ -367,7 +366,7 @@ void FoolGame::jigsawDropSelected() {
_screenGrid[arr_i16_2f38[i*32+j]].left,
_screenGrid[arr_i16_2f38[i*32+j]].top,
_jigsawPieces[arr_i16_3738[arr_i16_2f38[i*32 + j]]],
- kSrcCopy
+ Graphics::MacToolbox::kSrcCopy
);
}
// 132:134a
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index f6855ef3224..99479d17cea 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -135,9 +135,9 @@ void FoolGame::jumbleRun() {
}
// 130:03ba
if (var_i16_105e == 2) {
- var_i16_106c = kSrcBic;
+ var_i16_106c = Graphics::MacToolbox::kSrcBic;
} else {
- var_i16_106c = kSrcOr;
+ var_i16_106c = Graphics::MacToolbox::kSrcOr;
}
// 130:03d4
if (_jumbleGameType == 4) {
@@ -244,7 +244,7 @@ void FoolGame::jumbleRun() {
var_i16_484 = puzzlesReadShort();
var_i16_7e4 = puzzlesReadShort();
var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
- _zbasic->text(kFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
if (var_i16_7e4 > 0) {
_toolbox->MoveTo(var_i16_484, var_i16_7e4);
_toolbox->DrawString(var_str_1578);
@@ -329,7 +329,7 @@ void FoolGame::jumbleRun() {
// 130:0a90
if (_activePuzzle != 0x55) {
// 130:0b68
- while ((_event.modifiers & kModMouseButtonUp) != 0) {
+ while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) != 0) {
// 130:0aa0
if (arr_i16_4338[0] > 0) {
// strobe the squares in the victory list
@@ -349,7 +349,7 @@ void FoolGame::jumbleRun() {
getNextEvent(-1);
int delta = MAX(0, var_i16_7e4*60/1000 - ((int)_toolbox->TickCount() - ticks));
_toolbox->Delay(delta);
- } while (!((var_i16_68a == arr_i16_4338[0]) || ((_event.modifiers & kModMouseButtonUp) == 0)));
+ } while (!((var_i16_68a == arr_i16_4338[0]) || ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0)));
} else {
// 130:0b62
// mask was originally 0
@@ -367,7 +367,7 @@ void FoolGame::jumbleRun() {
_toolbox->Delay(0xd*60/1000);
_toolbox->InvertRect(_screenGrid[arr_i16_4338[i]]);
getNextEvent(0);
- if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
_activePuzzleSolved = true;
}
}
@@ -426,7 +426,7 @@ void FoolGame::sub_130_d2e() {
_stateFlags = kStateNull;
while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170)) {
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
@@ -485,7 +485,7 @@ void FoolGame::jumbleRunSubstitution() {
if (_keyLastPressed != 0) {
jumbleOnKey();
}
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
@@ -513,7 +513,7 @@ void FoolGame::sub_130_1004() {
if (_keyLastPressed != 0) {
jumbleOnKey();
}
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
@@ -543,7 +543,7 @@ void FoolGame::jumbleRunWordSquare() {
// 130:121c
while (((_stateFlags & kStateReturn) == 0) && (var_str_1070 != var_str_1170) && (var_str_1070 != var_str_177c)) {
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
@@ -573,7 +573,7 @@ void FoolGame::jumbleRunHiddenMessage() {
jumbleOnKey();
}
getGridFromMouse(var_i16_68a, var_i16_68c);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
jumbleOnClick();
}
if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
@@ -908,7 +908,7 @@ void FoolGame::sub_130_1e76() {
// 130:1ff4
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
- _toolbox->PenMode(kPatBic);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatBic);
_toolbox->PaintRect(temp);
}
@@ -1010,7 +1010,7 @@ void FoolGame::sub_130_2226() {
if (var_str_1578.empty()) // was: str(186)
return;
// 130:22a0
- _zbasic->text(kFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
var_i16_484 = _toolbox->StringWidth(var_str_1578);
_toolbox->MoveTo(0x127 - (var_i16_484 / 2), 0x133);
_toolbox->DrawString(var_str_1578);
@@ -1022,7 +1022,7 @@ void FoolGame::sub_130_22ee() {
fillRect(0x131, 0x84, 0x156, 0x17e, var_i16_1060);
if (var_str_1578.empty()) // was: str(187)
return;
- _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
var_i16_7ba = _toolbox->StringWidth(var_str_1578);
fillRect(0x13c, 0xf6 - (var_i16_7ba / 2), 0x150, 0x10a + (var_i16_7ba / 2), 2);
_toolbox->MoveTo(0x100 - (var_i16_7ba / 2), 0x14a);
@@ -1035,7 +1035,7 @@ void FoolGame::sub_130_23cc() {
fillRect(0x12c, 0x8c, 0x156, 0x186, var_i16_1060);
if (var_str_1578.empty()) // was: str(188)
return;
- _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
var_i16_7ba = _toolbox->StringWidth(var_str_1578);
fillRect(0x130, 0x100 - (var_i16_7ba / 2), 0x144, 0x114 + (var_i16_7ba / 2), 2);
_toolbox->MoveTo(0x10a - (var_i16_7ba / 2), 0x13e);
@@ -1048,7 +1048,7 @@ void FoolGame::sub_130_24aa() {
fillRect(0x125, 0x20, 0x136, 0x15e, 2);
if (var_str_1578.empty()) // was: str(189)
return;
- _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
var_i16_7ba = _toolbox->StringWidth(var_str_1578);
_toolbox->MoveTo(0xc4 - (var_i16_7ba / 2), 0x131);
_toolbox->DrawString(var_str_1578);
@@ -1057,7 +1057,7 @@ void FoolGame::sub_130_24aa() {
void FoolGame::sub_130_2548() {
warning(__func__);
// 130:2548
- _zbasic->text(kFontFool, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
fillRect(0x131, 0, 0x156, 0x10e, 0x47);
if (var_str_1578.empty()) // was: str(190)
return;
diff --git a/engines/fool/fool_justice.cpp b/engines/fool/fool_justice.cpp
index d3c2c98e17b..9ad398126cd 100644
--- a/engines/fool/fool_justice.cpp
+++ b/engines/fool/fool_justice.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -46,7 +46,7 @@ void FoolGame::justiceRun() {
return;
} else {
// 142:08a2
- zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x1a);
+ zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, Graphics::MacToolbox::kPatCopy, 0x1a);
_activePuzzleStatus = 0x63;
// behold the 3rd key of thoth
showBehold(0x3f, 1, _zbasic->str(OFF(0)));
@@ -58,7 +58,7 @@ void FoolGame::justiceRun() {
_zbasic->menu(8, 1, 1, _zbasic->str(OFF(2))); // return to scroll
thothKey3rd();
if (_activePuzzleSolved) {
- zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, kPatXor, 0x19);
+ zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 2, Graphics::MacToolbox::kPatXor, 0x19);
}
}
// 142:098a
@@ -218,7 +218,7 @@ void FoolGame::justiceOnClick() {
void FoolGame::justiceZoom() {
// 142:0f58
- zoomRect(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, kPatXor, 0x19);
+ zoomRect(0x130, 0x76, 0x130, 0x76, 0x1a, 0x82, 0x128, 0x190, 1, Graphics::MacToolbox::kPatXor, 0x19);
}
void FoolGame::justiceDrawBlock(int16 gridIndex) {
@@ -228,7 +228,7 @@ void FoolGame::justiceDrawBlock(int16 gridIndex) {
_toolbox->PenNormal();
_toolbox->FillRoundRect(_screenGrid[gridIndex], 0x1e, 0x1e, _patterns[0]);
_toolbox->FrameRoundRect(_screenGrid[gridIndex], 0x1e, 0x1e);
- _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcOr);
Common::U32String label = _zbasic->index(1, gridIndex + 0x19);
int16 width = _toolbox->StringWidth(label);
// 142:1056
@@ -268,7 +268,7 @@ void FoolGame::justiceResetGrid() {
_toolbox->FillRect(_screenGrid[i], _patterns[2]);
}
// 142:126e
- zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kNotPatXor, 0x1a);
+ zoomRect(0xec, 0x154, 0x11e, 0x186, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, Graphics::MacToolbox::kNotPatXor, 0x1a);
}
} // End of namespace Fool
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 11ec01a2223..730e075247a 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -160,7 +160,7 @@ void FoolGame::mazeRun() {
while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
// 136:06fe
getNextEvent(-1);
- if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
mazeOnClick();
}
if (_mazePlayerX == 0x19) {
@@ -240,7 +240,7 @@ void FoolGame::mazeFlashWall() {
_toolbox->PenNormal();
_toolbox->PenSize(5, 5);
if (arr_i16_1eb8[21] == 0) {
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
switch (_mazePlayerDirection-1) {
case 0:
mazeAddWallLeft();
@@ -499,7 +499,7 @@ void FoolGame::mazePrintMessage() {
}
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
if (!var_str_1ce2.empty()) { // was: str(OFF(7))
- _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
int16 width = _toolbox->StringWidth(var_str_1ce2);
fillRect(0x13b, 0xf1 - (width / 2), 0x14f, 0x10f + (width / 2), 2);
drawTextCenter(var_str_1ce2.decode(Common::kMacRoman), 0x149);
@@ -578,9 +578,9 @@ void FoolGame::mazeDrawLetter() {
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
if (var_i16_1dea == var_i16_1574) {
- var_src_1dee = kSrcOr;
+ var_src_1dee = Graphics::MacToolbox::kSrcOr;
} else {
- var_src_1dee = kSrcBic;
+ var_src_1dee = Graphics::MacToolbox::kSrcBic;
}
// 136:11ce
arr_i16_4338[var_i16_1dea] = var_i16_106e;
@@ -594,10 +594,10 @@ void FoolGame::mazeDrawLetter() {
var_i16_106e = arr_i16_4338[var_i16_1dea];
arr_i16_4338[var_i16_1dea] = 0;
if (var_i16_1dea == var_i16_1574) {
- var_src_1dee = kSrcBic;
+ var_src_1dee = Graphics::MacToolbox::kSrcBic;
} else {
// 136:126a
- var_src_1dee = kSrcOr;
+ var_src_1dee = Graphics::MacToolbox::kSrcOr;
}
}
// 136:1270
@@ -605,10 +605,10 @@ void FoolGame::mazeDrawLetter() {
var_i16_1dea = var_i16_1574;
var_i16_106e = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1dea == var_i16_1574) {
- var_src_1dee = kSrcOr;
+ var_src_1dee = Graphics::MacToolbox::kSrcOr;
} else {
// 136:12cc
- var_src_1dee = kSrcBic;
+ var_src_1dee = Graphics::MacToolbox::kSrcBic;
}
// 136:12d2
arr_i16_4338[var_i16_1dea] = var_i16_106e;
@@ -826,7 +826,7 @@ void FoolGame::sub_136_19d2() {
warning(__func__);
// 136:19d2
_toolbox->PenNormal();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_toolbox->PenSize(6, 6);
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1de4 = var_i16_1de4 * 2 - 1;
@@ -920,7 +920,7 @@ void FoolGame::mazeThornsGetScroll() {
mazeLoadTone(7);
_toolbox->PenNormal();
_toolbox->PenSize(4, 4);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
// 136:1eb0
if (var_i16_1e00 == 1) {
arr_i16_4758[0] = 0x14;
@@ -1430,7 +1430,7 @@ void FoolGame::mazeLoadState() {
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
if (var_i16_1de4 > 0) {
- _zbasic->text(kFontPuzzle, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontPuzzle, 0xc, 0, Graphics::MacToolbox::kSrcBic);
for (int16 i = 1; i <= var_i16_1de4; i++) {
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(_activePuzzleBuffer, var_i16_1f0a, 2));
var_i16_1f0a += 2;
@@ -1540,7 +1540,7 @@ void FoolGame::sub_136_3a70() {
// 136:3b0e
for (int16 j = 0; j <= 1; j++) {
if (j == 1) {
- _toolbox->PenMode(kNotPatOr);
+ _toolbox->PenMode(Graphics::MacToolbox::kNotPatOr);
_toolbox->PenPat(_patterns[1]);
}
// 136:3b32
diff --git a/engines/fool/fool_metapuzzle.cpp b/engines/fool/fool_metapuzzle.cpp
index 15b8a8f67b5..bf43ce34608 100644
--- a/engines/fool/fool_metapuzzle.cpp
+++ b/engines/fool/fool_metapuzzle.cpp
@@ -19,11 +19,9 @@
*
*/
-#include "graphics/managed_surface.h"
+#include "graphics/mactoolbox/toolbox.h"
-#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -43,7 +41,7 @@ void FoolGame::metapuzzleRun() {
var_i16_7ce |= 1;
copyScreen(0, _scrollPage);
fillRect(0x127, 0x69, 0x138, 0x190, 0);
- fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ fillRect(1, Graphics::MacToolbox::kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
fillRect(0x14, 0x67, SCREEN_HEIGHT, 0x1b1, 2);
var_i16_484 = 0;
for (int16 j = 0x1a; j <= 0x132; j += 0x23) {
@@ -69,10 +67,10 @@ void FoolGame::metapuzzleRun() {
if (_event.what == 1) {
metapuzzleOnClick();
}
- if ((_event.modifiers & (kModLOptionKeyDown | kModMouseButtonUp)) == (kModLOptionKeyDown | kModMouseButtonUp)) {
+ if ((_event.modifiers & (Graphics::MacToolbox::kModLOptionKeyDown | Graphics::MacToolbox::kModMouseButtonUp)) == (Graphics::MacToolbox::kModLOptionKeyDown | Graphics::MacToolbox::kModMouseButtonUp)) {
metapuzzleOnOption();
}
- if ((_event.modifiers & (kModLShiftKeyDown | kModMouseButtonUp)) == (kModLShiftKeyDown | kModMouseButtonUp)) {
+ if ((_event.modifiers & (Graphics::MacToolbox::kModLShiftKeyDown | Graphics::MacToolbox::kModMouseButtonUp)) == (Graphics::MacToolbox::kModLShiftKeyDown | Graphics::MacToolbox::kModMouseButtonUp)) {
metapuzzleOnShift();
}
if (_activePuzzle != 0) {
@@ -154,7 +152,7 @@ void FoolGame::sub_138_21e() {
straightPathRun();
}
if (_activePuzzle == 0x57) {
- zoomRect(arr_i16_4d20[28], arr_i16_4d20[0x1c+1], arr_i16_4d20[0x1c+2], arr_i16_4d20[0x1c+3], 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
+ zoomRect(arr_i16_4d20[28], arr_i16_4d20[0x1c+1], arr_i16_4d20[0x1c+2], arr_i16_4d20[0x1c+3], 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, Graphics::MacToolbox::kPatXor, 0x1a);
mazeRun();
}
// 138:0334
@@ -199,7 +197,7 @@ void FoolGame::metapuzzleSetupMenu() {
void FoolGame::metapuzzleWheel() {
// 138:049e
for (int16 i = 1; i <= 2; i++) {
- zoomRect(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, kPatXor, 0x1a);
+ zoomRect(arr_i16_4d20[0x30], arr_i16_4d20[0x30 + 1], arr_i16_4d20[0x30 + 2], arr_i16_4d20[0x30 + 3], 0x6e, 7, 0x100, 0x5d, 0x1, Graphics::MacToolbox::kPatXor, 0x1a);
}
_zbasic->picture(6, 0x6d, _metapuzzleWheelPic);
menuClickMessage();
@@ -211,7 +209,7 @@ void FoolGame::metapuzzleSecretCode() {
var_i16_c00 = 1;
for (int16 i = 1; i <= 2; i++) {
var_i16_68c = _activePuzzle - 0x50;
- zoomRect(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, kPatXor, 0x1a);
+ zoomRect(arr_i16_4d20[var_i16_68c*4], arr_i16_4d20[var_i16_68c*4+1], arr_i16_4d20[var_i16_68c*4+2], arr_i16_4d20[var_i16_68c*4+3], 0x122, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 1, Graphics::MacToolbox::kPatXor, 0x1a);
}
if (_activePuzzle == 0x58) {
_metapuzzleSecretGoal = _zbasic->str(OFF(4)); // treasure name
@@ -302,7 +300,7 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
if (!((_keyLastPressed >= 0x41) && (_keyLastPressed <= 0x5a))) {
return;
}
- _zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x19, Graphics::MacToolbox::kSrcBic);
_metapuzzleSecretCodeCount++;
if (_metapuzzleSecretCodeSpaceOffset == _metapuzzleSecretCodeCount) {
if (_zbasic->leftStr(_metapuzzleSecretGoal, _metapuzzleSecretCodeSpaceOffset - 1) == _metapuzzleSecretBuffer) {
@@ -323,7 +321,7 @@ void FoolGame::metapuzzleSecretCodeDrawText() {
void FoolGame::sub_138_9c4() {
// 138:09c4
- _zbasic->text(kFontLarge, 0x18, 0x19, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x19, Graphics::MacToolbox::kSrcBic);
Common::Rect temp;
temp.top = arr_i16_1eb8[0];
temp.left = arr_i16_1eb8[1];
@@ -349,7 +347,7 @@ void FoolGame::metapuzzleSecretCodeReset() {
temp.bottom = arr_i16_1eb8[2];
temp.right = arr_i16_1eb8[3];
_toolbox->FillRect(temp, _patterns[2]);
- _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
var_str_384 = _zbasic->str(OFF(15)); // if you know which is which, enter the letters you wish to switch
drawTextCenter(var_str_384, 0x140);
_metapuzzleSecretBuffer.clear(); // was: str(OFF(16))
@@ -387,7 +385,7 @@ void FoolGame::metapuzzleOnShift() {
return;
}
var_i16_200e = 0;
- while ((_event.modifiers & kModLShiftKeyDown) != 0) {
+ while ((_event.modifiers & Graphics::MacToolbox::kModLShiftKeyDown) != 0) {
getNextEvent(-1); // was: 0
if ((_event.where.x >= 0x6e) && (_event.where.y >= 0x1a) && (_event.where.x <= 0x1a8) && (_event.where.y <= SCREEN_HEIGHT)) {
// 138:0c04
@@ -426,7 +424,7 @@ void FoolGame::metapuzzleOnShift() {
var_str_384 = _zbasic->str(OFF(17)); // the book of thoth
}
// 138:0d9e
- _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcOr);
var_i16_30 = _toolbox->StringWidth(var_str_384);
_toolbox->MoveTo((_windowWidth / 2) - (var_i16_30 / 2), 0xf);
_toolbox->DrawString(var_str_384);
@@ -435,7 +433,7 @@ void FoolGame::metapuzzleOnShift() {
var_i16_200e = _selectedMenuChapter;
}
// 138:0dfc
- if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
if (_selectedMenuChapter != 0x51) {
setStateBits(kStateChapterSelect | kStateReturn);
return;
diff --git a/engines/fool/fool_polyomino.cpp b/engines/fool/fool_polyomino.cpp
index 8277efb7830..b129deaa989 100644
--- a/engines/fool/fool_polyomino.cpp
+++ b/engines/fool/fool_polyomino.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -88,7 +88,7 @@ void FoolGame::polyominoRun() {
}
// 133:0228
_toolbox->SetPort(var_i32_f24);
- _zbasic->text(kFontPuzzle, 0x18, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontPuzzle, 0x18, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// for each polyomino
for (int j = 1; j <= arr_i16_1eb8[0x10]; j++) {
@@ -160,9 +160,9 @@ void FoolGame::polyominoRun() {
// 133:0476: JSR - "PICTURE_ON"
// picture handle 0: XOR text + polyomino
PicHandle handle = _toolbox->OpenPicture(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
if (var_i16_103a >= 3) {
- _toolbox->TextMode(kSrcXor);
+ _toolbox->TextMode(Graphics::MacToolbox::kSrcXor);
for (int i = 1; i <= var_i16_103a; i += 3) {
_toolbox->MoveTo(arr_i16_3738[i], arr_i16_3738[i+1]);
var_str_384 = _zbasic->chr(arr_i16_3738[i+2]);
diff --git a/engines/fool/fool_prologue.cpp b/engines/fool/fool_prologue.cpp
index 652f32100c1..3dd09223da0 100644
--- a/engines/fool/fool_prologue.cpp
+++ b/engines/fool/fool_prologue.cpp
@@ -23,11 +23,11 @@
#include "common/str.h"
#include "common/str-enc.h"
#include "graphics/macgui/macwindow.h"
+#include "graphics/mactoolbox/toolbox.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
#include "fool/fool_prologue.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
#define OFF(x) (_zstrOffset[kOffsetPrologue] + (x))
@@ -41,15 +41,15 @@ namespace Fool {
// v3.0 - newer ZBasic, changed a few graphics assets, removed custom menu font and sounds for compatibility
void FoolPrologue::run(bool finale, const BitMap &prevWindow) {
- _toolbox = new Toolbox();
+ _toolbox = new Toolbox(&g_engine->_wm);
_zbasic = new ZBasic(_toolbox);
Common::MacFinderInfo finfo;
- if (_toolbox->GetFInfo(Common::U32String("Prologue - Finale"), 0, finfo) == kNoErr) {
+ if (_toolbox->GetFInfo(Common::U32String("Prologue - Finale"), 0, finfo) == Graphics::MacToolbox::kNoErr) {
_zbasic->loadProgram(Common::Path("Prologue - Finale", ':'));
- } else if (_toolbox->GetFInfo(Common::U32String("Prologue-Finale"), 0, finfo) == kNoErr) {
+ } else if (_toolbox->GetFInfo(Common::U32String("Prologue-Finale"), 0, finfo) == Graphics::MacToolbox::kNoErr) {
_zbasic->loadProgram(Common::Path("Prologue-Finale", ':'));
- } else if (_toolbox->GetFInfo(Common::U32String("Prologue & Finale"), 0, finfo) == kNoErr) {
+ } else if (_toolbox->GetFInfo(Common::U32String("Prologue & Finale"), 0, finfo) == Graphics::MacToolbox::kNoErr) {
_zbasic->loadProgram(Common::Path("Prologue & Finale", ':'));
} else {
error("FoolGame::run: Prologue - Finale program not found");
@@ -169,7 +169,7 @@ void FoolPrologue::setup(bool finale, const BitMap &prevWindow) {
void FoolPrologue::copyScreenToPage(int16 screenPage) {
// 128:01ba
_srcPage = _screenPages[screenPage];
- _toolbox->CopyBits(_dstPage, _srcPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_dstPage, _srcPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, nullptr);
}
void FoolPrologue::setPortBitsToPage(int16 screenPage) {
@@ -282,7 +282,7 @@ void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16
_tickMarker = _toolbox->TickCount();
srcRect.top = _randScanline[i];
srcRect.bottom = _randScanline[i] + 1;
- _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, Graphics::MacToolbox::kSrcCopy, nullptr);
if (i % updatePeriod == 0) {
delayFromMarker(0);
}
@@ -292,7 +292,7 @@ void FoolPrologue::scanlineBlitPageToScreen(int16 screenPage, int16 left, int16
void FoolPrologue::blitPageToScreen(int16 screenPage) {
// 128:0610
_srcPage = _screenPages[screenPage];
- _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, nullptr);
}
void FoolPrologue::scanlineTransition(int16 patternID) {
@@ -321,10 +321,10 @@ void FoolPrologue::zoomTransition(int16 screenPage) {
srcRect.left = (SCREEN_WIDTH/2) - i*5;
srcRect.bottom = (SCREEN_HEIGHT/2) + (int)(i*3.33);
srcRect.right = (SCREEN_WIDTH/2) + i*5;
- _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, srcRect, srcRect, Graphics::MacToolbox::kSrcCopy, nullptr);
_toolbox->Delay(0);
}
- _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, _pageRect, _pageRect, Graphics::MacToolbox::kSrcCopy, nullptr);
_toolbox->Delay(0);
}
@@ -341,7 +341,7 @@ void FoolPrologue::zoomFlash(int16 startTop, int16 startLeft, int16 startBottom,
end.bottom = endBottom;
end.right = endRight;
_toolbox->PenNormal();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
// 128:08bc
double buffer[16] = { 0 }; // arr_f64_41bbe
@@ -384,7 +384,7 @@ void FoolPrologue::drawText(const Common::U32String &str, int16 x, int16 y) {
void FoolPrologue::drawRainRecycle(int16 ticks) {
// 128:0a8c
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
do {
// 128:0a96
drawRainDrop();
@@ -432,14 +432,14 @@ void FoolPrologue::shuffleScanlines() {
void FoolPrologue::drawClickMessage() {
// 128:0de2
- _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcXor);
// Click Mouse to Continue
drawText(_zbasic->str(3), 5, 0x151);
}
void FoolPrologue::drawClickMessageRightAlign() {
// 128:0e1c
- _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcXor);
+ _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcXor);
// Click Mouse to Continue
drawTextRight(_zbasic->str(4), 0x1fb, 0x154);
}
@@ -450,14 +450,14 @@ void FoolPrologue::waitForClick() {
while (true) {
// was: 2
_toolbox->GetNextEvent(-1, _event);
- if (_event.what == kMouseDown)
+ if (_event.what == Graphics::MacToolbox::kMouseDown)
break;
- if ((_event.what == kScummVMQuitEvt) || (_event.what == kScummVMReturnToLauncherEvt)) {
+ if ((_event.what == Graphics::MacToolbox::kScummVMQuitEvt) || (_event.what == Graphics::MacToolbox::kScummVMReturnToLauncherEvt)) {
_quit = true;
return;
}
// wait until next redraw
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
}
waitForMouseUp();
@@ -467,23 +467,23 @@ void FoolPrologue::waitForMouseUp() {
// 128:0e80
while (true) {
_toolbox->GetNextEvent(-1, _event);
- if (_event.what == kUpdateEvt) {
+ if (_event.what == Graphics::MacToolbox::kUpdateEvt) {
onUpdateEvent();
}
- if (_event.what == kDiskEvt) {
+ if (_event.what == Graphics::MacToolbox::kDiskEvt) {
onDiskEvent();
}
- if (_event.what == kScummVMQuitEvt || _event.what == kScummVMReturnToLauncherEvt) {
+ if (_event.what == Graphics::MacToolbox::kScummVMQuitEvt || _event.what == Graphics::MacToolbox::kScummVMReturnToLauncherEvt) {
_quit = true;
return;
}
// keep looping until mouse is seen as up??
// see I-252
- if ((_event.modifiers & kModMouseButtonUp) && (_event.what == kNullEvent)) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) && (_event.what == Graphics::MacToolbox::kNullEvent)) {
break;
}
// wait until next redraw
- if (_event.what == kNullEvent)
+ if (_event.what == Graphics::MacToolbox::kNullEvent)
_toolbox->Delay(0);
}
}
@@ -608,7 +608,7 @@ void FoolPrologue::setupWindow() {
// 129:0386
fillRect(0x50, 0x6e, 0xd2, 0x192, 2);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
// "not enough memory" message
drawTextCenter(_zbasic->str(6), 0x100, 0x64);
drawTextCenter(_zbasic->str(7), 0x100, 0x78);
@@ -619,7 +619,7 @@ void FoolPrologue::setupWindow() {
if (_quit)
return;
- _zbasic->put(0x0, 0x14, _screenPages[0], kSrcCopy);
+ _zbasic->put(0x0, 0x14, _screenPages[0], Graphics::MacToolbox::kSrcCopy);
_mode = 0;
} else {
@@ -680,7 +680,7 @@ void FoolPrologue::setupWindow() {
fillRect(0x69, 0x87, 0xd7, 0x179, 1);
fillRect(0x6e, 0x8c, 0xd2, 0x174, 2);
// 129:0662
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
// "set your monitor to black and white" message"
drawTextCenter(_zbasic->str(13), 0x100, 0x82);
drawTextCenter(_zbasic->str(14), 0x100, 0x96);
@@ -693,7 +693,7 @@ void FoolPrologue::setupWindow() {
waitForClick();
if (_quit)
return;
- _zbasic->put(0x0, 0x14, _screenPages[0], kSrcCopy);
+ _zbasic->put(0x0, 0x14, _screenPages[0], Graphics::MacToolbox::kSrcCopy);
_mode = 0;
} else {
// 129:075c
@@ -741,7 +741,7 @@ void FoolPrologue::prologueRun() {
_toolbox->ReleaseResource(picTitle);
// 130:007a
- _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, kSrcBic);
+ _zbasic->text(kPrologueFontSmall, 0x9, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcBic);
if (_version == kFool30) {
drawTextCenter(_zbasic->str(OFF(0)), 0x103, 0x112);
} else {
@@ -869,28 +869,28 @@ void FoolPrologue::prologueRun() {
_tickMarker = _toolbox->TickCount();
_srcPage = _screenPages[8];
// 130:049e
- _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, Graphics::MacToolbox::kSrcCopy, nullptr);
drawRainRecycle(4);
for (int j = 0; j <= 3; j++) {
// 130:04ca
_tickMarker = _toolbox->TickCount();
_srcPage = _screenPages[3];
- _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, Graphics::MacToolbox::kSrcCopy, nullptr);
drawRainRecycle(5);
// 130:0518
_tickMarker = _toolbox->TickCount();
_srcPage = _screenPages[4];
- _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, Graphics::MacToolbox::kSrcCopy, nullptr);
drawRainRecycle(5);
_tickMarker = _toolbox->TickCount();
_srcPage = _screenPages[5];
- _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, Graphics::MacToolbox::kSrcCopy, nullptr);
drawRainRecycle(5);
}
// 130:05b6
_srcPage = _screenPages[7];
- _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, Graphics::MacToolbox::kSrcCopy, nullptr);
}
@@ -917,7 +917,7 @@ void FoolPrologue::prologueRun() {
scanline.top = _randScanline[y];
scanline.bottom = _randScanline[y] + 1;
// 130:068e
- _toolbox->CopyBits(_srcPage, _dstPage, scanline, scanline, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, scanline, scanline, Graphics::MacToolbox::kSrcCopy, nullptr);
}
// 130:06b0
drawRainRecycle(1);
@@ -959,7 +959,7 @@ void FoolPrologue::prologueRun() {
for (int i = 3; i <= 5; i++) {
_tickMarker = _toolbox->TickCount();
_srcPage = _screenPages[i];
- _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, kSrcCopy, nullptr);
+ _toolbox->CopyBits(_srcPage, _dstPage, temp2, temp2, Graphics::MacToolbox::kSrcCopy, nullptr);
drawRainRecycle(3);
}
}
@@ -1073,7 +1073,7 @@ void FoolPrologue::prologueRun() {
// 130:0b98
int16 pageIndex = 0;
int16 increment = 1;
- while (_event.what != kMouseDown) {
+ while (_event.what != Graphics::MacToolbox::kMouseDown) {
// 130:0ba4
_tickMarker = _toolbox->TickCount();
pageIndex += increment;
@@ -1089,7 +1089,7 @@ void FoolPrologue::prologueRun() {
// 130:0bee
_toolbox->GetNextEvent(2, _event);
}
- while (!((_event.what == kNullEvent) && (_event.modifiers & kModMouseButtonUp))) {
+ while (!((_event.what == Graphics::MacToolbox::kNullEvent) && (_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp))) {
// 130:0c0c
_tickMarker = _toolbox->TickCount();
pageIndex += increment;
@@ -1104,10 +1104,10 @@ void FoolPrologue::prologueRun() {
delayFromMarker(0xa);
// 130:0c56
_toolbox->GetNextEvent(-1, _event);
- if (_event.what == kUpdateEvt) {
+ if (_event.what == Graphics::MacToolbox::kUpdateEvt) {
onUpdateEvent();
}
- if (_event.what == kDiskEvt) {
+ if (_event.what == Graphics::MacToolbox::kDiskEvt) {
onDiskEvent();
}
}
@@ -1128,7 +1128,7 @@ void FoolPrologue::prologueRun() {
// zoom to close
- zoomClose(1, kPatCopy);
+ zoomClose(1, Graphics::MacToolbox::kPatCopy);
// 130:0ce6
// JMP 1002
// _zbasic->pushOldCodeResource(0x82);
@@ -1149,7 +1149,7 @@ void FoolPrologue::prologueDrawLoadingMsg() {
return;
// 130:0d28
_toolbox->SetPort(_grafPtrMenu);
- _zbasic->text(0, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(0, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
// "loading prologue" message
Common::U32String msg = _zbasic->str(OFF(1));
msg += Common::U32String::format(" %d", _prologueLoading);
@@ -1167,7 +1167,7 @@ void FoolPrologue::prologueDrawLoadingMsg() {
void FoolPrologue::drawRain() {
// 130:0db0
_zbasic->unk_20();
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_rainIndex = 0x1;
while (_rainIndex <= 0xb5) {
// 130:0dc0
@@ -1213,7 +1213,7 @@ void FoolPrologue::prologueRenderNextText() {
}
}
// 130:0fc8
- _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kPrologueFontFool, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
drawText(text, xPos, yPos);
}
}
diff --git a/engines/fool/fool_prologue.h b/engines/fool/fool_prologue.h
index 4345f57c077..0bc39c7f105 100644
--- a/engines/fool/fool_prologue.h
+++ b/engines/fool/fool_prologue.h
@@ -25,10 +25,10 @@
#include "common/array.h"
#include "common/scummsys.h"
#include "common/str.h"
+#include "graphics/surface.h"
+#include "graphics/mactoolbox/toolbox.h"
#include "fool/fool.h"
-#include "fool/toolbox.h"
-#include "graphics/surface.h"
namespace Fool {
@@ -115,7 +115,7 @@ public:
private:
FoolVersion _version;
const int *_zstrOffset;
- Toolbox *_toolbox;
+ Graphics::MacToolbox::Toolbox *_toolbox;
ZBasic *_zbasic;
bool _quit = false;
diff --git a/engines/fool/fool_reveal.cpp b/engines/fool/fool_reveal.cpp
index d75d7b46d54..66cd2f6ba66 100644
--- a/engines/fool/fool_reveal.cpp
+++ b/engines/fool/fool_reveal.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -76,12 +76,12 @@ void FoolGame::revealRun() {
arr_i16_1eb8[17] = (0x1c2 / arr_i16_1eb8[15]);
arr_i16_1eb8[18] = 0x100 - ((arr_i16_1eb8[15] * arr_i16_1eb8[17]) / 2);
Common::U32String letters = puzzlesReadString().decode(Common::kMacRoman);
- zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x19);
- zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, kPatCopy, 0x19);
+ zoomRect(0xb4, 0xff, 0xb6, 0x101, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, Graphics::MacToolbox::kPatCopy, 0x19);
+ zoomRect(0x9a, 0xff, 0x9c, 0x101, 0x37, 0x13, 0xff, 0x1ee, 0, Graphics::MacToolbox::kPatCopy, 0x19);
// 134:02f0
arr_i16_1eb8[19] = _zbasic->decodeInt(_activePuzzleBuffer);
var_i16_1aba = arr_i16_1eb8[18];
- _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
for (var_i16_7be = 1; var_i16_7be <= arr_i16_1eb8[15]; var_i16_7be++) {
// play a random tone and draw each of the letter buttons in sequence
playTone(
@@ -129,7 +129,7 @@ void FoolGame::revealRun() {
while ((_stateFlags == 0) && (!_activePuzzleSolved)) {
// 134:0582
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
revealOnClick();
}
if (arr_i16_1eb8[20] == arr_i16_1eb8[19]) {
@@ -183,7 +183,7 @@ void FoolGame::revealSelectButton() {
_toolbox->InvertRoundRect(_screenGrid[var_i16_7be], 0x19, 0x19);
_toolbox->PenPat(_patterns[arr_i16_1eb8[21]]);
// fill the polygon
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_toolbox->PaintPoly(_revealPoly[arr_i16_3738[var_i16_7be]]);
_toolbox->PenNormal();
}
diff --git a/engines/fool/fool_sentence.cpp b/engines/fool/fool_sentence.cpp
index b339763a2c4..de8ee02632c 100644
--- a/engines/fool/fool_sentence.cpp
+++ b/engines/fool/fool_sentence.cpp
@@ -19,10 +19,9 @@
*
*/
-#include "fool/detection.h"
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -113,7 +112,7 @@ void FoolGame::sentenceRun() {
// 135:0520
do {
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
sentenceOnClick();
}
// 135:0538
@@ -191,18 +190,18 @@ void FoolGame::sentenceOnClick() {
if (buttonsRemaining) {
return;
}
- _zbasic->text(kFontChicago, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcBic);
drawTextCenter(_zbasic->str(OFF(4)), 0x124); // click mouse to reset puzzle
waitForMouseUp();
var_i16_1abc = 1;
- _stateFlags = kNullEvent;
+ _stateFlags = Graphics::MacToolbox::kNullEvent;
// 135:07a0
- while ((_event.modifiers & kModMouseButtonUp) && (_stateFlags == kNullEvent)) {
+ while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) && (_stateFlags == Graphics::MacToolbox::kNullEvent)) {
getNextEvent(-1);
}
// 135:07c8
- if (_stateFlags == kNullEvent) {
+ if (_stateFlags == Graphics::MacToolbox::kNullEvent) {
sentenceUndo();
}
}
@@ -267,7 +266,7 @@ void FoolGame::sentenceUndo() {
void FoolGame::sentenceDrawButton(int16 gridIndex) {
// 135:0a34
- _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcOr);
Common::U32String buf = Common::U32String::format("%d", gridIndex) + _zbasic->str(OFF(6)); // ' '
int16 width = _toolbox->StringWidth(buf);
_toolbox->FillOval(_screenGrid[gridIndex], _patterns[0]);
@@ -278,7 +277,7 @@ void FoolGame::sentenceDrawButton(int16 gridIndex) {
void FoolGame::sentenceDrawBuffer() {
// 135:0b16
- _zbasic->text(kFontLarge, 0x18, 0, kSrcOr);
+ _zbasic->text(kFontLarge, 0x18, 0, Graphics::MacToolbox::kSrcOr);
int16 width = _toolbox->StringWidth(_sentenceBuffer);
if (width < arr_i16_1eb8[4]) {
width = arr_i16_1eb8[4];
diff --git a/engines/fool/fool_straightpath.cpp b/engines/fool/fool_straightpath.cpp
index 3c698202cd4..07890e8674f 100644
--- a/engines/fool/fool_straightpath.cpp
+++ b/engines/fool/fool_straightpath.cpp
@@ -19,11 +19,9 @@
*
*/
-#include "graphics/managed_surface.h"
+#include "graphics/mactoolbox/toolbox.h"
-#include "fool/fool.h"
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -71,7 +69,7 @@ void FoolGame::straightPathRun() {
_straightPathGoal += _zbasic->indexRaw(1, i);
// 143:0276
}
- _zbasic->text(kFontPuzzle, arr_i16_1eb8[14], 0, kSrcOr);
+ _zbasic->text(kFontPuzzle, arr_i16_1eb8[14], 0, Graphics::MacToolbox::kSrcOr);
_zbasic->unk_20();
// 143:02b6
for (int16 j = 0; j <= arr_i16_1eb8[1]; j++) {
@@ -106,7 +104,7 @@ void FoolGame::straightPathRun() {
// 143:0500
while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
straightPathOnClick();
}
if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
@@ -186,7 +184,7 @@ void FoolGame::straightPathReset() {
void FoolGame::straightPathDrawText() {
// 143:0864
straightPathClearText();
- _zbasic->text(kFontLarge, 0x18, 0x18, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x18, Graphics::MacToolbox::kSrcBic);
drawTextCenter(_activePuzzleBuffer, 0x148);
}
@@ -197,7 +195,7 @@ void FoolGame::straightPathClearText() {
void FoolGame::straightPathSuccess() {
// 143:08b0
- _toolbox->PenMode(kPatBic);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatBic);
_toolbox->PenPat(_patterns[1]);
for (int16 j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
diff --git a/engines/fool/fool_sun.cpp b/engines/fool/fool_sun.cpp
index 1ea7fb9484c..3e2fd2fca17 100644
--- a/engines/fool/fool_sun.cpp
+++ b/engines/fool/fool_sun.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -32,7 +32,7 @@ namespace Fool {
void FoolGame::sunMapRun() {
// 137:0004
var_i16_c00 = 1;
- fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ fillRect(1, Graphics::MacToolbox::kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
arr_i16_1eb8[0] = 9;
arr_i16_1eb8[1] = 9;
arr_i16_1eb8[4] = 0x4b;
@@ -87,7 +87,7 @@ void FoolGame::sunMapRun() {
while (((_stateFlags & kStateReturn) == 0) && (!_activePuzzleSolved)) {
while ((_stateFlags == kStateNull) && (!_activePuzzleSolved)) {
getNextEvent(-1);
- if (_event.what == kMouseDown) {
+ if (_event.what == Graphics::MacToolbox::kMouseDown) {
sunMapOnClick();
}
}
@@ -137,7 +137,7 @@ void FoolGame::sunMapOnClick() {
_zbasic->menu(8, 3, 0, Common::U32String());
_toolbox->PenNormal();
_toolbox->PenSize(3, 3);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
arr_i16_4758[0] = var_i16_68a;
arr_i16_4758[1] = var_i16_68c;
if (_puzzleFlags[_sunMapTileID[arr_i16_2f38[var_i16_68a*32 + var_i16_68c]]] & kFlagMapTile) {
@@ -191,7 +191,7 @@ void FoolGame::sunMapDragSelect() {
delay(2);
_toolbox->FrameRect(Common::Rect(arr_i16_4758[12], arr_i16_4758[11], arr_i16_4758[14], arr_i16_4758[13]));
delay(1);
- } while (_event.what != kMouseUp);
+ } while (_event.what != Graphics::MacToolbox::kMouseUp);
// 137:087e
}
@@ -247,7 +247,7 @@ void FoolGame::sunMapMoveSelected() {
delay(2);
_toolbox->FrameRect(arr_rect_4776);
delay(1);
- } while (_event.what != kMouseDown);
+ } while (_event.what != Graphics::MacToolbox::kMouseDown);
}
void FoolGame::sunMapUndoMove() {
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 08b8877cdbd..269e2f6ae82 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -127,7 +127,7 @@ void FoolGame::highPriestessRun() {
var_i16_68a = 1;
for (int16 i = 1; i <= 0x155; i++) {
_zbasic->get(1, i, SCREEN_WIDTH, i + 1, arr_bmp_fa3c);
- _zbasic->put(_zbasic->rndInt(0x14) - 0xa, i, arr_bmp_fa3c, kSrcCopy);
+ _zbasic->put(_zbasic->rndInt(0x14) - 0xa, i, arr_bmp_fa3c, Graphics::MacToolbox::kSrcCopy);
if (i % 2 == 0) {
_toolbox->Delay(0);
}
@@ -159,7 +159,7 @@ void FoolGame::highPriestessRun() {
}
}
// 140:03f0
- _zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x10, Graphics::MacToolbox::kSrcBic);
drawTextCenter(_zbasic->str(OFF(3)), 0x96); // you cannot claim
drawTextCenter(_zbasic->str(OFF(4)), 0xb9); // the book of thoth
drawTextCenter(_zbasic->str(OFF(5)), 0xdc); // so easily
@@ -185,7 +185,7 @@ void FoolGame::thoth99Enchantments() {
arr_i16_1eb8[0] = 1;
}
if (arr_i16_1eb8[0] == 0x63) {
- _zbasic->text(kFontLarge, 0x18, 0x10, kSrcBic);
+ _zbasic->text(kFontLarge, 0x18, 0x10, Graphics::MacToolbox::kSrcBic);
drawTextCenter(_zbasic->str(OFF(7)), 0xaf); // you dare to challenge
drawTextCenter(_zbasic->str(OFF(8)), 0xd2); // the high priestess
delay(0xb4);
@@ -202,7 +202,7 @@ void FoolGame::thoth99Enchantments() {
copyScreen(0, arr_bmp_b3ec);
for (int16 i = 1; i <= arr_i16_1eb8[0]; i++) {
_toolbox->PenSize(5, 5);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
for (int16 j = 0; j <= 1; j++) {
_toolbox->MoveTo(0x104, 0xa2);
_toolbox->LineTo(_screenGrid[i].left + 0x14, _screenGrid[i].top + 0x14);
@@ -287,7 +287,7 @@ void FoolGame::thoth99Enchantments() {
}
do {
getNextEvent(-1);
- if ((_event.modifiers & kModMouseButtonUp) == 0) {
+ if ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
sub_140_c4c();
}
// 140:0934
@@ -327,7 +327,7 @@ void FoolGame::thothDrawEnchantment() {
_toolbox->PenNormal();
_toolbox->EraseRoundRect(_screenGrid[arr_i16_1eb8[2]], 0x14, 0x14);
_toolbox->FrameRoundRect(_screenGrid[arr_i16_1eb8[2]], 0x14, 0x14);
- _zbasic->text(kFontChicago, 0xc, 0, kSrcOr);
+ _zbasic->text(kFontChicago, 0xc, 0, Graphics::MacToolbox::kSrcOr);
Common::U32String label = Common::U32String::format(" %d ", arr_i16_1eb8[2]); // was: str(OFF(10))
int16 width = _toolbox->StringWidth(label);
// 140:0bd2
@@ -355,7 +355,7 @@ void FoolGame::sub_140_c4c() {
_screenGrid[var_i16_484].left,
_screenGrid[var_i16_484].bottom,
_screenGrid[var_i16_484].right,
- 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatXor, 0xd
+ 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, Graphics::MacToolbox::kPatXor, 0xd
);
arr_i16_1eb8[1] = 0;
sub_140_e3c();
@@ -453,7 +453,7 @@ void FoolGame::thothKey1st() {
}
// 140:1346
_toolbox->PenSize(5, 5);
- _toolbox->PenMode(kPatXor);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatXor);
_event.where = Common::Point(0, 0);
// 140:139a
while (!(
@@ -474,7 +474,7 @@ void FoolGame::thothKey1st() {
_toolbox->PenNormal();
if ((var_i16_7ce & 2) == 0) {
_stateFlags = kStateReturn;
- zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, kPatXor, 0x19);
+ zoomRect(0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 0xa2, 0xff, 0xac, 0x10e, 1, Graphics::MacToolbox::kPatXor, 0x19);
delay(0x3c);
_activePuzzleSolved = false;
} else {
@@ -642,11 +642,11 @@ void FoolGame::sub_140_15fc() {
// 140:173a
if (var_i16_103a < 4) {
var_i16_2330 = 2;
- var_i16_1dee = kPatXor;
+ var_i16_1dee = Graphics::MacToolbox::kPatXor;
} else {
// 140:1756
var_i16_2330 = 3;
- var_i16_1dee = kPatCopy;
+ var_i16_1dee = Graphics::MacToolbox::kPatCopy;
}
// 140:1762
zoomRect(
@@ -815,7 +815,7 @@ void FoolGame::thothKey3rdOnClick() {
var_i16_1de6 = 3;
}
// 140:1d26
- while ((_event.modifiers & kModMouseButtonUp) == 0) {
+ while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
// 140:1d2a
// was: 0
getNextEvent(-1);
@@ -838,7 +838,7 @@ void FoolGame::thothKey3rdOnClick() {
_toolbox->FillRect(area, _patterns[arr_i16_2f38[var_i16_1de6*32+ var_i16_103a]]);
// 140:1e2e
if ((area.left <= 0) && (area.top <= 0x14) && (area.right >= SCREEN_WIDTH) && (area.bottom >= SCREEN_HEIGHT)) {
- _event.modifiers = kModMouseButtonUp;
+ _event.modifiers = Graphics::MacToolbox::kModMouseButtonUp;
}
// 140:1eae
}
@@ -943,7 +943,7 @@ void FoolGame::thothKeyLast() {
void FoolGame::thothKeyLastOnClick() {
// 140:22b8
- while (((_event.modifiers & kModMouseButtonUp) == 0) && (var_i16_1de6 != (arr_i16_3b38[0x20 + _hermitPathStage] + 1))) {
+ while (((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) && (var_i16_1de6 != (arr_i16_3b38[0x20 + _hermitPathStage] + 1))) {
// 140:22bc
getNextEvent(-1); // was: 0
getGridFromMouse(var_i16_68a, var_i16_68c);
@@ -977,7 +977,7 @@ void FoolGame::thothKeyLastOnClick() {
void FoolGame::thothBadSelect() {
// 140:24ae
playTone(0x14, 0x64, 0x0);
- while ((_event.modifiers & kModMouseButtonUp) == 0) {
+ while ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0) {
// 140:24c4
getNextEvent(-1);
var_i16_484 = _zbasic->rndInt(0x50);
@@ -1078,7 +1078,7 @@ void FoolGame::hermitScreenBehold() {
_activePuzzleSolved = true;
} else {
// 140:290c
- zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, kPatCopy, 0x21);
+ zoomRect(0x14, 0xc8, 0x14, 0x138, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2, Graphics::MacToolbox::kPatCopy, 0x21);
// behold the last key of thoth
showBehold(0x48, 2, _zbasic->str(OFF(22)));
}
diff --git a/engines/fool/fool_threeships.cpp b/engines/fool/fool_threeships.cpp
index 339ce0ecfd1..98566585e42 100644
--- a/engines/fool/fool_threeships.cpp
+++ b/engines/fool/fool_threeships.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -45,7 +45,7 @@ void FoolGame::shipsRun() {
var_i16_d08 = _zbasic->rndInt(5) + 5;
var_i16_d0a = _zbasic->rndInt(5) - 0xa;
for (int16 i = 0; i <= 5; i++) {
- _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
_toolbox->OffsetRect(arr_rect_1910c, var_i16_d08, var_i16_d0a);
sub_128_5a6c();
}
@@ -76,7 +76,7 @@ void FoolGame::shipsRun() {
if (_activePuzzleSolved) {
waitForMouseUp();
playTone(0x14, 0x64, 0);
- _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
_event.where.x += 5;
_event.where.y -= 5;
if (_activePuzzleStatus < 0x64) {
@@ -119,7 +119,7 @@ void FoolGame::shipsRun() {
SCREEN_HEIGHT,
SCREEN_WIDTH,
2,
- kPatCopy,
+ Graphics::MacToolbox::kPatCopy,
0x42
);
// behold the 1st key of thoth
@@ -161,7 +161,7 @@ void FoolGame::sub_128_55ac() {
}
// 128:56a0
for (var_i16_68a = 0; var_i16_68a <= 0x5; var_i16_68a++) {
- _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
_toolbox->OffsetRect(arr_rect_1910c, var_i16_d08, var_i16_d0a);
sub_128_5a6c();
}
@@ -178,7 +178,7 @@ void FoolGame::sub_128_57a2() {
var_str_d12 = _zbasic->ucase(_zbasic->chr(_keyLastPressed));
if (_zbasic->instr(1, _zbasic->str(OFF(2)), var_str_d12) > 0) { // NESW
// 128:57e0
- _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, kSrcCopy);
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_bbbc, Graphics::MacToolbox::kSrcCopy);
var_i16_d08 = 0;
var_i16_d0a = 0;
if (var_str_d12 == _zbasic->str(OFF(3))) { // N
@@ -238,7 +238,7 @@ void FoolGame::sub_128_5a6c() {
//Common::fill(fakePal+3, fakePal+768, 0x00);
//arr_bmp_bbbc->rawSurface().debugPrint(5, 0, 0,0, 0, -1, 160, fakePal);
_toolbox->EraseRoundRect(arr_rect_1910c, 8, 7);
- _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_b3ec, kSrcXor);
+ _zbasic->put(arr_rect_1910c.left, arr_rect_1910c.top, arr_bmp_b3ec, Graphics::MacToolbox::kSrcXor);
delayFromMarker(0);
}
diff --git a/engines/fool/fool_wordsearch.cpp b/engines/fool/fool_wordsearch.cpp
index 4f1b8709479..5ca92f72f97 100644
--- a/engines/fool/fool_wordsearch.cpp
+++ b/engines/fool/fool_wordsearch.cpp
@@ -19,10 +19,9 @@
*
*/
-#include "fool/detection.h"
-#include "fool/fool.h"
+#include "graphics/mactoolbox/toolbox.h"
+
#include "fool/fool_game.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -142,9 +141,9 @@ void FoolGame::wordSearchRun() {
_toolbox->PenNormal();
var_str_384 = var_str_188e;
wordSearchDrawFooter();
- _zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], Graphics::kMacFontRegular, kSrcOr);
+ _zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], Graphics::kMacFontRegular, Graphics::MacToolbox::kSrcOr);
_toolbox->PenPat(_patterns[1]);
- _toolbox->PenMode(kPatBic);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatBic);
_zbasic->unk_20();
// 131:04e0
for (int j = 1; j <= arr_i16_1eb8[1]; j++) {
@@ -281,7 +280,7 @@ void FoolGame::wordSearchOnClick() {
// found a word, update the screen
_toolbox->PenNormal();
_toolbox->PenPat(_patterns[1]);
- _toolbox->PenMode(kPatBic);
+ _toolbox->PenMode(Graphics::MacToolbox::kPatBic);
// for every letter in the word
for (int i = 1; i <= var_i16_1a94; i++) {
// play a tone
@@ -329,7 +328,7 @@ void FoolGame::wordSearchBadSelect() {
void FoolGame::wordSearchDrawFooter() {
// 131:0d22
fillRect(0x13b, 0, SCREEN_HEIGHT, SCREEN_WIDTH, 2);
- _zbasic->text(kFontFool, 0xc, 0, kSrcBic);
+ _zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcBic);
drawTextCenter(var_str_384, 0x152);
}
@@ -375,8 +374,8 @@ void FoolGame::wordSearchSuccess() {
_activePuzzleStatus = 0x64;
}
// 131:0f52
- fillRect(1, kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
- _zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], 0, kSrcOr);
+ fillRect(1, Graphics::MacToolbox::kPatOr, 0x14, 0, SCREEN_HEIGHT, SCREEN_WIDTH);
+ _zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], 0, Graphics::MacToolbox::kSrcOr);
for (int j = 1; j <= arr_i16_1eb8[1]; j++) {
for (int i = 1; i <= arr_i16_1eb8[0]; i++) {
if (arr_i16_2f38[i*32 + j] != 0) {
diff --git a/engines/fool/module.mk b/engines/fool/module.mk
index c49571cb576..f46664662be 100644
--- a/engines/fool/module.mk
+++ b/engines/fool/module.mk
@@ -1,7 +1,6 @@
MODULE := engines/fool
MODULE_OBJS = \
- siphash/halfsip.o \
fool.o \
fool_cards.o \
fool_death.o \
@@ -23,18 +22,9 @@ MODULE_OBJS = \
fool_thoth.o \
fool_threeships.o \
fool_wordsearch.o \
- toolbox.o \
- toolbox_fileman.o \
- toolbox_menu.o \
- toolbox_quickdraw.o \
- toolbox_pict.o \
- toolbox_resman.o \
- toolbox_sound.o \
- toolbox_text.o \
zbasic.o \
messages.o \
- metaengine.o \
- utils.o
+ metaengine.o
# This module can be built as a plugin
ifeq ($(ENABLE_FOOL), DYNAMIC_PLUGIN)
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 819b6f126eb..796fd88a221 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -27,11 +27,9 @@
#include "common/stream.h"
#include "common/tokenizer.h"
#include "common/ustr.h"
-#include "graphics/managed_surface.h"
#include "fool/fool.h"
#include "fool/detection.h"
-#include "fool/toolbox.h"
#include "fool/zbasic.h"
namespace Fool {
@@ -40,14 +38,14 @@ void menuCommandsCallback(int action, Common::String &text, void *data) {
// unused
}
-ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
+ZBasic::ZBasic(Graphics::MacToolbox::Toolbox *toolbox) : _toolbox(toolbox) {
_memPool = new Common::MemoryPool(sizeof(int));
_window = g_engine->_wm.addWindow(false, false, false);
_window->disableBorder();
_window->resize(SCREEN_WIDTH, SCREEN_HEIGHT);
_toolbox->_defaultWindow = _window;
- _toolbox->_defaultBits = BitMap(new Graphics::ManagedSurface());
+ _toolbox->_defaultBits = Graphics::MacToolbox::BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultBits->copyFrom(*_window->getWindowSurface());
_window->setSurface(_toolbox->_defaultBits.get(), DisposeAfterUse::NO);
@@ -58,7 +56,7 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_menu->setCommandsCallback(menuCommandsCallback, nullptr);
_toolbox->_defaultMenu = _menu;
- _toolbox->_defaultMenuBits = BitMap(new Graphics::ManagedSurface());
+ _toolbox->_defaultMenuBits = Graphics::MacToolbox::BitMap(new Graphics::ManagedSurface());
_toolbox->_defaultMenuBits->copyFrom(*_menu->getWindowSurface());
_menu->setSurface(_toolbox->_defaultMenuBits.get(), DisposeAfterUse::NO);
} else {
@@ -67,7 +65,7 @@ ZBasic::ZBasic(Toolbox *toolbox) : _toolbox(toolbox) {
_toolbox->_defaultMenu = _menu;
// we don't get the surface for directly manipulating the menu, but so far we don't need it
}
- _defaultPort = new GrafPort;
+ _defaultPort = new Graphics::MacToolbox::GrafPort;
_toolbox->OpenPort(_defaultPort);
_toolbox->SetPort(_defaultPort);
@@ -78,7 +76,7 @@ ZBasic::~ZBasic() {
_window = nullptr;
_toolbox->_defaultWindow = nullptr;
- GrafPtr test;
+ Graphics::MacToolbox::GrafPtr test;
_toolbox->GetPort(test);
if (test == _defaultPort) {
_toolbox->SetPort(nullptr);
@@ -96,7 +94,7 @@ void ZBasic::loadProgram(const Common::Path &path) {
warning("ZBasic::loadProgram: unable to open %s", path.toString(':').c_str());
return;
}
- Handle scotRes = _toolbox->GetResource(MKTAG('S', 'C', 'O', 'T'), 1);
+ Graphics::MacToolbox::Handle scotRes = _toolbox->GetResource(MKTAG('S', 'C', 'O', 'T'), 1);
if (!scotRes) {
warning("ZBasic::loadProgram: could not find SCOT chunk");
return;
@@ -250,8 +248,8 @@ void ZBasic::defOpen(const Common::U32String &str) {
_fileCreator = str.substr(4, 4).encode(Common::kMacRoman);
}
-void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims) {
- GrafPtr port;
+void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::BitMap &dest, bool preserveDims) {
+ Graphics::MacToolbox::GrafPtr port;
_toolbox->GetPort(port);
Common::Rect srcRect(x1, y1, x2, y2);
Common::Rect dstRect(srcRect.width(), srcRect.height());
@@ -266,7 +264,7 @@ void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool pres
} else {
dest->create(dstRect.width(), dstRect.height());
}
- _toolbox->CopyBits(port->portBits, dest, srcRect, dstRect, kSrcCopy, nullptr);
+ _toolbox->CopyBits(port->portBits, dest, srcRect, dstRect, Graphics::MacToolbox::kSrcCopy, nullptr);
}
int16 ZBasic::instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2) {
@@ -306,7 +304,7 @@ uint32 ZBasic::mem(int16 index) {
void ZBasic::menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title) {
debugC(5, kDebugLoading, "ZBasic::menu: menuNo %d, itemNo %d, state %d, title \"%s\"", menuNo, itemNo, state, title.encode().c_str());
- MenuHandle handle = _toolbox->GetMHandle(menuNo);
+ Graphics::MacToolbox::MenuHandle handle = _toolbox->GetMHandle(menuNo);
if (!handle) {
handle = _toolbox->NewMenu(menuNo, Common::U32String());
}
@@ -447,7 +445,7 @@ void ZBasic::openW(int16 fileNo, const Common::U32String &fileName, uint32 lineS
_fileLineSize[fileNo] = lineSize;
}
-void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
+void ZBasic::picture(int16 x, int16 y, Graphics::MacToolbox::PicHandle &src) {
if (!src) {
warning("ZBasic::picture: Empty handle");
return;
@@ -466,18 +464,18 @@ void ZBasic::picture(int16 x, int16 y, PicHandle &src) {
//warning("did something stupid");
}
-void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src) {
+void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::PicHandle &src) {
warning("STUB: ZBasic::picture");
}
-void ZBasic::put(int16 x, int16 y, BitMap &src, SourceMode mode) {
+void ZBasic::put(int16 x, int16 y, Graphics::MacToolbox::BitMap &src, Graphics::MacToolbox::SourceMode mode) {
put(x, y, x+src->w, y+src->h, src, mode);
}
-void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, SourceMode mode) {
+void ZBasic::put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::BitMap &src, Graphics::MacToolbox::SourceMode mode) {
debugC(8, kDebugGraphics, "ZBasic::put: %p -> (%d, %d) (%d, %d)", (void *)src.get(), x1, y1, x2, y2);
Common::Rect destRect(x1, y1, x2, y2);
- GrafPtr port;
+ Graphics::MacToolbox::GrafPtr port;
_toolbox->GetPort(port);
_toolbox->CopyBits(src, port->portBits, src->getBounds(), destRect, mode, nullptr);
}
@@ -526,11 +524,11 @@ Common::U32String ZBasic::readDataStr() {
return result;
}
-Handle ZBasic::readFile(int16 fileNo, uint32 length) {
+Graphics::MacToolbox::Handle ZBasic::readFile(int16 fileNo, uint32 length) {
if (!_fileStreams.contains(fileNo)) {
error("ZBasic::readFile: unknown fileNo %d", fileNo);
}
- Handle result(new Common::Array<byte>());
+ Graphics::MacToolbox::Handle result(new Common::Array<byte>());
result->resize(length);
uint32 newLen = _fileStreams[fileNo]->read(result->data(), length);
if (newLen != length) {
@@ -645,7 +643,7 @@ void ZBasic::swapStr(Common::U32String &a, Common::U32String &b) {
}
-void ZBasic::text(uint16 font, uint16 size, uint16 face, SourceMode mode) {
+void ZBasic::text(uint16 font, uint16 size, uint16 face, Graphics::MacToolbox::SourceMode mode) {
_toolbox->TextFont(font);
_toolbox->TextSize(size);
_toolbox->TextFace(face);
@@ -675,7 +673,7 @@ void ZBasic::sound(int16 frequency, int32 duration, int16 volume, int16 voice) {
// to program the 4-tone synthesizer.
// Without this, out of the box ZBasic seems to use
// square wave output.
- SWSynthRec record;
+ Graphics::MacToolbox::SWSynthRec record;
if (frequency == 0)
return;
record.triplets.push_back({ (uint16)(783360/frequency), MIN(MAX((uint16)volume, (uint16)0), (uint16)255), (uint16)(duration*60/1000) });
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index 2bb5310820c..ccf6ffd31ac 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -28,8 +28,7 @@
#include "common/stream.h"
#include "common/ustr.h"
#include "graphics/macgui/macwindow.h"
-
-#include "fool/toolbox.h"
+#include "graphics/mactoolbox/toolbox.h"
namespace Fool {
@@ -207,13 +206,13 @@ private:
uint32 _dataPtr;
Common::Array<Common::SharedPtr<ZBasicDatum>> _stringTable;
- Toolbox *_toolbox;
+ Graphics::MacToolbox::Toolbox *_toolbox;
Common::MemoryPool *_memPool;
int16 _fileId = -1;
Graphics::MacWindow *_window;
Graphics::MacMenu *_menu;
- GrafPtr _defaultPort;
+ Graphics::MacToolbox::GrafPtr _defaultPort;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableWriteStream>> _fileWriteStreams;
@@ -225,7 +224,7 @@ private:
public:
- ZBasic(Toolbox *toolbox);
+ ZBasic(Graphics::MacToolbox::Toolbox *toolbox);
~ZBasic();
void loadProgram(const Common::Path &path);
@@ -241,11 +240,11 @@ public:
void close(int16 fileNo);
void coordinateWindow();
void defOpen(const Common::U32String &str);
- void get(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &dest, bool preserveDims = false);
+ void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::BitMap &dest, bool preserveDims = false);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
int16 instr(int16 expression, const Common::String &string1, const Common::String &string2);
Common::U32String files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume);
- int finderInfo(int16 &count, Common::U32String &var, OSType &type, uint16 volume);
+ int finderInfo(int16 &count, Common::U32String &var, Graphics::MacToolbox::OSType &type, uint16 volume);
bool maybe();
uint32 mem(int16 index);
void menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32String &title);
@@ -259,14 +258,14 @@ public:
void midStrSet(Common::String &target, int16 expr1, int16 expr2, const Common::String &src);
void openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
void openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo);
- void picture(int16 x, int16 y, PicHandle &src);
- void picture(int16 x1, int16 y1, int16 x2, int16 y2, PicHandle &src);
- void put(int16 x, int16 y, BitMap &src, SourceMode mode);
- void put(int16 x1, int16 y1, int16 x2, int16 y2, BitMap &src, SourceMode mode);
+ void picture(int16 x, int16 y, Graphics::MacToolbox::PicHandle &src);
+ void picture(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::PicHandle &src);
+ void put(int16 x, int16 y, Graphics::MacToolbox::BitMap &src, Graphics::MacToolbox::SourceMode mode);
+ void put(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::BitMap &src, Graphics::MacToolbox::SourceMode mode);
int16 readDataInt();
int32 readDataDblInt();
Common::U32String readDataStr();
- Handle readFile(int16 fileNo, uint32 length);
+ Graphics::MacToolbox::Handle readFile(int16 fileNo, uint32 length);
uint32 readFile(int16 fileNo, byte *dest, uint32 length);
int32 readFileDblInt(int16 fileNo);
int16 readFileInt(int16 fileNo);
@@ -277,7 +276,7 @@ public:
Common::U32String space(int16 count);
void swapInt(int16 &a, int16 &b);
void swapStr(Common::U32String &a, Common::U32String &b);
- void text(uint16 font, uint16 size, uint16 face, SourceMode mode);
+ void text(uint16 font, uint16 size, uint16 face, Graphics::MacToolbox::SourceMode mode);
void window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
void writeFileStr(int16 fileNo, const Common::String &str);
void writeFileInt(int16 fileNo, int16 data);
diff --git a/engines/fool/siphash/LICENSE_CC0 b/graphics/mactoolbox/siphash/LICENSE_CC0
similarity index 100%
rename from engines/fool/siphash/LICENSE_CC0
rename to graphics/mactoolbox/siphash/LICENSE_CC0
diff --git a/engines/fool/siphash/halfsip.cpp b/graphics/mactoolbox/siphash/halfsip.cpp
similarity index 97%
rename from engines/fool/siphash/halfsip.cpp
rename to graphics/mactoolbox/siphash/halfsip.cpp
index 879038ec398..8ca870d1168 100644
--- a/engines/fool/siphash/halfsip.cpp
+++ b/graphics/mactoolbox/siphash/halfsip.cpp
@@ -14,7 +14,7 @@
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include "common/system.h"
-#include "fool/siphash/halfsip.h"
+#include "graphics/mactoolbox/siphash/halfsip.h"
/* default: SipHash-2-4 */
#ifndef cROUNDS
@@ -69,7 +69,8 @@
#define TRACE
#endif
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
/*
Computes a SipHash value
@@ -165,4 +166,5 @@ int halfsiphash(const void *in, const size_t inlen, const void *k, uint8_t *out,
return 0;
}
-} // namespace Fool
+} // namespace MacToolbox
+} // namespace Graphics
diff --git a/engines/fool/siphash/halfsip.h b/graphics/mactoolbox/siphash/halfsip.h
similarity index 83%
rename from engines/fool/siphash/halfsip.h
rename to graphics/mactoolbox/siphash/halfsip.h
index a5b8f28f822..1317445509d 100644
--- a/engines/fool/siphash/halfsip.h
+++ b/graphics/mactoolbox/siphash/halfsip.h
@@ -15,13 +15,15 @@
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/
-#ifndef FOOL_SIPHASH_HALFSIP_H
-#define FOOL_SIPHASH_HALFSIP_H
+#ifndef GRAPHICS_MACTOOLBOX_SIPHASH_HALFSIP_H
+#define GRAPHICS_MACTOOLBOX_SIPHASH_HALFSIP_H
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
int halfsiphash(const void* in, const size_t inlen, const void* k, uint8_t* out, const size_t outlen);
-};
+}
+}
#endif // FOOL_SIPHASH_HALFSIP_H
diff --git a/engines/fool/toolbox.cpp b/graphics/mactoolbox/toolbox.cpp
similarity index 96%
rename from engines/fool/toolbox.cpp
rename to graphics/mactoolbox/toolbox.cpp
index 6136c10e6e9..db834647f94 100644
--- a/engines/fool/toolbox.cpp
+++ b/graphics/mactoolbox/toolbox.cpp
@@ -25,11 +25,10 @@
#include "common/events.h"
#include "common/system.h"
-#include "fool/detection.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
+#include "graphics/mactoolbox/toolbox.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
static const struct MacKeyCodeMapping {
Common::KeyCode scummvm;
@@ -161,7 +160,8 @@ static const struct MacKeyCodeMapping {
-Toolbox::Toolbox() {
+Toolbox::Toolbox(Graphics::MacWindowManager *wm) : _wm(wm) {
+ _fileModalCallback = nullptr;
_frameLimiter = new Graphics::FrameLimiter(g_system, 60, false);
for (const MacKeyCodeMapping *k = MackeyCodeMappings; k->scummvm != Common::KEYCODE_INVALID; k++) {
_keyMap[k->scummvm] = k->mac;
@@ -295,7 +295,7 @@ void Toolbox::_pumpEvents() {
}
void Toolbox::_updateScreen() {
- g_engine->_wm.draw();
+ _wm->draw();
_frameLimiter->delayBeforeSwap();
g_system->updateScreen();
_frameLimiter->startFrame();
@@ -309,8 +309,8 @@ uint32 Toolbox::Delay(uint32 numTicks) {
_updateScreen();
updateCount++;
} while (g_system->getMillis() < target);
- if (debugChannelSet(8, kDebugGraphics)) {
- debugC(8, kDebugGraphics, "Toolbox::Delay: %d screen updates in %d ticks", updateCount, numTicks);
+ if (debugChannelSet(8, kDebugLevelMacToolbox)) {
+ debugC(8, kDebugLevelMacToolbox, "Toolbox::Delay: %d screen updates in %d ticks", updateCount, numTicks);
}
return (uint32)(g_system->getMillis() * 60 / 1000);
}
@@ -358,4 +358,5 @@ uint32 Toolbox::TickCount() {
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox.h b/graphics/mactoolbox/toolbox.h
similarity index 98%
rename from engines/fool/toolbox.h
rename to graphics/mactoolbox/toolbox.h
index 79d77b80051..b627a3fbeb4 100644
--- a/engines/fool/toolbox.h
+++ b/graphics/mactoolbox/toolbox.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef FOOL_TOOLBOX_H
-#define FOOL_TOOLBOX_H
+#ifndef GRAPHICS_MACTOOLBOX_MACTOOLBOX_H
+#define GRAPHICS_MACTOOLBOX_MACTOOLBOX_H
#include "common/bitstream.h"
#include "common/hashmap.h"
@@ -31,19 +31,19 @@
#include "audio/mixer.h"
#include "graphics/cursor.h"
-#include "image/pict.h"
#include "graphics/framelimiter.h"
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindow.h"
#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/mactoolbox/siphash/halfsip.h"
-#include "fool/siphash/halfsip.h"
namespace Audio {
class PCSpeakerStream;
}
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
struct RGBColor {
uint16 red;
@@ -273,29 +273,31 @@ typedef Common::SharedPtr<Picture> PicHandle;
typedef uint32 ResType;
typedef size_t Size;
-};
+}; // namespace MacToolbox
+}; // namespace Graphics
template<>
-struct Common::Hash<Fool::Handle> {
- uint operator()(const Fool::Handle& h) const {
+struct Common::Hash<Graphics::MacToolbox::Handle> {
+ uint operator()(const Graphics::MacToolbox::Handle& h) const {
void *target = h.get();
uint result;
- Fool::halfsiphash((const void *)&target, sizeof(intptr_t), "TBHANDLE", (byte *)&result, sizeof(uint));
+ Graphics::MacToolbox::halfsiphash((const void *)&target, sizeof(intptr_t), "TBHANDLE", (byte *)&result, sizeof(uint));
return result;
}
};
template<>
-struct Common::Hash<Fool::PicHandle> {
- uint operator()(const Fool::PicHandle& h) const {
+struct Common::Hash<Graphics::MacToolbox::PicHandle> {
+ uint operator()(const Graphics::MacToolbox::PicHandle& h) const {
void *target = h.get();
uint result;
- Fool::halfsiphash((const void *)&target, sizeof(intptr_t), "TBHANDLE", (byte *)&result, sizeof(uint));
+ Graphics::MacToolbox::halfsiphash((const void *)&target, sizeof(intptr_t), "TBHANDLE", (byte *)&result, sizeof(uint));
return result;
}
};
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
// TYPE BOOLEAN: int16
// TYPE INTEGER: int16
@@ -562,11 +564,13 @@ struct SWSynthRec : SynthRec {
Common::Array<Tone> triplets;
};
+typedef Common::String (*FileModalCallback)(bool save, const Common::String &suggested, const Common::String &title);
+
class Toolbox {
public:
// Compatibility shim for the Macintosh Toolbox/QuickDraw API.
- Toolbox();
+ Toolbox(Graphics::MacWindowManager *wm);
~Toolbox();
Graphics::MacWindow *_defaultWindow;
@@ -1316,7 +1320,11 @@ public:
void _loadFonts(int16 resID);
+ void _setFileModalCallback(FileModalCallback callback) { _fileModalCallback = callback; }
+
private:
+ Graphics::MacWindowManager *_wm;
+
Common::HashMap<int16, Common::SharedPtr<Common::MacResManager>> _resMap;
Common::Array<int16> _resOrder;
int16 _nextResId = 1;
@@ -1337,6 +1345,8 @@ private:
GrafPtr _port = nullptr;
+ FileModalCallback _fileModalCallback;
+
void _pumpEvents();
void _updateScreen();
void _drawOval(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor);
@@ -1348,6 +1358,7 @@ private:
void _addDirtyRect(const BitMap &dest, const Common::Rect &rect);
};
-} // namespace Fool
+} // namespace MacToolbox
+} // namespace Graphics
#endif
diff --git a/engines/fool/toolbox_fileman.cpp b/graphics/mactoolbox/toolbox_fileman.cpp
similarity index 64%
rename from engines/fool/toolbox_fileman.cpp
rename to graphics/mactoolbox/toolbox_fileman.cpp
index f98c2c864f5..89b6dc6ad1a 100644
--- a/engines/fool/toolbox_fileman.cpp
+++ b/graphics/mactoolbox/toolbox_fileman.cpp
@@ -22,25 +22,10 @@
#include "common/system.h"
#include "common/savefile.h"
-#include "gui/filebrowser-dialog.h"
+#include "graphics/mactoolbox/toolbox.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
-
-namespace Fool {
-
-Common::String getFileNameFromModal(bool save, const Common::String &suggested, const Common::String &title) {
- Common::String prefix = g_engine->getGameId() + '-';
- Common::String mask = prefix + "*";
- GUI::FileBrowserDialog browser(title.c_str(), "fool", save ? GUI::kFBModeSave : GUI::kFBModeLoad, mask.c_str(), suggested.c_str());
- if (browser.runModal() <= 0) {
- return Common::String();
- }
- Common::String result = browser.getResult();
- if (!result.empty() && !result.hasPrefixIgnoreCase(prefix))
- result = prefix + result;
- return result;
-}
+namespace Graphics {
+namespace MacToolbox {
OSErr Toolbox::GetFInfo(const Common::U32String &fileName, int16 vRefNum, Common::MacFinderInfo &fndrInfo) {
Common::MacResManager resMan;
@@ -62,15 +47,25 @@ OSErr Toolbox::PBSetVol(ParamBlockRec ¶mBlock) {
}
void Toolbox::SFGetFile(const Common::Point &where, const Common::U32String &prompt, ProcPtr fileFilter, int16 numTypes, const SFTypeList &typeList, const ProcPtr &dlgHook, SFReply &reply) {
- Common::String fileName = getFileNameFromModal(false, Common::String(), prompt.encode());
- reply.fName = fileName;
- reply.good = !fileName.empty() ? 1 : 0;
+ if (_fileModalCallback) {
+ Common::String fileName = _fileModalCallback(false, Common::String(), prompt.encode());
+ reply.fName = fileName;
+ } else {
+ warning("Toolbox::SFGetFile: file modal callback not set");
+ reply.fName.clear();
+ }
+ reply.good = !reply.fName.empty() ? 1 : 0;
}
void Toolbox::SFPutFile(const Common::Point &where, const Common::U32String &prompt, const Common::U32String &origName, const ProcPtr &dlgHook, SFReply &reply) {
- Common::String fileName = getFileNameFromModal(true, origName.encode(), prompt.encode());
- reply.fName = fileName;
- reply.good = !fileName.empty() ? 1 : 0;
+ if (_fileModalCallback) {
+ reply.fName = _fileModalCallback(true, origName.encode(), prompt.encode());
+ } else {
+ warning("Toolbox::SFPutFile: file modal callback not set");
+ reply.fName.clear();
+ }
+ reply.good = !reply.fName.empty() ? 1 : 0;
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox_menu.cpp b/graphics/mactoolbox/toolbox_menu.cpp
similarity index 95%
rename from engines/fool/toolbox_menu.cpp
rename to graphics/mactoolbox/toolbox_menu.cpp
index c1398f41946..f4001168840 100644
--- a/engines/fool/toolbox_menu.cpp
+++ b/graphics/mactoolbox/toolbox_menu.cpp
@@ -22,10 +22,10 @@
#include "common/tokenizer.h"
#include "graphics/macgui/macmenu.h"
-#include "fool/detection.h"
-#include "fool/toolbox.h"
+#include "graphics/mactoolbox/toolbox.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
void Toolbox::AppendMenu(MenuHandle &theMenu, const Common::U32String &data) {
if (!theMenu) {
@@ -33,7 +33,7 @@ void Toolbox::AppendMenu(MenuHandle &theMenu, const Common::U32String &data) {
return;
}
- debugC(5, kDebugLoading, "Toolbox::AppendMenu: menuID %d, data \"%s\"", theMenu->menuID, data.encode().c_str());
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::AppendMenu: menuID %d, data \"%s\"", theMenu->menuID, data.encode().c_str());
if (_defaultMenu) {
Graphics::MacMenuSubMenu *sub = _defaultMenu->getSubmenu(nullptr, theMenu->menuID-1);
@@ -85,7 +85,7 @@ uint16 Toolbox::CountMItems(MenuHandle &theMenu) {
}
void Toolbox::DeleteMenu(uint16 menuID) {
- debugC(5, kDebugLoading, "Toolbox::DeleteMenu: menuID %d", menuID);
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::DeleteMenu: menuID %d", menuID);
if (_menu.contains(menuID)) {
_menu.erase(menuID);
}
@@ -272,4 +272,5 @@ void Toolbox::SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox_pict.cpp b/graphics/mactoolbox/toolbox_pict.cpp
similarity index 94%
rename from engines/fool/toolbox_pict.cpp
rename to graphics/mactoolbox/toolbox_pict.cpp
index 68ed5c1ec99..3913ff67e10 100644
--- a/engines/fool/toolbox_pict.cpp
+++ b/graphics/mactoolbox/toolbox_pict.cpp
@@ -26,18 +26,14 @@
#include "common/stream.h"
#include "common/system.h"
-#include "fool/detection.h"
-#include "graphics/cursor.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/managed_surface.h"
-#include "graphics/pixelformat.h"
-#include "image/pict.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
-#include "fool/utils.h"
+#include "graphics/mactoolbox/toolbox.h"
+#include "graphics/mactoolbox/utils.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
void Toolbox::ClosePicture() {
ShowPen();
@@ -59,15 +55,15 @@ void Toolbox::_drawBitsRect(Common::SeekableReadStream &stream, const Common::Re
Common::Rect dstRect = readRect(stream);
SourceMode mode = (SourceMode)stream.readUint16BE();
- pixMap.bounds.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: bounds");
- srcRect.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: srcRect");
- dstRect.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: dstRect");
- picFrame.debugPrintC(5, kDebugGraphics, "Toolbox::_drawPackBitsRect: picFrame");
+ pixMap.bounds.debugPrintC(5, kDebugLevelMacToolbox, "Toolbox::_drawPackBitsRect: bounds");
+ srcRect.debugPrintC(5, kDebugLevelMacToolbox, "Toolbox::_drawPackBitsRect: srcRect");
+ dstRect.debugPrintC(5, kDebugLevelMacToolbox, "Toolbox::_drawPackBitsRect: dstRect");
+ picFrame.debugPrintC(5, kDebugLevelMacToolbox, "Toolbox::_drawPackBitsRect: picFrame");
if (pixMap._isBitMap) {
BitMap result = readBitsRectMono(stream, pixMap, compressed);
- const BitMap intermediate(createRemappedSurface(result->surfacePtr(), nullptr, 0));
+ const BitMap intermediate(createRemappedSurface(_wm, result->surfacePtr(), nullptr, 0));
// source rect needs to be in bitmap coordinates
srcRect.translate(-pixMap.bounds.left, -pixMap.bounds.top);
@@ -107,10 +103,10 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
Common::MemoryReadStream stream(myPicture->picData.data(), myPicture->picData.size(), DisposeAfterUse::NO);
- dstRect.debugPrintC(5, kDebugGraphics, "Toolbox::DrawPicture: drawing at ");
+ dstRect.debugPrintC(5, kDebugLevelMacToolbox, "Toolbox::DrawPicture: drawing at ");
- if (debugChannelSet(8, kDebugGraphics)) {
- debugC(8, kDebugGraphics, "Toolbox::DrawPicture: image contents");
+ if (debugChannelSet(8, kDebugLevelMacToolbox)) {
+ debugC(8, kDebugLevelMacToolbox, "Toolbox::DrawPicture: image contents");
stream.hexdump(stream.size());
}
@@ -153,7 +149,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
else
op = stream.readByte();
- debugC(5, kDebugGraphics, "Toolbox::DrawPicture: [%04x] opcode %04x", (uint32_t)pos, op);
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::DrawPicture: [%04x] opcode %04x", (uint32_t)pos, op);
switch (op) {
case kOpNOP:
@@ -638,4 +634,5 @@ PicHandle Toolbox::OpenPicture(const Common::Rect &picFrame) {
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox_quickdraw.cpp b/graphics/mactoolbox/toolbox_quickdraw.cpp
similarity index 87%
rename from engines/fool/toolbox_quickdraw.cpp
rename to graphics/mactoolbox/toolbox_quickdraw.cpp
index c119c10f818..632507878a5 100644
--- a/engines/fool/toolbox_quickdraw.cpp
+++ b/graphics/mactoolbox/toolbox_quickdraw.cpp
@@ -27,13 +27,12 @@
#include "graphics/cursor.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/managed_surface.h"
-#include "image/pict.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
-#include "fool/utils.h"
+#include "graphics/mactoolbox/toolbox.h"
+#include "graphics/mactoolbox/utils.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
void Toolbox::BackPat(const Pattern &pat) {
if (_port) {
@@ -140,7 +139,7 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
clipDstRect.bottom += clipSrcRect.bottom - srcRect.bottom;
}
}
- Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(clipDstRect.left, clipDstRect.top), mode);
+ Common::Rect result = blitMono(subsrc, dstBits, mask, Common::Point(clipDstRect.left, clipDstRect.top), mode, _wm->_colorBlack, _wm->_colorWhite);
_addDirtyRect(dstBits, result);
}
@@ -229,7 +228,7 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
// Only use a different pen size in frame mode, otherwise small filled shapes appear wrong
Common::Point penSize = frame ? _port->pnSize : Common::Point(1, 1);
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, penSize, bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Graphics::Primitives &pm = _wm->getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
destRect.right -= penSize.x;
@@ -242,7 +241,7 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
//Common::fill(fakePal+3, fakePal+768, 0x00);
//mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode, _wm->_colorBlack, _wm->_colorWhite);
_addDirtyRect(_port->portBits, dstRect);
}
}
@@ -274,7 +273,7 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
destPos.y += _port->portRect.top;
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Graphics::Primitives &pm = _wm->getDrawPrimitives();
Common::Point origin(bbox.left, bbox.top);
@@ -290,21 +289,21 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
for (auto &it : poly->polyPoints) {
polyX.push_back(it.x - origin.x);
polyY.push_back(it.y - origin.y);
- debugC(5, kDebugGraphics, "Toolbox::_drawPoly: (%d, %d)", it.x - bbox.left, it.y - bbox.top);
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::_drawPoly: (%d, %d)", it.x - bbox.left, it.y - bbox.top);
}
pm.drawPolygonScan(polyX.data(), polyY.data(), poly->polyPoints.size(), destRect, fgColor, &pd);
}
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode, _wm->_colorBlack, _wm->_colorWhite);
- if (debugChannelSet(5, kDebugGraphics)) {
+ if (debugChannelSet(5, kDebugLevelMacToolbox)) {
//byte fakePal[768];
//Common::fill(fakePal, fakePal+3, 0xff);
//Common::fill(fakePal+3, fakePal+768, 0x00);
//mask->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 512, fakePal);
- debugC(5, kDebugGraphics, "Toolbox::_drawPoly: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::_drawPoly: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
_addDirtyRect(_port->portBits, dstRect);
@@ -334,7 +333,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
// Only use a different pen size in frame mode, otherwise small filled shapes appear wrong
Common::Point penSize = frame ? _port->pnSize : Common::Point(1, 1);
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, penSize, bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Graphics::Primitives &pm = _wm->getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
destRect.right -= penSize.x - 1;
@@ -345,10 +344,10 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
} else {
pm.drawFilledRect(destRect, fgColor, &pd);
}
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode, _wm->_colorBlack, _wm->_colorWhite);
- if (debugChannelSet(5, kDebugGraphics)) {
- debugC(5, kDebugGraphics, "Toolbox::_drawRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
+ if (debugChannelSet(5, kDebugLevelMacToolbox)) {
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::_drawRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor);
}
_addDirtyRect(_port->portBits, dstRect);
@@ -373,7 +372,7 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
// Only use a different pen size in frame mode, otherwise small filled shapes appear wrong
Common::Point penSize = frame ? _port->pnSize : Common::Point(1, 1);
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, penSize, bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Graphics::Primitives &pm = _wm->getDrawPrimitives();
// For thicker outlines, the shape should be adjusted inward
Common::Rect destRect = intermediate->getBounds();
destRect.right -= penSize.x - 1;
@@ -384,10 +383,10 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
}
pm.drawRoundRect(destRect, ovalHeight/2, fgColor, !frame, &pd);
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, mode, _wm->_colorBlack, _wm->_colorWhite);
- if (debugChannelSet(5, kDebugGraphics)) {
- debugC(5, kDebugGraphics, "Toolbox::_drawRoundRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x, ovalWidth %d, ovalHeight %d", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor, ovalWidth, ovalHeight);
+ if (debugChannelSet(5, kDebugLevelMacToolbox)) {
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::_drawRoundRect: dstRect (%d, %d) %dx%d, pattern %s, mode %d, frame %d, fgColor %08x, bkColor %08x, ovalWidth %d, ovalHeight %d", dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), pat.format().c_str(), mode, frame, fgColor, bkColor, ovalWidth, ovalHeight);
}
_addDirtyRect(_port->portBits, dstRect);
@@ -508,7 +507,7 @@ void Toolbox::GlobalToLocal(Common::Point &pt) {
void Toolbox::HideCursor() {
_cursorLevel--;
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
+ _wm->replaceCursor(Graphics::MacGUIConstants::kMacCursorOff);
}
void Toolbox::HidePen() {
@@ -519,7 +518,7 @@ void Toolbox::HidePen() {
void Toolbox::InitCursor() {
_cursorLevel = 0;
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ _wm->replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
if (_cursor) {
_cursor = nullptr;
}
@@ -539,7 +538,7 @@ void Toolbox::InvertOval(const Common::Rect &r) {
if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
- _drawOval(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ _drawOval(r, pat, kPatXor, false, _wm->_colorBlack, _wm->_colorWhite);
if (_port->picSave) {
_port->picSave->pushOpRect(kOpInvertOval, r);
}
@@ -550,7 +549,7 @@ void Toolbox::InvertPoly(const PolyHandle &poly) {
if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
- _drawPoly(poly, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ _drawPoly(poly, pat, kPatXor, false, _wm->_colorBlack, _wm->_colorWhite);
if (_port->picSave) {
_port->picSave->pushOpPoly(kOpInvertPoly, poly);
}
@@ -561,7 +560,7 @@ void Toolbox::InvertRect(const Common::Rect &r) {
if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
- _drawRect(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite);
+ _drawRect(r, pat, kPatXor, false, _wm->_colorBlack, _wm->_colorWhite);
if (_port->picSave) {
_port->picSave->pushOpRect(kOpInvertRect, r);
}
@@ -572,7 +571,7 @@ void Toolbox::InvertRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ov
if (_port) {
// set pattern to full black
Pattern pat({0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
- _drawRoundRect(r, pat, kPatXor, false, g_engine->_wm._colorBlack, g_engine->_wm._colorWhite, ovalWidth, ovalHeight);
+ _drawRoundRect(r, pat, kPatXor, false, _wm->_colorBlack, _wm->_colorWhite, ovalWidth, ovalHeight);
if (_port->picSave) {
_port->picSave->pushOpPoint(kOpOvSize, Common::Point(ovalWidth, ovalHeight));
_port->picSave->pushOpRect(kOpInvertRRect, r);
@@ -612,14 +611,14 @@ void Toolbox::LineTo(int16 h, int16 v) {
Graphics::MacPatterns macpat({_port->pnPat.data});
Graphics::MacPlotData pd(intermediate.get(), mask.get(), &macpat, 1, destPos.x, destPos.y, _port->pnSize, _port->bkColor);
- Graphics::Primitives &pm = g_engine->_wm.getDrawPrimitives();
+ Graphics::Primitives &pm = _wm->getDrawPrimitives();
pm.drawLine(startPos.x, startPos.y, endPos.x, endPos.y, _port->fgColor, &pd);
- Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode);
+ Common::Rect dstRect = blitMono(intermediate, _port->portBits, mask, destPos, _port->pnMode, _wm->_colorBlack, _wm->_colorWhite);
_addDirtyRect(_port->portBits, dstRect);
- if (debugChannelSet(5, kDebugGraphics)) {
- debugC(5, kDebugGraphics, "Toolbox::LineTo: startPos(%d, %d), endPos(%d, %d), dstRect (%d, %d) %dx%d, pattern %s, mode %d, fgColor %08x, bkColor %08x", _port->pnLoc.x, _port->pnLoc.y, h, v, dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), _port->pnPat.format().c_str(), _port->pnMode, _port->fgColor, _port->bkColor);
+ if (debugChannelSet(5, kDebugLevelMacToolbox)) {
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::LineTo: startPos(%d, %d), endPos(%d, %d), dstRect (%d, %d) %dx%d, pattern %s, mode %d, fgColor %08x, bkColor %08x", _port->pnLoc.x, _port->pnLoc.y, h, v, dstRect.left, dstRect.top, dstRect.width(), dstRect.height(), _port->pnPat.format().c_str(), _port->pnMode, _port->fgColor, _port->bkColor);
}
}
@@ -682,10 +681,10 @@ PolyHandle Toolbox::OpenPoly() {
void Toolbox::OpenPort(GrafPtr port) {
// source: QuickDraw Routines I-163
port->portBits = _defaultBits;
- port->portRect = Common::Rect(SCREEN_WIDTH, SCREEN_HEIGHT);
- port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) }));
- port->fgColor = g_engine->_wm._colorBlack;
- port->bkColor = g_engine->_wm._colorWhite;
+ port->portRect = Common::Rect(_wm->getWidth(), _wm->getHeight());
+ port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, _wm->getWidth(), _wm->getHeight() ) }));
+ port->fgColor = _wm->_colorBlack;
+ port->bkColor = _wm->_colorWhite;
_port = port;
//port->clipRgn
}
@@ -775,7 +774,7 @@ void Toolbox::PlotIcon(const Common::Rect &theRect, const Handle &theIcon) {
pm._isBitMap = true;
Common::MemoryReadStream stream(theIcon->data(), theIcon->size());
BitMap result = readBitsRectMono(stream, pm, false);
- const BitMap intermediate(createRemappedSurface(result->surfacePtr(), nullptr, 0));
+ const BitMap intermediate(createRemappedSurface(_wm, result->surfacePtr(), nullptr, 0));
CopyBits(intermediate, _port->portBits, result->getBounds(), theRect, kSrcCopy, nullptr);
}
}
@@ -798,7 +797,7 @@ void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
void Toolbox::SetCursor(const Common::SharedPtr<Cursor> &crsr) {
_cursor = crsr;
if (_cursorLevel == 0)
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, crsr.get());
+ _wm->replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, crsr.get());
}
void Toolbox::SetOrigin(int16 h, int16 v) {
@@ -833,9 +832,9 @@ void Toolbox::ShowCursor() {
_cursorLevel++;
if (_cursorLevel == 0) {
if (_cursor) {
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, _cursor.get());
+ _wm->replaceCursor(Graphics::MacGUIConstants::kMacCursorCustom, _cursor.get());
} else {
- g_engine->_wm.replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
+ _wm->replaceCursor(Graphics::MacGUIConstants::kMacCursorArrow);
}
}
}
@@ -847,4 +846,5 @@ void Toolbox::ShowPen() {
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox_resman.cpp b/graphics/mactoolbox/toolbox_resman.cpp
similarity index 95%
rename from engines/fool/toolbox_resman.cpp
rename to graphics/mactoolbox/toolbox_resman.cpp
index 906d8303228..104c8a10c10 100644
--- a/engines/fool/toolbox_resman.cpp
+++ b/graphics/mactoolbox/toolbox_resman.cpp
@@ -22,21 +22,21 @@
#include "common/memstream.h"
#include "common/system.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
+#include "graphics/mactoolbox/toolbox.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
void Toolbox::_injectFOND(int16 resID, const byte *data, const size_t size, const Common::String &name) {
if (_resMap.contains(resID)) {
Common::MemoryReadStream stream(data, size);
- g_engine->_wm._fontMan->loadMacFont(_resMap[resID].get(), name, &stream);
+ _wm->_fontMan->loadMacFont(_resMap[resID].get(), name, &stream);
}
}
void Toolbox::_loadFonts(int16 resID) {
if (_resMap.contains(resID)) {
- g_engine->_wm._fontMan->loadFonts(_resMap[resID].get());
+ _wm->_fontMan->loadFonts(_resMap[resID].get());
}
}
@@ -206,4 +206,5 @@ void Toolbox::UseResFile(int16 refNum) {
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox_sound.cpp b/graphics/mactoolbox/toolbox_sound.cpp
similarity index 91%
rename from engines/fool/toolbox_sound.cpp
rename to graphics/mactoolbox/toolbox_sound.cpp
index 59dd5332a05..58fefd9a26b 100644
--- a/engines/fool/toolbox_sound.cpp
+++ b/graphics/mactoolbox/toolbox_sound.cpp
@@ -21,15 +21,12 @@
#include "audio/audiostream.h"
#include "audio/softsynth/pcspk.h"
-#include "common/system.h"
-#include "common/savefile.h"
-#include "gui/filebrowser-dialog.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
+#include "graphics/mactoolbox/toolbox.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
// FIXME: This sound code is incredibly basic, only providing
// an interface for the square wave synthesiser.
@@ -74,4 +71,5 @@ int16 Toolbox::GetSoundVol() {
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/toolbox_text.cpp b/graphics/mactoolbox/toolbox_text.cpp
similarity index 82%
rename from engines/fool/toolbox_text.cpp
rename to graphics/mactoolbox/toolbox_text.cpp
index 1dea9394b4b..6eb7d1bd0f9 100644
--- a/engines/fool/toolbox_text.cpp
+++ b/graphics/mactoolbox/toolbox_text.cpp
@@ -24,11 +24,11 @@
#include "graphics/managed_surface.h"
#include "graphics/pixelformat.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
-#include "fool/utils.h"
+#include "graphics/mactoolbox/toolbox.h"
+#include "graphics/mactoolbox/utils.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
void Toolbox::DrawChar(Common::u32char_type_t ch) {
warning("STUB: Toolbox::DrawChar");
@@ -37,8 +37,8 @@ void Toolbox::DrawChar(Common::u32char_type_t ch) {
void Toolbox::DrawString(const Common::U32String &s) {
if (_port) {
Common::String macString = s.encode(Common::kMacRoman);
- debugC(5, kDebugGraphics, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
- Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::DrawString: (%d, %d) %s\n", _port->pnLoc.x, _port->pnLoc.y, s.encode().c_str());
+ Graphics::MacFontRun fontRun(_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
const Graphics::Font *font = fontRun.getFont();
Common::Rect bbox = font->getBoundingBox(macString);
BitMap buffer(new Graphics::ManagedSurface(bbox.width(), bbox.height(), Graphics::PixelFormat::createFormatCLUT8()));
@@ -57,7 +57,7 @@ void Toolbox::DrawString(const Common::U32String &s) {
destPos.x += _port->portRect.left;
destPos.y += _port->portRect.top;
- Common::Rect result = blitMono(buffer, _port->portBits, mask, destPos, _port->txMode);
+ Common::Rect result = blitMono(buffer, _port->portBits, mask, destPos, _port->txMode, _wm->_colorBlack, _wm->_colorWhite);
if (_port->portBits == _defaultBits) {
_defaultWindow->addDirtyRect(result);
_defaultWindow->setDirty(true);
@@ -78,9 +78,9 @@ void Toolbox::DrawString(const Common::U32String &s) {
uint16 Toolbox::StringWidth(const Common::U32String &s) {
if (_port) {
Common::String macString = s.encode(Common::kMacRoman);
- Graphics::MacFontRun fontRun(&g_engine->_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
+ Graphics::MacFontRun fontRun(_wm, _port->txFont, _port->txFace, _port->txSize, 0, 0, 0);
uint16 result = fontRun.getFont()->getStringWidth(macString);
- debugC(5, kDebugGraphics, "Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
+ debugC(5, kDebugLevelMacToolbox, "Toolbox::StringWidth: %s -> %d", s.encode().c_str(), result);
return result;
}
return 0;
@@ -110,4 +110,5 @@ void Toolbox::TextSize(uint16 size) {
}
}
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/utils.cpp b/graphics/mactoolbox/utils.cpp
similarity index 91%
rename from engines/fool/utils.cpp
rename to graphics/mactoolbox/utils.cpp
index 2bcaafd4dbc..ae6cab212c5 100644
--- a/engines/fool/utils.cpp
+++ b/graphics/mactoolbox/utils.cpp
@@ -20,11 +20,11 @@
*/
#include "common/memstream.h"
-#include "fool/fool.h"
-#include "fool/toolbox.h"
-#include "fool/utils.h"
+#include "graphics/mactoolbox/toolbox.h"
+#include "graphics/mactoolbox/utils.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
Common::Rect readRect(Common::SeekableReadStream &stream) {
Common::Rect result;
@@ -55,8 +55,8 @@ PolyHandle readPolygon(Common::SeekableReadStream &stream) {
Region readRegion(Common::SeekableReadStream &stream) {
Region region;
region.rgnSize = stream.readUint16BE();
- if (debugChannelSet(8, kDebugGraphics)) {
- debugC(8, kDebugGraphics, "readRegion: region data");
+ if (debugChannelSet(8, kDebugLevelMacToolbox)) {
+ debugC(8, kDebugLevelMacToolbox, "readRegion: region data");
stream.hexdump(region.rgnSize - 2);
}
if (stream.size() - stream.pos() < region.rgnSize - 2) {
@@ -175,15 +175,13 @@ BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool
}
return result;
}
-Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode) {
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode, uint32 black, uint32 white) {
Common::Rect dstRect = src->getBounds();
dstRect.moveTo(dstPos);
dstRect.clip(dst->getBounds());
Common::Rect srcRect = dstRect;
srcRect.translate(-dstPos.x, -dstPos.y);
- uint32 black = g_engine->_wm._colorBlack;
- uint32 white = g_engine->_wm._colorWhite;
if (mode == kSrcCopy && !mask) {
// fast blit
dst->simpleBlitFrom(*src, srcRect, Common::Point(srcRect.left + dstPos.x, srcRect.top + dstPos.y));
@@ -238,17 +236,17 @@ Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const
return dstRect;
}
-Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode) {
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode, uint32 black, uint32 white) {
if ((mode >= 8) && (mode < 16)) {
// If the mode is one of the source transfer modes (or negative), no drawing is performed.
// Source: Inside Macintosh I-170
- return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7));
+ return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7), black, white);
}
warning("blitMono: Called with an invalid PatternMode, ignoring");
return Common::Rect();
}
-Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount) {
+Graphics::ManagedSurface *createRemappedSurface(Graphics::MacWindowManager *wm, const Graphics::Surface *surface, const byte *palette, uint colorCount) {
Graphics::ManagedSurface *s = new Graphics::ManagedSurface();
s->create(surface->w, surface->h, Graphics::PixelFormat::createFormatCLUT8());
@@ -272,7 +270,7 @@ Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface
uint32 c;
- c = g_engine->_wm.findBestColor(r, g, b);
+ c = wm->findBestColor(r, g, b);
paletteMap[i] = c;
}
@@ -286,7 +284,7 @@ Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface
for (int x = 0; x < s->w; x++) {
uint color = surface->getPixel(x, y);
if (color > colorCount)
- color = g_engine->_wm._colorBlack;
+ color = wm->_colorBlack;
else
color = paletteMap[color];
@@ -302,4 +300,5 @@ Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
diff --git a/engines/fool/utils.h b/graphics/mactoolbox/utils.h
similarity index 72%
rename from engines/fool/utils.h
rename to graphics/mactoolbox/utils.h
index 3672071d112..7a91ffbc01d 100644
--- a/engines/fool/utils.h
+++ b/graphics/mactoolbox/utils.h
@@ -20,14 +20,15 @@
*
*/
-#ifndef FOOL_UTILS_H
-#define FOOL_UTILS_H
+#ifndef GRAPHICS_MACTOOLBOX_UTILS_H
+#define GRAPHICS_MACTOOLBOX_UTILS_H
#include "graphics/managed_surface.h"
-#include "fool/toolbox.h"
+#include "graphics/mactoolbox/toolbox.h"
-namespace Fool {
+namespace Graphics {
+namespace MacToolbox {
Common::Rect readRect(Common::SeekableReadStream &stream);
Common::Point readPoint(Common::SeekableReadStream &stream);
@@ -37,11 +38,12 @@ Pattern readPattern(Common::SeekableReadStream &stream);
PixMap readPixMap(Common::SeekableReadStream &stream, bool hasBaseAddr);
BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool compressed);
-Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode);
-Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode);
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, SourceMode mode, uint32 black, uint32 white);
+Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const Common::Point &dstPos, PatternMode mode, uint32 black, uint32 white);
-Graphics::ManagedSurface *createRemappedSurface(const Graphics::Surface *surface, const byte *palette, uint colorCount);
+Graphics::ManagedSurface *createRemappedSurface(Graphics::MacWindowManager *wm, const Graphics::Surface *surface, const byte *palette, uint colorCount);
-} // End of namespace Fool
+} // End of namespace MacToolbox
+} // End of namespace Graphics
-#endif // FOOL_UTILS_H
+#endif // GRAPHICS_MACTOOLBOX_UTILS_H
diff --git a/graphics/module.mk b/graphics/module.mk
index d96f720c89c..34e505fcf28 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -43,6 +43,16 @@ MODULE_OBJS := \
macgui/macwindow.o \
macgui/macwindowborder.o \
macgui/macwindowmanager.o \
+ mactoolbox/siphash/halfsip.o \
+ mactoolbox/toolbox_fileman.o \
+ mactoolbox/toolbox_menu.o \
+ mactoolbox/toolbox_pict.o \
+ mactoolbox/toolbox_quickdraw.o \
+ mactoolbox/toolbox_resman.o \
+ mactoolbox/toolbox_sound.o \
+ mactoolbox/toolbox_text.o \
+ mactoolbox/toolbox.o \
+ mactoolbox/utils.o \
managed_surface.o \
nine_patch.o \
opengl/context.o \
Commit: d9280f27f23a5b6d542d752c07eb520a2a5e1ac7
https://github.com/scummvm/scummvm/commit/d9280f27f23a5b6d542d752c07eb520a2a5e1ac7
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:35+02:00
Commit Message:
MACTOOLBOX: Replace warnings with debug messages
Changed paths:
graphics/macgui/macwindowmanager.cpp
graphics/mactoolbox/toolbox.cpp
graphics/mactoolbox/toolbox_fileman.cpp
graphics/mactoolbox/toolbox_menu.cpp
graphics/mactoolbox/toolbox_pict.cpp
graphics/mactoolbox/toolbox_quickdraw.cpp
graphics/mactoolbox/toolbox_sound.cpp
graphics/mactoolbox/toolbox_text.cpp
graphics/mactoolbox/utils.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 643121ec398..1279ac76de2 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -874,6 +874,7 @@ void MacDrawPrimitives<T>::drawPolygonScan(const int *polyX, const int *polyY, i
j = npoints - 1;
for (i = 0; i < npoints; i++) {
+ // this line has been changed so the alignment is on the left
if ((polyY[i] <= pixelY && polyY[j] > pixelY) || (polyY[j] <= pixelY && polyY[i] > pixelY)) {
nodeX[nodes++] = (int)(polyX[i] + (double)(pixelY - polyY[i]) / (double)(polyY[j]-polyY[i]) *
(double)(polyX[j] - polyX[i]) + 0.5);
diff --git a/graphics/mactoolbox/toolbox.cpp b/graphics/mactoolbox/toolbox.cpp
index db834647f94..957806ef626 100644
--- a/graphics/mactoolbox/toolbox.cpp
+++ b/graphics/mactoolbox/toolbox.cpp
@@ -336,7 +336,6 @@ void Toolbox::FlushEvents(uint32 eventMask, uint32 stopMask) {
}
bool Toolbox::GetNextEvent(uint32 eventMask, EventRecord &theEvent) {
- //warning("STUB: Toolbox::GetNextEvent");
_pumpEvents();
if (!_events.empty() && eventMask) {
for (auto it = _events.begin(); it != _events.end(); ++it) {
diff --git a/graphics/mactoolbox/toolbox_fileman.cpp b/graphics/mactoolbox/toolbox_fileman.cpp
index 89b6dc6ad1a..9bb0409341e 100644
--- a/graphics/mactoolbox/toolbox_fileman.cpp
+++ b/graphics/mactoolbox/toolbox_fileman.cpp
@@ -19,9 +19,6 @@
*
*/
-#include "common/system.h"
-#include "common/savefile.h"
-
#include "graphics/mactoolbox/toolbox.h"
namespace Graphics {
@@ -37,12 +34,12 @@ OSErr Toolbox::GetFInfo(const Common::U32String &fileName, int16 vRefNum, Common
}
OSErr Toolbox::PBGetVol(ParamBlockRec ¶mBlock) {
- warning("STUB: Toolbox::PBGetVol");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::PBGetVol");
return 0;
}
OSErr Toolbox::PBSetVol(ParamBlockRec ¶mBlock) {
- warning("STUB: Toolbox::PBSetVol");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::PBSetVol");
return 0;
}
@@ -51,7 +48,7 @@ void Toolbox::SFGetFile(const Common::Point &where, const Common::U32String &pro
Common::String fileName = _fileModalCallback(false, Common::String(), prompt.encode());
reply.fName = fileName;
} else {
- warning("Toolbox::SFGetFile: file modal callback not set");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::SFGetFile: file modal callback not set");
reply.fName.clear();
}
reply.good = !reply.fName.empty() ? 1 : 0;
@@ -61,7 +58,7 @@ void Toolbox::SFPutFile(const Common::Point &where, const Common::U32String &pro
if (_fileModalCallback) {
reply.fName = _fileModalCallback(true, origName.encode(), prompt.encode());
} else {
- warning("Toolbox::SFPutFile: file modal callback not set");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::SFPutFile: file modal callback not set");
reply.fName.clear();
}
reply.good = !reply.fName.empty() ? 1 : 0;
diff --git a/graphics/mactoolbox/toolbox_menu.cpp b/graphics/mactoolbox/toolbox_menu.cpp
index f4001168840..d51d8cbcf3f 100644
--- a/graphics/mactoolbox/toolbox_menu.cpp
+++ b/graphics/mactoolbox/toolbox_menu.cpp
@@ -38,7 +38,7 @@ void Toolbox::AppendMenu(MenuHandle &theMenu, const Common::U32String &data) {
if (_defaultMenu) {
Graphics::MacMenuSubMenu *sub = _defaultMenu->getSubmenu(nullptr, theMenu->menuID-1);
if (!sub) {
- warning("Toolbox::AppendMenu: menu ID %d not found, skipping", theMenu->menuID);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::AppendMenu: menu ID %d not found, skipping", theMenu->menuID);
return;
}
_defaultMenu->appendMenu(sub, data.encode(Common::kMacRoman), 0);
@@ -52,11 +52,11 @@ void Toolbox::AppendMenu(MenuHandle &theMenu, const Common::U32String &data) {
void Toolbox::CheckItem(MenuHandle &theMenu, uint16 item, bool checked) {
if (!theMenu) {
- warning("Toolbox::CheckItem: empty menu handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::CheckItem: empty menu handle");
return;
}
if (theMenu->menuData.size() < (uint)(item)) {
- warning("Toolbox::CheckItem: item %d out of range for menu %d", item, theMenu->menuID);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::CheckItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
if (_defaultMenu) {
@@ -98,11 +98,11 @@ void Toolbox::DeleteMenu(uint16 menuID) {
void Toolbox::DisableItem(MenuHandle &theMenu, uint16 item) {
if (!theMenu) {
- warning("Toolbox::DisableItem: empty menu handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DisableItem: empty menu handle");
return;
}
if (theMenu->menuData.size() < (uint)(item)) {
- warning("Toolbox::DisableItem: item %d out of range for menu %d", item, theMenu->menuID);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DisableItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
if (_defaultMenu) {
@@ -129,11 +129,11 @@ void Toolbox::DrawMenuBar() {
void Toolbox::EnableItem(MenuHandle &theMenu, uint16 item) {
if (!theMenu) {
- warning("Toolbox::EnableItem: empty menu handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::EnableItem: empty menu handle");
return;
}
if (theMenu->menuData.size() < (uint)(item)) {
- warning("Toolbox::EnableItem: item %d out of range for menu %d", item, theMenu->menuID);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::EnableItem: item %d out of range for menu %d", item, theMenu->menuID);
return;
}
if (_defaultMenu) {
@@ -174,7 +174,7 @@ void Toolbox::HiliteMenu(uint16 menuID) {
}
_defaultMenu->setDirty(true);
}
- warning("STUB: Toolbox::HiliteMenu %d", menuID);
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::HiliteMenu %d", menuID);
}
uint32 Toolbox::MenuKey(char ch) {
@@ -219,7 +219,7 @@ uint32 Toolbox::MenuSelect(const Common::Point &startPt) {
}
// we've eaten a ton of events, fix the mouseUp modifier
_modifiers |= kModMouseButtonUp;
- warning("Toolbox::MenuSelect: %08x", result);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::MenuSelect: %08x", result);
return result;
}
@@ -235,7 +235,7 @@ MenuHandle Toolbox::NewMenu(uint16 menuID, const Common::U32String &menuTitle) {
_defaultMenu->clearSubMenu(menuID-1);
Graphics::MacMenuItem *item = _defaultMenu->getMenuItem(menuID-1);
if (!item) {
- warning("NewMenu: new menu didn't add for some reason??");
+ debugC(0, kDebugLevelMacToolbox, "NewMenu: new menu didn't add for some reason??");
} else {
item->text = menuTitle.encode(Common::kMacRoman);
item->unicode = false;
@@ -247,7 +247,7 @@ MenuHandle Toolbox::NewMenu(uint16 menuID, const Common::U32String &menuTitle) {
void Toolbox::SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String &itemString) {
if (!theMenu) {
- warning("Toolbox::SetItem: empty menu handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::SetItem: empty menu handle");
return;
}
if (theMenu->menuData.size() < (uint)(item + 1)) {
@@ -257,7 +257,7 @@ void Toolbox::SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String
if (_defaultMenu) {
Graphics::MacMenuSubMenu *submenu = _defaultMenu->getSubmenu(nullptr, theMenu->menuID-1);
if (!submenu) {
- warning("Toolbox::SetItem: menu ID %d not found", theMenu->menuID);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::SetItem: menu ID %d not found", theMenu->menuID);
return;
}
if (item == 0) {
diff --git a/graphics/mactoolbox/toolbox_pict.cpp b/graphics/mactoolbox/toolbox_pict.cpp
index 3913ff67e10..1f17b6de9bf 100644
--- a/graphics/mactoolbox/toolbox_pict.cpp
+++ b/graphics/mactoolbox/toolbox_pict.cpp
@@ -21,8 +21,6 @@
#include "common/debug.h"
#include "common/memstream.h"
-#include "common/scummsys.h"
-#include "common/str-enc.h"
#include "common/stream.h"
#include "common/system.h"
@@ -39,7 +37,7 @@ void Toolbox::ClosePicture() {
ShowPen();
if (_port) {
if (!_port->picSave) {
- warning("Toolbox::ClosePicture: picture not open");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::ClosePicture: picture not open");
return;
}
_port->picSave->pushOp(kOpEndPic);
@@ -75,29 +73,29 @@ void Toolbox::_drawBitsRect(Common::SeekableReadStream &stream, const Common::Re
//result->rawSurface().debugPrint(5, 0, 0, 0, 0, -1, 128, fakePal);
CopyBits(intermediate, _port->portBits, srcRect, dstRect, mode, nullptr);
} else {
- warning("Toolbox::_drawBitsRect: PixMaps unsupported");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_drawBitsRect: PixMaps unsupported");
}
}
void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
if (!_port) {
- warning("Toolbox::DrawPicture: no graphics port");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: no graphics port");
return;
}
if (!myPicture) {
- warning("Toolbox::DrawPicture: handle is empty");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: handle is empty");
return;
}
if ((dstRect.width() != myPicture->picFrame.width()) ||
(dstRect.height() != myPicture->picFrame.height())) {
- warning("Toolbox::DrawPicture: mismatched dimensions not supported");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: mismatched dimensions not supported");
}
if (myPicture->picData.size() < 2) {
- warning("Toolbox::DrawPicture: no image data!");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: no image data!");
return;
}
@@ -113,14 +111,14 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
uint16 version = stream.readUint16BE();
if ((version != kOpVersion1) && (version != kOpVersion2)) {
- warning("Toolbox::DrawPicture: cannot find PICT version opcode");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: cannot find PICT version opcode");
return;
}
if (version == kOpVersion2) {
uint16 header = stream.readUint16BE();
if (header != kOpHeaderOp) {
- warning("Toolbox::DrawPicture: cannot find PICT header opcode");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: cannot find PICT header opcode");
return;
}
// we don't use the header yet
@@ -155,7 +153,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
case kOpNOP:
break;
case kOpClip:
- warning("STUB: Toolbox::DrawPicture: clip");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: clip");
readRegion(stream);
break;
case kOpBkPat:
@@ -171,7 +169,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
TextMode((SourceMode)stream.readUint16BE());
break;
case kOpSpExtra:
- warning("STUB: Toolbox::DrawPicture: spExtra");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: spExtra");
stream.skip(4);
break;
case kOpPnSize:
@@ -209,49 +207,49 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
_port->bkColor = stream.readUint32BE();
break;
case kOpTxRatio:
- warning("STUB: Toolbox::DrawPicture: txRatio");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: txRatio");
readPoint(stream);
readPoint(stream);
break;
case kOpVersion2:
break;
case kOpBkPixPat:
- warning("STUB: Toolbox::DrawPicture: bkPixPat (struct unsupported)");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: bkPixPat (struct unsupported)");
break;
case kOpPnPixPat:
- warning("STUB: Toolbox::DrawPicture: pnPixPat (struct unsupported)");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: pnPixPat (struct unsupported)");
break;
case kOpFillPixPat:
- warning("STUB: Toolbox::DrawPicture: fillPixPat (struct unsupported)");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: fillPixPat (struct unsupported)");
break;
case kOpPnLocHFrac:
- warning("STUB: Toolbox::DrawPicture: pnLocHFrac");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: pnLocHFrac");
stream.skip(2);
break;
case kOpChExtra:
- warning("STUB: Toolbox::DrawPicture: chExtra");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: chExtra");
stream.skip(2);
break;
case kOpRGBFgCol:
- warning("STUB: Toolbox::DrawPicture: rgbFgCol");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: rgbFgCol");
stream.skip(6);
break;
case kOpRGBBkCol:
- warning("STUB: Toolbox::DrawPicture: rgbBkCol");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: rgbBkCol");
stream.skip(6);
break;
case kOpHiliteMode:
- warning("STUB: Toolbox::DrawPicture: hiliteMode");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: hiliteMode");
break;
case kOpHiliteColor:
- warning("STUB: Toolbox::DrawPicture: hiliteColor");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: hiliteColor");
stream.skip(6);
break;
case kOpDefHilite:
- warning("STUB: Toolbox::DrawPicture: defHilite");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: defHilite");
break;
case kOpColor:
- warning("STUB: Toolbox::DrawPicture: color");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: color");
stream.skip(6);
break;
case kOpLine:
@@ -321,7 +319,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
}
break;
case kOpFontName:
- warning("STUB: Toolbox::DrawPicture: fontName");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: fontName");
stream.skip(5);
stream.readPascalString(false);
break;
@@ -474,7 +472,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
_drawBitsRect(stream, myPicture->picFrame, false);
break;
case kOpBitsRgn:
- warning("STUB: Toolbox::DrawPicture: bitsRgn, aborting");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: bitsRgn, aborting");
endPic = true;
break;
@@ -482,18 +480,18 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
_drawBitsRect(stream, myPicture->picFrame, true);
break;
case kOpPackBitsRgn:
- warning("STUB: Toolbox::DrawPicture: packBitsRgn, aborting");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: packBitsRgn, aborting");
endPic = true;
break;
case kOpShortComment:
- //warning("STUB: Toolbox::DrawPicture: shortComment");
+ //debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: shortComment");
stream.readUint16BE();
break;
case kOpLongComment:
{
- //warning("STUB: Toolbox::DrawPicture: longComment");
+ //debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawPicture: longComment");
stream.readUint16BE();
int size = stream.readUint16BE();
stream.skip(size);
@@ -505,7 +503,7 @@ void Toolbox::DrawPicture(PicHandle &myPicture, const Common::Rect &dstRect) {
break;
default:
- warning("Toolbox::DrawPicture: unsupported opcode %04x", op);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::DrawPicture: unsupported opcode %04x", op);
}
// if version 2, align to nearest word
if (version == kOpVersion2)
@@ -624,7 +622,7 @@ PicHandle Toolbox::OpenPicture(const Common::Rect &picFrame) {
if (_port) {
if (_port->picSave) {
- warning("Toolbox::OpenPicture: last picture not closed, overwriting");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::OpenPicture: last picture not closed, overwriting");
}
_port->picSave = result;
}
diff --git a/graphics/mactoolbox/toolbox_quickdraw.cpp b/graphics/mactoolbox/toolbox_quickdraw.cpp
index 632507878a5..93627953ab6 100644
--- a/graphics/mactoolbox/toolbox_quickdraw.cpp
+++ b/graphics/mactoolbox/toolbox_quickdraw.cpp
@@ -23,10 +23,7 @@
#include "common/memstream.h"
#include "common/system.h"
-#include "fool/detection.h"
-#include "graphics/cursor.h"
#include "graphics/macgui/macwindowmanager.h"
-#include "graphics/managed_surface.h"
#include "graphics/mactoolbox/toolbox.h"
#include "graphics/mactoolbox/utils.h"
@@ -41,7 +38,7 @@ void Toolbox::BackPat(const Pattern &pat) {
}
void Toolbox::BeginUpdate(WindowRecord &theWindow) {
- warning("STUB: Toolbox::BeginUpdate");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::BeginUpdate");
}
void Toolbox::ClosePoly() {
@@ -68,7 +65,7 @@ void Toolbox::ClosePoly() {
}
void Toolbox::ClipRect(Common::Rect &r) {
- warning("STUB: Toolbox::ClipRect");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::ClipRect");
}
void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
@@ -77,28 +74,28 @@ void Toolbox::CopyBits(const BitMap &srcBits, BitMap &dstBits, const Common::Rec
void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBits, const Common::Rect &srcRect, const Common::Rect &dstRect, SourceMode mode, RgnHandle maskRgn) {
if (!_port) {
- warning("Toolbox::_copyBits: empty port");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_copyBits: empty port");
return;
}
if (!srcBits) {
- warning("Toolbox::_copyBits: empty srcBits handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_copyBits: empty srcBits handle");
return;
}
if (!dstBits) {
- warning("Toolbox::_copyBits: empty dstBits handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_copyBits: empty dstBits handle");
return;
}
if (maskRgn) {
- warning("Toolbox::_copyBits: maskRgn unimplemented");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_copyBits: maskRgn unimplemented");
}
if (!srcRect.isValidRect()) {
- warning("Toolbox::_copyBits: invalid src rectangle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_copyBits: invalid src rectangle");
return;
}
if (!dstRect.isValidRect()) {
- warning("Toolbox::_copyBits: invalid dst rectangle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_copyBits: invalid dst rectangle");
return;
}
@@ -143,21 +140,6 @@ void Toolbox::_copyBits(const BitMap &srcBits, const BitMap &mask, BitMap &dstBi
_addDirtyRect(dstBits, result);
}
-// maybe the better way of refactoring this would be to fork the Primitives
-// object from MacWindowManager and make one that uses GrafPort as a state store?
-// as it stands, all the operations fall back to calling DrawPoint over and over again,
-// which can touch the same pixel multiple times.
-// this is a problem for all the xor blend modes.
-// we could have it so that the draw commands check a mask before drawing again, and it
-// gets reset after every op. this would be pretty inefficient; e.g. in fools errand most
-// of the time is spent drawing to the screen or to a screen-sized buffer.
-
-// steps:
-// - create intermediate surface
-// - draw to intermediate surface using MacPlotData
-// - blit to target with blitMono
-// - add to target dirty rect list
-
void Toolbox::EraseOval(const Common::Rect &r) {
if (_port) {
_drawOval(r, _port->bkPat, kPatCopy, false, _port->fgColor, _port->bkColor);
@@ -196,7 +178,7 @@ void Toolbox::EraseRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ova
}
void Toolbox::EndUpdate(WindowRecord &theWindow) {
- warning("STUB: Toolbox::EndUpdate");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::EndUpdate");
}
void Toolbox::_addDirtyRect(const BitMap &dest, const Common::Rect &rect) {
@@ -212,7 +194,7 @@ void Toolbox::_addDirtyRect(const BitMap &dest, const Common::Rect &rect) {
void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
if ((!r.isValidRect()) || r.isEmpty()) {
- warning("Toolbox::_drawOval: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_drawOval: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
return;
}
if (_port && _port->pnVis == 0) {
@@ -248,11 +230,11 @@ void Toolbox::_drawOval(const Common::Rect &r, const Pattern &pat, PatternMode m
void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
if (!poly) {
- warning("_drawPoly: Polygon data not found, skipping");
+ debugC(0, kDebugLevelMacToolbox, "_drawPoly: Polygon data not found, skipping");
return;
}
if (poly->polyPoints.size() < 2) {
- warning("_drawPoly: need at least 2 points");
+ debugC(0, kDebugLevelMacToolbox, "_drawPoly: need at least 2 points");
return;
}
if (_port && _port->pnVis == 0) {
@@ -313,7 +295,7 @@ void Toolbox::_drawPoly(const PolyHandle &poly, const Pattern &pat, PatternMode
void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor) {
if ((!r.isValidRect()) || r.isEmpty()) {
- warning("Toolbox::_drawRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_drawRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
return;
}
if (_port && _port->pnVis == 0) {
@@ -356,7 +338,7 @@ void Toolbox::_drawRect(const Common::Rect &r, const Pattern &pat, PatternMode m
void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternMode mode, bool frame, uint32 fgColor, uint32 bkColor, uint16 ovalWidth, uint16 ovalHeight) {
if ((!r.isValidRect()) || r.isEmpty()) {
- warning("Toolbox::_drawRoundRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_drawRoundRect: invalid rect %d %d %d %d", r.left, r.top, r.right, r.bottom);
return;
}
if (_port && _port->pnVis == 0) {
@@ -379,7 +361,7 @@ void Toolbox::_drawRoundRect(const Common::Rect &r, const Pattern &pat, PatternM
destRect.bottom -= penSize.y - 1;
if (ovalWidth != ovalHeight) {
- warning("Toolbox::_drawRoundRect: different corner diameters not supported");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::_drawRoundRect: different corner diameters not supported");
}
pm.drawRoundRect(destRect, ovalHeight/2, fgColor, !frame, &pd);
@@ -439,7 +421,7 @@ void Toolbox::FillRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 oval
}
void Toolbox::FrameArc(const Common::Rect &r, int16 startAngle, int16 arcAngle) {
- warning("STUB: Toolbox::FrameArc");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::FrameArc");
}
void Toolbox::FrameOval(const Common::Rect &r) {
@@ -480,7 +462,7 @@ void Toolbox::FrameRoundRect(const Common::Rect &r, uint16 ovalWidth, uint16 ova
}
void Toolbox::GetCPixel(int16 h, int16 v, RGBColor &cPix) {
- warning("STUB: Toolbox::GetCPixel");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::GetCPixel");
}
Handle Toolbox::GetIcon(uint16 iconID) {
@@ -488,7 +470,7 @@ Handle Toolbox::GetIcon(uint16 iconID) {
if (handle) {
return handle;
} else {
- warning("Toolbox::GetIcon: failed to load ICON id %d", iconID);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::GetIcon: failed to load ICON id %d", iconID);
}
return nullptr;
@@ -682,7 +664,7 @@ void Toolbox::OpenPort(GrafPtr port) {
// source: QuickDraw Routines I-163
port->portBits = _defaultBits;
port->portRect = Common::Rect(_wm->getWidth(), _wm->getHeight());
- port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, _wm->getWidth(), _wm->getHeight() ) }));
+ port->visRgn = RgnHandle(new Region({ 1, Common::Rect( 0, 0, _wm->getWidth(), _wm->getHeight() ), Common::Array<int16>() }));
port->fgColor = _wm->_colorBlack;
port->bkColor = _wm->_colorWhite;
_port = port;
@@ -764,7 +746,7 @@ void Toolbox::PenSize(uint16 width, uint16 height) {
void Toolbox::PlotIcon(const Common::Rect &theRect, const Handle &theIcon) {
if (!theIcon) {
- warning("Toolbox::PlotIcon: empty handle");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::PlotIcon: empty handle");
return;
}
if (_port) {
@@ -791,7 +773,7 @@ bool Toolbox::PtInRect(const Common::Point &pt, const Common::Rect &r) {
}
void Toolbox::SetCPixel(int16 h, int16 v, const RGBColor &cPix) {
- warning("STUB: Toolbox::SetCPixel");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::SetCPixel");
}
void Toolbox::SetCursor(const Common::SharedPtr<Cursor> &crsr) {
diff --git a/graphics/mactoolbox/toolbox_sound.cpp b/graphics/mactoolbox/toolbox_sound.cpp
index 58fefd9a26b..7755ec2c768 100644
--- a/graphics/mactoolbox/toolbox_sound.cpp
+++ b/graphics/mactoolbox/toolbox_sound.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "audio/audiostream.h"
#include "audio/softsynth/pcspk.h"
@@ -33,10 +32,10 @@ namespace MacToolbox {
void Toolbox::StartSound(SynthPtr synthRec, uint32 numBytes, ProcPtr completionRtn) {
if (!synthRec) {
- warning("Toolbox::startSound: record not found");
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::startSound: record not found");
return;
}
- bool synch = completionRtn == -1;
+ bool synch = completionRtn == (ProcPtr)-1;
if (synthRec->mode == swMode) {
SWSynthRec *rec = static_cast<SWSynthRec *>(synthRec);
for (auto &it : rec->triplets) {
@@ -48,7 +47,7 @@ void Toolbox::StartSound(SynthPtr synthRec, uint32 numBytes, ProcPtr completionR
}
}
} else {
- warning("Toolbox::startSound: unimplemented synth mode %d", synthRec->mode);
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::startSound: unimplemented synth mode %d", synthRec->mode);
return;
}
}
@@ -62,11 +61,11 @@ bool Toolbox::SoundDone() {
}
void Toolbox::SetSoundVol(int16 level) {
- warning("STUB: Toolbox::SetSoundVol");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::SetSoundVol");
}
int16 Toolbox::GetSoundVol() {
- warning("STUB: Toolbox::GetSoundVol");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::GetSoundVol");
return 7;
}
diff --git a/graphics/mactoolbox/toolbox_text.cpp b/graphics/mactoolbox/toolbox_text.cpp
index 6eb7d1bd0f9..9b442c13b7b 100644
--- a/graphics/mactoolbox/toolbox_text.cpp
+++ b/graphics/mactoolbox/toolbox_text.cpp
@@ -20,7 +20,6 @@
*/
#include "graphics/macgui/mactext-canvas.h"
-#include "graphics/macgui/mactext.h"
#include "graphics/managed_surface.h"
#include "graphics/pixelformat.h"
@@ -31,7 +30,7 @@ namespace Graphics {
namespace MacToolbox {
void Toolbox::DrawChar(Common::u32char_type_t ch) {
- warning("STUB: Toolbox::DrawChar");
+ debugC(0, kDebugLevelMacToolbox, "STUB: Toolbox::DrawChar");
}
void Toolbox::DrawString(const Common::U32String &s) {
diff --git a/graphics/mactoolbox/utils.cpp b/graphics/mactoolbox/utils.cpp
index ae6cab212c5..d037ccc9637 100644
--- a/graphics/mactoolbox/utils.cpp
+++ b/graphics/mactoolbox/utils.cpp
@@ -19,7 +19,8 @@
*
*/
-#include "common/memstream.h"
+#include "common/debug.h"
+
#include "graphics/mactoolbox/toolbox.h"
#include "graphics/mactoolbox/utils.h"
@@ -60,7 +61,7 @@ Region readRegion(Common::SeekableReadStream &stream) {
stream.hexdump(region.rgnSize - 2);
}
if (stream.size() - stream.pos() < region.rgnSize - 2) {
- warning("readRegion: not enough data to match size");
+ debugC(0, kDebugLevelMacToolbox, "readRegion: not enough data to match size");
}
region.rgnBBox = readRect(stream);
for (int i = 10; i < region.rgnSize; i+=2) {
@@ -113,7 +114,7 @@ BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool
Common::BitStream8MSB bs(stream);
// rows are word-aligned
int overflowBits = (pixMap.bounds.width() % 16 == 0) ? 0 : (16 - (pixMap.bounds.width() % 16));
- debugC(5, kDebugLevelGGraphics, "readBitsRectMono: width %d, overflow %d", pixMap.bounds.width(), overflowBits);
+ debugC(5, kDebugLevelMacToolbox, "readBitsRectMono: width %d, overflow %d", pixMap.bounds.width(), overflowBits);
for (int y = pixMap.bounds.top; y < pixMap.bounds.bottom; y++) {
int yPos = y - pixMap.bounds.top;
@@ -157,8 +158,8 @@ BitMap readBitsRectMono(Common::SeekableReadStream &stream, PixMap &pixMap, bool
readBytes += bufLen;
}
- Common::MemoryReadStream ms(rowBuf, bufLen);
- Common::BitStream8MSB bs(ms);
+ Common::BitStreamMemoryStream ms(rowBuf, bufLen);
+ Common::BitStreamMemory8MSB bs(ms);
for (int i = 0; i < 8 * bufLen; i++) {
int xPos = x;
@@ -242,7 +243,7 @@ Common::Rect blitMono(const BitMap &src, BitMap &dst, const BitMap &mask, const
// Source: Inside Macintosh I-170
return blitMono(src, dst, mask, dstPos, (SourceMode)((int)mode & 0x7), black, white);
}
- warning("blitMono: Called with an invalid PatternMode, ignoring");
+ debugC(0, kDebugLevelMacToolbox, "blitMono: Called with an invalid PatternMode, ignoring");
return Common::Rect();
}
Commit: 97f806e45a1b7e89c5863fa495901dc2cb32d60b
https://github.com/scummvm/scummvm/commit/97f806e45a1b7e89c5863fa495901dc2cb32d60b
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:35+02:00
Commit Message:
FOOL: More cleanup
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jigsaw.cpp
engines/fool/fool_jumble.cpp
engines/fool/fool_maze.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 16b6313ecb0..aeb05a2bd9c 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1427,7 +1427,7 @@ void FoolGame::printStory() {
// 128:2b0a
_stateFlags = kStateNull;
// printing the story
- warning("STUB: %s", __func__);
+ warning("FoolGame::printStory: not implemented yet");
}
void FoolGame::newGame() {
@@ -1806,9 +1806,8 @@ void FoolGame::cursorExplodingWatchShort() {
void FoolGame::sub_128_388a() {
// 128:388a
if ((var_i16_7e6 & 0xff) == 2) {
- // problem with saving
+ // problem with saving, we don't have to worry about it
}
- warning("STUB: %s", __func__);
}
void FoolGame::puzzleRun() {
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index f7c5f660cb2..7518121a97d 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -210,9 +210,9 @@ public:
// fool_jumble.cpp:
void jumbleRun();
- void sub_130_c56();
+ void jumbleSave(); // sub_130_c56
void jumbleStoreState(); // sub_130_c66
- void sub_130_d2e();
+ void jumbleRunRearrange(); // sub_130_d2e
void jumbleRunSubstitution(); // sub_130_d90
void sub_130_1004();
void jumbleRunWordSquare(); // sub_130_10a6
@@ -235,13 +235,13 @@ public:
void jumblePreviousPosition(); // sub_130_2094
void sub_130_20aa();
void sub_130_20d2();
- void sub_130_20fe();
+ Common::Point jumbleGetGridPos(); // sub_130_20fe
void sub_130_2178();
- void sub_130_2226();
- void sub_130_22ee();
- void sub_130_23cc();
- void sub_130_24aa();
- void sub_130_2548();
+ void jumbleDrawHint(); // sub_130_2226
+ void jumbleDrawHintBoat(); // sub_130_22ee
+ void jumbleDrawHintBlacksmith(); // sub_130_23cc
+ void jumbleDrawHintSentry(); // sub_130_24aa
+ void jumbleDrawHintMetapuzzle(); // sub_130_2548
void sub_130_25d8();
void sub_130_2790();
@@ -324,8 +324,8 @@ public:
void mazeDelay(); // sub_136_1ddc
void mazeYeetObject(); // sub_136_1df4
void mazeThornsGetScroll(); // sub_136_1e4c
- void sub_136_21fa();
- void sub_136_2200();
+ void mazeWaitForMouseUp(); // sub_136_21fa
+ void mazeClearText(); // sub_136_2200
void mazeMovementTrail(); // sub_136_2208
void mazeLoadTone(int16 offset); // sub_136_24ae
@@ -501,6 +501,7 @@ private:
int16 var_i16_586;
Common::U32String var_str_588;
int16 var_i16_688;
+ Common::Point _jumbleGridPos; // var_i16_68a
int16 var_i16_68a;
int16 var_i16_68c;
uint32 var_i32_692;
@@ -676,7 +677,7 @@ private:
int16 var_i16_1bd6;
int16 var_i16_1bd8;
int16 var_i16_1bda;
- int16 var_i16_1bdc;
+ bool _mazeClearText; // var_i16_1bdc
Common::String var_str_1bde;
int16 var_i16_1cde;
diff --git a/engines/fool/fool_jigsaw.cpp b/engines/fool/fool_jigsaw.cpp
index 223edeee767..86d474193d0 100644
--- a/engines/fool/fool_jigsaw.cpp
+++ b/engines/fool/fool_jigsaw.cpp
@@ -226,7 +226,6 @@ void FoolGame::jigsawDragSelect() {
void FoolGame::jigsawMoveSelected() {
// 132:0962
// move select area to new target
- warning("call: %s", __func__);
do {
getNextEvent(2);
getGridFromMouse(var_i16_68a, var_i16_68c);
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 99479d17cea..49676bae876 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -61,22 +61,22 @@ void FoolGame::jumbleRun() {
}
// 130:0066
var_i16_484 = 0;
- var_i16_68c = arr_i16_1eb8[8];
+ int16 gridY = arr_i16_1eb8[8];
do {
- var_i16_68a = arr_i16_1eb8[10];
+ int16 gridX = arr_i16_1eb8[10];
do {
var_i16_484++;
_toolbox->SetRect(
_screenGrid[var_i16_484],
- var_i16_68a,
- var_i16_68c,
- var_i16_68a + arr_i16_1eb8[13],
- var_i16_68c + arr_i16_1eb8[12]
+ gridX,
+ gridY,
+ gridX + arr_i16_1eb8[13],
+ gridY + arr_i16_1eb8[12]
);
// 130:00f6
- } while (_zbasic->incrAndCheck(var_i16_68a, arr_i16_1eb8[11], arr_i16_1eb8[6]));
+ } while (_zbasic->incrAndCheck(gridX, arr_i16_1eb8[11], arr_i16_1eb8[6]));
// 130:0126
- } while (_zbasic->incrAndCheck(var_i16_68c, arr_i16_1eb8[9], arr_i16_1eb8[7]));
+ } while (_zbasic->incrAndCheck(gridY, arr_i16_1eb8[9], arr_i16_1eb8[7]));
// 130:0156
if ((var_i16_105a & 0x2) == 2) {
var_i16_105c = puzzlesReadShort();
@@ -197,9 +197,9 @@ void FoolGame::jumbleRun() {
_jumblePosition++;
arr_i16_3738[_jumblePosition] = puzzlesReadShort();
_jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
- sub_130_20fe();
- arr_i16_2f38[var_i16_68a*32 + var_i16_68c] = var_i16_103a;
- arr_i16_3b38[var_i16_68a*32 + var_i16_68c] = _jumblePosition;
+ Common::Point pos = jumbleGetGridPos();
+ arr_i16_2f38[pos.x*32 + pos.y] = var_i16_103a;
+ arr_i16_3b38[pos.x*32 + pos.y] = _jumblePosition;
sub_130_1c6c();
var_str_d12 = _zbasic->midStr(var_str_1070, _jumblePosition, 1);
// 130:06d4
@@ -240,16 +240,16 @@ void FoolGame::jumbleRun() {
// 130:07f2
var_i16_103a = puzzlesReadShort();
if (var_i16_103a > 0) {
- for (var_i16_68a = 1; var_i16_68a <= var_i16_103a; var_i16_68a++) {
- var_i16_484 = puzzlesReadShort();
- var_i16_7e4 = puzzlesReadShort();
+ for (int16 i = 1; i <= var_i16_103a; i++) {
+ int16 xPos = puzzlesReadShort();
+ int16 yPos = puzzlesReadShort();
var_str_1578 = puzzlesReadString().decode(Common::kMacRoman);
_zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
if (var_i16_7e4 > 0) {
- _toolbox->MoveTo(var_i16_484, var_i16_7e4);
+ _toolbox->MoveTo(xPos, yPos);
_toolbox->DrawString(var_str_1578);
} else {
- sub_130_2226();
+ jumbleDrawHint();
}
}
}
@@ -269,8 +269,8 @@ void FoolGame::jumbleRun() {
// 130:08fa
if (_activePuzzleStatus <= _jumbleCurrentSubPuzzle) {
switch (_jumbleGameType-1) {
- case 0:
- sub_130_d2e();
+ case 0: // letter rearrangement
+ jumbleRunRearrange();
break;
case 1:
jumbleRunSubstitution();
@@ -297,7 +297,7 @@ void FoolGame::jumbleRun() {
if ((var_i16_1678 > 0) && (!var_str_1578.empty())) { // was: str(172)
// 130:098c
var_str_1578.clear(); // was: str(173)
- sub_130_2226();
+ jumbleDrawHint();
}
// 130:09a4
for (int i = 1; i <= 3; i++) {
@@ -340,16 +340,16 @@ void FoolGame::jumbleRun() {
// originally was 0xd, lock to 2 frames
var_i16_7e4 = 0x22;
}
- var_i16_68a = 0;
+ int16 index = 0;
do {
int ticks = (int)_toolbox->TickCount();
- var_i16_68a++;
- _toolbox->InvertRect(_screenGrid[arr_i16_4338[var_i16_68a]]);
+ index++;
+ _toolbox->InvertRect(_screenGrid[arr_i16_4338[index]]);
// mask was originally 0
getNextEvent(-1);
int delta = MAX(0, var_i16_7e4*60/1000 - ((int)_toolbox->TickCount() - ticks));
_toolbox->Delay(delta);
- } while (!((var_i16_68a == arr_i16_4338[0]) || ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0)));
+ } while (!((index == arr_i16_4338[0]) || ((_event.modifiers & Graphics::MacToolbox::kModMouseButtonUp) == 0)));
} else {
// 130:0b62
// mask was originally 0
@@ -383,8 +383,7 @@ void FoolGame::jumbleRun() {
jumbleStoreState();
}
-void FoolGame::sub_130_c56() {
- warning(__func__);
+void FoolGame::jumbleSave() {
// 130:0c56
jumbleStoreState();
saveGame();
@@ -418,7 +417,7 @@ void FoolGame::jumbleStoreState() {
return;
}
-void FoolGame::sub_130_d2e() {
+void FoolGame::jumbleRunRearrange() {
warning(__func__);
// 130:0d2e
sub_130_1426();
@@ -430,7 +429,7 @@ void FoolGame::sub_130_d2e() {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- sub_130_c56();
+ jumbleSave();
}
}
}
@@ -467,7 +466,7 @@ void FoolGame::jumbleRunSubstitution() {
// 130:0f24
var_str_1578 += Common::U32String(" = ") + _zbasic->index(1, 1); // ABC = XYZ
var_i16_167a = _zbasic->instr(1, var_str_1578, Common::U32String("=")); // was: str(179)
- sub_130_2226();
+ jumbleDrawHint();
} else {
// 130:0f72
var_str_1578.clear(); // was: str(180);
@@ -489,7 +488,7 @@ void FoolGame::jumbleRunSubstitution() {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- sub_130_c56();
+ jumbleSave();
}
}
// 130:0ffe
@@ -517,7 +516,7 @@ void FoolGame::sub_130_1004() {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- sub_130_c56();
+ jumbleSave();
}
}
jumbleSelectSquare();
@@ -547,7 +546,7 @@ void FoolGame::jumbleRunWordSquare() {
jumbleOnClick();
}
if (_stateFlags == kStateSaveGame) {
- sub_130_c56();
+ jumbleSave();
}
}
}
@@ -572,14 +571,14 @@ void FoolGame::jumbleRunHiddenMessage() {
if (_keyLastPressed != 0) {
jumbleOnKey();
}
- getGridFromMouse(var_i16_68a, var_i16_68c);
+ getGridFromMouse(_jumbleGridPos.x, _jumbleGridPos.y);
if (_event.what == Graphics::MacToolbox::kMouseDown) {
jumbleOnClick();
}
- if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
+ if ((_jumbleGridPos.x < 1) || (_jumbleGridPos.x > arr_i16_1eb8[0]) || (_jumbleGridPos.y < 1) || (_jumbleGridPos.y > arr_i16_1eb8[1])) {
var_i16_187c = 0;
} else {
- var_i16_187c = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
+ var_i16_187c = arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y];
}
// 130:139e
if (var_i16_187c != var_i16_7b2) {
@@ -594,7 +593,7 @@ void FoolGame::jumbleRunHiddenMessage() {
// 130:13e2
var_i16_7b2 = var_i16_187c;
if (_stateFlags == kStateSaveGame) {
- sub_130_c56();
+ jumbleSave();
}
}
// 130:141e
@@ -610,7 +609,7 @@ void FoolGame::sub_130_1426() {
if (!_zbasic->index(1, 1).empty()) { // was: str(183)
var_i16_1678 = 1;
var_str_1578 = _zbasic->index(1, 1);
- sub_130_2226();
+ jumbleDrawHint();
}
// 130:1474
}
@@ -618,8 +617,8 @@ void FoolGame::sub_130_1426() {
void FoolGame::jumbleOnClick() {
warning(__func__);
// 130:1476
- getGridFromMouse(var_i16_68a, var_i16_68c);
- if ((var_i16_68a < 1) || (var_i16_68a > arr_i16_1eb8[0]) || (var_i16_68c < 1) || (var_i16_68c > arr_i16_1eb8[1])) {
+ getGridFromMouse(_jumbleGridPos.x, _jumbleGridPos.y);
+ if ((_jumbleGridPos.x < 1) || (_jumbleGridPos.x > arr_i16_1eb8[0]) || (_jumbleGridPos.y < 1) || (_jumbleGridPos.y > arr_i16_1eb8[1])) {
// 130:14fa
if (_event.where.x > 0x14) {
playTone(0xf, 0x42, 0x1);
@@ -627,22 +626,22 @@ void FoolGame::jumbleOnClick() {
return;
}
// 130:1518
- if (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] < 1) {
+ if (arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y] < 1) {
playTone(0xf, 0x42, 0x1);
return;
}
// 130:1558
- if ((_jumbleGameType == 6) && (arr_i16_2f38[var_i16_68a*32 + var_i16_68c] >= 0x11)) {
+ if ((_jumbleGameType == 6) && (arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y] >= 0x11)) {
playTone(0xf, 0x42, 0x1);
return;
}
// 130:15b0
switch (_jumbleGameType - 1) {
- case 0:
+ case 0: // hierophant
sub_130_172c();
break;
case 1: // the knight of wands
- case 2:
+ case 2: // the devil
case 6:
sub_130_20aa();
break;
@@ -713,29 +712,29 @@ void FoolGame::sub_130_172c() {
warning(__func__);
// 130:172c
// word square, disallow clicking the centre tile
- if ((_jumbleGameType == 4) && (arr_i16_3b38[var_i16_68a*32 + var_i16_68c] == 5)) {
+ if ((_jumbleGameType == 4) && (arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y] == 5)) {
jumbleClickFixedSquare();
return;
}
// 130:1776
- if (!((var_i16_1678 == arr_i16_2f38[var_i16_68a*32 + var_i16_68c]) && (var_i16_187e > 0))) {
+ if (!((var_i16_1678 == arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y]) && (var_i16_187e > 0))) {
// 130:17c4
sub_130_19ac();
- var_i16_187e = ABS(arr_i16_3738[arr_i16_3b38[var_i16_68a*32 + var_i16_68c]]);
- var_i16_1884 = arr_i16_3b38[var_i16_68a*32 + var_i16_68c];
+ var_i16_187e = ABS(arr_i16_3738[arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y]]);
+ var_i16_1884 = arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y];
_toolbox->InvertRect(_screenGrid[var_i16_187e]);
sub_130_2178();
return;
}
// 130:1844
- var_i16_1880 = ABS(arr_i16_3738[arr_i16_3b38[var_i16_68a*32 + var_i16_68c]]);
+ var_i16_1880 = ABS(arr_i16_3738[arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y]]);
if (var_i16_187e == var_i16_1880) {
sub_130_19ac();
return;
}
// 130:189a
_toolbox->InvertRect(_screenGrid[var_i16_1880]);
- var_i16_1886 = arr_i16_3b38[var_i16_68a*32 + var_i16_68c];
+ var_i16_1886 = arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y];
var_str_1374 = _zbasic->midStr(var_str_1070, var_i16_1884, 1);
var_str_1474 = _zbasic->midStr(var_str_1070, var_i16_1886, 1);
_zbasic->midStrSet(var_str_1070, var_i16_1884, 1, var_str_1474);
@@ -765,7 +764,6 @@ void FoolGame::sub_130_19ac() {
}
void FoolGame::jumbleClickFixedSquare() {
- warning(__func__);
// 130:19da
// fixed tile
sub_130_19ac();
@@ -820,7 +818,7 @@ void FoolGame::sub_130_1a16() {
}
// 130:1c02
}
- sub_130_2226();
+ jumbleDrawHint();
}
// 130:1c1a
sub_130_1c1a();
@@ -865,7 +863,6 @@ void FoolGame::sub_130_1c6c() {
}
void FoolGame::jumbleDrawLetter() {
- warning(__func__);
// 130:1dcc
_zbasic->text(kFontPuzzle, arr_i16_1eb8[0xe], 0, var_i16_106c);
_toolbox->MoveTo(
@@ -929,7 +926,6 @@ void FoolGame::sub_130_201a() {
}
void FoolGame::jumbleNextPosition() {
- warning(__func__);
// 130:2078
_jumblePosition++;
if (_jumblePosition > var_i16_1576) {
@@ -938,7 +934,6 @@ void FoolGame::jumbleNextPosition() {
}
void FoolGame::jumblePreviousPosition() {
- warning(__func__);
// 130:2094
_jumblePosition--;
if (_jumblePosition < 1) {
@@ -950,7 +945,7 @@ void FoolGame::sub_130_20aa() {
warning(__func__);
// 130:20aa
jumbleSelectSquare();
- _jumblePosition = arr_i16_3b38[var_i16_68a*32 + var_i16_68c];
+ _jumblePosition = arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y];
sub_130_20d2();
}
@@ -960,49 +955,49 @@ void FoolGame::sub_130_20d2() {
// 130:20d2
_jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
jumbleSelectSquare();
- sub_130_20fe();
+ _jumbleGridPos = jumbleGetGridPos();
sub_130_2178();
}
-void FoolGame::sub_130_20fe() {
- warning(__func__);
+Common::Point FoolGame::jumbleGetGridPos() {
// 130:20fe
- var_i16_1888 = ABS(arr_i16_3738[_jumblePosition]) - 1;
- var_i16_68a = (var_i16_1888 % arr_i16_1eb8[0]) + 1;
- var_i16_68c = (var_i16_1888 / arr_i16_1eb8[0]) + 1;
+ int16 index = ABS(arr_i16_3738[_jumblePosition]) - 1;
+ Common::Point result;
+ result.x = (index % arr_i16_1eb8[0]) + 1;
+ result.y = (index / arr_i16_1eb8[0]) + 1;
+ return result;
}
void FoolGame::sub_130_2178() {
warning(__func__);
// 130:2178
- if ((arr_i16_2f38[var_i16_68a*32 + var_i16_68c] == var_i16_1678) || (_jumbleGameType == 2))
+ if ((arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y] == var_i16_1678) || (_jumbleGameType == 2))
return;
- var_i16_1678 = arr_i16_2f38[var_i16_68a*32 + var_i16_68c];
+ var_i16_1678 = arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y];
if (!_zbasic->index(1, var_i16_1678).empty()) { // was: str(185)
var_str_1578 = _zbasic->index(1, var_i16_1678);
- sub_130_2226();
+ jumbleDrawHint();
}
// 130:2224
}
-void FoolGame::sub_130_2226() {
- warning(__func__);
+void FoolGame::jumbleDrawHint() {
// 130:2226
if (_activePuzzle == 0x14) { // the blacksmith
- sub_130_23cc();
+ jumbleDrawHintBlacksmith();
return;
}
if (_activePuzzle == 0x3c) { // the boat
- sub_130_22ee();
+ jumbleDrawHintBoat();
return;
}
if (_activePuzzle == 0x35) { // the sentry
- sub_130_24aa();
+ jumbleDrawHintSentry();
return;
}
if (_activePuzzle == 0x55) { // final puzzle
- sub_130_2548();
+ jumbleDrawHintMetapuzzle();
return;
}
// 130:2266
@@ -1016,8 +1011,7 @@ void FoolGame::sub_130_2226() {
_toolbox->DrawString(var_str_1578);
}
-void FoolGame::sub_130_22ee() {
- warning(__func__);
+void FoolGame::jumbleDrawHintBoat() {
// 130:22ee
fillRect(0x131, 0x84, 0x156, 0x17e, var_i16_1060);
if (var_str_1578.empty()) // was: str(187)
@@ -1029,8 +1023,7 @@ void FoolGame::sub_130_22ee() {
_toolbox->DrawString(var_str_1578);
}
-void FoolGame::sub_130_23cc() {
- warning(__func__);
+void FoolGame::jumbleDrawHintBlacksmith() {
// 130:23cc
fillRect(0x12c, 0x8c, 0x156, 0x186, var_i16_1060);
if (var_str_1578.empty()) // was: str(188)
@@ -1042,8 +1035,7 @@ void FoolGame::sub_130_23cc() {
_toolbox->DrawString(var_str_1578);
}
-void FoolGame::sub_130_24aa() {
- warning(__func__);
+void FoolGame::jumbleDrawHintSentry() {
// 130:24aa
fillRect(0x125, 0x20, 0x136, 0x15e, 2);
if (var_str_1578.empty()) // was: str(189)
@@ -1054,8 +1046,7 @@ void FoolGame::sub_130_24aa() {
_toolbox->DrawString(var_str_1578);
}
-void FoolGame::sub_130_2548() {
- warning(__func__);
+void FoolGame::jumbleDrawHintMetapuzzle() {
// 130:2548
_zbasic->text(kFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
fillRect(0x131, 0, 0x156, 0x10e, 0x47);
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index 730e075247a..edf993ecbe1 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -373,9 +373,9 @@ void FoolGame::sub_136_ade() {
void FoolGame::mazeHotspot() {
// 136:0b00
- if (arr_i16_1eb8[22] || var_i16_1bdc) {
+ if (arr_i16_1eb8[22] || _mazeClearText) {
fillRect(0x136, 0, SCREEN_HEIGHT, SCREEN_WIDTH, var_i16_1ac4);
- var_i16_1bdc = 0;
+ _mazeClearText = false;
var_str_1578.clear(); // was: str(OFF(2))
}
// 136:0b5e
@@ -476,10 +476,10 @@ void FoolGame::mazeHotspot() {
mazeThornsGetScroll();
break;
case 20: // K
- sub_136_21fa();
+ mazeWaitForMouseUp();
break;
case 21: // V
- sub_136_2200();
+ mazeClearText();
break;
default:
warning("mazeHotspot: breaking out of switch statement");
@@ -510,7 +510,6 @@ void FoolGame::mazePrintMessage() {
void FoolGame::mazePickUpItem() {
// 136:0e4c
- warning(__func__);
int16 itemID = _zbasic->decodeInt(var_str_1ce2);
_mazeInvItemCount[itemID]++;
if (arr_i16_3738[var_i16_1574] & 0x1000) {
@@ -521,7 +520,6 @@ void FoolGame::mazePickUpItem() {
}
void FoolGame::mazeUseItem() {
- warning(__func__);
// 136:0ed8
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
int16 itemID = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -572,7 +570,6 @@ void FoolGame::mazeWanderingWinds() {
}
void FoolGame::mazeDrawLetter() {
- warning(__func__);
// 136:115a
if (_zbasic->leftStr(var_str_1ce2, 1) == _zbasic->strRaw(OFF(10))) { // P
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
@@ -627,26 +624,29 @@ void FoolGame::sub_136_137c() {
Common::String op = _zbasic->leftStr(var_str_1ce2, 1);
warning("%s: op %s", __func__, op.c_str());
// 136:137c
- var_i16_1df0 = 0;
+ bool failed = false;
+ // has an inventory item
if (op == _zbasic->strRaw(OFF(13))) { // I
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (_mazeInvItemCount[var_i16_484] == 0) {
- var_i16_1df0 = 1;
+ failed = true;
}
}
// 136:13d8
+ // has at least X of an inventory item
if (op == _zbasic->strRaw(OFF(14))) { // M
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
var_i16_1de2 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 4, 2));
if (_mazeInvItemCount[var_i16_1de2] < var_i16_1de4) {
- var_i16_1df0 = 1;
+ failed = true;
}
}
// 136:144e
+ // has set a trigger elsewhere in the maze (e.g. picked up the Scroll of Prowess, so activate the exit)
if (op == _zbasic->strRaw(OFF(15))) { // B
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
- var_i16_1df0 = 1;
+ failed = true;
}
}
// 136:14b2
@@ -654,16 +654,17 @@ void FoolGame::sub_136_137c() {
// 136:14d6
var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (arr_i16_4338[var_i16_484] != var_i16_7e4) {
- var_i16_1df0 = 1;
+ failed = true;
}
}
// 136:1528
+ // has visited all of the characters in the maze
if (op == _zbasic->strRaw(OFF(17))) { // S
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
for (int16 i = 4; i <= (2*var_i16_484 + 2); i += 2) {
var_i16_7e4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, i, 2));
if (arr_i16_4338[var_i16_7e4] == 0) {
- var_i16_1df0 = 1;
+ failed = true;
}
}
}
@@ -671,11 +672,11 @@ void FoolGame::sub_136_137c() {
if (op == _zbasic->strRaw(OFF(18))) { // P
var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 2, 2));
if (var_i16_1bd0 != var_i16_484) {
- var_i16_1df0 = 1;
+ failed = true;
}
}
// 136:1612
- if (var_i16_1df0 != 0) {
+ if (failed) {
var_i16_1cde = _zbasic->instr(1, var_str_1ac8, _zbasic->strRaw(OFF(19))); // ||
}
// 136:163a
@@ -772,14 +773,12 @@ void FoolGame::sub_136_1806() {
}
void FoolGame::mazeSetTrigger() {
- warning(__func__);
// 136:185a
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
arr_i16_3738[var_i16_484] |= 0x1000;
}
void FoolGame::mazeClearTrigger() {
- warning(__func__);
// 136:1898
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
if (arr_i16_3738[var_i16_484] & 0x1000) {
@@ -788,7 +787,6 @@ void FoolGame::mazeClearTrigger() {
}
void FoolGame::mazePickUpTone() {
- warning(__func__);
// 136:18f4
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
mazeLoadTone(3);
@@ -798,7 +796,6 @@ void FoolGame::mazePickUpTone() {
}
void FoolGame::mazeFireDemon() {
- warning(__func__);
// 136:1932
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
mazeLoadTone(3);
@@ -868,7 +865,6 @@ void FoolGame::sub_136_19d2() {
}
void FoolGame::mazeNoisySprite() {
- warning(__func__);
// 136:1cf4
var_i16_1de4 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -896,14 +892,12 @@ void FoolGame::mazeNoisySprite() {
}
void FoolGame::mazeDelay() {
- warning(__func__);
// 136:1ddc
var_i16_484 = _zbasic->decodeInt(var_str_1ce2);
_toolbox->Delay(var_i16_484*60/1000);
}
void FoolGame::mazeYeetObject() {
- warning(__func__);
// 136:1df4
var_i16_1dea = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 1, 2));
var_i16_1de8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, 3, 2));
@@ -992,16 +986,14 @@ void FoolGame::mazeThornsGetScroll() {
}
}
-void FoolGame::sub_136_21fa() {
- warning(__func__);
+void FoolGame::mazeWaitForMouseUp() {
// 136:21fa
waitForMouseUp();
}
-void FoolGame::sub_136_2200() {
- warning(__func__);
+void FoolGame::mazeClearText() {
// 136:2200
- var_i16_1bdc = 1;
+ _mazeClearText = true;
}
void FoolGame::mazeMovementTrail() {
@@ -1045,7 +1037,6 @@ void FoolGame::mazeMovementTrail() {
}
void FoolGame::mazeLoadTone(int16 offset) {
- warning(__func__);
// 136:24ae
mazeToneFreq = _zbasic->decodeInt(_zbasic->midStr(var_str_1ce2, offset, 2));
if (mazeToneFreq > 0) {
@@ -1155,7 +1146,6 @@ void FoolGame::mazeSetupMenu() {
}
void FoolGame::mazeAddWallLeft() {
- warning(__func__);
// 136:2a7c
arr_i16_3738[var_i16_1574] |= 0x100;
_toolbox->MoveTo(
@@ -1169,7 +1159,6 @@ void FoolGame::mazeAddWallLeft() {
}
void FoolGame::mazeAddWallTop() {
- warning(__func__);
// 136:2b30
arr_i16_3738[var_i16_1574] |= 0x200;
_toolbox->MoveTo(
@@ -1183,7 +1172,6 @@ void FoolGame::mazeAddWallTop() {
}
void FoolGame::mazeAddWallRight() {
- warning(__func__);
// 136:2be2
arr_i16_3738[var_i16_1574] |= 0x400;
_toolbox->MoveTo(
@@ -1197,7 +1185,6 @@ void FoolGame::mazeAddWallRight() {
}
void FoolGame::mazeAddWallBottom() {
- warning(__func__);
// 136:2c96
arr_i16_3738[var_i16_1574] |= 0x800;
_toolbox->MoveTo(
@@ -1211,7 +1198,6 @@ void FoolGame::mazeAddWallBottom() {
}
void FoolGame::mazeDrawWallLeft() {
- warning(__func__);
// 136:2d4c
_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left - 2,
@@ -1224,7 +1210,6 @@ void FoolGame::mazeDrawWallLeft() {
}
void FoolGame::mazeDrawWallTop() {
- warning(__func__);
// 136:2dd0
_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left + 3,
@@ -1237,7 +1222,6 @@ void FoolGame::mazeDrawWallTop() {
}
void FoolGame::mazeDrawWallRight() {
- warning(__func__);
// 136:2e52
_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].right - 3,
@@ -1250,7 +1234,6 @@ void FoolGame::mazeDrawWallRight() {
}
void FoolGame::mazeDrawWallBottom() {
- warning(__func__);
// 136:2ed6
_toolbox->MoveTo(
_screenGrid[var_i16_1bd8].left + 3,
Commit: 0b338a70eae2833b663c6e574b453ba52cc34379
https://github.com/scummvm/scummvm/commit/0b338a70eae2833b663c6e574b453ba52cc34379
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:35+02:00
Commit Message:
FOOL: Fix letter trails in finale
Changed paths:
engines/fool/fool_finale.cpp
diff --git a/engines/fool/fool_finale.cpp b/engines/fool/fool_finale.cpp
index 52a1fa058b2..1659099a700 100644
--- a/engines/fool/fool_finale.cpp
+++ b/engines/fool/fool_finale.cpp
@@ -988,6 +988,11 @@ void FoolPrologue::finaleRun() {
int16 y = (int16)smearMid[1];
// 131:3078
drawText(dialog, x, y);
+
+ // fudge factor
+ if ((k % 4) == 1) {
+ _toolbox->Delay(0);
+ }
}
_zbasic->text(kPrologueFontFool, 0xc, 0, Graphics::MacToolbox::kSrcOr);
drawText(dialog, smears[i].xEnd, smears[i].yEnd);
Commit: 26fb10390e7893a31a4453b9b018443feef9629b
https://github.com/scummvm/scummvm/commit/26fb10390e7893a31a4453b9b018443feef9629b
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:36+02:00
Commit Message:
COMMON: Add MacResMan::writeMacBinary
Changed paths:
common/macresman.cpp
common/macresman.h
diff --git a/common/macresman.cpp b/common/macresman.cpp
index 5b89ba7649f..72f7a8eb127 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -27,6 +27,7 @@
#include "common/fs.h"
#include "common/macresman.h"
#include "common/md5.h"
+#include "common/memstream.h"
#include "common/substream.h"
#include "common/textconsole.h"
#include "common/archive.h"
@@ -429,6 +430,61 @@ SeekableReadStream * MacResManager::openFileOrDataFork(const Path &fileName, Arc
return nullptr;
}
+void MacResManager::writeMacBinary(SeekableWriteStream *outStream, SeekableReadStream *dataFork, SeekableReadStream *resourceFork, const Common::String &name, const MacFinderInfo &info, TimeDate *created, TimeDate *modified) {
+ if (!outStream)
+ return;
+
+ Common::MemoryWriteStreamDynamic buffer(DisposeAfterUse::YES);
+
+ buffer.writeByte(0);
+ Common::String nameLimit = name.substr(0, 63);
+ buffer.writeByte((byte)nameLimit.size());
+ buffer.writeString(nameLimit);
+ for (int i = 0; i < (63 - (int)nameLimit.size()); i++) {
+ buffer.writeByte(0);
+ }
+ buffer.writeUint32BE(info.type);
+ buffer.writeUint32BE(info.creator);
+ buffer.writeUint16BE(info.flags);
+ buffer.writeUint16BE(info.position.y);
+ buffer.writeUint16BE(info.position.x);
+ buffer.writeUint16BE(0); // folder_id
+ buffer.writeUint16BE(0); // flags2
+ buffer.writeUint32BE(dataFork ? dataFork->size() : 0);
+ buffer.writeUint32BE(resourceFork ? resourceFork->size() : 0);
+ TimeDate now;
+ g_system->getTimeAndDate(now);
+ if (!created) {
+ created = &now;
+ }
+ if (!modified) {
+ modified = &now;
+ }
+ // fixed offset between unix epoch (1970-01-01 00:00) and macintosh HFS epoch (1904-01-01 00:00)
+ buffer.writeUint32BE((uint32)(DateTime::dateTimeToInt64(*created) + 2082844800));
+ buffer.writeUint32BE((uint32)(DateTime::dateTimeToInt64(*modified) + 2082844800));
+
+ while (buffer.pos() < 0x7a)
+ buffer.writeByte(0);
+
+ buffer.writeByte(0x81); // macbinary version
+ buffer.writeByte(0x81); // minimum macbinary version required
+ CRC_BINHEX crc;
+ uint16 checksum = crc.crcFast(buffer.getData(), 0x7c);
+ buffer.writeUint16BE(checksum);
+ buffer.writeUint16BE(0);
+
+ outStream->write(buffer.getData(), 0x80);
+ if (dataFork) {
+ outStream->writeStream(dataFork);
+ while ((outStream->pos() % 0x80) != 0)
+ outStream->writeByte(0);
+ }
+ if (resourceFork) {
+ outStream->writeStream(resourceFork);
+ }
+}
+
bool MacResManager::exists(const Path &fileName) {
// Try the file name by itself
diff --git a/common/macresman.h b/common/macresman.h
index 8df2ded4f9e..10fed168437 100644
--- a/common/macresman.h
+++ b/common/macresman.h
@@ -166,6 +166,11 @@ public:
*/
static SeekableReadStream *openDataForkFromMacBinary(SeekableReadStream *inStream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO);
+ /**
+ * Write macbinary data to a stream.
+ */
+ static void writeMacBinary(SeekableWriteStream *outStream, SeekableReadStream *dataFork, SeekableReadStream *resourceFork, const Common::String &name, const MacFinderInfo &info, TimeDate *created = nullptr, TimeDate *modified = nullptr);
+
/**
* See if a Mac data/resource fork pair exists.
* @param fileName The base file name of the file
Commit: 4debf0312801cd02e87c9329b4e6a8addb9ae76c
https://github.com/scummvm/scummvm/commit/4debf0312801cd02e87c9329b4e6a8addb9ae76c
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:36+02:00
Commit Message:
FOOL: Output MacBinary save files compatible with original game
Changed paths:
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/zbasic.cpp
engines/fool/zbasic.h
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index aeb05a2bd9c..ecd91734a91 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -1300,7 +1300,7 @@ void FoolGame::menuNewGame() {
}
-void FoolGame::sub_128_2808() {
+void FoolGame::writeSaveFile() {
// 128:2808
var_i16_7e6 = 0;
// 128:280e: LEA - [0x3808],A0
@@ -1347,7 +1347,7 @@ void FoolGame::menuOpenGame() {
if (var_str_588.empty()) { // was: str(22)
return;
}
- sub_128_2808();
+ writeSaveFile();
if (var_str_588.empty()) { // was: str(23)
return;
}
@@ -1712,7 +1712,7 @@ void FoolGame::saveGame() {
var_i16_7e6 = 0;
// 128:359e: LEA - [0x3808],A0
// 128:35a2: MOVE.L - A0,-0x8ee(A5)
- _zbasic->defOpen(Common::U32String("FOOLgf87")); // str(59)
+ _zbasic->defOpen(Common::String("FOOLgf87")); // str(59)
_zbasic->openW(2, _saveFileName, 0x400, var_i16_9ec);
if (var_i16_7e6 != 0xa) {
@@ -2835,7 +2835,7 @@ void FoolGame::sub_129_068() {
var_i16_f22 = var_i16_688;
} else {
// 129:052e
- sub_128_2808();
+ writeSaveFile();
if (!var_str_588.empty()) { // was: str(129)
// 129:054c
_saveFileName = var_str_588;
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 7518121a97d..8cf731dee78 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -151,7 +151,7 @@ public:
void sub_128_26f6();
void fetchPuzzleData(); // sub_128_271a
void menuNewGame(); // sub_128_27d6
- void sub_128_2808();
+ void writeSaveFile(); // sub_128_2808
void menuOpenGame(); // sub_128_2988
void menuSaveGame(); // sub_128_2a06
void saveGameAs(); // sub_128_2a0e
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 796fd88a221..8b8e6cb0b58 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -25,7 +25,9 @@
#include "common/savefile.h"
#include "common/str-enc.h"
#include "common/stream.h"
+#include "common/substream.h"
#include "common/tokenizer.h"
+#include "common/types.h"
#include "common/ustr.h"
#include "fool/fool.h"
@@ -232,20 +234,42 @@ void ZBasic::close(int16 fileNo) {
_fileStreams.erase(fileNo);
}
if (_fileWriteStreams.contains(fileNo)) {
+ if (_fileWriteSaveStreams.contains(fileNo) && _filePaths.contains(fileNo)) {
+ Common::MacResManager resMan;
+ Common::MemoryReadStream ms(_fileWriteStreams[fileNo]->getData(), _fileWriteStreams[fileNo]->size(), DisposeAfterUse::NO);
+ Common::MacFinderInfo info;
+ info.creator = _fileCreator;
+ info.type = _fileType;
+ resMan.writeMacBinary(_fileWriteSaveStreams[fileNo].get(), &ms, nullptr, _filePaths[fileNo].toString(':'), info);
+ }
+ _fileWriteStreams[fileNo]->finalize();
_fileWriteStreams.erase(fileNo);
}
+ if (_fileWriteSaveStreams.contains(fileNo)) {
+ _fileWriteSaveStreams[fileNo]->finalize();
+ _fileWriteSaveStreams.erase(fileNo);
+ }
if (_fileLineSize.contains(fileNo)) {
_fileLineSize.erase(fileNo);
}
+ if (_filePaths.contains(fileNo)) {
+ _filePaths.erase(fileNo);
+ }
}
void ZBasic::coordinateWindow() {
warning("STUB: ZBasic::coordinateWindow");
}
-void ZBasic::defOpen(const Common::U32String &str) {
- _fileType = str.substr(0, 4).encode(Common::kMacRoman);
- _fileCreator = str.substr(4, 4).encode(Common::kMacRoman);
+void ZBasic::defOpen(const Common::String &str) {
+ Common::String fileType = str.substr(0, 4);
+ while (fileType.size() < 4)
+ fileType.append(0);
+ _fileType = ((uint32)fileType[0] << 24) + ((uint32)fileType[1] << 16) + ((uint32)fileType[2] << 8) + (uint32)fileType[3];
+ Common::String fileCreator = str.substr(4, 4);
+ while (fileCreator.size() < 4)
+ fileCreator.append(0);
+ _fileCreator = ((uint32)fileCreator[0] << 24) + ((uint32)fileCreator[1] << 16) + ((uint32)fileCreator[2] << 8) + (uint32)fileCreator[3];
}
void ZBasic::get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::BitMap &dest, bool preserveDims) {
@@ -411,37 +435,43 @@ void ZBasic::midStrSet(Common::String &target, int16 expr1, int16 expr2, const C
void ZBasic::openR(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
- if (_fileStreams.contains(fileNo)) {
- close(fileNo);
- }
+ close(fileNo);
Common::MacResManager resMan;
Common::SaveFileManager *saves = g_system->getSavefileManager();
// first load from the save manager
Common::SeekableReadStream *result = saves->openForLoading(fileName.encode());
+ Common::Path path(fileName, ':');
if (!result) {
// if that fails, load from the filesystem
- result = resMan.openFileOrDataFork(Common::Path(fileName, ':'));
+ result = resMan.openFileOrDataFork(path);
+ } else {
+ bool isMacBinary = resMan.isMacBinary(*result);
+ result->seek(0);
+ if (isMacBinary) {
+ result = resMan.openDataForkFromMacBinary(result, DisposeAfterUse::YES);
+ }
}
if (!result) {
error("ZBasic::openR: couldn't open %s", fileName.encode().c_str());
}
+ result->seek(0);
+ _filePaths[fileNo] = path;
_fileStreams[fileNo] = Common::SharedPtr<Common::SeekableReadStream>(result);
- _fileWriteStreams[fileNo] = nullptr;
_fileLineSize[fileNo] = lineSize;
}
void ZBasic::openW(int16 fileNo, const Common::U32String &fileName, uint32 lineSize, int16 volNo) {
- if (_fileStreams.contains(fileNo)) {
- close(fileNo);
- }
+ close(fileNo);
Common::MacResManager resMan;
Common::SaveFileManager *saves = g_system->getSavefileManager();
Common::SeekableWriteStream *result = saves->openForSaving(fileName, false);
+ Common::Path path(fileName, ':');
if (!result) {
error("ZBasic::openW: couldn't open %s", fileName.encode().c_str());
}
- _fileStreams[fileNo] = nullptr;
- _fileWriteStreams[fileNo] = Common::SharedPtr<Common::SeekableWriteStream>(result);
+ _filePaths[fileNo] = path;
+ _fileWriteStreams[fileNo] = Common::SharedPtr<Common::MemoryWriteStreamDynamic>(new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES));
+ _fileWriteSaveStreams[fileNo] = Common::SharedPtr<Common::SeekableWriteStream>(result);
_fileLineSize[fileNo] = lineSize;
}
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index ccf6ffd31ac..e992fdb080c 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -23,6 +23,7 @@
#define FOOL_ZBASIC_H
#include "common/memorypool.h"
+#include "common/memstream.h"
#include "common/ptr.h"
#include "common/str.h"
#include "common/stream.h"
@@ -214,13 +215,15 @@ private:
Graphics::MacToolbox::GrafPtr _defaultPort;
+ Common::HashMap<int16, Common::Path> _filePaths;
Common::HashMap<int16, Common::SharedPtr<Common::SeekableReadStream>> _fileStreams;
- Common::HashMap<int16, Common::SharedPtr<Common::SeekableWriteStream>> _fileWriteStreams;
+ Common::HashMap<int16, Common::SharedPtr<Common::MemoryWriteStreamDynamic>> _fileWriteStreams;
+ Common::HashMap<int16, Common::SharedPtr<Common::SeekableWriteStream>> _fileWriteSaveStreams;
Common::HashMap<int16, uint32> _fileLineSize;
Common::HashMap<int16, Common::Array<Common::String>> _index;
- Common::String _fileType;
- Common::String _fileCreator;
+ uint32 _fileType;
+ uint32 _fileCreator;
public:
@@ -239,7 +242,7 @@ public:
Common::U32String chr(uint16 code);
void close(int16 fileNo);
void coordinateWindow();
- void defOpen(const Common::U32String &str);
+ void defOpen(const Common::String &str);
void get(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::BitMap &dest, bool preserveDims = false);
int16 instr(int16 expression, const Common::U32String &string1, const Common::U32String &string2);
int16 instr(int16 expression, const Common::String &string1, const Common::String &string2);
@@ -311,6 +314,7 @@ public:
int16 getFileId() { return _fileId; }
void injectFOND(const byte *data, const size_t size, const Common::String &name);
void setMenuFont(uint16 font, uint16 size);
+
};
} // namespace Fool
Commit: f7b4217cd96af4f94d6ba5c4195a3fe4dc57f810
https://github.com/scummvm/scummvm/commit/f7b4217cd96af4f94d6ba5c4195a3fe4dc57f810
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:36+02:00
Commit Message:
FOOL: Use INFINITY instead of bithacks
Changed paths:
engines/fool/zbasic.h
diff --git a/engines/fool/zbasic.h b/engines/fool/zbasic.h
index e992fdb080c..50f9c1b200a 100644
--- a/engines/fool/zbasic.h
+++ b/engines/fool/zbasic.h
@@ -86,9 +86,9 @@ struct ZBasicBCD {
DoubleBits result = { 0 };
int64 expSigned = this->exponent <= 0x3fff ? (int64)this->exponent : ((int64)this->exponent - 0x8000);
if (expSigned > 0x7ff) {
- result.i = 0x7ff0000000000000; // +inf
+ result.d = INFINITY;
} else if (expSigned < -0x800) {
- result.i = 0xfff0000000000000; // -inf
+ result.d = -INFINITY;
} else {
int sign = expSigned < 0 ? -1 : 1;
uint64 mantissaRaw = this->mantissaBits;
Commit: 257e0e00c015c377ceb1970bc0856da6f1c70ec2
https://github.com/scummvm/scummvm/commit/257e0e00c015c377ceb1970bc0856da6f1c70ec2
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:37+02:00
Commit Message:
MACTOOLBOX: Fix compile error
Changed paths:
graphics/mactoolbox/toolbox.h
diff --git a/graphics/mactoolbox/toolbox.h b/graphics/mactoolbox/toolbox.h
index b627a3fbeb4..d4bcf153035 100644
--- a/graphics/mactoolbox/toolbox.h
+++ b/graphics/mactoolbox/toolbox.h
@@ -276,8 +276,10 @@ typedef size_t Size;
}; // namespace MacToolbox
}; // namespace Graphics
+namespace Common {
+
template<>
-struct Common::Hash<Graphics::MacToolbox::Handle> {
+struct Hash<Graphics::MacToolbox::Handle> {
uint operator()(const Graphics::MacToolbox::Handle& h) const {
void *target = h.get();
uint result;
@@ -287,7 +289,7 @@ struct Common::Hash<Graphics::MacToolbox::Handle> {
};
template<>
-struct Common::Hash<Graphics::MacToolbox::PicHandle> {
+struct Hash<Graphics::MacToolbox::PicHandle> {
uint operator()(const Graphics::MacToolbox::PicHandle& h) const {
void *target = h.get();
uint result;
@@ -296,6 +298,8 @@ struct Common::Hash<Graphics::MacToolbox::PicHandle> {
}
};
+}; // namespace Common
+
namespace Graphics {
namespace MacToolbox {
Commit: c2a6ac61c895147a6fda99cbf707cff4935159be
https://github.com/scummvm/scummvm/commit/c2a6ac61c895147a6fda99cbf707cff4935159be
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:37+02:00
Commit Message:
FOOL: Fix maze save game logic
Changed paths:
engines/fool/fool_maze.cpp
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index edf993ecbe1..ba7431c1d37 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -1247,8 +1247,8 @@ void FoolGame::mazeDrawWallBottom() {
void FoolGame::mazeStoreState() {
// 136:2f5c
- // for the endgame maze, there's specific code to not save the puzzle state
- if (!((_activePuzzle != 0x57) && (!_activePuzzleSolved))) {
+ // don't save the puzzle state if solved, except for the metapuzzle maze
+ if ((_activePuzzle != 0x57) && (_activePuzzleSolved)) {
_activePuzzleBuffer.clear(); // was: str(OFF(35))
return;
}
Commit: 4fd79d496bd2f318ca1079ca1e024fad628487ef
https://github.com/scummvm/scummvm/commit/4fd79d496bd2f318ca1079ca1e024fad628487ef
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:37+02:00
Commit Message:
FOOL: Use standard save system instead of FileBrowserDialog
Changed paths:
engines/fool/fool.cpp
engines/fool/fool_game.cpp
engines/fool/fool_game.h
engines/fool/fool_jumble.cpp
engines/fool/metaengine.cpp
diff --git a/engines/fool/fool.cpp b/engines/fool/fool.cpp
index f007fb1163d..455613883b9 100644
--- a/engines/fool/fool.cpp
+++ b/engines/fool/fool.cpp
@@ -69,7 +69,13 @@ Common::Error FoolEngine::run() {
version = kFool30;
}
- FoolGame fg(version);
+ int startSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
+ Common::String startSaveFileName;
+ if (startSlot != -1) {
+ startSaveFileName = g_engine->getMetaEngine()->getSavegameFile(startSlot, getGameId().c_str());
+ }
+
+ FoolGame fg(version, startSaveFileName);
fg.run();
return Common::kNoError;
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index ecd91734a91..47ccb2d3c60 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -20,11 +20,11 @@
*/
#include "common/endian.h"
-#include "common/memstream.h"
+#include "common/translation.h"
#include "common/ustr.h"
#include "common/util.h"
#include "graphics/mactoolbox/toolbox.h"
-#include "gui/filebrowser-dialog.h"
+#include "gui/saveload.h"
#include "fool/fool.h"
#include "fool/fool_game.h"
@@ -91,15 +91,34 @@ static const byte fondSmall[] = {
};
Common::String getFileNameFromModal(bool save, const Common::String &suggested, const Common::String &title) {
- Common::String prefix = g_engine->getGameId() + '-';
- Common::String mask = prefix + "*";
- GUI::FileBrowserDialog browser(title.c_str(), "fool", save ? GUI::kFBModeSave : GUI::kFBModeLoad, mask.c_str(), suggested.c_str());
- if (browser.runModal() <= 0) {
- return Common::String();
- }
- Common::String result = browser.getResult();
- if (!result.empty() && !result.hasPrefixIgnoreCase(prefix))
- result = prefix + result;
+ Common::String target = g_engine->getGameId();
+ Common::String result;
+ GUI::SaveLoadChooser chooser(title, Common::U32String(save ? _("Save") : _("Open")), save);
+ int slot = chooser.runModalWithCurrentTarget();
+ if (slot != -1) {
+ Common::String existing = g_engine->getMetaEngine()->getSavegameFile(slot, target.c_str());
+
+ if (save) {
+ // little bit of a hack; because the description is in the filename,
+ // we need to manually delete any existing save in that slot
+ g_engine->getMetaEngine()->removeSaveState(target.c_str(), slot);
+ Common::String intermediate = chooser.getResultString();
+ Common::String desc;
+ // because windows is bad, strip out any challenging characters
+ const char *ptr = intermediate.c_str();
+ const char *end = intermediate.c_str() + intermediate.size();
+ while (ptr < end) {
+ if (Common::isAlnum(*ptr) || (*ptr == ' ') || (*ptr == '-') || (*ptr == '_') || (*ptr == '.')) {
+ desc += *ptr;
+ }
+ ptr++;
+ }
+ result = Common::String::format("%s-%s.%03d", target.c_str(), desc.c_str(), slot);
+ } else {
+ result = existing;
+ }
+ }
+
return result;
}
@@ -357,7 +376,7 @@ void FoolGame::copyScreen(int16 put, BitMap &bmp) {
// 128:00a2
// the original code would use the memory at 5dfc + 2*arg2.
// to make this less bad, our version passes a BitMap pointer
- warning("copyScreen: put %d, bmp %p", put, (void *)&bmp);
+ debugC(5, kDebugGraphics, "FoolGame::copyScreen: put %d, bmp %p", put, (void *)&bmp);
if (put == 0) {
_zbasic->get(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bmp);
}
@@ -1681,7 +1700,7 @@ void FoolGame::autoSaveGame() {
// This wrapper changes the autosave behaviour to match the rest of ScummVM.
_isAutoSaving = true;
Common::U32String previous = _saveFileName;
- _saveFileName = Common::U32String::format("%s-Autosave", g_engine->getGameId().c_str());
+ _saveFileName = Common::U32String::format("%s-Autosave.000", g_engine->getGameId().c_str());
saveGame();
_saveFileName = previous;
_isAutoSaving = false;
@@ -2827,8 +2846,13 @@ void FoolGame::sub_129_068() {
var_str_e22.clear(); // was: str(124);
_saveFileName.clear(); // was: str(125);
- var_i16_484 = _zbasic->finderInfo(var_i16_7e4, var_str_588, var_i32_f28, var_i16_688);
+ // Check if the game was started from a saved file.
+ // Originally this would call the ZBasic FINDERINFO command, which returns
+ // the name of the save file (if one was used to open the game).
+
+ //var_i16_484 = _zbasic->finderInfo(var_i16_7e4, var_str_588, var_i32_f28, var_i16_688);
+ var_str_588 = _startSaveFileName;
if (!var_str_588.empty()) { // was: str(126)
if (var_str_588 == Common::U32String("Fool's Puzzles")) { // was: str(127)
var_str_e22 = Common::U32String("Fool's Puzzles"); // was: str(128)
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 8cf731dee78..87d7160758d 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -103,7 +103,7 @@ enum FoolFontID : uint16 {
class FoolGame {
public:
- FoolGame(FoolVersion version): _version(version) {}
+ FoolGame(FoolVersion version, const Common::String &saveFileName): _version(version), _startSaveFileName(saveFileName) {}
~FoolGame() {}
void run();
@@ -469,6 +469,7 @@ private:
const int *_zstrOffset;
Toolbox *_toolbox;
ZBasic *_zbasic;
+ Common::String _startSaveFileName;
bool _quit = false;
GrafPtr var_i32_0;
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 49676bae876..09921924bee 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -418,7 +418,6 @@ void FoolGame::jumbleStoreState() {
}
void FoolGame::jumbleRunRearrange() {
- warning(__func__);
// 130:0d2e
sub_130_1426();
sub_128_61ec();
@@ -435,7 +434,6 @@ void FoolGame::jumbleRunRearrange() {
}
void FoolGame::jumbleRunSubstitution() {
- warning(__func__);
// 130:0d90
// substitution cipher
if (!_zbasic->index(1, 1).empty()) { // was: str(177)
@@ -523,7 +521,6 @@ void FoolGame::sub_130_1004() {
}
void FoolGame::jumbleRunWordSquare() {
- warning(__func__);
// 130:10a6
// word square
sub_130_1426();
@@ -552,7 +549,6 @@ void FoolGame::jumbleRunWordSquare() {
}
void FoolGame::jumbleRunHiddenMessage() {
- warning(__func__);
// 130:1282
// hidden message, change the mouse cursor
_jumblePosition = _zbasic->instr(1, var_str_1070, Common::U32String(" ")); // was: str(182)
@@ -615,7 +611,6 @@ void FoolGame::sub_130_1426() {
}
void FoolGame::jumbleOnClick() {
- warning(__func__);
// 130:1476
getGridFromMouse(_jumbleGridPos.x, _jumbleGridPos.y);
if ((_jumbleGridPos.x < 1) || (_jumbleGridPos.x > arr_i16_1eb8[0]) || (_jumbleGridPos.y < 1) || (_jumbleGridPos.y > arr_i16_1eb8[1])) {
@@ -656,7 +651,6 @@ void FoolGame::jumbleOnClick() {
}
void FoolGame::jumbleOnKey() {
- warning(__func__);
// 130:15da
if ((_keyLastPressed == 3) || (_keyLastPressed == 0xd)) {
jumbleSelectSquare();
@@ -832,7 +826,6 @@ void FoolGame::sub_130_1c1a() {
}
void FoolGame::jumbleSelectSquare() {
- warning(__func__);
// 130:1c52
_toolbox->InvertRect(_screenGrid[_jumbleSelected]);
}
diff --git a/engines/fool/metaengine.cpp b/engines/fool/metaengine.cpp
index 4b4d75f8116..66fcceb72b8 100644
--- a/engines/fool/metaengine.cpp
+++ b/engines/fool/metaengine.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/savefile.h"
#include "common/translation.h"
#include "fool/detection.h"
@@ -56,6 +57,11 @@ public:
*/
bool hasFeature(MetaEngineFeature f) const override;
+ SaveStateList listSaves(const char *target) const override;
+ int getMaximumSaveSlot() const override { return 999; }
+ Common::String getSavegameFile(int saveGameIdx, const char *target) const override;
+ bool removeSaveState(const char *target, int slot) const override;
+
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
};
@@ -73,10 +79,47 @@ Common::Error FoolMetaEngine::createInstance(OSystem *syst, Engine **engine, con
}
bool FoolMetaEngine::hasFeature(MetaEngineFeature f) const {
- return checkExtendedSaves(f) ||
+ return (f == kSupportsListSaves) ||
+ (f == kSupportsDeleteSave) ||
(f == kSupportsLoadingDuringStartup);
}
+SaveStateList FoolMetaEngine::listSaves(const char *target) const {
+ if (!target)
+ target = getName();
+ SaveStateList result;
+
+ Common::SaveFileManager *saveMan = g_system->getSavefileManager();
+ Common::StringArray filenames = saveMan->listSavefiles(getSavegameFilePattern(target));
+ for (const Common::String &f : filenames) {
+ int slot = atoi(f.c_str() + f.size() - 3);
+ Common::String desc = f.substr(strlen(target) + 1, f.size() - strlen(target) - 1 - 4);
+ result.push_back(SaveStateDescriptor(this, slot, desc));
+ }
+ Common::sort(result.begin(), result.end(), SaveStateDescriptorSlotComparator());
+
+ return result;
+}
+
+Common::String FoolMetaEngine::getSavegameFile(int saveGameIdx, const char *target) const {
+ if (!target)
+ target = getName();
+ if (saveGameIdx == kSavegameFilePattern)
+ return Common::String::format("%s-*.###", target);
+ Common::SaveFileManager *saveMan = g_system->getSavefileManager();
+ Common::StringArray arr = saveMan->listSavefiles(Common::String::format("%s-*.%03d", target, saveGameIdx));
+ if (!arr.empty()) {
+ return arr.front();
+ }
+
+ return Common::String::format("%s-game.%03d", target, saveGameIdx);
+}
+
+bool FoolMetaEngine::removeSaveState(const char *target, int slot) const {
+ return g_system->getSavefileManager()->removeSavefile(getSavegameFile(slot, target));
+}
+
+
#if PLUGIN_ENABLED_DYNAMIC(FOOL)
REGISTER_PLUGIN_DYNAMIC(FOOL, PLUGIN_TYPE_ENGINE, FoolMetaEngine);
#else
Commit: 7a91f04770f04c50a357462b7f7a764de5b33d12
https://github.com/scummvm/scummvm/commit/7a91f04770f04c50a357462b7f7a764de5b33d12
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:38+02:00
Commit Message:
FOOL: Use punycode to allow non-ASCII game descriptions
Changed paths:
engines/fool/fool_game.cpp
engines/fool/metaengine.cpp
diff --git a/engines/fool/fool_game.cpp b/engines/fool/fool_game.cpp
index 47ccb2d3c60..a556b560cb0 100644
--- a/engines/fool/fool_game.cpp
+++ b/engines/fool/fool_game.cpp
@@ -20,6 +20,7 @@
*/
#include "common/endian.h"
+#include "common/punycode.h"
#include "common/translation.h"
#include "common/ustr.h"
#include "common/util.h"
@@ -102,16 +103,11 @@ Common::String getFileNameFromModal(bool save, const Common::String &suggested,
// little bit of a hack; because the description is in the filename,
// we need to manually delete any existing save in that slot
g_engine->getMetaEngine()->removeSaveState(target.c_str(), slot);
- Common::String intermediate = chooser.getResultString();
- Common::String desc;
- // because windows is bad, strip out any challenging characters
- const char *ptr = intermediate.c_str();
- const char *end = intermediate.c_str() + intermediate.size();
- while (ptr < end) {
- if (Common::isAlnum(*ptr) || (*ptr == ' ') || (*ptr == '-') || (*ptr == '_') || (*ptr == '.')) {
- desc += *ptr;
- }
- ptr++;
+ Common::String desc = chooser.getResultString();
+ // because windows is bad, and we need to encode the description in
+ // the filename, use punycode for forbidden characters
+ if (Common::punycode_needEncode(desc)) {
+ desc = Common::punycode_encodefilename(desc.decode());
}
result = Common::String::format("%s-%s.%03d", target.c_str(), desc.c_str(), slot);
} else {
diff --git a/engines/fool/metaengine.cpp b/engines/fool/metaengine.cpp
index 66fcceb72b8..674225b1f32 100644
--- a/engines/fool/metaengine.cpp
+++ b/engines/fool/metaengine.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/punycode.h"
#include "common/savefile.h"
#include "common/translation.h"
@@ -93,7 +94,10 @@ SaveStateList FoolMetaEngine::listSaves(const char *target) const {
Common::StringArray filenames = saveMan->listSavefiles(getSavegameFilePattern(target));
for (const Common::String &f : filenames) {
int slot = atoi(f.c_str() + f.size() - 3);
- Common::String desc = f.substr(strlen(target) + 1, f.size() - strlen(target) - 1 - 4);
+ Common::String descOrig = f.substr(strlen(target) + 1, f.size() - strlen(target) - 1 - 4);
+ Common::String desc = Common::punycode_decodefilename(descOrig);
+ if (desc.empty())
+ desc = descOrig;
result.push_back(SaveStateDescriptor(this, slot, desc));
}
Common::sort(result.begin(), result.end(), SaveStateDescriptorSlotComparator());
Commit: e421b49280791098e50602409d82ee4ba43f55b2
https://github.com/scummvm/scummvm/commit/e421b49280791098e50602409d82ee4ba43f55b2
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:38+02:00
Commit Message:
MACGUI: Add custom checkmarks for menu items
Changed paths:
graphics/macgui/macmenu.cpp
graphics/macgui/macmenu.h
graphics/mactoolbox/toolbox.h
graphics/mactoolbox/toolbox_menu.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index afd0273f686..16f0b1de21c 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -44,7 +44,8 @@ enum {
kMenuLeftMargin = 7,
kMenuSpacing = 13,
kMenuPadding = 16,
- kMenuDropdownPadding = 14,
+ kMenuLeftDropdownPadding = 17,
+ kMenuRightDropdownPadding = 11,
kMenuDropdownItemHeight = 16,
kMenuItemHeight = 20,
kMenuWin95LeftDropdownPadding = 34,
@@ -106,8 +107,8 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_menuRightDropdownPadding = kMenuWin95RightDropdownPadding;
} else {
_menuDropdownItemHeight = kMenuDropdownItemHeight;
- _menuLeftDropdownPadding = kMenuDropdownPadding;
- _menuRightDropdownPadding = kMenuDropdownPadding;
+ _menuLeftDropdownPadding = kMenuLeftDropdownPadding;
+ _menuRightDropdownPadding = kMenuRightDropdownPadding;
}
if (_wm->_mode & kWMModeAutohideMenu)
@@ -1262,10 +1263,12 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
if (menu->items[i]->checked) {
const Font *font = getMenuFont(menu->items[i]->style);
- int checkSymbol = _wm->_fontMan->hasBuiltInFonts() ? 0xD7 : 18;
+ int checkSymbol = menu->items[i]->checkSymbol;
+ if (!checkSymbol)
+ checkSymbol = _wm->_fontMan->hasBuiltInFonts() ? 0xD7 : 18;
int padding = _align == kTextAlignRight ? -_menuRightDropdownPadding: _menuLeftDropdownPadding;
- int offset = padding - font->getCharWidth(checkSymbol);
+ int offset = _align == kTextAlignRight ? padding - font->getCharWidth(checkSymbol) : 3;
// calculating the padding and offset, we draw the â at the center
font->drawChar(s, checkSymbol, tx - padding + offset, ty, color);
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 814d6e5b642..5e56ff27aa8 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -66,16 +66,17 @@ struct MacMenuItem {
int shortcutPos;
bool enabled;
bool checked;
+ int checkSymbol;
Common::Rect bbox;
MacMenuSubMenu *submenu;
- MacMenuItem(const Common::String &t, int a = -1, int s = 0, char sh = 0, int sp = -1, bool e = true, bool c = false) :
+ MacMenuItem(const Common::String &t, int a = -1, int s = 0, char sh = 0, int sp = -1, bool e = true, bool c = false, int cs = 0) :
text(t), unicode(false), action(a), style(s), shortcut(sh),
- shortcutPos(sp), enabled(e), submenu(nullptr), checked(c) {}
- MacMenuItem(const Common::U32String &t, int a = -1, int s = 0, char sh = 0, int sp = -1, bool e = true, bool c = false) :
+ shortcutPos(sp), enabled(e), submenu(nullptr), checked(c), checkSymbol(cs) {}
+ MacMenuItem(const Common::U32String &t, int a = -1, int s = 0, char sh = 0, int sp = -1, bool e = true, bool c = false, int cs = 0) :
unicodeText(t), unicode(true), action(a), style(s), shortcut(sh),
- shortcutPos(sp), enabled(e), submenu(nullptr), checked(c) {}
+ shortcutPos(sp), enabled(e), submenu(nullptr), checked(c), checkSymbol(cs) {}
~MacMenuItem() {
if (submenu)
diff --git a/graphics/mactoolbox/toolbox.h b/graphics/mactoolbox/toolbox.h
index d4bcf153035..47934fd05ab 100644
--- a/graphics/mactoolbox/toolbox.h
+++ b/graphics/mactoolbox/toolbox.h
@@ -826,6 +826,11 @@ public:
// string).
void EnableItem(MenuHandle &theMenu, uint16 item);
+ // PROCEDURE GetItemMark(theMenu: MenuHandle, item: INTEGER, VAR markChar: CHAR);
+ // GetItemMark returns in markChar whatever character the given menu item is marked with, or the
+ // predefined constant noMark if no mark is present
+ void GetItemMark(MenuHandle &theMenu, uint16 item, uint8 &markChar);
+
// FUNCTION GetMHandle(menuID: INTEGER): MenuHandle;
// Given the menu ID of a menu currentiy installed in the menu list, GetMHandle returns a handle to
// that menu; given any other menu ID, it returns NIL.
@@ -868,6 +873,12 @@ public:
// onâremain in effect. ItemString may be blank but should not be the empty string.
void SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String &itemString);
+ // PROCEDURE SetItemMark(theMenu: MenuHandle; item: INTEGER; markChar: CHAR);
+ // SetltemMark marks the given menu item in a more general manner than Checkltem. It allows you
+ // to place any character in the system font, not just the check mark, to the left of the item. The
+ // character is passed in the markChar parameter.
+ void SetItemMark(MenuHandle &theMenu, uint16 item, uint8 markChar);
+
// toolbox_pict.cpp
// PROCEDURE ClosePicture;
diff --git a/graphics/mactoolbox/toolbox_menu.cpp b/graphics/mactoolbox/toolbox_menu.cpp
index d51d8cbcf3f..d4cd0aa587d 100644
--- a/graphics/mactoolbox/toolbox_menu.cpp
+++ b/graphics/mactoolbox/toolbox_menu.cpp
@@ -147,6 +147,32 @@ void Toolbox::EnableItem(MenuHandle &theMenu, uint16 item) {
}
}
+void Toolbox::GetItemMark(MenuHandle &theMenu, uint16 item, uint8 &markChar) {
+ markChar = 0;
+ if (!theMenu) {
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::GetItemMark: empty menu handle");
+ return;
+ }
+ if (theMenu->menuData.size() < (uint)(item)) {
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::GetItemMark: item %d out of range for menu %d", item, theMenu->menuID);
+ return;
+ }
+ if (_defaultMenu) {
+ Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
+ if (sub) {
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item-1);
+ if (it && it->checked) {
+ if (it->checkSymbol) {
+ markChar = it->checkSymbol;
+ } else {
+ markChar = _wm->_fontMan->hasBuiltInFonts() ? 0xD7 : 18;
+ }
+ }
+ }
+ }
+
+}
+
MenuHandle Toolbox::GetMHandle(uint16 menuID) {
MenuHandle result;
@@ -271,6 +297,28 @@ void Toolbox::SetItem(MenuHandle &theMenu, uint16 item, const Common::U32String
}
}
+void Toolbox::SetItemMark(MenuHandle &theMenu, uint16 item, uint8 markChar) {
+ if (!theMenu) {
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::SetItemMark: empty menu handle");
+ return;
+ }
+ if (theMenu->menuData.size() < (uint)(item)) {
+ debugC(0, kDebugLevelMacToolbox, "Toolbox::SetItemMark: item %d out of range for menu %d", item, theMenu->menuID);
+ return;
+ }
+ if (_defaultMenu) {
+ Graphics::MacMenuItem *sub = _defaultMenu->getMenuItem(theMenu->menuID-1);
+ if (sub) {
+ Graphics::MacMenuItem *it = _defaultMenu->getSubMenuItem(sub, item-1);
+ if (it) {
+ it->checked = markChar != 0;
+ it->checkSymbol = markChar;
+ }
+ }
+ }
+
+}
+
} // End of namespace MacToolbox
} // End of namespace Graphics
Commit: 43cf2d5babeaae215aa270819d6979d3c691426a
https://github.com/scummvm/scummvm/commit/43cf2d5babeaae215aa270819d6979d3c691426a
Author: Scott Percival (code at moral.net.au)
Date: 2026-07-15T01:08:38+02:00
Commit Message:
FOOL: Move remaining warnings into debug level
Changed paths:
engines/fool/fool_game.h
engines/fool/fool_jumble.cpp
engines/fool/fool_maze.cpp
engines/fool/fool_thoth.cpp
engines/fool/zbasic.cpp
diff --git a/engines/fool/fool_game.h b/engines/fool/fool_game.h
index 87d7160758d..953ad23b038 100644
--- a/engines/fool/fool_game.h
+++ b/engines/fool/fool_game.h
@@ -314,7 +314,7 @@ public:
void sub_136_1650();
void mazeHiddenDoorOpen(); // sub_136_1756
void mazeHiddenDoorShut(); // sub_136_17a4
- void sub_136_1806();
+ void sub_136_1806(const Common::String &unk1);
void mazeSetTrigger(); // sub_136_185a
void mazeClearTrigger(); // sub_136_1898
void mazePickUpTone(); // sub_136_18f4
@@ -331,7 +331,7 @@ public:
void mazeLoadTone(int16 offset); // sub_136_24ae
void mazePlayTone(); // sub_136_2538
- void sub_136_2582(); // sub_136_2582
+ void sub_136_2582(const Common::String &unk1); // sub_136_2582
void mazeDrawPlayer(); // sub_136_2664
void mazeSetupMenu(); // sub_136_274e
void mazeAddWallLeft(); // sub_136_2a7c
diff --git a/engines/fool/fool_jumble.cpp b/engines/fool/fool_jumble.cpp
index 09921924bee..2d8876db90b 100644
--- a/engines/fool/fool_jumble.cpp
+++ b/engines/fool/fool_jumble.cpp
@@ -494,7 +494,7 @@ void FoolGame::jumbleRunSubstitution() {
}
void FoolGame::sub_130_1004() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:1004
_jumblePosition = _zbasic->instr(1, var_str_1070, Common::U32String(" ")); // was: str(181)
if (_jumblePosition == 0) {
@@ -598,7 +598,7 @@ void FoolGame::jumbleRunHiddenMessage() {
}
void FoolGame::sub_130_1426() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:1426
var_i16_187e = 0;
var_i16_1880 = 0;
@@ -703,7 +703,7 @@ void FoolGame::jumbleOnKey() {
}
void FoolGame::sub_130_172c() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:172c
// word square, disallow clicking the centre tile
if ((_jumbleGameType == 4) && (arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y] == 5)) {
@@ -748,7 +748,7 @@ void FoolGame::sub_130_172c() {
}
void FoolGame::sub_130_19ac() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:19ac
if (var_i16_187e > 0) {
_toolbox->InvertRect(_screenGrid[var_i16_187e]);
@@ -769,7 +769,7 @@ void FoolGame::jumbleClickFixedSquare() {
}
void FoolGame::sub_130_1a16() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:1a16
var_str_1374 = var_str_d12;
var_str_1474 = _zbasic->midStr(var_str_1070, _jumblePosition, 1);
@@ -819,7 +819,7 @@ void FoolGame::sub_130_1a16() {
}
void FoolGame::sub_130_1c1a() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:1c1a
_jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
_toolbox->InvertRect(_screenGrid[_jumbleSelected]);
@@ -831,7 +831,7 @@ void FoolGame::jumbleSelectSquare() {
}
void FoolGame::sub_130_1c6c() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
_toolbox->PenNormal();
_toolbox->FillRect(_screenGrid[_jumbleSelected], _patterns[var_i16_105e]);
_toolbox->PenPat(_patterns[var_i16_105c]);
@@ -866,7 +866,7 @@ void FoolGame::jumbleDrawLetter() {
}
void FoolGame::sub_130_1e5c() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:1e5c
_toolbox->PenNormal();
_toolbox->InvertRect(_screenGrid[_jumbleSelected]);
@@ -874,7 +874,7 @@ void FoolGame::sub_130_1e5c() {
}
void FoolGame::sub_130_1e76() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:1e76
arr_i16_4758[0] = _screenGrid[_jumbleSelected].top + 3;
arr_i16_4758[1] = _screenGrid[_jumbleSelected].left + 3;
@@ -903,7 +903,7 @@ void FoolGame::sub_130_1e76() {
}
void FoolGame::sub_130_201a() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:201a
_zbasic->midStrSet(var_str_1070, _jumblePosition, 1, var_str_d12);
if ((_activePuzzle > 0x50) && (_activePuzzle < 0x55)) {
@@ -935,7 +935,7 @@ void FoolGame::jumblePreviousPosition() {
}
void FoolGame::sub_130_20aa() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:20aa
jumbleSelectSquare();
_jumblePosition = arr_i16_3b38[_jumbleGridPos.x*32 + _jumbleGridPos.y];
@@ -944,7 +944,7 @@ void FoolGame::sub_130_20aa() {
void FoolGame::sub_130_20d2() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:20d2
_jumbleSelected = ABS(arr_i16_3738[_jumblePosition]);
jumbleSelectSquare();
@@ -962,7 +962,7 @@ Common::Point FoolGame::jumbleGetGridPos() {
}
void FoolGame::sub_130_2178() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:2178
if ((arr_i16_2f38[_jumbleGridPos.x*32 + _jumbleGridPos.y] == var_i16_1678) || (_jumbleGameType == 2))
return;
@@ -1053,7 +1053,7 @@ void FoolGame::jumbleDrawHintMetapuzzle() {
}
void FoolGame::sub_130_25d8() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 130:25d8
_zbasic->unk_20();
var_i16_188a = var_str_384.size();
@@ -1093,7 +1093,7 @@ void FoolGame::sub_130_25d8() {
}
void FoolGame::sub_130_2790() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
_zbasic->unk_20();
for (int16 i = 1; i <= 0x1a; i++) {
arr_i16_5bbc[i] = i;
diff --git a/engines/fool/fool_maze.cpp b/engines/fool/fool_maze.cpp
index ba7431c1d37..93bcc94e1c3 100644
--- a/engines/fool/fool_maze.cpp
+++ b/engines/fool/fool_maze.cpp
@@ -128,7 +128,7 @@ void FoolGame::mazeRun() {
var_i16_1bc8 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ac8, 3, 2));
if (var_i16_1bc8 != 666) {
for (int16 i = 1; i <= var_i16_1bc8; i++) {
- sub_136_2582();
+ sub_136_2582(var_str_1ac8);
}
}
// 136:0664
@@ -446,7 +446,7 @@ void FoolGame::mazeHotspot() {
mazeHiddenDoorShut();
break;
case 10: // M
- sub_136_1806();
+ sub_136_1806(var_str_1ac8);
break;
case 11: // O
mazeSetTrigger();
@@ -622,7 +622,7 @@ void FoolGame::mazeDrawLetter() {
void FoolGame::sub_136_137c() {
Common::String op = _zbasic->leftStr(var_str_1ce2, 1);
- warning("%s: op %s", __func__, op.c_str());
+ debugC(5, kDebugLoading, "%s: op %s", __func__, op.c_str());
// 136:137c
bool failed = false;
// has an inventory item
@@ -684,14 +684,14 @@ void FoolGame::sub_136_137c() {
}
void FoolGame::sub_136_163c() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:163c
var_i16_1bd8 = var_i16_1574;
var_i16_1bd6 = _zbasic->decodeInt(var_str_1ce2);
}
void FoolGame::sub_136_1650() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:1650
int16 index = _zbasic->decodeInt(var_str_1ce2);
Common::String data = _zbasic->indexRaw(1, index);
@@ -762,10 +762,10 @@ void FoolGame::mazeHiddenDoorShut() {
}
}
-void FoolGame::sub_136_1806() {
- warning(__func__);
+void FoolGame::sub_136_1806(const Common::String &unk1) {
+ debugC(5, kDebugLoading, __func__);
// 136:1806
- sub_136_2582();
+ sub_136_2582(unk1);
if ((arr_i16_3738[var_i16_1574] & 0x1000) != 0) {
arr_i16_3738[var_i16_1574] ^= 0x1000;
}
@@ -820,7 +820,7 @@ void FoolGame::mazeFireDemon() {
}
void FoolGame::sub_136_19d2() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:19d2
_toolbox->PenNormal();
_toolbox->PenMode(Graphics::MacToolbox::kPatXor);
@@ -1056,13 +1056,13 @@ void FoolGame::mazePlayTone() {
}
-void FoolGame::sub_136_2582() {
- warning(__func__);
+void FoolGame::sub_136_2582(const Common::String &unk1) {
+ debugC(5, kDebugLoading, __func__);
// 136:2582
var_i16_1df2 = 0;
- var_i16_1e06 = _zbasic->decodeInt(_zbasic->leftStr(var_str_1ac8, 2));
+ var_i16_1e06 = _zbasic->decodeInt(_zbasic->leftStr(unk1, 2));
for (int16 i = 1; i <= var_i16_1e06; i++) {
- var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(var_str_1ac8, i*2 + 3, 2));
+ var_i16_484 = _zbasic->decodeInt(_zbasic->midStr(unk1, i*2 + 3, 2));
if ((arr_i16_3738[var_i16_484] & 0x1000) == 0) {
var_i16_1df2++;
arr_i16_5bbc[var_i16_1df2] = var_i16_484;
@@ -1331,13 +1331,13 @@ void FoolGame::mazeStoreState() {
}
void FoolGame::sub_136_3408() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:3408
var_i16_1f08 |= _bitLUT[var_i16_1de6];
}
void FoolGame::sub_136_342a() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:342a
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
@@ -1490,7 +1490,7 @@ void FoolGame::mazeLoadState() {
}
void FoolGame::sub_136_3a30() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:3a30
var_i16_1de6++;
if (var_i16_1de6 > 0xf) {
@@ -1505,7 +1505,7 @@ void FoolGame::sub_136_3a30() {
}
void FoolGame::sub_136_3a70() {
- warning(__func__);
+ debugC(5, kDebugLoading, __func__);
// 136:3a70
if (_activePuzzle == 0x57) {
_activePuzzleStatus = 0x64;
diff --git a/engines/fool/fool_thoth.cpp b/engines/fool/fool_thoth.cpp
index 269e2f6ae82..c087f50fe18 100644
--- a/engines/fool/fool_thoth.cpp
+++ b/engines/fool/fool_thoth.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "fool/detection.h"
#include "graphics/mactoolbox/toolbox.h"
#include "fool/fool_game.h"
@@ -889,7 +890,7 @@ void FoolGame::thothKeyLast() {
copyScreen(1, arr_bmp_b3ec);
arr_i16_1eb8[1] = -1;
var_i16_1de6 = arr_i16_3b38[_hermitPathStage];
- warning("thothKeyLast: 1de6: %d, target: %d", var_i16_1de6, (arr_i16_3b38[0x20 + _hermitPathStage] + 1));
+ debugC(5, kDebugLoading, "thothKeyLast: 1de6: %d, target: %d", var_i16_1de6, (arr_i16_3b38[0x20 + _hermitPathStage] + 1));
// JMP 0x228c
while (((_stateFlags & kStateReturn) == 0) && !_activePuzzleSolved) {
// 140:20c2
@@ -961,7 +962,7 @@ void FoolGame::thothKeyLastOnClick() {
playTone(0x32 + (var_i16_1de6 * 5), 0x28, 0);
_toolbox->FillRect(_screenGrid[arr_i16_1eb8[0]], _patterns[2]);
var_i16_1de6++;
- warning("thothKeyLastOnClick: 1de6: %d, target: %d", var_i16_1de6, (arr_i16_3b38[0x20 + _hermitPathStage] + 1));
+ debugC(5, kDebugLoading, "thothKeyLastOnClick: 1de6: %d, target: %d", var_i16_1de6, (arr_i16_3b38[0x20 + _hermitPathStage] + 1));
}
}
// 140:2422
diff --git a/engines/fool/zbasic.cpp b/engines/fool/zbasic.cpp
index 8b8e6cb0b58..437c08da36b 100644
--- a/engines/fool/zbasic.cpp
+++ b/engines/fool/zbasic.cpp
@@ -226,7 +226,7 @@ Common::U32String ZBasic::chr(uint16 code) {
}
void ZBasic::bufferFlush(const Common::U32String &str) {
- warning("STUB: ZBasic::bufferFlush");
+ debugC(0, kDebugLoading, "STUB: ZBasic::bufferFlush");
}
void ZBasic::close(int16 fileNo) {
@@ -258,7 +258,7 @@ void ZBasic::close(int16 fileNo) {
}
void ZBasic::coordinateWindow() {
- warning("STUB: ZBasic::coordinateWindow");
+ debugC(0, kDebugLoading, "STUB: ZBasic::coordinateWindow");
}
void ZBasic::defOpen(const Common::String &str) {
@@ -306,13 +306,13 @@ int16 ZBasic::instr(int16 expression, const Common::String &string1, const Commo
}
Common::U32String ZBasic::files(int16 expression, const Common::U32String &prompt, const Common::U32String &defaultFilename, int16 &volume) {
- warning("STUB: ZBasic::files");
+ debugC(0, kDebugLoading, "STUB: ZBasic::files");
return Common::U32String();
}
int ZBasic::finderInfo(int16 &count, Common::U32String &var, uint32 &type, uint16 volume) {
- warning("STUB: ZBasic::finderInfo");
+ debugC(0, kDebugLoading, "STUB: ZBasic::finderInfo");
return 0;
}
@@ -345,11 +345,11 @@ void ZBasic::menu(uint16 menuNo, uint16 itemNo, uint16 state, const Common::U32S
_toolbox->CheckItem(handle, itemNo, false);
} else if (state == 2) {
_toolbox->EnableItem(handle, itemNo);
+ _toolbox->SetItemMark(handle, itemNo, 0);
_toolbox->CheckItem(handle, itemNo, true);
} else if (state >= 3) {
- warning("ZBasic::menu: custom checkmarks not supported");
_toolbox->EnableItem(handle, itemNo);
- _toolbox->CheckItem(handle, itemNo, true);
+ _toolbox->SetItemMark(handle, itemNo, (uint8)state);
}
} else {
warning("ZBasic::menu: no item %d in menu %d, ignoring", itemNo, menuNo);
@@ -495,7 +495,7 @@ void ZBasic::picture(int16 x, int16 y, Graphics::MacToolbox::PicHandle &src) {
}
void ZBasic::picture(int16 x1, int16 y1, int16 x2, int16 y2, Graphics::MacToolbox::PicHandle &src) {
- warning("STUB: ZBasic::picture");
+ debugC(0, kDebugLoading, "STUB: ZBasic::picture");
}
void ZBasic::put(int16 x, int16 y, Graphics::MacToolbox::BitMap &src, Graphics::MacToolbox::SourceMode mode) {
@@ -687,11 +687,11 @@ Common::U32String ZBasic::ucase(const Common::U32String &str) {
}
void ZBasic::window(int16 windowNumber, const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type) {
- warning("STUB: ZBasic::window");
+ debugC(0, kDebugLoading, "STUB: ZBasic::window");
}
void ZBasic::unk_4() {
- warning("STUB: ZBasic::unk_4");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_4");
}
int16 ZBasic::soundBusy() {
@@ -711,15 +711,15 @@ void ZBasic::sound(int16 frequency, int32 duration, int16 volume, int16 voice) {
}
void ZBasic::unk_8() {
- warning("STUB: ZBasic::unk_8");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_8");
}
void ZBasic::unk_11(int16 unk1) {
- warning("STUB: ZBasic::unk_11");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_11");
}
void ZBasic::unk_20() {
- warning("STUB: ZBasic::unk_20");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_20");
}
bool ZBasic::incrAndCheck(int16 &a0, int16 d1, int16 d0) {
@@ -728,7 +728,7 @@ bool ZBasic::incrAndCheck(int16 &a0, int16 d1, int16 d0) {
}
void ZBasic::unk_44(int16 unk1) {
- warning("STUB: ZBasic::unk_44");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_44");
}
void ZBasic::stringCopy(Common::U32String &target, const Common::U32String &src) {
@@ -776,11 +776,11 @@ Common::String ZBasic::encodeInt(uint16 data) {
}
void ZBasic::unk_130(int16 unk1) {
- warning("STUB: ZBasic::unk_130");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_130");
}
void ZBasic::unk_158() {
- warning("STUB: ZBasic::unk_158");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_158");
}
uint16 ZBasic::decodeInt(const Common::String &data) {
@@ -795,7 +795,7 @@ uint16 ZBasic::decodeInt(const Common::String &data) {
}
void ZBasic::unk_331(uint16 unk1, int16 unk2) {
- warning("STUB: ZBasic::unk_331");
+ debugC(0, kDebugLoading, "STUB: ZBasic::unk_331");
}
void ZBasic::indexClear(int16 table) {
More information about the Scummvm-git-logs
mailing list