Sometimes a texi component may refer to a material that was initialized by some other costume than the owner costume of the texi component. For example, the candles in gmi have a costume "fx/aura1.cos" that controls the animation of a material originally initialized by a sprite component of "fx/candle.cos".
In Lua, The wear chore of dumbshadow.cos is only started if GetActorPuckVector returns a non-nil value. In the original game GetActorPuckVector seems to always return nil until a call is made to SetActorFollowBoxes.
This fixes the candles not appearing in the set gmi. The original Lua code only starts the candle animation if the candle actor is not playing any chores. Previously the wear chore of dumbshadow.cos was playing, so the animation was never started.
Some chores need to stay active even after a call to
StopAllChores(). E.g. the hold chores should stay active
even after changing the set (which calls StopAllChores()).
It looks like that the previously unknown boolean paramter
of StopAllChores() controls that behavior. If set to TRUE,
stop only the non-looping chores.
This patch fixes:
- hold chore was lost when switching sets
- blue painting did not show the ultimate insult when opening
the inventory
The hold chore was always lost after e.g. turning left or right.
Although that chore was still in _playingChores, it was not shown.
The patch uses the following order for drawing the chores:
- wear chores
- rest chores
- walk/turn chores
- other chores (in order of the playChore calls)
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
- the costumes are handled on a stack per Actor
- the last costume is considered the current one
- currently, the costumes are never removed from from the stack
- this causes an issue when Guybrush is using its original
costume first, later the monkey robot costume for the final Monkey Kombat
and then again the standard costume (the robot costume will remain the last
on the stack and cosidered the current one - this causes a problem
when attaching the head actor since the robot has different joints
than guybrush with the standard costume)
- if a new wear chore is set and it uses a different costume than the
current one and neither of them is the shadow costume remove the old
costume before setting the new one
- additionally, this patch makes sure, that all active chores of all
costumes on the stack of an actor are stopped
- for solving the Monkey Kombat puzzle it is necessary that a kombat is
triggered when Guybrush runs into one of the monkeys on the map
- implement SetActorCollisionMode and SetActorCollisionScale
- add EMI-specific calculations for retrieving the sphere data for the
actors (and some minor refactoring for better readability)
The following changes may alter the behaviour in GRIM, too:
- in Actor::collisionHandlerCallback(), call the collision handler for
both affected objects (that is necessary since only one actor may have
a collision handler associated in lua but it may happen that the
character with the handler is standing still and the other one is run
into him)
- Actor::handleCollisionTo() did only update a given position to ensure
that there is no collision - so it is necessary to actually check for
collisions and execute the lua callback if necessary (via
Actor::handleCollisionWith())
EMI uses a different coordinate system than Grim, so we have to switch
dimensions in various places to share common code for walking and turning
actors. This patch fixes several yaw angle sign errors causing actors to
look into wrong directions.
The floor in the Hall of Justice is hidden by a solid gray actor named
"trap plane". This actor is originally positioned far in the background
but moved to the foreground because we can't find a sort plane in the
sector.
This patch stores returns an actor to the original sort order set by
the game script when entering a sector that has no sort information.
The clean buffer code needs two layers. Every actor needs its buffer,
but we also need a global one. The actors' buffers blit to the global buffer
which then gets blitted to screen.