Commit graph

280 commits

Author SHA1 Message Date
MontyTRC89
865202b33c Merge branch 'doors_refactoring'
# Conflicts:
#	TR5Main/Game/door.cpp
#	TR5Main/Game/door.h
#	TR5Main/Game/memory/malloc.cpp
#	TR5Main/Objects/Generic/Switches/cog_switch.cpp
#	TR5Main/Objects/Generic/Switches/crowbar_switch.cpp
#	TR5Main/Objects/Generic/Switches/generic_switch.h
#	TR5Main/Objects/Generic/Switches/turn_switch.cpp
#	TR5Main/Objects/TR4/Object/tr4_obelisk.cpp
#	TR5Main/Renderer/Renderer11Draw.cpp
#	TR5Main/Specific/level.cpp
#	TR5Main/TombEngine.vcxproj
#	TR5Main/TombEngine.vcxproj.filters
2021-09-11 05:38:26 +02:00
Lwmte
4186dfe685 Merge branch 'master' into item_data 2021-09-09 11:10:25 +03:00
Lwmte
7f5dceef0c Further organizing 2021-09-08 18:31:35 +03:00
Lwmte
9af21e3146 Further code organizing 2021-09-08 18:19:06 +03:00
Lwmte
2bee1df81a Move all effect source files to separate directory, rename effect2 to effects 2021-09-08 18:07:48 +03:00
Nils
58eda862e3 Fixed More Include Hell 2021-08-28 13:27:58 +02:00
hispidence
85d37a3594 Make ExecuteFunction print a better error message with the name of the function. 2021-08-23 22:07:18 +01:00
hispidence
4f6f3b9adf Remove more vestiges of old trigger system. Replace TO_LUA_SCRIPT with the enum that used to be there - TO_BODYBAG - so that the following enums still have their same values. 2021-08-23 22:05:58 +01:00
hispidence
8f51f14178 Remove j. 2021-08-23 19:22:31 +01:00
hispidence
1cccef16b2 Give documentation comments new tag names. Part 2 of making the documentation better. 2021-08-23 19:16:24 +01:00
hispidence
dda1d7143b Rename ItemInfo functions newItem and newItemTemporary to new and newTemporary for consistency. 2021-08-23 02:07:17 +01:00
hispidence
ef9a74d5e0 Clean up GameLogicScript.
Add some new member functions, ResetLevelTables and GetLevelFunc. The former is called in FreeLevelScripts, which is now called in control.cpp.

Remove AddTrigger, as the LevelFuncs table takes care of triggers.
2021-08-23 02:02:47 +01:00
hispidence
73eb96ee39 Add and fix documentation. 2021-08-21 00:29:54 +01:00
hispidence
ce38cae2d7 Fix GetFrameNumber, SetFrameNumber, GetAnimNumber and SetAnimNumber. 2021-08-21 00:25:15 +01:00
hispidence
5dedd1acc0 Implement ScriptAssertF and ScriptAssertTerminateF.
These are like ScriptAssert, but make use of the fmt library (atm hijacking the version that comes with spdlog). This allows us to pass in a format string and some args, and then only create the format string if there's an actual error. This means we won't waste time doing a ton of std::string concatenations if the assert succeeds.

