Commit graph

1650 commits

Author SHA1 Message Date
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
bbbca5849d Call AddLuaNameMesh in ReadRooms. 2021-07-21 18:21:10 +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
fc1add2329 Add new files to the project. 2021-07-21 18:18:02 +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
5dfb1acca2 Use markdown when generating docs. 2021-07-20 00:19:56 +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
66013143f6 Set luaName to blank in CreateItem to indicate the lack of a name. 2021-07-17 23:49:40 +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
hispidence
a3978af613 Add LDoc config and CSS template used for generating Lua API documentation. 2021-07-17 22:13:15 +01:00
MontyTRC89
f0698a3c80 Added code (to finish) for executing LUA triggers 2021-07-17 05:56:40 +02:00
MontyTRC89
0caaab8c52 New volume triggers logic 2021-07-16 11:13:57 +02:00
MontyTRC89
3836ed7a26 Fixed volumes and added debug message 2021-07-15 10:56:03 +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
MontyTRC89
1b60545b4a Merge branch 'master' of https://github.com/MontyTRC89/TR5Main 2021-07-14 05:30:04 +02:00
Troye
7b0025a1c9 FLARE_AGE constant; fix dynamic light intensity; fix release builds 2021-07-13 22:29:47 -05:00
MontyTRC89
fcc4e4465d Added LUA name for statics; LUA names refactoring; 2021-07-14 05:29:23 +02: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
cf0a415527 Remove ID_GOLDROSE_ITEM; the current plan is for secrets to be done via triggers instead of the pickup itself. 2021-07-12 16:13:52 +01:00
hispidence
78e8e52ef7 Use GetInventoryCount in have_i_got_object as it works the same way. 2021-07-11 17:10:35 +01:00
hispidence
54a7f80785 Forgot header in last commit. 2021-07-11 17:09:24 +01:00
hispidence
1d02f69496 Change AddDisplayPickup to use GAME_OBJECT_ID. 2021-07-11 17:04:41 +01:00
hispidence
10aec3d6f2 Make some functions take a GAME_OBJECT_ID instead of a short. Make AIOBJECT use a GAME_OBJECT_ID instead of a short. 2021-07-11 16:55:20 +01:00
hispidence
f7e79a1768 Add += operator and from_underlying function, because for some reason C++ doesn't like implicitly converting between an enum and its own underlying type.
These ONLY work for the type itself and its underlying type - this means the compiler will notify us if we try and use an int or long instead of a bool, and we can double check to make sure it is intended.
2021-07-11 16:50:29 +01:00
hispidence
0f0e439675 Forgot to commit this comment earlier. 2021-07-11 13:08:23 +01:00
hispidence
3485b5d5d4 Make GAME_OBJECT_ID a short in its underlying type (since that's the type that's mostly used to refer to it) and remove typedef to make VC++ stop giving tons of warnings. 2021-07-11 13:07:50 +01:00
hispidence
26702fab86 Make some ints to GAME_OBJECT_ID and add comments. 2021-07-10 18:01:10 +01:00
hispidence
42a11f2118 Call title script if present. 2021-07-10 17:51:01 +01:00
hispidence
a0257f5fb5 Cast to GAME_OBJECT_ID. 2021-07-10 17:46:45 +01:00