Fix Indy3/Loom override bugs. THIS MAY BREAK OTHER GAMES. Please test.

svn-id: r3876
This commit is contained in:
James Brown 2002-04-05 16:41:02 +00:00
parent 53b3cf6838
commit 2e0443e741
3 changed files with 24 additions and 26 deletions

View file

@ -2084,7 +2084,8 @@ void Scumm::setCursorHotspot2(int x,int y) {
byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) { byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) {
int w,h,i; int w,h,i;
if(_features & GF_SMALL_HEADER)
return 0;
l>>=3; l>>=3;
if (l<0) l = 0; if (l<0) l = 0;
if (t<0) t = 0; if (t<0) t = 0;

View file

@ -440,17 +440,9 @@ void Scumm::stopObjectCode() {
if (ss->where!=WIO_GLOBAL && ss->where!=WIO_LOCAL) { if (ss->where!=WIO_GLOBAL && ss->where!=WIO_LOCAL) {
if (ss->cutsceneOverride) if (ss->cutsceneOverride)
error("Object %d ending with active cutscene/override", ss->number); error("Object %d ending with active cutscene/override", ss->number);
/* I wonder if the removal of this breaks anything.
* put ss->number and ss->status at another place if using this
* stopObjectScript(ss->number); */
} else { } else {
if (ss->cutsceneOverride) if (ss->cutsceneOverride)
// FIXME: Loom workaround, fix properly :) - khalek error("Script %d ending with active cutscene/override (%d)", ss->number, ss->cutsceneOverride);
if ((_gameId == GID_LOOM256) && (ss->number==44))
this->exitCutscene();
else
error("Script %d ending with active cutscene/override", ss->number);
} }
ss->number = 0; ss->number = 0;
ss->status = 0; ss->status = 0;
@ -762,7 +754,7 @@ void Scumm::endCutscene() {
memset(args, 0, sizeof(args)); memset(args, 0, sizeof(args));
ss->cutsceneOverride--; ss->cutsceneOverride--;
printf("Ending cs(%d) from %d\n", ss->cutsceneOverride, _currentScript);
args[0] = vm.cutSceneData[vm.cutSceneStackPointer]; args[0] = vm.cutSceneData[vm.cutSceneStackPointer];
_vars[VAR_OVERRIDE] = 0; _vars[VAR_OVERRIDE] = 0;
@ -781,7 +773,7 @@ void Scumm::endCutscene() {
void Scumm::cutscene(int16 *args) { void Scumm::cutscene(int16 *args) {
int scr = _currentScript; int scr = _currentScript;
vm.slot[scr].cutsceneOverride++; vm.slot[scr].cutsceneOverride++;
printf("Starting cs(%d) from %d\n", vm.slot[scr].cutsceneOverride, _currentScript);
if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData)/sizeof(vm.cutSceneData[0])) if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData)/sizeof(vm.cutSceneData[0]))
error("Cutscene stack overflow"); error("Cutscene stack overflow");
@ -898,9 +890,10 @@ void Scumm::beginOverride() {
idx = vm.cutSceneStackPointer; idx = vm.cutSceneStackPointer;
ptr = &vm.cutScenePtr[idx]; ptr = &vm.cutScenePtr[idx];
if (!*ptr) { /* if (!*ptr) { // ENDER - FIXME - We don't need this?
vm.slot[_currentScript].cutsceneOverride++; vm.slot[_currentScript].cutsceneOverride++;
} }
*/
*ptr = _scriptPointer - _scriptOrgPointer; *ptr = _scriptPointer - _scriptOrgPointer;
vm.cutSceneScript[idx] = _currentScript; vm.cutSceneScript[idx] = _currentScript;
@ -915,9 +908,10 @@ void Scumm::endOverride() {
idx = vm.cutSceneStackPointer; idx = vm.cutSceneStackPointer;
ptr = &vm.cutScenePtr[idx]; ptr = &vm.cutScenePtr[idx];
if (*ptr) { /* if (!*ptr) { // ENDER - FIXME - We don't need this?
vm.slot[_currentScript].cutsceneOverride--; // vm.slot[_currentScript].cutsceneOverride--;
} //printf("ending override: %d on script %d\n", vm.slot[_currentScript].cutsceneOverride, _currentScript);
} */
*ptr = 0; *ptr = 0;
vm.cutSceneScript[idx] = 0; vm.cutSceneScript[idx] = 0;
_vars[VAR_OVERRIDE] = 0; _vars[VAR_OVERRIDE] = 0;
@ -1026,7 +1020,10 @@ void Scumm::exitCutscene() {
ss->offs = offs; ss->offs = offs;
ss->status = 2; ss->status = 2;
ss->freezeCount = 0; ss->freezeCount = 0;
if (ss->cutsceneOverride > 0)
ss->cutsceneOverride--; ss->cutsceneOverride--;
_vars[VAR_OVERRIDE] = 1; _vars[VAR_OVERRIDE] = 1;
vm.cutScenePtr[vm.cutSceneStackPointer] = 0; vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
} }

View file

@ -874,9 +874,8 @@ void Scumm::o5_chainScript() {
cur = _currentScript; cur = _currentScript;
if (vm.slot[cur].cutsceneOverride != 0) { if (vm.slot[cur].cutsceneOverride != 0)
error("Script %d chaining with active cutscene/override"); error("Script %d chaining with active cutscene/override");
}
vm.slot[cur].number = 0; vm.slot[cur].number = 0;
vm.slot[cur].status = 0; vm.slot[cur].status = 0;
@ -2105,8 +2104,9 @@ void Scumm::o5_stopScript() {
int script; int script;
script = getVarOrDirectByte(0x80); script = getVarOrDirectByte(0x80);
if (script==0) if (!script)
stopObjectCode(); // stopObjectCode(); // ENDER - wrong?
stopScriptNr(_currentScript);
else else
stopScriptNr(script); stopScriptNr(script);
} }