Commit graph

1540 commits

Author SHA1 Message Date
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
hispidence
a00f3a23fb Implement GiveInvItem, TakeInvItem, GetInvItemCount and SetInvItemCount (names to be finalized). 2021-07-10 14:05:01 +01:00
hispidence
9823087e32 Separate the logic for giving/taking inventory items from pickup.cpp and into its own set of files. It's not a perfect solution but it makes it somewhat cleaner and reduces the places where we have to make sure we're writing the correct enums/magic numbers.
Implement inventory item removal and GetInventoryCount for all items listed in PickedUpObject (except for ID_GOLDROSE_ITEM).

Make RemoveObjectFromInventory and GetInventoryCount take GAME_OBJECT_ID instead of short.
2021-07-10 13:54:15 +01:00
MontyTRC89
c1bfae6bf9 Refactored cameras, sinks and sound sources; Added sound sources playback; 2021-07-10 06:55:37 +02:00
Troye
1cf0aef90d Add more anims to NewAnims; Fix lean 2021-07-09 19:41:56 -05:00
Troye
c6cb23af9f fix control selection screens 2021-07-08 17:57:08 -05:00
Troye
e201df8f97 clean up larainfo; add anim bools' 2021-07-08 14:15:14 -05:00
MontyTRC89
99f476f3b9 Made LUA script optional; Deleted my bugged test code for volumes; 2021-07-06 11:54:34 +02:00
MontyTRC89
7daed7abb6 Merge branch 'NewLuaScripting' 2021-07-06 11:47:17 +02:00
MontyTRC89
918e6704c6 Merge branch 'master' of https://github.com/MontyTRC89/TR5Main 2021-07-06 04:55:01 +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