[Scummvm-git-logs] scummvm master -> bf6bd39f696a6cef4ff51e98cbe857e59039e230
bluegr
noreply at scummvm.org
Mon Oct 21 00:15:16 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bf6bd39f69 ENGINES: moved scumm enhancements system into shared engine code
Commit: bf6bd39f696a6cef4ff51e98cbe857e59039e230
https://github.com/scummvm/scummvm/commit/bf6bd39f696a6cef4ff51e98cbe857e59039e230
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-21T03:15:13+03:00
Commit Message:
ENGINES: moved scumm enhancements system into shared engine code
Changed paths:
A engines/enhancements.h
engines/engine.cpp
engines/engine.h
engines/scumm/detection.h
engines/scumm/metaengine.cpp
engines/scumm/scumm.cpp
engines/scumm/scumm.h
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 5b697564c96..9d88f9c6803 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -193,6 +193,18 @@ Engine::Engine(OSystem *syst)
g_system->getPaletteManager()->setPalette(dummyPalette, 0, 256);
defaultSyncSoundSettings();
+
+ // Register original bug fixes as defaults...
+ ConfMan.registerDefault("enhancements", kEnhGameBreakingBugFixes | kEnhGrp1);
+ if (!ConfMan.hasKey("enhancements", _targetName)) {
+ if (ConfMan.hasKey("enable_enhancements", _targetName) && ConfMan.getBool("enable_enhancements", _targetName)) {
+ // Was the "enable_enhancements" key previously set to true?
+ // Convert it to a full activation of the enhancement flags then!
+ ConfMan.setInt("enhancements", kEnhGameBreakingBugFixes | kEnhGrp1 | kEnhGrp2 | kEnhGrp3 | kEnhGrp4);
+ }
+ }
+
+ _activeEnhancements = (int32)ConfMan.getInt("enhancements");
}
Engine::~Engine() {
@@ -215,6 +227,10 @@ void Engine::initializePath(const Common::FSNode &gamePath) {
SearchMan.addDirectory(gamePath, 0, 4);
}
+bool Engine::enhancementEnabled(int32 cls) {
+ return _activeEnhancements & cls;
+}
+
void initCommonGFX() {
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
diff --git a/engines/engine.h b/engines/engine.h
index 036245c69f1..641c90e2e3d 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -28,6 +28,7 @@
#include "common/platform.h"
#include "common/queue.h"
#include "common/singleton.h"
+#include "engines/enhancements.h"
class OSystem;
class MetaEngineDetection;
@@ -179,6 +180,8 @@ protected:
*/
const Common::String _targetName;
+ int32 _activeEnhancements = kEnhGameBreakingBugFixes;
+
private:
/**
* The associated metaengine
@@ -379,6 +382,8 @@ public:
*/
virtual bool hasFeature(EngineFeature f) const { return false; }
+ bool enhancementEnabled(int32 cls);
+
/**
* Notify the engine that the sound settings in the config manager might have
* changed and that it should adjust any internal volume (and other) values
diff --git a/engines/enhancements.h b/engines/enhancements.h
new file mode 100644
index 00000000000..8f00860ccd4
--- /dev/null
+++ b/engines/enhancements.h
@@ -0,0 +1,173 @@
+/* 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 ENGINES_ENHANCEMENTS_H
+#define ENGINES_ENHANCEMENTS_H
+
+/* Game enhancements */
+
+/* "How should I mark an enhancement?" - A practical guide for the developer:
+ *
+ * Hi! If you're here it means that you are probably trying to make up
+ * your mind about how to correctly mark your brand new game enhancement:
+ * if that's the case... congratulations, you've come to the right place! :-)
+ *
+ * Marking a piece of code as an enhancement is as simple as guarding it with
+ * a conditional check using the enhancementEnabled(<class>) function.
+ * For example:
+ *
+ * if (enhancementEnabled(<kMyBeautifulEnhancementClass>)) {
+ * // Piece of code which makes Guybrush hair white
+ * }
+ *
+ * That's it! :-)
+ *
+ * You've probably noticed that the function above needs a class in order to work.
+ * Of course there is no one kind of enhancement: each of them might tackle
+ * different aspect of the game, from the graphics to the gameplay itself.
+ * So it all comes to identifying the correct class for your enhancement.
+ *
+ * We identify nine different enhancement classes:
+ *
+ * --- Gamebreaking Bug Fixes ---
+ *
+ * This is a class of enhancements which is ALWAYS active; it encapsulates
+ * code changes which were not in the original game but which are absolutely
+ * necessary in order to avoid deadlocks or even crashes! Being able to differentiate
+ * between original code and these enhancements can be quite useful for future
+ * developers and their research (e.g. "why is this code different from the disassembly?",
+ * "why did they change it like that?").
+ *
+ * --- Minor Bug Fixes ---
+ *
+ * Did the original developers blit a green pixel on a blue tinted background
+ * and YOU'RE ABSOLUTELY SURE that they didn't do that on purpose? Is one of the
+ * voice files playing as garbled noise instead of sounding like normal speech?
+ * Is the game looking like there is something which is clearly wrong with it?
+ * This is the class you're looking for, then!
+ *
+ * --- Text and Localization Fixes ---
+ *
+ * If you spot any issues which pertain texts (accents not being rendered properly
+ * on localizations, placeholder lines forgotten by the developers, obvious typos), and
+ * which are NOT about the format of the subtitle (color, position) or the content,
+ * then this is the class you should be using.
+ * Do not use this class when changing an already grammatically correct line to another
+ * line for the purpose of matching the text to the speech line!
+ * Use "Subtitle Format/Content Changes" instead.
+ *
+ * --- Visual Changes ---
+ *
+ * Any graphical change which is not classifiable as a "fix" but is, as a matter of fact,
+ * a deliberate change which strays away from the original intentions, should be marked
+ * with this class. Some examples of this are enhancements which modify palettes and add
+ * or edit graphical elements in order to better match a particular "reference" version.
+ *
+ * --- Audio Changes ---
+ *
+ * Like above, but for anything sound related.
+ *
+ * --- Timing Adjustments ---
+ *
+ * Are you making a scene slower or faster for any reason? Are you changing the framerate
+ * of an in-game situation? Choose this class!
+ *
+ * --- Subtitles Format/Content Changes ---
+ *
+ * Any changes to the subtitles format should be classified under this class.
+ * This also includes changes to the subtitles content when not under the "fix" umbrella,
+ * for example when you are changing an already grammatically and graphically correct line
+ * to match it with the corresponding speech file.
+ *
+ * --- Restored Cut Content ---
+ *
+ * Have you found any line of dialog, a graphical element or even a piece of music which
+ * is in the game data but is not being used? Go nuts with this enhancement class then! :-)
+ *
+ * --- UI/UX Enhancements ---
+ *
+ * These old games are beautiful. But sometimes they can be so clunky... :-)
+ * If you make any changes in order to yield a slightly-less-clunky user experience
+ * you should classify them under this class. Here's a couple of real use cases:
+ * - SAMNMAX: the CD version of the game begins with what seems to be a fake loading
+ * screen for the sounds. We have an enhancement which just skips that :-)
+ * - Early games: some early titles use a save menu screen which is piloted by SCUMM scripts,
+ * and therefore run at an in-game framerate. This causes lag and lost keypresses
+ * from your keyboard when attempting to write the names of your savegames.
+ * We remove the framerate cap so that writing is not painful anymore... :-P
+ *
+ */
+
+enum {
+ kEnhGameBreakingBugFixes = 1 << 0, // Gamebreaking Bug Fixes
+ kEnhMinorBugFixes = 1 << 1, // Minor Bug Fixes
+ kEnhTextLocFixes = 1 << 2, // Text and Localization Fixes
+ kEnhVisualChanges = 1 << 3, // Visual Changes
+ kEnhAudioChanges = 1 << 4, // Audio Changes
+ kEnhTimingChanges = 1 << 5, // Timing Adjustments
+ kEnhSubFmtCntChanges = 1 << 6, // Subtitles Format/Content Changes
+ kEnhRestoredContent = 1 << 7, // Restored Cut Content
+ kEnhUIUX = 1 << 8, // UI/UX Enhancements
+};
+
+/* "How are the enhancements grouped?" - A practical guide to follow if you're lost:
+ *
+ * GROUP 1: Fix original bugs
+ *
+ * This category includes both game-breaking bugs which cause the game to crash/deadlock and
+ * minor bug fixes (e.g. text and localization issues). Enhancements in this category should
+ * pertain stuff which is very clearly a bug (for example a badly shaped walkbox, a wrong accent
+ * in a word from the subtitles, a strip of pixels which is very clearly out of place/with the
+ * wrong palette, AND NOT include things like subtitles and boxes color changes, enhancements
+ * which make a version similar to another, etc.). Basically when this and only this is active,
+ * the game should not have deadlock situations and the immersiveness should not be broken by
+ * very evident graphical glitches, charset issues, etc.
+ *
+ * GROUP 2: Audio-visual improvements
+ *
+ * This category comprises visual and audio changes as well as timing adjustments. This is the
+ * category in which we can basically put everything which I said not to put in the previous
+ * category. This includes: changing the spacing of the font from the original, changing colors
+ * of subtitles for consistency, changes to the subtitles content in order to match the speech
+ * or to fix the localization, music changes (like the ones in COMI and FT), graphic changes
+ * which are not as essential as the ones from the previous category, etc.
+ *
+ * GROUP 3: Restored content
+ *
+ * This category reintroduces content cut or unused which was not in the original. This
+ * can include content which was somehow masked by mistake by the scripts.
+ *
+ * GROUP 4: Modern UI/UX adjustments
+ *
+ * This category pertains to all enhancements to the user interface and user experience:
+ * e.g. the artificial loading screen at the beginning of Sam&Max, speeding up the framerate
+ * in old original menus to have a decent keyboard polling rate.
+ *
+ */
+
+enum {
+ kEnhGrp1 = (kEnhMinorBugFixes | kEnhTextLocFixes),
+ kEnhGrp2 = (kEnhVisualChanges | kEnhAudioChanges | kEnhTimingChanges | kEnhSubFmtCntChanges),
+ kEnhGrp3 = (kEnhRestoredContent),
+ kEnhGrp4 = (kEnhUIUX)
+};
+
+#endif
\ No newline at end of file
diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h
index 4b9899a7284..d8c258efa48 100644
--- a/engines/scumm/detection.h
+++ b/engines/scumm/detection.h
@@ -37,154 +37,6 @@ namespace Scumm {
#define GAMEOPTION_NETWORK GUIO_GAMEOPTIONS6
#define GAMEOPTION_COPY_PROTECTION GUIO_GAMEOPTIONS7
-/* Game enhancements */
-
-/* "How should I mark an enhancement?" - A practical guide for the developer:
-*
-* Hi! If you're here it means that you are probably trying to make up
-* your mind about how to correctly mark your brand new game enhancement:
-* if that's the case... congratulations, you've come to the right place! :-)
-*
-* Marking a piece of code as an enhancement is as simple as guarding it with
-* a conditional check using the enhancementEnabled(<class>) function.
-* For example:
-*
-* if (enhancementEnabled(<kMyBeautifulEnhancementClass>)) {
-* // Piece of code which makes Guybrush hair white
-* }
-*
-* That's it! :-)
-*
-* You've probably noticed that the function above needs a class in order to work.
-* Of course there is no one kind of enhancement: each of them might tackle
-* different aspect of the game, from the graphics to the gameplay itself.
-* So it all comes to identifying the correct class for your enhancement.
-*
-* We identify nine different enhancement classes:
-*
-* --- Gamebreaking Bug Fixes ---
-*
-* This is a class of enhancements which is ALWAYS active; it encapsulates
-* code changes which were not in the original game but which are absolutely
-* necessary in order to avoid deadlocks or even crashes! Being able to differentiate
-* between original code and these enhancements can be quite useful for future
-* developers and their research (e.g. "why is this code different from the disassembly?",
-* "why did they change it like that?").
-*
-* --- Minor Bug Fixes ---
-*
-* Did the original developers blit a green pixel on a blue tinted background
-* and YOU'RE ABSOLUTELY SURE that they didn't do that on purpose? Is one of the
-* voice files playing as garbled noise instead of sounding like normal speech?
-* Is the game looking like there is something which is clearly wrong with it?
-* This is the class you're looking for, then!
-*
-* --- Text and Localization Fixes ---
-*
-* If you spot any issues which pertain texts (accents not being rendered properly
-* on localizations, placeholder lines forgotten by the developers, obvious typos), and
-* which are NOT about the format of the subtitle (color, position) or the content,
-* then this is the class you should be using.
-* Do not use this class when changing an already grammatically correct line to another
-* line for the purpose of matching the text to the speech line!
-* Use "Subtitle Format/Content Changes" instead.
-*
-* --- Visual Changes ---
-*
-* Any graphical change which is not classifiable as a "fix" but is, as a matter of fact,
-* a deliberate change which strays away from the original intentions, should be marked
-* with this class. Some examples of this are enhancements which modify palettes and add
-* or edit graphical elements in order to better match a particular "reference" version.
-*
-* --- Audio Changes ---
-*
-* Like above, but for anything sound related.
-*
-* --- Timing Adjustments ---
-*
-* Are you making a scene slower or faster for any reason? Are you changing the framerate
-* of an in-game situation? Choose this class!
-*
-* --- Subtitles Format/Content Changes ---
-*
-* Any changes to the subtitles format should be classified under this class.
-* This also includes changes to the subtitles content when not under the "fix" umbrella,
-* for example when you are changing an already grammatically and graphically correct line
-* to match it with the corresponding speech file.
-*
-* --- Restored Cut Content ---
-*
-* Have you found any line of dialog, a graphical element or even a piece of music which
-* is in the game data but is not being used? Go nuts with this enhancement class then! :-)
-*
-* --- UI/UX Enhancements ---
-*
-* These old games are beautiful. But sometimes they can be so clunky... :-)
-* If you make any changes in order to yield a slightly-less-clunky user experience
-* you should classify them under this class. Here's a couple of real use cases:
-* - SAMNMAX: the CD version of the game begins with what seems to be a fake loading
-* screen for the sounds. We have an enhancement which just skips that :-)
-* - Early games: some early titles use a save menu screen which is piloted by SCUMM scripts,
-* and therefore run at an in-game framerate. This causes lag and lost keypresses
-* from your keyboard when attempting to write the names of your savegames.
-* We remove the framerate cap so that writing is not painful anymore... :-P
-*
-*/
-
-enum {
- kEnhGameBreakingBugFixes = 1 << 0, // Gamebreaking Bug Fixes
- kEnhMinorBugFixes = 1 << 1, // Minor Bug Fixes
- kEnhTextLocFixes = 1 << 2, // Text and Localization Fixes
- kEnhVisualChanges = 1 << 3, // Visual Changes
- kEnhAudioChanges = 1 << 4, // Audio Changes
- kEnhTimingChanges = 1 << 5, // Timing Adjustments
- kEnhSubFmtCntChanges = 1 << 6, // Subtitles Format/Content Changes
- kEnhRestoredContent = 1 << 7, // Restored Cut Content
- kEnhUIUX = 1 << 8, // UI/UX Enhancements
-};
-
-/* "How are the enhancements grouped?" - A practical guide to follow if you're lost:
-*
-* GROUP 1: Fix original bugs
-*
-* This category includes both game-breaking bugs which cause the game to crash/deadlock and
-* minor bug fixes (e.g. text and localization issues). Enhancements in this category should
-* pertain stuff which is very clearly a bug (for example a badly shaped walkbox, a wrong accent
-* in a word from the subtitles, a strip of pixels which is very clearly out of place/with the
-* wrong palette, AND NOT include things like subtitles and boxes color changes, enhancements
-* which make a version similar to another, etc.). Basically when this and only this is active,
-* the game should not have deadlock situations and the immersiveness should not be broken by
-* very evident graphical glitches, charset issues, etc.
-*
-* GROUP 2: Audio-visual improvements
-*
-* This category comprises visual and audio changes as well as timing adjustments. This is the
-* category in which we can basically put everything which I said not to put in the previous
-* category. This includes: changing the spacing of the font from the original, changing colors
-* of subtitles for consistency, changes to the subtitles content in order to match the speech
-* or to fix the localization, music changes (like the ones in COMI and FT), graphic changes
-* which are not as essential as the ones from the previous category, etc.
-*
-* GROUP 3: Restored content
-*
-* This category reintroduces content cut or unused which was not in the original. This
-* can include content which was somehow masked by mistake by the scripts.
-*
-* GROUP 4: Modern UI/UX adjustments
-*
-* This category pertains to all enhancements to the user interface and user experience:
-* e.g. the artificial loading screen at the beginning of Sam&Max, speeding up the framerate
-* in old original menus to have a decent keyboard polling rate.
-*
-*/
-
-enum {
- kEnhGrp1 = (kEnhMinorBugFixes | kEnhTextLocFixes),
- kEnhGrp2 = (kEnhVisualChanges | kEnhAudioChanges | kEnhTimingChanges | kEnhSubFmtCntChanges),
- kEnhGrp3 = (kEnhRestoredContent),
- kEnhGrp4 = (kEnhUIUX)
-};
-
/**
* Descriptor of a specific SCUMM game. Used internally to store
* information about the tons of game variants that exist.
diff --git a/engines/scumm/metaengine.cpp b/engines/scumm/metaengine.cpp
index e0ec258cc00..988d8d19822 100644
--- a/engines/scumm/metaengine.cpp
+++ b/engines/scumm/metaengine.cpp
@@ -249,10 +249,6 @@ bool ScummEngine::hasFeature(EngineFeature f) const {
(f == kSupportsQuitDialogOverride && (gameSupportsQuitDialogOverride() || !ChainedGamesMan.empty()));
}
-bool Scumm::ScummEngine::enhancementEnabled(int32 cls) {
- return _activeEnhancements & cls;
-}
-
bool ScummEngine::gameSupportsQuitDialogOverride() const {
bool supportsOverride = isUsingOriginalGUI();
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index acda5a6f563..3ddeeb1ada8 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -312,11 +312,11 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
case Common::kRenderEGA:
// An actual use case for letting users change the render mode on Monkey Island 1 (Amiga):
// between revisions and localizations there were two variants of the executable:
- //
+ //
// - One which used the EGA palette for actors, resulting in
// characters having the usual "sunburnt" effect; as an example,
// one of the italian versions shipped with this executable.
- //
+ //
// - One which used a custom paler palette for actors, which might
// be how most of the people experienced the game.
//
@@ -969,17 +969,6 @@ Common::Error ScummEngine::init() {
_useOriginalGUI = ConfMan.getBool("original_gui");
}
- // Register original bug fixes as defaults...
- ConfMan.registerDefault("enhancements", kEnhGameBreakingBugFixes | kEnhGrp1);
- if (!ConfMan.hasKey("enhancements", _targetName)) {
- if (ConfMan.hasKey("enable_enhancements", _targetName) && ConfMan.getBool("enable_enhancements", _targetName)) {
- // Was the "enable_enhancements" key previously set to true?
- // Convert it to a full activation of the enhancement flags then!
- ConfMan.setInt("enhancements", kEnhGameBreakingBugFixes | kEnhGrp1 | kEnhGrp2 | kEnhGrp3 | kEnhGrp4);
- }
- }
-
- _activeEnhancements = (int32)ConfMan.getInt("enhancements");
_enableAudioOverride = ConfMan.getBool("audio_override");
// Add default file directories.
@@ -2434,7 +2423,7 @@ Common::Error ScummEngine::go() {
// In ScummVM 2.7.0, original GUI support was added.
// Unfortunately it came with an issue: in v4-7 games users could
// overwrite autosaves (slot 0). Why? Because I forgot about autosaves :-)
- //
+ //
// To amend this from 2.9.0 onwards we check for savegames which are on slot 0
// and are not autosaves (the heuristic is not optimal, but it will have to do),
// and performs a mass rename. Unless the user has used all 99 slots, in which case
@@ -2673,7 +2662,7 @@ double ScummEngine::getTimerFrequency() {
// the song end when the visuals are done. Just two checks are being done on VAR_MUSIC_TIMER
// within the relevant scripts at the beginning of the intro, and then in the end there is
// this check which fails because at that point Var[151 Bit 8] seems to be deactivated:
- //
+ //
// if (Var[151 Bit 8]) {
// breakHere();
// VAR_RESULT = isSoundRunning(93);
@@ -2835,7 +2824,7 @@ load_game:
// - Set screen shake off
//
// to work and to be timed correctly.
- //
+ //
// Again, from the disasms, we call runAllScripts() on a loop,
// while the _saveLoadFlag is active.
if (_game.version == 7 && !isFTDOSDemo) {
@@ -3328,13 +3317,13 @@ void ScummEngine_v3::terminateSaveMenuScript() {
int chainedArgs[NUM_SCRIPT_LOCAL];
// We only needed the first slot (0), but just like getWordVararg(), let's not leave memory uninitalized...
for (int i = 0; i < NUM_SCRIPT_LOCAL; i++)
- chainedArgs[i] = 0;
+ chainedArgs[i] = 0;
int cur = _currentScript;
int scriptToChain = _game.platform == Common::kPlatformFMTowns ? 5 : 6;
-
+
assert(cur != 0xFF);
-
+
vm.slot[cur].number = 0;
vm.slot[cur].status = ssDead;
_currentScript = 0xFF;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index c91783e0b30..2c3c4ac41cb 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -553,7 +553,6 @@ public:
ResourceManager *_res = nullptr;
int _insideCreateResource = 0; // Counter for HE sound
- int32 _activeEnhancements = kEnhGameBreakingBugFixes;
bool _useOriginalGUI = true;
bool _enableAudioOverride = false;
bool _enableCOMISong = false;
@@ -587,7 +586,6 @@ public:
void errorString(const char *buf_input, char *buf_output, int buf_output_size) override;
bool hasFeature(EngineFeature f) const override;
- bool enhancementEnabled(int32 cls);
bool gameSupportsQuitDialogOverride() const;
void syncSoundSettings() override;
More information about the Scummvm-git-logs
mailing list