aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMax Horn2010-02-13 17:43:31 +0000
committerMax Horn2010-02-13 17:43:31 +0000
commit721a57a66101d63bc05e294c24190ba66ccceb74 (patch)
tree058961d76217a87776f47fa62b178741eeb1e04e /engines/sci
parentac4d325e0d61b649026a5f5414f749697b285ccc (diff)
downloadscummvm-rg350-721a57a66101d63bc05e294c24190ba66ccceb74.tar.gz
scummvm-rg350-721a57a66101d63bc05e294c24190ba66ccceb74.tar.bz2
scummvm-rg350-721a57a66101d63bc05e294c24190ba66ccceb74.zip
SCI: Move Gui/Gfx related permanent objects from EngineState to SciEngine
svn-id: r48047
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/console.cpp20
-rw-r--r--engines/sci/engine/game.cpp4
-rw-r--r--engines/sci/engine/kernel32.cpp16
-rw-r--r--engines/sci/engine/kevent.cpp6
-rw-r--r--engines/sci/engine/kgraphics.cpp152
-rw-r--r--engines/sci/engine/kmenu.cpp12
-rw-r--r--engines/sci/engine/kpathing.cpp24
-rw-r--r--engines/sci/engine/savegame.cpp40
-rw-r--r--engines/sci/engine/state.cpp4
-rw-r--r--engines/sci/engine/state.h40
-rw-r--r--engines/sci/graphics/gui.cpp17
-rw-r--r--engines/sci/graphics/gui32.cpp8
-rw-r--r--engines/sci/sci.cpp50
-rw-r--r--engines/sci/sci.h41
14 files changed, 212 insertions, 222 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 424d7ca72b..7c811e3896 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -219,7 +219,7 @@ void Console::postEnter() {
_engine->_gamestate->_soundCmd->pauseAll(false);
if (!_videoFile.empty()) {
- _engine->_gamestate->_gfxCursor->kernelHide();
+ _engine->_gfxCursor->kernelHide();
if (_videoFile.hasSuffix(".seq")) {
SeqDecoder *seqDecoder = new SeqDecoder();
@@ -255,7 +255,7 @@ void Console::postEnter() {
#endif
}
- _engine->_gamestate->_gfxCursor->kernelShow();
+ _engine->_gfxCursor->kernelShow();
_videoFile.clear();
_videoFrameDelay = 0;
@@ -1062,7 +1062,7 @@ bool Console::cmdSetPalette(int argc, const char **argv) {
uint16 resourceId = atoi(argv[1]);
- _engine->_gamestate->_gfxPalette->kernelSetFromResource(resourceId, true);
+ _engine->_gfxPalette->kernelSetFromResource(resourceId, true);
return true;
}
@@ -1076,8 +1076,8 @@ bool Console::cmdDrawPic(int argc, const char **argv) {
uint16 resourceId = atoi(argv[1]);
- _engine->_gamestate->_gfxPaint->kernelDrawPicture(resourceId, 100, false, false, false, 0);
- _engine->_gamestate->_gfxScreen->copyToScreen();
+ _engine->_gfxPaint->kernelDrawPicture(resourceId, 100, false, false, false, 0);
+ _engine->_gfxScreen->copyToScreen();
return true;
}
@@ -1093,7 +1093,7 @@ bool Console::cmdDrawCel(int argc, const char **argv) {
uint16 loopNo = atoi(argv[2]);
uint16 celNo = atoi(argv[3]);
- _engine->_gamestate->_gfxPaint->kernelDrawCel(resourceId, loopNo, celNo, 50, 50, 0, 0, false, NULL_REG);
+ _engine->_gfxPaint->kernelDrawCel(resourceId, loopNo, celNo, 50, 50, 0, 0, false, NULL_REG);
return true;
}
@@ -1108,7 +1108,7 @@ bool Console::cmdDrawRobot(int argc, const char **argv) {
uint16 resourceId = atoi(argv[1]);
- _engine->_gamestate->_gui32->drawRobot(resourceId);
+ _engine->_gui32->drawRobot(resourceId);
return true;
}
#endif
@@ -1121,7 +1121,7 @@ bool Console::cmdUndither(int argc, const char **argv) {
}
bool flag = atoi(argv[1]) ? true : false;
- _engine->_gamestate->_gfxScreen->debugUnditherSetState(flag);
+ _engine->_gfxScreen->debugUnditherSetState(flag);
return false;
}
@@ -1134,7 +1134,7 @@ bool Console::cmdPicVisualize(int argc, const char **argv) {
bool state = atoi(argv[1]) ? true : false;
- return _engine->_gamestate->_gui->debugEGAdrawingVisualize(state);
+ return _engine->_gui->debugEGAdrawingVisualize(state);
}
bool Console::cmdPlayVideo(int argc, const char **argv) {
@@ -1421,7 +1421,7 @@ bool Console::cmdShowMap(int argc, const char **argv) {
case 1:
case 2:
case 3:
- _engine->_gamestate->_gfxScreen->debugShowMap(map);
+ _engine->_gfxScreen->debugShowMap(map);
break;
default:
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index b04dfc32c2..b72322ada3 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -255,8 +255,8 @@ int game_init(EngineState *s) {
}
// Initialize menu TODO: Actually this should be another init()
- if (s->_gfxMenu)
- s->_gfxMenu->reset();
+ if (g_sci->_gfxMenu)
+ g_sci->_gfxMenu->reset();
s->successor = NULL; // No successor
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp
index 8d70cdf45b..035388cbc2 100644
--- a/engines/sci/engine/kernel32.cpp
+++ b/engines/sci/engine/kernel32.cpp
@@ -668,7 +668,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->_gfxFrameout->kernelAddScreenItem(viewObj);
+ g_sci->_gfxFrameout->kernelAddScreenItem(viewObj);
return NULL_REG;
}
@@ -682,7 +682,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->_gfxFrameout->kernelDeleteScreenItem(viewObj);
+ g_sci->_gfxFrameout->kernelDeleteScreenItem(viewObj);
/*
reg_t viewObj = argv[0];
@@ -704,7 +704,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->_gfxFrameout->kernelAddPlane(planeObj);
+ g_sci->_gfxFrameout->kernelAddPlane(planeObj);
warning("kAddPlane object %04x:%04x", PRINT_REG(planeObj));
return NULL_REG;
}
@@ -712,7 +712,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->_gfxFrameout->kernelDeletePlane(planeObj);
+ g_sci->_gfxFrameout->kernelDeletePlane(planeObj);
warning("kDeletePlane object %04x:%04x", PRINT_REG(planeObj));
return NULL_REG;
}
@@ -720,7 +720,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->_gfxFrameout->kernelUpdatePlane(planeObj);
+ g_sci->_gfxFrameout->kernelUpdatePlane(planeObj);
return s->r_acc;
}
@@ -734,8 +734,8 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) {
}
reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
- warning("kGetHighPlanePri: %d", s->_gfxFrameout->kernelGetHighPlanePri());
- return make_reg(0, s->_gfxFrameout->kernelGetHighPlanePri());
+ warning("kGetHighPlanePri: %d", g_sci->_gfxFrameout->kernelGetHighPlanePri());
+ return make_reg(0, g_sci->_gfxFrameout->kernelGetHighPlanePri());
}
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
@@ -743,7 +743,7 @@ reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
// as its called right after a view is updated
// TODO
- s->_gfxFrameout->kernelFrameout();
+ g_sci->_gfxFrameout->kernelFrameout();
return NULL_REG;
}
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 7762417625..72dba8b6d5 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -48,7 +48,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
SegManager *segMan = s->_segMan;
Common::Point mousePos;
- mousePos = s->_gfxCursor->getPosition();
+ mousePos = g_sci->_gfxCursor->getPosition();
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
@@ -219,7 +219,7 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
int16 x = GET_SEL32V(segMan, obj, SELECTOR(x));
int16 y = GET_SEL32V(segMan, obj, SELECTOR(y));
- s->_gfxCoordAdjuster->kernelGlobalToLocal(x, y, planeObject);
+ g_sci->_gfxCoordAdjuster->kernelGlobalToLocal(x, y, planeObject);
PUT_SEL32V(segMan, obj, SELECTOR(x), x);
PUT_SEL32V(segMan, obj, SELECTOR(y), y);
@@ -238,7 +238,7 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
int16 x = GET_SEL32V(segMan, obj, SELECTOR(x));
int16 y = GET_SEL32V(segMan, obj, SELECTOR(y));
- s->_gfxCoordAdjuster->kernelLocalToGlobal(x, y, planeObject);
+ g_sci->_gfxCoordAdjuster->kernelLocalToGlobal(x, y, planeObject);
PUT_SEL32V(segMan, obj, SELECTOR(x), x);
PUT_SEL32V(segMan, obj, SELECTOR(y), y);
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index a007a9c145..f031b5130b 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -84,7 +84,7 @@ void _k_dirloop(reg_t object, uint16 angle, EngineState *s, int argc, reg_t *arg
else loopNo = -1;
}
- maxLoops = s->_gfxCache->kernelViewGetLoopCount(viewId);
+ maxLoops = g_sci->_gfxCache->kernelViewGetLoopCount(viewId);
if ((loopNo > 1) && (maxLoops < 4))
@@ -101,14 +101,14 @@ static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) {
if (argc >= 4) {
pos.y = argv[3].toSint16();
pos.x = argv[2].toSint16();
- s->_gfxCursor->kernelSetPos(pos);
+ g_sci->_gfxCursor->kernelSetPos(pos);
}
if ((argc >= 2) && (argv[1].toSint16() == 0)) {
cursorId = -1;
}
- s->_gfxCursor->kernelSetShape(cursorId);
+ g_sci->_gfxCursor->kernelSetShape(cursorId);
return s->r_acc;
}
@@ -120,7 +120,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
case 1:
switch (argv[0].toSint16()) {
case 0:
- s->_gfxCursor->kernelHide();
+ g_sci->_gfxCursor->kernelHide();
break;
case -1:
// TODO: Special case at least in kq6, check disassembly
@@ -129,7 +129,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
// TODO: Special case at least in kq6, check disassembly
break;
default:
- s->_gfxCursor->kernelShow();
+ g_sci->_gfxCursor->kernelShow();
break;
}
break;
@@ -137,7 +137,7 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
pos.y = argv[1].toSint16();
pos.x = argv[0].toSint16();
- s->_gfxCursor->kernelSetPos(pos);
+ g_sci->_gfxCursor->kernelSetPos(pos);
break;
case 4: {
int16 top = argv[0].toSint16();
@@ -147,7 +147,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->_gfxCursor->kernelSetMoveZone(rect);
+ g_sci->_gfxCursor->kernelSetMoveZone(rect);
} else {
warning("kSetCursor: Ignoring invalid mouse zone (%i, %i)-(%i, %i)", left, top, right, bottom);
}
@@ -158,7 +158,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:
- s->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
+ g_sci->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot);
break;
default :
warning("kSetCursor: Unhandled case: %d arguments given", argc);
@@ -184,7 +184,7 @@ reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv) {
if (argc == 2) {
pos.y = argv[1].toSint16();
pos.x = argv[0].toSint16();
- s->_gfxCursor->kernelSetPos(pos);
+ g_sci->_gfxCursor->kernelSetPos(pos);
}
return s->r_acc;
}
@@ -192,7 +192,7 @@ reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv) {
reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv) {
int16 newPicNotValid = (argc > 0) ? argv[0].toUint16() : -1;
- return make_reg(0, s->_gfxScreen->kernelPicNotValid(newPicNotValid));
+ return make_reg(0, g_sci->_gfxScreen->kernelPicNotValid(newPicNotValid));
}
Common::Rect kGraphCreateRect(int16 x, int16 y, int16 x1, int16 y1) {
@@ -248,27 +248,27 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
if (!s->resMan->isVGA() && !s->resMan->isAmiga32color())
color &= 0x0F;
- s->_gfxPaint16->kernelGraphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
+ g_sci->_gfxPaint16->kernelGraphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
break;
case K_GRAPH_SAVE_BOX:
rect = kGraphCreateRect(x, y, x1, y1);
screenMask = (argc > 5) ? argv[5].toUint16() : 0;
- return s->_gfxPaint16->kernelGraphSaveBox(rect, screenMask);
+ return g_sci->_gfxPaint16->kernelGraphSaveBox(rect, screenMask);
case K_GRAPH_RESTORE_BOX:
// This may be called with a memoryhandle from SAVE_BOX or SAVE_UPSCALEDHIRES_BOX
- s->_gfxPaint16->kernelGraphRestoreBox(argv[1]);
+ g_sci->_gfxPaint16->kernelGraphRestoreBox(argv[1]);
break;
case K_GRAPH_FILL_BOX_BACKGROUND:
rect = kGraphCreateRect(x, y, x1, y1);
- s->_gfxPaint16->kernelGraphFillBoxBackground(rect);
+ g_sci->_gfxPaint16->kernelGraphFillBoxBackground(rect);
break;
case K_GRAPH_FILL_BOX_FOREGROUND:
rect = kGraphCreateRect(x, y, x1, y1);
- s->_gfxPaint16->kernelGraphFillBoxForeground(rect);
+ g_sci->_gfxPaint16->kernelGraphFillBoxForeground(rect);
break;
case K_GRAPH_FILL_BOX_ANY:
@@ -278,31 +278,31 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
colorMask = argv[5].toUint16();
rect = kGraphCreateRect(x, y, x1, y1);
- s->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
+ g_sci->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
break;
case K_GRAPH_UPDATE_BOX: {
rect = kGraphCreateRect(x, y, x1, y1);
bool hiresMode = (argc > 6) ? true : false;
// argc == 7 on upscaled hires
- s->_gfxPaint16->kernelGraphUpdateBox(rect, hiresMode);
+ g_sci->_gfxPaint16->kernelGraphUpdateBox(rect, hiresMode);
break;
}
case K_GRAPH_REDRAW_BOX:
rect = kGraphCreateRect(x, y, x1, y1);
- s->_gfxPaint16->kernelGraphRedrawBox(rect);
+ g_sci->_gfxPaint16->kernelGraphRedrawBox(rect);
break;
case K_GRAPH_ADJUST_PRIORITY:
// Seems to be only implemented for SCI0/SCI01 games
debugC(2, kDebugLevelGraphics, "adjust_priority(%d, %d)", argv[1].toUint16(), argv[2].toUint16());
- s->_gfxPorts->kernelGraphAdjustPriority(argv[1].toUint16(), argv[2].toUint16());
+ g_sci->_gfxPorts->kernelGraphAdjustPriority(argv[1].toUint16(), argv[2].toUint16());
break;
case K_GRAPH_SAVE_UPSCALEDHIRES_BOX:
rect = kGraphCreateRect(x, y, x1, y1);
- return s->_gfxPaint16->kernelGraphSaveUpscaledHiresBox(rect);
+ return g_sci->_gfxPaint16->kernelGraphSaveUpscaledHiresBox(rect);
default:
warning("Unsupported kGraph() operation %04x", argv[0].toSint16());
@@ -336,11 +336,11 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16();
#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+ if (g_sci->_gui32)
+ g_sci->_gui32->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
else
#endif
- s->_gui->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+ g_sci->_gui->textSize(s->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
debugC(2, kDebugLevelStrings, "GetTextSize '%s' -> %dx%d", text.c_str(), textWidth, textHeight);
dest[2] = make_reg(0, textHeight);
@@ -364,7 +364,7 @@ reg_t kWait(EngineState *s, int argc, reg_t *argv) {
// FIXME: we should not be asking from the GUI to wait. The kernel sounds
// like a better place
- s->_gui->wait(sleep_time);
+ g_sci->_gui->wait(sleep_time);
return s->r_acc;
}
@@ -373,17 +373,17 @@ reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) {
int16 y = argv[0].toSint16();
if ((argc < 2) || (y != 1)) {
- return make_reg(0, s->_gfxPorts->kernelCoordinateToPriority(y));
+ return make_reg(0, g_sci->_gfxPorts->kernelCoordinateToPriority(y));
} else {
int16 priority = argv[1].toSint16();
- return make_reg(0, s->_gfxPorts->kernelPriorityToCoordinate(priority));
+ return make_reg(0, g_sci->_gfxPorts->kernelPriorityToCoordinate(priority));
}
}
reg_t kPriCoord(EngineState *s, int argc, reg_t *argv) {
int16 priority = argv[0].toSint16();
- return make_reg(0, s->_gfxPorts->kernelPriorityToCoordinate(priority));
+ return make_reg(0, g_sci->_gfxPorts->kernelPriorityToCoordinate(priority));
}
reg_t kDirLoop(EngineState *s, int argc, reg_t *argv) {
@@ -396,7 +396,7 @@ 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->_gfxCompare->kernelCanBeHere(curObject, listReference);
+ bool canBeHere = g_sci->_gfxCompare->kernelCanBeHere(curObject, listReference);
return make_reg(0, canBeHere);
}
@@ -405,7 +405,7 @@ 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->_gfxCompare->kernelCanBeHere(curObject, listReference);
+ bool canBeHere = g_sci->_gfxCompare->kernelCanBeHere(curObject, listReference);
return make_reg(0, !canBeHere);
}
@@ -415,7 +415,7 @@ reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv) {
int16 celNo = argv[2].toSint16();
Common::Point position(argv[4].toUint16(), argv[3].toUint16());
- bool result = s->_gfxCompare->kernelIsItSkip(viewId, loopNo, celNo, position);
+ bool result = g_sci->_gfxCompare->kernelIsItSkip(viewId, loopNo, celNo, position);
return make_reg(0, result);
}
@@ -427,7 +427,7 @@ reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) {
int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0;
int16 celHeight;
- celHeight = s->_gfxCache->kernelViewGetCelHeight(viewId, loopNo, celNo);
+ celHeight = g_sci->_gfxCache->kernelViewGetCelHeight(viewId, loopNo, celNo);
return make_reg(0, celHeight);
}
@@ -440,7 +440,7 @@ reg_t kCelWide(EngineState *s, int argc, reg_t *argv) {
int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0;
int16 celWidth;
- celWidth = s->_gfxCache->kernelViewGetCelWidth(viewId, loopNo, celNo);
+ celWidth = g_sci->_gfxCache->kernelViewGetCelWidth(viewId, loopNo, celNo);
return make_reg(0, celWidth);
}
@@ -450,7 +450,7 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) {
GuiResourceId viewId = GET_SEL32V(s->_segMan, object, SELECTOR(view));
int16 loopCount;
- loopCount = s->_gfxCache->kernelViewGetLoopCount(viewId);
+ loopCount = g_sci->_gfxCache->kernelViewGetLoopCount(viewId);
debugC(2, kDebugLevelGraphics, "NumLoops(view.%d) = %d", viewId, loopCount);
@@ -463,7 +463,7 @@ reg_t kNumCels(EngineState *s, int argc, reg_t *argv) {
int16 loopNo = GET_SEL32V(s->_segMan, object, SELECTOR(loop));
int16 celCount;
- celCount = s->_gfxCache->kernelViewGetCelCount(viewId, loopNo);
+ celCount = g_sci->_gfxCache->kernelViewGetCelCount(viewId, loopNo);
debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d", viewId, loopNo, celCount);
@@ -490,7 +490,7 @@ reg_t kOnControl(EngineState *s, int argc, reg_t *argv) {
rect.right = rect.left + 1;
rect.bottom = rect.top + 1;
}
- uint16 result = s->_gfxCompare->kernelOnControl(screenMask, rect);
+ uint16 result = g_sci->_gfxCompare->kernelOnControl(screenMask, rect);
return make_reg(0, result);
}
@@ -523,7 +523,7 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) {
if (argc >= 4)
EGApaletteNo = argv[3].toUint16();
- s->_gfxPaint16->kernelDrawPicture(pictureId, animationNr, animationBlackoutFlag, mirroredFlag, addToFlag, EGApaletteNo);
+ g_sci->_gfxPaint16->kernelDrawPicture(pictureId, animationNr, animationBlackoutFlag, mirroredFlag, addToFlag, EGApaletteNo);
return s->r_acc;
}
@@ -531,7 +531,7 @@ 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->_gfxCompare->kernelBaseSetter(object);
+ g_sci->_gfxCompare->kernelBaseSetter(object);
// WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened,
// till the actual problem is found
@@ -544,7 +544,7 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
}
reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) {
- s->_gfxCompare->kernelSetNowSeen(argv[0]);
+ g_sci->_gfxCompare->kernelSetNowSeen(argv[0]);
return s->r_acc;
}
@@ -560,7 +560,7 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
if (argc==3) {
GuiResourceId resourceId = argv[1].toUint16();
bool force = argv[2].toUint16() == 2 ? true : false;
- s->_gfxPalette->kernelSetFromResource(resourceId, force);
+ g_sci->_gfxPalette->kernelSetFromResource(resourceId, force);
} else {
warning("kPalette(1) called with %d parameters", argc);
}
@@ -569,14 +569,14 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
uint16 fromColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
uint16 toColor = CLIP<uint16>(argv[2].toUint16(), 1, 255);
uint16 flags = argv[3].toUint16();
- s->_gfxPalette->kernelSetFlag(fromColor, toColor, flags);
+ g_sci->_gfxPalette->kernelSetFlag(fromColor, toColor, flags);
break;
}
case 3: { // Remove palette-flag(s)
uint16 fromColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
uint16 toColor = CLIP<uint16>(argv[2].toUint16(), 1, 255);
uint16 flags = argv[3].toUint16();
- s->_gfxPalette->kernelUnsetFlag(fromColor, toColor, flags);
+ g_sci->_gfxPalette->kernelUnsetFlag(fromColor, toColor, flags);
break;
}
case 4: { // Set palette intensity
@@ -588,7 +588,7 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
uint16 intensity = argv[3].toUint16();
bool setPalette = (argc < 5) ? true : (argv[4].isNull()) ? true : false;
- s->_gfxPalette->kernelSetIntensity(fromColor, toColor, intensity, setPalette);
+ g_sci->_gfxPalette->kernelSetIntensity(fromColor, toColor, intensity, setPalette);
break;
}
default:
@@ -601,7 +601,7 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
uint16 g = argv[2].toUint16();
uint16 b = argv[3].toUint16();
- return make_reg(0, s->_gfxPalette->kernelFindColor(r, g, b));
+ return make_reg(0, g_sci->_gfxPalette->kernelFindColor(r, g, b));
}
case 6: { // Animate
int16 argNr;
@@ -610,11 +610,11 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
uint16 fromColor = argv[argNr].toUint16();
uint16 toColor = argv[argNr + 1].toUint16();
int16 speed = argv[argNr + 2].toSint16();
- if (s->_gfxPalette->kernelAnimate(fromColor, toColor, speed))
+ if (g_sci->_gfxPalette->kernelAnimate(fromColor, toColor, speed))
paletteChanged = true;
}
if (paletteChanged)
- s->_gfxPalette->kernelAnimateSet();
+ g_sci->_gfxPalette->kernelAnimateSet();
break;
}
case 7: { // Save palette to heap
@@ -636,7 +636,7 @@ 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)
+ if (!g_sci->_gui)
return s->r_acc;
switch (operation) {
@@ -646,7 +646,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
if (argc == 3) {
paletteId = argv[1].toUint16();
time = argv[2].toUint16();
- s->_gfxPalette->startPalVary(paletteId, time);
+ g_sci->_gfxPalette->startPalVary(paletteId, time);
warning("kPalVary(init) called with paletteId = %d, time = %d", paletteId, time);
} else {
warning("kPalVary(init) called with unsupported argc %d", argc);
@@ -659,7 +659,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
}
case 3: { // DeInit
if (argc == 1) {
- s->_gfxPalette->stopPalVary();
+ g_sci->_gfxPalette->stopPalVary();
warning("kPalVary(deinit)");
} else {
warning("kPalVary(deinit) called with unsupported argc %d", argc);
@@ -674,7 +674,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
bool pauseState;
if (argc == 2) {
pauseState = argv[1].isNull() ? false : true;
- s->_gfxPalette->togglePalVary(pauseState);
+ g_sci->_gfxPalette->togglePalVary(pauseState);
warning("kPalVary(pause) called with state = %d", pauseState);
} else {
warning("kPalVary(pause) called with unsupported argc %d", argc);
@@ -690,7 +690,7 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) {
reg_t kAssertPalette(EngineState *s, int argc, reg_t *argv) {
GuiResourceId paletteId = argv[1].toUint16();
- s->_gfxPalette->kernelAssertPalette(paletteId);
+ g_sci->_gfxPalette->kernelAssertPalette(paletteId);
return s->r_acc;
}
@@ -702,7 +702,7 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) {
case 0: { // load
if (argc == 2) {
Common::String resourceName = s->_segMan->getString(argv[1]);
- s->r_acc = s->_gui->portraitLoad(resourceName);
+ s->r_acc = g_sci->_gui->portraitLoad(resourceName);
} else {
warning("kPortrait(loadResource) called with unsupported argc %d", argc);
}
@@ -719,7 +719,7 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) {
uint seq = argv[8].toUint16() & 0xff;
// argv[9] is usually 0??!!
- s->_gui->portraitShow(resourceName, position, resourceNum, noun, verb, cond, seq);
+ g_sci->_gui->portraitShow(resourceName, position, resourceNum, noun, verb, cond, seq);
return SIGNAL_REG;
} else {
warning("kPortrait(show) called with unsupported argc %d", argc);
@@ -729,7 +729,7 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) {
case 2: { // unload
if (argc == 2) {
uint16 portraitId = argv[1].toUint16();
- s->_gui->portraitUnload(portraitId);
+ g_sci->_gui->portraitUnload(portraitId);
} else {
warning("kPortrait(unload) called with unsupported argc %d", argc);
}
@@ -781,13 +781,13 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
switch (type) {
case SCI_CONTROLS_TYPE_BUTTON:
debugC(2, kDebugLevelGraphics, "drawing button %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y);
- s->_gfxControls->kernelDrawButton(rect, controlObject, s->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite);
+ g_sci->_gfxControls->kernelDrawButton(rect, controlObject, s->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite);
return;
case SCI_CONTROLS_TYPE_TEXT:
alignment = GET_SEL32V(s->_segMan, controlObject, SELECTOR(mode));
debugC(2, kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d", PRINT_REG(controlObject), text.c_str(), x, y, alignment);
- s->_gfxControls->kernelDrawText(rect, controlObject, s->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite);
+ g_sci->_gfxControls->kernelDrawText(rect, controlObject, s->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite);
return;
case SCI_CONTROLS_TYPE_TEXTEDIT:
@@ -795,7 +795,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
maxChars = GET_SEL32V(s->_segMan, controlObject, SELECTOR(max));
cursorPos = GET_SEL32V(s->_segMan, controlObject, SELECTOR(cursor));
debugC(2, kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y);
- s->_gfxControls->kernelDrawTextEdit(rect, controlObject, s->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite);
+ g_sci->_gfxControls->kernelDrawTextEdit(rect, controlObject, s->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite);
return;
case SCI_CONTROLS_TYPE_ICON:
@@ -815,7 +815,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
priority = -1;
}
debugC(2, kDebugLevelGraphics, "drawing icon control %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y - 1);
- s->_gfxControls->kernelDrawIcon(rect, controlObject, viewId, loopNo, celNo, priority, style, hilite);
+ g_sci->_gfxControls->kernelDrawIcon(rect, controlObject, viewId, loopNo, celNo, priority, style, hilite);
return;
case SCI_CONTROLS_TYPE_LIST:
@@ -863,7 +863,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
}
debugC(2, kDebugLevelGraphics, "drawing list control %04x:%04x to %d,%d, diff %d", PRINT_REG(controlObject), x, y, SCI_MAX_SAVENAME_LENGTH);
- s->_gfxControls->kernelDrawList(rect, controlObject, maxChars, listCount, listEntries, fontId, style, upperPos, cursorPos, isAlias, hilite);
+ g_sci->_gfxControls->kernelDrawList(rect, controlObject, maxChars, listCount, listEntries, fontId, style, upperPos, cursorPos, isAlias, hilite);
free(listEntries);
delete[] listStrings;
return;
@@ -909,7 +909,7 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) {
switch (controlType) {
case SCI_CONTROLS_TYPE_TEXTEDIT:
// Only process textedit controls in here
- s->_gfxControls->kernelTexteditChange(controlObject, eventObject);
+ g_sci->_gfxControls->kernelTexteditChange(controlObject, eventObject);
}
}
return s->r_acc;
@@ -928,7 +928,7 @@ reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
case 1:
if (argv[0].isNull())
return s->r_acc;
- s->_gfxAnimate->kernelAddToPicList(argv[0], argc, argv);
+ g_sci->_gfxAnimate->kernelAddToPicList(argv[0], argc, argv);
break;
case 7:
viewId = argv[0].toUint16();
@@ -938,7 +938,7 @@ reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
topPos = argv[4].toSint16();
priority = argv[5].toSint16();
control = argv[6].toSint16();
- s->_gfxAnimate->kernelAddToPicView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
+ g_sci->_gfxAnimate->kernelAddToPicView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
break;
default:
error("kAddToPic with unsupported parameter count %d", argc);
@@ -947,7 +947,7 @@ reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
}
reg_t kGetPort(EngineState *s, int argc, reg_t *argv) {
- return s->_gfxPorts->kernelGetActive();
+ return g_sci->_gfxPorts->kernelGetActive();
}
reg_t kSetPort(EngineState *s, int argc, reg_t *argv) {
@@ -959,7 +959,7 @@ reg_t kSetPort(EngineState *s, int argc, reg_t *argv) {
switch (argc) {
case 1:
portId = argv[0].toSint16();
- s->_gfxPorts->kernelSetActive(portId);
+ g_sci->_gfxPorts->kernelSetActive(portId);
break;
case 7:
@@ -972,7 +972,7 @@ reg_t kSetPort(EngineState *s, int argc, reg_t *argv) {
picRect.right = argv[3].toSint16();
picTop = (argc >= 6) ? argv[4].toSint16() : 0;
picLeft = (argc >= 6) ? argv[5].toSint16() : 0;
- s->_gfxPorts->kernelSetPicWindow(picRect, picTop, picLeft, initPriorityBandsFlag);
+ g_sci->_gfxPorts->kernelSetPicWindow(picRect, picTop, picLeft, initPriorityBandsFlag);
break;
default:
@@ -1011,7 +1011,7 @@ reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) {
priority = 15;
}
- s->_gfxPaint16->kernelDrawCel(viewId, loopNo, celNo, x, y, priority, paletteNo, hiresMode, upscaledHiresHandle);
+ g_sci->_gfxPaint16->kernelDrawCel(viewId, loopNo, celNo, x, y, priority, paletteNo, hiresMode, upscaledHiresHandle);
return s->r_acc;
}
@@ -1022,7 +1022,7 @@ reg_t kDisposeWindow(EngineState *s, int argc, reg_t *argv) {
if ((argc != 2) || (argv[1].isNull()))
reanimate = true;
- s->_gfxPorts->kernelDisposeWindow(windowId, reanimate);
+ g_sci->_gfxPorts->kernelDisposeWindow(windowId, reanimate);
return s->r_acc;
}
@@ -1046,7 +1046,7 @@ reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) {
title = s->strSplit(title.c_str(), NULL);
}
- return s->_gfxPorts->kernelNewWindow(rect1, rect2, style, priority, colorPen, colorBack, title.c_str());
+ return g_sci->_gfxPorts->kernelNewWindow(rect1, rect2, style, priority, colorPen, colorBack, title.c_str());
}
reg_t kAnimate(EngineState *s, int argc, reg_t *argv) {
@@ -1057,7 +1057,7 @@ reg_t kAnimate(EngineState *s, int argc, reg_t *argv) {
// Take care of incoming events (kAnimate is called semi-regularly)
process_sound_events(s);
#endif
- s->_gfxAnimate->kernelAnimate(castListReference, cycle, argc, argv);
+ g_sci->_gfxAnimate->kernelAnimate(castListReference, cycle, argc, argv);
return s->r_acc;
}
@@ -1066,7 +1066,7 @@ reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv) {
int16 shakeCount = (argc > 0) ? argv[0].toUint16() : 1;
int16 directions = (argc > 1) ? argv[1].toUint16() : 1;
- s->_gfxPaint->kernelShakeScreen(shakeCount, directions);
+ g_sci->_gfxPaint->kernelShakeScreen(shakeCount, directions);
return s->r_acc;
}
@@ -1084,7 +1084,7 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) {
text = kernel_lookup_text(s, textp, index);
}
- return s->_gfxPaint16->kernelDisplay(s->strSplit(text.c_str()).c_str(), argc, argv);
+ return g_sci->_gfxPaint16->kernelDisplay(s->strSplit(text.c_str()).c_str(), argc, argv);
}
reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
@@ -1094,9 +1094,9 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
// previously visible.
bool reshowCursor;
- reshowCursor = s->_gfxCursor->isVisible();
+ reshowCursor = g_sci->_gfxCursor->isVisible();
if (reshowCursor)
- s->_gfxCursor->kernelHide();
+ g_sci->_gfxCursor->kernelHide();
if (argv[0].segment != 0) {
// DOS SEQ
@@ -1152,10 +1152,10 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
}
if (playedVideo)
- s->_gfxScreen->kernelSyncWithFramebuffer();
+ g_sci->_gfxScreen->kernelSyncWithFramebuffer();
if (reshowCursor)
- s->_gfxCursor->kernelShow();
+ g_sci->_gfxCursor->kernelShow();
return s->r_acc;
}
@@ -1208,12 +1208,12 @@ reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv) {
// New calls for SCI11. Using those is only needed when using text-codes so that one is able to change
// font and/or color multiple times during kDisplay and kDrawControl
reg_t kTextFonts(EngineState *s, int argc, reg_t *argv) {
- s->_gui->textFonts(argc, argv);
+ g_sci->_gui->textFonts(argc, argv);
return s->r_acc;
}
reg_t kTextColors(EngineState *s, int argc, reg_t *argv) {
- s->_gui->textColors(argc, argv);
+ g_sci->_gui->textColors(argc, argv);
return s->r_acc;
}
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index a785a8f368..4fca99b974 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -37,7 +37,7 @@ reg_t kAddMenu(EngineState *s, int argc, reg_t *argv) {
Common::String title = s->strSplit(s->_segMan->getString(argv[0]).c_str());
Common::String content = s->_segMan->getString(argv[1]);
- s->_gfxMenu->kernelAddEntry(title, content, argv[1]);
+ g_sci->_gfxMenu->kernelAddEntry(title, content, argv[1]);
return s->r_acc;
}
@@ -52,7 +52,7 @@ reg_t kSetMenu(EngineState *s, int argc, reg_t *argv) {
attributeId = argv[argPos].toUint16();
if ((argPos + 1) >= argc)
error("Too few parameters for kSetMenu");
- s->_gfxMenu->kernelSetAttribute(menuId, itemId, attributeId, argv[argPos + 1]);
+ g_sci->_gfxMenu->kernelSetAttribute(menuId, itemId, attributeId, argv[argPos + 1]);
argPos += 2;
}
return s->r_acc;
@@ -63,7 +63,7 @@ reg_t kGetMenu(EngineState *s, int argc, reg_t *argv) {
uint16 itemId = argv[0].toUint16() & 0xFF;
uint16 attributeId = argv[1].toUint16();
- return s->_gfxMenu->kernelGetAttribute(menuId, itemId, attributeId);
+ return g_sci->_gfxMenu->kernelGetAttribute(menuId, itemId, attributeId);
}
@@ -77,7 +77,7 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
// Sometimes this is called without giving text, if thats the case dont process it
text = s->_segMan->getString(textReference);
- s->_gfxMenu->kernelDrawStatus(s->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack);
+ g_sci->_gfxMenu->kernelDrawStatus(s->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack);
}
return s->r_acc;
}
@@ -85,7 +85,7 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {
bool clear = argv[0].isNull() ? true : false;
- s->_gfxMenu->kernelDrawMenuBar(clear);
+ g_sci->_gfxMenu->kernelDrawMenuBar(clear);
return s->r_acc;
}
@@ -94,7 +94,7 @@ reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) {
//bool pauseSound = argc > 1 ? (argv[1].isNull() ? false : true) : false;
// TODO: pauseSound implementation
- return s->_gfxMenu->kernelSelect(eventObject);
+ return g_sci->_gfxMenu->kernelSelect(eventObject);
}
} // End of namespace Sci
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index c168df3bf9..74f084467b 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -294,10 +294,10 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty
// Red : Barred access
// Yellow: Contained access
int poly_colors[4] = {
- s->_gfxPalette->kernelFindColor(0, 255, 0), // green
- s->_gfxPalette->kernelFindColor(0, 0, 255), // blue
- s->_gfxPalette->kernelFindColor(255, 0, 0), // red
- s->_gfxPalette->kernelFindColor(255, 255, 0) // yellow
+ g_sci->_gfxPalette->kernelFindColor(0, 255, 0), // green
+ g_sci->_gfxPalette->kernelFindColor(0, 0, 255), // blue
+ g_sci->_gfxPalette->kernelFindColor(255, 0, 0), // red
+ g_sci->_gfxPalette->kernelFindColor(255, 255, 0) // yellow
};
// Clip
@@ -308,7 +308,7 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty
p2.y = CLIP<int16>(p2.y, 0, height - 1);
assert(type >= 0 && type <= 3);
- s->_gfxPaint->kernelGraphDrawLine(p1, p2, poly_colors[type], 255, 255);
+ g_sci->_gfxPaint->kernelGraphDrawLine(p1, p2, poly_colors[type], 255, 255);
}
static void draw_point(EngineState *s, Common::Point p, int start, int width, int height) {
@@ -316,8 +316,8 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in
// Green: End point
// Blue: Starting point
int point_colors[2] = {
- s->_gfxPalette->kernelFindColor(0, 255, 0), // green
- s->_gfxPalette->kernelFindColor(0, 0, 255) // blue
+ g_sci->_gfxPalette->kernelFindColor(0, 255, 0), // green
+ g_sci->_gfxPalette->kernelFindColor(0, 0, 255) // blue
};
Common::Rect rect = Common::Rect(p.x - 1, p.y - 1, p.x - 1 + 3, p.y - 1 + 3);
@@ -329,8 +329,8 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in
rect.right = CLIP<int16>(rect.right, 0, width - 1);
assert(start >= 0 && start <= 1);
- if (s->_gfxPaint16)
- s->_gfxPaint16->kernelGraphFrameBox(rect, point_colors[start]);
+ if (g_sci->_gfxPaint16)
+ g_sci->_gfxPaint16->kernelGraphFrameBox(rect, point_colors[start]);
}
static void draw_polygon(EngineState *s, reg_t polygon, int width, int height) {
@@ -1417,9 +1417,9 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) {
}
// Update the whole screen
- s->_gfxScreen->copyToScreen();
+ g_sci->_gfxScreen->copyToScreen();
g_system->updateScreen();
- if (!s->_gfxPaint16)
+ if (!g_sci->_gfxPaint16)
g_system->delayMillis(2500);
}
@@ -1671,7 +1671,7 @@ reg_t kIntersections(EngineState *s, int argc, reg_t *argv) {
debug(";");
- s->_gfxScreen->copyToScreen();
+ g_sci->_gfxScreen->copyToScreen();
g_system->updateScreen();
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index e5020fa2c4..23a97166fa 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -361,13 +361,16 @@ void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
s.skip(4, VER(12), VER(12)); // obsolete: used to be status_bar_foreground
s.skip(4, VER(12), VER(12)); // obsolete: used to be status_bar_background
- if (s.getVersion() >= 13 && _gui) {
+ if (s.getVersion() >= 13 && g_sci->_gui) {
// Save/Load picPort as well (cause sierra sci also does this)
int16 picPortTop, picPortLeft;
Common::Rect picPortRect;
- if (s.isSaving())
- picPortRect = _gfxPorts->kernelGetPicWindow(picPortTop, picPortLeft);
+ if (s.isSaving()) {
+ // FIXME: _gfxPorts is 0 when using SCI32 code
+ assert(g_sci->_gfxPorts);
+ picPortRect = g_sci->_gfxPorts->kernelGetPicWindow(picPortTop, picPortLeft);
+ }
s.syncAsSint16LE(picPortRect.top);
s.syncAsSint16LE(picPortRect.left);
@@ -940,28 +943,9 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
}
// Create a new EngineState object
- retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_segMan, s->_gui, s->_audio);
+ retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_segMan, s->_audio);
retval->_event = new SciEvent();
- retval->_gfxAnimate = s->_gfxAnimate;
- retval->_gfxCache = s->_gfxCache;
- retval->_gfxCompare = s->_gfxCompare;
- retval->_gfxControls = s->_gfxControls;
- retval->_gfxCoordAdjuster = s->_gfxCoordAdjuster;
- retval->_gfxCursor = s->_gfxCursor;
- retval->_gfxMenu = s->_gfxMenu;
- retval->_gfxPaint = s->_gfxPaint;
- retval->_gfxPaint16 = s->_gfxPaint16;
- retval->_gfxPalette = s->_gfxPalette;
- retval->_gfxPorts = s->_gfxPorts;
- retval->_gfxScreen = s->_gfxScreen;
-
-#ifdef ENABLE_SCI32
- // Copy the Gui32 pointer over to the new EngineState, if it exists
- retval->_gui32 = s->_gui32;
- retval->_gfxFrameout = s->_gfxFrameout;
-#endif
-
// Copy some old data
retval->_soundCmd = s->_soundCmd;
@@ -1028,13 +1012,13 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->_msgState = new MessageState(retval->_segMan);
#ifdef ENABLE_SCI32
- if (retval->_gui32) {
- retval->_gui32->resetEngineState(retval);
- retval->_gui32->init();
+ if (g_sci->_gui32) {
+ g_sci->_gui32->resetEngineState(retval);
+ g_sci->_gui32->init();
} else {
#endif
- retval->_gui->resetEngineState(retval);
- retval->_gui->init(retval->_features->usesOldGfxFunctions());
+ g_sci->_gui->resetEngineState(retval);
+ g_sci->_gui->init(retval->_features->usesOldGfxFunctions());
#ifdef ENABLE_SCI32
}
#endif
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index f557bf618b..da670369e6 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -33,8 +33,8 @@
namespace Sci {
-EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, SciGui *gui, AudioPlayer *audio)
-: resMan(res), _kernel(kernel), _voc(voc), _segMan(segMan), _gui(gui), _audio(audio), _dirseeker() {
+EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, AudioPlayer *audio)
+: resMan(res), _kernel(kernel), _voc(voc), _segMan(segMan), _audio(audio), _dirseeker() {
#ifdef USE_OLD_MUSIC_FUNCTIONS
sfx_init_flags = 0;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index cb5dc023c9..29de9174b4 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -51,28 +51,9 @@ namespace Common {
namespace Sci {
class SciEvent;
-class GfxAnimate;
-class GfxCache;
-class GfxCompare;
-class GfxControls;
-class GfxCoordAdjuster;
-class GfxCursor;
-class GfxMenu;
-class GfxPaint;
-class GfxPaint16;
-class GfxPalette;
-class GfxPorts;
-class GfxScreen;
-class SciGui;
class MessageState;
class SoundCommandParser;
-#ifdef ENABLE_SCI32
-class SciGui32;
-class GfxFrameout;
-class GfxPaint32;
-#endif
-
class DirSeeker {
protected:
reg_t _outbuffer;
@@ -129,7 +110,7 @@ public:
struct EngineState : public Common::Serializable {
public:
- EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, SciGui *gui, AudioPlayer *audio);
+ EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, AudioPlayer *audio);
virtual ~EngineState();
virtual void saveLoadWithSerializer(Common::Serializer &ser);
@@ -146,25 +127,6 @@ public:
/* Non-VM information */
- GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
- GfxCache *_gfxCache;
- GfxCompare *_gfxCompare;
- GfxControls *_gfxControls; // Controls for 16-bit gfx
- GfxCoordAdjuster *_gfxCoordAdjuster;
- GfxCursor *_gfxCursor;
- GfxMenu *_gfxMenu; // Menu for 16-bit gfx
- GfxPalette *_gfxPalette;
- GfxPaint *_gfxPaint;
- GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx
- GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
- GfxScreen *_gfxScreen;
- SciGui *_gui; /* Currently active Gui */
-
-#ifdef ENABLE_SCI32
- SciGui32 *_gui32; // GUI for SCI32 games
- GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx
-#endif
-
SciEvent *_event; // Event handling
AudioPlayer *_audio;
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 4a0185c727..0ddb211905 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -54,22 +54,25 @@ namespace Sci {
SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor, GfxPorts *ports, AudioPlayer *audio)
: _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor), _ports(ports), _audio(audio) {
+ // FIXME/TODO: If SciGui inits all the stuff below, then it should *own* it,
+ // not SciEngine. Conversely, if we want SciEngine to own this stuff,
+ // then it should init it!
_coordAdjuster = new GfxCoordAdjuster16(_ports);
- _s->_gfxCoordAdjuster = _coordAdjuster;
+ g_sci->_gfxCoordAdjuster = _coordAdjuster;
_cursor->init(_coordAdjuster, _s->_event);
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster);
- _s->_gfxCompare = _compare;
+ g_sci->_gfxCompare = _compare;
_transitions = new GfxTransitions(this, _screen, _palette, _s->resMan->isVGA());
_paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, this, _cache, _ports, _coordAdjuster, _screen, _palette, _transitions);
- _s->_gfxPaint = _paint16;
- _s->_gfxPaint16 = _paint16;
+ g_sci->_gfxPaint = _paint16;
+ g_sci->_gfxPaint16 = _paint16;
_animate = new GfxAnimate(_s, _cache, _ports, _paint16, _screen, _palette, _cursor, _transitions);
- _s->_gfxAnimate = _animate;
+ g_sci->_gfxAnimate = _animate;
_text16 = new GfxText16(_s->resMan, _cache, _ports, _paint16, _screen);
_controls = new GfxControls(_s->_segMan, _ports, _paint16, _text16, _screen);
- _s->_gfxControls = _controls;
+ g_sci->_gfxControls = _controls;
_menu = new GfxMenu(_s->_event, _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor);
- _s->_gfxMenu = _menu;
+ g_sci->_gfxMenu = _menu;
}
SciGui::~SciGui() {
diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp
index b1a44e62bc..adc2c3a4e1 100644
--- a/engines/sci/graphics/gui32.cpp
+++ b/engines/sci/graphics/gui32.cpp
@@ -50,14 +50,14 @@ SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, G
: _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) {
_coordAdjuster = new GfxCoordAdjuster32(_s->_segMan);
- _s->_gfxCoordAdjuster = _coordAdjuster;
+ g_sci->_gfxCoordAdjuster = _coordAdjuster;
_cursor->init(_coordAdjuster, _s->_event);
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster);
- _s->_gfxCompare = _compare;
+ g_sci->_gfxCompare = _compare;
_paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _coordAdjuster, _cache, _screen, _palette);
- _s->_gfxPaint = _paint32;
+ g_sci->_gfxPaint = _paint32;
_frameout = new GfxFrameout(_s->_segMan, _s->resMan, _coordAdjuster, _cache, _screen, _palette, _paint32);
- _s->_gfxFrameout = _frameout;
+ g_sci->_gfxFrameout = _frameout;
}
SciGui32::~SciGui32() {
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 14af399d65..4cc2e97b95 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -176,7 +176,7 @@ Common::Error SciEngine::run() {
SegManager *segMan = new SegManager(_resMan);
// We'll set the GUI below
- _gamestate = new EngineState(_resMan, _kernel, _vocabulary, segMan, NULL, _audio);
+ _gamestate = new EngineState(_resMan, _kernel, _vocabulary, segMan, _audio);
_gamestate->_event = new SciEvent();
if (script_init_engine(_gamestate))
@@ -184,27 +184,27 @@ Common::Error SciEngine::run() {
#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
- _gamestate->_gfxAnimate = 0;
- _gamestate->_gfxControls = 0;
- _gamestate->_gfxMenu = 0;
- _gamestate->_gfxPaint16 = 0;
- _gamestate->_gfxPorts = 0;
- _gamestate->_gui = 0;
- _gamestate->_gui32 = new SciGui32(_gamestate, screen, palette, cache, cursor);
+ _gfxAnimate = 0;
+ _gfxControls = 0;
+ _gfxMenu = 0;
+ _gfxPaint16 = 0;
+ _gfxPorts = 0;
+ _gui = 0;
+ _gui32 = new SciGui32(_gamestate, screen, palette, cache, cursor);
} else {
#endif
- _gamestate->_gfxPorts = new GfxPorts(segMan, screen);
- _gamestate->_gui = new SciGui(_gamestate, screen, palette, cache, cursor, _gamestate->_gfxPorts, _audio);
+ _gfxPorts = new GfxPorts(segMan, screen);
+ _gui = new SciGui(_gamestate, screen, palette, cache, cursor, _gfxPorts, _audio);
#ifdef ENABLE_SCI32
- _gamestate->_gui32 = 0;
- _gamestate->_gfxFrameout = 0;
+ _gui32 = 0;
+ _gfxFrameout = 0;
}
#endif
- _gamestate->_gfxPalette = palette;
- _gamestate->_gfxScreen = screen;
- _gamestate->_gfxCache = cache;
- _gamestate->_gfxCursor = cursor;
+ _gfxPalette = palette;
+ _gfxScreen = screen;
+ _gfxCache = cache;
+ _gfxCursor = cursor;
if (game_init(_gamestate)) { /* Initialize */
warning("Game initialization failed: Aborting...");
@@ -239,11 +239,11 @@ Common::Error SciEngine::run() {
syncSoundSettings();
#ifdef ENABLE_SCI32
- if (_gamestate->_gui32)
- _gamestate->_gui32->init();
+ if (_gui32)
+ _gui32->init();
else
#endif
- _gamestate->_gui->init(_gamestate->_features->usesOldGfxFunctions());
+ _gui->init(_gamestate->_features->usesOldGfxFunctions());
debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()));
@@ -261,15 +261,15 @@ Common::Error SciEngine::run() {
ConfMan.flushToDisk();
delete _gamestate->_soundCmd;
- delete _gamestate->_gui;
+ delete _gui;
#ifdef ENABLE_SCI32
- delete _gamestate->_gui32;
+ delete _gui32;
#endif
- delete _gamestate->_gfxPorts;
- delete _gamestate->_gfxCache;
- delete _gamestate->_gfxPalette;
+ delete _gfxPorts;
+ delete _gfxCache;
+ delete _gfxPalette;
delete cursor;
- delete _gamestate->_gfxScreen;
+ delete _gfxScreen;
delete _gamestate->_event;
delete segMan;
delete _gamestate;
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index c6a251cb7b..beacc956e3 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -51,6 +51,27 @@ class Vocabulary;
class ResourceManager;
class AudioPlayer;
+class SciEvent;
+class GfxAnimate;
+class GfxCache;
+class GfxCompare;
+class GfxControls;
+class GfxCoordAdjuster;
+class GfxCursor;
+class GfxMenu;
+class GfxPaint;
+class GfxPaint16;
+class GfxPalette;
+class GfxPorts;
+class GfxScreen;
+class SciGui;
+
+
+#ifdef ENABLE_SCI32
+class SciGui32;
+class GfxFrameout;
+#endif
+
// our engine debug levels
enum kDebugLevels {
kDebugLevelError = 1 << 0,
@@ -143,6 +164,26 @@ public:
/** Remove the 'TARGET-' prefix of the given filename, if present. */
Common::String unwrapFilename(const Common::String &name) const;
+public:
+ GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
+ GfxCache *_gfxCache;
+ GfxCompare *_gfxCompare;
+ GfxControls *_gfxControls; // Controls for 16-bit gfx
+ GfxCoordAdjuster *_gfxCoordAdjuster;
+ GfxCursor *_gfxCursor;
+ GfxMenu *_gfxMenu; // Menu for 16-bit gfx
+ GfxPalette *_gfxPalette;
+ GfxPaint *_gfxPaint;
+ GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx
+ GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
+ GfxScreen *_gfxScreen;
+ SciGui *_gui; /* Currently active Gui */
+
+#ifdef ENABLE_SCI32
+ SciGui32 *_gui32; // GUI for SCI32 games
+ GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx
+#endif
+
private:
const ADGameDescription *_gameDescription;
AudioPlayer *_audio;