[Scummvm-git-logs] scummvm master -> 96912ee3f1c9bd169b38cc9056a44a64638bd893

sev- sev at scummvm.org
Mon Feb 10 14:06:14 UTC 2020


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

Summary:
dfadfbd60b DIRECTOR: LINGO: Initial code for custom cursor parsing
80da619f47 GRAPHICS: MACGUI: Added possibility to specify custom cursor
9582cecb22 DIRECTOR: LINGO: Implemented custom cursor setting up
28d79f7f4e DIRECTOR: LINGO: Fix custom cursor rendering
1a99c07dff DIRECTOR: Implemented toString() for ARRAY
96912ee3f1 GRAPHICS: MACGUI: Moved Font::setName() method implementation out of the header


Commit: dfadfbd60b77755d071f195a0b11add91325d624
    https://github.com/scummvm/scummvm/commit/dfadfbd60b77755d071f195a0b11add91325d624
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-10T15:05:38+01:00

Commit Message:
DIRECTOR: LINGO: Initial code for custom cursor parsing

Changed paths:
    engines/director/lingo/lingo-funcs.cpp


diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 869e343..f30f20f 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -29,6 +29,7 @@
 
 #include "director/director.h"
 #include "director/lingo/lingo.h"
+#include "director/cast.h"
 #include "director/score.h"
 #include "director/sound.h"
 #include "director/util.h"
@@ -326,14 +327,49 @@ void Lingo::func_playdone() {
 	func_goto(f, m);
 }
 
-void Lingo::func_cursor(int c, int mask) {
+void Lingo::func_cursor(int c, int m) {
 	if (_cursorOnStack) {
 		// pop cursor
 		_vm->getMacWindowManager()->popCursor();
 	}
 
-	if (mask != -1) {
-		warning("STUB: func_cursor(%d, %d)", c, mask);
+	if (m != -1) {
+		Score *score = _vm->getCurrentScore();
+		if (!score->_loadedCast->contains(c) || !score->_loadedCast->contains(m)) {
+			warning("cursor: non-existent cast reference");
+			return;
+		}
+
+		if (score->_loadedCast->getVal(c)->_type != kCastBitmap || score->_loadedCast->getVal(m)->_type != kCastBitmap) {
+			warning("cursor: wrong cast reference type");
+			return;
+		}
+
+		byte *assembly = (byte *)malloc(16 * 16);
+
+		for (int y = 0; y < 16; y++) {
+			byte *dst = assembly;
+			const byte *cursor, *mask;
+			bool nocursor = false;
+
+			if (y >= ((BitmapCast *)score->_loadedCast->getVal(c))->_surface->h ||
+					y >= ((BitmapCast *)score->_loadedCast->getVal(m))->_surface->h )
+				nocursor = true;
+
+			if (!nocursor) {
+				cursor = (const byte *)((BitmapCast *)score->_loadedCast->getVal(c))->_surface->getBasePtr(0, y);
+				mask = (const byte *)((BitmapCast *)score->_loadedCast->getVal(m))->_surface->getBasePtr(0, y);
+			}
+
+			for (int x = 0; x < 16; x++) {
+				*dst = (*cursor ? 1 : 0) || (*mask ? 0 : 3);
+				dst++;
+				cursor++;
+				mask++;
+			}
+		}
+
+		warning("STUB: func_cursor(%d, %d)", c, m);
 		return;
 	}
 


Commit: 80da619f473c9e3806910d06f41d153c871e8c12
    https://github.com/scummvm/scummvm/commit/80da619f473c9e3806910d06f41d153c871e8c12
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-10T15:05:38+01:00

Commit Message:
GRAPHICS: MACGUI: Added possibility to specify custom cursor

Changed paths:
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 7b9c048..b429325 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -499,6 +499,11 @@ void MacWindowManager::pushWatchCursor() {
 	CursorMan.pushCursorPalette(cursorPalette, 0, 2);
 }
 
+void MacWindowManager::pushCustomCursor(byte *data, int w, int h, int transcolor) {
+	CursorMan.pushCursor(data, w, h, 1, 1, transcolor);
+	CursorMan.pushCursorPalette(cursorPalette, 0, 2);
+}
+
 void MacWindowManager::popCursor() {
 	CursorMan.popCursor();
 	CursorMan.pushCursorPalette(cursorPalette, 0, 2);
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 963665d..4771690 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -211,6 +211,7 @@ public:
 	void pushCrossHairCursor();
 	void pushCrossBarCursor();
 	void pushWatchCursor();
+	void pushCustomCursor(byte *data, int w, int h, int transcolor);
 	void popCursor();
 
 	void pauseEngine(bool pause);


Commit: 9582cecb22474e74c7e5728b27dac31180272d11
    https://github.com/scummvm/scummvm/commit/9582cecb22474e74c7e5728b27dac31180272d11
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-10T15:05:38+01:00

Commit Message:
DIRECTOR: LINGO: Implemented custom cursor setting up

Changed paths:
    engines/director/lingo/lingo-funcs.cpp


diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index f30f20f..40158b6 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -352,24 +352,33 @@ void Lingo::func_cursor(int c, int m) {
 			const byte *cursor, *mask;
 			bool nocursor = false;
 
-			if (y >= ((BitmapCast *)score->_loadedCast->getVal(c))->_surface->h ||
-					y >= ((BitmapCast *)score->_loadedCast->getVal(m))->_surface->h )
+			if (y >= score->_loadedCast->getVal(c)->_surface->h ||
+					y >= score->_loadedCast->getVal(m)->_surface->h )
 				nocursor = true;
 
 			if (!nocursor) {
-				cursor = (const byte *)((BitmapCast *)score->_loadedCast->getVal(c))->_surface->getBasePtr(0, y);
-				mask = (const byte *)((BitmapCast *)score->_loadedCast->getVal(m))->_surface->getBasePtr(0, y);
+				cursor = (const byte *)score->_loadedCast->getVal(c)->_surface->getBasePtr(0, y);
+				mask = (const byte *)score->_loadedCast->getVal(m)->_surface->getBasePtr(0, y);
 			}
 
 			for (int x = 0; x < 16; x++) {
-				*dst = (*cursor ? 1 : 0) || (*mask ? 0 : 3);
+				if (x >= score->_loadedCast->getVal(c)->_surface->w ||
+						x >= score->_loadedCast->getVal(m)->_surface->w )
+					nocursor = true;
+
+				if (nocursor) {
+					*dst = 3;
+				} else {
+					*dst = (*cursor ? 1 : 0) || (*mask ? 0 : 3);
+					cursor++;
+					mask++;
+				}
 				dst++;
-				cursor++;
-				mask++;
 			}
 		}
 
-		warning("STUB: func_cursor(%d, %d)", c, m);
+		_vm->getMacWindowManager()->pushCustomCursor(assembly, 16, 16, 3);
+
 		return;
 	}
 


Commit: 28d79f7f4eed11b9fbc25167c17af6bbe8d8e59c
    https://github.com/scummvm/scummvm/commit/28d79f7f4eed11b9fbc25167c17af6bbe8d8e59c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-10T15:05:38+01:00

Commit Message:
DIRECTOR: LINGO: Fix custom cursor rendering

Changed paths:
    engines/director/lingo/lingo-funcs.cpp


diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 40158b6..5253c57 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -346,9 +346,9 @@ void Lingo::func_cursor(int c, int m) {
 		}
 
 		byte *assembly = (byte *)malloc(16 * 16);
+		byte *dst = assembly;
 
 		for (int y = 0; y < 16; y++) {
-			byte *dst = assembly;
 			const byte *cursor, *mask;
 			bool nocursor = false;
 
@@ -369,7 +369,7 @@ void Lingo::func_cursor(int c, int m) {
 				if (nocursor) {
 					*dst = 3;
 				} else {
-					*dst = (*cursor ? 1 : 0) || (*mask ? 0 : 3);
+					*dst = *mask ? 3 : (*cursor ? 1 : 0);
 					cursor++;
 					mask++;
 				}


Commit: 1a99c07dfff71d26a010c065950d14d3e6b3001a
    https://github.com/scummvm/scummvm/commit/1a99c07dfff71d26a010c065950d14d3e6b3001a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-10T15:05:38+01:00

Commit Message:
DIRECTOR: Implemented toString() for ARRAY

Changed paths:
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 371b7fc..f4f5910 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -510,6 +510,17 @@ Common::String *Datum::toString() {
 			*s = ((TextCast *)score->_loadedCast->getVal(idx))->_ptext;
 		}
 		break;
+	case ARRAY:
+		*s = "[";
+
+		for (int i = 0; i < u.farr->size(); i++) {
+			if (i > 0)
+				*s += ", ";
+			*s += *u.farr->operator[](i).toString();
+		}
+
+		*s += "]";
+		break;
 	default:
 		warning("Incorrect operation toString() for type: %s", type2str());
 	}


Commit: 96912ee3f1c9bd169b38cc9056a44a64638bd893
    https://github.com/scummvm/scummvm/commit/96912ee3f1c9bd169b38cc9056a44a64638bd893
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-10T15:05:46+01:00

Commit Message:
GRAPHICS: MACGUI: Moved Font::setName() method implementation out of the header

Changed paths:
    graphics/macgui/macfontmanager.cpp
    graphics/macgui/macfontmanager.h


diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index ff94038..46a32ed 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -337,6 +337,10 @@ void MacFontManager::clearFontMapping() {
 	_extraFontIds.clear();
 }
 
+void MacFont::setName(const char *name) {
+	_name = name;
+}
+
 const Common::String MacFontManager::getFontName(int id, int size, int slant, bool tryGen) {
 	Common::String n;
 
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index b4efdd7..f894de4 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -81,8 +81,8 @@ public:
 	int getSize() const { return _size; }
 	int getSlant() const { return _slant; }
 	Common::String getName() { return _name; }
-	void setName(Common::String &name) { _name = name; }
-	void setName(const char *name) { _name = name; }
+	void setName(Common::String &name) { setName(name.c_str()); }
+	void setName(const char *name);
 	FontManager::FontUsage getFallback() { return _fallback; }
 	bool isGenerated() { return _generated; }
 	void setGenerated(bool gen) { _generated = gen; }




More information about the Scummvm-git-logs mailing list