[Scummvm-git-logs] scummvm master -> 294b22a90da0209d72a32f42fce0acb156daa1aa

mduggan mgithub at guarana.org
Sat Aug 14 05:09:01 UTC 2021


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:
d317df77d2 ULTIMA8: Fix x offset of Crusader movie subtitle background
294b22a90d ULTIMA8: Rework Crusader startup to better match original


Commit: d317df77d2d717ae56fe630837f195a41ae849ce
    https://github.com/scummvm/scummvm/commit/d317df77d2d717ae56fe630837f195a41ae849ce
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-08-14T13:24:06+09:00

Commit Message:
ULTIMA8: Fix x offset of Crusader movie subtitle background

Changed paths:
    engines/ultima/ultima8/gumps/movie_gump.cpp


diff --git a/engines/ultima/ultima8/gumps/movie_gump.cpp b/engines/ultima/ultima8/gumps/movie_gump.cpp
index 4f5645fb94..7d108af552 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.cpp
+++ b/engines/ultima/ultima8/gumps/movie_gump.cpp
@@ -206,7 +206,7 @@ void MovieGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
 			subtitle->GetDims(textdims);
 			surf->GetSurfaceDims(screendims);
 			surf->Fill32(surf->getPixelFormat().RGBToColor(0, 0, 0),
-						 screendims.width() / 2 - 300,
+						 screendims.width() / 2 - 300 - screendims.left,
 						 y - 3,
 						 600,
 						 textdims.height() + 5);


Commit: 294b22a90da0209d72a32f42fce0acb156daa1aa
    https://github.com/scummvm/scummvm/commit/294b22a90da0209d72a32f42fce0acb156daa1aa
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-08-14T13:31:04+09:00

Commit Message:
ULTIMA8: Rework Crusader startup to better match original

The original has 2 ways to start a new game:

1. start from dos -> intro movies -> difficulty menu -> voice mail movie
	-> game
2. playing game (press esc) -> game menu (new game) -> difficulty menu
	-> voice mail movie -> game

We now match those sequences correctly.

There is one difference still - if you have a saved game, we will by default
load that.  Previously the game jumped straight into that, but since there is
now no other way to see the intro movies again, now they are always shown
first.  So the 3rd flow is (if you have a save game):

3. start scummvm -> intro movies -> game

Since some people might want to just jump straight into the game, I also added
a skip_intro config file setting which will skip the movies in this case.

Fixes #12758.

Changed paths:
    engines/ultima/ultima8/games/cru_game.cpp
    engines/ultima/ultima8/games/cru_game.h
    engines/ultima/ultima8/games/start_crusader_process.cpp
    engines/ultima/ultima8/games/start_crusader_process.h
    engines/ultima/ultima8/gumps/cru_menu_gump.cpp
    engines/ultima/ultima8/gumps/difficulty_gump.cpp
    engines/ultima/ultima8/gumps/difficulty_gump.h
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/ultima8.h


