[Scummvm-git-logs] scummvm master -> 58f9fc1fd8d2f609147940d3d6dbc7356611b887

mduggan mgithub at guarana.org
Tue Sep 7 09:59:56 UTC 2021


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:
23d8fe58ce ULTIMA8: Provide message on why movies and sound don't work
8322c0cc9b ULTIMA8: JANITORIAL: Whitespace
58f9fc1fd8 ULTIMA8: Fix various potential null pointer accesses


Commit: 23d8fe58ce6ef0b755ee001ad309038a4d935508
    https://github.com/scummvm/scummvm/commit/23d8fe58ce6ef0b755ee001ad309038a4d935508
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-09-07T17:12:13+09:00

Commit Message:
ULTIMA8: Provide message on why movies and sound don't work

A few people have not noticed that the GOG version includes a CD image and some
files need to be taken from there.  This should help those people.

The same problem will happen for anyone who has an old install of the game and
forgets that it uses some files from the CD.

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


diff --git a/engines/ultima/ultima8/games/cru_game.cpp b/engines/ultima/ultima8/games/cru_game.cpp
index 433f15af83..701a9fe2ea 100644
--- a/engines/ultima/ultima8/games/cru_game.cpp
+++ b/engines/ultima/ultima8/games/cru_game.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "common/config-manager.h"
+#include "common/translation.h"
 
 #include "ultima/ultima8/misc/pent_include.h"
 #include "ultima/ultima8/games/cru_game.h"
@@ -43,6 +44,8 @@
 #include "ultima/ultima8/world/actors/npc_dat.h"
 #include "common/memstream.h"
 