As these are variadic templates, we can't use a std::optional as the last argument to check if we're forcing a different error mode (we possibly could by assuming the last arg is a std::optional, but that seems unclean), so instead I've just separated them out into two functions.
2021-08-21 00:23:14 +01:00
hispidence
6df650acf3 Float->short to fix a warning. 2021-08-21 00:16:22 +01:00
hispidence
5280feb812 Update SetScriptErrorMode call. 2021-08-21 00:15:56 +01:00
hispidence
1621a00b3a Rename SetErrorMode to SetScriptErrorMode to avoid VS getting confused by some MS function with the same name. Add GetScriptErrorMode. 2021-08-21 00:13:44 +01:00
hispidence
bd6d2a998c Remove obsolete class. 2021-08-20 03:01:32 +01:00
hispidence
b5483512f2 Remove comments; these are technically no longer unused as they're linked up with Lua variables. 2021-08-20 02:43:56 +01:00
hispidence
ad7c6fddd1 Fixed some GameFlowScript.cpp warnings:
Remove SkyVelocity1 and SkyVelocity2 - they weren't being used.
Change a loop var to a size_t.
Make GameScriptInventoryObject.yOffset a short.
2021-08-20 02:42:47 +01:00
hispidence
6170ae72e8 Add newindex error to SoundSourceInfo. 2021-08-20 01:51:51 +01:00
hispidence
9fbf00cce5 Fix some documentation. 2021-08-20 01:51:16 +01:00
hispidence
7af11a9bf4 Add unlimitedAir documentation comment. 2021-08-20 01:48:06 +01:00
hispidence
12d896776a Give newindex errors to script classes which already have index errors. 2021-08-20 01:41:14 +01:00
hispidence
e74fa376d1 Move index_error_maker into new file (ScriptUtil.h). Add newindex_error_maker. Make them call ScriptAssert instead of just throwing an exception so it won't terminate the application on WARN or SILENT error modes. 2021-08-20 01:37:49 +01:00
hispidence
6df0bb5252 Remove some unused includes. 2021-08-17 14:23:47 +01:00
hispidence
3329523091 Make some getters const. 2021-08-17 13:37:08 +01:00
hispidence
906d583e7f Add documentation for SetGameFarView, Level.FarView, and Level.UVRotate, as well as some value checking. 2021-08-17 13:36:34 +01:00
hispidence
8cba52f026 Fix assert error message. 2021-08-17 00:30:21 +01:00
hispidence
9271172129 Fail assert if string is not found. 2021-08-16 12:52:45 +01:00
hispidence
e5d12a56f2 Document errorMode. Make it an enum on the Lua side rather than a string. 2021-08-16 12:52:06 +01:00
hispidence
b574a9b899 Make window title a strings.lua string instead. 2021-08-15 23:23:33 +01:00
hispidence
e49450d6b6 Make AudioTrack documentation stub. 2021-08-15 23:07:22 +01:00
hispidence
99e056b3c7 Add documentation comments in GameFlowScript.cpp.
Move windowTitle from GameScriptSettings to GameFlowScript and rename it to SetWindowTitleKey.
2021-08-15 23:04:56 +01:00
hispidence
e7166b05ba Fix some documentation. 2021-08-12 22:11:50 +01:00
hispidence
62948dddb0 Fix some GameLogic documentation. 2021-08-12 20:14:40 +01:00
hispidence
3b2775203b Remove GetLara as the Lara object is easier to use.
Add documentation for the Lara object.
2021-08-12 20:14:02 +01:00
hispidence
ece2dd9c38 Actually add documentation. 2021-08-12 19:58:22 +01:00
hispidence
cc5072dc64 Take CalculateDistance and CalculateHorizontalDistance out of header file as they can be static now.
Add documentation for said functions.
2021-08-12 19:57:17 +01:00
hispidence
0d3de8127c Register CalculateDistance and CalculateHorizontalDistance in GameLogicScript. 2021-08-12 19:54:03 +01:00
hispidence
8b7815c8a0 Make OnControlPhase take a float, representing the delta time.
This is not ACTUALLY the amount of time that has passed, since things in the gameplay loop appear to assume they are being called thirty times per second, even if more or less time has passed. Thus to keep the scripts in sync with the the rest of the engine, we force a 1/30 second delta time.
2021-08-12 18:20:14 +01:00
hispidence
b480ea23f7 Amend doc comment. 2021-08-12 17:20:09 +01:00
hispidence
801f47704f Fix documentation; Level -> LevelVars. 2021-08-12 02:43:59 +01:00
hispidence
634ab107ad Make "loop" arg to PlayAudioTrack optional; defaulting to false. 2021-08-12 02:39:29 +01:00
hispidence
c29af38f39 Add comments and update documentation for InventoryAdd/InventoryRemove. 2021-08-12 02:38:30 +01:00
hispidence
f4fb3786c9 Rename Lua tables Game and Level to GameVars and LevelVars to disambiguate the latter from the Level class. 2021-08-12 00:39:52 +01:00
hispidence
bf13661da6 Remove GameScriptLevel members which look superfluous. Mark some others as unused (for now). 2021-08-11 14:51:21 +01:00
hispidence
3a3afcaf38 Update Level documentation. 2021-08-11 14:50:10 +01:00
hispidence
855f67e1b9 Add default member initialisers and default constructor for GameScriptRotation.
These aren't intended (at the moment) to be exposed to the script writer; it's needed so that classes with a GameScriptRotation member can have a default member initialiser.
2021-08-11 14:39:26 +01:00