mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-06 10:58:01 +00:00
LAB: Add a console, with two new commands (scene and scene_resources)
This commit is contained in:
parent
ced5b677f6
commit
333d553716
78
engines/lab/console.cpp
Normal file
78
engines/lab/console.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
/* 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 "gui/debugger.h"
|
||||
|
||||
#include "lab/lab.h"
|
||||
#include "lab/console.h"
|
||||
#include "lab/processroom.h"
|
||||
#include "lab/resource.h"
|
||||
|
||||
namespace Lab {
|
||||
|
||||
Console::Console(LabEngine *vm) : GUI::Debugger(), _vm(vm) {
|
||||
registerCmd("scene", WRAP_METHOD(Console, Cmd_Scene));
|
||||
registerCmd("scene_resources", WRAP_METHOD(Console, Cmd_DumpSceneResources));
|
||||
}
|
||||
|
||||
Console::~Console() {
|
||||
}
|
||||
|
||||
bool Console::Cmd_Scene(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
const char *directions[] = { "North", "South", "East", "West" };
|
||||
debugPrintf("Current scene is %d, direction: %s\n", _vm->_roomNum, directions[_vm->getDirection()]);
|
||||
debugPrintf("Use %s <scene number> to change the current scene\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
_vm->_roomNum = atoi(argv[1]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Console::Cmd_DumpSceneResources(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
debugPrintf("Usage: %s <scene number> to dump the resources for a scene\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
int scene = atoi(argv[1]);
|
||||
_vm->_resource->readViews(scene);
|
||||
RoomData *roomData = &_vm->_rooms[scene];
|
||||
RuleList *rules = roomData->_rules;
|
||||
const char *transitions[] = { "None", "Wipe", "ScrollWipe", "ScrollBlack", "ScrollBounce", "Transporter", "ReadFirstFrame", "ReadNextFrame" };
|
||||
const char *ruleTypes[] = { "None", "Action", "Operate", "Go forward", "Conditions", "Turn", "Go main view", "Turn from to" };
|
||||
|
||||
debugPrintf("Room mesage: %s\n", roomData->_roomMsg.c_str());
|
||||
debugPrintf("Transition: %s (%d)\n", transitions[roomData->_transitionType], roomData->_transitionType);
|
||||
|
||||
debugPrintf("Script:\n");
|
||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||
debugPrintf("Rule type: %s\n", ruleTypes[rule->_ruleType]);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Neverhood
|
45
engines/lab/console.h
Normal file
45
engines/lab/console.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* 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 LAB_CONSOLE_H
|
||||
#define LAB_CONSOLE_H
|
||||
|
||||
#include "gui/debugger.h"
|
||||
|
||||
namespace Lab {
|
||||
|
||||
class LabEngine;
|
||||
|
||||
class Console : public GUI::Debugger {
|
||||
public:
|
||||
Console(LabEngine *vm);
|
||||
virtual ~Console(void);
|
||||
|
||||
private:
|
||||
LabEngine *_vm;
|
||||
|
||||
bool Cmd_Scene(int argc, const char **argv);
|
||||
bool Cmd_DumpSceneResources(int argc, const char **argv);
|
||||
};
|
||||
|
||||
} // End of namespace Lab
|
||||
#endif
|
@ -228,15 +228,19 @@ void EventManager::processInput() {
|
||||
case Common::KEYCODE_LEFTBRACKET:
|
||||
_vm->changeVolume(-1);
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_RIGHTBRACKET:
|
||||
_vm->changeVolume(1);
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_z:
|
||||
//saveSettings();
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_d:
|
||||
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
|
||||
// Open debugger console
|
||||
_vm->_console->attach();
|
||||
continue;
|
||||
}
|
||||
// Intentional fall through
|
||||
default: {
|
||||
int n = (_nextKeyIn + 1) % 64;
|
||||
if (n != _nextKeyOut) {
|
||||
@ -251,10 +255,11 @@ void EventManager::processInput() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_system->copyRectToScreen(_vm->_graphics->_displayBuffer, _vm->_graphics->_screenWidth, 0, 0, _vm->_graphics->_screenWidth, _vm->_graphics->_screenHeight);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
g_system->copyRectToScreen(_vm->_graphics->_displayBuffer, _vm->_graphics->_screenWidth, 0, 0, _vm->_graphics->_screenWidth, _vm->_graphics->_screenHeight);
|
||||
_vm->_console->onFrame();
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
Common::KeyCode EventManager::getNextChar() {
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "lab/lab.h"
|
||||
|
||||
#include "lab/anim.h"
|
||||
#include "lab/console.h"
|
||||
#include "lab/dispman.h"
|
||||
#include "lab/eventman.h"
|
||||
#include "lab/image.h"
|
||||
@ -83,6 +84,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
|
||||
_rooms = nullptr;
|
||||
_tilePuzzle = nullptr;
|
||||
_utils = nullptr;
|
||||
_console = nullptr;
|
||||
_journalBackImage = nullptr;
|
||||
_screenImage = nullptr;
|
||||
|
||||
@ -151,6 +153,7 @@ LabEngine::~LabEngine() {
|
||||
delete _graphics;
|
||||
delete _tilePuzzle;
|
||||
delete _utils;
|
||||
delete _console;
|
||||
delete _journalBackImage;
|
||||
// _screenImage->_imageData is always pointing to the current drawing buffer.
|
||||
// It shouldn't be deleted there.
|
||||
@ -171,6 +174,7 @@ Common::Error LabEngine::run() {
|
||||
_anim = new Anim(this);
|
||||
_tilePuzzle = new TilePuzzle(this);
|
||||
_utils = new Utils(this);
|
||||
_console = new Console(this);
|
||||
_journalBackImage = new Image(this);
|
||||
_screenImage = new Image(this);
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "engines/engine.h"
|
||||
#include "engines/savestate.h"
|
||||
|
||||
#include "lab/console.h"
|
||||
#include "lab/image.h"
|
||||
#include "lab/labsets.h"
|
||||
|
||||
@ -171,6 +172,8 @@ public:
|
||||
TextFont *_msgFont;
|
||||
TilePuzzle *_tilePuzzle;
|
||||
Utils *_utils;
|
||||
Console *_console;
|
||||
GUI::Debugger *getDebugger() { return _console; }
|
||||
|
||||
public:
|
||||
LabEngine(OSystem *syst, const ADGameDescription *gameDesc);
|
||||
|
@ -2,6 +2,7 @@ MODULE := engines/lab
|
||||
|
||||
MODULE_OBJS := \
|
||||
anim.o \
|
||||
console.o \
|
||||
detection.o \
|
||||
dispman.o \
|
||||
engine.o \
|
||||
|
Loading…
x
Reference in New Issue
Block a user