Commit graph

8102 commits

Author SHA1 Message Date
hispidence
2353be1fc2 Fix assignment-addition operator of GAME_OBJECT_ID, thus fixing a stack overflow. The operator was calling itself... Silly me D: 2021-08-01 20:49:28 +01:00
Lwmte
6e544ed50c Simplify Lara renderer a bit 2021-08-01 22:24:20 +03:00
Lwmte
48b020f5fb Fix keyhole deadlock 2021-08-01 22:24:09 +03:00
Lwmte
ed9fc47d27 Fix blending modes issue (#281)
Only for rooms and some objects but not for Lara or most effects
2021-08-01 15:54:54 +03:00
Lwmte
f53c825007 Update shaders 2021-08-01 14:07:14 +03:00
Lwmte
b93db28f1a Use refraction as before but accounting for vertex weight factor 2021-08-01 11:39:02 +03:00
Lwmte
9aec905bae Increase max refraction value 2021-07-31 19:11:02 +03:00
Lwmte
5563bbf990 Add refraction vertex attribute, separate attribs into separate normalized float values 2021-07-31 18:51:38 +03:00
hispidence
ed54da0782 Remove accidental scope specifier thingy. 2021-07-31 13:23:22 +01:00
hispidence
0703efac80 Change TitleType member initializer. 2021-07-31 12:50:52 +01:00
Lwmte
2c802289ea Fix #276 2021-07-31 07:32:01 +03:00
Lwmte
7b105ec01b Fix #266 2021-07-31 05:28:42 +03:00
Lwmte
3a2327a220 Fix #268 2021-07-31 04:48:15 +03:00
Lwmte
66cac71f33 Fix puzzle holes. NOTE: Commented a line which caused stack overflow, needs fixing 2021-07-31 04:40:28 +03:00
Lwmte
71444b28ad Update spotcam.cpp 2021-07-31 04:07:41 +03:00
Lwmte
55665d3706 Fix #286 2021-07-31 03:47:56 +03:00
Lwmte
f099fc69b4 Implement per-vertex effects for rooms and objects 2021-07-30 20:55:03 +03:00
Lwmte
fbbd6be47d Draw vertex colors for moveables too 2021-07-30 14:45:18 +03:00
hispidence
e68932f6aa Compile fix; forgot to commit this last time. 2021-07-30 11:44:00 +01:00
hispidence
b566e33f68 Missed these in the last commit. 2021-07-28 19:06:15 +01:00
hispidence
e6c076eb41 Move GameScriptLevel, GameScriptAudioTrack, GameScriptInventoryObject, GameScriptSkyLayer, GameScriptSettings and GameScriptMirror into their own files. This could be changed later as this does create many small .h and .cpp files, but for now this cleans things up and makes it easier to check things class by class.
Treat functions as global that would previously be accessed through the GameFlow table. This does pollute the global environment in Lua a bit, but keeps it consistent with the functions in GameLogicScript, which are all accessed as globals.

Add some default member initialisers.

Remove WriteDefaults. Rename Intro to IntroImagePath and make it a std::string.

Add some documentation for the functions of GameFlowScript.

Fix some comments.
2021-07-28 18:44:24 +01:00
hispidence
de71944e3c Include GameScriptColor.h in GameFlowScript.h as it uses it. 2021-07-26 18:28:13 +01:00
hispidence
08a5df8ab4 Delete copy operations for GameScriptAIObject, GameScriptCameraInfo, GameScriptSinkInfo and GameScriptSoundSourceInfo - this can be changed later, but for now is a safety measure since we hold a reference, which means copying these would take some extra thought. 2021-07-26 18:25:50 +01:00
hispidence
b94cc960a2 Clean up GameFlow and GameScriptLevel by adding default member initialisers. Replace GameScriptFog with GameScriptColor. Rename some enums for consistency. Make TITLE_TYPE and enum for consistency. 2021-07-26 18:23:29 +01:00
hispidence
831a0f7e8e Change mesh loading to use emplace_back.
Change some remaining vector::back calls to use the already-existing references.
2021-07-24 19:14:23 +01:00
hispidence
8c85446365 Clean up a load of warnings and possible errors:
Fix buffer from char*[255] to char[255]. This also allows us to avoid the C-style cast to char const *.

Remove original push_back call to g_Level.SoundSources which I left in by accident.

Use string constructor which takes pointer to first char and pointer to last char + 1. This removes the need to zero the memory (the calls were generating warnings about accessing buffer[256] when buffer is only 255 elements) and also gets rid of warning C6054 about string possibly not being zero-terminated.

Change calls to push_back and back with an emplace_back. Aside from being shorter and slightly more efficient, it gets rid of warning C26444 (about creating local variables with no name).
2021-07-24 19:08:17 +01:00
hispidence
6e8886dadd Make the GAME_OBJECT_ID compound addition-assignment operator take references, as is the canonical implementation (and so we don't return a reference to a local, as cppcheck very correctly warned me about). 2021-07-24 14:10:16 +01:00
hispidence
783d344185 Add SOUND_SOURCE_INFO and AI_OBJECT names when loading in the level data. Implement remaining functions on the GameLogicScript side. 2021-07-24 12:45:33 +01:00
hispidence
b763c9a632 Fix comment. 2021-07-24 12:29:54 +01:00
hispidence
447ba86d30 Add GameScriptSoundSourceInfo and GameScriptAIObject, and associated functions. 2021-07-24 12:29:25 +01:00
hispidence
3060fb85c0 Make color getters const. 2021-07-24 12:26:48 +01:00
hispidence
9b31649ada Update Sol version as the old version wasn't compiling under C++latest. Define SOL_NO_CHECK_NUMBER_PRECISION to stop Sol throwing exceptions when we pass a float to an int parameter instead of just truncating (which we were doing with the previous version). 2021-07-23 22:06:32 +01:00
hispidence
c017f1a89d Make Write and WriteString take char const * args. 2021-07-23 22:00:18 +01:00
hispidence
823eeaf45e Rearrange the args to BASS calls so that we're not taking addresses of temporaries. 2021-07-23 21:59:34 +01:00
hispidence
05699b108e Make uhmG.text a const char * now that GetValue returns one. 2021-07-23 21:58:55 +01:00
hispidence
02ee34a786 The explicit cast to void * made this line resolve to an assignment to an rvalue, but removing it fixes it. 2021-07-23 21:54:57 +01:00
hispidence
5e98a7aff7 Define some PHD_3DPOS vars before TriggerShockwave calls so that we don't take an address of a temporary. 2021-07-23 21:51:41 +01:00
hispidence
82b037c7fe Make more functions take reference-to-const args. 2021-07-23 21:50:29 +01:00
hispidence
a8344ed35e Make functions take reference-to-const args. 2021-07-23 21:49:44 +01:00
hispidence
16b3511d5f Make GetString return a char const *.
Make Intro a char const *.
2021-07-23 21:48:49 +01:00
hispidence
ba48783bc3 Define scale and translation vectors just before the Decompose call instead of in its arguments, since it takes them by non-const reference. 2021-07-23 21:48:06 +01:00
hispidence
18d9223d12 De-ambiguate a comparison operator and define PHD_3DPOS variables before TriggerShockWave calls, because taking an address of a temporary in this way is apparently not standard-compliant. 2021-07-23 21:46:38 +01:00
hispidence
1decbe9966 Declare WarningsAsErrors so that files which end up indirectly including GameScriptNamedBase.h don't complain 2021-07-23 21:43:08 +01:00
hispidence
f65ec91756 Rearrange headers so generic_bridge.h sees g_Level. 2021-07-23 21:41:44 +01:00
hispidence
f9ae0046c6 Add AddLuaNameSink, RemoveLuaNameSink, and GetSinkByName.
Make a template that all GetXByName member functions work off, to reduce copypasted functions.
For consistency, rename RemoveLuaName and AddLuaName to RemoveLuaNameItem and AddLuaNameItem.
Fix some documentation comments, order function documentation into sections.
2021-07-23 16:02:30 +01:00
hispidence
40933eef0c Add GameScriptSinkInfo/SinkInfo. 2021-07-23 15:59:13 +01:00
hispidence
171d427d77 Change ReadRooms to push back the ROOM_INFO to g_Level.Rooms first, and then working on the reference. This means that the MESH_INFO reference that gets added to the mesh-name table correctly refers to the copy that sits in the vector of an element of g_Level.Rooms and not a local copy that goes out of scope before the end of the function. It also makes loading about 50ms faster. 2021-07-23 02:41:39 +01:00
hispidence
a94893516b Call AddLuaNameCamera when loading a level to add a reference to the camera to the name-camera map. 2021-07-23 02:12:12 +01:00
hispidence
5257a3c074 Add m_camerasMapName, AddLuaNameCamera, RemoveLuaNameCamera, GetCameraByName, and GetMeshByName. 2021-07-23 02:09:52 +01:00
hispidence
cb59e06493 Add GameScriptCameraInfo.h and GameScriptCameraInfo.cpp. 2021-07-23 02:08:13 +01:00