From 26b11cb4448fff73099c35c5fb5d9dd0824a04ae Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Tue, 22 Feb 2005 22:23:10 +0000 Subject: o90_setSpriteInfo so 91 svn-id: r16866 --- scumm/intern.h | 2 ++ scumm/script_v90he.cpp | 23 ++++++++++++++++++++++- scumm/sprite_he.cpp | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) (limited to 'scumm') diff --git a/scumm/intern.h b/scumm/intern.h index 2ad2c9db90..b1dbbc32c9 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -935,6 +935,8 @@ protected: void spriteInfoSet_flags23_26(int spriteId, int value); void spriteInfoSet_flag31(int spriteId, int value); void spriteInfoSet_field_78_64(int spriteId, int value); + void spriteInfoSet_classFlags_1(int spriteId, int value1, int value2); + void spriteInfoSet_classFlags_2(int spriteId); void spritesAllocTables(int numSprites, int numGroups, int numMaxSprites); void spritesResetTables(bool refreshScreen); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index ecc5c6cab4..76a39bae1f 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -954,6 +954,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { int args[16]; int spriteId, tmp[2]; static int storedFields[2]; + int n; byte subOp = fetchScriptByte(); subOp -= 34; @@ -1210,7 +1211,27 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteInfoSet_flags23_26(spriteId, args[0]); break; case 91: - getStackList(args, ARRAYSIZE(args)); + n = getStackList(args, ARRAYSIZE(args)); + if (_curSpriteId != 0 && _curMaxSpriteId != 0 && n != 0) { + int *p = &args[n - 1]; + do { + int code = *p; + if (code == 0) { + for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { + spriteInfoSet_classFlags_2(i); + } + } else if (code & 0x80) { + for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { + spriteInfoSet_classFlags_1(i, code & 0x7F, 1); + } + } else { + for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { + spriteInfoSet_classFlags_1(i, code & 0x7F, 0); + } + } + --p; + } while (--n); + } break; case 105: // HE 99+ pop(); diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index cd8ccd4d3b..0b32c61e4d 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -485,6 +485,24 @@ void ScummEngine_v90he::spriteInfoSet_field_78_64(int spriteId, int value) { _spriteTable[spriteId].field_64 = value; } +void ScummEngine_v90he::spriteInfoSet_classFlags_1(int spriteId, int classId, int toggle) { + checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + checkRange(32, 1, classId, "class %d out of range in statement"); + + // XXX + if (toggle) { + _spriteTable[spriteId].flags |= 1 << (classId - 1); + } else { + _spriteTable[spriteId].flags &= 1 << (classId - 1); + } +} + +void ScummEngine_v90he::spriteInfoSet_classFlags_2(int spriteId) { + checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + + _spriteTable[spriteId].class_flags = 0; +} + void ScummEngine_v90he::spriteInfoSet_case183(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); -- cgit v1.2.3