Rework Level and Game tables as they weren't entirely working before. These correspond to m_locals and m_globals, which hold the level-specific and game-spanning data that will go into save files.
Make GetVariable and SetVariable take sol::table args. Sol seems to require this in order to use them as metamethods of a table (it doesn't require them for usertypes, but it seems more logical from the API point of view for Level and Game to be tables).
Add documentation for the above tables.
Move several functions out of the GameScript class in order to simplify its interface, and make them static functions that only live in GameLogicScript.cpp.
Remove g_GameScript from GameLogicScript.cpp as it's not used there; let winmain.cpp deal with it instead.
For recoverable errors, add some recovery behaviour and logging so a level designer can see in the log what was done as a result of the error.
Warn about default behaviour if no callbacks are added.
Treat functions as global that would previously be accessed through the GameFlow table. This does pollute the global environment in Lua a bit, but keeps it consistent with the functions in GameLogicScript, which are all accessed as globals.
Add some default member initialisers.
Remove WriteDefaults. Rename Intro to IntroImagePath and make it a std::string.
Add some documentation for the functions of GameFlowScript.
Fix some comments.
Make a template that all GetXByName member functions work off, to reduce copypasted functions.
For consistency, rename RemoveLuaName and AddLuaName to RemoveLuaNameItem and AddLuaNameItem.
Fix some documentation comments, order function documentation into sections.
Register GetItemByName in GameLogicScript instead of winmain. Register GameScriptColor too.
Define the lambdas passed to GameScriptItemInfo in terms of the actual functions we define. Functions that make a GameScriptItemInfo should pass false to make_unique (so the Lua object made does not control the lifetime of the ITEM_INFO).
Make «Add/Remove»LuaName return a bool for future error checking, and pass them via lambdas to GameScriptItemInfo, allowing it to call them whenever an object is added or removed (they would not have access to the m_itemsMapName otherwise).
- started moving structure out of types.h.
- fixed ExtraAnim using 0 instead of -1.
- changed void(*)(); to function<> for lara routines.
- changed short(*)() effect to function<> for CreatureEffect/CreatureEffect2.
- renamed guardian to laserhead.
- moved some structure to their right place.
- renamed TYPE_ZONE to ZoneTypeEnum.
- fixed zoneType not using ZoneTypeEnum as variable.
- fixed LOT.zone not using ZoneEnumType.
- changed "variable : 1" to bool in some structure.
- implemented @krys new collision structure and improved it a bit (but commented for "later")
- level need #pragma pack(push, 1) #pragma pack(pop) to work (for structure), else it crash at LoadTexturesInfos().
Co-Authored-By: krys <krys@users.noreply.github.com>