Merge branch 'develop' of https://github.com/MontyTRC89/TombEngine into develop

This commit is contained in:
MontyTRC89 2024-11-20 09:09:31 +01:00
commit 116c3d71fc
7 changed files with 67 additions and 3 deletions

View file

@ -38,7 +38,9 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Allow more than 1000 static mesh slots in a level. * Allow more than 1000 static mesh slots in a level.
### Lua API changes ### Lua API changes
* Added Moveable:GetCollidable() and Moveable:SetCollidable() functions.
* Added Flow.GetNextLevel() function to get script entry for incoming level, if it's about to start. * Added Flow.GetNextLevel() function to get script entry for incoming level, if it's about to start.
* Added Effects.GetWind() function to get current wind speed vector.
* Added support for transparency value in DisplayString class. * Added support for transparency value in DisplayString class.
* Added extra argument for SetAmbientTrack() function to specify if new ambient track should play from the beginning. * Added extra argument for SetAmbientTrack() function to specify if new ambient track should play from the beginning.
* Use load camera instead of load screen by playing fixed camera from OnEnd() event and removing loadScreenFile field from level's gameflow entry. * Use load camera instead of load screen by playing fixed camera from OnEnd() event and removing loadScreenFile field from level's gameflow entry.
@ -120,8 +122,8 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Added Flow.LensFlare() and Flow.Starfield() classes. * Added Flow.LensFlare() and Flow.Starfield() classes.
* Added Inventory.GetUsedItem(), Inventory.SetUsedItem() and Inventory.ClearUsedItem() functions. * Added Inventory.GetUsedItem(), Inventory.SetUsedItem() and Inventory.ClearUsedItem() functions.
* Added Input.KeyClearAll() function. * Added Input.KeyClearAll() function.
* Added Moveable.GetJointRotation() and optional 'offset' parameter for Moveable.GetJointPosition(). * Added Moveable:GetJointRotation() and optional 'offset' parameter for Moveable.GetJointPosition().
* Added Moveable.GetTargetState() function. * Added Moveable:GetTargetState() function.
* Added Room:GetRoomNumber() function. * Added Room:GetRoomNumber() function.
* Removed anims.monkeyAutoJump. It is now a player menu configuration. * Removed anims.monkeyAutoJump. It is now a player menu configuration.
* Fixed Volume:GetActive() method. * Fixed Volume:GetActive() method.

View file

@ -143,6 +143,10 @@
<td class="name" ><a href="#MakeEarthquake">MakeEarthquake(strength)</a></td> <td class="name" ><a href="#MakeEarthquake">MakeEarthquake(strength)</a></td>
<td class="summary">Make an earthquake</td> <td class="summary">Make an earthquake</td>
</tr> </tr>
<tr>
<td class="name" ><a href="#GetWind">GetWind()</a></td>
<td class="summary">Get the current wind for the current frame.</td>
</tr>
</table> </table>
<br/> <br/>
@ -498,6 +502,28 @@
</dd>
<dt>
<a name = "GetWind"></a>
<strong>GetWind()</strong>
</dt>
<dd>
Get the current wind for the current frame.
This represents the 3D displacement applied by the engine on things like particles affected by wind.
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
The wind.
</ol>
</dd> </dd>
</dl> </dl>

View file

