From 688c98890929acf4fb6a43a115e28f250fb7d466 Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Mon, 11 Jun 2018 18:14:34 -0400 Subject: STARTREK: Fix some uninitialized variables --- engines/startrek/graphics.cpp | 3 +++ engines/startrek/object.h | 44 +++++++++++++++++++++++++++++++++++++++++++ engines/startrek/startrek.cpp | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp index 145a156b1e..fc371545d1 100644 --- a/engines/startrek/graphics.cpp +++ b/engines/startrek/graphics.cpp @@ -51,6 +51,9 @@ Graphics::Graphics(StarTrekEngine *vm) : _vm(vm), _egaMode(false) { _palData = new byte[256 * 3]; _lutData = new byte[256 * 3]; + memset(_palData, 0, 256 * 3); + memset(_lutData, 0, 256 * 3); + _paletteFadeLevel = 0; _mouseLocked = false; _mouseToBeShown = false; diff --git a/engines/startrek/object.h b/engines/startrek/object.h index 6a7911636f..92597881ec 100644 --- a/engines/startrek/object.h +++ b/engines/startrek/object.h @@ -122,6 +122,50 @@ struct Actor { uint16 fielda2; uint16 fielda4; uint16 fielda6; + +public: + Actor() : + spriteDrawn(), + //animFilename[16], + animType(), + sprite(), + //bitmapFilename[10], + scale(), + animFile(), + numAnimFrames(), + animFrame(), + frameToStartNextAnim(), + pos(), + field60(), + field62(), + triggerActionWhenAnimFinished(), + finishedAnimActionParam(), + //animationString2[8](), + field70(), + field72(), + field74(), + field76(), + iwSrcPosition(), + iwDestPosition(), + granularPosX(), + granularPosY(), + speedX(), + speedY(), + + dest(), + field90(), + field92(), + + direction(), + field94(), + field96(), + //char animationString[10]; + + fielda2(), + fielda4(), + fielda6() + {} + }; } diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp index c623c1b0a6..82ac94e673 100644 --- a/engines/startrek/startrek.cpp +++ b/engines/startrek/startrek.cpp @@ -1134,7 +1134,7 @@ bool StarTrekEngine::walkActiveObjectToHotspot() { int objectIndex; if (_awayMission.activeAction != ACTION_USE) objectIndex = OBJECT_KIRK; - else if (_awayMission.activeObject >= OBJECT_KIRK && _awayMission.activeObject <= OBJECT_REDSHIRT) + else if (_awayMission.activeObject <= OBJECT_REDSHIRT) objectIndex = _awayMission.activeObject; else if (_awayMission.activeObject >= ITEMS_START && _awayMission.activeObject <= ITEMS_END) { // FIXME: "<= ITEMS_END" doesn't make sense? if (_awayMission.activeObject == OBJECT_ISTRICOR) -- cgit v1.2.3