[Scummvm-git-logs] scummvm master -> 703ff18cb3e0a917500e7c23e2d2cf6aa1683f87

a-yyg 76591232+a-yyg at users.noreply.github.com
Sun Jul 18 03:58:11 UTC 2021


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:
1ce9f5614a SAGA2: Remove displayPage from gDisplayPort
f439b36bc8 SAGA2: Fix global constructor warning in vwdraw.cpp
ae1e995ccc SAGA2: Fix global constructor warnings in uidialog.cpp
17bcde4f6f SAGA2: Fix ActorAssignment deletion
703ff18cb3 SAGA2: Fix a global constructor warning in tilemode.cpp


Commit: 1ce9f5614a4124c2bff5d68829c5350041c3aab1
    https://github.com/scummvm/scummvm/commit/1ce9f5614a4124c2bff5d68829c5350041c3aab1
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-18T12:11:11+09:00

Commit Message:
SAGA2: Remove displayPage from gDisplayPort

Changed paths:
    engines/saga2/messager.cpp
    engines/saga2/panel.cpp
    engines/saga2/towerfta.cpp
    engines/saga2/vbacksav.cpp
    engines/saga2/vdraw.h
    engines/saga2/vwdraw.cpp


diff --git a/engines/saga2/messager.cpp b/engines/saga2/messager.cpp
index 7635a222f6..614c1811d0 100644
--- a/engines/saga2/messager.cpp
+++ b/engines/saga2/messager.cpp
@@ -68,20 +68,19 @@ uint16 blackStatusF = 24;
 uint16 heightStatusF = 11;
 
 int StatusLineMessager::dumpit(char *s, size_t size) {
-	if (textPort->displayPage != NULL) {
-		Rect16          r;
-
-		r.x = atX;
-		r.y = atY;
-		r.width = atW;
-		r.height = heightStatusF;
-
-		textPort->setColor(blackStatusF);
-		textPort->fillRect(r);
-		textPort->setColor(atColor);
-		textPort->setStyle(0);
-		textPort->drawTextInBox(s, size, r, textPosLeft, Point16(2, 1));
-	}
+	Rect16          r;
+
+	r.x = atX;
+	r.y = atY;
+	r.width = atW;
+	r.height = heightStatusF;
+
+	textPort->setColor(blackStatusF);
+	textPort->fillRect(r);
+	textPort->setColor(atColor);
+	textPort->setStyle(0);
+	textPort->drawTextInBox(s, size, r, textPosLeft, Point16(2, 1));
+
 	return 0;
 }
 
diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp
index b44f2dd5bc..17ddb65090 100644
--- a/engines/saga2/panel.cpp
+++ b/engines/saga2/panel.cpp
@@ -400,7 +400,6 @@ gWindow::gWindow(const Rect16 &box, uint16 ident, const char saveName[], AppFunc
 
 	//  Set up the window's gPort
 
-	windowPort.setDisplayPage(globalPort->displayPage);
 	windowPort.setFont(mainFont);
 	windowPort.setPenMap(globalPort->penMap);
 
@@ -1099,7 +1098,6 @@ void HandleTimerTick(long tick) {
  * ===================================================================== */
 
 void initPanels(gDisplayPort &port) {
-	port.setDisplayPage(&protoPage);
 	globalPort = &port;
 	mainFont = &Helv11Font;
 }
diff --git a/engines/saga2/towerfta.cpp b/engines/saga2/towerfta.cpp
index 7a3de51136..5ab18f02ec 100644
--- a/engines/saga2/towerfta.cpp
+++ b/engines/saga2/towerfta.cpp
@@ -326,7 +326,6 @@ TERMINATOR(termMousePointer) {
 INITIALIZER(initDisplay) {
 	g_vm->_mainPort.setColor(0);            //  fill screen with color
 	drawPage = &g_vm->_mainPort.protoPage;
-	g_vm->_mainPort.setDisplayPage(drawPage);
 	//lightsOut();
 	//g_vm->_mainPort.fillRect( Rect16( 0, 0, screenWidth, screenHeight ) );
 
diff --git a/engines/saga2/vbacksav.cpp b/engines/saga2/vbacksav.cpp
index c9ce3b5b96..8a882e7bfc 100644
--- a/engines/saga2/vbacksav.cpp
+++ b/engines/saga2/vbacksav.cpp
@@ -85,7 +85,7 @@ gBackSave::~gBackSave() {
 */
 void gBackSave::save(gDisplayPort &port) {
 	if (!saved && savedPixels.data) {
-		port.displayPage->readPixels(savedRegion,
+		port.protoPage.readPixels(savedRegion,
 		                             savedPixels.data,
 		                             savedPixels.size.x);
 		saved = true;
@@ -108,7 +108,7 @@ void gBackSave::save(gDisplayPort &port) {
 */
 void gBackSave::restore(gDisplayPort &port) {
 	if (saved && savedPixels.data) {
-		port.displayPage->writePixels(savedRegion,
+		port.protoPage.writePixels(savedRegion,
 		                              savedPixels.data,
 		                              savedPixels.size.x);
 		saved = false;
diff --git a/engines/saga2/vdraw.h b/engines/saga2/vdraw.h
index 2da85aa4ea..c7d9992553 100644
--- a/engines/saga2/vdraw.h
+++ b/engines/saga2/vdraw.h
@@ -36,12 +36,6 @@ public:
 	virtual ~gDisplayPort() {}
 
 	vDisplayPage protoPage;
-	vDisplayPage        *displayPage;           // page to draw to
-
-	virtual void setDisplayPage(vDisplayPage *dPage) {
-		displayPage = dPage;
-		clip = Rect16(0, 0, dPage->size.x, dPage->size.y);
-	}
 
 	//  Lowest-level drawing functions, (virtually) retargeted to
 	//  call SVGA drawing routines
@@ -49,7 +43,7 @@ public:
 	void fillRect(const Rect16 r);
 
 	void clear(void) {
-		displayPage->fillRect(clip, fgPen);
+		protoPage.fillRect(clip, fgPen);
 	}
 
 	//  Blitting functions
diff --git a/engines/saga2/vwdraw.cpp b/engines/saga2/vwdraw.cpp
index f93219e16b..15ad078588 100644
--- a/engines/saga2/vwdraw.cpp
+++ b/engines/saga2/vwdraw.cpp
@@ -44,9 +44,9 @@ void gDisplayPort::fillRect(const Rect16 r) {
 
 	if (!sect.empty()) {                    // if result is non-empty
 		if (drawMode == drawModeComplement) // Complement drawing mode
-			displayPage->invertRect(sect, fgPen);
+			protoPage.invertRect(sect, fgPen);
 		else
-			displayPage->fillRect(sect, fgPen);     // regular drawing mode
+			protoPage.fillRect(sect, fgPen);     // regular drawing mode
 	}
 }
 
@@ -79,16 +79,16 @@ void gDisplayPort::bltPixels(
 
 		switch (drawMode) {
 		case drawModeMatte:                     // use transparency
-			displayPage->writeTransPixels(sect, src_line, src.size.x);
+			protoPage.writeTransPixels(sect, src_line, src.size.x);
 			break;
 		case drawModeReplace:                   // don't use transparency
-			displayPage->writePixels(sect, src_line, src.size.x);
+			protoPage.writePixels(sect, src_line, src.size.x);
 			break;
 		case drawModeColor:                     // solid color, use transparency
-			displayPage->writeColorPixels(sect, src_line, src.size.x, fgPen);
+			protoPage.writeColorPixels(sect, src_line, src.size.x, fgPen);
 			break;
 		case drawModeComplement:                // blit in complement mode
-			displayPage->writeComplementPixels(sect, src_line, src.size.x, fgPen);
+			protoPage.writeComplementPixels(sect, src_line, src.size.x, fgPen);
 			break;
 		default:
 			error("bltPixels: Unknown drawMode: %d", drawMode);
@@ -148,8 +148,8 @@ void gDisplayPort::scrollPixels(
 
 		//  Blit scrolled pixels to system ram and back to SVGA
 
-		displayPage->readPixels(srcRect, tempMap.data, tempMap.size.x);
-		displayPage->writePixels(dstRect, tempMap.data, tempMap.size.x);
+		protoPage.readPixels(srcRect, tempMap.data, tempMap.size.x);
+		protoPage.writePixels(dstRect, tempMap.data, tempMap.size.x);
 
 		//  dispose of temp pixel map
 
@@ -197,14 +197,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
 
 		yDir = -1;
 		yAbs = y1 - y2;
-		yMove = -displayPage->size.x;
+		yMove = -protoPage.size.x;
 	} else {                            // drawing down
 		if (y2 < clip.y || y1 >= clipBottom) return;
 		if (y1 < clip.y || y2 >= clipBottom) clipNeeded = true;
 
 		yDir = 1;
 		yAbs = y2 - y1;
-		yMove = displayPage->size.x;
+		yMove = protoPage.size.x;
 	}
 
 	if (clipNeeded) {                   // clipping versions
@@ -244,11 +244,11 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
 			}
 		}
 
-		offset = (y1 + origin.y) * displayPage->size.x + x1 + origin.x;
+		offset = (y1 + origin.y) * protoPage.size.x + x1 + origin.x;
 		bank = offset >> 16;
 
-		displayPage->setWriteBank(bank);
-		if (drawMode == drawModeComplement) displayPage->setReadBank(bank);
+		protoPage.setWriteBank(bank);
+		if (drawMode == drawModeComplement) protoPage.setReadBank(bank);
 		offset &= 0x0000ffff;
 
 		if (xAbs > yAbs) {
@@ -275,14 +275,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
 
 				if (offset >= cBytesPerBank) {
 					offset -= cBytesPerBank;
-					displayPage->setWriteBank(++bank);
+					protoPage.setWriteBank(++bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				} else if (offset < 0) {
 					offset += cBytesPerBank;
-					displayPage->setWriteBank(--bank);
+					protoPage.setWriteBank(--bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				}
 			}
 		} else {
@@ -309,24 +309,24 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
 
 				if (offset >= cBytesPerBank) {
 					offset -= cBytesPerBank;
-					displayPage->setWriteBank(++bank);
+					protoPage.setWriteBank(++bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				} else if (offset < 0) {
 					offset += cBytesPerBank;
-					displayPage->setWriteBank(--bank);
+					protoPage.setWriteBank(--bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				}
 			}
 		}
 	} else {                            // non-clipping versions
-		offset = (y1 + origin.y) * displayPage->size.x + x1 + origin.x;
+		offset = (y1 + origin.y) * protoPage.size.x + x1 + origin.x;
 
 		bank = offset >> 16;
 
-		displayPage->setWriteBank(bank);
-		if (drawMode == drawModeComplement) displayPage->setReadBank(bank);
+		protoPage.setWriteBank(bank);
+		if (drawMode == drawModeComplement) protoPage.setReadBank(bank);
 		offset &= 0x0000ffff;
 
 		if (xAbs > yAbs) {
@@ -350,14 +350,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
 
 				if (offset >= cBytesPerBank) {
 					offset -= cBytesPerBank;
-					displayPage->setWriteBank(++bank);
+					protoPage.setWriteBank(++bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				} else if (offset < 0) {
 					offset += cBytesPerBank;
-					displayPage->setWriteBank(--bank);
+					protoPage.setWriteBank(--bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				}
 			}
 		} else {
@@ -381,14 +381,14 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
 
 				if (offset >= cBytesPerBank) {
 					offset -= cBytesPerBank;
-					displayPage->setWriteBank(++bank);
+					protoPage.setWriteBank(++bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				} else if (offset < 0) {
 					offset += cBytesPerBank;
-					displayPage->setWriteBank(--bank);
+					protoPage.setWriteBank(--bank);
 					if (drawMode == drawModeComplement)
-						displayPage->setReadBank(bank);
+						protoPage.setReadBank(bank);
 				}
 			}
 		}


Commit: f439b36bc8724f5ace771ce5a7d09884c56acf34
    https://github.com/scummvm/scummvm/commit/f439b36bc8724f5ace771ce5a7d09884c56acf34
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-18T12:14:01+09:00

Commit Message:
SAGA2: Fix global constructor warning in vwdraw.cpp

Changed paths:
    engines/saga2/main.cpp
    engines/saga2/panel.cpp
    engines/saga2/vwdraw.cpp


diff --git a/engines/saga2/main.cpp b/engines/saga2/main.cpp
index 7639045c27..257ab46932 100644
--- a/engines/saga2/main.cpp
+++ b/engines/saga2/main.cpp
@@ -59,7 +59,6 @@ extern bool             underground;
 extern char             commandLineHelp[];
 extern hResContext     *tileRes;       // tile resource handle
 extern hResContext     *listRes;
-extern vDisplayPage     protoPage;
 
 /* ===================================================================== *
    Globals
diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp
index 17ddb65090..6c6e79869b 100644
--- a/engines/saga2/panel.cpp
+++ b/engines/saga2/panel.cpp
@@ -37,7 +37,6 @@ namespace Saga2 {
 
 //extern vDisplayPage   *drawPage;
 extern char iniFile[];
-extern vDisplayPage protoPage;
 
 //  Function to enable/disable user interface keys
 extern bool enableUIKeys(bool enabled);
diff --git a/engines/saga2/vwdraw.cpp b/engines/saga2/vwdraw.cpp
index 15ad078588..e6ddcd75c6 100644
--- a/engines/saga2/vwdraw.cpp
+++ b/engines/saga2/vwdraw.cpp
@@ -33,7 +33,6 @@
 namespace Saga2 {
 
 vDisplayPage *drawPage;
-vDisplayPage protoPage;
 
 void gDisplayPort::fillRect(const Rect16 r) {
 	Rect16          sect;


Commit: ae1e995ccc19e9a3379f99998f3f2d422a1f5d02
    https://github.com/scummvm/scummvm/commit/ae1e995ccc19e9a3379f99998f3f2d422a1f5d02
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-18T12:22:23+09:00

Commit Message:
SAGA2: Fix global constructor warnings in uidialog.cpp

Changed paths:
    engines/saga2/uidialog.cpp


diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index ac8238ff38..49db38a4da 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -194,12 +194,6 @@ static const StaticRect saveLoadWindowRect = {
 
 // indirections
 
-static const StaticRect *saveLoadPanelRects[kNumSaveLoadPanels] = {
-	&SLTopPanel,
-	&SLMidPanel,
-	&SLBotPanel
-};
-
 static const StaticRect *saveLoadButtonRects[kNumSaveLoadBtns] = {
 	&SLQuitBtnRect,
 	&SLBtnRect,
@@ -216,9 +210,9 @@ static const StaticRect *saveLoadTextRects[kNumSaveLoadTexts] = {
 // save/load dialog window decorations
 
 static StaticWindow saveWindowDecorations[kNumSaveLoadPanels] = {
-	{*(saveLoadPanelRects[0]), NULL, SLTopPanelResID},
-	{*(saveLoadPanelRects[1]), NULL, SLMidPanelResID},
-	{*(saveLoadPanelRects[2]), NULL, SLBotPanelResID}
+	{SLTopPanel, NULL, SLTopPanelResID},
+	{SLMidPanel, NULL, SLMidPanelResID},
+	{SLBotPanel, NULL, SLBotPanelResID}
 };
 
 
@@ -425,12 +419,6 @@ static const StaticRect optionsWindowRect = {
 
 // indirections
 
-static const StaticRect *optionsPanelRects[kNumOptionsPanels] = {
-	&optTopPanel,
-	&optMidPanel,
-	&optBotPanel
-};
-
 static const StaticRect *optionsButtonRects[] = {
 	&optResumeRect,
 	&optSaveRect,
@@ -458,9 +446,9 @@ static const StaticRect *optionsTextRects[] = {
 // options dialog window decorations
 
 static StaticWindow optionsDecorations[kNumOptionsPanels] = {
-	{*(optionsPanelRects[0]), NULL, optTopPanelResID},
-	{*(optionsPanelRects[1]), NULL, optMidPanelResID},
-	{*(optionsPanelRects[2]), NULL, optBotPanelResID}
+	{optTopPanel, NULL, optTopPanelResID},
+	{optMidPanel, NULL, optMidPanelResID},
+	{optBotPanel, NULL, optBotPanelResID}
 };
 
 


Commit: 17bcde4f6f96953b42140a9fbaee9fc28072e9ef
    https://github.com/scummvm/scummvm/commit/17bcde4f6f96953b42140a9fbaee9fc28072e9ef
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-18T12:55:50+09:00

Commit Message:
SAGA2: Fix ActorAssignment deletion

Changed paths:
    engines/saga2/task.cpp
    engines/saga2/task.h


diff --git a/engines/saga2/task.cpp b/engines/saga2/task.cpp
index 31ebae0889..93d8a25492 100644
--- a/engines/saga2/task.cpp
+++ b/engines/saga2/task.cpp
@@ -164,7 +164,6 @@ TaskStackList::~TaskStackList(void) {
 		if (_list[i] == nullptr)
 			continue;
 
-		_list[i]->actor->curTask = nullptr;
 		delete _list[i];
 		_list[i] = nullptr;
 	}
diff --git a/engines/saga2/task.h b/engines/saga2/task.h
index da848cade4..1557918dad 100644
--- a/engines/saga2/task.h
+++ b/engines/saga2/task.h
@@ -1641,6 +1641,8 @@ public:
 
 	//  Destructor
 	~TaskStack(void) {
+		if (actor)
+			actor->curTask = nullptr;
 		deleteTaskStack(this);
 	}
 


Commit: 703ff18cb3e0a917500e7c23e2d2cf6aa1683f87
    https://github.com/scummvm/scummvm/commit/703ff18cb3e0a917500e7c23e2d2cf6aa1683f87
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-18T12:57:12+09:00

Commit Message:
SAGA2: Fix a global constructor warning in tilemode.cpp

Changed paths:
    engines/saga2/dispnode.cpp
    engines/saga2/dispnode.h
    engines/saga2/objects.h
    engines/saga2/rect.h
    engines/saga2/tilemode.cpp


diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index 954ffa80e9..0b5f84c2df 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -808,7 +808,7 @@ void DisplayNode::drawObject(void) {
 //-----------------------------------------------------------------------
 //	Do mouse hit-test on objects
 
-ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos) {
+ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
 	DisplayNode     *dn;
 	ObjectID        result = Nothing;
 	int32           dist = maxint32;
@@ -822,7 +822,7 @@ ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos) {
 		if (dn->type == nodeTypeObject) {
 			GameObject  *obj = dn->object;
 
-			if (obj->parent() == currentWorld && dn->hitBox.ptInside(mouse)) {
+			if (obj->parent() == currentWorld && dn->hitBox.ptInside(mouse.x, mouse.y)) {
 				TilePoint   loc = obj->getLocation();
 				int32       newDist = loc.u + loc.v;
 
diff --git a/engines/saga2/dispnode.h b/engines/saga2/dispnode.h
index a77fdbe08c..198ef17cbe 100644
--- a/engines/saga2/dispnode.h
+++ b/engines/saga2/dispnode.h
@@ -48,7 +48,7 @@ class DisplayNode {
 	friend class    DisplayNodeList;
 	friend class    SpellDisplayList;
 	friend class    GameObject;
-	friend ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos);
+	friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
 
 private:
 	DisplayNode             *nextDisplayed;         // pointer to next in display list
@@ -85,7 +85,7 @@ public:
 const int           maxDisplayed = 100;
 
 class DisplayNodeList {
-	friend ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos);
+	friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
 
 public:
 	uint16              count;                  // number of entries in list
diff --git a/engines/saga2/objects.h b/engines/saga2/objects.h
index 387c345147..605eb1029f 100644
--- a/engines/saga2/objects.h
+++ b/engines/saga2/objects.h
@@ -1346,7 +1346,7 @@ bool lineOfSight(
 bool objObscured(GameObject *testObj);
 
 //  Determine which object mouse pointer is picking
-ObjectID pickObject(const Point16 &mouse, StaticTilePoint &objPos);
+ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
 
 //  Create enchantment attach it to object
 ObjectID EnchantObject(
diff --git a/engines/saga2/rect.h b/engines/saga2/rect.h
index 43db78cdc1..a8f9661d40 100644
--- a/engines/saga2/rect.h
+++ b/engines/saga2/rect.h
@@ -141,6 +141,11 @@ typedef Point16         Extent16;               // contains width and height
 struct StaticPoint32 {
 	int32 x, y;
 
+	void set(int16 nx, int16 ny) {
+		x = nx;
+		y = ny;
+	}
+
 	friend StaticPoint32 operator+ (StaticPoint32 a, StaticPoint32 b) {
 		StaticPoint32 p;
 		p.x = a.x + b.x;
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index c319d57d86..993f8f0c10 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -185,7 +185,7 @@ Alarm               updateAlarm,            // max coord update rate
 bool                tileLockFlag;           // true if tile mode is locked
 
 GameObject          *mouseObject = NULL;    // object being dragged
-Point32             lastMousePos;           // Last mouse position over map
+StaticPoint32       lastMousePos = {0, 0};           // Last mouse position over map
 static bool         mousePressed,           // State of mouse button
        clickActionDone = true; // Flag indication wether current
 // mouse click action is done
@@ -1066,7 +1066,7 @@ static APPFUNC(cmdClickTileMap) {
 			g_vm->_mouseInfo->setText(NULL);
 			g_vm->_mouseInfo->clearGauge();
 		}
-		lastMousePos = ev.mouse;
+		lastMousePos.set(ev.mouse.x, ev.mouse.y);
 		break;
 
 	case gEventMouseDown:




More information about the Scummvm-git-logs mailing list