diff options
author | Martin Kiewitz | 2010-01-29 21:30:46 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-29 21:30:46 +0000 |
commit | a800855bf4799de2025f6f1220dc363e66aab475 (patch) | |
tree | d97ab9702e0cf7c4a2cd3e0fc25b42de0e96e41b /engines/sci/engine | |
parent | 85517515a76069d77fde6ecfb933f2e133b52a01 (diff) | |
download | scummvm-rg350-a800855bf4799de2025f6f1220dc363e66aab475.tar.gz scummvm-rg350-a800855bf4799de2025f6f1220dc363e66aab475.tar.bz2 scummvm-rg350-a800855bf4799de2025f6f1220dc363e66aab475.zip |
SCI: added new SciGui32 class, Gfx class needs some work though and hopefully i didnt overlook some kernel function that is also used by sci32. now using plane left/top
svn-id: r47679
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/game.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 13 | ||||
-rw-r--r-- | engines/sci/engine/kevent.cpp | 26 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 121 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 2 |
5 files changed, 128 insertions, 37 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index b5e575e21d..a13e4a6691 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -270,7 +270,8 @@ int game_init(EngineState *s) { } // Initialize menu TODO: Actually this should be another init() - s->_gui->menuReset(); + if (s->_gui) + s->_gui->menuReset(); s->successor = NULL; // No successor diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index b4a403bedb..40298dc594 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -30,6 +30,7 @@ #include "sci/engine/state.h" #include "sci/engine/selector.h" #include "sci/graphics/gui.h" +#include "sci/graphics/gui32.h" namespace Sci { @@ -649,7 +650,7 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv) { reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) { reg_t viewObj = argv[0]; - s->_gui->addScreenItem(viewObj); + s->_gui32->addScreenItem(viewObj); return NULL_REG; } @@ -663,7 +664,7 @@ reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv) { reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) { reg_t viewObj = argv[0]; - s->_gui->deleteScreenItem(viewObj); + s->_gui32->deleteScreenItem(viewObj); /* reg_t viewObj = argv[0]; @@ -685,7 +686,7 @@ reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) { reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) { reg_t planeObj = argv[0]; - s->_gui->addPlane(planeObj); + s->_gui32->addPlane(planeObj); warning("kAddPlane object %04x:%04x", PRINT_REG(planeObj)); return NULL_REG; } @@ -693,7 +694,7 @@ reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) { reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv) { reg_t planeObj = argv[0]; - s->_gui->deletePlane(planeObj); + s->_gui32->deletePlane(planeObj); warning("kDeletePlane object %04x:%04x", PRINT_REG(planeObj)); return NULL_REG; } @@ -701,7 +702,7 @@ reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv) { reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv) { reg_t planeObj = argv[0]; - s->_gui->updatePlane(planeObj); + s->_gui32->updatePlane(planeObj); return s->r_acc; } @@ -719,7 +720,7 @@ reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) { // as its called right after a view is updated // TODO - s->_gui->frameOut(); + s->_gui32->frameOut(); return NULL_REG; } diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 47a469dd14..9ecd35ebde 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -31,6 +31,7 @@ #include "sci/debug.h" // for g_debug_simulated_key #include "sci/event.h" #include "sci/graphics/gui.h" +#include "sci/graphics/gui32.h" #include "sci/graphics/cursor.h" namespace Sci { @@ -44,7 +45,12 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { int oldx, oldy; int modifier_mask = getSciVersion() <= SCI_VERSION_01 ? SCI_KEYMOD_ALL : SCI_KEYMOD_NO_FOOLOCK; SegManager *segMan = s->_segMan; - const Common::Point mousePos = s->_gui->getCursorPos(); + Common::Point mousePos; + + if (s->_gui) + mousePos = s->_gui->getCursorPos(); + else + mousePos = s->_gui32->getCursorPos(); // If there's a simkey pending, and the game wants a keyboard event, use the // simkey instead of a normal event @@ -215,11 +221,13 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) { int16 y = GET_SEL32V(segMan, obj, y); #ifdef ENABLE_SCI32 - if (argc > 1) - s->_gui->globalToLocal(&x, &y, argv[1]); - else + if (s->_gui) +#endif + s->_gui->globalToLocal(&x, &y); +#ifdef ENABLE_SCI32 + else + s->_gui32->globalToLocal(&x, &y, argv[1]); #endif - s->_gui->globalToLocal(&x, &y); PUT_SEL32V(segMan, obj, x, x); PUT_SEL32V(segMan, obj, y, y); @@ -238,11 +246,13 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) { int16 y = GET_SEL32V(segMan, obj, y); #ifdef ENABLE_SCI32 - if (argc > 1) - s->_gui->localToGlobal(&x, &y, argv[1]); - else + if (s->_gui) #endif s->_gui->localToGlobal(&x, &y); +#ifdef ENABLE_SCI32 + else + s->_gui32->localToGlobal(&x, &y, argv[1]); +#endif PUT_SEL32V(segMan, obj, x, x); PUT_SEL32V(segMan, obj, y, y); diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 764410e2b0..11f03348c7 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -35,6 +35,7 @@ #include "sci/engine/selector.h" #include "sci/engine/kernel.h" #include "sci/graphics/gui.h" +#include "sci/graphics/gui32.h" #include "sci/graphics/animate.h" #include "sci/graphics/cursor.h" #include "sci/graphics/screen.h" @@ -77,7 +78,10 @@ void _k_dirloop(reg_t object, uint16 angle, EngineState *s, int argc, reg_t *arg else loopNo = -1; } - maxLoops = s->_gui->getLoopCount(viewId); + if (s->_gui) + maxLoops = s->_gui->getLoopCount(viewId); + else + maxLoops = s->_gui32->getLoopCount(viewId); if ((loopNo > 1) && (maxLoops < 4)) return; @@ -112,7 +116,10 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { case 1: switch (argv[0].toSint16()) { case 0: - s->_gui->hideCursor(); + if (s->_gui) + s->_gui->hideCursor(); + else + s->_gui32->hideCursor(); break; case -1: // TODO: Special case at least in kq6, check disassembly @@ -121,13 +128,19 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { // TODO: Special case at least in kq6, check disassembly break; default: - s->_gui->showCursor(); + if (s->_gui) + s->_gui->showCursor(); + else + s->_gui32->showCursor(); break; } case 2: pos.y = argv[1].toSint16(); pos.x = argv[0].toSint16(); - s->_gui->setCursorPos(pos); + if (s->_gui) + s->_gui->setCursorPos(pos); + else + s->_gui32->setCursorPos(pos); break; case 4: { int16 top = argv[0].toSint16(); @@ -137,7 +150,10 @@ 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->_gui->setCursorZone(rect); + if (s->_gui) + s->_gui->setCursorZone(rect); + else + s->_gui32->setCursorZone(rect); } else { warning("kSetCursor: Ignoring invalid mouse zone (%i, %i)-(%i, %i)", left, top, right, bottom); } @@ -148,7 +164,10 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16()); // Fallthrough case 3: - s->_gui->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); + if (s->_gui) + s->_gui->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); + else + s->_gui32->setCursorView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); break; default : warning("kSetCursor: Unhandled case: %d arguments given", argc); @@ -324,7 +343,10 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { } textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16(); - s->_gui->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight); + if (s->_gui) + s->_gui->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight); + else + s->_gui32->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight); debugC(2, kDebugLevelStrings, "GetTextSize '%s' -> %dx%d\n", text.c_str(), textWidth, textHeight); dest[2] = make_reg(0, textHeight); @@ -379,7 +401,11 @@ reg_t kDirLoop(EngineState *s, int argc, reg_t *argv) { reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv) { reg_t curObject = argv[0]; reg_t listReference = (argc > 1) ? argv[1] : NULL_REG; - bool canBeHere = s->_gui->canBeHere(curObject, listReference); + bool canBeHere; + if (s->_gui) + canBeHere = s->_gui->canBeHere(curObject, listReference); + else + canBeHere = s->_gui32->canBeHere(curObject, listReference); return make_reg(0, canBeHere); } @@ -387,7 +413,11 @@ reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv) { reg_t kCantBeHere(EngineState *s, int argc, reg_t *argv) { reg_t curObject = argv[0]; reg_t listReference = (argc > 1) ? argv[1] : NULL_REG; - bool canBeHere = s->_gui->canBeHere(curObject, listReference); + bool canBeHere; + if (s->_gui) + canBeHere = s->_gui->canBeHere(curObject, listReference); + else + canBeHere = s->_gui32->canBeHere(curObject, listReference); return make_reg(0, !canBeHere); } @@ -407,8 +437,13 @@ reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) { return NULL_REG; int16 loopNo = argv[1].toSint16(); int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0; + int16 celHeight; - return make_reg(0, s->_gui->getCelHeight(viewId, loopNo, celNo)); + if (s->_gui) + celHeight = s->_gui->getCelHeight(viewId, loopNo, celNo); + else + celHeight = s->_gui32->getCelHeight(viewId, loopNo, celNo); + return make_reg(0, celHeight); } reg_t kCelWide(EngineState *s, int argc, reg_t *argv) { @@ -417,14 +452,24 @@ reg_t kCelWide(EngineState *s, int argc, reg_t *argv) { return NULL_REG; int16 loopNo = argv[1].toSint16(); int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0; + int16 celWidth; - return make_reg(0, s->_gui->getCelWidth(viewId, loopNo, celNo)); + if (s->_gui) + celWidth = s->_gui->getCelWidth(viewId, loopNo, celNo); + else + celWidth = s->_gui32->getCelWidth(viewId, loopNo, celNo); + return make_reg(0, celWidth); } reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view); - int16 loopCount = s->_gui->getLoopCount(viewId); + int16 loopCount; + + if (s->_gui) + loopCount = s->_gui->getLoopCount(viewId); + else + loopCount = s->_gui32->getLoopCount(viewId); debugC(2, kDebugLevelGraphics, "NumLoops(view.%d) = %d\n", viewId, loopCount); @@ -435,7 +480,12 @@ reg_t kNumCels(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view); int16 loopNo = GET_SEL32V(s->_segMan, object, loop); - int16 celCount = s->_gui->getCelCount(viewId, loopNo); + int16 celCount; + + if (s->_gui) + celCount = s->_gui->getCelCount(viewId, loopNo); + else + celCount = s->_gui32->getCelCount(viewId, loopNo); debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d\n", viewId, loopNo, celCount); @@ -503,7 +553,10 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) { reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; - s->_gui->baseSetter(object); + if (s->_gui) + s->_gui->baseSetter(object); + else + s->_gui32->baseSetter(object); // WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened, // till the actual problem is found @@ -516,11 +569,17 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) { } reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) { - s->_gui->setNowSeen(argv[0]); + if (s->_gui) + s->_gui->setNowSeen(argv[0]); + else + s->_gui32->setNowSeen(argv[0]); return s->r_acc; } reg_t kPalette(EngineState *s, int argc, reg_t *argv) { + if (!s->_gui) + return s->r_acc; + switch (argv[0].toUint16()) { case 1: // Set resource palette if (argc==3) { @@ -600,6 +659,9 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) { reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { uint16 operation = argv[0].toUint16(); + if (!s->_gui) + return s->r_acc; + switch (operation) { case 0: { // Init GuiResourceId paletteId; @@ -1040,9 +1102,16 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { // Hide the cursor if it's showing and then show it again if it was // previously visible. - bool reshowCursor = s->_gui->isCursorVisible(); - if (reshowCursor) - s->_gui->hideCursor(); + bool reshowCursor; + if (s->_gui) { + reshowCursor = s->_gui->isCursorVisible(); + if (reshowCursor) + s->_gui->hideCursor(); + } else { + reshowCursor = s->_gui32->isCursorVisible(); + if (reshowCursor) + s->_gui32->hideCursor(); + } // The Windows and DOS versions use different video format as well // as a different argument set. @@ -1081,11 +1150,19 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { delete seqDecoder; } - if (playedVideo) - s->_gui->syncWithFramebuffer(); + if (playedVideo) { + if (s->_gui) + s->_gui->syncWithFramebuffer(); + else + s->_gui32->syncWithFramebuffer(); + } - if (reshowCursor) - s->_gui->showCursor(); + if (reshowCursor) { + if (s->_gui) + s->_gui->showCursor(); + else + s->_gui32->showCursor(); + } return s->r_acc; } diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 1882200b90..52bfa2314f 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -52,6 +52,7 @@ namespace Sci { class SciEvent; class Menubar; class SciGui; +class SciGui32; class Cursor; class MessageState; class SoundCommandParser; @@ -144,6 +145,7 @@ public: /* Non-VM information */ SciGui *_gui; /* Currently active Gui */ + SciGui32 *_gui32; SciEvent *_event; // Event handling |