More IHNM differences

svn-id: r18582
This commit is contained in:
Eugene Sandulenko 2005-07-25 02:38:43 +00:00
parent f773d76c54
commit e8c1f6d1f1
6 changed files with 57 additions and 14 deletions

View File

@ -572,7 +572,7 @@ int Anim::IHNM_DecodeFrame(byte *decode_buf, size_t decode_buf_len, const byte *
outbuf_remain -= runcount;
continue;
break;
case 0x1F: // 31: Unusued?
case SAGA_FRAME_NOOP: // Unused
if (thisf_len - readS.pos() < 3) {
warning("0x%02X: Input buffer underrun", in_ch);
return FAILURE;
@ -775,6 +775,12 @@ void Anim::fillFrameOffsets(AnimationData *anim) {
readS.readByte();
continue;
break;
case SAGA_FRAME_NOOP: // Does nothing
readS.readByte();
readS.readByte();
readS.readByte();
continue;
break;
default:
break;
}

View File

@ -30,12 +30,13 @@
namespace Saga {
#define MAX_ANIMATIONS 7
#define MAX_ANIMATIONS 10
#define DEFAULT_FRAME_TIME 140
#define SAGA_FRAME_START 0xF
#define SAGA_FRAME_END 0x3F
#define SAGA_FRAME_NOOP 0x1F
#define SAGA_FRAME_REPOSITION 0x30
#define SAGA_FRAME_ROW_END 0x2F
#define SAGA_FRAME_LONG_COMPRESSED_RUN 0x20

View File

@ -675,7 +675,7 @@ void Scene::loadSceneResourceList(uint32 resourceId) {
for (i = 0; i < _resourceListCount; i++) {
_resourceList[i].resourceId = readS.readUint16();
_resourceList[i].reourceType = readS.readUint16();
_resourceList[i].resourceType = readS.readUint16();
// demo version may contain invalid resourceId
_resourceList[i].invalid = !_vm->_resource->validResourceId(_sceneContext, _resourceList[i].resourceId);
}
@ -688,6 +688,7 @@ void Scene::processSceneResources() {
size_t resourceDataLength;
const byte *palPointer;
size_t i;
int resType;
// Process the scene resource list
for (i = 0; i < _resourceListCount; i++) {
@ -696,8 +697,25 @@ void Scene::processSceneResources() {
}
resourceData = _resourceList[i].buffer;
resourceDataLength = _resourceList[i].size;
switch (_resourceList[i].reourceType) {
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;
}
switch (resType) {
case SAGA_ACTOR:
//for (a = actorsInScene; a; a = a->nextInScene)
// if (a->obj.figID == glist->file_id)
// if (_vm->getGameType() == GType_ITE ||
// ((a->obj.flags & ACTORF_FINAL_FACE) & 0xff))
// a->sprites = (xSpriteSet *)glist->offset;
warning("STUB: unimplemeted handler of SAGA_ACTOR resource");
break;
case SAGA_OBJECT:
break;
@ -797,13 +815,17 @@ void Scene::processSceneResources() {
case SAGA_ANIM_6:
case SAGA_ANIM_7:
{
uint16 animId = _resourceList[i].reourceType - SAGA_ANIM_1;
uint16 animId = _resourceList[i].resourceType - SAGA_ANIM_1;
debug(3, "Loading animation resource animId=%i", animId);
_vm->_anim->load(animId, resourceData, resourceDataLength);
}
break;
case SAGA_ENTRY:
debug(3, "Loading entry list resource...");
loadSceneEntryList(resourceData, resourceDataLength);
break;
case SAGA_ISO_MULTI:
if (!(_sceneDescription.flags & kSceneFlagISO)) {
error("Scene::ProcessSceneResources(): not Iso mode");
@ -817,12 +839,9 @@ void Scene::processSceneResources() {
debug(3, "Loading palette animation resource.");
_vm->_palanim->loadPalAnim(resourceData, resourceDataLength);
break;
case SAGA_ENTRY:
debug(3, "Loading entry list resource...");
loadSceneEntryList(resourceData, resourceDataLength);
break;
case SAGA_FACES:
_vm->_interface->loadScenePortraits(_resourceList[i].resourceId);
if (_vm->getGameType() == GType_ITE)
_vm->_interface->loadScenePortraits(_resourceList[i].resourceId);
break;
case SAGA_PALETTE:
{
@ -841,7 +860,7 @@ void Scene::processSceneResources() {
}
break;
default:
error("Scene::ProcessSceneResources() Encountered unknown resource type %i", _resourceList[i].reourceType);
error("Scene::ProcessSceneResources() Encountered unknown resource type %i", _resourceList[i].resourceType);
break;
}
}

View File

@ -78,6 +78,9 @@ enum SAGAResourceTypes {
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,
@ -88,7 +91,7 @@ enum SAGAResourceTypes {
struct SceneResourceData {
uint32 resourceId;
int reourceType;
int resourceType;
byte *buffer;
size_t size;
bool invalid;

View File

@ -537,6 +537,8 @@ private:
void sfDebugShowData(SCRIPTFUNC_PARAMS);
void SF_stub(SCRIPTFUNC_PARAMS);
void sfNull(SCRIPTFUNC_PARAMS);
void sfPsychicProfile(SCRIPTFUNC_PARAMS);
void sfPsychicProfileOff(SCRIPTFUNC_PARAMS);
};
} // End of namespace Saga

View File

@ -183,8 +183,8 @@ static const ScriptFunctionDescription IHNMscriptFunctionsList[IHNM_SCRIPT_FUNCT
OPCODE(sfScriptWalkRelative),
OPCODE(sfScriptMoveRelative),
OPCODE(sfSimulSpeech2),
OPCODE(sfPlacard),
OPCODE(sfPlacardOff),
OPCODE(sfPsychicProfile),
OPCODE(sfPsychicProfileOff),
OPCODE(sfSetProtagState),
OPCODE(sfResumeBgdAnim),
OPCODE(sfThrowActor),
@ -1466,6 +1466,18 @@ void Script::sfPlacardOff(SCRIPTFUNC_PARAMS) {
}
void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
warning("STUB: sfPsychicProfile()");
}
void Script::sfPsychicProfileOff(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
warning("STUB: sfPsychicProfileOff()");
}
// Script function #50 (0x32)
void Script::sfSetProtagState(SCRIPTFUNC_PARAMS) {
int protagState = thread->pop();