Opened 17 years ago

Closed 17 years ago

Last modified 22 months ago

#831 closed defect (fixed)

ALL: o5_getClosestObjActor() oddity

Reported by: eriktorbjorn Owned by: fingolfin
Priority: normal Component: Engine: SCUMM
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)

actor_distance.diff (825 bytes ) - added by eriktorbjorn 17 years ago.
Patch against a May 30 CVS snapshot

Download all attachments as: .zip

Change History (6)

comment:1 by fingolfin, 17 years ago

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.

comment:2 by eriktorbjorn, 17 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.

by eriktorbjorn, 17 years ago

Attachment: actor_distance.diff added

Patch against a May 30 CVS snapshot

comment:3 by fingolfin, 17 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 fingolfin, 17 years ago

Owner: set to fingolfin
Resolution: fixed
Status: newclosed

comment:5 by digitall, 22 months ago

Component: --Unset--Engine: SCUMM
Note: See TracTickets for help on using tickets.