Skip to content

Commit

Permalink
Fix gravestone puzzle alignment when viewed from memos (#1131)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenFish24 authored Feb 5, 2025
1 parent fbc64a3 commit 12e5c6d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
31 changes: 31 additions & 0 deletions Patches/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ float *RPTClosetCutsceneBlurredBarsDespawnAddr = nullptr;
BYTE *InputAssignmentFlagAddr = nullptr;
BYTE *PauseMenuQuitIndexAddr = nullptr;
int16_t *MemoCountIndexAddr = nullptr;
BYTE *MemoUniqueIdAddr = nullptr;
BYTE *QuitSubmenuFlagAddr = nullptr;
BYTE *MousePointerVisibleFlagAddr = nullptr;
int32_t *MemoListIndexAddr = nullptr;
Expand Down Expand Up @@ -2436,6 +2437,36 @@ BYTE* GetReadingMemoFlagPointer()
return ReadingMemoFlagAddr;
}

BYTE GetMemoUniqueId()
{
BYTE* pMemoUniqueId = GetMemoUniqueIdPointer();

return (pMemoUniqueId) ? *pMemoUniqueId : 0;
}

BYTE* GetMemoUniqueIdPointer()
{
if (MemoUniqueIdAddr)
{
return MemoUniqueIdAddr;
}

switch (GameVersion)
{
case SH2V_10:
MemoUniqueIdAddr = reinterpret_cast<BYTE*>(0x94D860);
break;
case SH2V_11:
MemoUniqueIdAddr = reinterpret_cast<BYTE*>(0x951460);
break;
case SH2V_DC:
MemoUniqueIdAddr = reinterpret_cast<BYTE*>(0x950460);
break;
}

return MemoUniqueIdAddr;
}

DWORD* GetDrawCursorPointer()
{
if (DrawCursorAddr)
Expand Down
3 changes: 2 additions & 1 deletion Patches/Patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ int16_t GetMemoCountIndex();
int32_t GetMemoInventory();
BYTE GetMousePointerVisibleFlag();
BYTE GetReadingMemoFlag();
BYTE GetMemoUniqueId();
float GetGlobalFadeHoldValue();
float GetPuzzleCursorHorizontalPos();
float GetPuzzleCursorVerticalPos();
Expand Down Expand Up @@ -543,6 +544,7 @@ int16_t *GetMemoCountIndexPointer();
int32_t *GetMemoInventoryPointer();
BYTE *GetMousePointerVisibleFlagPointer();
BYTE *GetReadingMemoFlagPointer();
BYTE *GetMemoUniqueIdPointer();
DWORD *GetDrawCursorPointer();
DWORD *GetSetShowCursorPointer();
BYTE* GetInputAssignmentFlagPointer();
Expand Down Expand Up @@ -640,7 +642,6 @@ void PatchFullscreenImages();
void PatchFullscreenVideos();
void PatchGameLoad();
void PatchGameLoadFlashFix();
void PatchGravestoneBoardsFix();
void PatchHealthIndicatorOption();
void PatchGreatKnifeBoatSpeed();
void PatchHoldDamage();
Expand Down
5 changes: 3 additions & 2 deletions Patches/PuzzleAlignmentFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ static DrawUserInterfaceFunc DrawUserInterface = nullptr;

void GravestoneBoardsFix(UIElement* uiElement)
{
// Check we're in the grave room and examining the gravestone
if (GetRoomID() == R_MAN_GRAVE_ROOM && IsInFullScreenImageEvent())
// Check we're in the grave room and examining the gravestone or reading memo 54
if ((GetRoomID() == R_MAN_GRAVE_ROOM && IsInFullScreenImageEvent()) ||
(GetReadingMemoFlag() && GetEventIndex() == EVENT_MEMO_LIST && GetMemoUniqueId() == 54))
{
// Step 1: Adjust the texture coordinates for each board to more closely match eachother

Expand Down

0 comments on commit 12e5c6d

Please sign in to comment.