From c874ff15a8e95acb85940ba5de0243b93077cc9d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 23 May 2010 10:28:03 +0000 Subject: Cleaned up the game ID code: - The game ID is now obtained from ScummVM ID directly, not by converting Sierra's internal ID - Moved the code which reads the internal Sierra ID inside the resource manager - Moved the code which converts the internal Sierra ID to ScummVM's IDs together with the rest of the detection code svn-id: r49152 --- engines/sci/engine/kmisc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 450dca3770..74368b8c71 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -62,9 +62,9 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) { // LSL3 calculates a machinespeed variable during game startup (right after the filthy questions) // This one would go through w/o throttling resulting in having to do 1000 pushups or something // Another way of handling this would be delaying incrementing of "machineSpeed" selector - if (s->_gameId == "lsl3" && s->currentRoomNumber() == 290) + if (!strcmp(g_sci->getGameID(), "lsl3") && s->currentRoomNumber() == 290) s->_throttleTrigger = true; - if (s->_gameId == "iceman" && s->currentRoomNumber() == 27) { + if (!strcmp(g_sci->getGameID(), "iceman") && s->currentRoomNumber() == 27) { s->_throttleTrigger = true; neededSleep = 60; } -- cgit v1.2.3 From 9be4f6250cc88a1638299b3661b9896f4ebf57ed Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 23 May 2010 16:44:36 +0000 Subject: Made shrink_execution_stack() a member of EngineState svn-id: r49159 --- engines/sci/engine/kmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 74368b8c71..22295dca41 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -39,7 +39,7 @@ reg_t kRestartGame(EngineState *s, int argc, reg_t *argv) { s->restarting_flags |= SCI_GAME_IS_RESTARTING_NOW; s->restarting_flags &= ~SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE; // This appears to help - shrink_execution_stack(s, s->execution_stack_base + 1); + s->shrinkStackToBase(); script_abort_flag = 1; // Force vm to abort ASAP return NULL_REG; -- cgit v1.2.3 From 7cd9a23c0d11b451979aeea66a6bb325b2d31341 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 23 May 2010 17:03:16 +0000 Subject: Remove the unused SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE flag svn-id: r49161 --- engines/sci/engine/kmisc.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 22295dca41..aee1d58357 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -37,7 +37,6 @@ namespace Sci { reg_t kRestartGame(EngineState *s, int argc, reg_t *argv) { s->restarting_flags |= SCI_GAME_IS_RESTARTING_NOW; - s->restarting_flags &= ~SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE; // This appears to help s->shrinkStackToBase(); -- cgit v1.2.3 From d49fb8f42db7b9776f1dc426ebe2c6d806ad4720 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 24 May 2010 17:21:11 +0000 Subject: Add support for showing the icon bar in SCI1.1 Mac. svn-id: r49196 --- engines/sci/engine/kmisc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index aee1d58357..6fc4b2fc1d 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -32,6 +32,7 @@ #include "sci/engine/kernel.h" #include "sci/engine/gc.h" #include "sci/graphics/gui.h" +#include "sci/graphics/maciconbar.h" namespace Sci { @@ -297,9 +298,12 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { reg_t kIconBar(EngineState *s, int argc, reg_t *argv) { // TODO... - if (argv[0].toUint16() == 4 && argv[1].toUint16() == 0) + if (argv[0].toUint16() == 4 && argv[1].toUint16() == 0) { for (int i = 0; i < argv[2].toUint16(); i++) - warning("kIconBar: Icon Object %d = %04x:%04x", i, PRINT_REG(argv[i + 3])); + g_sci->_macIconBar->addIcon(argv[i + 3]); + + g_sci->_macIconBar->drawIcons(); + } // Other calls seem to handle selecting/deselecting them -- cgit v1.2.3 From 830d17ed318d62a01aa1ec24ec79a7439586eb5e Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 24 May 2010 21:47:06 +0000 Subject: SCI: renaming MacIconBar to GfxMacIconBar svn-id: r49202 --- engines/sci/engine/kmisc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 6fc4b2fc1d..c05a2bc57b 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -300,9 +300,9 @@ reg_t kIconBar(EngineState *s, int argc, reg_t *argv) { if (argv[0].toUint16() == 4 && argv[1].toUint16() == 0) { for (int i = 0; i < argv[2].toUint16(); i++) - g_sci->_macIconBar->addIcon(argv[i + 3]); + g_sci->_gfxMacIconBar->addIcon(argv[i + 3]); - g_sci->_macIconBar->drawIcons(); + g_sci->_gfxMacIconBar->drawIcons(); } // Other calls seem to handle selecting/deselecting them -- cgit v1.2.3 From 5d21ff280a30347362701ee177ab54f85e18e712 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 May 2010 16:47:30 +0000 Subject: Silenced some superfluous warnings in KQ5CD svn-id: r49294 --- engines/sci/engine/kmisc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index c05a2bc57b..68dc2fbba4 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -252,10 +252,15 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { break; } case K_MEMORY_PEEK : { + if (!argv[1].segment) { + // This occurs in KQ5CD when interacting with certain objects + warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1])); + return s->r_acc; + } + SegmentRef ref = s->_segMan->dereference(argv[1]); if (!ref.isValid() || ref.maxSize < 2) { - // This occurs in KQ5CD when interacting with certain objects warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1])); return s->r_acc; } -- cgit v1.2.3 From 3c82b6578fa3bd4b3d91c1933dd390581dbe08d1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 6 Jun 2010 23:00:33 +0000 Subject: Now that EngineState is not deleted when loading games, we can move some more state-related variables to it, and remove several FIXME's about non-const global variables. Also, the entries in the data stack are now deleted when loading (fixes a memory leak - thanks to digitall for this). svn-id: r49465 --- engines/sci/engine/kmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sci/engine/kmisc.cpp') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 68dc2fbba4..f91ba0fd82 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -41,7 +41,7 @@ reg_t kRestartGame(EngineState *s, int argc, reg_t *argv) { s->shrinkStackToBase(); - script_abort_flag = 1; // Force vm to abort ASAP + s->script_abort_flag = 1; // Force vm to abort ASAP return NULL_REG; } -- cgit v1.2.3