[Scummvm-git-logs] scummvm master -> 621599cd584285a99052b4c847d9421291213781
sev-
sev at scummvm.org
Wed Jul 14 22:17:34 UTC 2021
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
af52dbc638 SAGA2: Fix panel traversal logic. CID 1458093
fa93ff5558 SAGA2: Remove logically dead code. CID 1457966
e4e572a798 SAGA2: Fix Shorten decoder. CID 1457991, 1457880
410192d10d SAGA2: Prevent potential buffer overflow. CID 1457976
3a7e09e530 SAGA2: Use safer string manupulation. CID 1458016
e6047c2da7 SAGA2: Fix buffer overrun. CID 1457901, 1457994
621599cd58 SAGA2: Add (not-yet-working) debug mode for tile drawing
Commit: af52dbc638cc20d51657f4beb18c668202538b39
https://github.com/scummvm/scummvm/commit/af52dbc638cc20d51657f4beb18c668202538b39
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-14T23:28:39+02:00
Commit Message:
SAGA2: Fix panel traversal logic. CID 1458093
Changed paths:
engines/saga2/panel.cpp
diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp
index e4b5988196..408bc3c974 100644
--- a/engines/saga2/panel.cpp
+++ b/engines/saga2/panel.cpp
@@ -848,8 +848,8 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
if (!activePanel /* && !ms.right */) {
// If the point is within the window
-
- for (Common::List<gWindow *>::iterator it = windowList.begin(); it != windowList.end(); ++it) {
+ Common::List<gWindow *>::iterator it;
+ for (it = windowList.begin(); it != windowList.end(); ++it) {
w = *it;
if (w->extent.ptInside(_curMouseState.pos) || w->isModal()) {
// Set up the pick position relative to the window
@@ -866,7 +866,7 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
}
}
- if (w == NULL) {
+ if (it == windowList.end()) {
prevState = _curMouseState;
return;
}
Commit: fa93ff5558abc6e1870b55e57e8fe26aae0d988a
https://github.com/scummvm/scummvm/commit/fa93ff5558abc6e1870b55e57e8fe26aae0d988a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-14T23:31:12+02:00
Commit Message:
SAGA2: Remove logically dead code. CID 1457966
Changed paths:
engines/saga2/path.cpp
diff --git a/engines/saga2/path.cpp b/engines/saga2/path.cpp
index 7c0c8f71ce..3006903aed 100644
--- a/engines/saga2/path.cpp
+++ b/engines/saga2/path.cpp
@@ -1966,15 +1966,18 @@ PathResult PathRequest::findPath(void) {
} else if (cornerHeight[0] == 0 && cornerHeight[3] == 0) {
stairDir = 7;
stairHeight = pti.surfaceHeight + cornerHeight[1];
- } else continue;
+ } else
+ continue;
// Do not go onto the stair at a right angle
if (stairDir == 1 || stairDir == 5) {
- if (dir == 3 || dir == 7) continue;
+ if (dir == 3 || dir == 7)
+ continue;
} else if (stairDir == 3 || stairDir == 7) {
- if (dir == 1 || dir == 5) continue;
- } else continue;
+ if (dir == 1 || dir == 5)
+ continue;
+ }
// Add any additional costs for travelling on these
// stairs.
Commit: e4e572a79881693b9fefe092aeb02bfe376bb12a
https://github.com/scummvm/scummvm/commit/e4e572a79881693b9fefe092aeb02bfe376bb12a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-14T23:41:44+02:00
Commit Message:
SAGA2: Fix Shorten decoder. CID 1457991, 1457880
Changed paths:
engines/saga2/shorten.cpp
diff --git a/engines/saga2/shorten.cpp b/engines/saga2/shorten.cpp
index 5e9d90da9f..0094c6ae6a 100644
--- a/engines/saga2/shorten.cpp
+++ b/engines/saga2/shorten.cpp
@@ -87,7 +87,7 @@ public:
ShortenGolombReader(Common::ReadStream *stream, int version);
~ShortenGolombReader() {}
uint32 getUint32(uint32 numBits); // UINT_GET
- int32 getURice(uint32 numBits); // uvar_get
+ uint32 getURice(uint32 numBits); // uvar_get
int32 getSRice(uint32 numBits); // var_get
private:
int _version;
@@ -112,8 +112,8 @@ ShortenGolombReader::ShortenGolombReader(Common::ReadStream *stream, int version
}
}
-int32 ShortenGolombReader::getURice(uint32 numBits) {
- int32 result = 0;
+uint32 ShortenGolombReader::getURice(uint32 numBits) {
+ uint32 result = 0;
if (!_nbitget) {
_buf = _stream->readUint32BE();
@@ -144,12 +144,12 @@ int32 ShortenGolombReader::getURice(uint32 numBits) {
}
int32 ShortenGolombReader::getSRice(uint32 numBits) {
- uint32 uvar = (uint32) getURice(numBits + 1);
+ uint32 uvar = getURice(numBits + 1);
return (uvar & 1) ? (int32) ~(uvar >> 1) : (int32) (uvar >> 1);
}
uint32 ShortenGolombReader::getUint32(uint32 numBits) {
- return (_version == 0) ? (uint32)getURice(numBits) : (uint32)getURice(getURice(2));
+ return (_version == 0) ? getURice(numBits) : getURice(getURice(2));
}
// ---------------------------------------------------------------------------
Commit: 410192d10d7f6ce55a56f6db2f66734b456d1786
https://github.com/scummvm/scummvm/commit/410192d10d7f6ce55a56f6db2f66734b456d1786
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-14T23:43:44+02:00
Commit Message:
SAGA2: Prevent potential buffer overflow. CID 1457976
Changed paths:
engines/saga2/video.cpp
diff --git a/engines/saga2/video.cpp b/engines/saga2/video.cpp
index 15582be68a..12ffc9ca32 100644
--- a/engines/saga2/video.cpp
+++ b/engines/saga2/video.cpp
@@ -43,7 +43,7 @@ static bool nameCheck(char name[], const char ext[]) {
void Saga2Engine::startVideo(const char *fileName, int x, int y) {
char file[260];
strcpy(file, "video/");
- strncat(file, fileName, 260);
+ Common::strlcat(file, fileName, 260);
nameCheck(file, VIDEO_EXT);
if (!_smkDecoder)
Commit: 3a7e09e5309172f4b08d734b7cdf649beb660158
https://github.com/scummvm/scummvm/commit/3a7e09e5309172f4b08d734b7cdf649beb660158
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-14T23:45:18+02:00
Commit Message:
SAGA2: Use safer string manupulation. CID 1458016
Changed paths:
engines/saga2/video.cpp
diff --git a/engines/saga2/video.cpp b/engines/saga2/video.cpp
index 12ffc9ca32..de6f6814c7 100644
--- a/engines/saga2/video.cpp
+++ b/engines/saga2/video.cpp
@@ -33,10 +33,10 @@ namespace Saga2 {
#define VIDEO_EXT ".SMK"
-static bool nameCheck(char name[], const char ext[]) {
+static bool nameCheck(char name[], const char ext[], int len) {
size_t l = strlen(name);
if (l < 5 || 0 != scumm_stricmp(name + (l - strlen(ext)), ext))
- strcat(name, ext);
+ Common::strlcat(name, ext, len);
return true;
}
@@ -44,7 +44,7 @@ void Saga2Engine::startVideo(const char *fileName, int x, int y) {
char file[260];
strcpy(file, "video/");
Common::strlcat(file, fileName, 260);
- nameCheck(file, VIDEO_EXT);
+ nameCheck(file, VIDEO_EXT, 260);
if (!_smkDecoder)
_smkDecoder = new Video::SmackerDecoder();
Commit: e6047c2da72e726a2c53e18af69494e2e541462e
https://github.com/scummvm/scummvm/commit/e6047c2da72e726a2c53e18af69494e2e541462e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-14T23:48:07+02:00
Commit Message:
SAGA2: Fix buffer overrun. CID 1457901, 1457994
Changed paths:
engines/saga2/intrface.cpp
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index e0d7e236ef..7876fe2ee5 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -1891,7 +1891,8 @@ void setIndivBtns(uint16 brotherID) { // top = 0, mid = 1, bot = 2
setEnchantmentDisplay();
// point the read containers to the correct brother
- if (brotherID > playerActors) brotherID = playerActors;
+ if (brotherID >= playerActors)
+ brotherID = playerActors - 1;
indivCviewTop->setContainer(GameObject::objectAddress(ActorBaseID + brotherID));
indivCviewTop->ghost(TrioCviews[brotherID]->isGhosted());
Commit: 621599cd584285a99052b4c847d9421291213781
https://github.com/scummvm/scummvm/commit/621599cd584285a99052b4c847d9421291213781
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-15T00:16:47+02:00
Commit Message:
SAGA2: Add (not-yet-working) debug mode for tile drawing
Changed paths:
engines/saga2/terrain.cpp
engines/saga2/tileline.cpp
engines/saga2/tileline.h
diff --git a/engines/saga2/terrain.cpp b/engines/saga2/terrain.cpp
index 50e1b01ade..5354b836b1 100644
--- a/engines/saga2/terrain.cpp
+++ b/engines/saga2/terrain.cpp
@@ -27,6 +27,7 @@
#include "saga2/saga2.h"
#include "saga2/idtypes.h"
#include "saga2/tile.h"
+#include "saga2/tileline.h"
#include "saga2/actor.h"
namespace Saga2 {
@@ -34,9 +35,6 @@ namespace Saga2 {
extern WorldMapData *mapList;
-#define VISUAL1 1
-#define VISUAL2 0
-
static int16 prevMapNum;
static TilePoint prevCoords = Nowhere;
static MetaTilePtr prevMeta = NULL;
@@ -316,31 +314,17 @@ uint32 volumeTerrain(
volume.min.z = pos.z;
volume.max.z = pos.z + objHeight;
- /*
- #if VISUAL1
- void TPLine( const TilePoint &start, const TilePoint &stop, int16 color );
- {
- TilePoint minUminV(volume.min.u,
- volume.min.v,
- volume.min.z );
- TilePoint maxUminV(volume.max.u,
- volume.min.v,
- volume.min.z );
- TilePoint maxUmaxV(volume.max.u,
- volume.max.v,
- volume.min.z );
- TilePoint minUmaxV(volume.min.u,
- volume.max.v,
- volume.min.z );
-
- TPLine( minUminV, maxUminV, 7 );
- TPLine( maxUminV, maxUmaxV, 7 );
- TPLine( maxUmaxV, minUmaxV, 7 );
- TPLine( minUmaxV, minUminV, 7 );
-
- }
- #endif
- */
+ if (debugChannelSet(-1, kDebugTiles)) {
+ TilePoint minUminV(volume.min.u, volume.min.v, volume.min.z);
+ TilePoint maxUminV(volume.max.u, volume.min.v, volume.min.z);
+ TilePoint maxUmaxV(volume.max.u, volume.max.v, volume.min.z);
+ TilePoint minUmaxV(volume.min.u, volume.max.v, volume.min.z);
+
+ TPLine(minUminV, maxUminV, 7);
+ TPLine(maxUminV, maxUmaxV, 7);
+ TPLine(maxUmaxV, minUmaxV, 7);
+ TPLine(minUmaxV, minUminV, 7);
+ }
terrain = volumeTerrain(mapNum, volume);
@@ -382,11 +366,8 @@ uint32 lineTerrain(
int32 curZ,
zStep;
-#if DEBUG && VISUAL2
TilePoint prevPoint = from;
TilePoint tempPoint;
- void TPLine(const TilePoint & start, const TilePoint & stop);
-#endif
// Calculate starting subtile coordinates
curSubTile.u = from.u >> kSubTileShift;
@@ -458,13 +439,14 @@ uint32 lineTerrain(
subTileMask_ |= (uMask[curSubTile.u & kSubTileMask] &
vMask[curSubTile.v & kSubTileMask]);
-#if DEBUG && VISUAL2
- tempPoint.u = curSubTile.u << kTileSubShift;
- tempPoint.v = curSubTile.v << kTileSubShift;
- tempPoint.z = curSubTile.z;
- TPLine(prevPoint, tempPoint);
- prevPoint = tempPoint;
-#endif
+
+ if (debugChannelSet(-1, kDebugTiles)) {
+ tempPoint.u = curSubTile.u << kTileSubShift;
+ tempPoint.v = curSubTile.v << kTileSubShift;
+ tempPoint.z = curSubTile.z;
+ TPLine(prevPoint, tempPoint);
+ prevPoint = tempPoint;
+ }
errorTerm += vDiff;
if (errorTerm >= uDiff) {
@@ -489,14 +471,15 @@ uint32 lineTerrain(
subTileMask_ |= (uMask[curSubTile.u & kSubTileMask] &
vMask[curSubTile.v & kSubTileMask]);
-#if DEBUG && VISUAL2
- tempPoint.u = curSubTile.u << kTileSubShift;
- tempPoint.v = curSubTile.v << kTileSubShift;
- tempPoint.z = curSubTile.z;
- TPLine(prevPoint, tempPoint);
- prevPoint = tempPoint;
-#endif
+ if (debugChannelSet(-1, kDebugTiles)) {
+ tempPoint.u = curSubTile.u << kTileSubShift;
+ tempPoint.v = curSubTile.v << kTileSubShift;
+ tempPoint.z = curSubTile.z;
+ TPLine(prevPoint, tempPoint);
+ prevPoint = tempPoint;
+ warning("***************************");
+ }
}
}
} else {
@@ -528,13 +511,13 @@ uint32 lineTerrain(
subTileMask_ |= (uMask[curSubTile.u & kSubTileMask] &
vMask[curSubTile.v & kSubTileMask]);
-#if DEBUG && VISUAL2
- tempPoint.u = curSubTile.u << kTileSubShift;
- tempPoint.v = curSubTile.v << kTileSubShift;
- tempPoint.z = curSubTile.z;
- TPLine(prevPoint, tempPoint);
- prevPoint = tempPoint;
-#endif
+ if (debugChannelSet(-1, kDebugTiles)) {
+ tempPoint.u = curSubTile.u << kTileSubShift;
+ tempPoint.v = curSubTile.v << kTileSubShift;
+ tempPoint.z = curSubTile.z;
+ TPLine(prevPoint, tempPoint);
+ prevPoint = tempPoint;
+ }
errorTerm += uDiff;
if (errorTerm >= vDiff) {
@@ -559,14 +542,14 @@ uint32 lineTerrain(
subTileMask_ |= (uMask[curSubTile.u & kSubTileMask] &
vMask[curSubTile.v & kSubTileMask]);
-#if DEBUG && VISUAL2
- tempPoint.u = curSubTile.u << kTileSubShift;
- tempPoint.v = curSubTile.v << kTileSubShift;
- tempPoint.z = curSubTile.z;
- TPLine(prevPoint, tempPoint);
- prevPoint = tempPoint;
-#endif
+ if (debugChannelSet(-1, kDebugTiles)) {
+ tempPoint.u = curSubTile.u << kTileSubShift;
+ tempPoint.v = curSubTile.v << kTileSubShift;
+ tempPoint.z = curSubTile.z;
+ TPLine(prevPoint, tempPoint);
+ prevPoint = tempPoint;
+ }
}
}
}
diff --git a/engines/saga2/tileline.cpp b/engines/saga2/tileline.cpp
index c00001e430..0c04c96bd0 100644
--- a/engines/saga2/tileline.cpp
+++ b/engines/saga2/tileline.cpp
@@ -25,11 +25,11 @@
*/
#include "saga2/saga2.h"
+#include "saga2/tile.h"
+#include "saga2/tileline.h"
namespace Saga2 {
-#if DEBUG
-
void TPTriangle(const TilePoint &tp1, const TilePoint &tp2, const TilePoint &tp3, int16 color) {
TPLine(tp1, tp2, color);
TPLine(tp2, tp3, color);
@@ -73,8 +73,6 @@ void TPLine(const TilePoint &start, const TilePoint &stop) {
g_vm->_mainPort.drawTo(stopPt);
}
-void TPLine(const TilePoint &start, const TilePoint &stop, int16 color);
-
void TPLine(const TilePoint &start, const TilePoint &stop, int16 color) {
Point16 startPt,
stopPt;
@@ -91,6 +89,5 @@ void TPLine(const TilePoint &start, const TilePoint &stop, int16 color) {
g_vm->_mainPort.moveTo(startPt);
g_vm->_mainPort.drawTo(stopPt);
}
-#endif
} // end of namespace Saga2
diff --git a/engines/saga2/tileline.h b/engines/saga2/tileline.h
index 41c3cf06a5..1db8771c54 100644
--- a/engines/saga2/tileline.h
+++ b/engines/saga2/tileline.h
@@ -27,24 +27,16 @@
#ifndef SAGA2_TILELINE_H
#define SAGA2_TILELINE_H
-namespace Saga2 {
+#include "saga2/tcoords.h"
-#if DEBUG
+namespace Saga2 {
void TPLine(const TilePoint &start, const TilePoint &stop, int16 color);
+void TPLine(const TilePoint &start, const TilePoint &stop);
void TPTriangle(const TilePoint &tp1, const TilePoint &tp2, const TilePoint &tp3, int16 color);
void TPRectangle(const TilePoint &tp1, const TilePoint &tp2, const TilePoint &tp3, const TilePoint &tp4, int16 color);
void TPCircle(const TilePoint &tp1, const int radius, int16 color);
-#else
-
-#define TPLine(s1,s2,c) ((void)0)
-#define TPTriangle(p1,p2,p3,c) ((void)0)
-#define TPRectangle(p1,p2,p3,p4,c) ((void)0)
-#define TPCircle(p,r,c) ((void)0)
-
-#endif
-
} // end of namespace Saga2
#endif
More information about the Scummvm-git-logs
mailing list