aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-21 19:19:03 +0000
committerFilippos Karapetis2009-10-21 19:19:03 +0000
commitb105d690e398b47063b332245a783190f2cc84de (patch)
tree304b3c0fc5c2538430f949f77ec8075d3f7894ee /engines/sci/engine
parent95cefe311c29a5ea81ac17db25ecf142bd8352de (diff)
downloadscummvm-rg350-b105d690e398b47063b332245a783190f2cc84de.tar.gz
scummvm-rg350-b105d690e398b47063b332245a783190f2cc84de.tar.bz2
scummvm-rg350-b105d690e398b47063b332245a783190f2cc84de.zip
- Removed kShow() and the related code it uses - it's a debugging function, and we have the same functionality in the debug console
- Merged the view signal flags from kernel.h and gui_animate.h, and named them appropriately. Also, updated the notes next to them, cause some were incorrectly marked as not used in our engine - Added a note about a hack used in the old GUI in the view signal flags - Moved the control state flags inside gui_helpers.h svn-id: r45310
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.cpp5
-rw-r--r--engines/sci/engine/kernel.h24
-rw-r--r--engines/sci/engine/kgraphics.cpp52
-rw-r--r--engines/sci/engine/kmovement.cpp5
-rw-r--r--engines/sci/engine/vm.cpp22
5 files changed, 30 insertions, 78 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index ee795454b0..a7c6527bc4 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -44,7 +44,7 @@ static const char *sci_default_knames[SCI_KNAMES_DEFAULT_ENTRIES_NR] = {
/*0x06*/ "IsObject",
/*0x07*/ "RespondsTo",
/*0x08*/ "DrawPic",
- /*0x09*/ "Show",
+ /*0x09*/ "Dummy", // Show
/*0x0a*/ "PicNotValid",
/*0x0b*/ "Animate",
/*0x0c*/ "SetNowSeen",
@@ -192,7 +192,7 @@ SciKernelFunction kfunct_mappers[] = {
/*06*/ DEFUN("IsObject", kIsObject, "."),
/*07*/ DEFUN("RespondsTo", kRespondsTo, ".i"),
/*08*/ DEFUN("DrawPic", kDrawPic, "i*"),
- /*09*/ DEFUN("Show", kShow, "i"),
+
/*0a*/ DEFUN("PicNotValid", kPicNotValid, "i*"),
/*0b*/ DEFUN("Animate", kAnimate, "LI*"), // More like (li?)?
/*0c*/ DEFUN("SetNowSeen", kSetNowSeen, "oi*"), // The second parameter is ignored
@@ -341,6 +341,7 @@ SciKernelFunction kfunct_mappers[] = {
#if 0
// Stub functions
+ /*09*/ DEFUN("Show", kShow, "i"),
DEFUN("ShiftScreen", kShiftScreen, ".*"),
DEFUN("MemorySegment", kMemorySegment, ".*"),
DEFUN("ListOps", kListOps, ".*"),
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 7cf3bcd4e3..d43581e117 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -268,29 +268,6 @@ void process_sound_events(EngineState *s);
/* Maximum length of a savegame name (including terminator character) */
#define SCI_MAX_SAVENAME_LENGTH 0x24
-/* Flags for the signal selector */
-enum {
- _K_VIEW_SIG_FLAG_STOP_UPDATE = 0x0001,
- _K_VIEW_SIG_FLAG_UPDATED = 0x0002,
- _K_VIEW_SIG_FLAG_NO_UPDATE = 0x0004,
- _K_VIEW_SIG_FLAG_HIDDEN = 0x0008,
- _K_VIEW_SIG_FLAG_FIX_PRI_ON = 0x0010,
- _K_VIEW_SIG_FLAG_ALWAYS_UPDATE = 0x0020,
- _K_VIEW_SIG_FLAG_FORCE_UPDATE = 0x0040,
- _K_VIEW_SIG_FLAG_REMOVE = 0x0080,
- _K_VIEW_SIG_FLAG_FROZEN = 0x0100,
- _K_VIEW_SIG_FLAG_IS_EXTRA = 0x0200,
- _K_VIEW_SIG_FLAG_HIT_OBSTACLE = 0x0400,
- _K_VIEW_SIG_FLAG_DOESNT_TURN = 0x0800,
- _K_VIEW_SIG_FLAG_NO_CYCLER = 0x1000,
- _K_VIEW_SIG_FLAG_IGNORE_HORIZON = 0x2000,
- _K_VIEW_SIG_FLAG_IGNORE_ACTOR = 0x4000,
- _K_VIEW_SIG_FLAG_DISPOSE_ME = 0x8000,
-
- _K_VIEW_SIG_FLAG_STOPUPD = 0x20000000 /* View has been stop-updated */
-};
-
-
/******************** Kernel functions ********************/
// New kernel functions
@@ -312,7 +289,6 @@ reg_t kPriCoord(EngineState *s, int argc, reg_t *argv);
reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv);
reg_t kSetCursor(EngineState *s, int argc, reg_t *argv);
reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv);
-reg_t kShow(EngineState *s, int argc, reg_t *argv);
reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv);
reg_t kOnControl(EngineState *s, int argc, reg_t *argv);
reg_t kDrawPic(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 002a7ce841..29f3e632d3 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -33,10 +33,10 @@
#include "sci/seq_decoder.h"
#include "sci/engine/state.h"
#include "sci/engine/kernel.h"
-#include "sci/gfx/gfx_gui.h"
#include "sci/gfx/gfx_widgets.h"
-#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
+//#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
#include "sci/gui/gui.h"
+#include "sci/gui/gui_animate.h"
#include "sci/gui/gui_cursor.h"
#include "sci/gui/gui_screen.h"
@@ -67,7 +67,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv)
int maxloops;
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
- if (signal & _K_VIEW_SIG_FLAG_DOESNT_TURN)
+ if (signal & kSignalDoesntTurn)
return;
angle %= 360;
@@ -188,36 +188,6 @@ reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
-reg_t kShow(EngineState *s, int argc, reg_t *argv) {
- int old_map = s->pic_visible_map;
-
- s->pic_visible_map = (argc > 0) ? (gfx_map_mask_t) argv[0].toUint16() : GFX_MASK_VISUAL;
-
- switch (s->pic_visible_map) {
-
- case GFX_MASK_VISUAL:
- case GFX_MASK_PRIORITY:
- case GFX_MASK_CONTROL:
- gfxop_set_visible_map(s->gfx_state, s->pic_visible_map);
- if (old_map != s->pic_visible_map) {
-
- if (s->pic_visible_map == GFX_MASK_VISUAL) // Full widget redraw
- s->visual->draw(Common::Point(0, 0));
-
- gfxop_update(s->gfx_state);
- debugC(2, kDebugLevelGraphics, "Switching visible map to %x\n", s->pic_visible_map);
- }
- break;
-
- default:
- warning("Show(%x) selects unknown map", s->pic_visible_map);
-
- }
-
- s->pic_not_valid = 2;
- return s->r_acc;
-}
-
reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv) {
int16 newPicNotValid = (argc > 0) ? argv[0].toUint16() : -1;
@@ -862,22 +832,6 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
-void _k_view_list_mark_free(EngineState *s, reg_t off) {
- if (s->dyn_views) {
-
- GfxDynView *w = (GfxDynView *)s->dyn_views->_contents;
-
- while (w) {
- if (w->_ID == off.segment
- && w->_subID == off.offset) {
- w->under_bitsp.obj = NULL_REG;
- }
-
- w = (GfxDynView *)w->_next;
- }
- }
-}
-
reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
GuiResourceId viewId;
GuiViewLoopNo loopNo;
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 62a8bc88b0..7c8d070d10 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -27,6 +27,7 @@
#include "sci/resource.h"
#include "sci/engine/state.h"
#include "sci/engine/kernel.h"
+#include "sci/gui/gui_animate.h"
namespace Sci {
@@ -247,7 +248,7 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) {
int max_movcnt = GET_SEL32V(segMan, client, moveSpeed);
if (getSciVersion() > SCI_VERSION_01)
- signal &= ~_K_VIEW_SIG_FLAG_HIT_OBSTACLE;
+ signal &= ~kSignalHitObstacle;
PUT_SEL32(segMan, client, signal, make_reg(0, signal)); // This is a NOP for SCI0
oldx = x;
@@ -324,7 +325,7 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) {
PUT_SEL32V(segMan, client, x, oldx);
PUT_SEL32V(segMan, client, y, oldy);
- PUT_SEL32V(segMan, client, signal, (signal | _K_VIEW_SIG_FLAG_HIT_OBSTACLE));
+ PUT_SEL32V(segMan, client, signal, (signal | kSignalHitObstacle));
debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x by collision\n", PRINT_REG(mover));
completed = 1;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index eb154b1ad7..bf526e284f 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1608,6 +1608,7 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
objlength = 0;
reg.offset = magic_pos_adder; // Reset counter
+ reg_t egoClass = segMan->findObjectByName("Ego");
do {
reg_t addr;
@@ -1634,10 +1635,29 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
Object *baseObj = segMan->getObject(obj->getSpeciesSelector());
obj->setVarCount(baseObj->getVarCount());
- obj->_baseObj = baseObj->_baseObj;
// Copy base from species class, as we need its selector IDs
+ obj->_baseObj = baseObj->_baseObj;
obj->setSuperClassSelector(INST_LOOKUP_CLASS(obj->getSuperClassSelector().offset));
+
+ // Check if the game is trying to change an object that has Ego as its superclass
+ if (!egoClass.isNull() && obj->getSuperClassSelector() == egoClass) {
+ reg_t stopGroopPos = segMan->findObjectByName("stopGroop");
+ debugC(2, "ego changed, updating stopGroop");
+
+ // Notify the stopGroop object that Ego changed
+ if (!stopGroopPos.isNull()) {
+ Object *stopGroopObj = segMan->getObject(stopGroopPos);
+
+ // Find the client member variable, and update it
+ ObjVarRef varp;
+ if (lookup_selector(segMan, stopGroopPos, ((SciEngine*)g_engine)->getKernel()->_selectorCache.client, &varp, NULL) == kSelectorVariable) {
+ reg_t *clientVar = varp.getPointer(segMan);
+ *clientVar = addr;
+ }
+ }
+
+ }
} // if object or class
break;
case SCI_OBJ_POINTERS: // A relocation table