hispidence
74629db9d3
Make SetLevelFunc and GetLevelFunc only store the function in m_levelFuncs.
...
Store the function in m_levelFuncs instead of the table itself.
2021-08-30 18:21:42 +01:00
hispidence
f52a8455a4
Fix wrong function name.
2021-08-29 21:08:20 +01:00
hispidence
893eb4984f
Add the functions/properties SetPos, GetPos, col and key to DisplayString.
...
Add documentation too.
2021-08-29 20:28:40 +01:00
hispidence
861720dce0
Add DisplayString "flags" and "translated" support, as well as some things I forgot to commit earlier.
2021-08-29 20:25:54 +01:00
hispidence
1cde8877e4
Remove PrintString; it has been "replaced" with DisplayString/AddString.
2021-08-29 20:11:29 +01:00
hispidence
9a2d1a0f2d
Rename AddDisplayString to SetDisplayString. Make it call insert_or_assign instead of just insert.
...
Add GetDisplayString and assorted types/static functions.
2021-08-29 20:09:59 +01:00
hispidence
501be9c594
Add ScreenToPercent and PercentToScreen.
2021-08-29 20:03:51 +01:00
hispidence
75e6f14287
Make MakeReadOnlyTable give the metatable its own metatable with an __index metamethod which raises an error (for now) when you use a variable that doesn't exist.
2021-08-29 17:07:19 +01:00
hispidence
2e2d849092
Fix GameScriptColor's D3DCOLOR operator and __tostring, and add a converting constructor.
2021-08-29 17:05:06 +01:00
hispidence
5e525bb545
Add more reserved script names.
2021-08-29 17:03:51 +01:00
hispidence
72f925c3bc
Change PrintString arg names to better reflect what it does.
2021-08-27 19:08:28 +01:00
hispidence
34e187aa81
Make default s_callbackRemoveName not throw.
2021-08-27 19:07:55 +01:00
hispidence
f74460d8f8
Make variables an unordered_map for consistency and speed.
2021-08-27 19:04:03 +01:00
hispidence
a61e2fd0b0
Implement ShowString, HideString, and PrintString.
2021-08-27 18:56:35 +01:00
hispidence
a3adcd9f8a
Add GameScriptDisplayString.h and .cpp.
2021-08-27 18:49:59 +01:00
hispidence
68118bc9a3
Replace Get*ByName with GetByName, AddLuaName* with AddName, and RemoveLuaName* with RemoveName. Replace m_*MapName with m_nameMap. Use a std::variant for the types that m_nameMap elements could be. Modify SetNameCallbacks params to be variadic. These do make it look more complex, but also make it more generic, and mean that specific parameters do not need to be repeated (which will make it easier if/when we change said parameters).
2021-08-27 18:21:37 +01:00
hispidence
df5353d0c2
Add ReservedScriptNames.h. This holds some static const strings to be used as template arguments.
2021-08-27 18:11:59 +01:00
hispidence
4e8080b782
Add IdentifierType for named script types. This is in an effort to consolidate a lot of very similar functions into a few templates.
2021-08-27 18:10:19 +01:00
hispidence
50410f354a
Add comment for prev commit.
2021-08-27 14:32:00 +01:00
hispidence
f3b9b18ede
Make GameScriptColor able to convert to D3DCOLOR.
2021-08-27 14:30:41 +01:00
hispidence
88f056dc41
Set callbacks to nil and collect garbage when unloading level.
2021-08-27 12:46:01 +01: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