mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Merge branch 'MontyTRC89:develop' into develop
This commit is contained in:
commit
5e87ac32e6
6 changed files with 23 additions and 29 deletions
|
@ -20,6 +20,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
|
||||||
* Fixed vehicle transfer not happening for levels which were not previously visited.
|
* Fixed vehicle transfer not happening for levels which were not previously visited.
|
||||||
* Fixed audio tracks placed in subfolders not restoring after loading savegame.
|
* Fixed audio tracks placed in subfolders not restoring after loading savegame.
|
||||||
* Fixed initial position and lack of fade-in for looped audio track on level start.
|
* Fixed initial position and lack of fade-in for looped audio track on level start.
|
||||||
|
* Fixed shatter debris spawning on incorrect position for the first frame.
|
||||||
* Fixed scripted input events not registering on the same game frame.
|
* Fixed scripted input events not registering on the same game frame.
|
||||||
* Fixed incorrect object camera position.
|
* Fixed incorrect object camera position.
|
||||||
* Fixed incorrect camera movement near walls after leaving look mode.
|
* Fixed incorrect camera movement near walls after leaving look mode.
|
||||||
|
|
|
@ -183,6 +183,9 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num, short roomNumbe
|
||||||
fragment->numBounces = 0;
|
fragment->numBounces = 0;
|
||||||
fragment->color = isStatic ? mesh->color : item->color;
|
fragment->color = isStatic ? mesh->color : item->color;
|
||||||
fragment->lightMode = fragmentsMesh->lightMode;
|
fragment->lightMode = fragmentsMesh->lightMode;
|
||||||
|
|
||||||
|
fragment->UpdateTransform();
|
||||||
|
fragment->StoreInterpolationData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,9 +262,7 @@ void UpdateDebris()
|
||||||
deb.numBounces++;
|
deb.numBounces++;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto translation = Matrix::CreateTranslation(deb.worldPosition.x, deb.worldPosition.y, deb.worldPosition.z);
|
deb.UpdateTransform();
|
||||||
auto rotation = Matrix::CreateFromQuaternion(deb.rotation);
|
|
||||||
deb.Transform = rotation * translation;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,13 @@ struct DebrisFragment
|
||||||
|
|
||||||
Matrix PrevTransform = Matrix::Identity;
|
Matrix PrevTransform = Matrix::Identity;
|
||||||
|
|
||||||
|
void UpdateTransform()
|
||||||
|
{
|
||||||
|
auto translation = Matrix::CreateTranslation(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
|
auto rot = Matrix::CreateFromQuaternion(rotation);
|
||||||
|
Transform = rot * translation;
|
||||||
|
}
|
||||||
|
|
||||||
void StoreInterpolationData()
|
void StoreInterpolationData()
|
||||||
{
|
{
|
||||||
PrevTransform = Transform;
|
PrevTransform = Transform;
|
||||||
|
|
|
@ -8,33 +8,21 @@
|
||||||
|
|
||||||
namespace TEN::Math::Random
|
namespace TEN::Math::Random
|
||||||
{
|
{
|
||||||
static auto Generator = std::mt19937();
|
static std::mt19937 Engine;
|
||||||
|
|
||||||
int GenerateInt(int min, int max)
|
int GenerateInt(int low, int high)
|
||||||
{
|
{
|
||||||
if (min >= max)
|
return (Engine() / (Engine.max() / (high - low + 1) + 1) + low);
|
||||||
{
|
|
||||||
TENLog("Attempted to generate integer with minimum value greater than maximum value.", LogLevel::Warning);
|
|
||||||
return min;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (((Generator() / (Generator.max()) / (max - min + 1)) + 1) + min);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float GenerateFloat(float min, float max)
|
float GenerateFloat(float low, float high)
|
||||||
{
|
{
|
||||||
if (min >= max)
|
return ((high - low) * Engine() / Engine.max() + low);
|
||||||
{
|
|
||||||
TENLog("Attempted to generate float with minimum value greater than maximum value.", LogLevel::Warning);
|
|
||||||
return min;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((((max - min) * Generator()) / Generator.max()) + min);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
short GenerateAngle(short min, short max)
|
short GenerateAngle(short low, short high)
|
||||||
{
|
{
|
||||||
return (short)GenerateInt(min, min);
|
return (short)GenerateInt(low, high);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 GenerateDirection2D()
|
Vector2 GenerateDirection2D()
|
||||||
|
|
|
@ -6,9 +6,9 @@ namespace TEN::Math::Random
|
||||||
{
|
{
|
||||||
// Value generation
|
// Value generation
|
||||||
|
|
||||||
int GenerateInt(int min = 0, int max = SHRT_MAX);
|
int GenerateInt(int low = 0, int high = SHRT_MAX);
|
||||||
float GenerateFloat(float min = 0.0f, float max = 1.0f);
|
float GenerateFloat(float low = 0.0f, float high = 1.0f);
|
||||||
short GenerateAngle(short min = SHRT_MIN, short max = SHRT_MAX);
|
short GenerateAngle(short low = SHRT_MIN, short high = SHRT_MAX);
|
||||||
|
|
||||||
// 2D geometric generation
|
// 2D geometric generation
|
||||||
|
|
||||||
|
|
|
@ -1088,10 +1088,7 @@ int GetShatterSound(int shatterID)
|
||||||
if (fxID != NO_VALUE && fxID < NUM_SFX)
|
if (fxID != NO_VALUE && fxID < NUM_SFX)
|
||||||
return fxID;
|
return fxID;
|
||||||
|
|
||||||
if (shatterID < 3)
|
return SFX_TR5_SMASH_WOOD;
|
||||||
return SFX_TR5_SMASH_WOOD;
|
|
||||||
else
|
|
||||||
return SFX_TR4_SMASH_ROCK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaySoundSources()
|
void PlaySoundSources()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue