From d2d6645fe86522ce073d615cb899b692a2d5b623 Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Fri, 4 Apr 2025 08:57:06 +0200
Subject: [PATCH 01/16] Fallback for GetJointPosition
---
CHANGELOG.md | 4 ++++
TombEngine/Game/animation.cpp | 12 ++++++++++++
.../Internal/TEN/Objects/Moveable/MoveableObject.cpp | 6 +++---
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 234608089..eb51790f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed crashes when shooting, if gunflash or gunshell objects are not present in a level.
* Fixed Teleporter object.
* Fixed Wraith objects not working correctly in flipped rooms.
+* Fixed caustics not rendered correctly if texture compression was enabled.
+
+### Lua API changes
+* Fixed `Moveable.GetJointPosition` not returning correct results if moveable is invisible or not rendered.
## [Version 1.8.1](https://github.com/TombEngine/TombEditorReleases/releases/tag/v1.8.1) - 2025-03-29
diff --git a/TombEngine/Game/animation.cpp b/TombEngine/Game/animation.cpp
index 04eb59905..3588ef746 100644
--- a/TombEngine/Game/animation.cpp
+++ b/TombEngine/Game/animation.cpp
@@ -689,6 +689,18 @@ void ClampRotation(Pose& outPose, short angle, short rotation)
Vector3i GetJointPosition(const ItemInfo& item, int jointIndex, const Vector3i& relOffset)
{
+ bool incorrectJoint = false;
+ if (jointIndex < 0 || jointIndex >= Objects[item.ObjectNumber].nmeshes)
+ {
+ TENLog("Unknown joint ID specified for object " + GetObjectName(item.ObjectNumber), LogLevel::Warning, LogConfig::All);
+ incorrectJoint = true;
+ }
+
+ // Always return object's root position if it's invisible, because we can't predict its
+ // joint position otherwise, since it's not animated.
+ if (incorrectJoint || Objects[item.ObjectNumber].drawRoutine == nullptr || item.Status == ITEM_INVISIBLE)
+ return Geometry::TranslatePoint(item.Pose.Position, item.Pose.Orientation, relOffset);
+
// Use matrices done in renderer to transform relative offset.
return Vector3i(g_Renderer.GetMoveableBonePosition(item.Index, jointIndex, relOffset.ToVector3()));
}
diff --git a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
index eb1ef5760..36028332a 100644
--- a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
+++ b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
@@ -430,13 +430,13 @@ void Moveable::SetPosition(const Vec3& pos, sol::optional updateRoom)
/// Get the moveable's joint position with an optional relative offset.
// @function Moveable:GetJointPosition
-// @tparam int jointID Joint ID.
+// @tparam int jointIndex Index of a joint to get position.
// @tparam[opt] Vec3 offset Offset relative to the joint.
// @treturn Vec3 World position.
-Vec3 Moveable::GetJointPos(int jointID, sol::optional offset) const
+Vec3 Moveable::GetJointPos(int jointIndex, sol::optional offset) const
{
auto convertedOffset = offset.has_value() ? offset->ToVector3i() : Vector3i::Zero;
- return Vec3(GetJointPosition(_moveable, jointID, convertedOffset));
+ return Vec3(GetJointPosition(_moveable, jointIndex, convertedOffset));
}
/// Get the object's joint rotation
From ab55a7cf14bfa6c5389e8b86cdbe1bef5c471e8b Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Fri, 4 Apr 2025 09:08:55 +0200
Subject: [PATCH 02/16] Use Contains method where applicable
---
Documentation/doc/2 classes/Objects.Moveable.html | 8 ++++----
TombEngine/Game/Lara/lara_one_gun.cpp | 3 ++-
TombEngine/Game/camera.cpp | 3 ++-
TombEngine/Renderer/RendererDraw.cpp | 3 ++-
TombEngine/Renderer/RendererFrame.cpp | 2 +-
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/Documentation/doc/2 classes/Objects.Moveable.html b/Documentation/doc/2 classes/Objects.Moveable.html
index cddc5ebb0..45f4fa252 100644
--- a/Documentation/doc/2 classes/Objects.Moveable.html
+++ b/Documentation/doc/2 classes/Objects.Moveable.html
@@ -172,7 +172,7 @@
(e.g.
- Moveable:GetJointPosition(jointID[, offset]) |
+ Moveable:GetJointPosition(jointIndex[, offset]) |
Get the moveable's joint position with an optional relative offset. |
@@ -771,7 +771,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
- Moveable:GetJointPosition(jointID[, offset])
+ Moveable:GetJointPosition(jointIndex[, offset])
Get the moveable's joint position with an optional relative offset.
@@ -780,9 +780,9 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
Parameters:
- - jointID
+
- jointIndex
int
- Joint ID.
+ Index of a joint to get position.
- offset
Vec3
diff --git a/TombEngine/Game/Lara/lara_one_gun.cpp b/TombEngine/Game/Lara/lara_one_gun.cpp
index 592b9d99c..32b7d60bf 100644
--- a/TombEngine/Game/Lara/lara_one_gun.cpp
+++ b/TombEngine/Game/Lara/lara_one_gun.cpp
@@ -32,6 +32,7 @@
#include "Specific/clock.h"
#include "Specific/Input/Input.h"
#include "Specific/level.h"
+#include "Specific/trutils.h"
using namespace TEN::Collision::Point;
using namespace TEN::Effects::Bubble;
@@ -1594,7 +1595,7 @@ void HandleProjectile(ItemInfo& projectile, ItemInfo& emitter, const Vector3i& p
for (auto* itemPtr : collObjects.Items)
{
// Object was already affected by collision, skip it.
- if (std::find(affectedObjects.begin(), affectedObjects.end(), itemPtr->Index) != affectedObjects.end())
+ if (TEN::Utils::Contains(affectedObjects, itemPtr->Index))
continue;
const auto& currentObject = Objects[itemPtr->ObjectNumber];
diff --git a/TombEngine/Game/camera.cpp b/TombEngine/Game/camera.cpp
index fa5f62f02..b6095f8f1 100644
--- a/TombEngine/Game/camera.cpp
+++ b/TombEngine/Game/camera.cpp
@@ -22,6 +22,7 @@
#include "Sound/sound.h"
#include "Specific/Input/Input.h"
#include "Specific/level.h"
+#include "Specific/trutils.h"
#include "Specific/winmain.h"
using namespace TEN::Collision::Point;
@@ -1392,7 +1393,7 @@ static std::vector FillCollideableItemList()
{
const auto& item = g_Level.Items[i];
- if (std::find(roomList.begin(), roomList.end(), item.RoomNumber) == roomList.end())
+ if (!TEN::Utils::Contains(roomList, (int)item.RoomNumber))
continue;
if (!g_Level.Rooms[item.RoomNumber].Active())
diff --git a/TombEngine/Renderer/RendererDraw.cpp b/TombEngine/Renderer/RendererDraw.cpp
index 491f38b0b..341a7f986 100644
--- a/TombEngine/Renderer/RendererDraw.cpp
+++ b/TombEngine/Renderer/RendererDraw.cpp
@@ -31,6 +31,7 @@
#include "Renderer/Structures/RendererSortableObject.h"
#include "Specific/configuration.h"
#include "Specific/level.h"
+#include "Specific/trutils.h"
#include "Specific/winmain.h"
using namespace TEN::Effects::Hair;
@@ -2712,7 +2713,7 @@ namespace TEN::Renderer
if (rendererPass != RendererPass::GBuffer)
{
// Bind caustics texture.
- if (std::find(SpriteSequencesIds.begin(), SpriteSequencesIds.end(), ID_CAUSTIC_TEXTURES) != SpriteSequencesIds.end())
+ if (TEN::Utils::Contains(SpriteSequencesIds, (int)ID_CAUSTIC_TEXTURES))
{
int nmeshes = -Objects[ID_CAUSTIC_TEXTURES].nmeshes;
int meshIndex = Objects[ID_CAUSTIC_TEXTURES].meshIndex;
diff --git a/TombEngine/Renderer/RendererFrame.cpp b/TombEngine/Renderer/RendererFrame.cpp
index 3e5f2ac53..d8d0fcdb0 100644
--- a/TombEngine/Renderer/RendererFrame.cpp
+++ b/TombEngine/Renderer/RendererFrame.cpp
@@ -835,7 +835,7 @@ namespace TEN::Renderer
}
// Light already on a list
- if (std::find(renderView.LightsToDraw.begin(), renderView.LightsToDraw.end(), light) != renderView.LightsToDraw.end())
+ if (TEN::Utils::Contains(renderView.LightsToDraw, light))
{
continue;
}
From 783d7f5fa35fe41979f1e3de04510e37b2a3d129 Mon Sep 17 00:00:00 2001
From: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Date: Sat, 5 Apr 2025 11:24:06 -0400
Subject: [PATCH 03/16] Remove active requirement from ObjectCamera
---
.../Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
index 36028332a..b11d4ab72 100644
--- a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
+++ b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
@@ -1240,7 +1240,6 @@ bool Moveable::MeshExists(int index) const
// @tparam int mesh Mesh of a target moveable to use as a camera target.
void Moveable::AttachObjCamera(short camMeshId, Moveable& mov, short targetMeshId)
{
- if ((_moveable->Active || _moveable->IsLara()) && (mov._moveable->Active || mov._moveable->IsLara()))
ObjCamera(_moveable, camMeshId, mov._moveable, targetMeshId, true);
}
From 88b1971848604b81791781708aacc30986a9ae4f Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Sun, 6 Apr 2025 01:39:37 +0200
Subject: [PATCH 04/16] Correct exclude blend mode
---
CHANGELOG.md | 1 +
TombEngine/Renderer/RendererInit.cpp | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb51790f1..fecd0365f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed Teleporter object.
* Fixed Wraith objects not working correctly in flipped rooms.
* Fixed caustics not rendered correctly if texture compression was enabled.
+* Fixed exclusion blend mode not working correctly.
### Lua API changes
* Fixed `Moveable.GetJointPosition` not returning correct results if moveable is invisible or not rendered.
diff --git a/TombEngine/Renderer/RendererInit.cpp b/TombEngine/Renderer/RendererInit.cpp
index 46fac3c2f..81ee2c115 100644
--- a/TombEngine/Renderer/RendererInit.cpp
+++ b/TombEngine/Renderer/RendererInit.cpp
@@ -133,11 +133,11 @@ namespace TEN::Renderer
blendStateDesc.AlphaToCoverageEnable = false;
blendStateDesc.IndependentBlendEnable = false;
blendStateDesc.RenderTarget[0].BlendEnable = true;
- blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
- blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
- blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_REV_SUBTRACT;
- blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
- blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_DEST_ALPHA;
+ blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_INV_DEST_COLOR;
+ blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_COLOR;
+ blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
+ blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
+ blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blendStateDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
Utils::throwIfFailed(_device->CreateBlendState(&blendStateDesc, _excludeBlendState.GetAddressOf()));
From 517f5b30694bf194c1a80fc138170ee8b21377bd Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Mon, 7 Apr 2025 08:23:04 +0200
Subject: [PATCH 05/16] Use single version for TE and TEN
---
TombEngine/Resources.rc | 4 ++--
.../Internal/TEN/Objects/Moveable/MoveableObject.cpp | 2 +-
TombEngine/version.h | 9 +--------
3 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/TombEngine/Resources.rc b/TombEngine/Resources.rc
index 0fa0b9c9e..46163b7a4 100644
--- a/TombEngine/Resources.rc
+++ b/TombEngine/Resources.rc
@@ -28,7 +28,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
VS_VERSION_INFO VERSIONINFO
FILEVERSION TEN_MAJOR_VERSION,TEN_MINOR_VERSION,TEN_BUILD_NUMBER,TEN_REVISION_NUMBER
- PRODUCTVERSION TE_MAJOR_VERSION,TE_MINOR_VERSION,TE_BUILD_NUMBER,TE_REVISION_NUMBER
+ PRODUCTVERSION TEN_MAJOR_VERSION, TEN_MINOR_VERSION, TEN_BUILD_NUMBER, TEN_REVISION_NUMBER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -49,7 +49,7 @@ BEGIN
VALUE "OriginalFilename", "TombEngine.exe"
VALUE "ProductName", "Tomb Engine"
VALUE "FileVersion", TEN_VERSION_STRING
- VALUE "ProductVersion", TE_VERSION_STRING
+ VALUE "ProductVersion", TEN_VERSION_STRING
END
END
BLOCK "VarFileInfo"
diff --git a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
index b11d4ab72..04e4e000b 100644
--- a/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
+++ b/TombEngine/Scripting/Internal/TEN/Objects/Moveable/MoveableObject.cpp
@@ -1240,7 +1240,7 @@ bool Moveable::MeshExists(int index) const
// @tparam int mesh Mesh of a target moveable to use as a camera target.
void Moveable::AttachObjCamera(short camMeshId, Moveable& mov, short targetMeshId)
{
- ObjCamera(_moveable, camMeshId, mov._moveable, targetMeshId, true);
+ ObjCamera(_moveable, camMeshId, mov._moveable, targetMeshId, true);
}
/// Borrow animation from an object
diff --git a/TombEngine/version.h b/TombEngine/version.h
index 654ddf744..a7bbed0aa 100644
--- a/TombEngine/version.h
+++ b/TombEngine/version.h
@@ -1,19 +1,12 @@
#pragma once
-#define TE_MAJOR_VERSION 1
-#define TE_MINOR_VERSION 8
-#define TE_BUILD_NUMBER 1
-#define TE_REVISION_NUMBER 0
-
#define TEN_MAJOR_VERSION 1
#define TEN_MINOR_VERSION 8
-#define TEN_BUILD_NUMBER 1
+#define TEN_BUILD_NUMBER 2
#define TEN_REVISION_NUMBER 0
#define TEST_BUILD 1
#define TOSTR(x) #x
#define MAKE_VERSION_STRING(major, minor, build, revision) TOSTR(major) "." TOSTR(minor) "." TOSTR(build) "." TOSTR(revision)
-
-#define TE_VERSION_STRING MAKE_VERSION_STRING(TE_MAJOR_VERSION, TE_MINOR_VERSION, TE_BUILD_NUMBER, TE_REVISION_NUMBER)
#define TEN_VERSION_STRING MAKE_VERSION_STRING(TEN_MAJOR_VERSION, TEN_MINOR_VERSION, TEN_BUILD_NUMBER, TEN_REVISION_NUMBER)
From b643eec16582a5b1738d1c6db51be5c862d4a1b2 Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Wed, 9 Apr 2025 09:29:39 +0200
Subject: [PATCH 06/16] Added muzzle glow effect for firearms
---
CHANGELOG.md | 4 ++
.../doc/2 classes/Flow.Settings.html | 50 +++++++++++++++++++
TombEngine/Game/control/control.cpp | 1 +
TombEngine/Game/effects/tomb4fx.cpp | 46 +++++++++++++++++
TombEngine/Game/effects/tomb4fx.h | 1 +
TombEngine/Renderer/RendererDraw.cpp | 8 +--
TombEngine/Renderer/RendererDrawEffect.cpp | 41 +--------------
.../Internal/TEN/Flow/Settings/Settings.cpp | 28 +++++++----
.../Internal/TEN/Flow/Settings/Settings.h | 2 +
9 files changed, 126 insertions(+), 55 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fecd0365f..b5f5d1329 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,11 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed caustics not rendered correctly if texture compression was enabled.
* Fixed exclusion blend mode not working correctly.
+### New features
+* Added muzzle glow effect for firearms.
+
### Lua API changes
+* Added `muzzleGlow` and `muzzleOffset` parameters to weapon settings.
* Fixed `Moveable.GetJointPosition` not returning correct results if moveable is invisible or not rendered.
## [Version 1.8.1](https://github.com/TombEngine/TombEditorReleases/releases/tag/v1.8.1) - 2025-03-29
diff --git a/Documentation/doc/2 classes/Flow.Settings.html b/Documentation/doc/2 classes/Flow.Settings.html
index 6003f5cdc..c59098a2a 100644
--- a/Documentation/doc/2 classes/Flow.Settings.html
+++ b/Documentation/doc/2 classes/Flow.Settings.html
@@ -300,9 +300,17 @@
Display muzzle flash. |
+ muzzleGlow |
+ Display muzzle glow. |
+
+
colorizeMuzzleFlash |
Colorize muzzle flash. |
+
+ muzzleOffset |
+ Muzzle offset. |
+
@@ -1214,6 +1222,27 @@
+
+
+
+ muzzleGlow
+
+
+ Display muzzle glow.
+
+
+
+
+ - muzzleGlow
+ bool
+ specifies whether muzzle glow should be displayed or not. Applicable only for firearms.
+
+
+
+
+
+
+
@@ -1235,6 +1264,27 @@
+
+
+
+ muzzleOffset
+
+
+ Muzzle offset.
+
+
+
+
+ - muzzleOffset
+ Vec3
+ specifies offset for spawning muzzle gunflash effects. Applicable only for firearms.
+
+
+
+
+
+
+
diff --git a/TombEngine/Game/control/control.cpp b/TombEngine/Game/control/control.cpp
index d5171cbae..b543b9ee5 100644
--- a/TombEngine/Game/control/control.cpp
+++ b/TombEngine/Game/control/control.cpp
@@ -194,6 +194,7 @@ GameStatus GamePhase(bool insideMenu)
UpdateBlood();
UpdateBubbles();
UpdateDebris();
+ UpdateGunFlashes();
UpdateGunShells();
UpdateFootprints();
UpdateSplashes();
diff --git a/TombEngine/Game/effects/tomb4fx.cpp b/TombEngine/Game/effects/tomb4fx.cpp
index c97fd5a8b..12bd28a61 100644
--- a/TombEngine/Game/effects/tomb4fx.cpp
+++ b/TombEngine/Game/effects/tomb4fx.cpp
@@ -941,6 +941,52 @@ void TriggerGunShell(short hand, short objNum, LaraWeaponType weaponType)
}
}
+void UpdateGunFlashes()
+{
+ if (Lara.Control.Weapon.GunType == LaraWeaponType::None)
+ return;
+
+ const auto& settings = g_GameFlow->GetSettings()->Weapons[(int)Lara.Control.Weapon.GunType - 1];
+
+ if (!settings.MuzzleGlow)
+ return;
+
+ for (int hand = 0; hand < 2; hand++)
+ {
+ if ((hand ? Lara.RightArm.GunFlash : Lara.LeftArm.GunFlash) == 0)
+ continue;
+
+ auto& part = *GetFreeParticle();
+
+ part.on = true;
+ part.SpriteSeqID = ID_DEFAULT_SPRITES;
+ part.SpriteID = 11;
+ part.blendMode = BlendMode::Additive;
+
+ auto pos = GetJointPosition(LaraItem, hand ? LM_RHAND : LM_LHAND, settings.MuzzleOffset.ToVector3i());
+ part.x = pos.x;
+ part.y = pos.y;
+ part.z = pos.z;
+ part.roomNumber = LaraItem->RoomNumber;
+
+ part.sSize = part.size = part.dSize = 192;
+ part.scalar = 2;
+
+ part.xVel = part.yVel = part.zVel = 0;
+ part.gravity = part.friction = part.maxYvel = 0;
+
+ part.sR = part.dR = settings.FlashColor.GetR() / 2;
+ part.sG = part.dG = settings.FlashColor.GetG() / 2;
+ part.sB = part.dB = settings.FlashColor.GetB() / 2;
+
+ part.life = part.sLife = 2;
+ part.colFadeSpeed = 1;
+ part.fadeToBlack = 1;
+
+ part.flags = SP_SCALE | SP_DEF | SP_EXPDEF;
+ }
+}
+
void UpdateGunShells()
{
for (int i = 0; i < MAX_GUNSHELL; i++)
diff --git a/TombEngine/Game/effects/tomb4fx.h b/TombEngine/Game/effects/tomb4fx.h
index b65f8b41e..629d4e4bc 100644
--- a/TombEngine/Game/effects/tomb4fx.h
+++ b/TombEngine/Game/effects/tomb4fx.h
@@ -323,6 +323,7 @@ void TriggerBlood(int x, int y, int z, int unk, int num);
void UpdateBlood();
int GetFreeGunshell();
void TriggerGunShell(short hand, short objNum, LaraWeaponType weaponType);
+void UpdateGunFlashes();
void UpdateGunShells();
void AddWaterSparks(int x, int y, int z, int num);
void ExplodingDeath(short itemNumber, short flags); // BODY_ flags
diff --git a/TombEngine/Renderer/RendererDraw.cpp b/TombEngine/Renderer/RendererDraw.cpp
index 341a7f986..f068a8fd1 100644
--- a/TombEngine/Renderer/RendererDraw.cpp
+++ b/TombEngine/Renderer/RendererDraw.cpp
@@ -2824,12 +2824,8 @@ namespace TEN::Renderer
}
else
{
- BindTexture(
- TextureRegister::ColorMap, &std::get<0>(_roomTextures[bucket.Texture]),
- SamplerStateRegister::AnisotropicClamp);
- BindTexture(
- TextureRegister::NormalMap, &std::get<1>(_roomTextures[bucket.Texture]),
- SamplerStateRegister::AnisotropicClamp);
+ BindTexture(TextureRegister::ColorMap, &std::get<0>(_roomTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp);
+ BindTexture(TextureRegister::NormalMap, &std::get<1>(_roomTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp);
}
DrawIndexedTriangles(bucket.NumIndices, bucket.StartIndex, 0);
diff --git a/TombEngine/Renderer/RendererDrawEffect.cpp b/TombEngine/Renderer/RendererDrawEffect.cpp
index cb903c2f6..04104ca09 100644
--- a/TombEngine/Renderer/RendererDrawEffect.cpp
+++ b/TombEngine/Renderer/RendererDrawEffect.cpp
@@ -1085,50 +1085,13 @@ namespace TEN::Renderer
if (!settings.MuzzleFlash)
return false;
- short length = 0;
- short zOffset = 0;
- short rotationX = 0;
-
if (Lara.Control.Weapon.GunType != LaraWeaponType::Flare &&
Lara.Control.Weapon.GunType != LaraWeaponType::Crossbow)
{
- switch (Lara.Control.Weapon.GunType)
- {
- case LaraWeaponType::Revolver:
- length = 192;
- zOffset = 68;
- rotationX = -14560;
- break;
-
- case LaraWeaponType::Uzi:
- length = 190;
- zOffset = 50;
- rotationX = -14560;
- break;
-
- case LaraWeaponType::HK:
- case LaraWeaponType::Shotgun:
- length = 300;
- zOffset = 92;
- rotationX = -14560;
- break;
-
- default:
- case LaraWeaponType::Pistol:
- length = 180;
- zOffset = 40;
- rotationX = -16830;
- break;
- }
-
// Use MP5 flash if available.
auto gunflash = GAME_OBJECT_ID::ID_GUN_FLASH;
if (Lara.Control.Weapon.GunType == LaraWeaponType::HK && Objects[GAME_OBJECT_ID::ID_GUN_FLASH2].loaded)
- {
gunflash = GAME_OBJECT_ID::ID_GUN_FLASH2;
- length += 20;
- zOffset += 10;
- }
if (!_moveableObjects[gunflash].has_value())
return false;
@@ -1167,8 +1130,8 @@ namespace TEN::Renderer
BindTexture(TextureRegister::ColorMap, &std::get<0>(_moveablesTextures[flashBucket.Texture]), SamplerStateRegister::AnisotropicClamp);
- auto tMatrix = Matrix::CreateTranslation(0, length, zOffset);
- auto rotMatrix = Matrix::CreateRotationX(TO_RAD(rotationX));
+ auto tMatrix = Matrix::CreateTranslation(settings.MuzzleOffset);
+ auto rotMatrix = Matrix::CreateRotationX(TO_RAD(Lara.Control.Weapon.GunType == LaraWeaponType::Pistol ? -16830 : -14560)); // HACK
auto worldMatrix = Matrix::Identity;
if (Lara.LeftArm.GunFlash)
diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp
index 51cda08ee..88637ce35 100644
--- a/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp
+++ b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp
@@ -25,15 +25,15 @@ namespace TEN::Scripting
// NOTE: Since Weapons array is bound to Lua directly and Lua accesses this array by native enum, where 0 is NONE, and 1 is PISTOLS,
// 0 index is omitted due to Lua indexing arrays starting from 1. 1 must be subtracted from initializer index.
- Weapons[(int)LaraWeaponType::Pistol - 1] = { 8.0f, BLOCK(8), 9, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 3, true, true, true, false };
- Weapons[(int)LaraWeaponType::Revolver - 1] = { 4.0f, BLOCK(8), 16, (int)BLOCK(0.65f), 21, 21, 6, ScriptColor(192, 128, 0), 9, 3, true, false, true, false };
- Weapons[(int)LaraWeaponType::Uzi - 1] = { 8.0f, BLOCK(8), 3, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 2, true, true, true, false };
- Weapons[(int)LaraWeaponType::Shotgun - 1] = { 10.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 3, 3, 6, ScriptColor(192, 128, 0), 12, 3, true, true, false, false };
- Weapons[(int)LaraWeaponType::HK - 1] = { 4.0f, BLOCK(12), 0, (int)BLOCK(0.50f), 4, 4, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, false };
- Weapons[(int)LaraWeaponType::Crossbow - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 5, 20, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false };
- Weapons[(int)LaraWeaponType::GrenadeLauncher - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 30, 30, 10, ScriptColor(192, 128, 0), 0, 0, true, false, false, false };
- Weapons[(int)LaraWeaponType::RocketLauncher - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 30, 30, 1, ScriptColor(192, 128, 0), 0, 0, true, false, false, false };
- Weapons[(int)LaraWeaponType::HarpoonGun - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 6, 6, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false };
+ Weapons[(int)LaraWeaponType::Pistol - 1] = { 8.0f, BLOCK(8), 9, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 3, true, true, true, true, false, Vec3(0, 180, 40) };
+ Weapons[(int)LaraWeaponType::Revolver - 1] = { 4.0f, BLOCK(8), 16, (int)BLOCK(0.65f), 21, 21, 6, ScriptColor(192, 128, 0), 9, 3, true, false, true, true, false, Vec3(0, 192, 68) };
+ Weapons[(int)LaraWeaponType::Uzi - 1] = { 8.0f, BLOCK(8), 3, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 2, true, true, true, true, false, Vec3(0, 190, 50) };
+ Weapons[(int)LaraWeaponType::Shotgun - 1] = { 10.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 3, 3, 6, ScriptColor(192, 128, 0), 12, 3, true, true, false, false, false, Vec3(0, 300, 92) };
+ Weapons[(int)LaraWeaponType::HK - 1] = { 4.0f, BLOCK(12), 0, (int)BLOCK(0.50f), 4, 4, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, true, false, Vec3(0, 320, 102) };
+ Weapons[(int)LaraWeaponType::Crossbow - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 5, 20, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false, false, Vec3() };
+ Weapons[(int)LaraWeaponType::GrenadeLauncher - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 30, 30, 10, ScriptColor(192, 128, 0), 0, 0, true, false, false, false, false, Vec3() };
+ Weapons[(int)LaraWeaponType::RocketLauncher - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 30, 30, 1, ScriptColor(192, 128, 0), 0, 0, true, false, false, false, false, Vec3() };
+ Weapons[(int)LaraWeaponType::HarpoonGun - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 6, 6, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false, false, Vec3() };
}
void Settings::Register(sol::table& parent)
@@ -309,9 +309,17 @@ namespace TEN::Scripting
// @tfield bool muzzleFlash specifies whether muzzle flash should be displayed or not. Applicable only for firearms.
"muzzleFlash", &WeaponSettings::MuzzleFlash,
+ /// Display muzzle glow.
+ // @tfield bool muzzleGlow specifies whether muzzle glow should be displayed or not. Applicable only for firearms.
+ "muzzleGlow", &WeaponSettings::MuzzleGlow,
+
/// Colorize muzzle flash.
// @tfield bool colorizeMuzzleFlash specifies whether muzzle flash should be tinted with the same color as gunflash color. Applicable only for firearms.
- "colorizeMuzzleFlash", &WeaponSettings::ColorizeMuzzleFlash);
+ "colorizeMuzzleFlash", &WeaponSettings::ColorizeMuzzleFlash,
+
+ /// Muzzle offset.
+ // @tfield Vec3 muzzleOffset specifies offset for spawning muzzle gunflash effects. Applicable only for firearms.
+ "muzzleOffset", &WeaponSettings::MuzzleOffset);
}
/// System
diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.h b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.h
index 7b2d962ad..f4f110141 100644
--- a/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.h
+++ b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.h
@@ -103,7 +103,9 @@ namespace TEN::Scripting
bool Smoke = false;
bool Shell = false;
bool MuzzleFlash = true;
+ bool MuzzleGlow = true;
bool ColorizeMuzzleFlash = false;
+ Vec3 MuzzleOffset = {};
static void Register(sol::table& parent);
};
From ba166aa6fa72943e19e23b9cc7e6ae719ce9e2b7 Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Wed, 9 Apr 2025 09:48:40 +0200
Subject: [PATCH 07/16] Randomize glow angle
---
TombEngine/Game/effects/tomb4fx.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/TombEngine/Game/effects/tomb4fx.cpp b/TombEngine/Game/effects/tomb4fx.cpp
index 12bd28a61..b100e8ed3 100644
--- a/TombEngine/Game/effects/tomb4fx.cpp
+++ b/TombEngine/Game/effects/tomb4fx.cpp
@@ -969,6 +969,9 @@ void UpdateGunFlashes()
part.z = pos.z;
part.roomNumber = LaraItem->RoomNumber;
+ part.rotAng = ANGLE(TO_DEGREES(Random::GenerateAngle())) >> 4;
+ part.rotAdd = 0;
+
part.sSize = part.size = part.dSize = 192;
part.scalar = 2;
From c81feb7da14d430786622f59207d732b587bdc76 Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Wed, 9 Apr 2025 23:47:12 +0200
Subject: [PATCH 08/16] Dehardcode gun smoke positions, calculate gunflash
offset
---
TombEngine/Game/Lara/lara_one_gun.cpp | 29 ++++---------------
TombEngine/Game/Lara/lara_two_guns.cpp | 21 ++------------
TombEngine/Renderer/RendererDrawEffect.cpp | 6 +++-
.../Internal/TEN/Flow/Settings/Settings.cpp | 10 +++----
4 files changed, 17 insertions(+), 49 deletions(-)
diff --git a/TombEngine/Game/Lara/lara_one_gun.cpp b/TombEngine/Game/Lara/lara_one_gun.cpp
index 32b7d60bf..d651388ea 100644
--- a/TombEngine/Game/Lara/lara_one_gun.cpp
+++ b/TombEngine/Game/Lara/lara_one_gun.cpp
@@ -68,27 +68,6 @@ constexpr auto HK_RAPID_MODE_SHOT_INTERVAL = 3.0f;
constexpr auto SHOTGUN_PELLET_COUNT = 6;
-static Vector3i GetWeaponSmokeRelOffset(LaraWeaponType weaponType)
-{
- switch (weaponType)
- {
- case LaraWeaponType::HK:
- return Vector3i(0, 228, 96);
-
- case LaraWeaponType::Shotgun:
- return Vector3i(0, 228, 0);
-
- case LaraWeaponType::GrenadeLauncher:
- return Vector3i(0, 180, 80);
-
- case LaraWeaponType::RocketLauncher:
- return Vector3i(0, 84, 72);;
-
- default:
- return Vector3i::Zero;
- }
-}
-
void AnimateShotgun(ItemInfo& laraItem, LaraWeaponType weaponType)
{
auto& player = *GetLaraInfo(&laraItem);
@@ -96,7 +75,7 @@ void AnimateShotgun(ItemInfo& laraItem, LaraWeaponType weaponType)
if (player.LeftArm.GunSmoke > 0)
{
- auto relOffset = GetWeaponSmokeRelOffset(weaponType);
+ auto relOffset = g_GameFlow->GetSettings()->Weapons[(int)weaponType - 1].MuzzleOffset.ToVector3();
auto pos = GetJointPosition(&laraItem, LM_RHAND, relOffset);
if (laraItem.MeshBits.TestAny())
@@ -411,8 +390,10 @@ void FireShotgun(ItemInfo& laraItem)
if (!ammo.HasInfinite())
ammo--;
- auto pos = GetJointPosition(&laraItem, LM_RHAND, Vector3i(0, 1508, 32));
- auto pos2 = GetJointPosition(&laraItem, LM_RHAND, Vector3i(0, 228, 32));
+ auto offset = g_GameFlow->GetSettings()->Weapons[(int)LaraWeaponType::Shotgun].MuzzleOffset.ToVector3i();
+
+ auto pos = GetJointPosition(&laraItem, LM_RHAND, offset + Vector3::UnitY * CLICK(2));
+ auto pos2 = GetJointPosition(&laraItem, LM_RHAND, offset);
player.LeftArm.GunSmoke = 32;
diff --git a/TombEngine/Game/Lara/lara_two_guns.cpp b/TombEngine/Game/Lara/lara_two_guns.cpp
index a044c4282..48a26e200 100644
--- a/TombEngine/Game/Lara/lara_two_guns.cpp
+++ b/TombEngine/Game/Lara/lara_two_guns.cpp
@@ -45,24 +45,6 @@ static WeaponAnimData GetWeaponAnimData(LaraWeaponType weaponType)
return ((it != ANIM_DATA_MAP.end()) ? it->second : ANIM_DATA_MAP.at(LaraWeaponType::None));
}
-static Vector3i GetWeaponSmokeRelOffset(LaraWeaponType weaponType, bool isRightWeapon)
-{
- switch (weaponType)
- {
- case LaraWeaponType::Pistol:
- return Vector3i(isRightWeapon ? -16 : 4, 128, 40);
-
- case LaraWeaponType::Revolver:
- return Vector3i(isRightWeapon ? -32 : 16, 160, 56);
-
- case LaraWeaponType::Uzi:
- return Vector3i(isRightWeapon ? -16 : 8, 140, 48);
-
- default:
- return Vector3i::Zero;
- }
-}
-
static void SetArmInfo(const ItemInfo& laraItem, ArmInfo& arm, int frame)
{
const auto& player = GetLaraInfo(laraItem);
@@ -118,8 +100,9 @@ static void AnimateWeapon(ItemInfo& laraItem, LaraWeaponType weaponType, bool& h
// Spawn weapon smoke.
if (laraItem.MeshBits.TestAny() && arm.GunSmoke)
{
- auto relOffset = GetWeaponSmokeRelOffset(weaponType, isRightWeapon);
+ auto relOffset = g_GameFlow->GetSettings()->Weapons[(int)weaponType - 1].MuzzleOffset.ToVector3();
auto pos = GetJointPosition(&laraItem, isRightWeapon ? LM_RHAND : LM_LHAND, relOffset);
+
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, weaponType, arm.GunSmoke);
}
diff --git a/TombEngine/Renderer/RendererDrawEffect.cpp b/TombEngine/Renderer/RendererDrawEffect.cpp
index 04104ca09..ce6ed8034 100644
--- a/TombEngine/Renderer/RendererDrawEffect.cpp
+++ b/TombEngine/Renderer/RendererDrawEffect.cpp
@@ -1130,7 +1130,11 @@ namespace TEN::Renderer
BindTexture(TextureRegister::ColorMap, &std::get<0>(_moveablesTextures[flashBucket.Texture]), SamplerStateRegister::AnisotropicClamp);
- auto tMatrix = Matrix::CreateTranslation(settings.MuzzleOffset);
+
+ auto meshOffset = g_Level.Frames[GetAnimData(gunflash, 0).FramePtr].Offset;
+ auto offset = settings.MuzzleOffset + Vector3(meshOffset.x, meshOffset.z, meshOffset.y); // Offsets are inverted because of bone orientation.
+
+ auto tMatrix = Matrix::CreateTranslation(offset);
auto rotMatrix = Matrix::CreateRotationX(TO_RAD(Lara.Control.Weapon.GunType == LaraWeaponType::Pistol ? -16830 : -14560)); // HACK
auto worldMatrix = Matrix::Identity;
diff --git a/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp
index 88637ce35..cb65ca8d7 100644
--- a/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp
+++ b/TombEngine/Scripting/Internal/TEN/Flow/Settings/Settings.cpp
@@ -25,11 +25,11 @@ namespace TEN::Scripting
// NOTE: Since Weapons array is bound to Lua directly and Lua accesses this array by native enum, where 0 is NONE, and 1 is PISTOLS,
// 0 index is omitted due to Lua indexing arrays starting from 1. 1 must be subtracted from initializer index.
- Weapons[(int)LaraWeaponType::Pistol - 1] = { 8.0f, BLOCK(8), 9, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 3, true, true, true, true, false, Vec3(0, 180, 40) };
- Weapons[(int)LaraWeaponType::Revolver - 1] = { 4.0f, BLOCK(8), 16, (int)BLOCK(0.65f), 21, 21, 6, ScriptColor(192, 128, 0), 9, 3, true, false, true, true, false, Vec3(0, 192, 68) };
- Weapons[(int)LaraWeaponType::Uzi - 1] = { 8.0f, BLOCK(8), 3, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 2, true, true, true, true, false, Vec3(0, 190, 50) };
- Weapons[(int)LaraWeaponType::Shotgun - 1] = { 10.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 3, 3, 6, ScriptColor(192, 128, 0), 12, 3, true, true, false, false, false, Vec3(0, 300, 92) };
- Weapons[(int)LaraWeaponType::HK - 1] = { 4.0f, BLOCK(12), 0, (int)BLOCK(0.50f), 4, 4, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, true, false, Vec3(0, 320, 102) };
+ Weapons[(int)LaraWeaponType::Pistol - 1] = { 8.0f, BLOCK(8), 9, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 3, true, true, true, true, false, Vec3( 0, 120, 30) };
+ Weapons[(int)LaraWeaponType::Revolver - 1] = { 4.0f, BLOCK(8), 16, (int)BLOCK(0.65f), 21, 21, 6, ScriptColor(192, 128, 0), 9, 3, true, false, true, true, false, Vec3(-10, 130, 45) };
+ Weapons[(int)LaraWeaponType::Uzi - 1] = { 8.0f, BLOCK(8), 3, (int)BLOCK(0.65f), 1, 1, 30, ScriptColor(192, 128, 0), 9, 2, true, true, true, true, false, Vec3( 0, 110, 40) };
+ Weapons[(int)LaraWeaponType::Shotgun - 1] = { 10.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 3, 3, 6, ScriptColor(192, 128, 0), 12, 3, true, true, false, false, false, Vec3( 0, 210, 42) };
+ Weapons[(int)LaraWeaponType::HK - 1] = { 4.0f, BLOCK(12), 0, (int)BLOCK(0.50f), 4, 4, 30, ScriptColor(192, 128, 0), 12, 2, true, true, true, true, false, Vec3( 0, 220, 102) };
Weapons[(int)LaraWeaponType::Crossbow - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 5, 20, 10, ScriptColor(192, 128, 0), 0, 0, false, false, false, false, false, Vec3() };
Weapons[(int)LaraWeaponType::GrenadeLauncher - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 30, 30, 10, ScriptColor(192, 128, 0), 0, 0, true, false, false, false, false, Vec3() };
Weapons[(int)LaraWeaponType::RocketLauncher - 1] = { 8.0f, BLOCK(8), 0, (int)BLOCK(0.50f), 30, 30, 1, ScriptColor(192, 128, 0), 0, 0, true, false, false, false, false, Vec3() };
From ee5147eb4f0d18d83c42f14334dfc25abeb3de4b Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Thu, 10 Apr 2025 21:23:34 +0200
Subject: [PATCH 09/16] Fixed spamming of HK sound effects
---
CHANGELOG.md | 1 +
TombEngine/Game/Lara/lara_one_gun.cpp | 7 ++-----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5f5d1329..2fd24b052 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed Wraith objects not working correctly in flipped rooms.
* Fixed caustics not rendered correctly if texture compression was enabled.
* Fixed exclusion blend mode not working correctly.
+* Fixed HK sound effects.
### New features
* Added muzzle glow effect for firearms.
diff --git a/TombEngine/Game/Lara/lara_one_gun.cpp b/TombEngine/Game/Lara/lara_one_gun.cpp
index d651388ea..3dcefb301 100644
--- a/TombEngine/Game/Lara/lara_one_gun.cpp
+++ b/TombEngine/Game/Lara/lara_one_gun.cpp
@@ -231,9 +231,8 @@ void AnimateShotgun(ItemInfo& laraItem, LaraWeaponType weaponType)
player.Control.Weapon.Timer = 0.0f;
}
}
- else if (player.Control.Weapon.Timer != 0.0f)
+ else if (weaponType == LaraWeaponType::HK && player.Control.Weapon.Timer != 0.0f)
{
- SoundEffect(SFX_TR4_EXPLOSION1, &laraItem.Pose, SoundEnvironment::Land, 1.0f, 0.4f);
SoundEffect(SFX_TR4_HK_FIRE, &laraItem.Pose);
}
else if (weaponType == LaraWeaponType::Shotgun && !IsHeld(In::Action) && !player.LeftArm.Locked)
@@ -312,9 +311,8 @@ void AnimateShotgun(ItemInfo& laraItem, LaraWeaponType weaponType)
player.Control.Weapon.Timer = 0.0f;
}
}
- else if (player.Control.Weapon.Timer != 0.0f)
+ else if (weaponType == LaraWeaponType::HK && player.Control.Weapon.Timer != 0.0f)
{
- SoundEffect(SFX_TR4_EXPLOSION1, &laraItem.Pose, SoundEnvironment::Land, 1.0f, 0.4f);
SoundEffect(SFX_TR4_HK_FIRE, &laraItem.Pose);
}
@@ -1233,7 +1231,6 @@ void LasersightWeaponHandler(ItemInfo& item, LaraWeaponType weaponType)
if (playSound)
{
- SoundEffect(SFX_TR4_EXPLOSION1, nullptr, SoundEnvironment::Land, 1.0f, 0.4f);
SoundEffect(SFX_TR4_HK_FIRE, nullptr);
Camera.bounce = -16 - (GetRandomControl() & 0x1F);
}
From 218299193fc9b1b01aa5ccb9e60e93410396e442 Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Fri, 11 Apr 2025 03:11:05 +0200
Subject: [PATCH 10/16] Another method for SSAO fix
---
CHANGELOG.md | 1 +
TombEngine/Renderer/RendererDraw.cpp | 6 +-----
TombEngine/Shaders/InstancedStatics.fx | 3 +++
TombEngine/Shaders/Items.fx | 3 +++
TombEngine/Shaders/Rooms.fx | 3 +++
5 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fd24b052..47356f0a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed Wraith objects not working correctly in flipped rooms.
* Fixed caustics not rendered correctly if texture compression was enabled.
* Fixed exclusion blend mode not working correctly.
+* Fixed SSAO incorrectly applied through alpha blended textures.
* Fixed HK sound effects.
### New features
diff --git a/TombEngine/Renderer/RendererDraw.cpp b/TombEngine/Renderer/RendererDraw.cpp
index f068a8fd1..1949fc062 100644
--- a/TombEngine/Renderer/RendererDraw.cpp
+++ b/TombEngine/Renderer/RendererDraw.cpp
@@ -3236,11 +3236,7 @@ namespace TEN::Renderer
case RendererPass::GBuffer:
if (blendMode != BlendMode::Opaque &&
blendMode != BlendMode::AlphaTest &&
- blendMode != BlendMode::FastAlphaBlend &&
- // WARNING: For G-Buffer step we consider alpha blend like alpha test
- // assuming that most of the geometry used in rooms, items and statics
- // are fences, foliages, trees... But it could fail with translucent surfaces!
- blendMode != BlendMode::AlphaBlend)
+ blendMode != BlendMode::FastAlphaBlend)
{
return false;
}
diff --git a/TombEngine/Shaders/InstancedStatics.fx b/TombEngine/Shaders/InstancedStatics.fx
index 26ed08921..e284579e9 100644
--- a/TombEngine/Shaders/InstancedStatics.fx
+++ b/TombEngine/Shaders/InstancedStatics.fx
@@ -110,6 +110,9 @@ PixelShaderOutput PS(PixelShaderInput input)
samplePosition = samplePosition * 0.5f + 0.5f;
samplePosition.y = 1.0f - samplePosition.y;
occlusion = pow(SSAOTexture.Sample(SSAOSampler, samplePosition).x, AmbientOcclusionExponent);
+
+ if (BlendMode == BLENDMODE_ALPHABLEND)
+ occlusion = lerp(occlusion, 1.0f, tex.w);
}
float3 color = (mode == 0) ?
diff --git a/TombEngine/Shaders/Items.fx b/TombEngine/Shaders/Items.fx
index c789da24c..d8a13d5dc 100644
--- a/TombEngine/Shaders/Items.fx
+++ b/TombEngine/Shaders/Items.fx
@@ -140,6 +140,9 @@ PixelShaderOutput PS(PixelShaderInput input)
samplePosition = samplePosition * 0.5f + 0.5f; // transform to range 0.0 - 1.0
samplePosition.y = 1.0f - samplePosition.y;
occlusion = pow(SSAOTexture.Sample(SSAOSampler, samplePosition).x, AmbientOcclusionExponent);
+
+ if (BlendMode == BLENDMODE_ALPHABLEND)
+ occlusion = lerp(occlusion, 1.0f, tex.w);
}
float3 color = (BoneLightModes[input.Bone / 4][input.Bone % 4] == 0) ?
diff --git a/TombEngine/Shaders/Rooms.fx b/TombEngine/Shaders/Rooms.fx
index b1da5c9ec..619e18972 100644
--- a/TombEngine/Shaders/Rooms.fx
+++ b/TombEngine/Shaders/Rooms.fx
@@ -141,6 +141,9 @@ PixelShaderOutput PS(PixelShaderInput input)
samplePosition = samplePosition * 0.5f + 0.5f; // transform to range 0.0 - 1.0
samplePosition.y = 1.0f - samplePosition.y;
occlusion = pow(SSAOTexture.Sample(SSAOSampler, samplePosition).x, AmbientOcclusionExponent);
+
+ if (BlendMode == BLENDMODE_ALPHABLEND)
+ occlusion = lerp(occlusion, 1.0f, output.Color.w);
}
lighting = DoShadow(input.WorldPosition, normal, lighting, -2.5f);
From 0128660f0747d8f15046fef5ca59784e5277388f Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Sat, 12 Apr 2025 17:27:06 +0200
Subject: [PATCH 11/16] Change LDoc to properly format optional arguments and
defaults
---
Documentation/compiler/ldoc/ldoc/doc.lua | 15 +++++++--------
.../compiler/ldoc/ldoc/html/ldoc_ltp.lua | 6 +++---
Documentation/ldoc.ltp | 6 +++---
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/Documentation/compiler/ldoc/ldoc/doc.lua b/Documentation/compiler/ldoc/ldoc/doc.lua
index 30f8eafc5..52860ccba 100644
--- a/Documentation/compiler/ldoc/ldoc/doc.lua
+++ b/Documentation/compiler/ldoc/ldoc/doc.lua
@@ -868,20 +868,19 @@ function build_arg_list (names,pmods)
local opt
if m then
if not m.optchain then
- acc ((']'):rep(npending))
npending=0
end
opt = m.optchain or m.opt
- if opt then
- acc('[')
- npending=npending+1
- end
end
if i>1 then acc (', ') end
- acc(names[i])
- if opt and opt ~= true then acc('='..opt) end
+ if opt then
+ acc('[' .. names[i])
+ if opt ~= true then acc('='..opt) end
+ acc(']')
+ else
+ acc(names[i])
+ end
end
- acc ((']'):rep(npending))
return '('..table.concat(buffer)..')'
end
diff --git a/Documentation/compiler/ldoc/ldoc/html/ldoc_ltp.lua b/Documentation/compiler/ldoc/ldoc/html/ldoc_ltp.lua
index 31b09d72c..2efb79a43 100644
--- a/Documentation/compiler/ldoc/ldoc/html/ldoc_ltp.lua
+++ b/Documentation/compiler/ldoc/ldoc/html/ldoc_ltp.lua
@@ -215,12 +215,12 @@ return [==[
# end
$(M(item.params.map[p],item))
# if def == true then
- (optional)
+ (Optional.)
# elseif def then
- (default $(def))
+ (Default. $(def))
# end
# if item:readonly(p) then
- readonly
+ Read-only.
# end
# end
diff --git a/Documentation/ldoc.ltp b/Documentation/ldoc.ltp
index 77472d077..5034016d4 100644
--- a/Documentation/ldoc.ltp
+++ b/Documentation/ldoc.ltp
@@ -216,12 +216,12 @@
# end
$(M(item.params.map[p],item))
# if def == true then
- (optional)
+ Optional.
# elseif def then
- (default $(def))
+ Default: $(def).
# end
# if item:readonly(p) then
- readonly
+ Read-only.
# end
# end
From 73af37dbe15f194f50e828c8a5b6971da04a3cfb Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Sun, 13 Apr 2025 16:19:58 +0200
Subject: [PATCH 12/16] Fixed lensflare enabled status not saved in a savegame
---
TombEngine/Game/savegame.cpp | 2 ++
.../flatbuffers/ten_savegame_generated.h | 30 ++++++++++++++-----
.../Specific/savegame/schema/ten_savegame.fbs | 1 +
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/TombEngine/Game/savegame.cpp b/TombEngine/Game/savegame.cpp
index 8f3f1394c..26b41d8ad 100644
--- a/TombEngine/Game/savegame.cpp
+++ b/TombEngine/Game/savegame.cpp
@@ -1143,6 +1143,7 @@ const std::vector SaveGame::Build()
levelData.add_sky_layer_2_color(level->GetSkyLayerColor(1));
levelData.add_sky_layer_2_speed(level->GetSkyLayerSpeed(1));
+ levelData.add_lensflare_enabled(level->LensFlare.GetEnabled());
levelData.add_lensflare_color(level->LensFlare.GetColor());
levelData.add_lensflare_pitch(level->LensFlare.GetPitch());
levelData.add_lensflare_yaw(level->LensFlare.GetYaw());
@@ -1844,6 +1845,7 @@ static void ParseLua(const Save::SaveGame* s, bool hubMode)
level->Layer2.CloudSpeed = s->level_data()->sky_layer_2_speed();
level->Layer2.SetColor(s->level_data()->sky_layer_2_color());
+ level->LensFlare.SetEnabled(s->level_data()->lensflare_enabled());
level->LensFlare.SetSunSpriteID(s->level_data()->lensflare_sprite_id());
level->LensFlare.SetPitch(s->level_data()->lensflare_pitch());
level->LensFlare.SetYaw(s->level_data()->lensflare_yaw());
diff --git a/TombEngine/Specific/savegame/flatbuffers/ten_savegame_generated.h b/TombEngine/Specific/savegame/flatbuffers/ten_savegame_generated.h
index a99d79882..3c85b7494 100644
--- a/TombEngine/Specific/savegame/flatbuffers/ten_savegame_generated.h
+++ b/TombEngine/Specific/savegame/flatbuffers/ten_savegame_generated.h
@@ -571,6 +571,7 @@ struct LevelDataT : public flatbuffers::NativeTable {
std::unique_ptr horizon2_position{};
std::unique_ptr horizon2_orientation{};
float horizon2_transparency = 0.0f;
+ bool lensflare_enabled = false;
int32_t lensflare_sprite_id = 0;
float lensflare_pitch = 0.0f;
float lensflare_yaw = 0.0f;
@@ -610,14 +611,15 @@ struct LevelData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_HORIZON2_POSITION = 46,
VT_HORIZON2_ORIENTATION = 48,
VT_HORIZON2_TRANSPARENCY = 50,
- VT_LENSFLARE_SPRITE_ID = 52,
- VT_LENSFLARE_PITCH = 54,
- VT_LENSFLARE_YAW = 56,
- VT_LENSFLARE_COLOR = 58,
- VT_STARFIELD_STAR_COUNT = 60,
- VT_STARFIELD_METEOR_COUNT = 62,
- VT_STARFIELD_METEOR_SPAWN_DENSITY = 64,
- VT_STARFIELD_METEOR_VELOCITY = 66
+ VT_LENSFLARE_ENABLED = 52,
+ VT_LENSFLARE_SPRITE_ID = 54,
+ VT_LENSFLARE_PITCH = 56,
+ VT_LENSFLARE_YAW = 58,
+ VT_LENSFLARE_COLOR = 60,
+ VT_STARFIELD_STAR_COUNT = 62,
+ VT_STARFIELD_METEOR_COUNT = 64,
+ VT_STARFIELD_METEOR_SPAWN_DENSITY = 66,
+ VT_STARFIELD_METEOR_VELOCITY = 68
};
int32_t level_far_view() const {
return GetField(VT_LEVEL_FAR_VIEW, 0);
@@ -691,6 +693,9 @@ struct LevelData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
float horizon2_transparency() const {
return GetField(VT_HORIZON2_TRANSPARENCY, 0.0f);
}
+ bool lensflare_enabled() const {
+ return GetField(VT_LENSFLARE_ENABLED, 0) != 0;
+ }
int32_t lensflare_sprite_id() const {
return GetField(VT_LENSFLARE_SPRITE_ID, 0);
}
@@ -741,6 +746,7 @@ struct LevelData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VerifyField(verifier, VT_HORIZON2_POSITION) &&
VerifyField(verifier, VT_HORIZON2_ORIENTATION) &&
VerifyField(verifier, VT_HORIZON2_TRANSPARENCY) &&
+ VerifyField(verifier, VT_LENSFLARE_ENABLED) &&
VerifyField(verifier, VT_LENSFLARE_SPRITE_ID) &&
VerifyField(verifier, VT_LENSFLARE_PITCH) &&
VerifyField(verifier, VT_LENSFLARE_YAW) &&
@@ -832,6 +838,9 @@ struct LevelDataBuilder {
void add_horizon2_transparency(float horizon2_transparency) {
fbb_.AddElement(LevelData::VT_HORIZON2_TRANSPARENCY, horizon2_transparency, 0.0f);
}
+ void add_lensflare_enabled(bool lensflare_enabled) {
+ fbb_.AddElement(LevelData::VT_LENSFLARE_ENABLED, static_cast(lensflare_enabled), 0);
+ }
void add_lensflare_sprite_id(int32_t lensflare_sprite_id) {
fbb_.AddElement(LevelData::VT_LENSFLARE_SPRITE_ID, lensflare_sprite_id, 0);
}
@@ -893,6 +902,7 @@ inline flatbuffers::Offset CreateLevelData(
const TEN::Save::Vector3 *horizon2_position = 0,
const TEN::Save::EulerAngles *horizon2_orientation = 0,
float horizon2_transparency = 0.0f,
+ bool lensflare_enabled = false,
int32_t lensflare_sprite_id = 0,
float lensflare_pitch = 0.0f,
float lensflare_yaw = 0.0f,
@@ -928,6 +938,7 @@ inline flatbuffers::Offset CreateLevelData(
builder_.add_weather_strength(weather_strength);
builder_.add_weather_type(weather_type);
builder_.add_level_far_view(level_far_view);
+ builder_.add_lensflare_enabled(lensflare_enabled);
builder_.add_horizon2_enabled(horizon2_enabled);
builder_.add_horizon1_enabled(horizon1_enabled);
builder_.add_sky_layer_2_enabled(sky_layer_2_enabled);
@@ -9260,6 +9271,7 @@ inline void LevelData::UnPackTo(LevelDataT *_o, const flatbuffers::resolver_func
{ auto _e = horizon2_position(); if (_e) _o->horizon2_position = std::unique_ptr(new TEN::Save::Vector3(*_e)); }
{ auto _e = horizon2_orientation(); if (_e) _o->horizon2_orientation = std::unique_ptr(new TEN::Save::EulerAngles(*_e)); }
{ auto _e = horizon2_transparency(); _o->horizon2_transparency = _e; }
+ { auto _e = lensflare_enabled(); _o->lensflare_enabled = _e; }
{ auto _e = lensflare_sprite_id(); _o->lensflare_sprite_id = _e; }
{ auto _e = lensflare_pitch(); _o->lensflare_pitch = _e; }
{ auto _e = lensflare_yaw(); _o->lensflare_yaw = _e; }
@@ -9302,6 +9314,7 @@ inline flatbuffers::Offset CreateLevelData(flatbuffers::FlatBufferBui
auto _horizon2_position = _o->horizon2_position ? _o->horizon2_position.get() : 0;
auto _horizon2_orientation = _o->horizon2_orientation ? _o->horizon2_orientation.get() : 0;
auto _horizon2_transparency = _o->horizon2_transparency;
+ auto _lensflare_enabled = _o->lensflare_enabled;
auto _lensflare_sprite_id = _o->lensflare_sprite_id;
auto _lensflare_pitch = _o->lensflare_pitch;
auto _lensflare_yaw = _o->lensflare_yaw;
@@ -9336,6 +9349,7 @@ inline flatbuffers::Offset CreateLevelData(flatbuffers::FlatBufferBui
_horizon2_position,
_horizon2_orientation,
_horizon2_transparency,
+ _lensflare_enabled,
_lensflare_sprite_id,
_lensflare_pitch,
_lensflare_yaw,
diff --git a/TombEngine/Specific/savegame/schema/ten_savegame.fbs b/TombEngine/Specific/savegame/schema/ten_savegame.fbs
index bc41d27be..11d988d99 100644
--- a/TombEngine/Specific/savegame/schema/ten_savegame.fbs
+++ b/TombEngine/Specific/savegame/schema/ten_savegame.fbs
@@ -38,6 +38,7 @@ table LevelData {
horizon2_orientation: EulerAngles;
horizon2_transparency: float;
+ lensflare_enabled: bool;
lensflare_sprite_id: int32;
lensflare_pitch: float;
lensflare_yaw: float;
From 0d604678339363e1a806ef0baeac9d131e6a1c7e Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Sun, 13 Apr 2025 16:22:41 +0200
Subject: [PATCH 13/16] Fixed script API documentation mistakes
---
Documentation/doc/3 primitive classes/Flow.LensFlare.html | 4 ++--
Documentation/doc/3 primitive classes/Vec2.html | 2 +-
.../Scripting/Internal/TEN/Flow/LensFlare/LensFlare.cpp | 2 +-
TombEngine/Scripting/Internal/TEN/Types/Vec2/Vec2.cpp | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/doc/3 primitive classes/Flow.LensFlare.html b/Documentation/doc/3 primitive classes/Flow.LensFlare.html
index 493f9432b..172afbfdf 100644
--- a/Documentation/doc/3 primitive classes/Flow.LensFlare.html
+++ b/Documentation/doc/3 primitive classes/Flow.LensFlare.html
@@ -127,7 +127,7 @@
spriteID |
- (Objects.ObjID.SpriteConstants) Lens flare's sun sprite object ID. |
+ (int) Lens flare's sun sprite ID in DEFAULT_SPRITES sequence. |
pitch |
@@ -178,7 +178,7 @@
spriteID
- (Objects.ObjID.SpriteConstants) Lens flare's sun sprite object ID.
+ (int) Lens flare's sun sprite ID in DEFAULT_SPRITES sequence.
diff --git a/Documentation/doc/3 primitive classes/Vec2.html b/Documentation/doc/3 primitive classes/Vec2.html
index eb65b2271..4bedd88bf 100644
--- a/Documentation/doc/3 primitive classes/Vec2.html
+++ b/Documentation/doc/3 primitive classes/Vec2.html
@@ -354,7 +354,7 @@
Parameters:
- EmitLight(pos[, color][, radius][, shadows][, name]) |
+ EmitLight(pos, [color], [radius], [shadows], [name]) |
Emit dynamic light that lasts for a single frame. |
- EmitSpotLight(pos, dir[, color][, radius][, falloff][, distance][, shadows][, name]) |
+ EmitSpotLight(pos, dir, [color], [radius], [falloff], [distance], [shadows], [name]) |
Emit dynamic directional spotlight that lasts for a single frame. |
@@ -152,7 +152,7 @@
Emit blood. |
- EmitAirBubble(pos[, size][, amp]) |
+ EmitAirBubble(pos, [size], [amp]) |
Emit an air bubble in a water room. |
@@ -172,7 +172,7 @@
Get the wind vector for the current game frame. |
- EmitStreamer(mov, tag, pos, dir[, rot][, startColor][, endColor][, width][, life][, vel][, expRate][, rotRate][, edgeFeatherMode][, lengthFeatherMode][, blendID]) |
+ EmitStreamer(mov, tag, pos, dir, [rot], [startColor], [endColor], [width], [life], [vel], [expRate], [rotRate], [edgeFeatherMode], [lengthFeatherMode], [blendID]) |
Emit an extending streamer effect. |
@@ -454,7 +454,7 @@ EmitAdvancedParticle(particle)
- EmitLight(pos[, color][, radius][, shadows][, name])
+ EmitLight(pos, [color], [radius], [shadows], [name])
Emit dynamic light that lasts for a single frame.
@@ -471,22 +471,22 @@ EmitAdvancedParticle(particle)
color
Color
light color (default Color(255, 255, 255))
- (optional)
+ Optional.
radius
int
measured in "clicks" or 256 world units (default 20)
- (optional)
+ Optional.
shadows
bool
determines whether light should generate dynamic shadows for applicable moveables (default is false)
- (optional)
+ Optional.
name
string
if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights)
- (optional)
+ Optional.
@@ -497,7 +497,7 @@ EmitAdvancedParticle(particle)
- EmitSpotLight(pos, dir[, color][, radius][, falloff][, distance][, shadows][, name])
+ EmitSpotLight(pos, dir, [color], [radius], [falloff], [distance], [shadows], [name])
Emit dynamic directional spotlight that lasts for a single frame.
@@ -518,32 +518,32 @@ EmitAdvancedParticle(particle)
color
Color
(default Color(255, 255, 255))
- (optional)
+ Optional.
radius
int
overall radius at the endpoint of a light cone, measured in "clicks" or 256 world units (default 10)
- (optional)
+ Optional.
falloff
int
radius, at which light starts to fade out, measured in "clicks" (default 5)
- (optional)
+ Optional.
distance
int
distance, at which light cone fades out, measured in "clicks" (default 20)
- (optional)
+ Optional.
shadows
bool
determines whether light should generate dynamic shadows for applicable moveables (default is false)
- (optional)
+ Optional.
name
string
if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights)
- (optional)
+ Optional.
@@ -582,7 +582,7 @@ EmitAdvancedParticle(particle)
- EmitAirBubble(pos[, size][, amp])
+ EmitAirBubble(pos, [size], [amp])
Emit an air bubble in a water room.
@@ -598,12 +598,12 @@ EmitAdvancedParticle(particle)
size
float
Sprite size. Default: 32
- (optional)
+ Optional.
amp
float
Oscillation amplitude. Default: 32
- (optional)
+ Optional.
@@ -718,7 +718,7 @@ EmitAdvancedParticle(particle)
- EmitStreamer(mov, tag, pos, dir[, rot][, startColor][, endColor][, width][, life][, vel][, expRate][, rotRate][, edgeFeatherMode][, lengthFeatherMode][, blendID])
+ EmitStreamer(mov, tag, pos, dir, [rot], [startColor], [endColor], [width], [life], [vel], [expRate], [rotRate], [edgeFeatherMode], [lengthFeatherMode], [blendID])
Emit an extending streamer effect.
@@ -746,57 +746,57 @@ EmitAdvancedParticle(particle)
rot
float
Start rotation in degrees. Default: 0
- (optional)
+ Optional.
startColor
Color
Color at the start of life. Default: Color(255, 255, 255, 255))
- (optional)
+ Optional.
endColor
Color
Color at the end of life. Default: Color(0, 0, 0, 0))
- (optional)
+ Optional.
width
float
Width in world units. Default: 0
- (optional)
+ Optional.
life
float
Lifetime in seconds. Default: 1
- (optional)
+ Optional.
vel
float
Movement velocity in world units per second. Default: 0
- (optional)
+ Optional.
expRate
float
Width expansion rate in world units per second. Default: 0
- (optional)
+ Optional.
rotRate
float
Rotation rate in degrees per second. Default: 0
- (optional)
+ Optional.
edgeFeatherMode
StreamerFeatherMode
Edge feather mode. Default: Effects.StreamerFeatherMode.NONE
- (optional)
+ Optional.
lengthFeatherMode
StreamerFeatherMode
Length feather mode. UNIMPLEMENTED, currently will always leave a fading tail
- (optional)
+ Optional.
blendID
BlendID
Renderer blend ID. Default: Effects.BlendID.ALPHA_BLEND
- (optional)
+ Optional.
@@ -831,127 +831,127 @@ EmitAdvancedParticle(particle)
spriteSeqID
SpriteConstants
Sprite sequence slot ID. default: Objects.ObjID.DEFAULT_SPRITES
- (optional)
+ Optional.
spriteID
int
Sprite ID in the sprite sequence slot. default: 0
- (optional)
+ Optional.
life
float
Lifespan in seconds. default: 2
- (optional)
+ Optional.
maxYVel
float
Maximum vertical velocity in world units per second. default: 0
- (optional)
+ Optional.
gravity
float
Effect of gravity in world units per second. Positive value ascend, negative value descend. default: 0
- (optional)
+ Optional.
friction
float
Friction affecting velocity over time in world units per second. default: 0
- (optional)
+ Optional.
startRot
float
Rotation at start of life. default: random
- (optional)
+ Optional.
rotVel
float
Rotational velocity in degrees per second. default: 0
- (optional)
+ Optional.
startSize
float
Size at start of life. default: 10
- (optional)
+ Optional.
endSize
float
Size at end of life. default: 0
- (optional)
+ Optional.
startColor
Color
Color at start of life. default: Color(255, 255, 255)
- (optional)
+ Optional.
endColor
Color
Color at end of life. Note that this will finish long before the end of life due to internal math. default: Color(255, 255, 255)
- (optional)
+ Optional.
blendMode
BlendID
Render blend mode. default: TEN.Effects.BlendID.ALPHA_BLEND
- (optional)
+ Optional.
damage
bool
Harm the player on collision. default: false
- (optional)
+ Optional.
poison
bool
Poison the player on collision. default: false
- (optional)
+ Optional.
burn
bool
Burn the player on collision. default: false
- (optional)
+ Optional.
wind
bool
Affect position by wind in outside rooms. default: false
- (optional)
+ Optional.
damageHit
int
Player damage amount on collision. default: 2
- (optional)
+ Optional.
light
bool
Emit a colored light. CAUTION: Recommended only for a single particle. Too many particles with lights can overwhelm the lighting system. default: false
- (optional)
+ Optional.
lightRadius
int
Light radius in 1/4 blocks. default: 0
- (optional)
+ Optional.
lightFlicker
int
Interval at which the light should flicker. default: 0
- (optional)
+ Optional.
soundID
int
Sound ID to play. CAUTION: Recommended only for a single particle. Too many particles with sounds can overwhelm the sound system. default: none
- (optional)
+ Optional.
animated
bool
Play animates sprite sequence. default: false
- (optional)
+ Optional.
animType
ParticleAnimationType
Animation type of the sprite sequence. default: TEN.Effects.ParticleAnimationType.LOOP
- (optional)
+ Optional.
frameRate
float
Sprite sequence animation framerate. default: 1
- (optional)
+ Optional.
diff --git a/Documentation/doc/1 modules/Flow.html b/Documentation/doc/1 modules/Flow.html
index a8ae0a9b0..4a680cba5 100644
--- a/Documentation/doc/1 modules/Flow.html
+++ b/Documentation/doc/1 modules/Flow.html
@@ -175,7 +175,7 @@ scripts too.
Returns the level that the game control is running in that moment. |
- EndLevel([index][, startPos]) |
+ EndLevel([index], [startPos]) |
Finishes the current level, with optional level index and start position index provided. |
@@ -570,7 +570,7 @@ have an ID of 0, the second an ID of 1, and so on.
- EndLevel([index][, startPos])
+ EndLevel([index], [startPos])
Finishes the current level, with optional level index and start position index provided.
@@ -585,12 +585,12 @@ teleported to such object with OCB similar to provided second argument.
index
int
level index (default 0)
- (optional)
+ Optional.
startPos
int
player start position (default 0)
- (optional)
+ Optional.
@@ -959,7 +959,7 @@ Must be an integer value (0 means no secrets).
index
int
Flipmap group ID to check. If no group specified or group is -1, function returns overall flipmap status (on or off).
- (optional)
+ Optional.
diff --git a/Documentation/doc/1 modules/Input.html b/Documentation/doc/1 modules/Input.html
index c3439c75c..7cf9f7de0 100644
--- a/Documentation/doc/1 modules/Input.html
+++ b/Documentation/doc/1 modules/Input.html
@@ -124,7 +124,7 @@
- Vibrate(strength, time) |
+ Vibrate(strength, [time]) |
Vibrate the game controller if the function is available and the setting is on. |
@@ -162,7 +162,7 @@
-
- Vibrate(strength, time)
+ Vibrate(strength, [time])
-
Vibrate the game controller if the function is available and the setting is on.
@@ -177,7 +177,8 @@
- time
float
- (default 0.3) Vibration time in seconds.
+ Vibration time in seconds.
+ Default: 0.3.
diff --git a/Documentation/doc/1 modules/Inventory.html b/Documentation/doc/1 modules/Inventory.html
index 45a377928..1c069126b 100644
--- a/Documentation/doc/1 modules/Inventory.html
+++ b/Documentation/doc/1 modules/Inventory.html
@@ -124,11 +124,11 @@
- GiveItem(objectID[, count][, addToPickupSummary]) |
+ GiveItem(objectID, [count], [addToPickupSummary]) |
Add an item to the player's inventory. |
- TakeItem(Object[, count]) |
+ TakeItem(Object, [count]) |
Remove an item from the player's inventory. |
@@ -162,7 +162,7 @@
-
- GiveItem(objectID[, count][, addToPickupSummary])
+ GiveItem(objectID, [count], [addToPickupSummary])
-
Add an item to the player's inventory.
@@ -178,12 +178,12 @@
- count
int
The amount of items to add. Default is the yield from a single pickup, e.g. 1 from a medipack, 12 from a flare pack.
- (optional)
+ Optional.
- addToPickupSummary
bool
If true, display the item in the pickup summary. Default is false.
- (optional)
+ Optional.
@@ -194,7 +194,7 @@
-
- TakeItem(Object[, count])
+ TakeItem(Object, [count])
-
Remove an item from the player's inventory.
@@ -210,7 +210,7 @@
- count
int
The amount of items to remove. Default is the yield from a single pickup, e.g. 1 from a medipack, 12 from a flare pack.
- (optional)
+ Optional.
diff --git a/Documentation/doc/1 modules/Sound.html b/Documentation/doc/1 modules/Sound.html
index 6f1305b02..be07997d5 100644
--- a/Documentation/doc/1 modules/Sound.html
+++ b/Documentation/doc/1 modules/Sound.html
@@ -144,7 +144,7 @@
Get current loudness level for specified track type. |
- PlaySound(soundID[, position]) |
+ PlaySound(soundID, [position]) |
Play sound effect. |
@@ -291,7 +291,7 @@
-
- PlaySound(soundID[, position])
+ PlaySound(soundID, [position])
-
Play sound effect.
@@ -307,7 +307,7 @@
- position
Vec3
The 3D position of the sound, i.e. where the sound "comes from". If not given, the sound will not be positional.
- (optional)
+ Optional.
diff --git a/Documentation/doc/1 modules/Util.html b/Documentation/doc/1 modules/Util.html
index a9b7c3972..4981e18db 100644
--- a/Documentation/doc/1 modules/Util.html
+++ b/Documentation/doc/1 modules/Util.html
@@ -152,7 +152,7 @@
Pick a static mesh by the given display position. |
- PrintLog(message, logLevel[, allowSpam]) |
+ PrintLog(message, logLevel, [allowSpam]) |
Write messages within the Log file |
@@ -414,7 +414,7 @@ To be used with
- PrintLog(message, logLevel[, allowSpam])
+ PrintLog(message, logLevel, [allowSpam])
-
Write messages within the Log file
@@ -439,7 +439,7 @@ To be used with allowSpam
bool
true allows spamming of the message
- (optional)
+ Optional.
diff --git a/Documentation/doc/1 modules/View.html b/Documentation/doc/1 modules/View.html
index 557e35756..51c5b824e 100644
--- a/Documentation/doc/1 modules/View.html
+++ b/Documentation/doc/1 modules/View.html
@@ -176,11 +176,11 @@
Play a flyby sequence. |
- GetFlybyPosition(seqID, progress[, loop]) |
+ GetFlybyPosition(seqID, progress, [loop]) |
Get a flyby sequence's position at a specified progress point in percent. |
- GetFlybyRotation(seqID, progress[, loop]) |
+ GetFlybyRotation(seqID, progress, [loop]) |
Get a flyby sequence's rotation at a specified progress point in percent. |
@@ -499,7 +499,7 @@
- GetFlybyPosition(seqID, progress[, loop])
+ GetFlybyPosition(seqID, progress, [loop])
Get a flyby sequence's position at a specified progress point in percent.
@@ -519,7 +519,7 @@
loop
bool
Smooth the position near start and end points, as if the sequence is looped.
- (optional)
+ Optional.
@@ -536,7 +536,7 @@
- GetFlybyRotation(seqID, progress[, loop])
+ GetFlybyRotation(seqID, progress, [loop])
Get a flyby sequence's rotation at a specified progress point in percent.
@@ -556,7 +556,7 @@
loop
bool
Smooth the position near start and end points, as if the sequence is looped.
- (optional)
+ Optional.
diff --git a/Documentation/doc/2 classes/Collision.Probe.html b/Documentation/doc/2 classes/Collision.Probe.html
index 19c7f4ec2..f10d87d34 100644
--- a/Documentation/doc/2 classes/Collision.Probe.html
+++ b/Documentation/doc/2 classes/Collision.Probe.html
@@ -122,7 +122,7 @@
- Probe(pos[, roomNumber]) |
+ Probe(pos, [roomNumber]) |
Create a Probe at a specified world position in a room. |
@@ -220,7 +220,7 @@
-
- Probe(pos[, roomNumber])
+ Probe(pos, [roomNumber])
-
Create a Probe at a specified world position in a room.
@@ -236,7 +236,7 @@
- roomNumber
int
Room number. Must be used if probing a position in an overlapping room.
- (optional)
+ Optional.
diff --git a/Documentation/doc/2 classes/Objects.Camera.html b/Documentation/doc/2 classes/Objects.Camera.html
index 630d1a44f..3ca2f2939 100644
--- a/Documentation/doc/2 classes/Objects.Camera.html
+++ b/Documentation/doc/2 classes/Objects.Camera.html
@@ -330,7 +330,7 @@
- Target
Moveable
If you put a moveable, the camera will look at it. Otherwise, it will look at Lara.
- (optional)
+ Optional.
diff --git a/Documentation/doc/2 classes/Objects.LaraObject.html b/Documentation/doc/2 classes/Objects.LaraObject.html
index 41fefa5bc..7192dc620 100644
--- a/Documentation/doc/2 classes/Objects.LaraObject.html
+++ b/Documentation/doc/2 classes/Objects.LaraObject.html
@@ -229,7 +229,7 @@
- poison
int
Poison strength. Maximum value is 128 (default 0)
- (optional)
+ Optional.
diff --git a/Documentation/doc/2 classes/Objects.Moveable.html b/Documentation/doc/2 classes/Objects.Moveable.html
index 45f4fa252..5810dedcc 100644
--- a/Documentation/doc/2 classes/Objects.Moveable.html
+++ b/Documentation/doc/2 classes/Objects.Moveable.html
@@ -166,13 +166,13 @@
Get the moveable's position |
- Moveable:SetPosition(position[, updateRoom]) |
+ Moveable:SetPosition(position, [updateRoom]) |
Set the moveable's position
If you are moving a moveable whose behaviour involves knowledge of room geometry,
(e.g. |
- Moveable:GetJointPosition(jointIndex[, offset]) |
+ Moveable:GetJointPosition(jointIndex, [offset]) |
Get the moveable's joint position with an optional relative offset. |
@@ -217,11 +217,11 @@
Set OCB (object code bit) of the moveable |
- Moveable:SetEffect(effect[, timeout]) |
+ Moveable:SetEffect(effect, [timeout]) |
Set the effect for this moveable. |
- Moveable:SetCustomEffect(color1, color2[, timeout]) |
+ Moveable:SetCustomEffect(color1, color2, [timeout]) |
Set custom colored burn effect to moveable |
@@ -285,7 +285,7 @@
Retrieve the index of the current animation. |
- Moveable:SetAnim(index[, slot]) |
+ Moveable:SetAnim(index, [slot]) |
Set the object's animation to the one specified by the given index. |
@@ -364,7 +364,7 @@
if it is not swapped.
- Moveable:SwapMesh(index, slotIndex[, swapIndex]) |
+ Moveable:SwapMesh(index, slotIndex, [swapIndex]) |
Set state of specified mesh swap of object
Use this to swap specified mesh of an object. |
@@ -741,7 +741,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
- Moveable:SetPosition(position[, updateRoom])
+ Moveable:SetPosition(position, [updateRoom])
Set the moveable's position
@@ -760,7 +760,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
updateRoom
bool
Will room changes be automatically detected? Set to false if you are using overlapping rooms (default: true)
- (optional)
+ Optional.
@@ -771,7 +771,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
- Moveable:GetJointPosition(jointIndex[, offset])
+ Moveable:GetJointPosition(jointIndex, [offset])
Get the moveable's joint position with an optional relative offset.
@@ -787,7 +787,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
offset
Vec3
Offset relative to the joint.
- (optional)
+ Optional.
@@ -1026,7 +1026,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
- Moveable:SetEffect(effect[, timeout])
+ Moveable:SetEffect(effect, [timeout])
Set the effect for this moveable.
@@ -1042,7 +1042,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
timeout
float
time (in seconds) after which effect turns off.
- (optional)
+ Optional.
@@ -1053,7 +1053,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
- Moveable:SetCustomEffect(color1, color2[, timeout])
+ Moveable:SetCustomEffect(color1, color2, [timeout])
Set custom colored burn effect to moveable
@@ -1073,7 +1073,7 @@ baddy:SetOnCollidedWithRoom(LevelFuncs.roomCollided)
timeout
float
Time (in seconds) after which effect turns off.
- (optional)
+ Optional.
@@ -1423,7 +1423,7 @@ sas:SetAIBits({1, 0,
- Moveable:SetAnim(index[, slot])
+ Moveable:SetAnim(index, [slot])
Set the object's animation to the one specified by the given index.
@@ -1441,7 +1441,7 @@ sas:SetAIBits({1, 0, slot
int
slot ID of the desired anim (if omitted, moveable's own slot ID is used)
- (optional)
+ Optional.
@@ -1857,7 +1857,7 @@ sas:SetPosition(newPos, false)
- Moveable:SwapMesh(index, slotIndex[, swapIndex])
+ Moveable:SwapMesh(index, slotIndex, [swapIndex])
Set state of specified mesh swap of object
@@ -1878,7 +1878,7 @@ sas:SetPosition(newPos, false)
swapIndex
int
index of a mesh from meshswap slot to use
- (optional)
+ Optional.
diff --git a/Documentation/doc/2 classes/Strings.DisplayString.html b/Documentation/doc/2 classes/Strings.DisplayString.html
index d4b209327..4f1088fad 100644
--- a/Documentation/doc/2 classes/Strings.DisplayString.html
+++ b/Documentation/doc/2 classes/Strings.DisplayString.html
@@ -129,7 +129,7 @@ when you need to use screen-space coordinates.