Commit graph

1650 commits

Author SHA1 Message Date
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
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
214d45acfa 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
19402f8d55 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
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
76aa8cd786 Init and call new Lua script callbacks. 2021-07-01 19:32:10 +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
7f8cdec884 Merge branch 'master' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting 2021-06-29 05:01:35 +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
hispidence
9e17b737ea Run the level script inside DoLevel. For now, this just runs the script once. 2021-06-28 18:34:59 +01:00
Brad Ellis
434707286c 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
b544c8bed6 Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting 2021-06-26 07:37:02 +02:00
MontyTRC89
4c7110558f Switched audio tracks from int index to string; Added Tracks.lua loading support; 2021-06-26 07:36:54 +02:00
Brad Ellis
1a41e3ef50 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
Brad Ellis
1a9347297c Remove assignment that already happens in LuaHandler. 2021-06-23 21:27:04 +01:00
wolfcheese
d7b1720ca2 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
ef46715233 Disable debris on level unload to avoid crashes 2021-06-23 14:14:58 -04:00
MontyTRC89
628358f242 Merge branch 'NewLuaScripting' of https://github.com/MontyTRC89/TR5Main into NewLuaScripting
# Conflicts:
#	TR5Main/Scripting/GameLogicScript.cpp
2021-06-23 05:59:25 +02:00
MontyTRC89
3bd65d3629 Removed test code; Removed scripts from project (they will be created by LD); Added some missing strings for inventory; Added scripting for puzzles; Removed some old code for scripting; 2021-06-23 05:58:24 +02:00
Brad Ellis
bc576d8711 Remove test code. 2021-06-21 16:23:18 +01:00