Commit graph

8102 commits

Author SHA1 Message Date
hispidence
85f5c9dadd Call title script if present. 2021-07-10 17:51:01 +01:00
hispidence
10fe19f559 Cast to GAME_OBJECT_ID. 2021-07-10 17:46:45 +01:00
hispidence
5dd8ca33a8 Implement GiveInvItem, TakeInvItem, GetInvItemCount and SetInvItemCount (names to be finalized). 2021-07-10 14:05:01 +01:00
hispidence
6676369f5c 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
1effeed738 Refactored cameras, sinks and sound sources; Added sound sources playback; 2021-07-10 06:55:37 +02:00
Troye
f5ec4695ef Add more anims to NewAnims; Fix lean 2021-07-09 19:41:56 -05:00
Troye
8dc41f1f0f fix control selection screens 2021-07-08 17:57:08 -05:00
Troye
88407761b1 clean up larainfo; add anim bools' 2021-07-08 14:15:14 -05:00
MontyTRC89
c98c51f5b5 Made LUA script optional; Deleted my bugged test code for volumes; 2021-07-06 11:54:34 +02:00
MontyTRC89
28364f8289 Merge branch 'NewLuaScripting' 2021-07-06 11:47:17 +02:00
MontyTRC89
8aea90bc20 Merge branch 'master' of https://github.com/MontyTRC89/TR5Main 2021-07-06 04:55:01 +02:00
hispidence
988d595955 Add and register "name" getter and setter for the string ID of an item. 2021-07-05 18:19:10 +01:00
hispidence
7a43cd156c Make InventoryAdd and InventoryRemove static. Add them as Lua functions. 2021-07-05 18:18:20 +01:00
hispidence
03c7f833ba Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TombEngine into NewLuaScripting 2021-07-05 18:14:06 +01:00
MontyTRC89
a12d9d8793 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
465e5f2347 Added trigger volumes experimental 2021-07-05 16:33:50 +02:00
hispidence
e6de9dc21f 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
5b840df07a 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
47f5745304 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
b7d2a45a29 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
4e09dc1d1d 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
d328a7f36c GetCurrentAnim -> SetCurrentAnim 2021-07-03 23:14:58 +01:00
hispidence
0e599d1f41 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
f88d2ac4bb Clean headers a bit. 2021-07-03 23:08:46 +01:00
hispidence
5f0b5f699f 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
1a361ebfe7 Round TO_DEGREES and don't cast to an unsigned type, as the only places which use this function appear to be able to handle negative numbers - it also makes thing slightly less confusing, as modulo-ing the unsigned result by 360 gives a slightly incorrect angle value. 2021-07-03 22:59:16 +01:00
hispidence
534e458395 Move OnStart and OnLoad calls to after things are initialised but before the game loop begins. 2021-07-03 22:56:12 +01:00
hispidence
932ac8f4a2 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
adad1e69e7 Init and call new Lua script callbacks. 2021-07-01 19:32:10 +01:00
hispidence
948e3519a2 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
b4a52de5d0 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
68f4603c9c Merge GameScriptInfo into GameScriptItemInfo. Add move constructor. Make functions use item ptr directly. 2021-07-01 19:27:57 +01:00
hispidence
d00428f3fb 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
61284fe571 Add Register to GameScriptPosition. Make member vars private to for consistency with GameScriptRotation. 2021-07-01 19:20:59 +01:00
hispidence
461f7cd1aa Make getters of GameScriptPosition and GameScriptRotation const. 2021-06-30 14:08:46 +01:00
hispidence
d225041048 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
a507e9e1be Moved GameScriptPosition, GameScriptRotation and GameScriptColor classes in separate files 2021-06-29 05:28:17 +02:00
MontyTRC89
aaee0e833a 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
c4577641c2 Merge branch 'master' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting 2021-06-29 05:01:35 +02:00
MontyTRC89
255393b589 Added FROM_DEGREES function; Added quantity param to PickedUpObject(); LUA scripting refactoring WIP; 2021-06-29 05:00:15 +02:00
hispidence
b2ace2c1bf Include and register GameScriptItemInfo. 2021-06-28 18:35:16 +01:00
hispidence
a9583065f6 Run the level script inside DoLevel. For now, this just runs the script once. 2021-06-28 18:34:59 +01:00
hispidence
5a1c6f78ac Add GameScriptItemInfo class.
This is the first pass at wrapping an ITEM_INFO in a struct and handing it over to Lua. Many improvements should follow - this is more of a test implementation.
2021-06-28 18:23:26 +01:00
MontyTRC89
cf98c30910 Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting 2021-06-26 07:37:02 +02:00
MontyTRC89
a4d3ec9d26 Switched audio tracks from int index to string; Added Tracks.lua loading support; 2021-06-26 07:36:54 +02:00
hispidence
1fbb41d997 Remove Strings and CurrentStrings from GameFlow; they were for the old system. Remove LoadScript for the same reason. 2021-06-25 14:33:26 +01:00
hispidence
350d0426ca Remove assignment that already happens in LuaHandler. 2021-06-23 21:27:04 +01:00
wolfcheese
0bea268332 Removed code messing up angle of crossbow arrows during lasersight. Crossbow ammo now depletes during lasersight. 2021-06-23 14:45:04 -04:00
wolfcheese
062d926a8d Disable debris on level unload to avoid crashes 2021-06-23 14:14:58 -04:00
MontyTRC89
127e142622 Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting
# Conflicts:
#	TR5Main/Scripting/GameLogicScript.cpp
2021-06-23 05:59:25 +02:00