Skip to content

Commit

Permalink
feat: cool death fade
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed May 25, 2022
1 parent ce22b92 commit 51929ac
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Code/client/Games/References.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ float CalculateRealDamage(Actor* apHittee, float aDamage) noexcept

}

void FadeOutGame(bool aFadingOut, bool aBlackFade, float aFadeDuration, bool aRemainVisible, float aSecondsToFade) noexcept
{
using TFadeOutGame = void(bool, bool, float, bool, float);
POINTER_SKYRIMSE(TFadeOutGame, fadeOutGame, 52847);
fadeOutGame.Get()(aFadingOut, aBlackFade, aFadeDuration, aRemainVisible, aSecondsToFade);
}

TESObjectREFR* TESObjectREFR::GetByHandle(uint32_t aHandle) noexcept
{
TESObjectREFR* pResult = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions Code/client/Games/References.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ float* GetGreetDistance() noexcept

}

void FadeOutGame(bool aFadingOut, bool aBlackFade, float aFadeDuration, bool aRemainVisible, float aSecondsToFade) noexcept;

struct ExActor : Actor, ActorExtension
{
};
Expand Down
6 changes: 6 additions & 0 deletions Code/client/Services/Debug/DebugService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ void DebugService::OnUpdate(const UpdateEvent& acUpdateEvent) noexcept
{
s_f8Pressed = true;

static bool s_enabled = true;

FadeOutGame(s_enabled, true, 1.f, true, 0.f);

s_enabled = !s_enabled;

#if 0
static bool s_enabled = true;
static bool s_firstPerson = false;
Expand Down
5 changes: 4 additions & 1 deletion Code/client/Services/Generic/PlayerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void PlayerService::RunRespawnUpdates(const double acDeltaTime) noexcept
{
s_startTimer = true;
m_respawnTimer = 5.0;
FadeOutGame(true, true, 2.5f, true, 2.5f);

// If a player dies not by its health reaching 0, getting it up from its bleedout state isn't possible
// just by setting its health back to max. Therefore, put it to 0.
Expand All @@ -161,7 +162,7 @@ void PlayerService::RunRespawnUpdates(const double acDeltaTime) noexcept
{
pPlayer->RespawnPlayer();

knockdownTimer = 1.0;
knockdownTimer = 1.5;
knockdownStart = true;

m_transport.Send(PlayerRespawnRequest());
Expand All @@ -187,6 +188,8 @@ void PlayerService::RunPostDeathUpdates(const double acDeltaTime) noexcept
PlayerCharacter* pPlayer = PlayerCharacter::Get();
pPlayer->currentProcess->KnockExplosion(pPlayer, &pPlayer->position, 0.f);

FadeOutGame(false, true, 0.5f, true, 2.f);

knockdownStart = false;
}
}
Expand Down

0 comments on commit 51929ac

Please sign in to comment.