mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
VOYEUR: Added in debugger and adding event manager methods
This commit is contained in:
parent
e9e596e741
commit
f70fd94732
34
engines/voyeur/debugger.cpp
Normal file
34
engines/voyeur/debugger.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/* 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 "voyeur/debugger.h"
|
||||
|
||||
#include "voyeur/graphics.h"
|
||||
#include "voyeur/voyeur.h"
|
||||
|
||||
namespace Voyeur {
|
||||
|
||||
Debugger::Debugger() : GUI::Debugger() {
|
||||
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
|
||||
}
|
||||
|
||||
} // End of namespace Voyeur
|
45
engines/voyeur/debugger.h
Normal file
45
engines/voyeur/debugger.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 VOYEUR_DEBUGGER_H
|
||||
#define VOYEUR_DEBUGGER_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "gui/debugger.h"
|
||||
|
||||
namespace Voyeur {
|
||||
|
||||
class VoyeurEngine;
|
||||
|
||||
class Debugger : public GUI::Debugger {
|
||||
private:
|
||||
VoyeurEngine *_vm;
|
||||
|
||||
public:
|
||||
Debugger();
|
||||
virtual ~Debugger() {}
|
||||
void setVm(VoyeurEngine *vm) { _vm = vm; }
|
||||
};
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
||||
#endif
|
@ -27,6 +27,9 @@ namespace Voyeur {
|
||||
|
||||
EventsManager::EventsManager() {
|
||||
_cycleStatus = 0;
|
||||
_mouseButton = 0;
|
||||
_priorFrameTime = g_system->getMillis();
|
||||
Common::fill(&_keyState[0], &_keyState[256], false);
|
||||
}
|
||||
|
||||
void EventsManager::resetMouse() {
|
||||
@ -71,4 +74,57 @@ void EventsManager::sWaitFlip() {
|
||||
}
|
||||
}
|
||||
|
||||
void EventsManager::checkForNextFrameCounter() {
|
||||
// Check for next game frame
|
||||
uint32 milli = g_system->getMillis();
|
||||
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
|
||||
++_gameCounter;
|
||||
_priorFrameTime = milli;
|
||||
|
||||
// Signal the ScummVM debugger
|
||||
_vm->_debugger.onFrame();
|
||||
}
|
||||
}
|
||||
|
||||
void EventsManager::delay(int totalMilli) {
|
||||
uint32 delayEnd = g_system->getMillis() + totalMilli;
|
||||
|
||||
while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) {
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
}
|
||||
|
||||
void EventsManager::pollEvents() {
|
||||
checkForNextFrameCounter();
|
||||
|
||||
Common::Event event;
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
// Handle keypress
|
||||
switch (event.type) {
|
||||
case Common::EVENT_QUIT:
|
||||
case Common::EVENT_RTL:
|
||||
return;
|
||||
|
||||
case Common::EVENT_KEYDOWN:
|
||||
_keyState[(byte)toupper(event.kbd.ascii)] = true;
|
||||
return;
|
||||
case Common::EVENT_KEYUP:
|
||||
_keyState[(byte)toupper(event.kbd.ascii)] = false;
|
||||
return;
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
_mouseButton = 1;
|
||||
return;
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
_mouseButton = 2;
|
||||
return;
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
_mouseButton = 0;
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
@ -30,11 +30,21 @@ namespace Voyeur {
|
||||
|
||||
class VoyeurEngine;
|
||||
|
||||
#define GAME_FRAME_RATE 50
|
||||
#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
|
||||
|
||||
class EventsManager {
|
||||
private:
|
||||
VoyeurEngine *_vm;
|
||||
uint32 _priorFrameTime;
|
||||
uint32 _gameCounter;
|
||||
bool _keyState[256];
|
||||
int _mouseButton;
|
||||
|
||||
static void mainVoyeurIntFunc();
|
||||
private:
|
||||
void checkForNextFrameCounter();
|
||||
|
||||
public:
|
||||
IntData _intPtr;
|
||||
IntNode _fadeIntNode;
|
||||
@ -50,6 +60,9 @@ public:
|
||||
void startMainClockInt();
|
||||
void vStopCycle();
|
||||
void sWaitFlip();
|
||||
|
||||
void delay(int totalMilli);
|
||||
void pollEvents();
|
||||
};
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
@ -1,6 +1,7 @@
|
||||
MODULE := engines/voyeur
|
||||
|
||||
MODULE_OBJS := \
|
||||
debugger.o \
|
||||
detection.o \
|
||||
events.o \
|
||||
game.o \
|
||||
|
@ -93,6 +93,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
|
||||
}
|
||||
|
||||
void VoyeurEngine::initialiseManagers() {
|
||||
_debugger.setVm(this);
|
||||
_eventsManager.setVm(this);
|
||||
_filesManager.setVm(this);
|
||||
_graphicsManager.setVm(this);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#ifndef VOYEUR_VOYEUR_H
|
||||
#define VOYEUR_VOYEUR_H
|
||||
|
||||
#include "voyeur/debugger.h"
|
||||
#include "voyeur/events.h"
|
||||
#include "voyeur/files.h"
|
||||
#include "voyeur/game.h"
|
||||
@ -79,6 +80,7 @@ protected:
|
||||
virtual Common::Error run();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
public:
|
||||
Debugger _debugger;
|
||||
EventsManager _eventsManager;
|
||||
FilesManager _filesManager;
|
||||
GraphicsManager _graphicsManager;
|
||||
|
Loading…
x
Reference in New Issue
Block a user