mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Merge branch 'develop' of https://github.com/MontyTRC89/TombEngine into develop
This commit is contained in:
commit
d0f50407ee
8 changed files with 58 additions and 200 deletions
|
@ -3,6 +3,13 @@
|
|||
The dates are in European standard format where date is presented as **YYYY-MM-DD**.
|
||||
TombEngine releases are located in this repository (alongside with Tomb Editor): https://github.com/TombEngine/TombEditorReleases
|
||||
|
||||
## [Version 1.8.2]
|
||||
|
||||
### Bug fixes
|
||||
* 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.
|
||||
|
||||
## [Version 1.8.1](https://github.com/TombEngine/TombEditorReleases/releases/tag/v1.8.1) - 2025-03-29
|
||||
|
||||
### Bug fixes
|
||||
|
|
|
@ -308,6 +308,11 @@ namespace TEN::Entities::TR4
|
|||
item.Pose.Orientation.x += angleV;
|
||||
}
|
||||
|
||||
// Translate wraith.
|
||||
item.Pose.Position.x += item.Animation.Velocity.z * phd_sin(item.Pose.Orientation.y);
|
||||
item.Pose.Position.y += item.Animation.Velocity.z * phd_sin(item.Pose.Orientation.x);
|
||||
item.Pose.Position.z += item.Animation.Velocity.z * phd_cos(item.Pose.Orientation.y);
|
||||
|
||||
auto pointColl = GetPointCollision(item);
|
||||
|
||||
bool hasHitWall = false;
|
||||
|
@ -317,13 +322,8 @@ namespace TEN::Entities::TR4
|
|||
hasHitWall = true;
|
||||
}
|
||||
|
||||
// Translate wraith.
|
||||
item.Pose.Position.x += item.Animation.Velocity.z * phd_sin(item.Pose.Orientation.y);
|
||||
item.Pose.Position.y += item.Animation.Velocity.z * phd_sin(item.Pose.Orientation.x);
|
||||
item.Pose.Position.z += item.Animation.Velocity.z * phd_cos(item.Pose.Orientation.y);
|
||||
|
||||
if (pointColl.GetRoomNumber() != item.RoomNumber)
|
||||
ItemNewRoom(itemNumber, pointColl.GetRoomNumber());
|
||||
ItemNewRoom(itemNumber, FindRoomNumber(item.Pose.Position, item.RoomNumber));
|
||||
|
||||
for (int linkItemNumber = g_Level.Rooms[item.RoomNumber].itemNumber; linkItemNumber != NO_VALUE; linkItemNumber = g_Level.Items[linkItemNumber].NextItem)
|
||||
{
|
||||
|
|
|
@ -1,28 +1,18 @@
|
|||
#include "framework.h"
|
||||
#include "tr5_teleporter.h"
|
||||
#include "Game/items.h"
|
||||
#include "Specific/level.h"
|
||||
#include "Game/collision/collide_room.h"
|
||||
#include "Sound/sound.h"
|
||||
#include "Game/effects/weather.h"
|
||||
#include "Game/Lara/lara.h"
|
||||
#include "Objects/TR5/Object/tr5_teleporter.h"
|
||||
|
||||
#include "Game/camera.h"
|
||||
#include "Game/collision/collide_room.h"
|
||||
#include "Game/collision/Point.h"
|
||||
#include "Game/effects/weather.h"
|
||||
#include "Game/items.h"
|
||||
#include "Game/Lara/lara.h"
|
||||
#include "Sound/sound.h"
|
||||
#include "Specific/level.h"
|
||||
|
||||
using namespace TEN::Collision::Point;
|
||||
using namespace TEN::Effects::Environment;
|
||||
|
||||
void InitializeTeleporter(short itemNumber)
|
||||
{
|
||||
/*ItemInfo* item = &g_Level.Items[itemNumber];
|
||||
|
||||
if (item->triggerFlags == 512)
|
||||
{
|
||||
ItemInfo* puzzleHoleItem = FindItem(ID_PUZZLE_HOLE2);
|
||||
v4 = (signed int)((unsigned __int64)(391146079i64 * ((char*)v3 - (char*)items)) >> 32) >> 9;
|
||||
result = (unsigned int)((unsigned __int64)(391146079i64 * ((char*)v3 - (char*)items)) >> 32) >> 31;
|
||||
item->itemFlags[1] = result + v4;
|
||||
}*/
|
||||
}
|
||||
|
||||
void ControlTeleporter(short itemNumber)
|
||||
{
|
||||
ItemInfo* item = &g_Level.Items[itemNumber];
|
||||
|
@ -30,149 +20,6 @@ void ControlTeleporter(short itemNumber)
|
|||
if (!TriggerActive(item))
|
||||
return;
|
||||
|
||||
/*if (item->triggerFlags == 512)
|
||||
{
|
||||
if (item->itemFlags[2])
|
||||
{
|
||||
Lara.Puzzles[1] = 1;
|
||||
RemoveActiveItem(itemNumber);
|
||||
item->flags &= 0xC1FF;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->itemFlags[0] += 2;
|
||||
|
||||
if (item->itemFlags[0] <= 255)
|
||||
{
|
||||
int flags = item->itemFlags[0] >> 3;
|
||||
if (flags >= 4)
|
||||
{
|
||||
if (flags > 31)
|
||||
flags = 31;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = 4;
|
||||
}
|
||||
|
||||
ItemInfo* targetItem = &g_Level.Items[item->itemFlags[1]];
|
||||
SoundEffect(SFX_TR5_TELEPORT, &targetItem->pos, SoundEnvironment::Land);
|
||||
|
||||
if (GlobalCounter & 1)
|
||||
{
|
||||
Vector3i src;
|
||||
pos.x = targetItem->pos.Position.x;
|
||||
pos.y = targetItem->pos.Position.y - 496;
|
||||
pos.z = targetItem->pos.Position.z + 472;
|
||||
|
||||
int dl = 4 * item->itemFlags[0] + 256;
|
||||
|
||||
Vector3i dest;
|
||||
dest.x = src.x + GetRandomControl() % dl - (dl >> 1);
|
||||
dest.y = src.y + GetRandomControl() % dl - (dl >> 1);
|
||||
dest.z = src.z + GetRandomControl() % dl - (dl >> 1);
|
||||
|
||||
int color = (item->itemFlags[0] >> 2) | (((item->itemFlags[0] - (GetRandomControl() % (item->itemFlags[0] >> 1))) | (item->itemFlags[0] << 8)) << 8);
|
||||
color |= 0x18; // BYTE1
|
||||
|
||||
//TriggerEnergyArc(&src, &dest, (GetRandomControl() & 0x1F) + 16, color, 15, 40, 5);
|
||||
|
||||
v20 = v16;
|
||||
v21 = v12 & 0xFFFFFFFE;
|
||||
LOBYTE(v20) = v16 & 0xFE;
|
||||
BYTE1(v21) |= 0x80u;
|
||||
TriggerLightningGlow(src.x, src.y, src.z, (item->itemFlags[0] >> 3) | ((v20 | (v21 << 8)) << 7));
|
||||
v22 = GetRandomControl();
|
||||
SpawnDynamicLight(src.x, src.y, src.z, (v22 & 3) + (item->itemFlags[0] >> 5) + 8, v12, v16, v13);
|
||||
}
|
||||
LOBYTE(v3) = GetRandomControl();
|
||||
if (v3 & 1)
|
||||
{
|
||||
v23 = item->itemFlags[0];
|
||||
v24 = item->itemFlags[0];
|
||||
v25 = GetRandomControl();
|
||||
|
||||
auto R = v23;
|
||||
auto G = v24 - v25 % (v24 >> 1);
|
||||
auto B = v24 >> 2;
|
||||
Weather.Flash(R, G, B, 0.03f);
|
||||
|
||||
LOBYTE(v3) = SoundEffect(SFX_TR5_TELEPORT_CRACKLES, nullptr);
|
||||
}
|
||||
if (!(GlobalCounter & 3))
|
||||
{
|
||||
v26 = GetRandomControl();
|
||||
v27 = 0;
|
||||
v28 = v26 & 3;
|
||||
v29 = 0;
|
||||
if (v28)
|
||||
{
|
||||
if (v28 == 1)
|
||||
v29 = 512;
|
||||
else
|
||||
v27 = v28 != 2 ? 512 : -512;
|
||||
}
|
||||
else
|
||||
{
|
||||
v29 = -512;
|
||||
}
|
||||
v30 = item->itemFlags[0];
|
||||
v31 = &g_Level.Items[item->itemFlags[1]];
|
||||
src.Position.x = v29 + v31->pos.Position.x;
|
||||
src.Position.y = v31->pos.Position.y - 2328;
|
||||
src.zPos = v27 + v31->pos.Position.z;
|
||||
*(_DWORD*)& src.xRot = v31->pos.Position.x;
|
||||
v32 = item->itemFlags[0];
|
||||
*(_DWORD*)& src.zRot = v31->pos.Position.y - 496;
|
||||
v45 = v31->pos.Position.z + 472;
|
||||
v33 = (v30 >> 2) | (((v30 - GetRandomControl() % (v30 >> 1)) | ((v32 | 0x2400) << 8)) << 8);
|
||||
v34 = GetRandomControl();
|
||||
TriggerEnergyArc((Vector3i*)& src, (Vector3i*)& src.xRot, (v34 & 0xF) + 16, v33, 13, 56, 5);
|
||||
v35* = GetFreeParticle();
|
||||
v35->On = 1;
|
||||
v36 = item->itemFlags[0];
|
||||
v35->dR = v36;
|
||||
v35->sR = v36;
|
||||
v37 = item->itemFlags[0] >> 1;
|
||||
v35->dG = v37;
|
||||
v35->sG = v37;
|
||||
v38 = item->itemFlags[0];
|
||||
v35->ColFadeSpeed = 20;
|
||||
v38 >>= 2;
|
||||
v35->dB = v38;
|
||||
v35->sB = v38;
|
||||
v35->FadeToBlack = 4;
|
||||
v35->Life = 24;
|
||||
v35->sLife = 24;
|
||||
v35->blendMode = BlendMode::Additive;
|
||||
v35->x = src.Position.x;
|
||||
v35->y = src.Position.y;
|
||||
v35->z = src.zPos;
|
||||
v35->Zvel = 0;
|
||||
v35->Yvel = 0;
|
||||
v35->Xvel = 0;
|
||||
v35->Flags = 10;
|
||||
v39 = objects[458].mesh_index;
|
||||
v35->Scalar = 3;
|
||||
v35->MaxYvel = 0;
|
||||
v35->Def = v39 + 11;
|
||||
v35->Gravity = 0;
|
||||
v3 = (GetRandomControl() & 3) + 24;
|
||||
v35->dSize = v3;
|
||||
v35->sSize = v3;
|
||||
v35->Size = v3;
|
||||
}
|
||||
return v3;
|
||||
}
|
||||
FlashFadeR = 255;
|
||||
FlashFadeG = 255;
|
||||
FlashFadeB = 64;
|
||||
FlashFader = 32;
|
||||
item->itemFlags[2] = 1;
|
||||
SoundEffect(SFX_TR5_TELEPORT_FLASH, nullptr, SoundEnvironment::Land);
|
||||
}
|
||||
}*/
|
||||
|
||||
Lara.Control.IsLocked = false;
|
||||
|
||||
if (item->TriggerFlags == 666)
|
||||
|
@ -192,16 +39,19 @@ void ControlTeleporter(short itemNumber)
|
|||
else
|
||||
{
|
||||
Camera.fixedCamera = true;
|
||||
LaraItem->DisableInterpolation = true;
|
||||
LaraItem->Pose.Position.x = item->Pose.Position.x;
|
||||
LaraItem->Pose.Position.z = item->Pose.Position.z;
|
||||
LaraItem->Pose.Orientation.y = item->Pose.Orientation.y - ANGLE(180.0f);
|
||||
|
||||
short roomNumber = item->RoomNumber;
|
||||
FloorInfo* floor = GetFloor(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, &roomNumber);
|
||||
LaraItem->Pose.Position.y = GetFloorHeight(floor, item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z);
|
||||
auto& pointColl = GetPointCollision(*item);
|
||||
LaraItem->Pose.Position.y = pointColl.GetPosition().y;
|
||||
|
||||
if (LaraItem->RoomNumber != roomNumber)
|
||||
ItemNewRoom(LaraItem->Index, roomNumber);
|
||||
if (LaraItem->RoomNumber != pointColl.GetRoomNumber())
|
||||
{
|
||||
ItemNewRoom(LaraItem->Index, pointColl.GetRoomNumber());
|
||||
LaraItem->Location.RoomNumber = pointColl.GetRoomNumber();
|
||||
}
|
||||
|
||||
if (item->Flags & IFLAG_INVISIBLE)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
void InitializeTeleporter(short itemNumber);
|
||||
void ControlTeleporter(short itemNumber);
|
||||
|
|
|
@ -774,7 +774,6 @@ static void StartObject(ObjectInfo *obj)
|
|||
obj = &Objects[ID_TELEPORTER];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->Initialize = InitializeTeleporter;
|
||||
obj->control = ControlTeleporter;
|
||||
obj->drawRoutine = nullptr;
|
||||
}
|
||||
|
|
|
@ -68,9 +68,6 @@ namespace TEN::Renderer
|
|||
_animatedTextures[i] = tex;
|
||||
}
|
||||
|
||||
if (_animatedTextures.size() > 0)
|
||||
TENLog("Generated " + std::to_string(_animatedTextures.size()) + " animated textures.", LogLevel::Info);
|
||||
|
||||
std::transform(g_Level.AnimatedTexturesSequences.begin(), g_Level.AnimatedTexturesSequences.end(), std::back_inserter(_animatedTextureSets), [](ANIMATED_TEXTURES_SEQUENCE& sequence) {
|
||||
RendererAnimatedTextureSet set{};
|
||||
set.NumTextures = sequence.numFrames;
|
||||
|
|
|
@ -263,6 +263,9 @@ namespace TEN::Renderer
|
|||
|
||||
objectID = gunshell->objectNumber;
|
||||
|
||||
if (!_moveableObjects[objectID].has_value())
|
||||
continue;
|
||||
|
||||
auto translation = Matrix::CreateTranslation(gunshell->pos.Position.ToVector3());
|
||||
auto rotMatrix = gunshell->pos.Orientation.ToRotationMatrix();
|
||||
auto worldMatrix = rotMatrix * translation;
|
||||
|
|
|
@ -1085,31 +1085,10 @@ namespace TEN::Renderer
|
|||
if (!settings.MuzzleFlash)
|
||||
return false;
|
||||
|
||||
_shaders.Bind(Shader::Statics);
|
||||
|
||||
unsigned int stride = sizeof(Vertex);
|
||||
unsigned int offset = 0;
|
||||
|
||||
_context->IASetVertexBuffers(0, 1, _moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
||||
_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
_context->IASetIndexBuffer(_moveablesIndexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
|
||||
|
||||
const auto& room = _rooms[LaraItem->RoomNumber];
|
||||
auto* itemPtr = &_items[LaraItem->Index];
|
||||
|
||||
// Divide gunflash tint by 2 because tinting uses multiplication and additive color which doesn't look good with overbright color values.
|
||||
_stStatic.Color = settings.ColorizeMuzzleFlash ? ((Vector4)settings.FlashColor / 2) : Vector4::One;
|
||||
_stStatic.AmbientLight = room.AmbientLight;
|
||||
_stStatic.LightMode = (int)LightMode::Static;
|
||||
BindStaticLights(itemPtr->LightsToDraw);
|
||||
|
||||
short length = 0;
|
||||
short zOffset = 0;
|
||||
short rotationX = 0;
|
||||
|
||||
SetAlphaTest(AlphaTestMode::GreatherThan, ALPHA_TEST_THRESHOLD);
|
||||
SetBlendMode(BlendMode::Additive);
|
||||
|
||||
if (Lara.Control.Weapon.GunType != LaraWeaponType::Flare &&
|
||||
Lara.Control.Weapon.GunType != LaraWeaponType::Crossbow)
|
||||
{
|
||||
|
@ -1151,9 +1130,33 @@ namespace TEN::Renderer
|
|||
zOffset += 10;
|
||||
}
|
||||
|
||||
if (!_moveableObjects[gunflash].has_value())
|
||||
return false;
|
||||
|
||||
const auto& flashMoveable = *_moveableObjects[gunflash];
|
||||
const auto& flashMesh = *flashMoveable.ObjectMeshes[0];
|
||||
|
||||
_shaders.Bind(Shader::Statics);
|
||||
|
||||
unsigned int stride = sizeof(Vertex);
|
||||
unsigned int offset = 0;
|
||||
|
||||
_context->IASetVertexBuffers(0, 1, _moveablesVertexBuffer.Buffer.GetAddressOf(), &stride, &offset);
|
||||
_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
_context->IASetIndexBuffer(_moveablesIndexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
|
||||
|
||||
const auto& room = _rooms[LaraItem->RoomNumber];
|
||||
auto* itemPtr = &_items[LaraItem->Index];
|
||||
|
||||
// Divide gunflash tint by 2 because tinting uses multiplication and additive color which doesn't look good with overbright color values.
|
||||
_stStatic.Color = settings.ColorizeMuzzleFlash ? ((Vector4)settings.FlashColor / 2) : Vector4::One;
|
||||
_stStatic.AmbientLight = room.AmbientLight;
|
||||
_stStatic.LightMode = (int)LightMode::Static;
|
||||
BindStaticLights(itemPtr->LightsToDraw);
|
||||
|
||||
SetAlphaTest(AlphaTestMode::GreatherThan, ALPHA_TEST_THRESHOLD);
|
||||
SetBlendMode(BlendMode::Additive);
|
||||
|
||||
for (const auto& flashBucket : flashMesh.Buckets)
|
||||
{
|
||||
if (flashBucket.BlendMode == BlendMode::Opaque)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue