aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/startrek/awaymission.cpp4
-rw-r--r--engines/startrek/math.cpp2
-rw-r--r--engines/startrek/menu.cpp6
-rw-r--r--engines/startrek/room.h4
-rw-r--r--engines/startrek/sound.cpp2
-rw-r--r--engines/startrek/startrek.cpp15
-rw-r--r--engines/startrek/startrek.h4
7 files changed, 25 insertions, 12 deletions
diff --git a/engines/startrek/awaymission.cpp b/engines/startrek/awaymission.cpp
index 9edf121083..3f33d1f25d 100644
--- a/engines/startrek/awaymission.cpp
+++ b/engines/startrek/awaymission.cpp
@@ -410,8 +410,8 @@ void StarTrekEngine::awayMissionUseObject(int16 clickedObject) {
else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
tryWalkToHotspot = true;
// CHECKME: Identical to the previous check, thus never used
- else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
- tryWalkToHotspot = true;
+ //else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
+ // tryWalkToHotspot = true;
else if (_awayMission.activeObject == OBJECT_SPOCK && _room->actionHasCode(ACTION_USE, OBJECT_ISTRICOR, _awayMission.passiveObject, 0))
tryWalkToHotspot = true;
diff --git a/engines/startrek/math.cpp b/engines/startrek/math.cpp
index 7770ed3a44..f9527dd413 100644
--- a/engines/startrek/math.cpp
+++ b/engines/startrek/math.cpp
@@ -83,7 +83,7 @@ Angle StarTrekEngine::atan2(int32 deltaX, int32 deltaY) {
int16 endIndex = 128;
int16 index = 0;
- int16 angle;
+ int16 angle = 0;
while (index <= endIndex) {
angle = (index + endIndex) / 2;
Fixed14 tableValue = Fixed14::fromRaw(atanTable[angle]);
diff --git a/engines/startrek/menu.cpp b/engines/startrek/menu.cpp
index 0ef16592d3..a4a37394bf 100644
--- a/engines/startrek/menu.cpp
+++ b/engines/startrek/menu.cpp
@@ -499,8 +499,8 @@ void StarTrekEngine::loadMenuButtons(String mnuFilename, int xpos, int ypos) {
if (_activeMenu == nullptr)
_keyboardControlsMouseOutsideMenu = _keyboardControlsMouse;
- SharedPtr<Menu> oldMenu = _activeMenu;
- _activeMenu = SharedPtr<Menu>(new Menu());
+ Menu *oldMenu = _activeMenu;
+ _activeMenu = new Menu();
_activeMenu->nextMenu = oldMenu;
SharedPtr<FileStream> stream = loadFile(mnuFilename + ".MNU");
@@ -851,7 +851,9 @@ void StarTrekEngine::unloadMenuButtons() {
_gfx->delSprite(sprite);
}
+ Menu *prevMenu = _activeMenu;
_activeMenu = _activeMenu->nextMenu;
+ delete prevMenu;
if (_activeMenu == nullptr)
_keyboardControlsMouse = _keyboardControlsMouseOutsideMenu;
diff --git a/engines/startrek/room.h b/engines/startrek/room.h
index b6a7d5dfaa..8e0e3a3ac3 100644
--- a/engines/startrek/room.h
+++ b/engines/startrek/room.h
@@ -42,12 +42,16 @@ namespace StarTrek {
class StarTrekEngine;
class Room;
+#include "common/pack-start.h" // START STRUCT PACKING
+
// Per-room action functions
struct RoomAction {
const Action action;
void (Room::*funcPtr)();
};
+#include "common/pack-end.h" // END STRUCT PACKING
+
// Offsets of data in RDF files
const int RDF_BAN_DATA_START = 0x1e;
diff --git a/engines/startrek/sound.cpp b/engines/startrek/sound.cpp
index f7f93382e0..ae31727479 100644
--- a/engines/startrek/sound.cpp
+++ b/engines/startrek/sound.cpp
@@ -35,7 +35,7 @@ namespace StarTrek {
// Main Sound Functions
Sound::Sound(StarTrekEngine *vm) : _vm(vm) {
- _midiDevice = MT_INVALID;
+ _midiDevice = MT_AUTO;
_midiDriver = nullptr;
_loopingMidiTrack = false;
diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp
index 0a3a89a2bf..968bc3ccfb 100644
--- a/engines/startrek/startrek.cpp
+++ b/engines/startrek/startrek.cpp
@@ -67,6 +67,7 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
DebugMan.addDebugChannel(kDebugGeneral, "general", "General");
_gfx = nullptr;
+ _activeMenu = nullptr;
_sound = nullptr;
_macResFork = nullptr;
@@ -104,6 +105,8 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
}
StarTrekEngine::~StarTrekEngine() {
+ delete _activeMenu->nextMenu;
+ delete _activeMenu;
delete _gfx;
delete _sound;
delete _macResFork;
@@ -418,11 +421,15 @@ SharedPtr<FileStream> StarTrekEngine::loadFile(Common::String filename, int file
// The Judgment Rites demo has its files not in the standard archive
if (getGameType() == GType_STJR && (getFeatures() & GF_DEMO)) {
Common::File *file = new Common::File();
- if (!file->open(filename.c_str()))
+ if (!file->open(filename.c_str())) {
+ delete file;
error("Could not find file \'%s\'", filename.c_str());
- byte *data = (byte *)malloc(file->size());
- file->read(data, file->size());
- return SharedPtr<FileStream>(new FileStream(data, file->size(), bigEndian));
+ }
+ int32 size = file->size();
+ byte *data = (byte *)malloc(size);
+ file->read(data, size);
+ delete file;
+ return SharedPtr<FileStream>(new FileStream(data, size, bigEndian));
}
Common::SeekableReadStream *indexFile = 0;
diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h
index 373778e36a..bfc8266e45 100644
--- a/engines/startrek/startrek.h
+++ b/engines/startrek/startrek.h
@@ -162,7 +162,7 @@ struct Menu {
SharedPtr<FileStream> menuFile;
uint16 numButtons;
int16 selectedButton;
- SharedPtr<Menu> nextMenu;
+ Menu *nextMenu;
};
// Special events that can be returned by handleMenuEvents.
@@ -646,7 +646,7 @@ private:
uint32 _textboxVar2;
uint16 _textboxVar6;
bool _textboxHasMultipleChoices;
- SharedPtr<Menu> _activeMenu;
+ Menu *_activeMenu;
// Saved value of StarTrekEngine::_keyboardControlsMouse when menus are up
bool _keyboardControlsMouseOutsideMenu;