[Scummvm-git-logs] scummvm master -> 6b4f5809ee13f11b2ee5b341585d11d7f696ed03

mduggan mgithub at guarana.org
Sun Apr 26 10:27:28 UTC 2020


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
89516e47b0 ULTIMA8: Remove some unneccessary casts and typedefs
9277cc6c4a ULTIMA8: Fix crusader data file names
c30319f1e9 ULTIMA8: Fix potential null pointer access
df981ddacb ULTIMA8: Avoid uninitialized values if settingman fails
6b4f5809ee ULTIMA8: Adjust screen size config for crusader


Commit: 89516e47b0b5f4f5e9fc56ed061e2778d7a47100
    https://github.com/scummvm/scummvm/commit/89516e47b0b5f4f5e9fc56ed061e2778d7a47100
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-26T19:25:14+09:00

Commit Message:
ULTIMA8: Remove some unneccessary casts and typedefs

Changed paths:
    engines/ultima/ultima8/graphics/soft_render_surface.inl
    engines/ultima/ultima8/misc/common_types.h


diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.inl b/engines/ultima/ultima8/graphics/soft_render_surface.inl
index b3734bd8ba..fd0ee884f1 100644
--- a/engines/ultima/ultima8/graphics/soft_render_surface.inl
+++ b/engines/ultima/ultima8/graphics/soft_render_surface.inl
@@ -121,7 +121,7 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0;
 #define NOT_CLIPPED_Y (line >= 0 && line < scrn_height)
 #define OFFSET_PIXELS (off_pixels)
 
-	uint8				*off_pixels  = static_cast<uint8*>(_pixels) + static_cast<sintptr>(_clipWindow.x)*sizeof(uintX) + static_cast<sintptr>(_clipWindow.y)*_pitch;
+	uint8			*off_pixels  = _pixels + _clipWindow.x * sizeof(uintX) + _clipWindow.y * _pitch;
 	x -= _clipWindow.x;
 	y -= _clipWindow.y;
 
