Commit Graph

156 Commits

Author SHA1 Message Date
Vincent Pelletier
bad3de8a12 GRIM: Drop off-screen buffers
These were present to implement actor freezing in software rendering mode
in the way original engine was intended for performance reason.
In residualvm, software rendering will generalise the principle through
dirty-rectangles management, so off-screen buffers should not be needed.

Also, properly implementing them requires invasive changes (move previous
draw call list from global OpenGL context to individual off-screen buffers,
along with associated linear vertex allocator, adding a new draw call to
track requested buffer changes until final on-screen frame buffer
presentation).
So instead of such added complexity, lie to lua API about actor not being
in set but keep it in so it is part of normal redraw sequence.

Fixes disappearing actors in cn, bi.
Likely also fixes at, ly, sh, mn, dd which uses free/thaw lua API, but
which I did not check.
2017-05-02 09:51:47 +00:00
Christian Krause
6d226501b5 EMI: Implement mesh-specific alpha values
- if Lua_V2::SetActorGlobalAlpha() is called with a mesh name,
  set a mesh-specific alpha value / mode
- use this alpha value in drawEMIModelFace()
- fixes the problem that the whole actor vanishes in some scenes
  (e.g. when entering or leaving the porch of the of LUA bar)
2015-02-17 01:57:07 +01:00
Christian Krause
5df7e5991d EMI: Fix semantic of IsActorTurning() LUA call
TurnActorTo is mapped to Actor::singleTurnTo() which only
turns the actor (according to its turn rate) by a small amount.

If the turn could not be completed, TurnActorTo returns false.

In EMI, all LUA calls to TurnActorTo are repeated until the
actor does eventually look into the correct direction.

However, for parallel running LUA threads, calls to IsActorTurning
would return false during such a "LUA-controlled" turn.

In the scene with the dart players, the LUA code for the dialog
waits for the dart player to stop moving (and turning) by repeatedly
calling IsActorTurning. Since that function returns false
even if the players are still turning towards the dart board, the
dialog code starts and spawns a parallel LUA thread to use
TurnActorTo to make the dart players looking at Guybrush.

This means, that eventually for each dart player, two LUA
threads with contradicting TurnActorTo directions will run forever
since in none of the threads the final direction is ever reached.

To fix that, a new actor state variable, _singleTurning, is introduced.
It is set to true if an Actor::singleTurnTo() call indicates that
the turn is not complete. It is set to false once the turning has
fininshed.

Since all TurnActorTo calls in EMI are repeated until the function returns
false, it is safe to use that variable to indicate that a "LUA-controlled"
turning is in progress.

In GRIM, that's not the case and so isTurning() is only changed for EMI.
2014-11-30 21:24:04 +01:00
Joel Teichroeb
6c01a3ca74 Merge pull request #1077 from JoseJX/StopTurning
EMI: Add stop turning to actor methods.
2014-09-09 09:01:33 -07:00
Christian Krause
e2eee80716 EMI: Implement Lua_V2::SetActorLocalAlpha
- sets the alpha mode and the alpha value for single vertices
2014-09-08 09:00:21 +02:00
Joseph Jezak
aa1977618a EMI: Add stop turning to actor methods. 2014-08-26 13:36:07 -04:00
Joel Teichroeb
9c54ff5795 Merge pull request #1053 from Akz-/emi-shadow-fixes
EMI: Shadow fixes
2014-08-23 21:44:51 -07:00
Joni Vähämäki
70b65cb45f EMI: Return playing chores of all costumes from GetActorChores. 2014-08-20 01:37:28 +03:00
Joni Vähämäki
1bf63977a6 EMI: Remove special treatment of wear chores which is no longer necessary. 2014-08-20 01:37:19 +03:00
Joni Vähämäki
0bd258be1d EMI: Return the first costume that has a model component in Actor::getCurrentCostume. 2014-08-20 01:36:32 +03:00
Joni Vähämäki
6b1eb0ec4e EMI: Free costumes once all chores have finished. 2014-08-20 01:36:31 +03:00
Joni Vähämäki
3648da8934 EMI: Increase MAX_SHADOWS from 5 to 8. 2014-08-19 15:44:36 +03:00
Joni Vähämäki
a37890b8f5 EMI: Get the sort order from the closest sector even if the current position is not contained within any sector.
This fixes Guybrush occasionally being visible through the buildings and foliage on Lucre island when walking at the edge of the walkable sectors. This happened because for positions at the edge of the walkable sector the method Sector::isPointInSector may not always return true.
2014-08-14 18:06:59 +03:00
Joni Vähämäki
de049e0eaf EMI: If a sort order is specified for an actor that is attached to another, use the specified sort order instead of the parent's one. 2014-08-12 17:46:36 +03:00
Joseph Jezak
e057c003c1 EMI: Calculate the bounding box using the actor's bounding box info. 2014-08-04 11:14:28 -04:00
Joseph Jezak
2c563d41b4 EMI: Honor X and Y attributes to spoken lines, rebased from Botje. 2014-08-04 11:14:27 -04:00
Joel Teichroeb
96946a4802 Merge pull request #967 from Akz-/emi-fix-savecrash
EMI: Free materials as soon as they are no longer in use by any costumes
2014-07-22 14:46:05 -07:00
Joni Vähämäki
e5e05e1152 GRIM/EMI: Make Light and SetShadow structs instead of classes. 2014-07-20 21:46:21 +03:00
Joni Vähämäki
4a1df6bfa2 EMI: Enable shadow sprites. 2014-07-20 21:46:21 +03:00
Joni Vähämäki
1081471119 EMI: Implement projection shadows. 2014-07-20 21:46:14 +03:00
Joni Vähämäki
930a589569 EMI: Free materials as soon as they are no longer in use by any costumes. 2014-07-19 22:11:24 +03:00
Joni Vähämäki
39fa931012 EMI: Continuously update the look at vector when looking at an actor. 2014-07-05 14:14:53 +03:00
Joni Vähämäki
23a99a9f2b EMI: Implement head limits. 2014-07-02 22:43:58 +03:00
Joni Vähämäki
3adbd1fdcf EMI: Implement head tracking. 2014-07-02 22:43:50 +03:00
Joni Vähämäki
5c20f0f4a7 EMI: Share Materials between Costumes.
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".
2014-06-23 22:36:04 +03:00
Joni Vähämäki
947ddefbc8 GRIM/EMI: Move implementation of setFollowBoxes from header to source file. 2014-06-23 22:34:49 +03:00
Joni Vähämäki
72a7f7c1b0 EMI: GetActorPuckVector should return nil for actors that have never followed walkboxes.
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.
2014-06-22 14:19:52 +03:00
Joni Vähämäki
360c6ee95f EMI: Implemented SetActorLighting. 2014-06-16 15:42:25 +03:00
Joel Teichroeb
08f6e8195d Merge pull request #891 from Akz-/grim-lookat-fix
GRIM: If ActorLookAt is called with an actor as the target, look towards...
2014-06-11 16:59:41 -07:00
Joel Teichroeb
4aa61146c6 GRIM: Convert a few more NULLs 2014-06-02 16:59:09 -07:00
Joni Vähämäki
de3c68d89c GRIM: If ActorLookAt is called with an actor as the target, look towards the actor's head instead of their origin. Fixes #887 2014-05-31 15:59:55 +03:00
Joni Vähämäki
3e322b67ba Revert "EMI: Fix missing hold chores"
This reverts commit 863b33e803.

