#831 closed defect (fixed)
ALL: o5_getClosestObjActor() oddity
Reported by: | eriktorbjorn | Owned by: | fingolfin |
---|---|---|---|
Priority: | normal | Component: | Engine: SCUMM |
Version: | Keywords: | script | |
Cc: | Game: |
Description
The o5_getClosestObjActor() function looks a bit strange to me. It won't notice any actor that's farther away than 255 units (pixels?).
This appears to be the main reason why the encounter with Edna in the kitchen in Maniac Mansion doesn't work the way it should. If I change it to initialize closest_dist to 0xFFFF instead of 0xFF she will at least notice you, though some of the text isn't displayed when it should be. I guess the script that checks for when you get near her will terminate if it thinks she's not in the room at all.
Is this the right thing to do, or would it break any other games? An alternative way would be to change getObjActToObjActDist() to divide the distance by 8 for V2-games. If so, we'd have to remember to change o5_getDist(), of course.
Ticket imported from: #745935. Ticket imported from: bugs/831.
Attachments (1)
Change History (6)
comment:1 by , 21 years ago
comment:2 by , 21 years ago
So this patch that I'm about to attach is the proper fix for V2 then, and if there are any other problems we can deal with those later?
By the way, this time when I tried it all text messages appeared the way (I think) they should.
comment:3 by , 21 years ago
I applied a different change, namely your proposed change to o5_getClosestObjActor. That seems more natural to me, and since the only place in non-V2 games this is used seems to be the airpor in Zak256, i don't see any problems caused by this coming to us, either :-)
comment:4 by , 21 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:5 by , 6 years ago
Component: | --Unset-- → Engine: SCUMM |
---|
Yup, 255 pixels is it's max. That's how it's implemented in the original, too, at least up to V3. But of course in V2, the distance should be measured in chars, not pixels, hence you are right about the division by 8, for V2 at least.
To repeat it, the max. cap for V3 is 0xFF. Not sure about V5, though the code, AFAIK, was REed from a V5 game, so it would seem strange if it was wrong. But the only game I know to use that feature is Zak256 anyway.