Commit graph

191 commits

Author SHA1 Message Date
hispidence
dba2f8ac91 Delete copy operations for GameScriptAIObject, GameScriptCameraInfo, GameScriptSinkInfo and GameScriptSoundSourceInfo - this can be changed later, but for now is a safety measure since we hold a reference, which means copying these would take some extra thought. 2021-07-26 18:25:50 +01:00
hispidence
e33e821cb8 Clean up GameFlow and GameScriptLevel by adding default member initialisers. Replace GameScriptFog with GameScriptColor. Rename some enums for consistency. Make TITLE_TYPE and enum for consistency. 2021-07-26 18:23:29 +01:00
hispidence
9dd4bcf4ca Add SOUND_SOURCE_INFO and AI_OBJECT names when loading in the level data. Implement remaining functions on the GameLogicScript side. 2021-07-24 12:45:33 +01:00
hispidence
07d8a254b9 Fix comment. 2021-07-24 12:29:54 +01:00
hispidence
cf8723c448 Add GameScriptSoundSourceInfo and GameScriptAIObject, and associated functions. 2021-07-24 12:29:25 +01:00
hispidence
6720fb2318 Make color getters const. 2021-07-24 12:26:48 +01:00
hispidence
b0089ef059 Make GetString return a char const *.
Make Intro a char const *.
2021-07-23 21:48:49 +01:00
hispidence
16a5998abc Declare WarningsAsErrors so that files which end up indirectly including GameScriptNamedBase.h don't complain 2021-07-23 21:43:08 +01:00
hispidence
97d5d85f7a Add AddLuaNameSink, RemoveLuaNameSink, and GetSinkByName.
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.
2021-07-23 16:02:30 +01:00
hispidence
278a52c49a Add GameScriptSinkInfo/SinkInfo. 2021-07-23 15:59:13 +01:00
hispidence
c13106252f Add m_camerasMapName, AddLuaNameCamera, RemoveLuaNameCamera, GetCameraByName, and GetMeshByName. 2021-07-23 02:09:52 +01:00
hispidence
1be51d0f9f Add GameScriptCameraInfo.h and GameScriptCameraInfo.cpp. 2021-07-23 02:08:13 +01:00
hispidence
c0c4310bed Add __tostring metamethod to GameScriptPosition, GameScriptRotation and GameScriptColor.
Make their properties lowercase to keep them consistent with the properties of other classes.

Move documentation from GameScriptPosition.h to GameScriptPosition.cpp.
2021-07-23 02:06:50 +01:00
hispidence
38291e7b60 Add m_temporary to GameScriptMeshInfo, as well as a constructor and destructor.
Fix documentation.

Remove duplicated pos property.
2021-07-23 02:04:47 +01:00
hispidence
1af07aa8b5 Rearrange GameScriptItemInfo a bit.
Exchange m_temporary in the move constructor.
Fix documentation to reference ObjID instead of int.
2021-07-23 02:03:31 +01:00
hispidence
16ea0f1aa2 Add documentation and constructor member initialisers for GameScript. 2021-07-21 18:19:57 +01:00
hispidence
936b7b36b6 Add conversions between GameScriptColor and Vector3/Vector4. 2021-07-21 18:18:51 +01:00
hispidence
f46e6222a2 Add GameScriptMeshInfo. This is still a fairly skeletal class for the time being. 2021-07-21 18:17:30 +01:00
hispidence
3d464becb2 Make GameScriptItemInfo inherit from GameScriptNamedBase and remove functions which now reside there. 2021-07-21 18:16:35 +01:00
hispidence
c82a505b67 Add GameScriptNameBase, which will serve as a base class for the GameScriptXInfo classes to avoid having to specify static callback-assignment functions and index metafunctions for each one individually. 2021-07-21 18:14:43 +01:00
hispidence
da5af327e9 Link up MeshInfo with GameLogicScript, adding a m_meshesMapName and implementing AddLuaNameMesh and RemoveLuaNameMesh.
Add GetMeshByName and make GetItemByName take a constant reference.

Remove no-longer-used headers.
2021-07-21 18:12:17 +01:00
hispidence
12dada0145 Make the "Lara" global non-owning. Will look into this and see if we actually need it. 2021-07-21 18:09:53 +01:00
hispidence
df11377a51 Make GetItemByName take a const ref, and make its error print the name of the item that could not be found.
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).
2021-07-20 17:58:11 +01:00
hispidence
bf9bd13095 Make GameScriptColor::Register static. 2021-07-20 17:53:10 +01:00
hispidence
893c176c0c Move documentation from GameScriptRotation.h to ".cpp. 2021-07-20 17:49:14 +01:00
hispidence
12b28a38c6 Add Register function and documentation for GameScriptColor, since it will be used in GameScriptMeshInfo. 2021-07-20 17:48:39 +01:00
hispidence
ffa8791c03 Add concept of 'temporary' ItemInfo instances. These instances will kill the ITEM_INFO they reference when they are destroyed. This was previously the default behaviour. However, now that we're using things like GetItemByName, it makes more sense for ItemInfos to be non-owning by default.
Move LDoc from GameScriptItemInfo.h to GameScriptItemInfo.cpp. This might seem counter-intuitive, but LDoc is concerned with the Lua interfaces rather than the actual C++ functions; since the Lua interfaces are defined in GameScriptItemInfo::Register, it makes more sense for the comments to be nearby.
2021-07-20 17:18:39 +01:00
hispidence
e9b2026404 Make the contents of ObjectIDs.h part of the Lua interface. 2021-07-20 00:16:15 +01:00
hispidence
298f3905ec Add ObjectIDs.h. Add documentation comments to InventorySlots.h 2021-07-20 00:14:59 +01:00
hispidence
f379de7c89 Add m_initialised to GameScriptItemInfo. This is possibly temporary, and controls whether SetRoom calls ItemNewRoom or just sets the room number. This is because ItemNewRoom relies on InitialiseItem having been called, but InitialiseItem requires the roomNumber of the object to be correct.
Add and document GetLara.
2021-07-20 00:10:00 +01:00
MontyTRC89
81611e2bdd Added LUA name insertion on items loading; Fixed item rooms change (use ItemNewRoom); 2021-07-19 05:52:21 +02:00
hispidence
07d9fdae2f Add SetAnimNumber, GetAnimNumber, SetFrameNumber and GetFrameNumber. Fix SetGoalAnimState call. 2021-07-18 17:37:39 +01:00
hispidence
6e11570e3f Rename «Current/Goal/Required»Anim to «Current/Goal/Required»AnimState. 2021-07-18 15:29:40 +01:00
hispidence
21a867e821 Remove 'typedef' from enums and structs. This was required in C, but in C++ all it does is generate thousands of warnings. 2021-07-18 15:22:15 +01:00
hispidence
82e73efc27 Add initial documentation comments for GameScriptPosition and GameScriptRotation. 2021-07-17 23:51:01 +01:00
hispidence
552a4f07ae Fix some whitespace. 2021-07-17 23:50:10 +01:00
hispidence
5c30fdee5d Implementations for GameScriptItemInfo member functions «Get/Set»ObjectID, «Get/Set»Name, and default implementations for the callbacks. 2021-07-17 23:48:35 +01:00
hispidence
70d7ae4572 Add GameScriptItemInfo::«Set/Get»ObjectID and GameScriptItemInfo::SetNameCallbacks.
Add calls to the callbacks to GameScriptItemInfo::SetName, so that giving a Lua name to an object removes its existing object and any other object currently using the new name, before then putting the name into the map.

Add initial documentation for the Lua-exported parts.
2021-07-17 23:47:07 +01:00
hispidence
011e1a9bf4 Uncomment ExecuteFunction and make it take a const ref.
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).
2021-07-17 22:26:07 +01:00
MontyTRC89
f0698a3c80 Added code (to finish) for executing LUA triggers 2021-07-17 05:56:40 +02:00
MontyTRC89
8294e73199 Merge remote-tracking branch 'origin/lara_info'
# Conflicts:
#	TR5Main/Game/Lara/lara_flare.h
#	TR5Main/Scripting/GameLogicScript.cpp
2021-07-14 05:48:42 +02:00
Troye
7b0025a1c9 FLARE_AGE constant; fix dynamic light intensity; fix release builds 2021-07-13 22:29:47 -05:00
hispidence
a0ced5c34e Make GameLogicScript use kInventorySlots. Make InvItem a read-only table. This means we do not need to write an enum directly in the Lua source. 2021-07-13 13:21:13 +01:00
hispidence
aa4f7f6526 Add map from inventory slot string keys to their GAME_OBJECT_ID counterpart. 2021-07-13 13:17:31 +01:00
hispidence
a00f3a23fb Implement GiveInvItem, TakeInvItem, GetInvItemCount and SetInvItemCount (names to be finalized). 2021-07-10 14:05:01 +01:00
MontyTRC89
99f476f3b9 Made LUA script optional; Deleted my bugged test code for volumes; 2021-07-06 11:54:34 +02:00
hispidence
61d5767035 Add and register "name" getter and setter for the string ID of an item. 2021-07-05 18:19:10 +01:00
hispidence
34859c154f Make InventoryAdd and InventoryRemove static. Add them as Lua functions. 2021-07-05 18:18:20 +01:00
hispidence
de165aaa04 Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TombEngine into NewLuaScripting 2021-07-05 18:14:06 +01:00
MontyTRC89
d85d624609 Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting
# Conflicts:
#	TR5Main/Game/control.cpp
#	TR5Main/Scripting/GameScriptItemInfo.cpp
2021-07-05 16:38:22 +02:00