mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
Added sanity checks for hitzones in SAGA, after discussing with h00ligan and sev. Removed a hack for IHNM which is not needed anymore and removed a redundant check for zero object types
svn-id: r27140
This commit is contained in:
parent
44d98de023
commit
a265844351
@ -1289,6 +1289,10 @@ void Interface::handleChapterSelectionClick(const Point& mousePoint) {
|
||||
switch (objectTypeId(obj)) {
|
||||
case kGameObjectHitZone:
|
||||
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(obj));
|
||||
|
||||
if (hitZone == NULL)
|
||||
return;
|
||||
|
||||
if (hitZone->getFlags() & kHitZoneExit)
|
||||
script = hitZone->getScriptNumber();
|
||||
break;
|
||||
|
@ -110,12 +110,7 @@ public:
|
||||
int hitTest(const Point& testPoint);
|
||||
HitZone *getHitZone(int16 index) {
|
||||
if ((index < 0) || (index >= _hitZoneListCount)) {
|
||||
// HACK: If we get a wrong hitzone, return the last hitzone in the list
|
||||
// Normally, we don't get wrong hitzones in ITE, however IHNM still seems
|
||||
// to have problems with some, therefore just throw a warning for now and
|
||||
// continue with a valid hitzone
|
||||
warning("ObjectMap::getHitZone wrong index 0x%X, adjusting it to 0x%X", index, _hitZoneListCount - 1);
|
||||
index = _hitZoneListCount - 1;
|
||||
return NULL;
|
||||
}
|
||||
return _hitZoneList[index];
|
||||
}
|
||||
|
@ -352,6 +352,10 @@ const char *SagaEngine::getObjectName(uint16 objectId) {
|
||||
return _actor->_actorsStrings.getString(actor->_nameIndex);
|
||||
case kGameObjectHitZone:
|
||||
hitZone = _scene->_objectMap->getHitZone(objectIdToIndex(objectId));
|
||||
|
||||
if (hitZone == NULL)
|
||||
return "";
|
||||
|
||||
return _scene->_sceneStrings.getString(hitZone->getNameIndex());
|
||||
}
|
||||
warning("SagaEngine::getObjectName name not found for 0x%X", objectId);
|
||||
|
@ -469,6 +469,10 @@ void Script::doVerb() {
|
||||
else if (objectType == kGameObjectHitZone) {
|
||||
scriptModuleNumber = _vm->_scene->getScriptModuleNumber();
|
||||
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(_pendingObject[0]));
|
||||
|
||||
if (hitZone == NULL)
|
||||
return;
|
||||
|
||||
if ((hitZone->getFlags() & kHitZoneExit) == 0) {
|
||||
scriptEntrypointNumber = hitZone->getScriptNumber();
|
||||
}
|
||||
|
@ -386,13 +386,14 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) {
|
||||
break;
|
||||
case kGameObjectHitZone:
|
||||
case kGameObjectStepZone:
|
||||
if (objectTypeId(objectId) == 0)
|
||||
return;
|
||||
else if (objectTypeId(objectId) == kGameObjectHitZone)
|
||||
if (objectTypeId(objectId) == kGameObjectHitZone)
|
||||
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
|
||||
else
|
||||
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
|
||||
|
||||
if (hitZone == NULL)
|
||||
return;
|
||||
|
||||
scriptEntryPointNumber = hitZone->getScriptNumber();
|
||||
moduleNumber = _vm->_scene->getScriptModuleNumber();
|
||||
break;
|
||||
@ -731,14 +732,6 @@ void Script::sfEnableZone(SCRIPTFUNC_PARAMS) {
|
||||
int16 flag = thread->pop();
|
||||
HitZone *hitZone;
|
||||
|
||||
// HACK: Don't disable the tear in scene 14, to keep the staircase functioning
|
||||
// FIXME: Investigate why this hack is needed and remove it
|
||||
if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 1 &&
|
||||
_vm->_scene->currentSceneNumber() == 14) {
|
||||
warning("sfEnableZone: HACK: Prevent unusable staircase");
|
||||
return; // Do nothing
|
||||
}
|
||||
|
||||
if (objectTypeId(objectId) == 0)
|
||||
return;
|
||||
else if (objectTypeId(objectId) == kGameObjectHitZone)
|
||||
@ -746,6 +739,9 @@ void Script::sfEnableZone(SCRIPTFUNC_PARAMS) {
|
||||
else
|
||||
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
|
||||
|
||||
if (hitZone == NULL)
|
||||
return;
|
||||
|
||||
if (flag) {
|
||||
hitZone->setFlag(kHitZoneEnabled);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user