summaryrefslogtreecommitdiff
path: root/mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2024-10-25 13:44:32 -0500
committerGarrett Cox <garrettjcox@gmail.com>2024-10-25 13:44:32 -0500
commit635edb07cfbc7e3714b5fc7cfa2cd80f15822cdc (patch)
tree39b877096b7a32c310384d16313751585c922825 /mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp
parent4c0892393d435c4366183456740ce70011551eb1 (diff)
Tweak CheckQueue to use notifications
Diffstat (limited to 'mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp')
-rw-r--r--mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp b/mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp
index 06a41356d..797134e53 100644
--- a/mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp
+++ b/mm/2s2h/Rando/MiscBehavior/CheckQueue.cpp
@@ -3,9 +3,12 @@
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/CustomItem/CustomItem.h"
#include "2s2h/CustomMessage/CustomMessage.h"
+#include "2s2h/BenGui/Notification.h"
extern "C" {
#include "variables.h"
+extern TexturePtr gItemIcons[131];
+extern s16 D_801CFF94[250];
}
static bool queued = false;
@@ -38,23 +41,48 @@ void Rando::MiscBehavior::CheckQueue() {
auto& randoSaveCheck = RANDO_SAVE_CHECKS[CUSTOM_ITEM_PARAM];
RandoItemId randoItemId = Rando::ConvertItem(randoSaveCheck.randoItemId);
- std::string message = "You received {{item}}!";
- CustomMessage::Replace(&message, "{{item}}", Rando::StaticData::Items[randoItemId].name);
+ CustomMessage::Entry entry = {
+ .msg = "You received {{item}}!",
+ .textboxType = 2,
+ };
+ CustomMessage::Replace(&entry.msg, "{{item}}", Rando::StaticData::Items[randoItemId].name);
+ if (Rando::StaticData::Items[randoItemId].getItemId != GI_NONE) {
+ entry.icon = (u8)Rando::StaticData::Items[randoItemId].getItemId;
+ }
if (CUSTOM_ITEM_FLAGS & CustomItem::GIVE_ITEM_CUTSCENE) {
- CustomMessage::SetActiveCustomMessage(message, { .textboxType = 2 });
+ CustomMessage::SetActiveCustomMessage(entry.msg, entry);
+ } else if (!CVarGetInteger("gEnhancements.Cutscenes.SkipGetItemCutscenes", 0)) {
+ CustomMessage::StartTextbox(entry.msg + "\x1C\x02\x10", entry);
} else {
- CustomMessage::StartTextbox(message + "\x1C\x02\x10", { .textboxType = 2 });
+ s16 itemId = Rando::StaticData::Items[randoItemId].itemId;
+ if (itemId >= ITEM_RECOVERY_HEART) {
+ itemId = D_801CFF94[Rando::StaticData::Items[randoItemId].getItemId];
+ }
+
+ Notification::Emit({
+ .itemIcon = itemId < ITEM_RECOVERY_HEART ? (const char*)gItemIcons[itemId] : nullptr,
+ .message = "You found",
+ .suffix = Rando::StaticData::Items[randoItemId].name,
+ });
}
Rando::GiveItem(randoItemId);
randoSaveCheck.obtained = true;
queued = false;
+ CUSTOM_ITEM_PARAM = randoItemId;
},
.drawItem =
[](Actor* actor, PlayState* play) {
- auto& randoSaveCheck = RANDO_SAVE_CHECKS[CUSTOM_ITEM_PARAM];
- // Do we want to convert here? Maybe not?
- RandoItemId randoItemId = Rando::ConvertItem(randoSaveCheck.randoItemId);
+ RandoItemId randoItemId;
+
+ // If the item has been given, the CUSTOM_ITEM_PARAM is set to the RI, prior to that it's the RC
+ if (CUSTOM_ITEM_FLAGS & CustomItem::CALLED_ACTION) {
+ randoItemId = (RandoItemId)CUSTOM_ITEM_PARAM;
+ } else {
+ auto& randoSaveCheck = RANDO_SAVE_CHECKS[CUSTOM_ITEM_PARAM];
+ randoItemId = Rando::ConvertItem(randoSaveCheck.randoItemId);
+ }
+
Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY);
Rando::DrawItem(randoItemId);
} });