mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
AGI: Cleanup PreAGI console code
This commit is contained in:
parent
87b48806dd
commit
6f83052b40
@ -275,25 +275,21 @@ bool Console::Cmd_BT(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PreAGI_Console::PreAGI_Console(PreAgiEngine *vm) {
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
Mickey_Console::Mickey_Console(MickeyEngine *mickey) : PreAGI_Console(mickey) {
|
||||
MickeyConsole::MickeyConsole(MickeyEngine *mickey) : GUI::Debugger() {
|
||||
_mickey = mickey;
|
||||
|
||||
DCmd_Register("curRoom", WRAP_METHOD(Mickey_Console, Cmd_CurRoom));
|
||||
DCmd_Register("gotoRoom", WRAP_METHOD(Mickey_Console, Cmd_GotoRoom));
|
||||
DCmd_Register("drawPic", WRAP_METHOD(Mickey_Console, Cmd_DrawPic));
|
||||
DCmd_Register("drawObj", WRAP_METHOD(Mickey_Console, Cmd_DrawObj));
|
||||
DCmd_Register("curRoom", WRAP_METHOD(MickeyConsole, Cmd_CurRoom));
|
||||
DCmd_Register("gotoRoom", WRAP_METHOD(MickeyConsole, Cmd_GotoRoom));
|
||||
DCmd_Register("drawPic", WRAP_METHOD(MickeyConsole, Cmd_DrawPic));
|
||||
DCmd_Register("drawObj", WRAP_METHOD(MickeyConsole, Cmd_DrawObj));
|
||||
}
|
||||
|
||||
bool Mickey_Console::Cmd_CurRoom(int argc, const char **argv) {
|
||||
bool MickeyConsole::Cmd_CurRoom(int argc, const char **argv) {
|
||||
_mickey->debugCurRoom();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mickey_Console::Cmd_GotoRoom(int argc, const char **argv) {
|
||||
bool MickeyConsole::Cmd_GotoRoom(int argc, const char **argv) {
|
||||
if (argc != 2)
|
||||
DebugPrintf("Usage: %s <Room number>\n", argv[0]);
|
||||
else
|
||||
@ -301,7 +297,7 @@ bool Mickey_Console::Cmd_GotoRoom(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mickey_Console::Cmd_DrawPic(int argc, const char **argv) {
|
||||
bool MickeyConsole::Cmd_DrawPic(int argc, const char **argv) {
|
||||
if (argc != 2)
|
||||
DebugPrintf("Usage: %s <Picture number>\n", argv[0]);
|
||||
else
|
||||
@ -309,7 +305,7 @@ bool Mickey_Console::Cmd_DrawPic(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mickey_Console::Cmd_DrawObj(int argc, const char **argv) {
|
||||
bool MickeyConsole::Cmd_DrawObj(int argc, const char **argv) {
|
||||
if (argc != 2)
|
||||
DebugPrintf("Usage: %s <Object number>\n", argv[0]);
|
||||
else
|
||||
@ -317,13 +313,13 @@ bool Mickey_Console::Cmd_DrawObj(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Winnie_Console::Winnie_Console(WinnieEngine *winnie) : PreAGI_Console(winnie) {
|
||||
WinnieConsole::WinnieConsole(WinnieEngine *winnie) : GUI::Debugger() {
|
||||
_winnie = winnie;
|
||||
|
||||
DCmd_Register("curRoom", WRAP_METHOD(Winnie_Console, Cmd_CurRoom));
|
||||
DCmd_Register("curRoom", WRAP_METHOD(WinnieConsole, Cmd_CurRoom));
|
||||
}
|
||||
|
||||
bool Winnie_Console::Cmd_CurRoom(int argc, const char **argv) {
|
||||
bool WinnieConsole::Cmd_CurRoom(int argc, const char **argv) {
|
||||
_winnie->debugCurRoom();
|
||||
|
||||
return true;
|
||||
|
@ -67,20 +67,10 @@ private:
|
||||
AgiEngine *_vm;
|
||||
};
|
||||
|
||||
class PreAGI_Console : public GUI::Debugger {
|
||||
class MickeyConsole : public GUI::Debugger {
|
||||
public:
|
||||
PreAGI_Console(PreAgiEngine *vm);
|
||||
virtual ~PreAGI_Console() {}
|
||||
|
||||
private:
|
||||
PreAgiEngine *_vm;
|
||||
};
|
||||
|
||||
|
||||
class Mickey_Console : public PreAGI_Console {
|
||||
public:
|
||||
Mickey_Console(MickeyEngine *mickey);
|
||||
virtual ~Mickey_Console() {}
|
||||
MickeyConsole(MickeyEngine *mickey);
|
||||
virtual ~MickeyConsole() {}
|
||||
|
||||
private:
|
||||
MickeyEngine *_mickey;
|
||||
@ -91,10 +81,10 @@ private:
|
||||
bool Cmd_DrawObj(int argc, const char **argv);
|
||||
};
|
||||
|
||||
class Winnie_Console : public PreAGI_Console {
|
||||
class WinnieConsole : public GUI::Debugger {
|
||||
public:
|
||||
Winnie_Console(WinnieEngine *winnie);
|
||||
virtual ~Winnie_Console() {}
|
||||
WinnieConsole(WinnieEngine *winnie);
|
||||
virtual ~WinnieConsole() {}
|
||||
|
||||
private:
|
||||
WinnieEngine *_winnie;
|
||||
@ -102,6 +92,6 @@ private:
|
||||
bool Cmd_CurRoom(int argc, const char **argv);
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
} // End of namespace Agi
|
||||
|
||||
#endif /* AGI_CONSOLE_H */
|
||||
|
@ -203,6 +203,7 @@ void PreAgiEngine::printStrXOR(char *szMsg) {
|
||||
|
||||
int PreAgiEngine::getSelection(SelectionTypes type) {
|
||||
Common::Event event;
|
||||
GUI::Debugger *console = getDebugger();
|
||||
|
||||
while (!shouldQuit()) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
@ -216,9 +217,9 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
|
||||
if (type == kSelYesNo || type == kSelAnyKey)
|
||||
return 1;
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL) && _console) {
|
||||
_console->attach();
|
||||
_console->onFrame();
|
||||
if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL) && console) {
|
||||
console->attach();
|
||||
console->onFrame();
|
||||
//FIXME: If not cleared, clicking again will start the console
|
||||
event.kbd.keycode = Common::KEYCODE_INVALID;
|
||||
event.kbd.flags = 0;
|
||||
|
@ -66,8 +66,6 @@ protected:
|
||||
}
|
||||
|
||||
PictureMgr *_picture;
|
||||
PreAGI_Console *_console;
|
||||
GUI::Debugger *getDebugger() { return _console; }
|
||||
|
||||
void clearImageStack() {}
|
||||
void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
|
||||
|
@ -2247,10 +2247,11 @@ void MickeyEngine::debugGotoRoom(int room) {
|
||||
}
|
||||
|
||||
MickeyEngine::MickeyEngine(OSystem *syst, const AGIGameDescription *gameDesc) : PreAgiEngine(syst, gameDesc) {
|
||||
_console = new Mickey_Console(this);
|
||||
_console = new MickeyConsole(this);
|
||||
}
|
||||
|
||||
MickeyEngine::~MickeyEngine() {
|
||||
delete _console;
|
||||
}
|
||||
|
||||
void MickeyEngine::init() {
|
||||
|
@ -689,7 +689,11 @@ public:
|
||||
void drawPic(int);
|
||||
void drawObj(ENUM_MSA_OBJECT, int, int);
|
||||
|
||||
GUI::Debugger *getDebugger() { return _console; }
|
||||
|
||||
protected:
|
||||
MickeyConsole *_console;
|
||||
|
||||
MSA_GAME _gameStateMickey;
|
||||
bool _clickToMove;
|
||||
|
||||
|
@ -1306,7 +1306,7 @@ void WinnieEngine::debugCurRoom() {
|
||||
}
|
||||
|
||||
WinnieEngine::WinnieEngine(OSystem *syst, const AGIGameDescription *gameDesc) : PreAgiEngine(syst, gameDesc) {
|
||||
_console = new Winnie_Console(this);
|
||||
_console = new WinnieConsole(this);
|
||||
}
|
||||
|
||||
WinnieEngine::~WinnieEngine() {
|
||||
|
@ -291,7 +291,11 @@ public:
|
||||
|
||||
void debugCurRoom();
|
||||
|
||||
GUI::Debugger *getDebugger() { return _console; }
|
||||
|
||||
private:
|
||||
WinnieConsole *_console;
|
||||
|
||||
WTP_SAVE_GAME _gameStateWinnie;
|
||||
int _room;
|
||||
int _mist;
|
||||
|
Loading…
x
Reference in New Issue
Block a user