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.
Merge pull request #761 from inguin/emi-fixes

EMI: Fix invisible floor in the Hall of Justice
EMI: Use uint32 to store actor alpha mode

Storing the actor's alpha mode in a byte does not work when the value is
negative (AlphaOff == -1).
EMI: Save/restore state of costumes

EMICostume overrides the parent class's saveState/restoreState methods with
NOP functions, causing a great number of graphical glitches after restoring
a savegame. EMI costumes do not seem to have any additional dynamic state,
so the parent save and restore methods work just fine.
EMI: Fix display of "dock" video

During the run of the "dock" video (first arrival at melee island) only
a black screen was displayed although the sound did work.
The lua code dims (_dimLevel = 1) the scene before showing a video so
that only the video is visible. GfxOpenGL::drawBitmap sets the current
color according to the dim level before it starts drawing the bitmap:

glColor3f(1.0f - _dimLevel, 1.0f - _dimLevel, 1.0f  - _dimLevel);

If there is no other glColor* call before drawing the video, the current
color stays (0, 0, 0) and the video won't be visible.

The bug fix resets the color to (1.0, 1.0, 1.0) after the drawing of the
bitmap at the end of GfxOpenGL::drawBitmap.
EMI: Fix turn_rate of voodoo chair

The turn rate for the chair of the voodoo lady is set to 1 in the lua
code which makes the turn animation very slow (> 30s).

Since the rate value of 1 is not used otherwise in EMI, adjust the
turnrate in this case.
Merge pull request #763 from inguin/emi-fixes

EMI: Savegame fixes
Merge pull request #764 from chkr-private/emi-fixes

EMI: various small bug fixes
GRAPHICS: Fix off-by-one error in software renderer
EMI: Fix color of menu entries

The highlighted menu entry is sometimes not correctly colored.
There are multiple textObjects per string (one for each color) and
residualvm draws them in an unspecified order.

To ensure that the correct textObject is drawn on top, each
object gets a layer attribute assigned by the lua code.

The patch adds the layer attribute to the runtime engine and orders the
textObjects by layer before drawing them.
Merge pull request #765 from chkr-private/menu-text-fixes

EMI: Fix color of menu entries
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.
EMI: Add volume/balance support to Poolsound/Track

Add volume and balance support. If a track is already playing, update
the values via the mixer accordingly.
EMI: Add comment and fix special handling in Imuse

Add a comment about the input/output range of:
Imuse::setPan (0 ... 127)
Imuse::getPan (-127 ... 127).

The value is stored internally as 1000 * input range
(0 ... 127000), so a value of 6400 is not possible:

int getPan() const { return (pan != 6400) ? 2 * (pan / 1000) - 127 : 0;
}

Changing to 64000 which roughly corresponds with a balance of +/- 0.
EMI: Implement sound-panning for EMISound

Implement sound-panning for EMISound and add a comment to document
the input range of EMISound::setPan.
Merge pull request #767 from inguin/emi-actor-yaw

EMI: Fix actor orientation
GRIM: Add a const_cast as making ts const is not worth the effort
EMI: Fix the intro at cs_dock getting stuck in the PS2-version.

IsActorChoring takes different parameters in EMI than it does in Grim,
the original code was prudent enough about checking it’s parameters that
it actually ran fine, however the problem was that the argument that
said whether we should ignore looping chores was moved. This lets the
intro play the cut scene on the docks.
EMI: Allow movie skipping in the PS2-version.

Catch the ESC-key event manually for the PS2 version,
to allow skipping movies. (This also eats up the ESC-key event,
to avoid passing it on to lua afterwards).
EMI: Avoid updating lua while playing movies in the PS2-version.

Otherwise the scripts that start after a movie start prematurely, in the
case of the dock intro, this means that the dialogue on the docks starts
playing at the same time as the arrival video starts playing. With this
fix we avoid that issue, resuming operation as normal only when the movie
is finished.