aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/tinsel/actors.cpp13
-rw-r--r--engines/tinsel/actors.h2
-rw-r--r--engines/tinsel/pcode.h2
-rw-r--r--engines/tinsel/savescn.cpp2
4 files changed, 15 insertions, 4 deletions
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index 4e9847f8b4..acacd89667 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -314,10 +314,19 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
// get the stuff copied to process when it was created
const RATP_INIT *r = (const RATP_INIT *)param;
+ bool isSavegame = r->pic->resumeState == RES_SAVEGAME;
CORO_BEGIN_CODE(_ctx);
_ctx->pic = RestoreInterpretContext(r->pic);
+
+ // The newly added check here specially sets the process to RES_NOT when loading a savegame.
+ // This is needed particularly for the Psychiatrist scene in Discworld 1 - otherwise Rincewind
+ // can't go upstairs without leaving the building and returning. If this patch causes problems
+ // in other scenes, an added check for the hCode == 1174490602 could be added.
+ if (isSavegame && TinselV1)
+ _ctx->pic->resumeState = RES_NOT;
+
CORO_INVOKE_1(Interpret, _ctx->pic);
// If it gets here, actor's code has run to completion
@@ -326,8 +335,10 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
CORO_END_CODE;
}
-void RestoreActorProcess(int id, INT_CONTEXT *pic) {
+void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag) {
RATP_INIT r = { pic, id };
+ if (savegameFlag)
+ pic->resumeState = RES_SAVEGAME;
g_scheduler->createProcess(PID_TCODE, ActorRestoredProcess, &r, sizeof(r));
}
diff --git a/engines/tinsel/actors.h b/engines/tinsel/actors.h
index e707db77ba..6ebe32505a 100644
--- a/engines/tinsel/actors.h
+++ b/engines/tinsel/actors.h
@@ -156,7 +156,7 @@ struct Z_POSITIONS {
int z;
};
-void RestoreActorProcess(int id, INT_CONTEXT *pic);
+void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag);
int SaveActors(PSAVED_ACTOR sActorInfo);
void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo);
diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h
index 971a42d7bd..5d16dae432 100644
--- a/engines/tinsel/pcode.h
+++ b/engines/tinsel/pcode.h
@@ -37,7 +37,7 @@ namespace Tinsel {
struct INV_OBJECT;
enum RESUME_STATE {
- RES_NOT, RES_1, RES_2
+ RES_NOT, RES_1, RES_2, RES_SAVEGAME
};
enum {
diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp
index 73d587165e..39a8033d45 100644
--- a/engines/tinsel/savescn.cpp
+++ b/engines/tinsel/savescn.cpp
@@ -281,7 +281,7 @@ void ResumeInterprets() {
if (TinselV2)
RestoreProcess(&rsd->SavedICInfo[i]);
else
- RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i]);
+ RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i], rsd == &sgData);
break;
case GS_POLYGON: