[Scummvm-git-logs] scummvm master -> a404c80d410603265e1e226471647ee8e753157c
digitall
547637+digitall at users.noreply.github.com
Wed Mar 24 23:24:22 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a404c80d41 SCUMM: Fix Memset on Non-Trivial Structure GCC Compiler Warnings
Commit: a404c80d410603265e1e226471647ee8e753157c
https://github.com/scummvm/scummvm/commit/a404c80d410603265e1e226471647ee8e753157c
Author: D G Turner (digitall at scummvm.org)
Date: 2021-03-24T23:23:46Z
Commit Message:
SCUMM: Fix Memset on Non-Trivial Structure GCC Compiler Warnings
Changed paths:
engines/scumm/actor_he.h
engines/scumm/gfx.h
engines/scumm/he/wiz_he.cpp
engines/scumm/scumm.cpp
engines/scumm/scumm_v6.h
diff --git a/engines/scumm/actor_he.h b/engines/scumm/actor_he.h
index d80d042608..ccb47bc912 100644
--- a/engines/scumm/actor_he.h
+++ b/engines/scumm/actor_he.h
@@ -37,6 +37,12 @@ struct AuxBlock {
r.left = r.top = 0;
r.right = r.bottom = -1;
}
+
+ void clear() {
+ reset();
+ r.right = 0;
+ r.bottom = 0;
+ }
};
struct AuxEntry {
diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h
index 1629567fa4..6b3194d4cc 100644
--- a/engines/scumm/gfx.h
+++ b/engines/scumm/gfx.h
@@ -156,6 +156,17 @@ struct VirtScreen : Graphics::Surface {
*/
uint16 bdirty[80 + 1];
+ void clear() {
+ // FIXME: Call Graphics::Surface clear / constructor?
+ number = kMainVirtScreen;
+ topline = 0;
+ xstart = 0;
+ hasTwoBuffers = false;
+ backBuf = nullptr;
+ for (uint i = 0; i < ARRAYSIZE(tdirty); i++) tdirty[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(bdirty); i++) bdirty[i] = 0;
+ }
+
/**
* Convenience method to set the whole tdirty and bdirty arrays to one
* specific value each. This is mostly used to mark every as dirty in
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 0d3a75c17f..f55cc6ea1a 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1850,7 +1850,9 @@ struct PolygonDrawData {
int pAreasNum;
PolygonDrawData(int n) {
- memset(mat, 0, sizeof(mat));
+ for (uint i = 0; i < ARRAYSIZE(mat); i++) {
+ mat[i] = Common::Point();
+ }
pa = new PolygonArea[n];
for (int i = 0; i < n; ++i) {
pa[i].xmin = 0x7FFFFFFF;
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 7960f813be..ba7cf7e5b6 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -249,7 +249,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_roomWidth = 0;
_screenHeight = 0;
_screenWidth = 0;
- memset(_virtscr, 0, sizeof(_virtscr));
+ for (uint i = 0; i < ARRAYSIZE(_virtscr); i++) {
+ _virtscr[i].clear();
+ }
camera.reset();
memset(_colorCycle, 0, sizeof(_colorCycle));
memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle));
@@ -808,9 +810,13 @@ int ScummEngine_v0::DelayCalculateDelta() {
ScummEngine_v6::ScummEngine_v6(OSystem *syst, const DetectorResult &dr)
: ScummEngine(syst, dr) {
_blastObjectQueuePos = 0;
- memset(_blastObjectQueue, 0, sizeof(_blastObjectQueue));
+ for (uint i = 0; i < ARRAYSIZE(_blastObjectQueue); i++) {
+ _blastObjectQueue[i].clear();
+ }
_blastTextQueuePos = 0;
- memset(_blastTextQueue, 0, sizeof(_blastTextQueue));
+ for (uint i = 0; i < ARRAYSIZE(_blastTextQueue); i++) {
+ _blastTextQueue[i].clear();
+ }
memset(_akosQueue, 0, sizeof(_akosQueue));
_akosQueuePos = 0;
@@ -894,7 +900,9 @@ ScummEngine_v70he::~ScummEngine_v70he() {
ScummEngine_v71he::ScummEngine_v71he(OSystem *syst, const DetectorResult &dr)
: ScummEngine_v70he(syst, dr) {
_auxBlocksNum = 0;
- memset(_auxBlocks, 0, sizeof(_auxBlocks));
+ for (uint i = 0; i < ARRAYSIZE(_auxBlocks); i++) {
+ _auxBlocks[i].clear();
+ }
_auxEntriesNum = 0;
memset(_auxEntries, 0, sizeof(_auxEntries));
diff --git a/engines/scumm/scumm_v6.h b/engines/scumm/scumm_v6.h
index 21e0e4d55c..f125ca281a 100644
--- a/engines/scumm/scumm_v6.h
+++ b/engines/scumm/scumm_v6.h
@@ -54,6 +54,14 @@ protected:
byte color;
byte charset;
byte text[256];
+
+ void clear() {
+ xpos = 0;
+ ypos = 0;
+ color = 0;
+ charset = 0;
+ for (uint i = 0; i < ARRAYSIZE(text); i++) text[i] = 0;
+ }
};
/** BlastObjects to draw */
@@ -63,6 +71,15 @@ protected:
uint16 scaleX, scaleY;
uint16 image;
uint16 mode;
+
+ void clear() {
+ number = 0;
+ rect = Common::Rect();
+ scaleX = 0;
+ scaleY = 0;
+ image = 0;
+ mode = 0;
+ }
};
int _blastObjectQueuePos;
@@ -71,6 +88,12 @@ protected:
struct BlastText : TextObject {
Common::Rect rect;
bool center;
+
+ void clear() {
+ this->TextObject::clear();
+ rect = Common::Rect();
+ center = false;
+ }
};
int _blastTextQueuePos;
More information about the Scummvm-git-logs
mailing list