[Scummvm-git-logs] scummvm master -> 913229f9dbce3dc4b3670ffe5d7f7c4405d1a820

bluegr bluegr at gmail.com
Sun Aug 4 13:05:34 CEST 2019


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:
8940601413 MADS: Draw the portrait in V2 game dialogs
913229f9db MADS: Implement V2 DynamicHotspots::add()


Commit: 8940601413012ab0c2e1423415c4a9cfd4bcf7fa
    https://github.com/scummvm/scummvm/commit/8940601413012ab0c2e1423415c4a9cfd4bcf7fa
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-04T14:05:08+03:00

Commit Message:
MADS: Draw the portrait in V2 game dialogs

Changed paths:
    engines/mads/dialogs.cpp
    engines/mads/dialogs.h


diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp
index fa656a9..3373938 100644
--- a/engines/mads/dialogs.cpp
+++ b/engines/mads/dialogs.cpp
@@ -147,7 +147,7 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName,
 	: Dialog(vm) {
 	_font = _vm->_font->getFont(fontName);
 	_position = pos;
-	_icon = nullptr;
+	_portrait = nullptr;
 	_edgeSeries = nullptr;
 	_piecesPerCenter = 0;
 	_fontSpacing = 0;
@@ -158,10 +158,10 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName,
 }
 
 TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName,
-		const Common::Point &pos, MSurface *icon, int maxTextChars): Dialog(vm) {
+		const Common::Point &pos, MSurface *portrait, int maxTextChars): Dialog(vm) {
 	_font = _vm->_font->getFont(fontName);
 	_position = pos;
-	_icon = icon;
+	_portrait = portrait;
 	_edgeSeries = new SpriteAsset(_vm, "box.ss", PALFLAG_RESERVED);
 	_vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK);
 	_piecesPerCenter = _edgeSeries->getFrame(EDGE_UPPER_CENTER)->w / _edgeSeries->getFrame(EDGE_BOTTOM)->w;
