From 15b02f923217b302dc78a425a4885372c5908e59 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 23 Feb 2005 05:09:14 +0000 Subject: Another sprite function. svn-id: r16874 --- scumm/sprite_he.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index 0fabcfe392..d05a6a10e0 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -220,10 +220,30 @@ void ScummEngine_v90he::spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy) // spriteGroupGet functions // int ScummEngine_v90he::spriteGroupGet_allocateGroupSpritesList(int spriteGroupId) { + int i, j, sprites = 0; + checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); - // TODO - return 0; + for (i = 1; i < _varNumSprites; i++) { + if (_spriteTable[i].group_num == spriteGroupId) + sprites++; + } + + if (!sprites) + return 0; + + writeVar(0, 0); + defineArray(0, kDwordArray, 0, 0, 0, sprites); + writeArray(0, 0, 0, sprites); + + i = _varNumSpriteGroups - 1; + while (i) { + if (_spriteTable[i].group_num == spriteGroupId) + writeArray(0, 0, i, j++); + i--; + } + + return readVar(0); } int ScummEngine_v90he::spriteGroupGet_field_10(int spriteGroupId) { -- cgit v1.2.3