SCI: calling most of the cursor functions directly via _gfxCursor instead of SciGui/32
svn-id: r47903
This commit is contained in:
parent
6c204cc890
commit
f8f490c565
13 changed files with 31 additions and 124 deletions
|
@ -219,7 +219,7 @@ void Console::postEnter() {
|
|||
_engine->_gamestate->_soundCmd->pauseAll(false);
|
||||
|
||||
if (!_videoFile.empty()) {
|
||||
_engine->_gamestate->_gui->hideCursor();
|
||||
_engine->_gamestate->_gfxCursor->kernelHide();
|
||||
|
||||
if (_videoFile.hasSuffix(".seq")) {
|
||||
SeqDecoder *seqDecoder = new SeqDecoder();
|
||||
|
@ -255,7 +255,7 @@ void Console::postEnter() {
|
|||
#endif
|
||||
}
|
||||
|
||||
_engine->_gamestate->_gui->showCursor();
|
||||
_engine->_gamestate->_gfxCursor->kernelShow();
|
||||
|
||||
_videoFile.clear();
|
||||
_videoFrameDelay = 0;
|
||||
|
|
|
@ -47,12 +47,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
|
|||
SegManager *segMan = s->_segMan;
|
||||
Common::Point mousePos;
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
if (s->_gui32)
|
||||
mousePos = s->_gui32->getCursorPos();
|
||||
else
|
||||
#endif
|
||||
mousePos = s->_gui->getCursorPos();
|
||||
mousePos = s->_gfxCursor->getPosition();
|
||||
|
||||
// If there's a simkey pending, and the game wants a keyboard event, use the
|
||||
// simkey instead of a normal event
|
||||
|
|
|
@ -107,7 +107,7 @@ static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) {
|
|||
cursorId = -1;
|
||||
}
|
||||
|
||||
s->_gui->setCursorShape(cursorId);
|
||||
s->_gfxCursor->kernelSetShape(cursorId);
|
||||
return s->r_acc;
|
||||
}
|
||||
|
||||
|
@ -119,12 +119,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
|
|||
case 1:
|
||||
switch (argv[0].toSint16()) {
|
||||
case 0:
|
||||
#ifdef ENABLE_SCI32
|
||||
if (s->_gui32)
|
||||
s->_gui32->hideCursor();
|
||||
else
|
||||
#endif
|
||||
s->_gui->hideCursor();
|
||||
s->_gfxCursor->kernelHide();
|
||||
break;
|
||||
case -1:
|
||||
// TODO: Special case at least in kq6, check disassembly
|
||||
|
@ -133,12 +128,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
|
|||
// TODO: Special case at least in kq6, check disassembly
|
||||
break;
|
||||
default:
|
||||
#ifdef ENABLE_SCI32
|
||||
if (s->_gui32)
|
||||
s->_gui32->showCursor();
|
||||
else
|
||||
#endif
|
||||
s->_gui->showCursor();
|
||||
s->_gfxCursor->kernelShow();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
|
@ -176,12 +166,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
|
|||
hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16());
|
||||
// Fallthrough
|
||||
case 3:
|
||||
#ifdef ENABLE_SCI32
|
||||
if (s->_gui32)
|
||||
s->_gui32->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
|
||||
else
|
||||
#endif
|
||||
s->_gui->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
|
||||
s->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
|
||||
break;
|
||||
default :
|
||||
warning("kSetCursor: Unhandled case: %d arguments given", argc);
|
||||
|
@ -1139,19 +1124,9 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
|
|||
// previously visible.
|
||||
bool reshowCursor;
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
if (s->_gui32) {
|
||||
reshowCursor = s->_gui32->isCursorVisible();
|
||||
if (reshowCursor)
|
||||
s->_gui32->hideCursor();
|
||||
} else {
|
||||
#endif
|
||||
reshowCursor = s->_gui->isCursorVisible();
|
||||
if (reshowCursor)
|
||||
s->_gui->hideCursor();
|
||||
#ifdef ENABLE_SCI32
|
||||
}
|
||||
#endif
|
||||
reshowCursor = s->_gfxCursor->isVisible();
|
||||
if (reshowCursor)
|
||||
s->_gfxCursor->kernelHide();
|
||||
|
||||
// The Windows and DOS versions use different video format as well
|
||||
// as a different argument set.
|
||||
|
@ -1218,14 +1193,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
|
|||
s->_gfxScreen->kernelSyncWithFramebuffer();
|
||||
}
|
||||
|
||||
if (reshowCursor) {
|
||||
#ifdef ENABLE_SCI32
|
||||
if (s->_gui32)
|
||||
s->_gui32->showCursor();
|
||||
else
|
||||
#endif
|
||||
s->_gui->showCursor();
|
||||
}
|
||||
if (reshowCursor)
|
||||
s->_gfxCursor->kernelShow();
|
||||
|
||||
return s->r_acc;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ class SciEvent;
|
|||
class GfxAnimate;
|
||||
class GfxCache;
|
||||
class GfxControls;
|
||||
class GfxCursor;
|
||||
class GfxMenu;
|
||||
class GfxPaint;
|
||||
class GfxPaint16;
|
||||
|
@ -153,6 +154,7 @@ public:
|
|||
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
|
||||
GfxCache *_gfxCache;
|
||||
GfxControls *_gfxControls; // Controls for 16-bit gfx
|
||||
GfxCursor *_gfxCursor;
|
||||
GfxMenu *_gfxMenu; // Menu for 16-bit gfx
|
||||
GfxPalette *_gfxPalette;
|
||||
GfxPaint *_gfxPaint;
|
||||
|
|
|
@ -591,12 +591,12 @@ void GfxAnimate::animateShowPic() {
|
|||
bool previousCursorState = _cursor->isVisible();
|
||||
|
||||
if (previousCursorState)
|
||||
_cursor->hide();
|
||||
_cursor->kernelHide();
|
||||
// Adjust picRect to become relative to screen
|
||||
picRect.translate(picPort->left, picPort->top);
|
||||
_transitions->doit(picRect);
|
||||
if (previousCursorState)
|
||||
_cursor->show();
|
||||
_cursor->kernelShow();
|
||||
|
||||
// We set SCI1.1 priority band information here
|
||||
_ports->priorityBandsRecall();
|
||||
|
|
|
@ -51,12 +51,12 @@ GfxCursor::~GfxCursor() {
|
|||
purgeCache();
|
||||
}
|
||||
|
||||
void GfxCursor::show() {
|
||||
void GfxCursor::kernelShow() {
|
||||
CursorMan.showMouse(true);
|
||||
_isVisible = true;
|
||||
}
|
||||
|
||||
void GfxCursor::hide() {
|
||||
void GfxCursor::kernelHide() {
|
||||
CursorMan.showMouse(false);
|
||||
_isVisible = false;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void GfxCursor::purgeCache() {
|
|||
_cachedCursors.clear();
|
||||
}
|
||||
|
||||
void GfxCursor::setShape(GuiResourceId resourceId) {
|
||||
void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
|
||||
Resource *resource;
|
||||
byte *resourceData;
|
||||
Common::Point hotspot = Common::Point(0, 0);
|
||||
|
@ -87,7 +87,7 @@ void GfxCursor::setShape(GuiResourceId resourceId) {
|
|||
|
||||
if (resourceId == -1) {
|
||||
// no resourceId given, so we actually hide the cursor
|
||||
hide();
|
||||
kernelHide();
|
||||
delete[] rawBitmap;
|
||||
return;
|
||||
}
|
||||
|
@ -128,12 +128,12 @@ void GfxCursor::setShape(GuiResourceId resourceId) {
|
|||
}
|
||||
|
||||
CursorMan.replaceCursor(rawBitmap, SCI_CURSOR_SCI0_HEIGHTWIDTH, SCI_CURSOR_SCI0_HEIGHTWIDTH, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR);
|
||||
show();
|
||||
kernelShow();
|
||||
|
||||
delete[] rawBitmap;
|
||||
}
|
||||
|
||||
void GfxCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) {
|
||||
void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) {
|
||||
if (_cachedCursors.size() >= MAX_CACHED_CURSORS)
|
||||
purgeCache();
|
||||
|
||||
|
@ -153,7 +153,7 @@ void GfxCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::
|
|||
|
||||
// Eco Quest 1 uses a 1x1 transparent cursor to hide the cursor from the user. Some scalers don't seem to support this
|
||||
if (width < 2 || height < 2) {
|
||||
hide();
|
||||
kernelHide();
|
||||
delete cursorHotspot;
|
||||
return;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void GfxCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::
|
|||
if (_upscaledHires)
|
||||
delete[] cursorBitmap;
|
||||
|
||||
show();
|
||||
kernelShow();
|
||||
|
||||
delete cursorHotspot;
|
||||
}
|
||||
|
|
|
@ -45,11 +45,11 @@ public:
|
|||
GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen);
|
||||
~GfxCursor();
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
void kernelShow();
|
||||
void kernelHide();
|
||||
bool isVisible();
|
||||
void setShape(GuiResourceId resourceId);
|
||||
void setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
|
||||
void kernelSetShape(GuiResourceId resourceId);
|
||||
void kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
|
||||
void setPosition(Common::Point pos);
|
||||
Common::Point getPosition();
|
||||
void refreshPosition();
|
||||
|
|
|
@ -391,36 +391,12 @@ void SciGui::baseSetter(reg_t object) {
|
|||
}
|
||||
}
|
||||
|
||||
void SciGui::hideCursor() {
|
||||
_cursor->hide();
|
||||
}
|
||||
|
||||
void SciGui::showCursor() {
|
||||
_cursor->show();
|
||||
}
|
||||
|
||||
bool SciGui::isCursorVisible() {
|
||||
return _cursor->isVisible();
|
||||
}
|
||||
|
||||
void SciGui::setCursorShape(GuiResourceId cursorId) {
|
||||
_cursor->setShape(cursorId);
|
||||
}
|
||||
|
||||
void SciGui::setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot) {
|
||||
_cursor->setView(viewNum, loopNum, cellNum, hotspot);
|
||||
}
|
||||
|
||||
void SciGui::setCursorPos(Common::Point pos) {
|
||||
pos.y += _ports->getPort()->top;
|
||||
pos.x += _ports->getPort()->left;
|
||||
moveCursor(pos);
|
||||
}
|
||||
|
||||
Common::Point SciGui::getCursorPos() {
|
||||
return _cursor->getPosition();
|
||||
}
|
||||
|
||||
void SciGui::moveCursor(Common::Point pos) {
|
||||
pos.y += _ports->_picWind->rect.top;
|
||||
pos.x += _ports->_picWind->rect.left;
|
||||
|
|
|
@ -87,13 +87,7 @@ public:
|
|||
virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
|
||||
virtual void baseSetter(reg_t object);
|
||||
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
bool isCursorVisible();
|
||||
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);
|
||||
|
||||
|
|
|
@ -176,36 +176,12 @@ void SciGui32::baseSetter(reg_t object) {
|
|||
}
|
||||
}
|
||||
|
||||
void SciGui32::hideCursor() {
|
||||
_cursor->hide();
|
||||
}
|
||||
|
||||
void SciGui32::showCursor() {
|
||||
_cursor->show();
|
||||
}
|
||||
|
||||
bool SciGui32::isCursorVisible() {
|
||||
return _cursor->isVisible();
|
||||
}
|
||||
|
||||
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 += _gfx->GetPort()->top;
|
||||
//pos.x += _gfx->GetPort()->left;
|
||||
moveCursor(pos);
|
||||
}
|
||||
|
||||
Common::Point SciGui32::getCursorPos() {
|
||||
return _cursor->getPosition();
|
||||
}
|
||||
|
||||
void SciGui32::moveCursor(Common::Point pos) {
|
||||
// pos.y += _windowMgr->_picWind->rect.top;
|
||||
// pos.x += _windowMgr->_picWind->rect.left;
|
||||
|
|
|
@ -55,13 +55,7 @@ public:
|
|||
bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
|
||||
void baseSetter(reg_t object);
|
||||
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
bool isCursorVisible();
|
||||
void setCursorShape(GuiResourceId cursorId);
|
||||
void setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Common::Point *hotspot);
|
||||
void setCursorPos(Common::Point pos);
|
||||
Common::Point getCursorPos();
|
||||
void moveCursor(Common::Point pos);
|
||||
void setCursorZone(Common::Rect zone);
|
||||
|
||||
|
|
|
@ -591,12 +591,12 @@ void GfxMenu::invertMenuSelection(uint16 itemId) {
|
|||
|
||||
void GfxMenu::interactiveShowMouse() {
|
||||
_mouseOldState = _cursor->isVisible();
|
||||
_cursor->show();
|
||||
_cursor->kernelShow();
|
||||
}
|
||||
|
||||
void GfxMenu::interactiveRestoreMouse() {
|
||||
if (!_mouseOldState)
|
||||
_cursor->hide();
|
||||
_cursor->kernelHide();
|
||||
}
|
||||
|
||||
uint16 GfxMenu::mouseFindMenuSelection(Common::Point mousePosition) {
|
||||
|
|
|
@ -196,6 +196,7 @@ Common::Error SciEngine::run() {
|
|||
_gamestate->_gfxPalette = palette;
|
||||
_gamestate->_gfxScreen = screen;
|
||||
_gamestate->_gfxCache = cache;
|
||||
_gamestate->_gfxCursor = cursor;
|
||||
|
||||
if (game_init(_gamestate)) { /* Initialize */
|
||||
warning("Game initialization failed: Aborting...");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue