mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-11 13:06:49 +03:00
Minor formatting
This commit is contained in:
parent
0bc1d1f004
commit
e902c0e94e
4 changed files with 41 additions and 26 deletions
|
@ -495,7 +495,7 @@ void LaraControl(ItemInfo* item, CollisionInfo* coll)
|
||||||
player.Context.WaterSurfaceDist = -water.HeightFromWater;
|
player.Context.WaterSurfaceDist = -water.HeightFromWater;
|
||||||
|
|
||||||
if (player.Context.Vehicle == NO_ITEM)
|
if (player.Context.Vehicle == NO_ITEM)
|
||||||
WadeSplash(item, water.WaterHeight, water.WaterDepth);
|
SpawnPlayerSplash(*item, water.WaterHeight, water.WaterDepth);
|
||||||
|
|
||||||
bool isWaterOnHeadspace = false;
|
bool isWaterOnHeadspace = false;
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ void LaraControl(ItemInfo* item, CollisionInfo* coll)
|
||||||
{
|
{
|
||||||
player.Control.WaterStatus = WaterStatus::Wade;
|
player.Control.WaterStatus = WaterStatus::Wade;
|
||||||
|
|
||||||
// Make splash ONLY within this particular threshold before swim depth while airborne (WadeSplash() above interferes otherwise).
|
// Make splash ONLY within this particular threshold before swim depth while airborne (SpawnPlayerSplash() above interferes otherwise).
|
||||||
if (water.WaterDepth > (SWIM_WATER_DEPTH - CLICK(1)) &&
|
if (water.WaterDepth > (SWIM_WATER_DEPTH - CLICK(1)) &&
|
||||||
item->Animation.IsAirborne && !water.IsSwamp)
|
item->Animation.IsAirborne && !water.IsSwamp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1236,43 +1236,58 @@ void TriggerDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byt
|
||||||
g_Renderer.AddDynamicLight(x, y, z, falloff, r, g, b);
|
g_Renderer.AddDynamicLight(x, y, z, falloff, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WadeSplash(ItemInfo* item, int wh, int wd)
|
// TODO: Better implementation.
|
||||||
|
void SpawnPlayerSplash(const ItemInfo& item, int waterHeight, int waterDepth)
|
||||||
{
|
{
|
||||||
auto probe1 = GetCollision(item);
|
// Get point collision.
|
||||||
auto probe2 = GetCollision(probe1.Block, item->Pose.Position.x, probe1.Position.Ceiling, item->Pose.Position.z);
|
auto pointColl0 = GetCollision(item);
|
||||||
|
auto pointColl1 = GetCollision(pointColl0.Block, item.Pose.Position.x, pointColl0.Position.Ceiling, item.Pose.Position.z);
|
||||||
|
|
||||||
if (!TestEnvironment(ENV_FLAG_WATER, probe1.RoomNumber) ||
|
if (!TestEnvironment(ENV_FLAG_WATER, pointColl0.RoomNumber) ||
|
||||||
TestEnvironment(ENV_FLAG_WATER, probe1.RoomNumber) == TestEnvironment(ENV_FLAG_WATER, probe2.RoomNumber))
|
TestEnvironment(ENV_FLAG_WATER, pointColl0.RoomNumber) == TestEnvironment(ENV_FLAG_WATER, pointColl1.RoomNumber))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& bounds = GetBestFrame(item).BoundingBox;
|
||||||
|
if (item.Pose.Position.y + bounds.Y1 > waterHeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& bounds = GetBestFrame(*item).BoundingBox;
|
if (item.Pose.Position.y + bounds.Y2 < waterHeight)
|
||||||
if (item->Pose.Position.y + bounds.Y1 > wh)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (item->Pose.Position.y + bounds.Y2 < wh)
|
if (item.Animation.Velocity.y <= 0.0f || waterDepth >= 474 || SplashCount != 0)
|
||||||
return;
|
|
||||||
|
|
||||||
if (item->Animation.Velocity.y <= 0.0f || wd >= 474 || SplashCount != 0)
|
|
||||||
{
|
{
|
||||||
if (!(Wibble & 0xF))
|
if (!(Wibble & 0xF))
|
||||||
{
|
{
|
||||||
if (!(GetRandomControl() & 0xF) || item->Animation.ActiveState != LS_IDLE)
|
if (!(GetRandomControl() & 0xF) || item.Animation.ActiveState != LS_IDLE)
|
||||||
{
|
{
|
||||||
if (item->Animation.ActiveState != LS_IDLE)
|
if (item.Animation.ActiveState != LS_IDLE)
|
||||||
SpawnRipple(Vector3(item->Pose.Position.x, wh - 1, item->Pose.Position.z), item->RoomNumber, 112 + (GetRandomControl() & 15), (int)RippleFlags::SlowFade | (int)RippleFlags::LowOpacity);
|
{
|
||||||
|
SpawnRipple(
|
||||||
|
Vector3(item.Pose.Position.x, waterHeight - 1, item.Pose.Position.z),
|
||||||
|
item.RoomNumber, 112 + (GetRandomControl() & 15),
|
||||||
|
(int)RippleFlags::SlowFade | (int)RippleFlags::LowOpacity);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
SpawnRipple(Vector3(item->Pose.Position.x, wh - 1, item->Pose.Position.z), item->RoomNumber, 112 + (GetRandomControl() & 15), (int)RippleFlags::LowOpacity);
|
{
|
||||||
|
SpawnRipple(
|
||||||
|
Vector3(item.Pose.Position.x, waterHeight - 1, item.Pose.Position.z),
|
||||||
|
item.RoomNumber, 112 + (GetRandomControl() & 15),
|
||||||
|
(int)RippleFlags::LowOpacity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SplashSetup.y = wh - 1;
|
SplashSetup.x = item.Pose.Position.x;
|
||||||
SplashSetup.x = item->Pose.Position.x;
|
SplashSetup.y = waterHeight - 1;
|
||||||
SplashSetup.z = item->Pose.Position.z;
|
SplashSetup.z = item.Pose.Position.z;
|
||||||
SplashSetup.innerRadius = 16;
|
SplashSetup.innerRadius = 16;
|
||||||
SplashSetup.splashPower = item->Animation.Velocity.z;
|
SplashSetup.splashPower = item.Animation.Velocity.z;
|
||||||
SetupSplash(&SplashSetup, probe1.RoomNumber);
|
|
||||||
|
SetupSplash(&SplashSetup, pointColl0.RoomNumber);
|
||||||
SplashCount = 16;
|
SplashCount = 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ void TriggerFlashSmoke(int x, int y, int z, short roomNumber);
|
||||||
void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, const Vector3& color, int additional);
|
void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, const Vector3& color, int additional);
|
||||||
void SpawnCorpseEffect(const Vector3& pos);
|
void SpawnCorpseEffect(const Vector3& pos);
|
||||||
void TriggerAttackFlame(const Vector3i& pos, const Vector3& color, int scale);
|
void TriggerAttackFlame(const Vector3i& pos, const Vector3& color, int scale);
|
||||||
void WadeSplash(ItemInfo* item, int wh, int wd);
|
void SpawnPlayerSplash(const ItemInfo& item, int waterHeight, int waterDepth);
|
||||||
void Splash(ItemInfo* item);
|
void Splash(ItemInfo* item);
|
||||||
void TriggerRocketFire(int x, int y, int z);
|
void TriggerRocketFire(int x, int y, int z);
|
||||||
void TriggerExplosionBubbles(int x, int y, int z, short roomNumber);
|
void TriggerExplosionBubbles(int x, int y, int z, short roomNumber);
|
||||||
|
|
|
@ -631,11 +631,11 @@ void StopSoundTracks(bool excludeAmbience)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)SoundTrackType::Count; i++)
|
for (int i = 0; i < (int)SoundTrackType::Count; i++)
|
||||||
{
|
{
|
||||||
auto mode = (SoundTrackType)i;
|
auto type = (SoundTrackType)i;
|
||||||
if (excludeAmbience && mode == SoundTrackType::BGM)
|
if (excludeAmbience && type == SoundTrackType::BGM)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
StopSoundTrack((SoundTrackType)i, SOUND_XFADETIME_ONESHOT);
|
StopSoundTrack(type, SOUND_XFADETIME_ONESHOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue