From 4f2cd36bd9c2eaebb74c7ede5367290679254cca Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 21 Feb 2005 00:25:30 +0000 Subject: More getSpriteInfo functions svn-id: r16836 --- scumm/intern.h | 2 ++ scumm/script_v90he.cpp | 44 +++++++++++++++++++++++++++++++++----------- scumm/sprite_he.cpp | 24 ++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/scumm/intern.h b/scumm/intern.h index 0392ca5628..2c1399f59f 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -895,6 +895,8 @@ protected: int spriteInfoGet_field_78(int spriteNun); int spriteInfoGet_field_80(int spriteNun); void getSpriteImageDim(int spriteNum, int32 &w, int32 &h); + void spriteInfoGet_tx_ty(int spriteNum, int32 &tx, int32 &ty); + void spriteInfoGet_field_2C_30(int spriteNum, int32 &field_2C, int32 &field_30); void spriteInfoSet_field_14(int spriteNum, int value); void spriteInfoSet_field_7C(int spriteNum, int value); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index f675bf065a..64aec9e826 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -699,23 +699,33 @@ void ScummEngine_v90he::o90_getDistanceBetweenPoints() { void ScummEngine_v90he::o90_getSpriteInfo() { int args[16]; int eax, esi; - int32 w, h; + int32 a, b; byte subOp = fetchScriptByte(); subOp -= 30; debug(1,"o90_getSpriteInfo stub (%d)", subOp); switch (subOp) { case 0: - pop(); - break; + eax = pop(); + if (eax) { + spriteInfoGet_tx_ty(eax, a, b); + push(a); + } else { + push(0); + } case 1: - pop(); - break; + eax = pop(); + if (eax) { + spriteInfoGet_tx_ty(eax, a, b); + push(b); + } else { + push(0); + } case 2: eax = pop(); if (eax) { - getSpriteImageDim(eax, w, h); - push(w); + getSpriteImageDim(eax, a, b); + push(a); } else { push(0); } @@ -723,17 +733,29 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 3: eax = pop(); if (eax) { - getSpriteImageDim(eax, w, h); - push(h); + getSpriteImageDim(eax, a, b); + push(b); } else { push(0); } break; case 4: - pop(); + eax = pop(); + if (eax) { + spriteInfoGet_field_2C_30(eax, a, b); + push(a); + } else { + push(0); + } break; case 5: - pop(); + eax = pop(); + if (eax) { + spriteInfoGet_field_2C_30(eax, a, b); + push(b); + } else { + push(0); + } break; case 6: eax = pop(); diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index bce46f6727..6434178e6b 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -110,13 +110,19 @@ int ScummEngine_v90he::spriteInfoGet_field_18(int spriteNum) { int ScummEngine_v90he::spriteInfoGet_grp_tx(int spriteNum) { checkRange(_numSprites, 1, spriteNum, "spriteInfoGet_grp_tx: Invalid sprite %d"); - return _spriteTable[spriteNum].tx; + if (_spriteTable[spriteNum].group_num) + return _spriteTable[spriteNum].tx + _spriteGroups[spriteNum].tx; + else + return _spriteTable[spriteNum].tx; } int ScummEngine_v90he::spriteInfoGet_grp_ty(int spriteNum) { checkRange(_numSprites, 1, spriteNum, "spriteInfoGet_grp_ty: Invalid sprite %d"); - return _spriteTable[spriteNum].ty; + if (_spriteTable[spriteNum].group_num) + return _spriteTable[spriteNum].ty + _spriteGroups[spriteNum].ty; + else + return _spriteTable[spriteNum].ty; } int ScummEngine_v90he::spriteInfoGet_field_44(int spriteNum) { @@ -161,6 +167,20 @@ void ScummEngine_v90he::getSpriteImageDim(int spriteNum, int32 &w, int32 &h) { getWizImageDim(_spriteTable[spriteNum].res_id, _spriteTable[spriteNum].res_state, w, h); } +void ScummEngine_v90he::spriteInfoGet_tx_ty(int spriteNum, int32 &tx, int32 &ty) { + checkRange(_numSprites, 1, spriteNum, "spriteInfoGet_tx_ty: Invalid sprite %d"); + + tx = _spriteTable[spriteNum].tx; + ty = _spriteTable[spriteNum].ty; +} + +void ScummEngine_v90he::spriteInfoGet_field_2C_30(int spriteNum, int32 &field_2C, int32 &field_30) { + checkRange(_numSprites, 1, spriteNum, "spriteInfoGet_field_2C_30: Invalid sprite %d"); + + field_2C = _spriteTable[spriteNum].field_2C; + field_30 = _spriteTable[spriteNum].field_30; +} + // // spriteInfoSet functions // -- cgit v1.2.3