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