aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kmisc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/kmisc.cpp')
-rw-r--r--engines/sci/engine/kmisc.cpp53
1 files changed, 39 insertions, 14 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index d8ae1a3418..90ddf4d7ea 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -75,6 +75,17 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
neededSleep = 60;
}
break;
+ case GID_SQ4:
+ // In SQ4 (floppy and CD) the sequel police appear way too quickly in
+ // the Skate-o-rama rooms, resulting in all sorts of timer issues, like
+ // #3109139 (which occurs because a police officer instantly teleports
+ // just before Roger exits and shoots him). We throttle these scenes a
+ // bit more, in order to prevent timer bugs related to the sequel police
+ if (s->currentRoomNumber() == 405 || s->currentRoomNumber() == 406 ||
+ s->currentRoomNumber() == 410 || s->currentRoomNumber() == 411) {
+ s->_throttleTrigger = true;
+ neededSleep = 60;
+ }
default:
break;
}
@@ -164,7 +175,7 @@ reg_t kFlushResources(EngineState *s, int argc, reg_t *argv) {
}
reg_t kSetDebug(EngineState *s, int argc, reg_t *argv) {
- printf("Debug mode activated\n");
+ debug("Debug mode activated");
g_sci->_debugState.seeking = kDebugSeekNothing;
g_sci->_debugState.runningStep = 0;
@@ -180,11 +191,10 @@ enum {
reg_t kGetTime(EngineState *s, int argc, reg_t *argv) {
TimeDate loc_time;
- uint32 elapsedTime;
+ uint32 elapsedTime = g_engine->getTotalPlayTime();
int retval = 0; // Avoid spurious warning
g_system->getTimeAndDate(loc_time);
- elapsedTime = g_system->getMillis() - s->gameStartTime;
int mode = (argc > 0) ? argv[0].toUint16() : 0;
@@ -231,14 +241,18 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
switch (argv[0].toUint16()) {
case K_MEMORY_ALLOCATE_CRITICAL: {
int byteCount = argv[1].toUint16();
- // WORKAROUND: pq3 (multilingual) when plotting crimes - allocates the
- // returned bytes from kStrLen on "W" and "E" and wants to put a
- // string in there, which doesn't fit of course. That's why we allocate
- // one byte more all the time inside that room
- if (g_sci->getGameId() == GID_PQ3) {
- if (s->currentRoomNumber() == 202)
- byteCount++;
- }
+ // WORKAROUND:
+ // - pq3 (multilingual) room 202
+ // when plotting crimes, allocates the returned bytes from kStrLen
+ // on "W" and "E" and wants to put a string in there, which doesn't
+ // fit of course.
+ // - lsl5 (multilingual) room 280
+ // allocates memory according to a previous kStrLen for the name of
+ // the airport ladies (bug #3093818), which isn't enough
+
+ // We always allocate 1 byte more, because of this
+ byteCount++;
+
if (!s->_segMan->allocDynmem(byteCount, "kMemory() critical", &s->r_acc)) {
error("Critical heap allocation failed");
}
@@ -326,6 +340,17 @@ reg_t kIconBar(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+#ifdef ENABLE_SCI32
+reg_t kGetConfig(EngineState *s, int argc, reg_t *argv) {
+ Common::String setting = s->_segMan->getString(argv[0]);
+ reg_t data = readSelector(s->_segMan, argv[1], SELECTOR(data));
+
+ warning("Get config setting %s", setting.c_str());
+ s->_segMan->strcpy(data, "");
+ return argv[1];
+}
+#endif
+
enum kSciPlatforms {
kSciPlatformDOS = 1,
kSciPlatformWindows = 2
@@ -421,12 +446,12 @@ reg_t kStub(EngineState *s, int argc, reg_t *argv) {
}
Common::String warningMsg = "Dummy function k" + kernel->getKernelName(kernelCallNr) +
- Common::String::printf("[%x]", kernelCallNr) +
+ Common::String::format("[%x]", kernelCallNr) +
" invoked. Params: " +
- Common::String::printf("%d", argc) + " (";
+ Common::String::format("%d", argc) + " (";
for (int i = 0; i < argc; i++) {
- warningMsg += Common::String::printf("%04x:%04x", PRINT_REG(argv[i]));
+ warningMsg += Common::String::format("%04x:%04x", PRINT_REG(argv[i]));
warningMsg += (i == argc - 1 ? ")" : ", ");
}