+#include "gui/message.h"
+
 namespace Ultima {
 namespace Ultima8 {
 
@@ -159,7 +162,12 @@ ProcId CruGame::playIntroMovie(bool fade) {
 	if (_skipIntroMovie)
 		return 0;
 	const char *name = (GAME_IS_REMORSE ? "T01" : "origin");
-	return playMovie(name, fade, true);
+	ProcId pid = playMovie(name, fade, true);
+	if (!pid) {
+		GUI::MessageDialogWithURL dialog(_("Crusader intro movie file missing - check that the FLICS and SOUND directories have been copied from the CD.  More instructions are on the wiki: https://wiki.scummvm.org/index.php?title=Crusader:_No_Remorse."), "https://wiki.scummvm.org/index.php?title=Crusader:_No_Remorse");
+		dialog.runModal();
+	}
+	return pid;
 }
 
 ProcId CruGame::playIntroMovie2(bool fade) {


Commit: 8322c0cc9bb6c629a2fb8edb69fa24ba81c15f8a
    https://github.com/scummvm/scummvm/commit/8322c0cc9bb6c629a2fb8edb69fa24ba81c15f8a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-09-07T17:12:13+09:00

Commit Message:
ULTIMA8: JANITORIAL: Whitespace

Changed paths:
    engines/ultima/ultima8/convert/convert_shape.cpp


diff --git a/engines/ultima/ultima8/convert/convert_shape.cpp b/engines/ultima/ultima8/convert/convert_shape.cpp
index 260d6583d2..38287741c0 100644
--- a/engines/ultima/ultima8/convert/convert_shape.cpp
+++ b/engines/ultima/ultima8/convert/convert_shape.cpp
@@ -64,7 +64,7 @@ void ConvertShape::Read(Common::SeekableReadStream &source, const ConvertShapeFo
 		char ident[4];
 		source.read(ident, csf->_bytes_ident);
 
-		if (memcmp (ident, csf->_ident, csf->_bytes_ident)) {
+		if (memcmp(ident, csf->_ident, csf->_bytes_ident)) {
 			perr << "Warning: Corrupt shape!" << Std::endl;
 			return;
 		}
@@ -103,7 +103,7 @@ void ConvertShape::Read(Common::SeekableReadStream &source, const ConvertShapeFo
 
 	// Create _frames array
 	_frames = new ConvertShapeFrame[_num_frames];
-	memset (_frames, 0, _num_frames * sizeof(ConvertShapeFrame));
+	memset(_frames, 0, _num_frames * sizeof(ConvertShapeFrame));
 
 	// Now read the _frames
 	for(uint32 f = 0; f < _num_frames; ++f) {
@@ -316,7 +316,7 @@ void ConvertShapeFrame::ReadCmpFrame(Common::SeekableReadStream &source, const C
 
 	_bytes_rle = rlebuf.pos();
 	_rle_data = new uint8[_bytes_rle];
-	memcpy (_rle_data, rlebuf.getData(), _bytes_rle);
+	memcpy(_rle_data, rlebuf.getData(), _bytes_rle);
 }
 
 void ConvertShapeFrame::GetPixels(uint8 *buf, int32 count, int32 x, int32 y) {
@@ -427,7 +427,7 @@ bool ConvertShape::Check(Common::SeekableReadStream &source, const ConvertShapeF
 		ident[csf->_bytes_ident] = 0;
 		source.read(ident, csf->_bytes_ident);
 
-		if (memcmp (ident, csf->_ident, csf->_bytes_ident)) {
+		if (memcmp(ident, csf->_ident, csf->_bytes_ident)) {
 			// Return to start position
 			source.seek(start_pos);
 			return false;
@@ -447,7 +447,7 @@ bool ConvertShape::Check(Common::SeekableReadStream &source, const ConvertShapeF
 
 	// Create _frames array
 	ConvertShapeFrame oneframe;
-	memset (&oneframe, 0, sizeof(ConvertShapeFrame));
+	memset(&oneframe, 0, sizeof(ConvertShapeFrame));
 
 	// Now read the _frames
 	for (int f = 0; f < numFrames; f++) {
@@ -606,7 +606,7 @@ bool ConvertShape::CheckUnsafe(Common::SeekableReadStream &source, const Convert
 		ident[csf->_bytes_ident] = 0;
 		source.read(ident, csf->_bytes_ident);
 
-		if (memcmp (ident, csf->_ident, csf->_bytes_ident)) {
+		if (memcmp(ident, csf->_ident, csf->_bytes_ident)) {
 			// Return to start position
 			source.seek(start_pos);
 			return false;
@@ -626,7 +626,7 @@ bool ConvertShape::CheckUnsafe(Common::SeekableReadStream &source, const Convert
 
 	// Create _frames array
 	ConvertShapeFrame oneframe;
-	memset (&oneframe, 0, sizeof(ConvertShapeFrame));
+	memset(&oneframe, 0, sizeof(ConvertShapeFrame));
 
 	// Now read the _frames
 	for (int f = 0; f < numFrames; f++) {


Commit: 58f9fc1fd8d2f609147940d3d6dbc7356611b887
    https://github.com/scummvm/scummvm/commit/58f9fc1fd8d2f609147940d3d6dbc7356611b887
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-09-07T17:12:13+09:00

Commit Message:
ULTIMA8: Fix various potential null pointer accesses

I don't think any of these can happen in practice, but it will make clang
static analysis happy.

Changed paths:
    engines/ultima/ultima8/gumps/cru_credits_gump.cpp
    engines/ultima/ultima8/gumps/u8_save_gump.cpp
    engines/ultima/ultima8/gumps/widgets/button_widget.cpp
    engines/ultima/ultima8/world/actors/animation_tracker.cpp
    engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
    engines/ultima/ultima8/world/container.cpp


diff --git a/engines/ultima/ultima8/gumps/cru_credits_gump.cpp b/engines/ultima/ultima8/gumps/cru_credits_gump.cpp
index 2b439129b5..a07784a459 100644
--- a/engines/ultima/ultima8/gumps/cru_credits_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_credits_gump.cpp
@@ -172,6 +172,11 @@ void CruCreditsGump::run() {
 	for (Common::Array<CredLine>::const_iterator iter = lines.begin();
 		 iter != lines.end(); iter++) {
 		Font *linefont = (iter->_lineType == kCredTitle) ? titlefont : namefont;
+		if (!linefont) {
+			// shouldn't happen.. just to be sure?
+			warning("can't render credits line type %d, font is null", iter->_lineType);
+			break;
+		}
 
 		unsigned int remaining;
 		RenderedText *rendered = linefont->renderText(iter->_text, remaining, 640, 0, Font::TEXT_CENTER);
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
index 38090313ac..fa300a4a14 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
@@ -203,9 +203,8 @@ void U8SaveGump::onMouseClick(int button, int32 mx, int32 my) {
 	}
 
 	if (!_save) {
-
 		// If our parent has a notifiy process, we'll put our result in it and wont actually load the game
-		GumpNotifyProcess *p = _parent->GetNotifyProcess();
+		GumpNotifyProcess *p = _parent ? _parent->GetNotifyProcess() : nullptr;
 		if (p) {
 			// Do nothing in this case
 			if (index != 1 && _descriptions[i].empty()) return;
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
index 0a1a342cdb..31639d7174 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
@@ -45,6 +45,7 @@ ButtonWidget::ButtonWidget(int x, int y, Std::string txt, bool gamefont,
 	Gump(x, y, w, h, 0, 0, layer), _shapeUp(nullptr), _shapeDown(nullptr),
 	_mouseOver(false), _origW(w), _origH(h), _frameNumUp(0), _frameNumDown(0) {
 	TextWidget *widget = new TextWidget(0, 0, txt, gamefont, font, w, h);
+	// FIXME: Do we ever free this widget?
 	_textWidget = widget->getObjId();
 	_mouseOverBlendCol = mouseOverBlendCol;
 	_mouseOver = (_mouseOverBlendCol != 0);
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index 48501dbdf3..e71840ed4f 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -659,7 +659,7 @@ bool AnimationTracker::load(Common::ReadStream *rs, uint32 version) {
 			unsigned int i = _currentFrame;
 			if (!_firstFrame) i = getNextFrame(i);
 
-			for (; i != _endFrame; i = getNextFrame(i)) {
+			for (; _animAction && i != _endFrame; i = getNextFrame(i)) {
 				const AnimFrame &f = _animAction->getFrame(_dir, i);
 				if (f.is_onground())
 					++_targetOffGroundLeft;
diff --git a/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp b/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
index f76df38342..dfe4e0b72a 100644
--- a/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
@@ -89,6 +89,10 @@ void RollingThunderProcess::run() {
 		return;
 	}
 
+	// Should end up with some target here??
+	if (!target)
+		return;
+
 	Animation::Sequence anim = (getRandom() % 2) ? Animation::combatRollLeft : Animation::combatRollRight;
 
 	Direction actordir = actor->getDir();
diff --git a/engines/ultima/ultima8/world/container.cpp b/engines/ultima/ultima8/world/container.cpp
index 49c46100b7..0fc1816f71 100644
--- a/engines/ultima/ultima8/world/container.cpp
+++ b/engines/ultima/ultima8/world/container.cpp
@@ -199,6 +199,7 @@ void Container::removeContents() {
 void Container::destroyContents() {
 	while (_contents.begin() != _contents.end()) {
 		Item *item = *(_contents.begin());
+		assert(item);
 		Container *cont = dynamic_cast<Container *>(item);
 		if (cont) cont->destroyContents();
 		item->destroy(true); // we destroy the item immediately




More information about the Scummvm-git-logs mailing list