TINSEL: Cleaner fix for bug #2893946 - Psychiatrist savegame problem
This commit is contained in:
parent
301de7b640
commit
b7ab968dc7
4 changed files with 15 additions and 4 deletions
|
@ -314,10 +314,19 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
|
||||||
|
|
||||||
// get the stuff copied to process when it was created
|
// get the stuff copied to process when it was created
|
||||||
const RATP_INIT *r = (const RATP_INIT *)param;
|
const RATP_INIT *r = (const RATP_INIT *)param;
|
||||||
|
bool isSavegame = r->pic->resumeState == RES_SAVEGAME;
|
||||||
|
|
||||||
CORO_BEGIN_CODE(_ctx);
|
CORO_BEGIN_CODE(_ctx);
|
||||||
|
|
||||||
_ctx->pic = RestoreInterpretContext(r->pic);
|
_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);
|
CORO_INVOKE_1(Interpret, _ctx->pic);
|
||||||
|
|
||||||
// If it gets here, actor's code has run to completion
|
// 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;
|
CORO_END_CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreActorProcess(int id, INT_CONTEXT *pic) {
|
void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag) {
|
||||||
RATP_INIT r = { pic, id };
|
RATP_INIT r = { pic, id };
|
||||||
|
if (savegameFlag)
|
||||||
|
pic->resumeState = RES_SAVEGAME;
|
||||||
|
|
||||||
g_scheduler->createProcess(PID_TCODE, ActorRestoredProcess, &r, sizeof(r));
|
g_scheduler->createProcess(PID_TCODE, ActorRestoredProcess, &r, sizeof(r));
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ struct Z_POSITIONS {
|
||||||
int z;
|
int z;
|
||||||
};
|
};
|
||||||
|
|
||||||
void RestoreActorProcess(int id, INT_CONTEXT *pic);
|
void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag);
|
||||||
|
|
||||||
int SaveActors(PSAVED_ACTOR sActorInfo);
|
int SaveActors(PSAVED_ACTOR sActorInfo);
|
||||||
void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo);
|
void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Tinsel {
|
||||||
struct INV_OBJECT;
|
struct INV_OBJECT;
|
||||||
|
|
||||||
enum RESUME_STATE {
|
enum RESUME_STATE {
|
||||||
RES_NOT, RES_1, RES_2
|
RES_NOT, RES_1, RES_2, RES_SAVEGAME
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -281,7 +281,7 @@ void ResumeInterprets() {
|
||||||
if (TinselV2)
|
if (TinselV2)
|
||||||
RestoreProcess(&rsd->SavedICInfo[i]);
|
RestoreProcess(&rsd->SavedICInfo[i]);
|
||||||
else
|
else
|
||||||
RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i]);
|
RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i], rsd == &sgData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_POLYGON:
|
case GS_POLYGON:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue