Commit graph

8102 commits

Author SHA1 Message Date
hispidence
94c6ada241 Update Level documentation. 2021-08-11 14:50:10 +01:00
hispidence
55e7de24b8 Add default member initialisers and default constructor for GameScriptRotation.
These aren't intended (at the moment) to be exposed to the script writer; it's needed so that classes with a GameScriptRotation member can have a default member initialiser.
2021-08-11 14:39:26 +01:00
hispidence
2d1e2d97b9 Add default member initialisers, SetSlot function, and default constructor for GameScriptInventoryObject.
Expose default constructor to Lua API. Use SetSlot as a sol::property instead of accessing the member directly.

Update documentation.
2021-08-11 14:38:24 +01:00
Lwmte
7b9f01a1c4 Fix some lasersight issues 2021-08-11 15:18:22 +03:00
Lwmte
080658c416 Fix #289 2021-08-11 13:10:22 +03:00
hispidence
5cbdfcd578 Make it explicit that item_options is a 64-bit int. 2021-08-11 01:29:38 +01:00
hispidence
686a4902a5 Update GameFlowScript to account for the changes made to GameScriptInventoryObject.
Add FROM_DEGREES calls to fix the "rot" property.
2021-08-11 01:28:37 +01:00
hispidence
156342ca14 Register GameScriptRotation in GameFlowScript and not GameLogicScript. 2021-08-11 01:26:35 +01:00
hispidence
25d90c9820 Refactor and add documenation for GameScriptInventoryObject. 2021-08-11 01:23:07 +01:00
hispidence
8453ce49a7 Fix wrong name in ItemInfo documentation. 2021-08-11 01:21:11 +01:00
hispidence
c21f2ac829 Rename some of GameScriptLevel's Lua "members" to better reflect their purpose.
Add documentation that was missing.
2021-08-09 20:02:55 +01:00
hispidence
0c58e78733 Fix clusterfuck of a sentence. 2021-08-09 20:01:39 +01:00
hispidence
4fb42ab59b Give InventoryObject some documentation. Rename "name" to "nameKey". 2021-08-09 20:01:05 +01:00
hispidence
7300193b47 More cleanup. 2021-08-09 00:54:09 +01:00
hispidence
15da537331 Clean GameScriptInventoryObject a bit. 2021-08-09 00:22:58 +01:00
hispidence
3c93a7bc78 Add some initial documentation for GameScriptMirror. 2021-08-09 00:07:53 +01:00
hispidence
9df901ec1f Remove ResetHub; as it's almost certainly going to be made obsolete with the new scripts and save game rework. 2021-08-09 00:07:08 +01:00
hispidence
25e92b6dbd Add ItemEnumPair.h to the project files. 2021-08-09 00:03:13 +01:00
hispidence
61d9e00e63 Change InventoryAdd/Remove/GetCount/SetCount and GameScriptInventoryObject to use ItemEnumPair. 2021-08-09 00:01:40 +01:00
hispidence
05054a05fe Make the read-only table of kInventorySlots in GameFlowScript instead of GameLogicScript. 2021-08-08 23:53:52 +01:00
hispidence
93380eb761 Modify InvItem table to map to both GAME_OBJECT_ID and inv_objects. We can't use a std::pair directly since sol::as_table will interpret the unordered_map weirdly if we do. 2021-08-08 23:52:38 +01:00
hispidence
2d48007ef8 Change waterskin add/remove behaviour.
If the script adds a waterskin of X litres, we will overwrite the waterskin that's already there, if any (assuming the requested waterskin and the one the player has are both small or both large).

If the script tries to remove a waterskin of X litres, the player will only lose their waterskin if it has EXACTLY X litres. If their waterskin has Y litres, it will remain in the inventory.
2021-08-08 23:42:30 +01:00
hispidence
8e6ff2faee Fix what seems to be a copy-paste error (sky layer 2 doesn't seem to be implemented right now anyway, but still). 2021-08-07 19:25:55 +01:00
hispidence
0d8b9c881b Scope TITLE_TYPE usage. 2021-08-07 19:25:13 +01:00
hispidence
0974fc091c Fix old LARA_DRAW_TYPE usage with LARA_TYPE constants.
These don't need to be scoped, but I originally made it an enum class and plan to end up doing so down the line anyway, and this should save a bit of time there.
2021-08-07 19:24:39 +01:00
hispidence
361d22aa82 Make Renderer11::Initialise use TitleScreenImagePath instead of Background. 2021-08-07 19:20:56 +01:00
hispidence
c96a92f1cb Improve GameScriptLevel.
Rename LARA_DRAW_TYPE to LARA_TYPE as it's used in more than just drawing code. Make WEATHER_TYPE a scoped enum (would have done this for LARA_TYPE too but didn't want to pepper casts in other parts of the codebase). Relabel constants in both enums.

Add kLaraTypes and kWeatherTypes and add them as tables in GameFlow.

Remove Background member - it's not level-specific so GameFlow is a better home for it.

Add (incomplete for now) documentation for some GameScriptLevel members - those I tested, at any rate.
2021-08-07 19:20:17 +01:00
hispidence
4a2e61fcbc Don't register Color in GameScript (it's in GameFlow now). 2021-08-07 19:14:11 +01:00
hispidence
e409222739 Clean up GameFlowScript.
Remove a lot of members which were unused and which represented level properties already accounted for in GameScriptLevel.

Make TITLE_TYPE an enum class and relabel its values.

Add TitleScreenImagePath and SetTitleScreenImagePath, which replaces GameScriptLevel's Background member.

Register GameScriptColor in GameFlowScript since we will be using it for the fog and sky layer properties of levels.
2021-08-07 19:13:36 +01:00
hispidence
10111e2df2 Improve GameScriptSkyLayer.
Make its constructor take a GameScriptColor, and give it a SetColor function, exposing it to Lua as the color member.

Add documentation.
2021-08-07 19:06:22 +01:00
hispidence
af5b32c929 Clean up GameScriptColor.
Give it default member initialisers and a delegating constructor and expose the four-component version to Lua.
2021-08-07 19:03:27 +01:00
hispidence
2d4c091b64 Make MakeReadOnlyTable a member function of LuaHandler so that GameFlow can use it too. 2021-08-07 19:00:45 +01:00
hispidence
339a95c6e4 Wrap some WinMain script calls in a TenScriptException try-catch block to log any errors happening in GameFlow/GameScript construction and GameFlow loading. 2021-08-07 18:59:36 +01:00
hispidence
7bc9e7b935 Replace a TENLog call with ScriptWarn, so that it won't get logged in ERROR_MODE::SILENT. 2021-08-06 16:48:03 +01:00
hispidence
dc40060a63 Make m_levelFuncs an unordered_set, as these seem to be the proper structure to use when the key IS the value.
Make all GameScript maps unordered_maps, as these are supposed to be more suitable for cases where we don't need the data to be sorted.

Add default member initialisers to GameScript.
2021-08-06 16:47:24 +01:00
hispidence
7d26686836 Add ErrorMode to GameScriptSettings (C++) and errorMode to settings (Lua). Call SetErrorMode in LoadGameFlowScript. 2021-08-06 16:44:37 +01:00
hispidence
032f824870 Add ScriptWarn and SetErrorMode.
SetErrorMode is called via Lua in settings.lua to allow us or the LD to choose between the three ERROR_MODEs for script asserts.

ScriptWarn is for when we want to follow up on a failed assert in ERROR_MODE::WARN. e.g. if the player gives in an invalid HP value, we would ScriptWarn to tell them that the HP is being set to zero instead. If we added this information in ScriptAssert, we would end up displaying this message in TERMINATE mode, too - which is incorrect, since we won't have set the HP to zero, as we will have terminated the game.
2021-08-06 16:43:01 +01:00
hispidence
60a3ae227c Fix logic error in TENLog. We DO want to print LogConfig::Debug logs in debug mode. 2021-08-06 16:38:05 +01:00
Lwmte
77ab74bc3e Fix gunflash drawing 2021-08-06 13:41:37 +03:00
Lwmte
a43cb7506d Fix git mess 2021-08-06 12:21:16 +03:00
Lwmte
47aa2a5b68 Add alternate way to make a debug box 2021-08-06 12:18:28 +03:00
Lwmte
2bdb851092 Reorder renderer operations, redo debug output (use F10-F11 to switch pages), add debug sphere/box drawing 2021-08-06 11:12:34 +03:00
hispidence
7229f99ff3 Add InventorySlots.h to the project, seems I missed this the first time round. 2021-08-05 21:37:12 +01:00
hispidence
354b21d4f4 Add m_levelFuncs and SetLevelFunc. These correspond to the table "LevelFuncs", which will hold trigger functions and the OnStart (etc) callbacks. Putting them into a table will make it much easier to discard them when the player goes from one level to another (through loading a save or finishing the current level).
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.
2021-08-05 21:36:18 +01:00
Lwmte
b25ba9e71e Rollback flame sizes 2021-08-05 16:12:10 +03:00
Lwmte
f9831ee892 Add support for sphere volumes 2021-08-05 15:46:03 +03:00
Lwmte
2e1bb88e5b Don't call nonexistent volume functions 2021-08-05 14:56:09 +03:00
Lwmte
316102fa33 Update level.cpp 2021-08-05 14:51:15 +03:00
Lwmte
408bbf8e73 Fix controls lockup if level was changed during flyby with disabled controls 2021-08-05 14:26:23 +03:00
Lwmte
d4c5304cf0 Fix spheres 4th time, fix alloc of TR4/5 objects 2021-08-05 13:31:42 +03:00