Commit graph

151 commits

Author SHA1 Message Date
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
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
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
MontyTRC89
dc9b86a375 Added Strings.lua 2021-06-20 06:34:52 +02:00
MontyTRC89
907fce42e7 Added translations support and fixed some bugs with strings 2021-06-20 06:33:44 +02:00
MontyTRC89
a03f30952c Merge branch 'master' into NewLuaScripting
# Conflicts:
#	TR5Main/Scripting/GameFlowScript.cpp
#	TR5Main/Scripting/GameFlowScript.h
2021-06-19 07:20:04 +02:00
MontyTRC89
1bb5965157 Moving to stringed keys for game strings 2021-06-19 07:11:22 +02:00
Brad Ellis
3169f0986d Add some missing strings so I can remap controls. These will very likely be replaced when the new strings system is finished. 2021-06-18 02:16:08 +01:00
Brad Ellis
b6be46992b GameFlowScript changes:
Remove all code related to reading SCRIPT.DAT.

Include AudioTracks.h, which, I emphasise, is temporary until we start listing audio tracks in Lua.

Hardcode language to English for now.

Add WeatherType and LaraType usertypes. These were in the Lua scripts but weren't connected with their related C++ types.

Name -> NameStringIndex; the latter is what the engine reads, and as far as I can tell, that is what GameFlow.lua is passing.

Add _GameFlow usertype to correspond to the GameFlow class. I don't think this is the perfect way to expose this functionality to Lua, but it will do the job for now.

GameFlow's destructor now deletes its dynamically allocated memory. Note that I haven't fully looked into whether said memory needs to be dynamically allocated; I just new'd GameScriptLevels and LanguageScripts because they were being new'd in the original implementation.
2021-06-16 15:05:10 +01:00
Brad Ellis
9aea1c9ba8 Change string back; I was using this for debugging. 2021-06-16 14:52:30 +01:00
Brad Ellis
8f3f973c5e GameFlowScript changes:
Inherit from LuaHandler.

Remove the SCRIPT.DAT-related code.

Add m_translationsMap which stores strings by key and holds a vector with their translations. The index of a translation corresponds with the index of the language in m_languageNames; e.g. if Italian is at index 2 in m_languageNames, then the Italian translation of a string will be at index 2 in the vector. See GameFlow:SetStrings in English.lua.

Add m_languageNames which stores a vector of language names. See GameFlow:SetLanguageNames in English.lua.

Add WriteDefaults and AddTracks, which is there for data which isn't in Lua scripts yet. It will be removed in the future.

Add AddLevel, which corresponds with GameFlow:AddLevel in Gameflow.lua.

Add LoadGameFlowScript, which loads (for now) Gameflow.lua and English.lua.

Add GetLang, which is to load the old-style strings and which will be removed when the switch to new strings is complete.
2021-06-16 14:51:58 +01:00
Brad Ellis
514a691836 GameLogicScript inherits from LuaHandler now. 2021-06-16 14:39:43 +01:00
Brad Ellis
a435b889a2 Call WriteDefaults and AddTracks. These are temporary things to add the settings which were in SCRIPT.DAT but which have no Lua counterpart yet.
The bool "rain" is now the WeatherType "Weather" to reflect what's in the C++ implementation.

Gameflow -> GameFlow to be consistent with C++.
2021-06-16 14:38:59 +01:00