[Scummvm-git-logs] scummvm master -> 60935316cf24a288185a111a563cc400ba3c376e
elasota
noreply at scummvm.org
Fri May 5 13:59:37 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0c1eeab31d VCRUISE: Fix compass in Schizm. Fix dragging a click off of an in-game menu button below the menu bar registering as cl
921702efea VCRUISE: Add SpeechTest opcode.
60935316cf VCRUISE: Use Schizm.ini to detect start configs and CD version
Commit: 0c1eeab31d2db68543921e5ee1c0d65f11a8d487
https://github.com/scummvm/scummvm/commit/0c1eeab31d2db68543921e5ee1c0d65f11a8d487
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-05T09:59:18-04:00
Commit Message:
VCRUISE: Fix compass in Schizm. Fix dragging a click off of an in-game menu button below the menu bar registering as clicking it.
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 5f50ef2064f..5319d7c1c91 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -4037,12 +4037,19 @@ void Runtime::drawCompass() {
Common::Rect lowerRightRect = Common::Rect(_traySection.rect.right - 88, 0, _traySection.rect.right, 88);
- if (haveLocation) {
- if (_gameID == GID_REAH)
+ if (_gameID == GID_REAH) {
+
+ if (haveLocation)
_traySection.surf->blitFrom(*_trayCornerGraphic, Common::Point(lowerRightRect.left, lowerRightRect.top));
- } else {
- if (_gameID == GID_REAH)
- _traySection.surf->blitFrom(*_trayBackgroundGraphic, lowerRightRect, lowerRightRect);
+ else
+ _traySection.surf->blitFrom(*_trayBackgroundGraphic, lowerRightRect, Common::Point(lowerRightRect.left, lowerRightRect.top));
+ } else if (_gameID == GID_SCHIZM) {
+ Common::Rect graphicRect = Common::Rect(0u + _hero * 176u, 0, 0u + _hero * 176u + 88, 88);
+
+ if (!haveLocation)
+ graphicRect.translate(88, 0);
+
+ _traySection.surf->blitFrom(*_trayCornerGraphic, graphicRect, Common::Point(lowerRightRect.left, lowerRightRect.top));
}
commitSectionToScreen(_traySection, compassRect);
@@ -4338,13 +4345,13 @@ void Runtime::checkInGameMenuHover() {
}
break;
case kInGameMenuStateClickingOver:
- if (activeElement != _inGameMenuActiveElement) {
+ if (activeElement != _inGameMenuActiveElement || _mousePos.y >= _menuSection.rect.bottom) {
_inGameMenuState = kInGameMenuStateClickingNotOver;
drawInGameMenuButton(_inGameMenuActiveElement);
}
break;
case kInGameMenuStateClickingNotOver:
- if (activeElement == _inGameMenuActiveElement) {
+ if (activeElement == _inGameMenuActiveElement && _mousePos.y < _menuSection.rect.bottom) {
_inGameMenuState = kInGameMenuStateClickingOver;
drawInGameMenuButton(_inGameMenuActiveElement);
}
@@ -6179,6 +6186,7 @@ void Runtime::scriptOpAnimChange(ScriptArg_t arg) {
(void)stackArgs;
+ // Not sure what this does yet. It is parameterized in some rooms.
warning("animChange opcode isn't implemented yet");
}
Commit: 921702efeaf77ad5635ee4197d91afb266348c35
https://github.com/scummvm/scummvm/commit/921702efeaf77ad5635ee4197d91afb266348c35
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-05T09:59:18-04:00
Commit Message:
VCRUISE: Add SpeechTest opcode.
Changed paths:
engines/vcruise/runtime.cpp
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 5319d7c1c91..8d37a9b346f 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -6241,7 +6241,21 @@ void Runtime::scriptOpSpeechEx(ScriptArg_t arg) {
}
}
-OPCODE_STUB(SpeechTest)
+void Runtime::scriptOpSpeechTest(ScriptArg_t arg) {
+ TAKE_STACK_INT(1);
+
+ bool found = false;
+
+ for (const TriggeredOneShot &oneShot : _triggeredOneShots) {
+ if (oneShot.soundID == static_cast<uint>(stackArgs[0])) {
+ found = true;
+ break;
+ }
+ }
+
+ _scriptStack.push_back(StackValue(found ? 1 : 0));
+}
+
OPCODE_STUB(Say)
void Runtime::scriptOpRandomInclusive(ScriptArg_t arg) {
Commit: 60935316cf24a288185a111a563cc400ba3c376e
https://github.com/scummvm/scummvm/commit/60935316cf24a288185a111a563cc400ba3c376e
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-05T09:59:18-04:00
Commit Message:
VCRUISE: Use Schizm.ini to detect start configs and CD version
Changed paths:
engines/vcruise/detection.h
engines/vcruise/detection_tables.h
engines/vcruise/runtime.cpp
engines/vcruise/runtime.h
engines/vcruise/vcruise.cpp
diff --git a/engines/vcruise/detection.h b/engines/vcruise/detection.h
index b8b1e875a85..205aef97608 100644
--- a/engines/vcruise/detection.h
+++ b/engines/vcruise/detection.h
@@ -37,8 +37,6 @@ enum VCruiseGameFlag {
VCRUISE_GF_WANT_MP3 = (1 << 0),
VCRUISE_GF_WANT_OGG_VORBIS = (1 << 1),
VCRUISE_GF_NEED_JPEG = (1 << 2),
- VCRUISE_GF_CD_VARIANT = (1 << 3),
- VCRUISE_GF_DVD_VARIANT = (1 << 4),
};
struct VCruiseGameDescription {
diff --git a/engines/vcruise/detection_tables.h b/engines/vcruise/detection_tables.h
index b949c0fd94d..f8f02e0dab9 100644
--- a/engines/vcruise/detection_tables.h
+++ b/engines/vcruise/detection_tables.h
@@ -61,7 +61,7 @@ static const VCruiseGameDescription gameDescriptions[] = {
AD_ENTRY1s("Schizm.exe", "296edd26d951c3bdc4d303c4c88b27cd", 364544),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_UNSTABLE | VCRUISE_GF_WANT_OGG_VORBIS | VCRUISE_GF_NEED_JPEG | VCRUISE_GF_DVD_VARIANT,
+ ADGF_UNSTABLE | VCRUISE_GF_WANT_OGG_VORBIS | VCRUISE_GF_NEED_JPEG,
GUIO0()
},
GID_SCHIZM,
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 8d37a9b346f..ff5c3169d04 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -118,15 +118,7 @@ Common::Point RuntimeMenuInterface::getMouseCoordinate() const {
}
void RuntimeMenuInterface::restartGame() const {
- Common::SharedPtr<SaveGameSnapshot> snapshot(new SaveGameSnapshot());
-
- snapshot->roomNumber = 1;
- snapshot->screenNumber = 0xb0;
-
- if (_runtime->_gameID == GID_SCHIZM)
- snapshot->loadedAnimation = 200;
- else
- snapshot->loadedAnimation = 1;
+ Common::SharedPtr<SaveGameSnapshot> snapshot = _runtime->generateNewGameSnapshot();
_runtime->_saveGame = snapshot;
_runtime->restoreSaveGameSnapshot();
@@ -607,6 +599,9 @@ void TriggeredOneShot::read(Common::ReadStream *stream) {
ScoreSectionDef::ScoreSectionDef() : volumeOrDurationInSeconds(0) {
}
+StartConfigDef::StartConfigDef() : disc(0), room(0), screen(0), direction(0) {
+}
+
StaticAnimParams::StaticAnimParams() : initialDelay(0), repeatDelay(0), lockInteractions(false) {
}
@@ -915,7 +910,7 @@ void SaveGameSnapshot::writeString(Common::WriteStream *stream, const Common::St
FontCacheItem::FontCacheItem() : font(nullptr), size(0) {
}
-Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &rootFSNode, VCruiseGameID gameID, bool isCDVariant, bool isDVDVariant)
+Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &rootFSNode, VCruiseGameID gameID)
: _system(system), _mixer(mixer), _roomNumber(1), _screenNumber(0), _direction(0), _hero(0), _haveHorizPanAnimations(false), _loadedRoomNumber(0), _activeScreenNumber(0),
_gameState(kGameStateBoot), _gameID(gameID), _havePendingScreenChange(false), _forceScreenChange(false), _havePendingReturnToIdleState(false), _havePendingCompletionCheck(false),
_havePendingPlayAmbientSounds(false), _ambientSoundFinishTime(0), _escOn(false), _debugMode(false), _fastAnimationMode(false),
@@ -931,7 +926,7 @@ Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &roo
_listenerX(0), _listenerY(0), _listenerAngle(0), _soundCacheIndex(0),
_isInGame(false),
_subtitleFont(nullptr), _isDisplayingSubtitles(false), _languageIndex(0),
- _isCDVariant(isCDVariant), _isDVDVariant(isDVDVariant) {
+ _isCDVariant(false) {
for (uint i = 0; i < kNumDirections; i++) {
_haveIdleAnimations[i] = false;
@@ -1132,11 +1127,17 @@ bool Runtime::bootGame(bool newGame) {
debug(1, "Waves indexed OK");
if (_gameID == GID_SCHIZM) {
+ loadConfig("Schizm.ini");
+ debug(1, "Config indexed OK");
+
loadScore();
debug(1, "Score loaded OK");
-
- if (_isCDVariant == _isDVDVariant)
- error("Detection entry is malformed, Schizm requires either VCRUISE_GF_CD_VARIANT or VCRUISE_GF_DVD_VARIANT");
+ } else {
+ StartConfigDef &startConfig = _startConfigs[kStartConfigInitial];
+ startConfig.disc = 1;
+ startConfig.room = 1;
+ startConfig.screen = 0xb0;
+ startConfig.direction = 0;
}
_trayBackgroundGraphic = loadGraphic("Pocket", true);
@@ -1144,17 +1145,6 @@ bool Runtime::bootGame(bool newGame) {
_trayCompassGraphic = loadGraphic("Select_1", true);
_trayCornerGraphic = loadGraphic("Select_2", true);
- _gameState = kGameStateIdle;
-
- if (newGame) {
- if (ConfMan.hasKey("vcruise_skip_menu") && ConfMan.getBool("vcruise_skip_menu")) {
- _isInGame = true;
- changeToScreen(1, 0xb0);
- } else {
- changeToScreen(1, 0xb1);
- }
- }
-
Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
bool foundLang = false;
@@ -1241,6 +1231,16 @@ bool Runtime::bootGame(bool newGame) {
}
}
+ if (newGame) {
+ if (ConfMan.hasKey("vcruise_skip_menu") && ConfMan.getBool("vcruise_skip_menu")) {
+ _saveGame = generateNewGameSnapshot();
+ restoreSaveGameSnapshot();
+ } else {
+ _gameState = kGameStateIdle;
+ changeToScreen(1, 0xb1);
+ }
+ }
+
return true;
}
@@ -2346,6 +2346,33 @@ void Runtime::findWaves() {
}
}
+void Runtime::loadConfig(const char *filePath) {
+ Common::INIFile configINI;
+ if (!configINI.loadFromFile(filePath))
+ error("Couldn't load config '%s'", filePath);
+
+ for (uint i = 0; i < kNumStartConfigs; i++) {
+ Common::String cfgKey = Common::String::format("dwStart%02u", i);
+ Common::String startConfigValue;
+
+ if (!configINI.getKey(cfgKey, "TextSettings", startConfigValue))
+ error("Config key '%s' is missing", cfgKey.c_str());
+
+ StartConfigDef &startDef = _startConfigs[i];
+ if (sscanf(startConfigValue.c_str(), "0x%02x,0x%02x,0x%02x,0x%02x", &startDef.disc, &startDef.room, &startDef.screen, &startDef.direction) != 4)
+ error("Start config key '%s' is malformed", cfgKey.c_str());
+ }
+
+ _isCDVariant = false;
+
+ Common::String cdVersionValue;
+ if (configINI.getKey("bStatusVersionCD", "ValueSettings", cdVersionValue)) {
+ uint boolValue = 0;
+ if (sscanf(cdVersionValue.c_str(), "%u", &boolValue) == 1)
+ _isCDVariant = (boolValue != 0);
+ }
+}
+
void Runtime::loadScore() {
Common::INIFile scoreINI;
if (scoreINI.loadFromFile("Sfx/score.ini")) {
@@ -4713,6 +4740,21 @@ void Runtime::restoreSaveGameSnapshot() {
redrawTray();
}
+Common::SharedPtr<SaveGameSnapshot> Runtime::generateNewGameSnapshot() const {
+ Common::SharedPtr<SaveGameSnapshot> snapshot(new SaveGameSnapshot());
+
+ snapshot->roomNumber = _startConfigs[kStartConfigInitial].room;
+ snapshot->screenNumber = _startConfigs[kStartConfigInitial].screen;
+ snapshot->direction = _startConfigs[kStartConfigInitial].direction;
+
+ if (_gameID == GID_SCHIZM)
+ snapshot->loadedAnimation = 200;
+ else
+ snapshot->loadedAnimation = 1;
+
+ return snapshot;
+}
+
void Runtime::saveGame(Common::WriteStream *stream) const {
_saveGame->write(stream);
}
@@ -6282,7 +6324,7 @@ OPCODE_STUB(BitOr)
OPCODE_STUB(AngleGet)
void Runtime::scriptOpIsDVDVersion(ScriptArg_t arg) {
- _scriptStack.push_back(StackValue(_isDVDVariant ? 1 : 0));
+ _scriptStack.push_back(StackValue(_isCDVariant ? 0 : 1));
}
void Runtime::scriptOpIsCDVersion(ScriptArg_t arg) {
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 5c89eadc5ce..5233d34dfdb 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -66,6 +66,13 @@ namespace VCruise {
static const uint kNumDirections = 8;
static const uint kNumHighPrecisionDirections = 256;
static const uint kHighPrecisionDirectionMultiplier = kNumHighPrecisionDirections / kNumDirections;
+static const uint kNumStartConfigs = 3;
+
+enum StartConfig {
+ kStartConfigCheatMenu,
+ kStartConfigInitial,
+ kStartConfigAlt,
+};
class AudioPlayer;
class MenuInterface;
@@ -285,6 +292,15 @@ struct ScoreTrackDef {
ScoreSectionMap_t sections;
};
+struct StartConfigDef {
+ StartConfigDef();
+
+ uint disc;
+ uint room;
+ uint screen;
+ uint direction;
+};
+
struct StaticAnimParams {
StaticAnimParams();
@@ -508,7 +524,7 @@ class Runtime {
public:
friend class RuntimeMenuInterface;
- Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &rootFSNode, VCruiseGameID gameID, bool isCDVariant, bool isDVDVariant);
+ Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &rootFSNode, VCruiseGameID gameID);
virtual ~Runtime();
void initSections(const Common::Rect &gameRect, const Common::Rect &menuRect, const Common::Rect &trayRect, const Common::Rect &fullscreenMenuRect, const Graphics::PixelFormat &pixFmt);
@@ -531,6 +547,7 @@ public:
void recordSaveGameSnapshot();
void restoreSaveGameSnapshot();
+ Common::SharedPtr<SaveGameSnapshot> generateNewGameSnapshot() const;
void saveGame(Common::WriteStream *stream) const;
LoadGameOutcome loadGame(Common::ReadStream *stream);
@@ -745,6 +762,7 @@ private:
void loadIndex();
void findWaves();
+ void loadConfig(const char *cfgPath);
void loadScore();
Common::SharedPtr<SoundInstance> loadWave(const Common::String &soundName, uint soundID, const Common::ArchiveMemberPtr &archiveMemberPtr);
SoundCache *loadCache(SoundInstance &sound);
@@ -1201,8 +1219,8 @@ private:
const Graphics::Font *_subtitleFont;
Common::SharedPtr<Graphics::Font> _subtitleFontKeepalive;
uint _languageIndex;
- bool _isDVDVariant;
bool _isCDVariant;
+ StartConfigDef _startConfigs[kNumStartConfigs];
typedef Common::HashMap<uint, SubtitleDef> FrameToSubtitleMap_t;
typedef Common::HashMap<uint, FrameToSubtitleMap_t> AnimSubtitleMap_t;
diff --git a/engines/vcruise/vcruise.cpp b/engines/vcruise/vcruise.cpp
index cbf78a2ee40..41f96302975 100644
--- a/engines/vcruise/vcruise.cpp
+++ b/engines/vcruise/vcruise.cpp
@@ -105,9 +105,6 @@ Common::Error VCruiseEngine::run() {
syncSoundSettings();
- bool isCDVariant = ((_gameDescription->desc.flags & VCRUISE_GF_CD_VARIANT) != 0);
- bool isDVDVariant = ((_gameDescription->desc.flags & VCRUISE_GF_DVD_VARIANT) != 0);
-
const Graphics::PixelFormat *fmt16_565 = nullptr;
const Graphics::PixelFormat *fmt16_555 = nullptr;
const Graphics::PixelFormat *fmt32 = nullptr;
@@ -167,7 +164,7 @@ Common::Error VCruiseEngine::run() {
_system->fillScreen(0);
- _runtime.reset(new Runtime(_system, _mixer, _rootFSNode, _gameDescription->gameID, isCDVariant, isDVDVariant));
+ _runtime.reset(new Runtime(_system, _mixer, _rootFSNode, _gameDescription->gameID));
_runtime->initSections(_videoRect, _menuBarRect, _trayRect, Common::Rect(640, 480), _system->getScreenFormat());
const char *exeName = _gameDescription->desc.filesDescriptions[0].fileName;
More information about the Scummvm-git-logs
mailing list