aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kfile.cpp4
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/kmath.cpp8
-rw-r--r--engines/sci/engine/kmisc.cpp2
-rw-r--r--engines/sci/engine/kmovement.cpp2
-rw-r--r--engines/sci/engine/vm.cpp1
-rw-r--r--engines/sci/engine/vm_types.h1
-rw-r--r--engines/sci/gfx/menubar.cpp6
8 files changed, 14 insertions, 12 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 8e4dbdb148..1c68428de5 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -148,7 +148,7 @@ void file_open(EngineState *s, const char *filename, int mode) {
if (!inFile && !outFile) { // Failed
debug(3, "file_open() failed");
- s->r_acc = make_reg(0, SIGNAL_OFFSET);
+ s->r_acc = SIGNAL_REG;
return;
}
@@ -755,7 +755,7 @@ reg_t kFileIO(EngineState *s, int argc, reg_t *argv) {
if (name.empty()) {
warning("Attempted to open a file with an empty filename");
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
}
file_open(s, name.c_str(), mode);
debug(3, "K_FILEIO_OPEN(%s,0x%x)", name.c_str(), mode);
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index ecfc6e1ae8..1afc2b76c4 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -876,7 +876,7 @@ reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv) {
if (!res) {
warning("[GFX] Attempt to get cel parameters for invalid view %d", view);
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
}
pxm = res->loops[loop].cels[cel];
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index 3ebe2483ce..ea427435f2 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -130,7 +130,7 @@ reg_t kCosDiv(EngineState *s, int argc, reg_t *argv) {
if ((cosval < 0.0001) && (cosval > -0.0001)) {
warning("kCosDiv: Attempted division by zero");
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
} else
return make_reg(0, (int16)(value / cosval));
}
@@ -142,7 +142,7 @@ reg_t kSinDiv(EngineState *s, int argc, reg_t *argv) {
if ((sinval < 0.0001) && (sinval > -0.0001)) {
warning("kSinDiv: Attempted division by zero");
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
} else
return make_reg(0, (int16)(value / sinval));
}
@@ -154,7 +154,7 @@ reg_t kTimesTan(EngineState *s, int argc, reg_t *argv) {
param -= 90;
if ((param % 90) == 0) {
warning("kTimesTan: Attempted tan(pi/2)");
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
} else
return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale));
}
@@ -165,7 +165,7 @@ reg_t kTimesCot(EngineState *s, int argc, reg_t *argv) {
if ((param % 90) == 0) {
warning("kTimesCot: Attempted tan(pi/2)");
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
} else
return make_reg(0, (int16)(tan(param * PI / 180.0) * scale));
}
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 42a595cdd8..4d0bd8a73a 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -60,7 +60,7 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
}
reg_t kHaveMouse(EngineState *s, int argc, reg_t *argv) {
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
}
enum kMemoryInfoFunc {
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index ad5851cd3d..3a21704469 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -401,7 +401,7 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) {
int dx, dy;
int destx, desty;
- s->r_acc = make_reg(0, SIGNAL_OFFSET);
+ s->r_acc = SIGNAL_REG;
if (!s->segMan->isHeapObject(avoider)) {
warning("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider));
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index f377e77d13..d617ecf64e 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -40,6 +40,7 @@
namespace Sci {
reg_t NULL_REG = {0, 0};
+reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
//#define VM_DEBUG_SEND
#undef STRICT_SEND // Disallows variable sends with more than one parameter
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 62dc35aae7..93378fe3d1 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -81,6 +81,7 @@ static inline reg_t make_reg(SegmentId segment, uint16 offset) {
}
extern reg_t NULL_REG;
+extern reg_t SIGNAL_REG;
} // End of namespace Sci
diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp
index 283b233477..6005e62041 100644
--- a/engines/sci/gfx/menubar.cpp
+++ b/engines/sci/gfx/menubar.cpp
@@ -345,10 +345,10 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut
reg_t Menubar::getAttribute(int menu_nr, int item_nr, int attribute) const {
if ((menu_nr < 0) || (item_nr < 0))
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
if ((menu_nr >= (int)_menus.size()) || (item_nr >= (int)_menus[menu_nr]._items.size()))
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
const MenuItem &item = _menus[menu_nr]._items[item_nr];
@@ -370,7 +370,7 @@ reg_t Menubar::getAttribute(int menu_nr, int item_nr, int attribute) const {
default:
warning("Attempt to read invalid attribute from menu %d, item %d: 0x%04x", menu_nr, item_nr, attribute);
- return make_reg(0, SIGNAL_OFFSET);
+ return SIGNAL_REG;
}
}