|
2 | 2 | #include <ui/black_bar.h> |
3 | 3 | #include <user/config.h> |
4 | 4 | #include <user/achievement_manager.h> |
| 5 | +#include <app.h> |
5 | 6 |
|
6 | 7 | // TODO (Hyper): implement achievements menu. |
7 | 8 | void AchievementManagerUnlockMidAsmHook(PPCRegister& id) |
@@ -103,9 +104,60 @@ void PedestrianAnimationLOD(PPCRegister& val) |
103 | 104 | val.u32 = 0; |
104 | 105 | } |
105 | 106 |
|
106 | | -bool DisableHints() |
| 107 | +bool IsTextCardHint(Sonicteam::TextCard* pTextCard) |
107 | 108 | { |
108 | | - return !Config::Hints; |
| 109 | + return pTextCard->m_pVariables && strstr(pTextCard->m_pVariables, "picture(button_"); |
| 110 | +} |
| 111 | + |
| 112 | +bool DisableControlTutorialHints(PPCRegister& r3) |
| 113 | +{ |
| 114 | + if (Config::ControlTutorial) |
| 115 | + return false; |
| 116 | + |
| 117 | + auto pspTextCard = (boost::shared_ptr<Sonicteam::TextCard>*)g_memory.Translate(r3.u32); |
| 118 | + |
| 119 | + if (auto pTextCard = pspTextCard->get()) |
| 120 | + { |
| 121 | + if (IsTextCardHint(pTextCard)) |
| 122 | + return true; |
| 123 | + } |
| 124 | + |
| 125 | + return false; |
| 126 | +} |
| 127 | + |
| 128 | +// Sonicteam::CommonObjectHint::Update |
| 129 | +PPC_FUNC_IMPL(__imp__sub_822CE930); |
| 130 | +PPC_FUNC(sub_822CE930) |
| 131 | +{ |
| 132 | + auto pCommonObjectHint = (Sonicteam::CommonObjectHint*)(base + ctx.r3.u32); |
| 133 | + |
| 134 | + if (pCommonObjectHint->m_Type == Sonicteam::CommonObjectHint::CommonObjectHintType_HintRing) |
| 135 | + { |
| 136 | + if (!Config::Hints) |
| 137 | + { |
| 138 | + pCommonObjectHint->Destroy(); |
| 139 | + return; |
| 140 | + } |
| 141 | + |
| 142 | + if (!Config::ControlTutorial) |
| 143 | + { |
| 144 | + guest_stack_var<int> stack{}; |
| 145 | + |
| 146 | + auto pspTextCard = GuestToHostFunction<boost::shared_ptr<Sonicteam::TextCard>*>(sub_825ECB48, |
| 147 | + stack.get(), App::s_pApp->GetGame()->m_pHintTextBook.get(), (const char*)&pCommonObjectHint->m_MessageName); |
| 148 | + |
| 149 | + if (auto pTextCard = pspTextCard->get()) |
| 150 | + { |
| 151 | + if (IsTextCardHint(pTextCard)) |
| 152 | + { |
| 153 | + pCommonObjectHint->Destroy(); |
| 154 | + return; |
| 155 | + } |
| 156 | + } |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + __imp__sub_822CE930(ctx, base); |
109 | 161 | } |
110 | 162 |
|
111 | 163 | PPC_FUNC_IMPL(__imp__sub_824A6EA8); |
|
0 commit comments