@ -592,7 +592,7 @@ int ObjectOnLOS2(GameVector* origin, GameVector* target, Vector3i* vec, MESH_INF
if (priorityObjectID != GAME_OBJECT_ID::ID_NO_OBJECT && item.ObjectNumber != priorityObjectID) if (priorityObjectID != GAME_OBJECT_ID::ID_NO_OBJECT && item.ObjectNumber != priorityObjectID)
continue; continue;
if (item.ObjectNumber != ID_LARA && Objects[item.ObjectNumber].collision == nullptr) if (item.ObjectNumber != ID_LARA && (Objects[item.ObjectNumber].collision == nullptr || !item.Collidable))
continue; continue;
if (item.ObjectNumber == ID_LARA && priorityObjectID != ID_LARA) if (item.ObjectNumber == ID_LARA && priorityObjectID != ID_LARA)

View file

@ -96,6 +96,8 @@ static constexpr char ScriptReserved_New[] = "New";
static constexpr char ScriptReserved_Init[] = "Init"; static constexpr char ScriptReserved_Init[] = "Init";
static constexpr char ScriptReserved_Enable[] = "Enable"; static constexpr char ScriptReserved_Enable[] = "Enable";
static constexpr char ScriptReserved_Disable[] = "Disable"; static constexpr char ScriptReserved_Disable[] = "Disable";
static constexpr char ScriptReserved_GetCollidable[] = "GetCollidable";
static constexpr char ScriptReserved_SetCollidable[] = "SetCollidable";
static constexpr char ScriptReserved_MakeInvisible[] = "MakeInvisible"; static constexpr char ScriptReserved_MakeInvisible[] = "MakeInvisible";
static constexpr char ScriptReserved_SetVisible[] = "SetVisible"; static constexpr char ScriptReserved_SetVisible[] = "SetVisible";
static constexpr char ScriptReserved_Explode[] = "Explode"; static constexpr char ScriptReserved_Explode[] = "Explode";
@ -299,6 +301,7 @@ static constexpr char ScriptReserved_EmitBlood[] = "EmitBlood";
static constexpr char ScriptReserved_EmitFire[] = "EmitFire"; static constexpr char ScriptReserved_EmitFire[] = "EmitFire";
static constexpr char ScriptReserved_MakeExplosion[] = "MakeExplosion"; static constexpr char ScriptReserved_MakeExplosion[] = "MakeExplosion";
static constexpr char ScriptReserved_MakeEarthquake[] = "MakeEarthquake"; static constexpr char ScriptReserved_MakeEarthquake[] = "MakeEarthquake";
static constexpr char ScriptReserved_GetWind[] = "GetWind";
static constexpr char ScriptReserved_Vibrate[] = "Vibrate"; static constexpr char ScriptReserved_Vibrate[] = "Vibrate";
static constexpr char ScriptReserved_FlashScreen[] = "FlashScreen"; static constexpr char ScriptReserved_FlashScreen[] = "FlashScreen";
static constexpr char ScriptReserved_FadeIn[] = "FadeIn"; static constexpr char ScriptReserved_FadeIn[] = "FadeIn";

View file

@ -10,6 +10,7 @@
#include "Game/effects/explosion.h" #include "Game/effects/explosion.h"
#include "Game/effects/spark.h" #include "Game/effects/spark.h"
#include "Game/effects/tomb4fx.h" #include "Game/effects/tomb4fx.h"
#include "Game/effects/weather.h"
#include "Game/Setup.h" #include "Game/Setup.h"
#include "Objects/Utils/object_helper.h" #include "Objects/Utils/object_helper.h"
#include "Scripting/Internal/LuaHandler.h" #include "Scripting/Internal/LuaHandler.h"
@ -31,6 +32,7 @@ Functions to generate effects.
using namespace TEN::Effects::DisplaySprite; using namespace TEN::Effects::DisplaySprite;
using namespace TEN::Effects::Electricity; using namespace TEN::Effects::Electricity;
using namespace TEN::Effects::Environment;
using namespace TEN::Effects::Explosion; using namespace TEN::Effects::Explosion;
using namespace TEN::Effects::Spark; using namespace TEN::Effects::Spark;
@ -308,6 +310,15 @@ namespace TEN::Scripting::Effects
Camera.bounce = -str; Camera.bounce = -str;
} }
/// Get the wind vector for the current game frame.
// This represents the 3D displacement applied by the engine on things like particles affected by wind.
// @function GetWind()
// @treturn Vec3 Wind vector.
static Vec3 GetWind()
{
return Vec3(Weather.Wind());
}
void Register(sol::state* state, sol::table& parent) void Register(sol::state* state, sol::table& parent)
{ {
auto tableEffects = sol::table(state->lua_state(), sol::create); auto tableEffects = sol::table(state->lua_state(), sol::create);
@ -321,6 +332,7 @@ namespace TEN::Scripting::Effects
tableEffects.set_function(ScriptReserved_MakeExplosion, &MakeExplosion); tableEffects.set_function(ScriptReserved_MakeExplosion, &MakeExplosion);
tableEffects.set_function(ScriptReserved_EmitFire, &EmitFire); tableEffects.set_function(ScriptReserved_EmitFire, &EmitFire);
tableEffects.set_function(ScriptReserved_MakeEarthquake, &Earthquake); tableEffects.set_function(ScriptReserved_MakeEarthquake, &Earthquake);
tableEffects.set_function(ScriptReserved_GetWind, &GetWind);
auto handler = LuaHandler{ state }; auto handler = LuaHandler{ state };
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_BlendID, BLEND_IDS); handler.MakeReadOnlyTable(tableEffects, ScriptReserved_BlendID, BLEND_IDS);

View file

@ -168,6 +168,9 @@ void Moveable::Register(sol::state& state, sol::table& parent)
ScriptReserved_SetVisible, &Moveable::SetVisible, ScriptReserved_SetVisible, &Moveable::SetVisible,
ScriptReserved_SetCollidable, & Moveable::SetCollidable,
ScriptReserved_GetCollidable, & Moveable::GetCollidable,
/// Explode item. This also kills and disables item. /// Explode item. This also kills and disables item.
// @function Moveable:Explode // @function Moveable:Explode
ScriptReserved_Explode, &Moveable::Explode, ScriptReserved_Explode, &Moveable::Explode,
@ -1166,6 +1169,22 @@ void Moveable::Shatter()
KillItem(m_num); KillItem(m_num);
} }
/// Get the item's collision state.
// @treturn bool item's collision state
// @function Moveable:GetCollidable
bool Moveable::GetCollidable()
{
return m_item->Collidable;
}
/// Set the item's collision.
// @bool collidable true if the caller should be collidable, false if no collision should occur.
// @function Moveable:SetCollidable
void Moveable::SetCollidable(bool isCollidable)
{
m_item->Collidable = isCollidable;
}
/// Make the item invisible. Alias for `Moveable:SetVisible(false)`. /// Make the item invisible. Alias for `Moveable:SetVisible(false)`.
// @function Moveable:MakeInvisible // @function Moveable:MakeInvisible
void Moveable::MakeInvisible() void Moveable::MakeInvisible()

View file

@ -118,6 +118,8 @@ public:
void DisableItem(); void DisableItem();
void MakeInvisible(); void MakeInvisible();
void SetVisible(bool isVisible); void SetVisible(bool isVisible);
[[nodiscard]] bool GetCollidable();
void SetCollidable(bool isCollidable);
void Explode(); void Explode();
void Shatter(); void Shatter();