ASYLUM: Simplify the console code

This commit is contained in:
Cameron Cawley authored and Alexander Panov committed 2024-06-26 10:28:09 +03:00
1 parent 3e4640a7ed
commit fe9dabec20
7 files changed
+54 -34

No files matched your search

+4 -12
View File
@@ -50,12 +50,13 @@
#include "asylum/views/menu.h"
#include "asylum/views/video.h"
#include "asylum/console.h"
#include "asylum/respack.h"
namespace Asylum {
AsylumEngine::AsylumEngine(OSystem *system, const ADGameDescription *gd) : Engine(system), _gameDescription(gd),
_console(nullptr), _cursor(nullptr), _encounter(nullptr), _menu(nullptr), _resource(nullptr), _savegame(nullptr),
_cursor(nullptr), _encounter(nullptr), _menu(nullptr), _resource(nullptr), _savegame(nullptr),
_scene(nullptr), _screen(nullptr), _script(nullptr), _special(nullptr), _speech(nullptr), _sound(nullptr), _text(nullptr),
_video(nullptr), _handler(nullptr), _puzzles(nullptr) {
@@ -112,8 +113,7 @@ Common::Error AsylumEngine::run() {
initGraphics(640, 480);
// Create debugger. It requires GFX to be initialized
_console = new Console(this);
setDebugger(_console);
setDebugger(new Console(this));
// Create resource manager
_resource = new ResourceManager(this);
@@ -392,12 +392,9 @@ void AsylumEngine::playIntro() {
}
void AsylumEngine::handleEvents() {
if (!_console || !_video || !_screen || !_sound || !_menu || !_cursor)
if (!_video || !_screen || !_sound || !_menu || !_cursor)
error("[AsylumEngine::handleEvents] Subsystems not initialized properly!");
// Show the debugger if required
_console->onFrame();
AsylumEvent ev;
Common::Keymapper *const keymapper = _eventMan->getKeymapper();
@@ -414,11 +411,6 @@ void AsylumEngine::handleEvents() {
break;
case Common::EVENT_KEYDOWN:
if ((ev.kbd.flags & Common::KBD_CTRL) && ev.kbd.keycode == Common::KEYCODE_d) {
_console->attach();
break;
}
// Handle key events
if (_handler)
_handler->handleEvent(ev);
+1 -2
View File
@@ -35,7 +35,7 @@
#include "asylum/resources/data.h"
#include "asylum/console.h"
#include "asylum/detection.h"
#include "asylum/eventhandler.h"
#include "asylum/shared.h"
@@ -209,7 +209,6 @@ private:
const ADGameDescription *_gameDescription;
// Misc
Console *_console;
Common::RandomSource *_rnd;
// Game
-17
View File
@@ -31,23 +31,6 @@
namespace Asylum {
enum kDebugLevels {
kDebugLevelMain = 1 << 0,
kDebugLevelResources = 1 << 1,
kDebugLevelSprites = 1 << 2,
kDebugLevelInput = 1 << 3,
kDebugLevelMenu = 1 << 4,
kDebugLevelScripts = 1 << 5,
kDebugLevelSound = 1 << 6,
kDebugLevelSavegame = 1 << 7,
kDebugLevelScene = 1 << 8,
kDebugLevelObjects = 1 << 9,
kDebugLevelActor = 1 << 10,
kDebugLevelEncounter = 1 << 11,
kDebugLevelVideo = 1 << 12,
kDebugLevelCommands = 1 << 13
};
class AsylumEngine;
struct ActionArea;
+1 -1
View File
@@ -22,8 +22,8 @@
#include "engines/advancedDetector.h"
#include "base/plugins.h"
#include "asylum/detection.h"
#include "asylum/detection_tables.h"
#include "asylum/console.h"
static const DebugChannelDef debugFlagList[] = {
{Asylum::kDebugLevelMain, "Main", "Generic debug level"},
+46
View File
@@ -0,0 +1,46 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ASYLUM_DETECTION_H
#define ASYLUM_DETECTION_H
namespace Asylum {
enum kDebugLevels {
kDebugLevelMain = 1 << 0,
kDebugLevelResources = 1 << 1,
kDebugLevelSprites = 1 << 2,
kDebugLevelInput = 1 << 3,
kDebugLevelMenu = 1 << 4,
kDebugLevelScripts = 1 << 5,
kDebugLevelSound = 1 << 6,
kDebugLevelSavegame = 1 << 7,
kDebugLevelScene = 1 << 8,
kDebugLevelObjects = 1 << 9,
kDebugLevelActor = 1 << 10,
kDebugLevelEncounter = 1 << 11,
kDebugLevelVideo = 1 << 12,
kDebugLevelCommands = 1 << 13
};
} // End of namespace Asylum
#endif // ASYLUM_DETECTION_H
+1 -1
View File
@@ -24,11 +24,11 @@
#include "common/serializer.h"
#include "asylum/console.h"
#include "asylum/shared.h"
namespace Asylum {
class AsylumEngine;
class EventHandler;
class Puzzle;
+1 -1
View File
@@ -21,7 +21,7 @@
#include "common/textconsole.h"
#include "engines/asylum/console.h"
#include "engines/asylum/detection.h"
#include "engines/asylum/resources/data.h"