Check if a zone type is NULL for both ITE and IHNM, as it's done in the original. This fixes the crash in IHNM when entering the second floor of the zeppelin and the crash in ITE when interacting with the bowl in the tunnel, outside the prison. Removed the two relevant hacks

svn-id: r27108
This commit is contained in:
Filippos Karapetis 2007-06-05 15:04:25 +00:00
parent 95821c97ee
commit 2f033e7a4c
2 changed files with 26 additions and 31 deletions

View file

@ -464,7 +464,9 @@ void Script::doVerb() {
}
}
if (objectType == kGameObjectHitZone) {
if (objectType == NULL)
return;
else if (objectType == kGameObjectHitZone) {
scriptModuleNumber = _vm->_scene->getScriptModuleNumber();
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[0]));
if ((hitZone->getFlags() & kHitZoneExit) == 0) {
@ -485,8 +487,6 @@ void Script::doVerb() {
if (scriptEntrypointNumber > 0) {
// WORKAROUND: Fixes bug #1690045 "ITE: Item description missing / ScummVM crash"
if (!(_vm->_scene->currentSceneNumber() == 278 && (_pendingObject[0] == 16419 || _pendingObject[1] == 16419) && _vm->getGameType() == GType_ITE)) {
event.type = kEvTOneshot;
event.code = kScriptEvent;
event.op = kEventExecNonBlocking;
@ -499,7 +499,6 @@ void Script::doVerb() {
event.param6 = (objectType == kGameObjectActor) ? _pendingObject[0] : ID_PROTAG; // Actor
_vm->_events->queue(&event);
}
} else {
_vm->getExcuseInfo(_pendingVerb, excuseText, excuseSampleResourceId);
@ -620,7 +619,9 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) {
hitZone = NULL;
if (objectTypeId(_pendingObject[0]) == kGameObjectHitZone) {
if (objectTypeId(_pendingObject[0]) == NULL)
return;
else if (objectTypeId(_pendingObject[0]) == kGameObjectHitZone) {
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[0]));
} else {
if ((_pendingVerb == getVerbType(kVerbUse)) && (objectTypeId(_pendingObject[1]) == kGameObjectHitZone)) {

View file

@ -386,11 +386,13 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) {
break;
case kGameObjectHitZone:
case kGameObjectStepZone:
if (objectTypeId(objectId) == kGameObjectHitZone) {
if (objectTypeId(objectId) == NULL)
return;
else if (objectTypeId(objectId) == kGameObjectHitZone)
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
} else {
else
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
}
scriptEntryPointNumber = hitZone->getScriptNumber();
moduleNumber = _vm->_scene->getScriptModuleNumber();
break;
@ -729,20 +731,12 @@ void Script::sfEnableZone(SCRIPTFUNC_PARAMS) {
int16 flag = thread->pop();
HitZone *hitZone;
if (objectTypeId(objectId) == kGameObjectHitZone) {
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
} else if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 1 &&
_vm->_scene->currentSceneNumber() == 14) {
// HACK: Don't disable the requested hitzone in room 14 in chapter 1 (Gorrister) of IHNM
// Apparently, this is used in that room to disable the tear at the very end of the
// corridor. This fixes the staircase in scenes 4 and 14
// FIXME: Remove this hack
warning("HACK: Prevent crash at staircase with Gorrister");
// Do nothing
if (objectTypeId(objectId) == NULL)
return;
} else {
else if (objectTypeId(objectId) == kGameObjectHitZone)
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
else
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
}
if (flag) {
hitZone->setFlag(kHitZoneEnabled);