Open main menu

Difference between revisions of "GrimE"

54 bytes added ,  10:56, 14 October 2020
no edit summary
(Created page with "{{EngineDescription| name=GrimE| developer=aquadran, somaen| companies=LucasArts| usedBy=[[Grim Fandango]...")
 
Line 1: Line 1:
{{EngineDescription|
{{EngineDescription|
         name=GrimE|
         name=GrimE|
         developer=[[User:aquadran|aquadran]], [[User:somaen|somaen]]|
         developer=[[User:aquadran|aquadran]], [[User:botje|botje]], [[User:giucam|giucam]], [[User:klusark|klusark]], [[User:somaen|somaen]]|
         companies=[[LucasArts]]|
         companies=[[LucasArts]]|
         usedBy=[[Grim Fandango]], [[Escape from Monkey Island]]|
         usedBy=[[Grim Fandango]], [[Escape from Monkey Island]]|
Line 17: Line 17:
== Structure ==
== Structure ==
=== Scripting - Lua ===
=== Scripting - Lua ===
GrimE uses a modified version of [http://www.lua.org/manual/3.1/ Lua 3.1] alpha as script engine. It interacts with the engine through a set of global C functions defined in the [https://github.com/residualvm/residualvm/tree/master/engines/grim grim/lua*.cpp] files, which can be called by the scripts.
GrimE uses a modified version of [http://www.lua.org/manual/3.1/ Lua 3.1] alpha as script engine. It interacts with the engine through a set of global C functions defined in the [https://github.com/scummvm/scummvm/tree/master/engines/grim grim/lua*.cpp] files, which can be called by the scripts.


The main difference with the original version is multi-tasking support. The function start_script, callable by the scripts, create a new lua state, which lives together with the original one. The function lua_runtasks() updates all the states. The states are managed by the functions start_script, stop_script, (un)pause_script, find_script.
The main difference with the original version is multi-tasking support. The function start_script, callable by the scripts, create a new lua state, which lives together with the original one. The function lua_runtasks() updates all the states. The states are managed by the functions start_script, stop_script, (un)pause_script, find_script.
Line 23: Line 23:
The function lua_Save is invoked when saving a game and it writes the entire Lua state to disk. This information is restored by lua_Restore upon game load.
The function lua_Save is invoked when saving a game and it writes the entire Lua state to disk. This information is restored by lua_Restore upon game load.


The management of user objects in Lua is different from the upstream version. Instead of the pointer to the object itself Lua stores an unique id for the object (see Grim::PoolObject), which is later used to get the object from a pool. So the objects are now not saved into a TaggedString anymore, but with this new struct into the "Value" union, in [https://github.com/residualvm/residualvm/blob/master/engines/grim/lua/lobject.h#L54 lua/lobject.h]:
The management of user objects in Lua is different from the upstream version. Instead of the pointer to the object itself Lua stores an unique id for the object (see Grim::PoolObject), which is later used to get the object from a pool. So the objects are now not saved into a TaggedString anymore, but with this new struct into the "Value" union, in [https://github.com/scummvm/scummvm/blob/master/engines/grim/lua/lobject.h#L54 lua/lobject.h]:
<pre>
<pre>
typedef struct UserData {
typedef struct UserData {
Line 34: Line 34:
GrimE uses the good old iMuse for playing music and sound effects.
GrimE uses the good old iMuse for playing music and sound effects.


iMuse is controlled by the scripts through the use of these functions, defined in [https://github.com/residualvm/residualvm/blob/master/engines/grim/lua_v1_sound.cpp lua_v1_sound.cpp]:  
iMuse is controlled by the scripts through the use of these functions, defined in [https://github.com/scummvm/scummvm/blob/master/engines/grim/lua_v1_sound.cpp lua_v1_sound.cpp]:  


* ImStartSound();
* ImStartSound();
161

edits