[Scummvm-git-logs] scummvm master -> 2a0c90e7dd2a7e26ccc19b83da315d1e13764537
OMGPizzaGuy
noreply at scummvm.org
Sat Apr 27 03:28:48 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
983580ce7a ULTIMA8: Clean up graphics startup
2a0c90e7dd ULTIMA8: Clean up engine initialize / deinitialize
Commit: 983580ce7a2d9e2dab93633782eb82af92e23716
https://github.com/scummvm/scummvm/commit/983580ce7a2d9e2dab93633782eb82af92e23716
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-04-26T18:37:04-05:00
Commit Message:
ULTIMA8: Clean up graphics startup
Changed paths:
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 504058d6448..12204f9e3e2 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -463,6 +463,10 @@ Common::Error Ultima8Engine::startupGame() {
int height = ConfMan.getInt("height");
changeVideoMode(width, height);
+ // Show the splash screen immediately now that the screen has been set up
+ _mouse->setMouseCursor(Mouse::MOUSE_NONE);
+ showSplashScreen();
+
_gameData = new GameData(_gameInfo);
if (_gameInfo->_type == GameInfo::GAME_U8) {
@@ -758,36 +762,21 @@ void Ultima8Engine::changeVideoMode(int width, int height) {
Graphics::ManagedSurface *surface = new Graphics::Screen(width, height, format);
_screen = new RenderSurface(surface);
- if (_desktopGump) {
+ if (!_paletteManager) {
+ _paletteManager = new PaletteManager(format);
+ } else {
_paletteManager->PixelFormatChanged(format);
- _desktopGump->SetDims(Rect(0, 0, width, height));
- _desktopGump->RenderSurfaceChanged();
- paint();
- return;
- }
-
- _desktopGump = new DesktopGump(0, 0, width, height);
- _desktopGump->InitGump(0);
- _desktopGump->MakeFocus();
-
- if (GAME_IS_U8) {
- _inverterGump = new InverterGump(0, 0, width, height);
- _inverterGump->InitGump(0);
}
- // Show the splash screen immediately now that the screen has been set up
- int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
- if (saveSlot == -1) {
- _mouse->setMouseCursor(Mouse::MOUSE_NONE);
- showSplashScreen();
+ if (!_desktopGump) {
+ _desktopGump = new DesktopGump(0, 0, width, height);
+ _desktopGump->InitGump(0);
+ _desktopGump->MakeFocus();
+ } else {
+ _desktopGump->SetDims(Rect(0, 0, width, height));
+ _desktopGump->RenderSurfaceChanged();
}
- _paletteManager = new PaletteManager(format);
-
- ConfMan.registerDefault("fadedModal", true);
- bool faded_modal = ConfMan.getBool("fadedModal");
- DesktopGump::SetFadedModal(faded_modal);
-
paint();
}
@@ -1088,6 +1077,10 @@ void Ultima8Engine::setupCoreGumps() {
_desktopGump->InitGump(0);
_desktopGump->MakeFocus();
+ ConfMan.registerDefault("fadedModal", true);
+ bool faded_modal = ConfMan.getBool("fadedModal");
+ DesktopGump::SetFadedModal(faded_modal);
+
if (GAME_IS_U8) {
debugN(MM_INFO, "Creating Inverter...\n");
_inverterGump = new InverterGump(0, 0, dims.width(), dims.height());
Commit: 2a0c90e7dd2a7e26ccc19b83da315d1e13764537
https://github.com/scummvm/scummvm/commit/2a0c90e7dd2a7e26ccc19b83da315d1e13764537
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-04-26T22:28:16-05:00
Commit Message:
ULTIMA8: Clean up engine initialize / deinitialize
Changed paths:
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 12204f9e3e2..be895897d0e 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -159,14 +159,10 @@ Ultima8Engine::~Ultima8Engine() {
}
Common::Error Ultima8Engine::run() {
- Common::Error result;
- if (initialize()) {
- result = startup();
- if (result.getCode() == Common::kNoError)
- result = runGame();
-
+ Common::Error result = initialize();
+ if (result.getCode() == Common::kNoError) {
+ result = runGame();
deinitialize();
- shutdown();
}
return result;
@@ -179,7 +175,9 @@ void Ultima8Engine::initializePath(const Common::FSNode& gamePath) {
SearchMan.addSubDirectoryMatching(gamePath, "data", 0, 4);
}
-bool Ultima8Engine::initialize() {
+Common::Error Ultima8Engine::initialize() {
+ debug(MM_INFO, "-- Initializing Pentagram --");
+
// Call syncSoundSettings to get default volumes set
syncSoundSettings();
@@ -187,44 +185,11 @@ bool Ultima8Engine::initialize() {
Common::Archive *archive = Common::makeZipArchive("ultima8.dat");
if (!archive) {
GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), "ultima8.dat");
- return false;
+ return Common::kPathDoesNotExist;
}
SearchMan.add("ultima8.dat", archive);
- return true;
-}
-
-void Ultima8Engine::deinitialize() {
-}
-
-void Ultima8Engine::pauseEngineIntern(bool pause) {
- if (_mixer)
- _mixer->pauseAll(pause);
- if (_audioMixer) {
- MidiPlayer *midiPlayer = _audioMixer->getMidiPlayer();
- if (midiPlayer)
- midiPlayer->pause(pause);
- }
-
- _avatarMoverProcess->resetMovementFlags();
-}
-
-bool Ultima8Engine::hasFeature(EngineFeature f) const {
- return
- (f == kSupportsSubtitleOptions) ||
- (f == kSupportsReturnToLauncher) ||
- (f == kSupportsLoadingDuringRuntime) ||
- (f == kSupportsSavingDuringRuntime) ||
- (f == kSupportsChangingOptionsDuringRuntime);
-}
-
-Common::Language Ultima8Engine::getLanguage() const {
- return _gameDescription->desc.language;
-}
-
-Common::Error Ultima8Engine::startup() {
setDebugger(new Debugger());
- debug(MM_INFO, "-- Initializing Pentagram --");
_gameInfo = nullptr;
_configFileMan = new ConfigFileManager();
@@ -233,111 +198,111 @@ Common::Error Ultima8Engine::startup() {
//!! move this elsewhere
_kernel->addProcessLoader("DelayProcess",
- ProcessLoader<DelayProcess>::load);
+ ProcessLoader<DelayProcess>::load);
_kernel->addProcessLoader("GravityProcess",
- ProcessLoader<GravityProcess>::load);
+ ProcessLoader<GravityProcess>::load);
_kernel->addProcessLoader("AvatarGravityProcess",
- ProcessLoader<AvatarGravityProcess>::load);
+ ProcessLoader<AvatarGravityProcess>::load);
_kernel->addProcessLoader("PaletteFaderProcess",
- ProcessLoader<PaletteFaderProcess>::load);
+ ProcessLoader<PaletteFaderProcess>::load);
_kernel->addProcessLoader("TeleportToEggProcess",
- ProcessLoader<TeleportToEggProcess>::load);
+ ProcessLoader<TeleportToEggProcess>::load);
_kernel->addProcessLoader("ActorAnimProcess",
- ProcessLoader<ActorAnimProcess>::load);
+ ProcessLoader<ActorAnimProcess>::load);
_kernel->addProcessLoader("TargetedAnimProcess",
- ProcessLoader<TargetedAnimProcess>::load);
+ ProcessLoader<TargetedAnimProcess>::load);
_kernel->addProcessLoader("AvatarMoverProcess", // parent class for backward compatibility
- ProcessLoader<U8AvatarMoverProcess>::load);
+ ProcessLoader<U8AvatarMoverProcess>::load);
_kernel->addProcessLoader("U8AvatarMoverProcess",
- ProcessLoader<U8AvatarMoverProcess>::load);
+ ProcessLoader<U8AvatarMoverProcess>::load);
_kernel->addProcessLoader("CruAvatarMoverProcess",
- ProcessLoader<CruAvatarMoverProcess>::load);
+ ProcessLoader<CruAvatarMoverProcess>::load);
_kernel->addProcessLoader("QuickAvatarMoverProcess",
- ProcessLoader<QuickAvatarMoverProcess>::load);
+ ProcessLoader<QuickAvatarMoverProcess>::load);
_kernel->addProcessLoader("PathfinderProcess",
- ProcessLoader<PathfinderProcess>::load);
+ ProcessLoader<PathfinderProcess>::load);
_kernel->addProcessLoader("CruPathfinderProcess",
- ProcessLoader<CruPathfinderProcess>::load);
+ ProcessLoader<CruPathfinderProcess>::load);
_kernel->addProcessLoader("SpriteProcess",
- ProcessLoader<SpriteProcess>::load);
+ ProcessLoader<SpriteProcess>::load);
_kernel->addProcessLoader("CameraProcess",
- ProcessLoader<CameraProcess>::load);
+ ProcessLoader<CameraProcess>::load);
_kernel->addProcessLoader("MusicProcess", // parent class name for save game backwards-compatibility.
- ProcessLoader<U8MusicProcess>::load);
+ ProcessLoader<U8MusicProcess>::load);
_kernel->addProcessLoader("U8MusicProcess",
- ProcessLoader<U8MusicProcess>::load);
+ ProcessLoader<U8MusicProcess>::load);
_kernel->addProcessLoader("RemorseMusicProcess", // name was changed, keep this for backward-compatibility.
- ProcessLoader<CruMusicProcess>::load);
+ ProcessLoader<CruMusicProcess>::load);
_kernel->addProcessLoader("CruMusicProcess",
- ProcessLoader<CruMusicProcess>::load);
+ ProcessLoader<CruMusicProcess>::load);
_kernel->addProcessLoader("AudioProcess",
- ProcessLoader<AudioProcess>::load);
+ ProcessLoader<AudioProcess>::load);
_kernel->addProcessLoader("EggHatcherProcess",
- ProcessLoader<EggHatcherProcess>::load);
+ ProcessLoader<EggHatcherProcess>::load);
_kernel->addProcessLoader("UCProcess",
- ProcessLoader<UCProcess>::load);
+ ProcessLoader<UCProcess>::load);
_kernel->addProcessLoader("GumpNotifyProcess",
- ProcessLoader<GumpNotifyProcess>::load);
+ ProcessLoader<GumpNotifyProcess>::load);
_kernel->addProcessLoader("ResurrectionProcess",
- ProcessLoader<ResurrectionProcess>::load);
+ ProcessLoader<ResurrectionProcess>::load);
_kernel->addProcessLoader("DeleteActorProcess",
ProcessLoader<DestroyItemProcess>::load); // YES, this is intentional
_kernel->addProcessLoader("DestroyItemProcess",
- ProcessLoader<DestroyItemProcess>::load);
+ ProcessLoader<DestroyItemProcess>::load);
_kernel->addProcessLoader("SplitItemProcess",
- ProcessLoader<SplitItemProcess>::load);
+ ProcessLoader<SplitItemProcess>::load);
_kernel->addProcessLoader("ClearFeignDeathProcess",
- ProcessLoader<ClearFeignDeathProcess>::load);
+ ProcessLoader<ClearFeignDeathProcess>::load);
_kernel->addProcessLoader("LoiterProcess",
- ProcessLoader<LoiterProcess>::load);
+ ProcessLoader<LoiterProcess>::load);
_kernel->addProcessLoader("AvatarDeathProcess",
- ProcessLoader<AvatarDeathProcess>::load);
+ ProcessLoader<AvatarDeathProcess>::load);
_kernel->addProcessLoader("GrantPeaceProcess",
- ProcessLoader<GrantPeaceProcess>::load);
+ ProcessLoader<GrantPeaceProcess>::load);
_kernel->addProcessLoader("CombatProcess",
- ProcessLoader<CombatProcess>::load);
+ ProcessLoader<CombatProcess>::load);
_kernel->addProcessLoader("FireballProcess",
- ProcessLoader<FireballProcess>::load);
+ ProcessLoader<FireballProcess>::load);
_kernel->addProcessLoader("HealProcess",
- ProcessLoader<HealProcess>::load);
+ ProcessLoader<HealProcess>::load);
_kernel->addProcessLoader("SchedulerProcess",
- ProcessLoader<SchedulerProcess>::load);
+ ProcessLoader<SchedulerProcess>::load);
_kernel->addProcessLoader("InverterProcess",
- ProcessLoader<InverterProcess>::load);
+ ProcessLoader<InverterProcess>::load);
_kernel->addProcessLoader("ActorBarkNotifyProcess",
- ProcessLoader<ActorBarkNotifyProcess>::load);
+ ProcessLoader<ActorBarkNotifyProcess>::load);
_kernel->addProcessLoader("AmbushProcess",
- ProcessLoader<AmbushProcess>::load);
+ ProcessLoader<AmbushProcess>::load);
_kernel->addProcessLoader("TargetReticleProcess",
- ProcessLoader<TargetReticleProcess>::load);
+ ProcessLoader<TargetReticleProcess>::load);
_kernel->addProcessLoader("SurrenderProcess",
- ProcessLoader<SurrenderProcess>::load);
+ ProcessLoader<SurrenderProcess>::load);
_kernel->addProcessLoader("CruHealerProcess",
- ProcessLoader<CruHealerProcess>::load);
+ ProcessLoader<CruHealerProcess>::load);
_kernel->addProcessLoader("BatteryChargerProcess",
- ProcessLoader<BatteryChargerProcess>::load);
+ ProcessLoader<BatteryChargerProcess>::load);
_kernel->addProcessLoader("CycleProcess",
- ProcessLoader<CycleProcess>::load);
+ ProcessLoader<CycleProcess>::load);
_kernel->addProcessLoader("GuardProcess",
- ProcessLoader<GuardProcess>::load);
+ ProcessLoader<GuardProcess>::load);
_kernel->addProcessLoader("SnapProcess",
- ProcessLoader<SnapProcess>::load);
+ ProcessLoader<SnapProcess>::load);
_kernel->addProcessLoader("CrosshairProcess",
- ProcessLoader<CrosshairProcess>::load);
+ ProcessLoader<CrosshairProcess>::load);
_kernel->addProcessLoader("ItemSelectionProcess",
- ProcessLoader<ItemSelectionProcess>::load);
+ ProcessLoader<ItemSelectionProcess>::load);
_kernel->addProcessLoader("PaceProcess",
- ProcessLoader<PaceProcess>::load);
+ ProcessLoader<PaceProcess>::load);
_kernel->addProcessLoader("SuperSpriteProcess",
- ProcessLoader<SuperSpriteProcess>::load);
+ ProcessLoader<SuperSpriteProcess>::load);
_kernel->addProcessLoader("AttackProcess",
- ProcessLoader<AttackProcess>::load);
+ ProcessLoader<AttackProcess>::load);
_kernel->addProcessLoader("AutoFirerProcess",
- ProcessLoader<AutoFirerProcess>::load);
+ ProcessLoader<AutoFirerProcess>::load);
_kernel->addProcessLoader("BoboBoomerProcess",
- ProcessLoader<BoboBoomerProcess>::load);
+ ProcessLoader<BoboBoomerProcess>::load);
_kernel->addProcessLoader("RollingThunderProcess",
- ProcessLoader<RollingThunderProcess>::load);
+ ProcessLoader<RollingThunderProcess>::load);
_objectManager = new ObjectManager();
_mouse = new Mouse();
@@ -359,6 +324,84 @@ Common::Error Ultima8Engine::startup() {
return Common::kNoError;
}
+void Ultima8Engine::deinitialize() {
+ debug(MM_INFO, "-- Shutting down Game -- ");
+
+ // Save config here....
+
+ // reset mouse cursor
+ _mouse->popAllCursors();
+ _mouse->pushMouseCursor(Mouse::MOUSE_NORMAL);
+
+ delete _world;
+ _world = nullptr;
+
+ _objectManager->reset();
+
+ delete _ucMachine;
+ _ucMachine = nullptr;
+
+ _kernel->reset();
+ _paletteManager->reset();
+ _fontManager->resetGameFonts();
+
+ delete _game;
+ _game = nullptr;
+
+ delete _gameData;
+ _gameData = nullptr;
+
+ if (_audioMixer) {
+ _audioMixer->closeMidiOutput();
+ _audioMixer->reset();
+ delete _audioMixer;
+ _audioMixer = nullptr;
+ }
+
+ _desktopGump = nullptr;
+ _gameMapGump = nullptr;
+ _inverterGump = nullptr;
+
+ _timeOffset = -(int32)Kernel::get_instance()->getFrameNum();
+ _saveCount = 0;
+ _hasCheated = false;
+
+ _configFileMan->clearRoot("bindings");
+ _configFileMan->clearRoot("language");
+ _configFileMan->clearRoot("weapons");
+ _configFileMan->clearRoot("armour");
+ _configFileMan->clearRoot("monsters");
+ _configFileMan->clearRoot("game");
+ _gameInfo = nullptr;
+
+ debug(MM_INFO, "-- Game Shutdown -- ");
+}
+
+void Ultima8Engine::pauseEngineIntern(bool pause) {
+ if (_mixer)
+ _mixer->pauseAll(pause);
+ if (_audioMixer) {
+ MidiPlayer *midiPlayer = _audioMixer->getMidiPlayer();
+ if (midiPlayer)
+ midiPlayer->pause(pause);
+ }
+
+ _avatarMoverProcess->resetMovementFlags();
+}
+
+bool Ultima8Engine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsSubtitleOptions) ||
+ (f == kSupportsReturnToLauncher) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsChangingOptionsDuringRuntime);
+}
+
+Common::Language Ultima8Engine::getLanguage() const {
+ return _gameDescription->desc.language;
+}
+
bool Ultima8Engine::setupGame() {
GameInfo *info = new GameInfo;
info->_name = _gameDescription->desc.gameId;
@@ -548,59 +591,6 @@ Common::Error Ultima8Engine::startupGame() {
return Common::kNoError;
}
-void Ultima8Engine::shutdown() {
- debug(MM_INFO, "-- Shutting down Game -- ");
-
- // Save config here....
-
- // reset mouse cursor
- _mouse->popAllCursors();
- _mouse->pushMouseCursor(Mouse::MOUSE_NORMAL);
-
- delete _world;
- _world = nullptr;
-
- _objectManager->reset();
-
- delete _ucMachine;
- _ucMachine = nullptr;
-
- _kernel->reset();
- _paletteManager->reset();
- _fontManager->resetGameFonts();
-
- delete _game;
- _game = nullptr;
-
- delete _gameData;
- _gameData = nullptr;
-
- if (_audioMixer) {
- _audioMixer->closeMidiOutput();
- _audioMixer->reset();
- delete _audioMixer;
- _audioMixer = nullptr;
- }
-
- _desktopGump = nullptr;
- _gameMapGump = nullptr;
- _inverterGump = nullptr;
-
- _timeOffset = -(int32)Kernel::get_instance()->getFrameNum();
- _saveCount = 0;
- _hasCheated = false;
-
- _configFileMan->clearRoot("bindings");
- _configFileMan->clearRoot("language");
- _configFileMan->clearRoot("weapons");
- _configFileMan->clearRoot("armour");
- _configFileMan->clearRoot("monsters");
- _configFileMan->clearRoot("game");
- _gameInfo = nullptr;
-
- debug(MM_INFO, "-- Game Shutdown -- ");
-}
-
//
// To time the frames, we use "fast" ticks which come 3000 times a second.
//
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 27aea115dd0..f8756bbf000 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -129,17 +129,11 @@ private:
uint32 _moveKeyFrame; //!< An imperfect way for the Crusader usecode to stop remote camera viewing.
bool _cruStasis; //!< A slightly different kind of stasis for Crusader that stops some keyboard events
private:
- /**
- * Does engine deinitialization
- */
- void deinitialize();
-
/**
* Shows the Pentagram splash screen
*/
void showSplashScreen();
-private:
//! write savegame info (time, ..., game-specifics)
void writeSaveInfo(Common::WriteStream *ws);
@@ -165,7 +159,8 @@ protected:
// Engine APIs
Common::Error run() override;
- bool initialize();
+ Common::Error initialize();
+ void deinitialize();
void pauseEngineIntern(bool pause) override;
@@ -183,9 +178,6 @@ public:
Common::Language getLanguage() const;
- Common::Error startup();
- void shutdown();
-
bool setupGame();
Common::Error startupGame();
More information about the Scummvm-git-logs
mailing list