From e2b131bbdb15ce56b1f75c58f176750601e63f7b Mon Sep 17 00:00:00 2001 From: James Brown Date: Mon, 30 Dec 2002 11:03:13 +0000 Subject: Implement findBlastObject correctly - inventory now works svn-id: r6273 --- scumm/script_v8.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 022d03d44f..9f7e51f8f0 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1416,10 +1416,22 @@ void Scumm_v8::o6_kernelGetFunctions() push(0); warning("o6_kernelGetFunctions: default case %d (len = %d)", args[0], len); break; - case 0xD8: // findBlastObject - // FIXME - this is WRONG and just a temporary hack - push(findObject(args[1], args[2])); + case 0xD8: { // findBlastObject + BlastObject *eo; + int i; + + for (i = _enqueuePos; i >= 0; i--) { + eo = &_enqueuedObjects[i]; + if (eo->posX <= args[1] && eo->width + eo->posX > args[1] && + eo->posY <= args[2] && eo->height + eo->posY > args[2]) { + push(eo->number); + return; + } + } + + push(0); break; + } case 0xD9: // actorHit push(0); warning("o6_kernelGetFunctions: default case %d (len = %d)", args[0], len); -- cgit v1.2.3