Removed the reference to SciGuiCursor from EngineState
svn-id: r45660
This commit is contained in:
parent
effdfcd4b8
commit
12e3375f3b
10 changed files with 24 additions and 35 deletions
|
@ -43,7 +43,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
|
|||
int oldx, oldy;
|
||||
int modifier_mask = getSciVersion() <= SCI_VERSION_01 ? SCI_EVM_ALL : SCI_EVM_NO_FOOLOCK;
|
||||
SegManager *segMan = s->_segMan;
|
||||
const Common::Point mousePos = s->_cursor->getPosition();
|
||||
const Common::Point mousePos = s->_gui->getCursorPos();
|
||||
|
||||
// If there's a simkey pending, and the game wants a keyboard event, use the
|
||||
// simkey instead of a normal event
|
||||
|
|
|
@ -128,7 +128,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
|
|||
|
||||
if ((right >= left) && (bottom >= top)) {
|
||||
Common::Rect rect = Common::Rect(left, top, right, bottom);
|
||||
s->_cursor->setMoveZone(rect);
|
||||
s->_gui->setCursorZone(rect);
|
||||
} else {
|
||||
warning("kSetCursor: Ignoring invalid mouse zone (%i, %i)-(%i, %i)", left, top, right, bottom);
|
||||
}
|
||||
|
|
|
@ -737,7 +737,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
|||
}
|
||||
|
||||
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
|
||||
retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_gui, s->_cursor, s->_audio);
|
||||
retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_gui, s->_audio);
|
||||
|
||||
// Copy some old data
|
||||
retval->gfx_state = s->gfx_state;
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
namespace Sci {
|
||||
|
||||
EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, SciGuiCursor *cursor, AudioPlayer *audio)
|
||||
: resMan(res), _kernel(kernel), _voc(voc), _gui(gui), _cursor(cursor), _audio(audio), _dirseeker(this) {
|
||||
EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, AudioPlayer *audio)
|
||||
: resMan(res), _kernel(kernel), _voc(voc), _gui(gui), _audio(audio), _dirseeker(this) {
|
||||
|
||||
gfx_state = 0;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
struct EngineState : public Common::Serializable {
|
||||
public:
|
||||
EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, SciGuiCursor *cursor, AudioPlayer *audio);
|
||||
EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SciGui *gui, AudioPlayer *audio);
|
||||
virtual ~EngineState();
|
||||
|
||||
virtual void saveLoadWithSerializer(Common::Serializer &ser);
|
||||
|
@ -132,7 +132,6 @@ public:
|
|||
/* Non-VM information */
|
||||
|
||||
SciGui *_gui; /* Currently active Gui */
|
||||
SciGuiCursor *_cursor; /* Cursor functions */
|
||||
|
||||
GfxState *gfx_state; /**< Graphics state and driver */
|
||||
|
||||
|
|
|
@ -737,6 +737,10 @@ void SciGui::setCursorPos(Common::Point pos) {
|
|||
moveCursor(pos);
|
||||
}
|
||||
|
||||
Common::Point SciGui::getCursorPos() {
|
||||
return _cursor->getPosition();
|
||||
}
|
||||
|
||||
void SciGui::moveCursor(Common::Point pos) {
|
||||
pos.y += _windowMgr->_picWind->rect.top;
|
||||
pos.x += _windowMgr->_picWind->rect.left;
|
||||
|
@ -756,6 +760,10 @@ void SciGui::moveCursor(Common::Point pos) {
|
|||
// FIXME!
|
||||
}
|
||||
|
||||
void SciGui::setCursorZone(Common::Rect zone) {
|
||||
_cursor->setMoveZone(zone);
|
||||
}
|
||||
|
||||
int16 SciGui::getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) {
|
||||
return _gfx->getView(viewId)->getCelInfo(loopNo, celNo)->width;
|
||||
}
|
||||
|
|
|
@ -126,12 +126,14 @@ public:
|
|||
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
|
||||
virtual void baseSetter(reg_t object);
|
||||
|
||||
virtual void hideCursor();
|
||||
virtual void showCursor();
|
||||
virtual void setCursorShape(GuiResourceId cursorId);
|
||||
virtual void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
void setCursorShape(GuiResourceId cursorId);
|
||||
void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
|
||||
virtual void setCursorPos(Common::Point pos);
|
||||
Common::Point getCursorPos();
|
||||
virtual void moveCursor(Common::Point pos);
|
||||
void setCursorZone(Common::Rect zone);
|
||||
|
||||
virtual int16 getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo);
|
||||
virtual int16 getCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo);
|
||||
|
|
|
@ -934,7 +934,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
|
|||
}
|
||||
}
|
||||
|
||||
Common::Point cursorPos = _s->_cursor->getPosition();
|
||||
Common::Point cursorPos = _cursor->getPosition();
|
||||
|
||||
if ((type == SCI_EVT_MOUSE_PRESS) && (cursorPos.y < 10)) {
|
||||
menu_mode = 1;
|
||||
|
@ -1027,7 +1027,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
|
|||
|
||||
case SCI_EVT_MOUSE_RELEASE:
|
||||
{
|
||||
Common::Point curMousePos = _s->_cursor->getPosition();
|
||||
Common::Point curMousePos = _cursor->getPosition();
|
||||
menu_mode = (curMousePos.y < 10);
|
||||
claimed = !menu_mode && !_s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, portBounds);
|
||||
mouse_down = 0;
|
||||
|
@ -1044,7 +1044,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
|
|||
}
|
||||
|
||||
if (mouse_down)
|
||||
_s->_menubar->mapPointer(_s->_cursor->getPosition(), menu_nr, item_nr, portBounds);
|
||||
_s->_menubar->mapPointer(_cursor->getPosition(), menu_nr, item_nr, portBounds);
|
||||
|
||||
if ((item_nr > -1 && old_item == -1) || (menu_nr != old_menu)) { /* Update menu */
|
||||
|
||||
|
@ -2962,22 +2962,6 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
void SciGui32::hideCursor() {
|
||||
_cursor->hide();
|
||||
}
|
||||
|
||||
void SciGui32::showCursor() {
|
||||
_cursor->show();
|
||||
}
|
||||
|
||||
void SciGui32::setCursorShape(GuiResourceId cursorId) {
|
||||
_cursor->setShape(cursorId);
|
||||
}
|
||||
|
||||
void SciGui32::setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot) {
|
||||
_cursor->setView(viewNum, loopNum, cellNum, hotspot);
|
||||
}
|
||||
|
||||
void SciGui32::setCursorPos(Common::Point pos) {
|
||||
pos.y += _s->port->_bounds.y;
|
||||
pos.x += _s->port->_bounds.x;
|
||||
|
|
|
@ -102,10 +102,6 @@ public:
|
|||
void setNowSeen(reg_t objectReference);
|
||||
bool canBeHere(reg_t curObject, reg_t listReference);
|
||||
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
void setCursorShape(GuiResourceId cursorId);
|
||||
void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
|
||||
void setCursorPos(Common::Point pos);
|
||||
void moveCursor(Common::Point pos);
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ Common::Error SciEngine::run() {
|
|||
_audio = new AudioPlayer(_resMan);
|
||||
|
||||
// We'll set the GUI below
|
||||
_gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, cursor, _audio);
|
||||
_gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, _audio);
|
||||
|
||||
if (script_init_engine(_gamestate))
|
||||
return Common::kUnknownError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue