Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Default Off) Item Description Headers #4767

Merged
merged 12 commits into from
Sep 3, 2024
17 changes: 17 additions & 0 deletions asm/macros/event.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2321,3 +2321,20 @@
.macro togglefakertc
callnative Script_ToggleFakeRtc
.endm

@ ============================ @
@ ITEM DESCRIPTION HEADER MACROS
@ Used with OW_SHOW_ITEM_DESCRIPTIONS config
.macro showitemdescription
callnative ScriptShowItemDescription
.byte 0
.endm

.macro showberrydescription
callnative ScriptShowItemDescription
.byte 1
.endm

.macro hideitemdescription
callnative ScriptHideItemDescription
.endm
14 changes: 14 additions & 0 deletions data/maps/MtChimney/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ MtChimney_EventScript_LavaCookieLady::
msgbox MtChimney_Text_ThankYouDear, MSGBOX_DEFAULT
checkitemspace ITEM_LAVA_COOKIE
call_if_eq VAR_RESULT, TRUE, MtChimney_EventScript_RemoveMoney
.if OW_SHOW_ITEM_DESCRIPTIONS == OW_ITEM_DESCRIPTIONS_OFF
giveitem ITEM_LAVA_COOKIE
goto_if_eq VAR_RESULT, FALSE, MtChimney_EventScript_BagIsFull
hidemoneybox
Expand All @@ -122,6 +123,19 @@ MtChimney_EventScript_BagIsFull::
hidemoneybox
release
end
.else
hidemoneybox
giveitem ITEM_LAVA_COOKIE
goto_if_eq VAR_RESULT, FALSE, MtChimney_EventScript_BagIsFull
release
end

MtChimney_EventScript_BagIsFull::
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
release
end
.endif @ OW_SHOW_ITEM_DESCRIPTIONS
Bassoonian marked this conversation as resolved.
Show resolved Hide resolved


MtChimney_EventScript_RemoveMoney::
removemoney 200
Expand Down
5 changes: 5 additions & 0 deletions data/maps/Route109_SeashoreHouse/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ Route109_SeashoreHouse_EventScript_BuySodaPop::
msgbox Route109_SeashoreHouse_Text_HereYouGo, MSGBOX_DEFAULT
removemoney 300
updatemoneybox
.if OW_SHOW_ITEM_DESCRIPTIONS != OW_ITEM_DESCRIPTIONS_OFF
hidemoneybox
giveitem ITEM_SODA_POP
.else
giveitem ITEM_SODA_POP
hidemoneybox
.endif
release
end

Expand Down
3 changes: 3 additions & 0 deletions data/scripts/berry_tree.inc
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,16 @@ BerryTree_EventScript_PickBerry::
special IncrementDailyPickedBerries
special ObjectEventInteractionRemoveBerryTree
message BerryTree_Text_PickedTheBerry
delay 10
showberrydescription
playfanfare MUS_OBTAIN_BERRY
waitmessage
waitfanfare
waitbuttonpress
message BerryTree_Text_PutAwayBerry
waitmessage
waitbuttonpress
hideitemdescription
release
end

Expand Down
14 changes: 14 additions & 0 deletions data/scripts/obtain_item.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.set AMOUNT, VAR_0x8001

Std_ObtainItem::
copyvar VAR_0x8006, ITEMID
additem ITEMID, AMOUNT
copyvar VAR_0x8007, VAR_RESULT
call EventScript_ObtainItemMessage
Expand Down Expand Up @@ -58,8 +59,11 @@ EventScript_ObtainedItem::
EventScript_ObtainedItemMessage:
message gText_ObtainedTheItem
EventScript_ContinueObtainedItem:
delay 10
showitemdescription
waitfanfare
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
hideitemdescription
setvar VAR_RESULT, TRUE
return

Expand Down Expand Up @@ -103,6 +107,7 @@ Std_FindItem::
lock
faceplayer
waitse
copyvar VAR_0x8006, ITEMID
copyvar VAR_0x8004, ITEMID
copyvar VAR_0x8005, AMOUNT
checkitemspace ITEMID, AMOUNT
Expand All @@ -118,20 +123,25 @@ Std_FindItem::
EventScript_PickUpItem::
removeobject VAR_LAST_TALKED
additem VAR_0x8004, VAR_0x8005
copyvar VAR_0x8006 VAR_0x8004
specialvar VAR_RESULT, BufferTMHMMoveName
copyvar VAR_0x8008, VAR_RESULT
call_if_eq VAR_0x8008, TRUE, EventScript_FoundTMHM
call_if_eq VAR_0x8008, FALSE, EventScript_FoundItem
delay 10
showitemdescription
waitfanfare
waitmessage
bufferitemnameplural STR_VAR_2, VAR_0x8004, VAR_0x8005
pyramid_inchallenge
goto_if_eq VAR_RESULT, TRUE, EventScript_PutBattlePyramidItemInBag
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
hideitemdescription
return

EventScript_PutBattlePyramidItemInBag::
msgbox gText_PlayerPutItemInBag, MSGBOX_DEFAULT
hideitemdescription
return

EventScript_FoundTMHM::
Expand Down Expand Up @@ -165,6 +175,7 @@ EventScript_NoRoomToPickUpItem::
EventScript_HiddenItemScript::
lockall
waitse
copyvar VAR_0x8006, VAR_0x8005
additem VAR_0x8005
copyvar VAR_0x8007, VAR_RESULT
bufferitemnameplural STR_VAR_2, VAR_0x8005, 1
Expand Down Expand Up @@ -194,11 +205,14 @@ EventScript_FoundHiddenItem::
end

EventScript_PutHiddenItemInPocket::
delay 10
showitemdescription
waitmessage
waitfanfare
bufferitemnameplural STR_VAR_2, VAR_0x8004, 1
copyvar VAR_0x8004, VAR_0x8008
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
hideitemdescription
special TryPutTreasureInvestigatorsOnAir
special SetHiddenItemFlag
releaseall
Expand Down
6 changes: 6 additions & 0 deletions include/config/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#define OW_HIDE_REPEAT_MAP_POPUP FALSE // If enabled, map popups will not appear if entering a map with the same Map Section Id as the last.
#define OW_FRLG_WHITEOUT FALSE // If enabled, shows an additional whiteout message and post whiteout event script with healing NPC.

// Item Obtain Description Box
#define OW_ITEM_DESCRIPTIONS_OFF 0 // never show descriptions
#define OW_ITEM_DESCRIPTIONS_FIRST_TIME 1 // show first time (** SAVE-BREAKING - see struct SaveBlock3 **)
#define OW_ITEM_DESCRIPTIONS_ALWAYS 2 // always show description
#define OW_SHOW_ITEM_DESCRIPTIONS OW_ITEM_DESCRIPTIONS_OFF // If enabled, item descriptions/images will be shown when finding items.

// These generational defines only make a distinction for Berries and the OW_PC_MOVE_ORDER
#define GEN_6_XY GEN_6
#define GEN_6_ORAS GEN_LATEST + 1
Expand Down
5 changes: 5 additions & 0 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,17 @@ struct Time
/*0x04*/ s8 seconds;
};

#include "constants/items.h"
AlexOn1ine marked this conversation as resolved.
Show resolved Hide resolved
#define ITEM_FLAGS_COUNT ((ITEMS_COUNT / 8) + ((ITEMS_COUNT % 8) ? 1 : 0))

struct SaveBlock3
{
#if OW_USE_FAKE_RTC
struct Time fakeRTC;
#endif
#if OW_SHOW_ITEM_DESCRIPTIONS == OW_ITEM_DESCRIPTIONS_FIRST_TIME
u8 itemFlags[ITEM_FLAGS_COUNT];
#endif
};

extern struct SaveBlock3 *gSaveBlock3Ptr;
Expand Down
8 changes: 8 additions & 0 deletions include/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,12 @@ bool32 Overworld_SendKeysToLinkIsRunning(void);
bool32 IsSendingKeysOverCable(void);
void ClearLinkPlayerObjectEvents(void);

// Item Description Headers
enum ItemObtainFlags
{
FLAG_GET_ITEM_OBTAINED,
FLAG_SET_ITEM_OBTAINED,
};
bool8 GetSetItemObtained(u16 item, enum ItemObtainFlags caseId);

#endif // GUARD_OVERWORLD_H
2 changes: 2 additions & 0 deletions src/berry.c
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,8 @@ void ObjectEventInteractionGetBerryCountString(void)
u8 treeId = GetObjectEventBerryTreeId(gSelectedObjectEvent);
u8 berry = GetBerryTypeByBerryTreeId(treeId);
u8 count = GetBerryCountByBerryTreeId(treeId);

gSpecialVar_0x8006 = BerryTypeToItemId(berry);
CopyItemNameHandlePlural(BerryTypeToItemId(berry), gStringVar1, count);
berry = GetTreeMutationValue(treeId);
if (berry > 0)
Expand Down
Loading
Loading