diff options
author | Andrew Kurushin | 2005-07-25 17:35:35 +0000 |
---|---|---|
committer | Andrew Kurushin | 2005-07-25 17:35:35 +0000 |
commit | e175e68b992ac355fe2bcaa1eededc1361f11ffc (patch) | |
tree | 64d4e7f2ffe4ee0d8d2a5fa0923c40a4f729e410 | |
parent | 545ce7e00419be3073254eea9bdb20188308ac54 (diff) | |
download | scummvm-rg350-e175e68b992ac355fe2bcaa1eededc1361f11ffc.tar.gz scummvm-rg350-e175e68b992ac355fe2bcaa1eededc1361f11ffc.tar.bz2 scummvm-rg350-e175e68b992ac355fe2bcaa1eededc1361f11ffc.zip |
resolve scene resources without shift hack
svn-id: r18584
-rw-r--r-- | saga/ihnm_introproc.cpp | 16 | ||||
-rw-r--r-- | saga/scene.cpp | 99 | ||||
-rw-r--r-- | saga/scene.h | 44 |
3 files changed, 107 insertions, 52 deletions
diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp index fd27049d71..53e039ac9c 100644 --- a/saga/ihnm_introproc.cpp +++ b/saga/ihnm_introproc.cpp @@ -36,8 +36,8 @@ namespace Saga { SceneResourceData IHNM_IntroMovie1RL[] = { - {30, SAGA_BG_IMAGE, 0, 0, false} , - {31, SAGA_ANIM_1, 0, 0, false} + {30, 2, 0, 0, false} , + {31, 14, 0, 0, false} }; SceneDescription IHNM_IntroMovie1Desc = { @@ -47,8 +47,8 @@ SceneDescription IHNM_IntroMovie1Desc = { }; SceneResourceData IHNM_IntroMovie2RL[] = { - {32, SAGA_BG_IMAGE, 0, 0, false} , - {33, SAGA_ANIM_1, 0, 0, false} + {32, 2, 0, 0, false} , + {33, 14, 0, 0, false} }; SceneDescription IHNM_IntroMovie2Desc = { @@ -58,8 +58,8 @@ SceneDescription IHNM_IntroMovie2Desc = { }; SceneResourceData IHNM_IntroMovie3RL[] = { - {34, SAGA_BG_IMAGE, 0, 0, false}, - {35, SAGA_ANIM_1, 0, 0, false} + {34, 2, 0, 0, false}, + {35, 14, 0, 0, false} }; SceneDescription IHNM_IntroMovie3Desc = { @@ -69,8 +69,8 @@ SceneDescription IHNM_IntroMovie3Desc = { }; SceneResourceData IHNM_IntroMovie4RL[] = { - {1227, SAGA_BG_IMAGE, 0, 0, false}, - {1226, SAGA_ANIM_1, 0, 0, false} + {1227, 2, 0, 0, false}, + {1226, 14, 0, 0, false} }; SceneDescription IHNM_IntroMovie4Desc = { diff --git a/saga/scene.cpp b/saga/scene.cpp index c19b654587..1d286270cd 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -47,7 +47,67 @@ namespace Saga { static int initSceneDoors[SCENE_DOORS_MAX] = { -0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +static SAGAResourceTypes ITESceneResourceTypes[26] = { + SAGA_ACTOR, + SAGA_OBJECT, + SAGA_BG_IMAGE, + SAGA_BG_MASK, +SAGA_UNKNOWN, + SAGA_STRINGS, + SAGA_OBJECT_MAP, + SAGA_ACTION_MAP, + SAGA_ISO_IMAGES, + SAGA_ISO_MAP, + SAGA_ISO_PLATFORMS, + SAGA_ISO_METATILES, + SAGA_ENTRY, +SAGA_UNKNOWN, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ISO_MULTI, + SAGA_PAL_ANIM, + SAGA_FACES, + SAGA_PALETTE +}; + +static SAGAResourceTypes IHNMSceneResourceTypes[28] = { + SAGA_ACTOR, +SAGA_UNKNOWN, + SAGA_BG_IMAGE, + SAGA_BG_MASK, +SAGA_UNKNOWN, + SAGA_STRINGS, + SAGA_OBJECT_MAP, + SAGA_ACTION_MAP, + SAGA_ISO_IMAGES, + SAGA_ISO_MAP, + SAGA_ISO_PLATFORMS, + SAGA_ISO_METATILES, + SAGA_ENTRY, +SAGA_UNKNOWN, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ANIM, + SAGA_ISO_MULTI, + SAGA_PAL_ANIM, + SAGA_FACES, + SAGA_PALETTE }; Scene::Scene(SagaEngine *vm) : _vm(vm) { @@ -688,7 +748,17 @@ void Scene::processSceneResources() { size_t resourceDataLength; const byte *palPointer; size_t i; - int resType; + SAGAResourceTypes *types; + int typesCount; + SAGAResourceTypes resType; + + if (_vm->getGameType() == GType_IHNM) { + typesCount = ARRAYSIZE(IHNMSceneResourceTypes); + types = IHNMSceneResourceTypes; + } else { + typesCount = ARRAYSIZE(ITESceneResourceTypes); + types = ITESceneResourceTypes; + } // Process the scene resource list for (i = 0; i < _resourceListCount; i++) { @@ -698,17 +768,16 @@ void Scene::processSceneResources() { resourceData = _resourceList[i].buffer; resourceDataLength = _resourceList[i].size; - resType = _resourceList[i].resourceType; - - if (_vm->getGameType() == GType_IHNM) { - // IHNM has more animation slots and so resource numbers are shifted - // We use this trick to avoid code duplication. - // SAGA_ANIM_X code is correctly dependent on _resourceList[i].resourceType - if (resType > SAGA_ANIM_7) - resType -= 3; + if (_resourceList[i].resourceType >= typesCount) { + error("Scene::processSceneResources() wrong resource type %i", _resourceList[i].resourceType); } + resType = types[_resourceList[i].resourceType]; + switch (resType) { + case SAGA_UNKNOWN: + warning("UNKNOWN resourceType %i", _resourceList[i].resourceType); + break; case SAGA_ACTOR: //for (a = actorsInScene; a; a = a->nextInScene) // if (a->obj.figID == glist->file_id) @@ -807,15 +876,9 @@ void Scene::processSceneResources() { _vm->_isoMap->loadMetaTiles(resourceData, resourceDataLength); break; - case SAGA_ANIM_1: - case SAGA_ANIM_2: - case SAGA_ANIM_3: - case SAGA_ANIM_4: - case SAGA_ANIM_5: - case SAGA_ANIM_6: - case SAGA_ANIM_7: + case SAGA_ANIM: { - uint16 animId = _resourceList[i].resourceType - SAGA_ANIM_1; + uint16 animId = _resourceList[i].resourceType - 14; debug(3, "Loading animation resource animId=%i", animId); diff --git a/saga/scene.h b/saga/scene.h index c69cee3ecc..93732ed1d2 100644 --- a/saga/scene.h +++ b/saga/scene.h @@ -59,32 +59,24 @@ enum SCENE_PROC_PARAMS { // Resource type numbers enum SAGAResourceTypes { - SAGA_ACTOR = 0, - SAGA_OBJECT = 1, - SAGA_BG_IMAGE = 2, - SAGA_BG_MASK = 3, - SAGA_STRINGS = 5, - SAGA_OBJECT_MAP = 6, - SAGA_ACTION_MAP = 7, - SAGA_ISO_IMAGES = 8, - SAGA_ISO_MAP = 9, - SAGA_ISO_PLATFORMS = 10, - SAGA_ISO_METATILES = 11, - SAGA_ENTRY = 12, - SAGA_ANIM_1 = 14, - SAGA_ANIM_2, - SAGA_ANIM_3, - SAGA_ANIM_4, - SAGA_ANIM_5, - SAGA_ANIM_6, - SAGA_ANIM_7, - //SAGA_ANIM_8, // IHNM. We use trick to avoid code duplication - //SAGA_ANIM_9, - //SAGA_ANIM_10, - SAGA_ISO_MULTI = 22, - SAGA_PAL_ANIM = 23, - SAGA_FACES = 24, - SAGA_PALETTE = 25 + SAGA_UNKNOWN, + SAGA_ACTOR, + SAGA_OBJECT, + SAGA_BG_IMAGE, + SAGA_BG_MASK, + SAGA_STRINGS, + SAGA_OBJECT_MAP, + SAGA_ACTION_MAP, + SAGA_ISO_IMAGES, + SAGA_ISO_MAP, + SAGA_ISO_PLATFORMS, + SAGA_ISO_METATILES, + SAGA_ENTRY, + SAGA_ANIM, + SAGA_ISO_MULTI, + SAGA_PAL_ANIM, + SAGA_FACES, + SAGA_PALETTE }; #define SAGA_RESLIST_ENTRY_LEN 4 |