@@ -19,12 +19,12 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
1919
2020// clang-format off
2121std::vector<RogueLikeQuestObject> rogueLikeQuestList = {
22- { RL_QUEST_HF_TRIAL_A , RL_QUEST_TRIAL , " Ganon's Fury I" , " Watch out!" , RL_QUEST_ACTIVE , 0 , 1 },
23- { RL_QUEST_KF_HOPOFFAITH , RL_QUEST_SIGHTSEEING , " Hop of Faith" , " Sidehop from the fence\n above the waterfall and land\n on the middle platform." , RL_QUEST_ACTIVE , 0 , 1 },
24- { RL_QUEST_KF_STRONGMAN , RL_QUEST_SIGHTSEEING , " Toe Crushers" , " Mido likes rock, show them\n that we don't!" , RL_QUEST_ACTIVE , 0 , 11 },
25- { RL_QUEST_KV_POTHUNT , RL_QUEST_SIGHTSEEING , " The Pot Thickens" , " A magical pot with extra lives?\n Find out how many!" , RL_QUEST_ACTIVE , 0 , 4 },
26- { RL_QUEST_KV_STALFOS , RL_QUEST_KILL , " Stal-Not-So-Child" , " The Stalchild in Hyrule Field have\n gotten bigger, take them out!" , RL_QUEST_ACTIVE , 0 , 5 },
27- { RL_QUEST_ZD_POTTERY , RL_QUEST_SIGHTSEEING , " A Smashing View" , " Toss a pot off the edge\n of the waterfall." , RL_QUEST_ACTIVE , 0 , 1 },
22+ { RL_QUEST_HF_TRIAL_A , " Ganon's Fury I" , " Watch out!" , RL_QUEST_ACTIVE , 0 , 1 },
23+ { RL_QUEST_KF_HOPOFFAITH , " Hop of Faith" , " Sidehop from the fence\n above the waterfall and land\n on the middle platform." , RL_QUEST_ACTIVE , 0 , 1 },
24+ { RL_QUEST_KF_STRONGMAN , " Toe Crushers" , " Mido likes rock, show them\n that we don't!" , RL_QUEST_ACTIVE , 0 , 11 },
25+ { RL_QUEST_KV_POTHUNT , " The Pot Thickens" , " A magical pot with extra lives?\n Find out how many!" , RL_QUEST_ACTIVE , 0 , 4 },
26+ { RL_QUEST_KV_STALFOS , " Stal-Not-So-Child" , " The Stalchild in Hyrule Field have\n gotten bigger, take them out!" , RL_QUEST_ACTIVE , 0 , 5 },
27+ { RL_QUEST_ZD_POTTERY , " A Smashing View" , " Toss a pot off the edge\n of the waterfall." , RL_QUEST_ACTIVE , 0 , 1 },
2828};
2929
3030std::vector<Vec3f> potHuntLocations = {
@@ -48,7 +48,7 @@ extern std::vector<RogueLikeQuestObject> activeQuests;
4848static std::vector<Vec3f> potHuntAvailability;
4949static std::vector<Actor*> currentTrialActorList;
5050static bool potHuntActorSpawned = false ;
51- static bool showTrialConditions = true ;
51+ static bool sendConditionMessage = true ;
5252
5353bool CheckActiveQuestById (u8 questId) {
5454 for (auto & quest : activeQuests) {
@@ -77,6 +77,33 @@ bool CheckQuestCompletedById(u8 questId) {
7777 return false ;
7878}
7979
80+ void SendQuestConditionMessage (u8 questId) {
81+ if (!sendConditionMessage) {
82+ return ;
83+ }
84+
85+ std::string message = " " ;
86+ ImVec4 color = ImVec4 (1 , 1 , 1 , 1 );
87+
88+ switch (questId) {
89+ case RL_QUEST_KV_POTHUNT :
90+ message = " A Magical Pot has appeared nearby." ;
91+ color = ImVec4 (0 .25f , 0 , 0 .75f , 1 );
92+ break ;
93+ case RL_QUEST_HF_TRIAL_A :
94+ message = " Come back when you have a sword..." ;
95+ color = ImVec4 (1 , 0 , 0 , 1 );
96+ break ;
97+ default :
98+ return ;
99+ }
100+ Notification::Emit ({
101+ .message = message,
102+ .messageColor = color,
103+ });
104+ sendConditionMessage = false ;
105+ }
106+
80107void RogueLike::Quests::CompleteQuestById (u8 questId) {
81108 for (auto & quest : activeQuests) {
82109 if (quest.questId == questId) {
@@ -233,15 +260,31 @@ void StartQuest(u8 questId) {
233260 spawnPoint.y , spawnPoint.z , 0 , 0 , 0 , 256 , false );
234261 Actor_SetColorFilter (potActor, 0x1000 , 150 , 0 , 1000 );
235262 potHuntAvailability.erase (potHuntAvailability.begin () + potRoll);
236- Notification::Emit ({
237- .message = " A Magical Pot has appeared nearby." ,
238- .messageColor = ImVec4 (0 .25f , 0 , 0 .75f , 1 ),
239- });
263+ SendQuestConditionMessage (RL_QUEST_KV_POTHUNT );
264+ }
265+ break ;
266+ default :
267+ break ;
268+ }
269+ }
270+
271+ RogueLikeQuest FindTrialByLocation (Actor* trialActor) {
272+ switch (gPlayState ->sceneNum ) {
273+ case SCENE_HYRULE_FIELD :
274+ if (trialActor->world .pos .x == 335 .571f && trialActor->world .pos .z == 2677 .854f ) {
275+ if (LINK_IS_ADULT && ((EQUIP_FLAG_SWORD_MASTER & gSaveContext .inventory .equipment ) ||
276+ (EQUIP_FLAG_SWORD_BGS & gSaveContext .inventory .equipment ))) {
277+ return RL_QUEST_HF_TRIAL_A ;
278+ } else {
279+ SendQuestConditionMessage (RL_QUEST_HF_TRIAL_A );
280+ }
240281 }
241282 break ;
242283 default :
243284 break ;
244285 }
286+
287+ return RL_QUEST_ID_MAX ;
245288}
246289
247290static void InitRogueLikeQuests () {
@@ -259,6 +302,7 @@ static void OnLoadGame() {
259302
260303 COND_HOOK (OnPlayerUpdate, IS_ROGUELIKE , []() {
261304 Player* player = GET_PLAYER (gPlayState );
305+ RogueLikeQuest questId = RL_QUEST_ID_MAX ;
262306 static bool hopOfFaithStart = false ;
263307
264308 if (CheckActiveQuestById (RL_QUEST_KF_HOPOFFAITH ) && !CheckQuestGoalCompleteById (RL_QUEST_KF_HOPOFFAITH )) {
@@ -274,24 +318,17 @@ static void OnLoadGame() {
274318 }
275319 }
276320 }
277- if (!CheckQuestGoalCompleteById (RL_QUEST_HF_TRIAL_A ) && gPlayState ->sceneNum == SCENE_HYRULE_FIELD ) {
278- if (!CheckActiveQuestById (RL_QUEST_HF_TRIAL_A )) {
279- Actor* trialActor =
280- Actor_FindNearby (gPlayState , &GET_PLAYER (gPlayState )->actor , ACTOR_BG_MJIN , ACTORCAT_BG , 45 .0f );
281- if (trialActor != NULL ) {
282- if (LINK_IS_ADULT && ((EQUIP_FLAG_SWORD_MASTER & gSaveContext .inventory .equipment ) ||
283- (EQUIP_FLAG_SWORD_BGS & gSaveContext .inventory .equipment ))) {
284- RogueLike::Quests::AddQuestById (RL_QUEST_HF_TRIAL_A );
285- StartQuest (RL_QUEST_HF_TRIAL_A );
286- } else {
287- if (showTrialConditions) {
288- Notification::Emit ({
289- .message = " Come back when you have a sword..." ,
290- .messageColor = ImVec4 (1 , 0 , 0 , 1 ),
291- });
292- showTrialConditions = false ;
293- }
294- }
321+ if (gPlayState ->sceneNum == SCENE_HYRULE_FIELD ) {
322+ Actor* trialActor =
323+ Actor_FindNearby (gPlayState , &GET_PLAYER (gPlayState )->actor , ACTOR_BG_MJIN , ACTORCAT_BG , 45 .0f );
324+ if (trialActor != NULL ) {
325+ questId = FindTrialByLocation (trialActor);
326+ if (questId == RL_QUEST_ID_MAX ) {
327+ return ;
328+ }
329+ if (!CheckActiveQuestById (questId)) {
330+ RogueLike::Quests::AddQuestById (questId);
331+ StartQuest (questId);
295332 }
296333 }
297334 }
@@ -301,7 +338,7 @@ static void OnLoadGame() {
301338 for (auto & quest : activeQuests) {
302339 RogueLike::Quests::ResetQuestProgress (quest.questId );
303340 }
304- showTrialConditions = true ;
341+ sendConditionMessage = true ;
305342 });
306343
307344 COND_HOOK (OnRoomInit, IS_ROGUELIKE , [](u16 roomNum) {
0 commit comments