@@ -190,12 +190,12 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0;
 	y -= frame->_yoff;
 
 	for (int i = 0; i < height_; i++)  {
-		sintptr line = y + i;
+		int line = y + i;
 
 		if (NOT_CLIPPED_Y) {
 			const uint8	*srcline = srcpixels + i * width_;
 			const uint8	*srcmaskline = srcmask + i * width_;
-			uintX *dst_line_start = reinterpret_cast<uintX *>(static_cast<uint8*>(OFFSET_PIXELS) + _pitch * line);
+			uintX *dst_line_start = reinterpret_cast<uintX *>(OFFSET_PIXELS + _pitch * line);
 			LINE_END_ASSIGN;
 
 			for (int xpos = 0; xpos < width_; xpos++) {
diff --git a/engines/ultima/ultima8/misc/common_types.h b/engines/ultima/ultima8/misc/common_types.h
index 702e1b0b43..27ee2be8cb 100644
--- a/engines/ultima/ultima8/misc/common_types.h
+++ b/engines/ultima/ultima8/misc/common_types.h
@@ -37,33 +37,6 @@ enum DebugLevel {
 	MM_MINOR_WARN = 1
 };
 
-//
-// {s,u}int{8,16,32,ptr}
-//
-#ifndef BASIC_TYPES_DEFINED
-#define BASIC_TYPES_DEFINED
-
-#ifndef EX_TYPE_INT8
-#define EX_TYPE_INT8 char
-#endif
-
-#ifndef EX_TYPE_INT16
-#define EX_TYPE_INT16 int16
-#endif
-
-#ifndef EX_TYPE_INT32
-#define EX_TYPE_INT32 int32
-#endif
-
-#ifndef EX_TYPE_INTPTR
-#define EX_TYPE_INTPTR long long
-#endif
-
-typedef unsigned EX_TYPE_INTPTR uintptr;
-typedef signed EX_TYPE_INTPTR sintptr;
-
-#endif
-
 // ObjId and ProcId
 
 //! 16-Bit ID of an Object


Commit: 9277cc6c4ab65f2c9d245350fca8bf2be9f2d1bc
    https://github.com/scummvm/scummvm/commit/9277cc6c4ab65f2c9d245350fca8bf2be9f2d1bc
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-26T19:25:14+09:00

Commit Message:
ULTIMA8: Fix crusader data file names

Changed paths:
    engines/ultima/ultima8/games/game_data.cpp


diff --git a/engines/ultima/ultima8/games/game_data.cpp b/engines/ultima/ultima8/games/game_data.cpp
index 8a852328c7..33912ed4f4 100644
--- a/engines/ultima/ultima8/games/game_data.cpp
+++ b/engines/ultima/ultima8/games/game_data.cpp
@@ -475,9 +475,9 @@ SpeechFlex *GameData::getSpeechFlex(uint32 shapeNum) {
 void GameData::loadRemorseData() {
 	FileSystem *filesystem = FileSystem::get_instance();
 
-	Common::SeekableReadStream *fd = filesystem->ReadFile("@game/static/_fixed.dat");
+	Common::SeekableReadStream *fd = filesystem->ReadFile("@game/static/fixed.dat");
 	if (!fd)
-		error("Unable to load static/_fixed.dat");
+		error("Unable to load static/fixed.dat");
 
 	_fixed = new RawArchive(fd);
 
@@ -565,26 +565,26 @@ void GameData::loadRemorseData() {
 	delete globflex;
 
 	// Load fonts
-	Common::SeekableReadStream *fds = filesystem->ReadFile("@game/static/_fonts.flx");
+	Common::SeekableReadStream *fds = filesystem->ReadFile("@game/static/fonts.flx");
 	if (!fds)
-		error("Unable to load static/_fonts.flx");
+		error("Unable to load static/fonts.flx");
 
 	_fonts = new FontShapeArchive(fds, OTHER,
 	                             PaletteManager::get_instance()->getPalette(PaletteManager::Pal_Game));
 	_fonts->setHVLeads();
 
 	// Load mouse
-	IDataSource *msds = filesystem->ReadFile("@game/static/_mouse.shp");
+	IDataSource *msds = filesystem->ReadFile("@game/static/mouse.shp");
 	if (!msds)
-		error("Unable to load static/_mouse.shp");
+		error("Unable to load static/mouse.shp");
 
 	_mouse = new Shape(msds, 0);
 	_mouse->setPalette(PaletteManager::get_instance()->getPalette(PaletteManager::Pal_Game));
 	delete msds;
 
-	Common::SeekableReadStream *gumpds = filesystem->ReadFile("@game/static/_gumps.flx");
+	Common::SeekableReadStream *gumpds = filesystem->ReadFile("@game/static/gumps.flx");
 	if (!gumpds)
-		error("Unable to load static/_gumps.flx");
+		error("Unable to load static/gumps.flx");
 
 	_gumps = new GumpShapeArchive(gumpds, GUMPS,
 		PaletteManager::get_instance()->getPalette(PaletteManager::Pal_Game));
@@ -602,9 +602,9 @@ void GameData::loadRemorseData() {
 	_music = nullptr; //new MusicFlex(dummyds);
 	delete dummyrs;
 #if 0
-	Common::SeekableReadStream *mf = filesystem->ReadFile("@game/sound/_music.flx");
+	Common::SeekableReadStream *mf = filesystem->ReadFile("@game/sound/music.flx");
 	if (!mf)
-		error("Unable to load sound/_music.flx");
+		error("Unable to load sound/music.flx");
 
 	_music = new MusicFlex(mf);
 #endif


Commit: c30319f1e967a79da69f99f029333b47385361be
    https://github.com/scummvm/scummvm/commit/c30319f1e967a79da69f99f029333b47385361be
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-26T19:25:14+09:00

Commit Message:
ULTIMA8: Fix potential null pointer access

Changed paths:
    engines/ultima/ultima8/audio/music_process.cpp


diff --git a/engines/ultima/ultima8/audio/music_process.cpp b/engines/ultima/ultima8/audio/music_process.cpp
index 414e619a1c..d4d6cbb3a1 100644
--- a/engines/ultima/ultima8/audio/music_process.cpp
+++ b/engines/ultima/ultima8/audio/music_process.cpp
@@ -50,7 +50,8 @@ MusicProcess::MusicProcess(MidiPlayer *player) : _midiPlayer(player),
 }
 
 MusicProcess::~MusicProcess() {
-	_midiPlayer->stop();
+	if (_midiPlayer)
+		_midiPlayer->stop();
 	_theMusicProcess = nullptr;
 }
 


Commit: df981ddacb8fcad1c27f5cee579e22ec5e2ab7a6
    https://github.com/scummvm/scummvm/commit/df981ddacb8fcad1c27f5cee579e22ec5e2ab7a6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-26T19:25:14+09:00

Commit Message:
ULTIMA8: Avoid uninitialized values if settingman fails

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


diff --git a/engines/ultima/ultima8/gumps/menu_gump.cpp b/engines/ultima/ultima8/gumps/menu_gump.cpp
index 05d00b7c4c..e4acd1da85 100644
--- a/engines/ultima/ultima8/gumps/menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/menu_gump.cpp
@@ -119,7 +119,8 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
 
 	if (!_nameEntryMode) {
 		SettingManager *settingman = SettingManager::get_instance();
-		bool endgame, quotes;
+		bool endgame = false;
+		bool quotes = false;
 		settingman->get("endgame", endgame);
 		settingman->get("quotes", quotes);
 


Commit: 6b4f5809ee13f11b2ee5b341585d11d7f696ed03
    https://github.com/scummvm/scummvm/commit/6b4f5809ee13f11b2ee5b341585d11d7f696ed03
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-26T19:25:14+09:00

Commit Message:
ULTIMA8: Adjust screen size config for crusader

Changed paths:
    engines/ultima/ultima8/games/game.cpp
    engines/ultima/ultima8/gumps/scaler_gump.cpp
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/ultima8.h


diff --git a/engines/ultima/ultima8/games/game.cpp b/engines/ultima/ultima8/games/game.cpp
index 0cc33ea631..a223702ca5 100644
--- a/engines/ultima/ultima8/games/game.cpp
+++ b/engines/ultima/ultima8/games/game.cpp
@@ -50,6 +50,7 @@ Game *Game::createGame(GameInfo *info) {
 	case GameInfo::GAME_U8:
 		return new U8Game();
 	case GameInfo::GAME_REMORSE:
+	case GameInfo::GAME_REGRET:
 		return new RemorseGame();
 	default:
 		CANT_HAPPEN_MSG("createGame: invalid _game");
diff --git a/engines/ultima/ultima8/gumps/scaler_gump.cpp b/engines/ultima/ultima8/gumps/scaler_gump.cpp
index 27389f71da..409afa2a55 100644
--- a/engines/ultima/ultima8/gumps/scaler_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scaler_gump.cpp
@@ -180,8 +180,13 @@ void ScalerGump::setupScaling() {
 	FORGET_OBJECT(_buffer1);
 	FORGET_OBJECT(_buffer2);
 
-	_swidth1 = 320;
-	_sheight1 = 200;
+	if (CoreApp::get_instance()->getGameInfo() && GAME_IS_U8) {
+		_swidth1 = Ultima8Engine::U8_DEFAULT_SCREEN_WIDTH;
+		_sheight1 = Ultima8Engine::U8_DEFAULT_SCREEN_HEIGHT;
+	} else {
+		_swidth1 = Ultima8Engine::CRUSADER_DEFAULT_SCREEN_WIDTH;
+		_sheight1 = Ultima8Engine::CRUSADER_DEFAULT_SCREEN_HEIGHT;
+	}
 	_swidth2 = 0;
 	_sheight2 = 0;
 	const Scaler *point = &Ultima8Engine::get_instance()->point_scaler;
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 89b69022e6..6b3968f730 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -276,8 +276,6 @@ void Ultima8Engine::startup() {
 	_objectManager = new ObjectManager();
 	_mouse = new Mouse();
 
-	GraphicSysInit();
-
 	// Audio Mixer
 	_audioMixer = new AudioMixer(_mixer);
 
@@ -286,12 +284,14 @@ void Ultima8Engine::startup() {
 	// We Attempt to startup _game
 	setupGameList();
 	GameInfo *info = getDefaultGame();
-	if (setupGame(info))
+
+	if (setupGame(info)) {
+		GraphicSysInit();
 		startupGame();
-	else
+	} else {
 		// Couldn't setup the game, should never happen?
 		CANT_HAPPEN_MSG("default game failed to initialize");
-
+	}
 	paint();
 }
 
@@ -306,6 +306,9 @@ void Ultima8Engine::startupGame() {
 		_ucMachine = new UCMachine(U8Intrinsics, 256);
 	} else if (_gameInfo->_type == GameInfo::GAME_REMORSE) {
 		_ucMachine = new UCMachine(RemorseIntrinsics, 308);
+	} else if (_gameInfo->_type == GameInfo::GAME_REGRET) {
+		// TODO: Do these work the same as remorse?
+		_ucMachine = new UCMachine(RemorseIntrinsics, 308);
 	} else {
 		CANT_HAPPEN_MSG("Invalid game type.");
 	}
@@ -566,8 +569,13 @@ void Ultima8Engine::paint() {
 }
 
 void Ultima8Engine::GraphicSysInit() {
-	_settingMan->setDefault("width", DEFAULT_SCREEN_WIDTH);
-	_settingMan->setDefault("height", DEFAULT_SCREEN_HEIGHT);
+	if (GAME_IS_U8) {
+		_settingMan->setDefault("width", U8_DEFAULT_SCREEN_WIDTH);
+		_settingMan->setDefault("height", U8_DEFAULT_SCREEN_HEIGHT);
+	} else {
+		_settingMan->setDefault("width", CRUSADER_DEFAULT_SCREEN_WIDTH);
+		_settingMan->setDefault("height", CRUSADER_DEFAULT_SCREEN_HEIGHT);
+	}
 	_settingMan->setDefault("bpp", 16);
 
 	int width, height, bpp;
@@ -592,8 +600,8 @@ void Ultima8Engine::GraphicSysInit() {
 	RenderSurface *new_screen = RenderSurface::SetVideoMode(width, height, bpp);
 
 	if (!new_screen) {
-		perr << Common::String::format("Unable to set new video mode. Trying %dx%dx32", width, height) << Std::endl;
-		new_screen = RenderSurface::SetVideoMode(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32);
+		perr << Common::String::format("Unable to set new video mode. Trying %dx%dx32", U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT) << Std::endl;
+		new_screen = RenderSurface::SetVideoMode(U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT, 32);
 	}
 
 	if (!new_screen) {
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index e25385d265..2f7feddaf4 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -50,9 +50,6 @@
 namespace Ultima {
 namespace Ultima8 {
 
-#define DEFAULT_SCREEN_WIDTH 320
-#define DEFAULT_SCREEN_HEIGHT 200
-
 class Debugger;
 class Kernel;
 class MemoryManager;
@@ -215,6 +212,10 @@ public:
 		return _painting;
 	}
 
+	static const int U8_DEFAULT_SCREEN_WIDTH = 320;
+	static const int U8_DEFAULT_SCREEN_HEIGHT = 200;
+	static const int CRUSADER_DEFAULT_SCREEN_WIDTH = 640;
+	static const int CRUSADER_DEFAULT_SCREEN_HEIGHT = 480;
 
 	INTRINSIC(I_getCurrentTimerTick);
 	INTRINSIC(I_setAvatarInStasis);




More information about the Scummvm-git-logs mailing list