Conflicts:
	engines/grim/actor.cpp
	engines/grim/actor.h
	engines/grim/costume.cpp
	engines/grim/costume.h
	engines/grim/costume/chore.h
	engines/grim/emi/costumeemi.cpp
	engines/grim/emi/costumeemi.h
2014-05-31 03:05:30 +03:00
Joni Vähämäki
ab1631e6ef EMI: Fade talk chores. 2014-05-31 02:51:46 +03:00
Joseph Jezak josejx@gentoo.org
6951b5c0ee EMI: Remove setYaw. 2014-05-19 15:40:24 -07:00
Pawel Kolodziejski
8759900b6a ALL: synced with ScummVM 2014-04-05 18:18:42 +02:00
Joel Teichroeb
f763dd05ea GRIM: Rename Actor::Chore to Actor::ActionChore 2014-02-21 16:02:25 -08:00
Christian Krause
b35bdd2ddf EMI: Don't stop looping chores in StopAllChores
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
2014-02-21 20:13:11 +01:00
Christian Krause
863b33e803 EMI: Fix missing hold chores
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)
2014-02-21 20:13:05 +01:00
Christian Krause
58d7bf116c EMI/GRIM: Fix rotation of attached actors
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
2014-02-05 21:35:02 +01:00
Dries Harnie
f618b90d31 GRAPHICS: Stencil for grim shadows [OpenGLS] 2014-01-23 20:03:21 +01:00
Joel Teichroeb
7cf3f2f99c GRIM: Add a constructor for Shadow
This lets us get rid of the loop in Actor and lets us ensure
that Shadow is initizlied even if constructed elsewhere.
2014-01-23 10:22:44 -08:00
Christian Krause
71a44ba28a Merge pull request #797 from chkr-private/collision-fixes
Collision fixes
2014-01-14 14:48:52 -08:00
Christian Krause
5a65ffd470 EMI: Unload the active costume once a different is set
- 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
2014-01-08 23:19:46 +01:00
Christian Krause
ce9239412d EMI/GRIM: Implement collision handling for EMI
- 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())
2014-01-07 03:21:52 +01:00
Joel Teichroeb
e570cd5d32 GRIM: A Chore is only valid of _costime isn't null 2013-12-06 15:16:07 -08:00
Dries Harnie
b1a910c800 GRIM/EMI: Refactor GfxBase::startActorDraw 2013-12-04 14:31:06 +01:00
Dries Harnie
fa9a866e54 EMI: Add some accessors to Actor 2013-12-04 13:19:45 +01:00
Joel Teichroeb
58b0bed9ad EMI: Make attached objects use their parents sort order 2013-11-29 16:05:08 -08:00
Ingo van Lil
33005ce43d EMI: Fix actor orientation
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.
2013-11-27 23:28:54 +01:00
Ingo van Lil
4509e4ff34 EMI: Return to original sort order when no sort plane is available
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.
2013-11-25 21:16:45 +01:00