diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp index b3763ac83ac..1214f6eb9d9 100644 --- a/engines/queen/display.cpp +++ b/engines/queen/display.cpp @@ -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(); } diff --git a/engines/queen/display.h b/engines/queen/display.h index 7261d05b074..fe5d6017520 100644 --- a/engines/queen/display.h +++ b/engines/queen/display.h @@ -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; diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp index 8b1242d595d..2eda781833d 100644 --- a/engines/queen/graphics.cpp +++ b/engines/queen/graphics.cpp @@ -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 ]; } diff --git a/engines/queen/graphics.h b/engines/queen/graphics.h index 2035b170d3a..243ef947665 100644 --- a/engines/queen/graphics.h +++ b/engines/queen/graphics.h @@ -83,6 +83,7 @@ struct BobSlot { void scaleWalkSpeed(uint16 ms); + void clear(); void clear(const Box *defaultBox); };