QUEEN: Fix Memset on Non-Trivial Structure GCC Compiler Warnings

This commit is contained in:
D G Turner 2021-03-22 18:50:27 +00:00
parent 6769b2b93b
commit d87419f0a4
4 changed files with 58 additions and 4 deletions

View File

@ -73,9 +73,11 @@ Display::Display(QueenEngine *vm, OSystem *system)
_imageExt = (_vm->resource()->getPlatform() == Common::kPlatformAmiga) ? "LBM" : "PCX";
_curTextColor = 0;
memset(_texts, 0, sizeof(_texts));
for (uint i = 0; i < ARRAYSIZE(_texts); i++) {
_texts[i].clear();
}
memset(&_dynalum, 0, sizeof(_dynalum));
_dynalum.clear();
setupInkColors();
}

View File

@ -212,6 +212,15 @@ private:
int8 *lumBuf;
uint32 lumSize;
uint8 prevColMask;
void clear() {
valid = false;
mskBuf = nullptr;
mskSize = 0;
lumBuf = nullptr;
lumSize = 0;
prevColMask = 0;
}
};
struct TextSlot {
@ -219,6 +228,13 @@ private:
uint8 color;
Common::String text;
bool outlined;
void clear() {
x = 0;
color = 0;
text = "";
outlined = false;
}
};
uint8 *_screenBuf;

View File

@ -175,6 +175,37 @@ void BobSlot::scaleWalkSpeed(uint16 ms) {
}
}
void BobSlot::clear() {
active = false;
x = 0;
y = 0;
box = Box();
xflip = false;
scale = 0;
frameNum = 0;
frameDir = 0;
animating = false;
anim.speed = 0;
anim.speedBak = 0;
anim.string.buffer = nullptr;
anim.string.curPos = nullptr;
anim.normal.rebound = false;
anim.normal.firstFrame = 0;
anim.normal.lastFrame = 0;
moving = false;
speed = 0;
xmajor = false;
xdir = 0;
ydir = 0;
endx = 0;
endy = 0;
dx = 0;
dy = 0;
total = 0;
}
void BobSlot::clear(const Box *defaultBox) {
active = false;
xflip = false;
@ -203,8 +234,12 @@ Graphics::Graphics(QueenEngine *vm)
_defaultBox(-1, -1, -1, -1),
_gameScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, ROOM_ZONE_HEIGHT - 1),
_fullScreenBox(0, 0, GAME_SCREEN_WIDTH - 1, GAME_SCREEN_HEIGHT - 1) {
memset(_bobs, 0, sizeof(_bobs));
memset(_sortedBobs, 0, sizeof(_sortedBobs));
for (uint i = 0; i < ARRAYSIZE(_bobs); i++) {
_bobs[i].clear();
}
for (uint i = 0; i < ARRAYSIZE(_sortedBobs); i++) {
_sortedBobs[i] = nullptr;
}
_sortedBobsCount = 0;
_shrinkBuffer.data = new uint8[ BOB_SHRINK_BUF_SIZE ];
}

View File

@ -83,6 +83,7 @@ struct BobSlot {
void scaleWalkSpeed(uint16 ms);
void clear();
void clear(const Box *defaultBox);
};