When attaching an actor to another one, set its local position
so that its final position (position of the parent actor + the
local position) remains the same as the final position before
it was attached.
Use matrix multiplications to fix the rotation for attached actors:
- calculate the final transformation matrix recursively for attached
actors (instead of using getWorldPos and getWorldRot)
- use a different order for building the quaternions out of the Euler
angles
- changed handling of camera position (just apply the rotation of the
camera, the (inverted) position of the camera and the position of the
actor
- no functional changes for GRIM
- no changes for drawing in overworld
Code simplification for GRIM:
- no need to use _currentPos in calculations for GRIM since it is
always (0, 0, 0)
This fixes:
- the rotation of any items Guybrush is holding in his hands
- the handling of the pole when using the raft in the swamps
- getting the bananas with the banana picker
Two animations (guy_puton_cap, guy_holdstickystuff) contain bone names
which which don't match any joints. To avoid that the holding actor is
drawn with a wrong orientation, ingore the unknown bone names when
running the animations.
Skeleton::getJointNamed() will now return null for unknown names.
The original behaviour for Actor::getWorldPos and
Actor::getRotationQuat is kept.
This patch fixes the problem, that Guybrush is "lying down" once he
holds the bottle of glue.
When drawing attached actors the engine uses the parent's sort order
plus one. This offset can move the attached actor behind a background
plane, for instance the chess board in the Lucre docks or Guybrush when
riding the manatee.
setSurface is done in a different thread than the one that starts
the scummvm main. The main thread would then wait until the setSurface
thread notifies. The setSurface thread would notify before it actually
calls setSurface, meaning if the thread is preemted before calling
setSurface, initSurface will assert, causing the app to crash.