Skip to content

Commit

Permalink
Fix cutscene fadeout James gives final blow
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Mar 25, 2023
1 parent 1dd57ac commit 8918a71
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
27 changes: 27 additions & 0 deletions Patches/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ float* MeetingMariaCutsceneFogCounterTwoAddr = nullptr;
float* RPTClosetCutsceneMannequinDespawnAddr = nullptr;
float* RPTClosetCutsceneBlurredBarsDespawnAddr = nullptr;
BYTE* InputAssignmentFlagAddr = nullptr;
float* GlobalFadeHoldValueAddr = nullptr;

bool ShowDebugOverlay = false;
bool ShowInfoOverlay = false;
Expand Down Expand Up @@ -2107,9 +2108,35 @@ BYTE GetInputAssignmentFlag()

BYTE* GetInputAssignmentFlagPointer()
{
if (InputAssignmentFlagAddr)
{
return InputAssignmentFlagAddr;
}

InputAssignmentFlagAddr = (BYTE*)((GameVersion == SH2V_10) ? 0x009415F5 :
(GameVersion == SH2V_11) ? 0x009415F5 :
(GameVersion == SH2V_DC) ? 0x009441F5 : NULL);

return InputAssignmentFlagAddr;
}

float GetGlobalFadeHoldValue()
{
float* pGlobalFadeHoldValue = GetGlobalFadeHoldValuePointer();

return (pGlobalFadeHoldValue) ? *pGlobalFadeHoldValue : 0;
}

float* GetGlobalFadeHoldValuePointer()
{
if (GlobalFadeHoldValueAddr)
{
return GlobalFadeHoldValueAddr;
}

GlobalFadeHoldValueAddr = (float*)((GameVersion == SH2V_10) ? 0x0094262C :
(GameVersion == SH2V_11) ? 0x0094622C :
(GameVersion == SH2V_DC) ? 0x0094522C : NULL);

return GlobalFadeHoldValueAddr;
}
2 changes: 2 additions & 0 deletions Patches/Patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ int32_t GetIsWritingQuicksave();
int32_t GetTextAddr();
float GetFrametime();
BYTE GetInputAssignmentFlag();
float GetGlobalFadeHoldValue();

// Shared pointer function declaration
DWORD *GetRoomIDPointer();
Expand Down Expand Up @@ -141,6 +142,7 @@ float *GetMeetingMariaCutsceneFogCounterTwoPointer();
float *GetRPTClosetCutsceneMannequinDespawnPointer();
float *GetRPTClosetCutsceneBlurredBarsDespawnPointer();
BYTE* GetInputAssignmentFlagPointer();
float* GetGlobalFadeHoldValuePointer();

// Function patch declaration
void CheckArgumentsForPID();
Expand Down
2 changes: 1 addition & 1 deletion Resources/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 2064
#define BUILD_NUMBER 2065
7 changes: 6 additions & 1 deletion Wrappers/d3d8/IDirect3DDevice8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1900,8 +1900,13 @@ HRESULT m_IDirect3DDevice8::BeginScene()
RunFlashlightClockPush();
}

// Fix cutscene James final blow to his wife
if (GetRoomID() == 0xBB && GetGlobalFadeHoldValue() == 2.0f)
{
IsInFakeFadeout = true;
}
// Bowling cutscene fading
if (IsInFakeFadeout && GetCutsceneID() != 0x19)
else if (IsInFakeFadeout && GetCutsceneID() != 0x19)
{
IsInFakeFadeout = false;
}
Expand Down

0 comments on commit 8918a71

Please sign in to comment.