@@ -174,6 +174,8 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName,
 void TextDialog::init(int maxTextChars) {
 	_innerWidth = (_font->maxWidth() + 1) * maxTextChars;
 	_width = _innerWidth + 10;
+	if (_portrait != nullptr)
+		_width += _portrait->w + 10;
 	_lineSize = maxTextChars * 2;
 	_lineWidth = 0;
 	_currentX = 0;
@@ -320,6 +322,20 @@ void TextDialog::draw() {
 	// Draw the underlying dialog
 	Dialog::draw();
 
+	// Draw the edges
+	if (_edgeSeries != nullptr) {
+		//_vm->_screen->transBlitFrom(*_edgeSeries->getFrame(EDGE_UPPER_LEFT), _position, 0xFF);
+		//_vm->_screen->transBlitFrom(*_edgeSeries->getFrame(EDGE_UPPER_RIGHT), _position);
+		//_vm->_screen->transBlitFrom(*_edgeSeries->getFrame(EDGE_LOWER_LEFT), Common::Point(_position.x, _position.y + _height));
+		//_vm->_screen->transBlitFrom(*_edgeSeries->getFrame(EDGE_LOWER_RIGHT), _position);
+	}
+
+	// Draw the portrait
+	if (_portrait != nullptr) {
+		Common::Point portraitPos = Common::Point(_position.x + 5, _position.y + 5);
+		_vm->_screen->transBlitFrom(*_portrait, portraitPos, 0xFF);
+	}
+
 	// Draw the text lines
 	int lineYp = _position.y + 5;
 	for (int lineNum = 0; lineNum <= _numLines; ++lineNum) {
@@ -335,6 +351,9 @@ void TextDialog::draw() {
 			if (_lineXp[lineNum] & 0x40)
 				++yp;
 
+			if (_portrait != nullptr)
+				xp += _portrait->w + 5;
+
 			_font->writeString(_vm->_screen, _lines[lineNum],
 				Common::Point(xp, yp), 1);
 
@@ -417,6 +436,8 @@ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...)
 Dialogs *Dialogs::init(MADSEngine *vm) {
 	if (vm->getGameID() == GType_RexNebular)
 		return new Nebular::DialogsNebular(vm);
+	//else if (vm->getGameID() == GType_Phantom)
+	//	return new Phantom::DialogsPhantom(vm);
 
 	// Throw a warning for now, since the associated Dialogs class isn't implemented yet
 	warning("Dialogs: Unknown game");
diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h
index 7642b76..e2db2d8 100644
--- a/engines/mads/dialogs.h
+++ b/engines/mads/dialogs.h
@@ -127,7 +127,7 @@ protected:
 	Common::String _lines[TEXT_DIALOG_MAX_LINES];
 	int _lineXp[TEXT_DIALOG_MAX_LINES];
 	SpriteAsset *_edgeSeries;
-	MSurface *_icon;
+	MSurface *_portrait;
 	int _piecesPerCenter;
 	int _fontSpacing;
 
@@ -151,11 +151,11 @@ public:
 	 * @param vm			Engine reference
 	 * @param fontName		Font to use for display
 	 * @param pos			Position for window top-left
-	 * @param icon			Speaker portrait to show in dialog
+	 * @param portrait		Speaker portrait to show in dialog
 	 * @param maxTextChars	Horizontal width of text portion of window in characters
 	 */
 	TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos,
-		MSurface *icon, int maxTextChars);
+		MSurface *portrait, int maxTextChars);
 
 	/**
 	 * Destructor


Commit: 913229f9dbce3dc4b3670ffe5d7f7c4405d1a820
    https://github.com/scummvm/scummvm/commit/913229f9dbce3dc4b3670ffe5d7f7c4405d1a820
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-04T14:05:09+03:00

Commit Message:
MADS: Implement V2 DynamicHotspots::add()

Changed paths:
    engines/mads/hotspots.cpp
    engines/mads/hotspots.h
    engines/mads/phantom/phantom_scenes1.cpp


diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp
index 098313e..06d5756 100644
--- a/engines/mads/hotspots.cpp
+++ b/engines/mads/hotspots.cpp
@@ -31,7 +31,9 @@ DynamicHotspot::DynamicHotspot() {
 	_facing = FACING_NONE;
 	_descId = 0;
 	_verbId = 0;
+	_valid = false;	// V2
 	_articleNumber = 0;
+	_syntax = 0;	// V2
 	_cursor = CURSOR_NONE;
 	_active = false;
 }
@@ -53,9 +55,36 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) {
 	_count = 0;
 }
 
-int DynamicHotspots::add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds) {
-	warning("TODO: DynamicHotspots::add(5 params))");
-	return add(descId, verbId, seqIndex, bounds);
+int DynamicHotspots::add(int descId, int verbId, byte syntax, int seqIndex, const Common::Rect &bounds) {
+	// Find a free slot
+	uint idx = 0;
+	while ((idx < _entries.size()) && _entries[idx]._active)
+		++idx;
+	if (idx == _entries.size())
+		error("DynamicHotspots overflow");
+
+	_entries[idx]._active = true;
+	_entries[idx]._descId = descId;
+	_entries[idx]._seqIndex = seqIndex;
+	_entries[idx]._bounds = bounds;
+	_entries[idx]._feetPos = Common::Point(-3, 0);
+	_entries[idx]._facing = FACING_NONE;
+	_entries[idx]._verbId = verbId;
+	_entries[idx]._articleNumber = PREP_IN;
+	_entries[idx]._syntax = syntax;
+	_entries[idx]._cursor = CURSOR_NONE;
+	_entries[idx]._valid = true;
+	_entries[idx]._animIndex = -1;
+
+	++_count;
+	_changed = true;
+
+	if (seqIndex >= 0) {
+		_vm->_game->_scene._sequences[seqIndex]._dynamicHotspotIndex = idx;
+		_entries[idx]._valid = false;
+	}
+
+	return idx;
 }
 
 int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rect &bounds) {
@@ -138,11 +167,13 @@ void DynamicHotspots::refresh() {
 	ScreenObjects &scrObjects = _vm->_game->_screenObjects;
 	scrObjects.resize(scrObjects._uiCount);
 
+	 bool isV2 = (_vm->getGameID() != GType_RexNebular);
+
 	// Loop through adding hotspots
 	for (uint i = 0; i < _entries.size(); ++i) {
 		DynamicHotspot &dh = (*this)[i];
 
-		if ((*this)[i]._active) {
+		if ((*this)[i]._active && (!isV2 || (*this)[i]._valid)) {
 			switch (scrObjects._inputMode) {
 			case kInputBuildingSentences:
 			case kInputLimitedSentences:
@@ -203,7 +234,7 @@ Hotspot::Hotspot(Common::SeekableReadStream &f, bool isV2) {
 	_cursor = (CursorType)f.readByte();
 	if (isV2) {
 		f.skip(1);		// cursor
-		f.skip(1);		// syntax
+		_syntax = f.readByte();
 	}
 	_vocabId = f.readUint16LE();
 	_verbId = f.readUint16LE();
diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h
index ffd53e5..1b6fb35 100644
--- a/engines/mads/hotspots.h
+++ b/engines/mads/hotspots.h
@@ -41,7 +41,9 @@ public:
 	Facing _facing;
 	int _descId;
 	int _verbId;
+	bool _valid;	// V2
 	int _articleNumber;
+	byte _syntax;	// V2
 	CursorType _cursor;
 
 	/**
@@ -79,7 +81,7 @@ public:
 
 	Common::Array<MADS::DynamicHotspot>::size_type size() const { return _entries.size(); }
 	DynamicHotspot &operator[](uint idx) { return _entries[idx]; }
-	int add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds);
+	int add(int descId, int verbId, byte syntax, int seqIndex, const Common::Rect &bounds);	// V2
 	int add(int descId, int verbId, int seqIndex, const Common::Rect &bounds);
 	int setPosition(int index, const Common::Point &pos, Facing facing);
 	int setCursor(int index, CursorType cursor);
@@ -107,6 +109,7 @@ public:
 	Facing _facing;
 	int _articleNumber;
 	bool _active;
+	byte _syntax;	// V2
 	CursorType _cursor;
 	int _vocabId;
 	int _verbId;
diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp
index 91f7555..2ce08ef 100644
--- a/engines/mads/phantom/phantom_scenes1.cpp
+++ b/engines/mads/phantom/phantom_scenes1.cpp
@@ -271,6 +271,7 @@ void Scene101::step() {
 		_talkCounter = 0;
 	}
 
+	// Monsieur Brie beckons Raul
 	if (_game._trigger == 50) {
 		_vm->_gameConv->run(0);
 		_callingStatus = 1;





More information about the Scummvm-git-logs mailing list