[Scummvm-git-logs] scummvm master -> 3a6d4ddd3e94a661097ece45bd4eb028dfeec82e
sev-
sev at scummvm.org
Thu Jul 1 21:00:43 UTC 2021
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:
d403eab56f SAGA2: Get rid of tileRect
3a6d4ddd3e SAGA2: Fix warning
Commit: d403eab56f828883027fdc42c292e61614e3ae06
https://github.com/scummvm/scummvm/commit/d403eab56f828883027fdc42c292e61614e3ae06
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-01T22:59:44+02:00
Commit Message:
SAGA2: Get rid of tileRect
Changed paths:
engines/saga2/dispnode.cpp
engines/saga2/floating.cpp
engines/saga2/idtypes.h
engines/saga2/magic.cpp
engines/saga2/modal.cpp
engines/saga2/path.cpp
engines/saga2/playmode.cpp
engines/saga2/setup.h
engines/saga2/speech.cpp
engines/saga2/tile.cpp
engines/saga2/tileline.cpp
engines/saga2/tilemode.cpp
diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index ed3c8380e4..64140383a6 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -55,7 +55,6 @@ bool centerActorIndicatorEnabled;
extern int16 currentMapNum;
extern WorldMapData *mapList;
-extern Rect16 tileRect;
extern Point16 fineScroll;
extern gPort backPort;
@@ -192,7 +191,7 @@ void DisplayNodeList::buildObjects(bool fromScratch) {
int16 distList[maxDisplayed + 1];
int16 sortCount = 0;
int16 i;
- int16 viewSize = tileRect.height;
+ int16 viewSize = kTileRectHeight;
// Distance at which characters should be loaded.
int16 loadDist = viewSize + viewSize / 2;
@@ -414,9 +413,9 @@ void DisplayNode::drawObject(void) {
// Reject any sprites which fall off the edge of the screen.
if (drawPos.x < -32
- || drawPos.x > tileRect.x + tileRect.width + 32
+ || drawPos.x > kTileRectX + kTileRectWidth + 32
|| drawPos.y < -32
- || drawPos.y > tileRect.y + tileRect.height + 100) {
+ || drawPos.y > kTileRectY + kTileRectHeight + 100) {
// Disable hit-test on the object's box
hitBox.width = -1;
hitBox.height = -1;
@@ -489,9 +488,9 @@ void DisplayNode::drawObject(void) {
// Reject any sprites which fall off the edge of the screen.
if (drawPos.x < -maxSpriteWidth
- || drawPos.x > tileRect.x + tileRect.width + maxSpriteWidth
+ || drawPos.x > kTileRectX + kTileRectWidth + maxSpriteWidth
|| drawPos.y < -maxSpriteBaseLine
- || drawPos.y > tileRect.y + tileRect.height + maxSpriteHeight) {
+ || drawPos.y > kTileRectY + kTileRectHeight + maxSpriteHeight) {
// Mark as being off screen
a->setOnScreen(false);
a->setObscured(false);
@@ -518,9 +517,9 @@ void DisplayNode::drawObject(void) {
} else {
// Reject any sprites which fall off the edge of the screen.
if (drawPos.x < -maxSpriteWidth
- || drawPos.x > tileRect.x + tileRect.width + maxSpriteWidth
+ || drawPos.x > kTileRectX + kTileRectWidth + maxSpriteWidth
|| drawPos.y < -maxSpriteBaseLine
- || drawPos.y > tileRect.y + tileRect.height + maxSpriteHeight) {
+ || drawPos.y > kTileRectY + kTileRectHeight + maxSpriteHeight) {
// Disable hit-test on the object's box
hitBox.width = -1;
hitBox.height = -1;
@@ -975,9 +974,9 @@ void Effectron::drawEffect(void) {
// Reject any sprites which fall off the edge of the screen.
if (drawPos.x < -32
- || drawPos.x > tileRect.x + tileRect.width + 32
+ || drawPos.x > kTileRectX + kTileRectWidth + 32
|| drawPos.y < -32
- || drawPos.y > tileRect.y + tileRect.height + 100) {
+ || drawPos.y > kTileRectY + kTileRectHeight + 100) {
// Disable hit-test on the object's box
hitBox.width = -1;
hitBox.height = -1;
diff --git a/engines/saga2/floating.cpp b/engines/saga2/floating.cpp
index ba938df7bc..53644dd5d5 100644
--- a/engines/saga2/floating.cpp
+++ b/engines/saga2/floating.cpp
@@ -57,7 +57,6 @@ extern gToolBase G_BASE;
// These externs are imported because the window update routines
// need to know about the scrolling tile area.
-extern Rect16 tileRect;
extern gPixelMap tileDrawMap;
extern Point16 fineScroll;
extern gFont *mainFont;
@@ -619,7 +618,7 @@ void updateWindowSection(const Rect16 &r) {
Point16 offset(r.x, r.y);
Rect16 clip,
animClip;
- Point16 animOffset(tileRect.x - fineScroll.x, tileRect.y);
+ Point16 animOffset(kTileRectX - fineScroll.x, kTileRectY);
// Detects that program is shutting down and aborts the blit
if (tileDrawMap.data == nullptr)
@@ -647,7 +646,7 @@ void updateWindowSection(const Rect16 &r) {
// rectangle. If they overlap, then copy part of the animated
// area into the temporary bitmap.
- animClip = intersect(tileRect, clip);
+ animClip = intersect(Rect16(kTileRectX, kTileRectY, kTileRectWidth, kTileRectHeight), clip);
if (!animClip.empty() && !allPlayerActorsDead) {
// Compute which pixel on the animated pixel map is the
// upper left corner of the clip area
diff --git a/engines/saga2/idtypes.h b/engines/saga2/idtypes.h
index d63eb286e3..cf465eb968 100644
--- a/engines/saga2/idtypes.h
+++ b/engines/saga2/idtypes.h
@@ -428,6 +428,15 @@ enum {
kMesBoxY = (480 - kMesBoxYSize) / 3
};
+//Sets Up Tile Map Area
+enum {
+ kTileRectX = 16 + 4,
+ kTileRectY = 16 + 4,
+ kTileRectWidth = 448 - 8,
+ kTileRectHeight = 428 - 8
+};
+
+
} // end of namespace Saga2
#endif
diff --git a/engines/saga2/magic.cpp b/engines/saga2/magic.cpp
index a9a806728f..6a6117e46a 100644
--- a/engines/saga2/magic.cpp
+++ b/engines/saga2/magic.cpp
@@ -60,7 +60,6 @@ extern WorldMapData *mapList;
extern SpellDisplayList activeSpells;
extern SpellStuff spellBook[];
extern Point32 lastMousePos; // Last mouse position over map
-extern Rect16 tileRect;
/* ===================================================================== *
Inlines
diff --git a/engines/saga2/modal.cpp b/engines/saga2/modal.cpp
index 5c313197ff..3a41cb8fd2 100644
--- a/engines/saga2/modal.cpp
+++ b/engines/saga2/modal.cpp
@@ -35,7 +35,6 @@ ModalWindow *mWinPtr;
extern gPixelMap tileDrawMap;
extern Point16 fineScroll;
-extern Rect16 tileRect;
extern gToolBase G_BASE;
APPFUNC(cmdModalWindow);
diff --git a/engines/saga2/path.cpp b/engines/saga2/path.cpp
index 0047a29b54..214548ec1d 100644
--- a/engines/saga2/path.cpp
+++ b/engines/saga2/path.cpp
@@ -2564,7 +2564,6 @@ TilePoint selectNearbySite(
// if this point is on-screen, we might want to reject it...
if (offScreenOnly) {
Point16 screenCoords; // screen coordinates
- extern Rect16 tileRect;
// Convert to XY coords.
TileToScreenCoords(centerPt, screenCoords);
@@ -2572,8 +2571,8 @@ TilePoint selectNearbySite(
// If the point is on-screen, then reject it.
// (We want the monsters to walk in from off-screen,
// not 'pop in').
- if (screenCoords.x >= -16 && screenCoords.x <= tileRect.width + 16
- && screenCoords.y >= -16 && screenCoords.y <= tileRect.height + 80) {
+ if (screenCoords.x >= -16 && screenCoords.x <= kTileRectWidth + 16
+ && screenCoords.y >= -16 && screenCoords.y <= kTileRectHeight + 80) {
cellOK = false;
}
}
diff --git a/engines/saga2/playmode.cpp b/engines/saga2/playmode.cpp
index 17801d1117..d4f78fdb0d 100644
--- a/engines/saga2/playmode.cpp
+++ b/engines/saga2/playmode.cpp
@@ -45,7 +45,6 @@ const int defaultStatusWait = 15;
Imports
* ===================================================================== */
-extern Rect16 tileRect;
extern gPixelMap tileDrawMap;
extern gPort tileDrawPort;
extern BackWindow *mainWindow;
@@ -150,8 +149,8 @@ extern bool gameRunning;
bool checkTileAreaPort(void) {
if (gameRunning && tileDrawMap.data == nullptr) {
// Allocate back buffer for tile rendering
- tileDrawMap.size.x = (tileRect.width + kTileWidth - 1) & ~kTileDXMask;
- tileDrawMap.size.y = (tileRect.height + kTileWidth - 1) & ~kTileDXMask;
+ tileDrawMap.size.x = (kTileRectWidth + kTileWidth - 1) & ~kTileDXMask;
+ tileDrawMap.size.y = (kTileRectHeight + kTileWidth - 1) & ~kTileDXMask;
tileDrawMap.data = new uint8[tileDrawMap.bytes()]();
}
diff --git a/engines/saga2/setup.h b/engines/saga2/setup.h
index 65ee326e90..97dbbb4154 100644
--- a/engines/saga2/setup.h
+++ b/engines/saga2/setup.h
@@ -69,13 +69,6 @@ extern const ContainerInfo indivReadyContInfoTop;
extern const ContainerInfo indivReadyContInfoBot;
-//Sets Up Tile Map Area
-
-const int tileRectX = 16 + 4,
- tileRectY = 16 + 4,
- tileRectWidth = 448 - 8,
- tileRectHeight = 428 - 8;
-
//Sets Up Filenames based on PROJECT defined in make.
#define IMAGE_RESFILE "FTAIMAGE.HRS"
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index eee2d260c5..98738238b8 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -51,7 +51,6 @@ struct TextSpan {
// externs
extern Point16 fineScroll;
-extern Rect16 tileRect;
int kludgeHeight = 15;
extern TilePoint viewCenter; // coordinates of view on map
@@ -410,7 +409,6 @@ bool Speech::setupActive(void) {
if (speechButtonCount > 0) {
// REM: Also set pointer to arrow shape.
g_vm->_mouseInfo->setIntent(GrabInfo::WalkTo);
-// g_vm->_mouseInfo->setDoable( tileRect.ptInside( ev.mouse ) );
speakButtonControls->enable(true);
speechList.SetLock(false);
@@ -481,11 +479,11 @@ bool Speech::calcPosition(Point16 &p) {
p.x = clamp(8,
p.x - bounds.width / 2,
- 8 + maxWidth /* tileRect.width - 40 */ - bounds.width);
+ 8 + maxWidth - bounds.width);
- p.y = clamp(tileRect.y + 8,
+ p.y = clamp(kTileRectY + 8,
p.y - (bounds.height + actorHeight),
- tileRect.height - 50 - bounds.height);
+ kTileRectHeight - 50 - bounds.height);
return true;
}
@@ -890,8 +888,8 @@ bool isVisible(GameObject *obj) {
//For Determining If Object Is Being Displayed
//Could We Just Check Display List ???
int16 distanceX, distanceY;
- int16 viewSizeY = tileRect.height;
- int16 viewSizeX = tileRect.width;
+ int16 viewSizeY = kTileRectHeight;
+ int16 viewSizeX = kTileRectWidth;
//I Figure This Differently Than In Dispnode
int16 loadDistX = viewSizeX / 2;
@@ -1119,8 +1117,8 @@ void Speech::remove(void) {
int16 pickSpeechButton(Point16 mouse) {
Point16 p = mouse - initialSpeechPosition;
- p.x -= tileRect.x;
- p.y -= tileRect.y;
+ p.x -= kTileRectX;
+ p.y -= kTileRectY;
return pickButton(p,
speechLineList, speechLineCount,
@@ -1135,7 +1133,7 @@ APPFUNC(cmdClickSpeech) {
case gEventMouseMove:
case gEventMouseDrag:
- g_vm->_mouseInfo->setDoable(tileRect.ptInside(ev.mouse));
+ g_vm->_mouseInfo->setDoable(Rect16(kTileRectX, kTileRectY, kTileRectWidth, kTileRectHeight).ptInside(ev.mouse));
break;
case gEventMouseDown:
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 923de796a3..4833a64ee6 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -172,7 +172,6 @@ extern ObjectID viewCenterObject; // ID of object that view tracks
Exports
* ===================================================================== */
-Rect16 tileRect(tileRectX, tileRectY, tileRectWidth, tileRectHeight);
gPixelMap tileDrawMap;
/* ===================================================================== *
@@ -1657,9 +1656,6 @@ void setCurrentMap(int mapNum) {
audioEnvironmentSetWorld(mapNum);
}
-// tileScroll.x = mapList[mapNum].mapHeight - tileRect.width - 800;
-// tileScroll.y = mapList[mapNum].mapHeight - tileRect.width / 2;
-
lastUpdateTime = gameTime;
}
@@ -2923,7 +2919,7 @@ inline void drawMetaTiles(void) {
debugC(2, kDebugTiles, "baseCoords = (%d,%d,%d)", baseCoords.u, baseCoords.v, baseCoords.z);
- setAreaSound(baseCoords); //+TilePoint(tileRectWidth, tileRectHeight,0));
+ setAreaSound(baseCoords);
updateHandleRefs(baseCoords); // viewPoint, &sti );
// coordinates of current metatile (in X,Y), relative to screen
@@ -2987,17 +2983,17 @@ inline void drawTileMousePointer(void) {
saveMap = pointer.getSaveMap(saveExtent);
// If the pointer overlaps the tile scrolling area
- if (saveExtent.overlap(tileRect)) {
+ if (saveExtent.overlap(Rect16(kTileRectX, kTileRectY, kTileRectWidth, kTileRectHeight))) {
// get the intersecting area
- blitExtent = intersect(saveExtent, tileRect);
+ blitExtent = intersect(saveExtent, Rect16(kTileRectX, kTileRectY, kTileRectWidth, kTileRectHeight));
mouseSavePort.setMap(saveMap);
// Blit the tile data into the backsave buffer
mouseSavePort.bltPixels(
tileDrawMap,
- blitExtent.x - tileRect.x + fineScroll.x,
- blitExtent.y - tileRect.y + fineScroll.y,
+ blitExtent.x - kTileRectX + fineScroll.x,
+ blitExtent.y - kTileRectY + fineScroll.y,
blitExtent.x - saveExtent.x,
blitExtent.y - saveExtent.y,
blitExtent.width,
@@ -3006,8 +3002,8 @@ inline void drawTileMousePointer(void) {
// Blit the mouse pointer onto the tile map
int x, y;
- x = mouseState.pos.x + offset.x + fineScroll.x - tileRect.x;
- y = mouseState.pos.y + offset.y + fineScroll.y - tileRect.y;
+ x = mouseState.pos.x + offset.x + fineScroll.x - kTileRectX;
+ y = mouseState.pos.y + offset.y + fineScroll.y - kTileRectY;
// if ( x >=0 && y >=0 )
TBlit(&tileDrawMap, currentPtr, x, y);
@@ -4527,7 +4523,7 @@ void updateMainDisplay(void) {
int32 scrollSpeed = defaultScrollSpeed,
scrollDistance;
- int16 viewSize = tileRect.height;
+ int16 viewSize = kTileRectHeight;
int16 mapSectors = curMap->mapSize * 8 * 16 / kSectorSize;
TilePoint trackPos,
mCoords;
@@ -4552,10 +4548,10 @@ void updateMainDisplay(void) {
// Convert to XY coordinates.
targetScroll.x =
((trackPos.u - trackPos.v) << 1)
- + curMap->mapHeight - tileRect.width / 2;
+ + curMap->mapHeight - kTileRectWidth / 2;
targetScroll.y =
curMap->mapHeight - (trackPos.u + trackPos.v)
- - trackPos.z - tileRect.height / 2 - 32;
+ - trackPos.z - kTileRectHeight / 2 - 32;
debugC(1, kDebugTiles, "targetScroll = (%d,%d)", targetScroll.x, targetScroll.y);
// Compute the delta vector between the current scroll position
@@ -4583,8 +4579,8 @@ void updateMainDisplay(void) {
fineScroll.y = 0;
// Compute the center of the screen in (u,v) coords.
- scrollCenter.x = tileScroll.x + tileRect.width / 2;
- scrollCenter.y = tileScroll.y + tileRect.height / 2;
+ scrollCenter.x = tileScroll.x + kTileRectWidth / 2;
+ scrollCenter.y = tileScroll.y + kTileRectHeight / 2;
viewCenter = XYToUV(scrollCenter);
// Compute the largest U/V rectangle which completely
@@ -4629,17 +4625,19 @@ void drawMainDisplay(void) {
// Render the text if any
updateSpeech();
+ Rect16 rect(kTileRectX, kTileRectY, kTileRectWidth, kTileRectHeight);
+
// Render floating windows
drawFloatingWindows(backPort,
- Point16(tileRect.x - fineScroll.x, tileRect.y),
- tileRect);
+ Point16(kTileRectX - fineScroll.x, kTileRectY),
+ rect);
// Render the image of the mouse pointer on everything else
drawTileMousePointer();
// Blit it all onto the screen
drawPage->writePixels(
- tileRect,
+ rect,
tileDrawMap.data
+ fineScroll.x
+ fineScroll.y * tileDrawMap.size.x,
@@ -4674,65 +4672,6 @@ void ShowObjectSection(GameObject *obj) {
#endif
-#if 0
-
-// Tile drawing speed test
-
-/*
-int32 tclock0,
- tclock1;
-
-extern int32 gameTime;
-
- for (int i=0; i<30000; i++)
- {
- drawTile( &tileDrawMap,
- 0, 64, ti->attrs.height,
- (*th)->tileData( *ti ) );
- }
-
- tclock1 = gameTime;
- debug( "Time = %d", tclock1 - tclock0 );
-*/
-
-
-/*
- // Tile drawing speed test 2
-
- for (int i = 0; i < 256; i+=4)
- {
- for (int y=0; y <= tileDrawMap.size.y + 32; y += tileHeight)
- {
- for (int x=0; x <= tileDrawMap.size.x; x += tileWidth)
- {
- drawTile( &tileDrawMap,
- x, y, ti->attrs.height,
- (*th)->tileData( *ti ) );
- drawTile( &tileDrawMap,
- x, y, ti->attrs.height,
- (*th)->tileData( *ti ) );
- }
-
- for (x=tileDX; x <= tileDrawMap.size.x; x += tileWidth)
- {
- drawTile( &tileDrawMap,
- x, y + tileDY, ti->attrs.height,
- (*th)->tileData( *ti ) );
- drawTile( &tileDrawMap,
- x, y + tileDY, ti->attrs.height,
- (*th)->tileData( *ti ) );
- }
- }
-
- pointer.hide( g_vm->_mainPort, tileRect );
- drawPage->writePixels( tileRect,
- tileDrawMap.data,
- tileDrawMap.size.x );
- pointer.show( g_vm->_mainPort, tileRect );
- }
-*/
-#endif
-
//-----------------------------------------------------------------------
// mark this and surrounding metatiles as visited
diff --git a/engines/saga2/tileline.cpp b/engines/saga2/tileline.cpp
index 97c14ce91c..c00001e430 100644
--- a/engines/saga2/tileline.cpp
+++ b/engines/saga2/tileline.cpp
@@ -54,8 +54,6 @@ void TPCircle(const TilePoint &tp, const int radius, int16 color) {
TPLine(tp + TilePoint(radius / 1, radius / -2, 0), tp + TilePoint(radius / 1, radius / 2, 0), color);
}
-extern Rect16 tileRect;
-
// Draw a line in TP space
void TPLine(const TilePoint &start, const TilePoint &stop) {
@@ -65,10 +63,10 @@ void TPLine(const TilePoint &start, const TilePoint &stop) {
TileToScreenCoords(start, startPt);
TileToScreenCoords(stop, stopPt);
- startPt.x += tileRect.x;
- stopPt.x += tileRect.x;
- startPt.y += tileRect.y;
- stopPt.y += tileRect.y;
+ startPt.x += kTileRectX;
+ stopPt.x += kTileRectX;
+ startPt.y += kTileRectY;
+ stopPt.y += kTileRectY;
g_vm->_mainPort.setColor(1);
g_vm->_mainPort.moveTo(startPt);
@@ -84,10 +82,10 @@ void TPLine(const TilePoint &start, const TilePoint &stop, int16 color) {
TileToScreenCoords(start, startPt);
TileToScreenCoords(stop, stopPt);
- startPt.x += tileRect.x;
- stopPt.x += tileRect.x;
- startPt.y += tileRect.y;
- stopPt.y += tileRect.y;
+ startPt.x += kTileRectX;
+ stopPt.x += kTileRectX;
+ startPt.y += kTileRectY;
+ stopPt.y += kTileRectY;
g_vm->_mainPort.setColor(color);
g_vm->_mainPort.moveTo(startPt);
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index 6044e53406..eccb7b39a1 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -161,8 +161,6 @@ static struct _delayedNavigation {
} delayedNavigation;
static bool navigationDelayed = false;
-extern Rect16 tileRect;
-
//Tile Mode GameMode Object
GameMode TileMode = {
@@ -673,7 +671,7 @@ void TileModeSetup(void) {
mainWindow->draw();
// Create a control covering the map area.
- tileMapControl = new gStickyDragControl(*playControls, tileRect, 0, cmdClickTileMap);
+ tileMapControl = new gStickyDragControl(*playControls, Rect16(kTileRectX, kTileRectY, kTileRectWidth, kTileRectHeight), 0, cmdClickTileMap);
//Enable Tile Mode Specific Controls
tileControls->enable(true);
@@ -792,9 +790,9 @@ void TileModeHandleTask(void) {
if (G_BASE.isMousePanel(tileMapControl)) {
// If mouse is near edge of screen, then run.
runFlag = lastMousePos.x < runThreshhold
- || lastMousePos.x >= tileRect.width - runThreshhold
+ || lastMousePos.x >= kTileRectWidth - runThreshhold
|| lastMousePos.y < runThreshhold
- || lastMousePos.y >= tileRect.height - runThreshhold;
+ || lastMousePos.y >= kTileRectHeight - runThreshhold;
// Calculate the mouse's position on the tile map.
if (runFlag) {
Commit: 3a6d4ddd3e94a661097ece45bd4eb028dfeec82e
https://github.com/scummvm/scummvm/commit/3a6d4ddd3e94a661097ece45bd4eb028dfeec82e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-01T23:00:26+02:00
Commit Message:
SAGA2: Fix warning
Changed paths:
engines/saga2/target.h
diff --git a/engines/saga2/target.h b/engines/saga2/target.h
index 216099eb5d..11f723e476 100644
--- a/engines/saga2/target.h
+++ b/engines/saga2/target.h
@@ -569,8 +569,8 @@ class SpecificActorTarget : public ActorTarget {
public:
// Constructor -- initial construction
- SpecificActorTarget(Actor *actor) :
- a(actor) {
+ SpecificActorTarget(Actor *actor_) :
+ a(actor_) {
}
// Constructor -- reconstruct from archive buffer
More information about the Scummvm-git-logs
mailing list