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
MontyTRC89
34862c94e7
Added trigger volumes experimental
2021-07-05 16:33:50 +02:00
hispidence
a29326f407
Add an index metafunction that throws an error. This will prevent the end user from accidentally reading a value which does not exist (as happened to me because of a typo).
2021-07-04 14:37:50 +01:00
hispidence
2dd4f546fa
Make SetHP only throw an error if the item represents something intelligent - as it stands, with one of the constructors requiring a HP value, it makes the most sense to just allow HP to be set for a non-intelligent item, as it seems said value is ignored by the engine, anyway.
2021-07-04 14:36:01 +01:00
hispidence
33dcd85a06
Register SetAmbientTrack and PlayAudioTrack. Make PlayAudioTrack static, pass its string arg by reference-to-const, and let it use the loop bool passed in instead of the one stored in global state.
...
Improve some text formatting in the header.
2021-07-04 14:33:57 +01:00
hispidence
9386993bcd
Make SetAmbientTrack take a string by const ref. Change functions to access GameScript[Position/Rotation] members directly instead of via getters/setters.
2021-07-03 23:18:10 +01:00
hispidence
474cf41a7d
Add doCallback function to throw an exception if one of the callback encounters an error (and if WarningsAsErrors is on).
2021-07-03 23:16:28 +01:00
hispidence
0d082bea8b
GetCurrentAnim -> SetCurrentAnim
2021-07-03 23:14:58 +01:00
hispidence
2def69f79a
Change most Getters and Setters into assignments. Change GameScriptItemInfo to use new PHD_3DPOS -> GameScript[Position/Rotation] constructor. Add value conversions/corrections to Get/SetRot.
2021-07-03 23:14:09 +01:00
hispidence
73bf4d24a1
Clean headers a bit.
2021-07-03 23:08:46 +01:00
hispidence
3adf79879a
Make GameScriptPosition and GameScriptRotation convertible from PHD_3POS and add a function which puts their position or rotation data into a PHD_3POS. Make their members public since their setters and getters were trivial, aside from some tests which seem to serve no purpose (an int can't be larger than INT_MAX or smaller than INT_MIN).
2021-07-03 23:07:21 +01:00
hispidence
4c02d6a222
Add implementation of GameScript::InitCallbacks and the C++ holders of the callbacks. This might well be a needless layer of indirection, but it prevents the callbacks being reassigned outside of the class.
2021-07-01 19:33:48 +01:00
hispidence
997d31af89
Add m_onStart, m_onEnd, m_onLoad, m_onControlPhase, and m_onSave callbacks. Add InitCallBacks, which assigns the aforementioned member functions and checks that they exist in the script, throwing an exception if not.
2021-07-01 19:31:15 +01:00
hispidence
f22551ab32
Register GameScriptRotation and GameScriptPosition in GameScript constructor. Remove GameScriptItem class, which has been merged into GameScriptItemInfo.
2021-07-01 19:29:58 +01:00
hispidence
3b6e0e1b8c
Merge GameScriptInfo into GameScriptItemInfo. Add move constructor. Make functions use item ptr directly.
2021-07-01 19:27:57 +01:00
hispidence
cabc14dbbc
Add Register and ConvertRotation member functions. ConvertRotation converts from degrees to the -32768 to 32767 system the renderer seems to expect.
...
Changed clamp values to -359 and 359, as 360 = -360 = 0.
2021-07-01 19:25:44 +01:00
hispidence
8bb24e2b34
Add Register to GameScriptPosition. Make member vars private to for consistency with GameScriptRotation.
2021-07-01 19:20:59 +01:00
hispidence
5056ebbb54
Make getters of GameScriptPosition and GameScriptRotation const.
2021-06-30 14:08:46 +01:00
hispidence
56a305b546
Add CreateEmpty, so that new can be called on the Lua side with no args.
...
Change pos and rot from arrays to GameScript[Position/Rotation].
Add getters and setters for the members used so far.
Add Init, which for now is needed to get an item working properly.
2021-06-30 14:08:12 +01:00
MontyTRC89
d25cfb6c92
Moved GameScriptPosition, GameScriptRotation and GameScriptColor classes in separate files
2021-06-29 05:28:17 +02:00
MontyTRC89
b6e74eb4e6
Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting
...
# Conflicts:
# TR5Main/Scripting/GameLogicScript.cpp
2021-06-29 05:03:57 +02:00
MontyTRC89
f81d8e439f
Added FROM_DEGREES function; Added quantity param to PickedUpObject(); LUA scripting refactoring WIP;
2021-06-29 05:00:15 +02:00
hispidence
5344e0a211
Include and register GameScriptItemInfo.
2021-06-28 18:35:16 +01:00