mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-01 08:23:15 +00:00
Renamed the SciEvent class to EventManager, to separate it from the sciEvent structure, and removed it from the engine state
svn-id: r49534
This commit is contained in:
parent
10aeb33a42
commit
5cb311ee2c
@ -67,7 +67,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
oldx = mousePos.x;
|
||||
oldy = mousePos.y;
|
||||
curEvent = s->_event->get(mask);
|
||||
curEvent = g_sci->getEventManager()->get(mask);
|
||||
|
||||
if (g_sci->getVocabulary())
|
||||
g_sci->getVocabulary()->parser_event = NULL_REG; // Invalidate parser event
|
||||
|
@ -119,14 +119,12 @@ void EngineState::reset(bool isRestoring) {
|
||||
}
|
||||
|
||||
void EngineState::wait(int16 ticks) {
|
||||
uint32 time;
|
||||
|
||||
time = g_system->getMillis();
|
||||
uint32 time = g_system->getMillis();
|
||||
r_acc = make_reg(0, ((long)time - (long)last_wait_time) * 60 / 1000);
|
||||
last_wait_time = time;
|
||||
|
||||
ticks *= g_debug_sleeptime_factor;
|
||||
_event->sleep(ticks * 1000 / 60);
|
||||
g_sci->getEventManager()->sleep(ticks * 1000 / 60);
|
||||
}
|
||||
|
||||
uint16 EngineState::currentRoomNumber() const {
|
||||
|
@ -48,7 +48,7 @@ namespace Common {
|
||||
|
||||
namespace Sci {
|
||||
|
||||
class SciEvent;
|
||||
class EventManager;
|
||||
class MessageState;
|
||||
class SoundCommandParser;
|
||||
|
||||
@ -112,8 +112,6 @@ public:
|
||||
|
||||
/* Non-VM information */
|
||||
|
||||
SciEvent *_event; // Event handling
|
||||
|
||||
#ifdef USE_OLD_MUSIC_FUNCTIONS
|
||||
SfxState _sound; /**< sound subsystem */
|
||||
int sfx_init_flags; /**< flags the sfx subsystem was initialised with */
|
||||
|
@ -36,12 +36,12 @@ namespace Sci {
|
||||
|
||||
#define SCANCODE_ROWS_NR 3
|
||||
|
||||
SciEvent::SciEvent(ResourceManager *resMan) {
|
||||
EventManager::EventManager(ResourceManager *resMan) {
|
||||
// Check, if font of current game includes extended chars
|
||||
_fontIsExtended = resMan->detectFontExtended();
|
||||
}
|
||||
|
||||
SciEvent::~SciEvent() {
|
||||
EventManager::~EventManager() {
|
||||
}
|
||||
|
||||
struct scancode_row {
|
||||
@ -53,7 +53,7 @@ struct scancode_row {
|
||||
{0x2c, "ZXCVBNM,./"}
|
||||
};
|
||||
|
||||
int SciEvent::altify (int ch) {
|
||||
int EventManager::altify (int ch) {
|
||||
// Calculates a PC keyboard scancode from a character */
|
||||
int row;
|
||||
int c = toupper((char)ch);
|
||||
@ -74,7 +74,7 @@ int SciEvent::altify (int ch) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
int SciEvent::numlockify (int c) {
|
||||
int EventManager::numlockify (int c) {
|
||||
switch (c) {
|
||||
case SCI_KEY_DELETE:
|
||||
return '.';
|
||||
@ -114,7 +114,7 @@ static const byte codepagemap_88591toDOS[0x80] = {
|
||||
'?', 0xa4, 0x95, 0xa2, 0x93, '?', 0x94, '?', '?', 0x97, 0xa3, 0x96, 0x81, '?', '?', 0x98 // 0xFx
|
||||
};
|
||||
|
||||
sciEvent SciEvent::getFromScummVM() {
|
||||
sciEvent EventManager::getFromScummVM() {
|
||||
static int _modifierStates = 0; // FIXME: Avoid non-const global vars
|
||||
sciEvent input = { SCI_EVENT_NONE, 0, 0, 0 };
|
||||
|
||||
@ -315,7 +315,7 @@ sciEvent SciEvent::getFromScummVM() {
|
||||
return input;
|
||||
}
|
||||
|
||||
sciEvent SciEvent::get(unsigned int mask) {
|
||||
sciEvent EventManager::get(unsigned int mask) {
|
||||
//sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 };
|
||||
sciEvent event = { 0, 0, 0, 0 };
|
||||
|
||||
@ -380,7 +380,7 @@ sciEvent SciEvent::get(unsigned int mask) {
|
||||
return event;
|
||||
}
|
||||
|
||||
void SciEvent::sleep(uint32 msecs) {
|
||||
void EventManager::sleep(uint32 msecs) {
|
||||
uint32 time;
|
||||
const uint32 wakeup_time = g_system->getMillis() + msecs;
|
||||
|
||||
|
@ -111,10 +111,10 @@ struct sciEvent {
|
||||
#define SCI_KEYMOD_NO_FOOLOCK (~(SCI_KEYMOD_SCRLOCK | SCI_KEYMOD_NUMLOCK | SCI_KEYMOD_CAPSLOCK | SCI_KEYMOD_INSERT))
|
||||
#define SCI_KEYMOD_ALL 0xFF
|
||||
|
||||
class SciEvent {
|
||||
class EventManager {
|
||||
public:
|
||||
SciEvent(ResourceManager *resMgr);
|
||||
~SciEvent();
|
||||
EventManager(ResourceManager *resMgr);
|
||||
~EventManager();
|
||||
|
||||
sciEvent get(unsigned int mask);
|
||||
|
||||
|
@ -54,7 +54,7 @@ GfxCursor::~GfxCursor() {
|
||||
purgeCache();
|
||||
}
|
||||
|
||||
void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, SciEvent *event) {
|
||||
void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, EventManager *event) {
|
||||
_coordAdjuster = coordAdjuster;
|
||||
_event = event;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen);
|
||||
~GfxCursor();
|
||||
|
||||
void init(GfxCoordAdjuster *coordAdjuster, SciEvent *event);
|
||||
void init(GfxCoordAdjuster *coordAdjuster, EventManager *event);
|
||||
|
||||
void kernelShow();
|
||||
void kernelHide();
|
||||
@ -74,7 +74,7 @@ private:
|
||||
GfxScreen *_screen;
|
||||
GfxPalette *_palette;
|
||||
GfxCoordAdjuster *_coordAdjuster;
|
||||
SciEvent *_event;
|
||||
EventManager *_event;
|
||||
|
||||
int _upscaledHires;
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
namespace Sci {
|
||||
|
||||
SciGui32::SciGui32(SegManager *segMan, SciEvent *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor)
|
||||
SciGui32::SciGui32(SegManager *segMan, EventManager *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor)
|
||||
: _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) {
|
||||
|
||||
_coordAdjuster = new GfxCoordAdjuster32(segMan);
|
||||
|
@ -41,7 +41,7 @@ class GfxPaint32;
|
||||
|
||||
class SciGui32 {
|
||||
public:
|
||||
SciGui32(SegManager *segMan, SciEvent *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor);
|
||||
SciGui32(SegManager *segMan, EventManager *event, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor);
|
||||
~SciGui32();
|
||||
|
||||
void init();
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
namespace Sci {
|
||||
|
||||
GfxMenu::GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor)
|
||||
GfxMenu::GfxMenu(EventManager *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor)
|
||||
: _event(event), _segMan(segMan), _gui(gui), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen), _cursor(cursor) {
|
||||
|
||||
_menuSaveHandle = NULL_REG;
|
||||
|
@ -83,7 +83,7 @@ typedef Common::List<GuiMenuItemEntry *> GuiMenuItemList;
|
||||
*/
|
||||
class GfxMenu {
|
||||
public:
|
||||
GfxMenu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor);
|
||||
GfxMenu(EventManager *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen, GfxCursor *cursor);
|
||||
~GfxMenu();
|
||||
|
||||
void reset();
|
||||
@ -111,7 +111,7 @@ private:
|
||||
uint16 mouseFindMenuItemSelection(Common::Point mousePosition, uint16 menuId);
|
||||
GuiMenuItemEntry *interactiveGetItem(uint16 menuId, uint16 itemId, bool menuChanged);
|
||||
|
||||
SciEvent *_event;
|
||||
EventManager *_event;
|
||||
SegManager *_segMan;
|
||||
SciGui *_gui;
|
||||
GfxPorts *_ports;
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
namespace Sci {
|
||||
|
||||
Portrait::Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName)
|
||||
Portrait::Portrait(ResourceManager *resMan, EventManager *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName)
|
||||
: _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) {
|
||||
init();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ struct PortraitBitmap {
|
||||
*/
|
||||
class Portrait {
|
||||
public:
|
||||
Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName);
|
||||
Portrait(ResourceManager *resMan, EventManager *event, SciGui *gui, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName);
|
||||
~Portrait();
|
||||
|
||||
void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
|
||||
@ -56,7 +56,7 @@ private:
|
||||
void bitsShow();
|
||||
|
||||
ResourceManager *_resMan;
|
||||
SciEvent *_event;
|
||||
EventManager *_event;
|
||||
SciGui *_gui;
|
||||
GfxPalette *_palette;
|
||||
GfxScreen *_screen;
|
||||
|
@ -190,7 +190,7 @@ Common::Error SciEngine::run() {
|
||||
|
||||
_gamestate = new EngineState(segMan);
|
||||
|
||||
_gamestate->_event = new SciEvent(_resMan);
|
||||
_eventMan = new EventManager(_resMan);
|
||||
|
||||
if (script_init_engine(_gamestate))
|
||||
return Common::kUnknownError;
|
||||
@ -203,7 +203,7 @@ Common::Error SciEngine::run() {
|
||||
_gfxPaint16 = 0;
|
||||
_gfxPorts = 0;
|
||||
_gui = 0;
|
||||
_gui32 = new SciGui32(_gamestate->_segMan, _gamestate->_event, screen, palette, cache, cursor);
|
||||
_gui32 = new SciGui32(_gamestate->_segMan, _eventMan, screen, palette, cache, cursor);
|
||||
} else {
|
||||
#endif
|
||||
_gfxPorts = new GfxPorts(segMan, screen);
|
||||
@ -280,7 +280,7 @@ Common::Error SciEngine::run() {
|
||||
delete _gfxPalette;
|
||||
delete cursor;
|
||||
delete _gfxScreen;
|
||||
delete _gamestate->_event;
|
||||
delete _eventMan;
|
||||
delete segMan;
|
||||
delete _gamestate;
|
||||
|
||||
|
@ -51,6 +51,7 @@ class Kernel;
|
||||
class GameFeatures;
|
||||
class Console;
|
||||
class AudioPlayer;
|
||||
class EventManager;
|
||||
|
||||
class GfxAnimate;
|
||||
class GfxCache;
|
||||
@ -164,6 +165,7 @@ public:
|
||||
inline Kernel *getKernel() const { return _kernel; }
|
||||
inline EngineState *getEngineState() const { return _gamestate; }
|
||||
inline Vocabulary *getVocabulary() const { return _vocabulary; }
|
||||
inline EventManager *getEventManager() const { return _eventMan; }
|
||||
|
||||
Common::String getSavegameName(int nr) const;
|
||||
Common::String getSavegamePattern() const;
|
||||
@ -222,6 +224,7 @@ private:
|
||||
EngineState *_gamestate;
|
||||
Kernel *_kernel;
|
||||
Vocabulary *_vocabulary;
|
||||
EventManager *_eventMan;
|
||||
Console *_console;
|
||||
OSystem *_system;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user