diff --git a/engines/ultima/ultima8/games/cru_game.cpp b/engines/ultima/ultima8/games/cru_game.cpp
index 177a31e41e..433f15af83 100644
--- a/engines/ultima/ultima8/games/cru_game.cpp
+++ b/engines/ultima/ultima8/games/cru_game.cpp
@@ -46,7 +46,7 @@
 namespace Ultima {
 namespace Ultima8 {
 
-CruGame::CruGame() : Game() {
+CruGame::CruGame() : Game(), _skipIntroMovie(false) {
 }
 
 CruGame::~CruGame() {
@@ -137,6 +137,8 @@ bool CruGame::startGame() {
 }
 
 bool CruGame::startInitialUsecode(int saveSlot) {
+	if (saveSlot >= 0 && ConfMan.getBool("skip_intro"))
+		_skipIntroMovie = true;
 	Process* proc = new StartCrusaderProcess(saveSlot);
 	Kernel::get_instance()->addProcess(proc);
 	return true;
@@ -154,11 +156,15 @@ static ProcId playMovie(const char *movieID, bool fade, bool noScale) {
 }
 
 ProcId CruGame::playIntroMovie(bool fade) {
+	if (_skipIntroMovie)
+		return 0;
 	const char *name = (GAME_IS_REMORSE ? "T01" : "origin");
 	return playMovie(name, fade, true);
 }
 
 ProcId CruGame::playIntroMovie2(bool fade) {
+	if (_skipIntroMovie)
+		return 0;
 	const char *name = (GAME_IS_REMORSE ? "T02" : "ANIM01");
 	return playMovie(name, fade, false);
 }
diff --git a/engines/ultima/ultima8/games/cru_game.h b/engines/ultima/ultima8/games/cru_game.h
index bd8c8fcf36..e5d5ab0589 100644
--- a/engines/ultima/ultima8/games/cru_game.h
+++ b/engines/ultima/ultima8/games/cru_game.h
@@ -54,6 +54,14 @@ public:
 
 	/** Play credits but without showing a menu at the end - just finish. */
 	ProcId playCreditsNoMenu();
+
+	void setSkipIntroMovie() {
+		_skipIntroMovie = true;
+	}
+
+private:
+	/** Whether this game should skip the intro movie on startup */
+	bool _skipIntroMovie;
 };
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/games/start_crusader_process.cpp b/engines/ultima/ultima8/games/start_crusader_process.cpp
index fda2b30c2a..db61dffc4d 100644
--- a/engines/ultima/ultima8/games/start_crusader_process.cpp
+++ b/engines/ultima/ultima8/games/start_crusader_process.cpp
@@ -26,6 +26,7 @@
 #include "ultima/ultima8/world/actors/main_actor.h"
 #include "ultima/ultima8/ultima8.h"
 #include "ultima/ultima8/kernel/kernel.h"
+#include "ultima/ultima8/gumps/difficulty_gump.h"
 #include "ultima/ultima8/gumps/cru_status_gump.h"
 #include "ultima/ultima8/gumps/cru_pickup_area_gump.h"
 #include "ultima/ultima8/world/get_object.h"
@@ -39,29 +40,29 @@ namespace Ultima8 {
 DEFINE_RUNTIME_CLASSTYPE_CODE(StartCrusaderProcess)
 
 StartCrusaderProcess::StartCrusaderProcess(int saveSlot) : Process(),
-		_initStage(PlayFirstMovie), _saveSlot(saveSlot), _skipStart(saveSlot >= 0) {
+_initStage(PlayFirstMovie), _saveSlot(saveSlot) {
 }
 
 
 void StartCrusaderProcess::run() {
-	if (!_skipStart && _initStage == PlayFirstMovie) {
+	if (_initStage == PlayFirstMovie) {
 		_initStage = PlaySecondMovie;
 		ProcId moviepid = Game::get_instance()->playIntroMovie(false);
 		Process *movieproc = Kernel::get_instance()->getProcess(moviepid);
 		if (movieproc) {
 			waitFor(movieproc);
-			return;
 		}
-	} else if (!_skipStart && _initStage == PlaySecondMovie) {
-		_initStage = ShowMenu;
+		return;
+	} else if (_initStage == PlaySecondMovie) {
+		_initStage = ShowDifficultyMenu;
 		CruGame *game = dynamic_cast<CruGame *>(Game::get_instance());
 		assert(game);
 		ProcId moviepid = game->playIntroMovie2(false);
 		Process *movieproc = Kernel::get_instance()->getProcess(moviepid);
 		if (movieproc) {
 			waitFor(movieproc);
-			return;
 		}
+		return;
 	}
 
 	// Try to load the save game, if succeeded this pointer will no longer be valid
@@ -69,62 +70,68 @@ void StartCrusaderProcess::run() {
 		return;
 	}
 
+	if (_initStage == ShowDifficultyMenu) {
+		DifficultyGump *gump = new DifficultyGump();
+		_initStage = StartGame;
+		gump->InitGump(nullptr, true);
+		return;
+	}
+
 	Gump *statusGump = new CruStatusGump(true);
 	statusGump->InitGump(nullptr, false);
 
 	Gump *cruPickupAreaGump = new CruPickupAreaGump(true);
 	cruPickupAreaGump->InitGump(nullptr, false);
 
-	Ultima8Engine::get_instance()->setCheatMode(true);
-
-	if (!_skipStart) {
-		MainActor *avatar = getMainActor();
-		int mapnum = avatar->getMapNum();
+	MainActor *avatar = getMainActor();
+	int mapnum = avatar->getMapNum();
 
-		// These items are the same in Regret and Remorse
-		Item *datalink = ItemFactory::createItem(0x4d4, 0, 0, 0, 0, mapnum, 0, true);
-		avatar->addItemCru(datalink, false);
-		Item *smiley = ItemFactory::createItem(0x598, 0, 0, 0, 0, mapnum, 0, true);
-		smiley->moveToContainer(avatar);
+	// These items are the same in Regret and Remorse
+	Item *datalink = ItemFactory::createItem(0x4d4, 0, 0, 0, 0, mapnum, 0, true);
+	avatar->addItemCru(datalink, false);
+	Item *smiley = ItemFactory::createItem(0x598, 0, 0, 0, 0, mapnum, 0, true);
+	smiley->moveToContainer(avatar);
 
-		avatar->setShieldType(1);
+	avatar->setShieldType(1);
 
 #if 0
-		// Give the avatar *all the weapons and ammo*.. (handy for testing)
-		static const uint32 wpnshapes[] = {
-			// Weapons
-			0x032E, 0x032F, 0x0330, 0x038C, 0x0332, 0x0333, 0x0334,
-			0x038E, 0x0388, 0x038A, 0x038D, 0x038B, 0x0386,
-			// Ammo
-			0x033D, 0x033E, 0x033F, 0x0340, 0x0341
-			// No Regret Weapons
-			0x5F6, 0x5F5, 0x198,
-			// No Regret Ammo
-			0x615, 0x614
-		};
-		for (int i = 0; i < ARRAYSIZE(wpnshapes); i++) {
-			for (int j = 0; j < 5; j++) {
-				Item *wpn = ItemFactory::createItem(wpnshapes[i], 0, 0, 0, 0, mapnum, 0, true);
-				avatar->addItemCru(wpn, false);
-			}
-		}
-#endif
+	// Give the avatar *all the weapons and ammo*.. (handy for testing)
 
-		avatar->teleport(1, 0x1e);
-		// The first level 0x1e teleporter in No Remorse goes straight to another
-		// teleport, so undo the flag that normally stops that.
-		avatar->setJustTeleported(false);
+	Ultima8Engine::get_instance()->setCheatMode(true);
 
-		if (GAME_IS_REGRET) {
-			avatar->setInCombat(0);
-			avatar->setDir(dir_south);
-			avatar->setActorFlag(Actor::ACT_WEAPONREADY);
+	static const uint32 wpnshapes[] = {
+		// Weapons
+		0x032E, 0x032F, 0x0330, 0x038C, 0x0332, 0x0333, 0x0334,
+		0x038E, 0x0388, 0x038A, 0x038D, 0x038B, 0x0386,
+		// Ammo
+		0x033D, 0x033E, 0x033F, 0x0340, 0x0341
+		// No Regret Weapons
+		0x5F6, 0x5F5, 0x198,
+		// No Regret Ammo
+		0x615, 0x614
+	};
+	for (int i = 0; i < ARRAYSIZE(wpnshapes); i++) {
+		for (int j = 0; j < 5; j++) {
+			Item *wpn = ItemFactory::createItem(wpnshapes[i], 0, 0, 0, 0, mapnum, 0, true);
+			avatar->addItemCru(wpn, false);
 		}
+	}
+#endif
+
+	avatar->teleport(1, 0x1e);
+	// The first level 0x1e teleporter in No Remorse goes straight to another
+	// teleport, so undo the flag that normally stops that.
+	avatar->setJustTeleported(false);
 
-		Process *fader = new PaletteFaderProcess(0x00FFFFFF, true, 0x7FFF, 60, false);
-		Kernel::get_instance()->addProcess(fader);
+	if (GAME_IS_REGRET) {
+		avatar->setInCombat(0);
+		avatar->setDir(dir_south);
+		avatar->setActorFlag(Actor::ACT_WEAPONREADY);
 	}
 
+	Process *fader = new PaletteFaderProcess(0x00FFFFFF, true, 0x7FFF, 60, false);
+	Kernel::get_instance()->addProcess(fader);
+
 	Ultima8Engine::get_instance()->setAvatarInStasis(false);
 
 	terminate();
diff --git a/engines/ultima/ultima8/games/start_crusader_process.h b/engines/ultima/ultima8/games/start_crusader_process.h
index a5db7efa93..c95eb71675 100644
--- a/engines/ultima/ultima8/games/start_crusader_process.h
+++ b/engines/ultima/ultima8/games/start_crusader_process.h
@@ -36,16 +36,16 @@ public:
 	enum CruInitStage {
 		PlayFirstMovie,
 		PlaySecondMovie,
-		ShowMenu
+		ShowDifficultyMenu,
+		StartGame
 	};
 
 protected:
 	CruInitStage _initStage;
-	bool _skipStart;
 	int _saveSlot;
 
 public:
-	StartCrusaderProcess(int saveSlot = -1);
+	StartCrusaderProcess(int saveSlot);
 
 	ENABLE_RUNTIME_CLASSTYPE()
 
diff --git a/engines/ultima/ultima8/gumps/cru_menu_gump.cpp b/engines/ultima/ultima8/gumps/cru_menu_gump.cpp
index 7c4ab66cf3..420a715d78 100644
--- a/engines/ultima/ultima8/gumps/cru_menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_menu_gump.cpp
@@ -202,9 +202,11 @@ void CruMenuGump::ChildNotify(Gump *child, uint32 message) {
 void CruMenuGump::selectEntry(int entry) {
 	switch (entry) {
 	case 1: { // New Game
-		DifficultyGump *gump = new DifficultyGump();
-		gump->InitGump(0);
-		gump->setRelativePosition(CENTER);
+		Ultima8Engine::get_instance()->newGame(-1);
+		// When starting a new game from the menu, we skip intro movies.
+		CruGame *game = dynamic_cast<CruGame *>(Game::get_instance());
+		assert(game);
+		game->setSkipIntroMovie();
 		break;
 	}
 	case 2:
diff --git a/engines/ultima/ultima8/gumps/difficulty_gump.cpp b/engines/ultima/ultima8/gumps/difficulty_gump.cpp
index c4db64f3d3..a8ab6bb7cb 100644
--- a/engines/ultima/ultima8/gumps/difficulty_gump.cpp
+++ b/engines/ultima/ultima8/gumps/difficulty_gump.cpp
@@ -26,6 +26,8 @@
 #include "ultima/ultima8/graphics/palette_manager.h"
 #include "ultima/ultima8/ultima8.h"
 #include "ultima/ultima8/games/game_data.h"
+#include "ultima/ultima8/kernel/mouse.h"
+#include "ultima/ultima8/world/world.h"
 #include "ultima/ultima8/graphics/shape.h"
 #include "ultima/ultima8/graphics/shape_frame.h"
 
@@ -55,6 +57,10 @@ static const int RIGHT_FRAME_IDX_OFFSET = 16;
 void DifficultyGump::InitGump(Gump *newparent, bool take_focus) {
 	ModalGump::InitGump(newparent, take_focus);
 
+	Mouse *mouse = Mouse::get_instance();
+	mouse->pushMouseCursor();
+	mouse->setMouseCursor(Mouse::MOUSE_HAND);
+
 	_dims.top = 0;
 	_dims.left = 0;
 	_dims.bottom = 480;
@@ -121,6 +127,8 @@ void DifficultyGump::InitGump(Gump *newparent, bool take_focus) {
 }
 
 void DifficultyGump::Close(bool no_del) {
+	Mouse *mouse = Mouse::get_instance();
+	mouse->popMouseCursor();
 	ModalGump::Close(no_del);
 }
 
@@ -150,7 +158,8 @@ bool DifficultyGump::OnKeyDown(int key, int mod) {
 	if (ModalGump::OnKeyDown(key, mod)) return true;
 
 	if (key == Common::KEYCODE_ESCAPE) {
-		Close();
+		// Don't allow closing, we have to choose a difficulty.
+		return true;
 	} else if (key >= Common::KEYCODE_1 && key <= Common::KEYCODE_4) {
 		selectEntry(key - Common::KEYCODE_1 + 1);
 	} else if (key == Common::KEYCODE_UP) {
@@ -171,9 +180,9 @@ bool DifficultyGump::OnKeyDown(int key, int mod) {
 }
 
 void DifficultyGump::selectEntry(int num) {
-	debug(6, "select entry %d", num);
-	Ultima8Engine::get_instance()->newGame(-1, num);
-	// note; this is now deleted (the kernel will kill it)
+	debug(6, "selected difficulty %d", num);
+	World::get_instance()->setGameDifficulty(num);
+	Close();
 }
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/difficulty_gump.h b/engines/ultima/ultima8/gumps/difficulty_gump.h
index 5d1617a60f..5ba1ae434b 100644
--- a/engines/ultima/ultima8/gumps/difficulty_gump.h
+++ b/engines/ultima/ultima8/gumps/difficulty_gump.h
@@ -46,8 +46,6 @@ public:
 	void OnFocus(bool gain) override;
 	void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
 
-	static Gump *showLoadSaveGump(Gump *parent, bool save);
-
 private:
 	int _highlighted;
 	int32 _buttonWidth;
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 9b864f536a..82631897f3 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -1173,8 +1173,8 @@ void Ultima8Engine::setupCoreGumps() {
 		_objectManager->reserveObjId(i);
 }
 
-bool Ultima8Engine::newGame(int saveSlot, int difficulty) {
-	debugN(MM_INFO, "Starting New Game (slot %d difficulty %d)... \n", saveSlot, difficulty);
+bool Ultima8Engine::newGame(int saveSlot) {
+	debugN(MM_INFO, "Starting New Game (slot %d)... \n", saveSlot);
 
 	// First validate we still have a save file for the slot
 	if (saveSlot != -1) {
@@ -1215,12 +1215,6 @@ bool Ultima8Engine::newGame(int saveSlot, int difficulty) {
 	//	av->teleport(54, 14783,5959,8); // shrine of the Ancient Ones; Hanoi
 	//	av->teleport(5, 5104,22464,48); // East road (tenebrae end)
 
-	_game->startInitialUsecode(saveSlot);
-
-	if (difficulty > 0) {
-		_world->get_instance()->setGameDifficulty(difficulty);
-	}
-
 	if (GAME_IS_CRUSADER) {
 		_kernel->addProcess(new TargetReticleProcess());
 		_kernel->addProcess(new ItemSelectionProcess());
@@ -1229,6 +1223,8 @@ bool Ultima8Engine::newGame(int saveSlot, int difficulty) {
 		_kernel->addProcess(new SnapProcess());
 	}
 
+	_game->startInitialUsecode(saveSlot);
+
 	if (saveSlot == -1)
 		ConfMan.set("lastSave", "");
 
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 4a11b1d2a4..bb2b4d1b50 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -349,7 +349,7 @@ public:
 
 	//! start a new game
 	//! \return true if succesful.
-	bool newGame(int saveSlot = -1, int difficulty = -1);
+	bool newGame(int saveSlot = -1);
 
 	//! Enter gump text mode (aka Unicode keyhandling)
 	void enterTextMode(Gump *);




More information about the Scummvm-git-logs mailing list