Grim Fandango Remastered has an alpha channel in the
video that plays as intro.
This makes Grim Fandango Remastered start, although there
are still quite a few issues to fix.
The builtin font emerFont is currently used to display FPS.
Each graphics engine reads this array to render each of the 96 characters,
from 32 to 127 the ASCII table.
TinyGL and OpenGL-shaders read the array out of bound because they read
data for the 96th character in emerFont that only describes 95.
No problem was hightlighted with OpenGL engine because it only read 95
characters, with no consequence as the character 127 is DEL, so never
displayed.
To be compliant with the global implementation, data for character 127
is added in emerFont (will display nothing) and the OpenGL engine is
changed accordingly.
In EMI and GRIM games, a resource leak was found with OpenGL and
OpenGL-shaders engines: releaseMovieFrame() was not called in the destructor
of these graphics drivers (and never called at all on exit).
This patch calls explicitely realeaseMovieFrame.
Note that is was already done correctly with TinyGL.
Reduces vertex redundancy.
In TinyGL, fixes checkbox border on Copal computer (actually, works around
yet another discrepancy between OpenGL and TinyGL on 1-pixel-thick
[T]GL_QUADS).
Enabling quadratic atenuation, even with values as low as 0.1, reduces spot
lighting too much in (at least) sets "do" (see Domino), "al" (see Manny when
walking along the garage door), "hq" (see Salvador).
Disabling is not perfect either, as attenuation can be seen (at least) in
set "tu" (see fire extinguisher), but it should be overall better.
Also, it should be noted that perfect fidelity cannot be achieved with openGL
fixed pipeline, as DirectX spotlight have two angles (0 <= phi <= theta <= pi),
atenuation being null below phi, full above theta, transitioning with a
configurable exponent between both (defaults to angle-linear). OpenGL would
correspond to phi=0 and theta=pi (ie, transition is always done between fixed
angles), plus a configurable hard cutoff.
Determined by enabling a single omnidirectional light (newlight9 in set
"ce", which stands at set entrance toward elevator) and comparing
luminosity level on Manny at several locations in that scene with original
software renderer.
This set is quite convenient for this comparison, as Manny position can be
easily controlled: stick to the wall with the red arrow pointing at the
stairs, making movements one-dimensional.
For spotlight, set "tu" was used with the single spotlight on, walking
from the fire extinguisher to server door, confirming similar attenuation.
From these tests, it seems only quadratic attenuation is used, which makes
sense as it gives a realistic effect.
Determined by keping a single directional light source enabled, as they are
not subject to attenuation (having no position), and comparing with
original software renderer.
Default DirectX material reflects all diffuse light, so 1.0f coefficient is
likely correct.
My initial idea that GRIM would use specular likely came from a difference
between DirectX and OpenGL lighting for spotlights: DirectX allows for an
extra penumbra angle, allowing stronger center spots while maintaining a
smooth fade (which I emulated with a fixed 2.0 exponent).
Also, specular involves an extra light color value and material definition
for specular reflection, which are not visible in game data files.
All this making the use of specular very unlikely to match original renderer.
Instead of using the number of sub-images to decide whether bitmaps
should be drawn using TIL information, better use the existance
of texture coordinates which are distinctive for tiles.
Use bit 0x20 in the mesh face flags to disable ligthing. This
fixes the problem that once a previous screen is used as
texture (e.g. in the intro or for the transition effects
in set kab when walking eastwards or westwards), it is shown
too dark due to the applied static lighting for overworld
actors.
- 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)