[Scummvm-git-logs] scummvm master -> 089c04f6f7a13d40db1e5df5829e84c9a728371f
bluegr
bluegr at gmail.com
Thu Aug 15 10:59:16 CEST 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
384715da84 STARTREK: Add a console
089c04f6f7 STARTREK: Cleanup away mission chain loading code
Commit: 384715da8448c303785072820329432461991deb
https://github.com/scummvm/scummvm/commit/384715da8448c303785072820329432461991deb
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-15T11:58:15+03:00
Commit Message:
STARTREK: Add a console
This also fixes an uninitialized pointer crash (_mapFile)
Changed paths:
A engines/startrek/console.cpp
A engines/startrek/console.h
engines/startrek/events.cpp
engines/startrek/graphics.cpp
engines/startrek/module.mk
engines/startrek/startrek.cpp
engines/startrek/startrek.h
diff --git a/engines/startrek/console.cpp b/engines/startrek/console.cpp
new file mode 100644
index 0000000..5e6108e
--- /dev/null
+++ b/engines/startrek/console.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "startrek/console.h"
+#include "gui/debugger.h"
+#include "startrek/startrek.h"
+
+namespace StarTrek {
+
+Console::Console(StarTrekEngine *vm) : GUI::Debugger(), _vm(vm) {
+ registerCmd("room", WRAP_METHOD(Console, Cmd_Room));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_Room(int argc, const char **argv) {
+ if (argc < 3) {
+ debugPrintf("Current room: %s%d\n", _vm->_missionToLoad.c_str(), _vm->_roomIndexToLoad);
+ debugPrintf("Use room <mission> <room> to teleport\n");
+ debugPrintf("Valid missions are: DEMON, TUG, LOVE, MUDD, FEATHER, TRIAL, SINS, VENG");
+ return true;
+ }
+
+ _vm->_missionToLoad = argv[1];
+ _vm->_roomIndexToLoad = atoi(argv[2]);
+ _vm->runAwayMission();
+
+ return false;
+}
+
+} // End of namespace StarTrek
diff --git a/engines/startrek/console.h b/engines/startrek/console.h
new file mode 100644
index 0000000..1d1b6e7
--- /dev/null
+++ b/engines/startrek/console.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef STARTREK_CONSOLE_H
+#define STARTREK_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace StarTrek {
+
+class StarTrekEngine;
+
+class Console : public GUI::Debugger {
+public:
+ Console(StarTrekEngine *vm);
+ virtual ~Console(void);
+
+private:
+ StarTrekEngine *_vm;
+
+ bool Cmd_Room(int argc, const char **argv);
+};
+
+} // End of namespace StarTrek
+#endif
diff --git a/engines/startrek/events.cpp b/engines/startrek/events.cpp
index d8935bd..c425b09 100644
--- a/engines/startrek/events.cpp
+++ b/engines/startrek/events.cpp
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "startrek/console.h"
#include "startrek/startrek.h"
namespace StarTrek {
@@ -61,6 +62,9 @@ void StarTrekEngine::pollEvents(bool queueEvents) {
break;
case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL))
+ _console->attach();
+
if (queueEvents) {
trekEvent.type = TREKEVENT_KEYDOWN;
addEventToQueue(trekEvent);
diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp
index 02e778c..f56d7d3 100644
--- a/engines/startrek/graphics.cpp
+++ b/engines/startrek/graphics.cpp
@@ -20,6 +20,7 @@
*/
#include "startrek/common.h"
+#include "startrek/console.h"
#include "startrek/graphics.h"
#include "common/algorithm.h"
@@ -639,6 +640,7 @@ void Graphics::updateScreen() {
_mouseWarpY = -1;
}
+ _vm->_console->onFrame();
_vm->_system->updateScreen();
_vm->_system->delayMillis(10);
}
diff --git a/engines/startrek/module.mk b/engines/startrek/module.mk
index e8012b5..cc4b32a 100644
--- a/engines/startrek/module.mk
+++ b/engines/startrek/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS = \
awaymission.o \
bitmap.o \
common.o \
+ console.o \
detection.o \
events.o \
font.o \
diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp
index b017495..123fc74 100644
--- a/engines/startrek/startrek.cpp
+++ b/engines/startrek/startrek.cpp
@@ -37,6 +37,7 @@
#include "engines/util.h"
#include "video/qt_decoder.h"
+#include "startrek/console.h"
#include "startrek/iwfile.h"
#include "startrek/lzss.h"
#include "startrek/room.h"
@@ -94,6 +95,7 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
_missionToLoad = "DEMON";
_roomIndexToLoad = 0;
+ _mapFile = nullptr;
_showSubtitles = true;
Common::fill(_r3List, _r3List + NUM_SPACE_OBJECTS, (R3 *)nullptr);
@@ -106,6 +108,8 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
StarTrekEngine::~StarTrekEngine() {
delete _activeMenu->nextMenu;
delete _activeMenu;
+
+ delete _console;
delete _gfx;
delete _sound;
delete _macResFork;
@@ -114,6 +118,7 @@ StarTrekEngine::~StarTrekEngine() {
Common::Error StarTrekEngine::run() {
_gfx = new Graphics(this);
_sound = new Sound(this);
+ _console = new Console(this);
if (getPlatform() == Common::kPlatformMacintosh) {
_macResFork = new Common::MacResManager();
diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h
index fadf295..5f4dc61 100644
--- a/engines/startrek/startrek.h
+++ b/engines/startrek/startrek.h
@@ -60,6 +60,7 @@ namespace StarTrek {
class StarTrekEngine;
class Room;
+class Console;
typedef String(StarTrekEngine::*TextGetterFunc)(int, uintptr, String *);
// FIXME: Eventually get rid of Common::SharedPtr and dispose of file streams properly
@@ -775,6 +776,7 @@ public:
Graphics *_gfx;
Sound *_sound;
+ Console *_console;
SharedPtr<IWFile> _iwFile;
private:
Commit: 089c04f6f7a13d40db1e5df5829e84c9a728371f
https://github.com/scummvm/scummvm/commit/089c04f6f7a13d40db1e5df5829e84c9a728371f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-08-15T11:58:16+03:00
Commit Message:
STARTREK: Cleanup away mission chain loading code
Changed paths:
engines/startrek/room.cpp
diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index 79e6621..976d9f4 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -586,20 +586,25 @@ void Room::endMission(int16 score, int16 arg1, int16 arg2) {
// TODO: This is a stopgap measure (loading the next away mission immediately).
// Replace this with the proper code later.
_vm->_gameMode = GAMEMODE_BEAMDOWN;
- if (_vm->_missionName == "DEMON")
- _vm->_missionToLoad = "TUG";
- if (_vm->_missionName == "TUG")
- _vm->_missionToLoad = "LOVE";
- if (_vm->_missionName == "LOVE")
- _vm->_missionToLoad = "MUDD";
- if (_vm->_missionName == "MUDD")
- _vm->_missionToLoad = "FEATHER";
- if (_vm->_missionName == "FEATHER")
- _vm->_missionToLoad = "TRIAL";
- if (_vm->_missionName == "TRIAL")
- _vm->_missionToLoad = "SINS";
- if (_vm->_missionName == "SINS")
- _vm->_missionToLoad = "VENG";
+
+ const char *missionNames[] = {
+ "DEMON",
+ "TUG",
+ "LOVE",
+ "MUDD",
+ "FEATHER",
+ "TRIAL",
+ "SINS",
+ "VENG"
+ };
+
+ for (int i = 0; i < ARRAYSIZE(missionNames); i++) {
+ if (_vm->_missionName == missionNames[i]) {
+ _vm->_missionToLoad = missionNames[i + 1];
+ break;
+ }
+ }
+
_vm->_roomIndexToLoad = 0;
}
More information about the Scummvm-git-logs
mailing list