diff --git a/asm/trader.s b/asm/trader.s index 8e4bce384..8e0b17905 100644 --- a/asm/trader.s +++ b/asm/trader.s @@ -433,15 +433,15 @@ sub_8133DA0: @ 8133DA0 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 - bl sub_81279C4 + bl IsSelectedDecorInThePC lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _08133DFC ldr r5, =gSpecialVar_0x8006 - ldr r0, =gUnknown_0203A172 + ldr r0, =gCurDecorationIndex ldrb r1, [r0] - ldr r0, =gUnknown_0203A14C + ldr r0, =gCurDecorInventoryItems ldr r0, [r0] adds r0, r1 ldrb r0, [r0] diff --git a/data/strings.s b/data/strings.s index 90ccad90f..2b88c6d03 100644 --- a/data/strings.s +++ b/data/strings.s @@ -1517,52 +1517,52 @@ gUnknown_085EA79D:: @ 85EA79D gUnknown_085EA7A9:: @ 85EA7A9 .string "{STR_VAR_3}{STR_VAR_1}/{STR_VAR_2}$" -gUnknown_085EA7B1:: @ 85EA7B1 +gText_Decorate:: @ 85EA7B1 .string "DECORATE$" -gUnknown_085EA7BA:: @ 85EA7BA +gText_PutAway:: @ 85EA7BA .string "PUT AWAY$" -gUnknown_085EA7C3:: @ 85EA7C3 +gText_Toss2:: @ 85EA7C3 .string "TOSS$" gText_Color161Shadow161:: @ 85EA7C8 .string "{COLOR 161}{SHADOW 161}$" -gUnknown_085EA7CF:: @ 85EA7CF +gText_PutOutSelectedDecorItem:: @ 85EA7CF .string "Put out the selected decoration item.$" -gUnknown_085EA7F5:: @ 85EA7F5 +gText_StoreChosenDecorInPC:: @ 85EA7F5 .string "Store the chosen decoration in the PC.$" -gUnknown_085EA81C:: @ 85EA81C +gText_ThrowAwayUnwantedDecors:: @ 85EA81C .string "Throw away unwanted decorations.$" gText_NoDecorations:: @ 85EA83D .string "There are no decorations.{PAUSE_UNTIL_PRESS}$" -gUnknown_085EA859:: @ 85EA859 +gText_Desk:: @ 85EA859 .string "DESK$" -gUnknown_085EA85E:: @ 85EA85E +gText_Chair:: @ 85EA85E .string "CHAIR$" -gUnknown_085EA864:: @ 85EA864 +gText_Plant:: @ 85EA864 .string "PLANT$" -gUnknown_085EA86A:: @ 85EA86A +gText_Ornament:: @ 85EA86A .string "ORNAMENT$" -gUnknown_085EA873:: @ 85EA873 +gText_Mat:: @ 85EA873 .string "MAT$" -gUnknown_085EA877:: @ 85EA877 +gText_Poster:: @ 85EA877 .string "POSTER$" -gUnknown_085EA87E:: @ 85EA87E +gText_Doll:: @ 85EA87E .string "DOLL$" -gUnknown_085EA883:: @ 85EA883 +gText_Cushion:: @ 85EA883 .string "CUSHION$" gText_Gold:: @ 85EA88B diff --git a/include/decoration.h b/include/decoration.h index c426a479a..adefb2fd1 100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -187,8 +187,8 @@ struct DecorPCPointers }; extern const struct Decoration gDecorations[]; -extern EWRAM_DATA u8 *gUnknown_0203A14C; -extern EWRAM_DATA u8 gUnknown_0203A172; +extern EWRAM_DATA u8 *gCurDecorInventoryItems; +extern EWRAM_DATA u8 gCurDecorationIndex; void sub_8126968(void); diff --git a/include/strings.h b/include/strings.h index 33c8984d2..191b1809a 100644 --- a/include/strings.h +++ b/include/strings.h @@ -56,19 +56,19 @@ extern const u8 gText_NoDecorationHere[]; extern const u8 gText_DecorationWillBeDiscarded[]; extern const u8 gText_CantThrowAwayInUse[]; extern const u8 gText_DecorationThrownAway[]; -extern const u8 gUnknown_085EA859[]; -extern const u8 gUnknown_085EA85E[]; -extern const u8 gUnknown_085EA864[]; -extern const u8 gUnknown_085EA86A[]; -extern const u8 gUnknown_085EA873[]; -extern const u8 gUnknown_085EA877[]; -extern const u8 gUnknown_085EA7CF[]; -extern const u8 gUnknown_085EA7F5[]; -extern const u8 gUnknown_085EA81C[]; -extern const u8 gUnknown_085EA87E[]; -extern const u8 gUnknown_085EA883[]; -extern const u8 gUnknown_085EA7B1[]; -extern const u8 gUnknown_085EA7BA[]; -extern const u8 gUnknown_085EA7C3[]; +extern const u8 gText_Desk[]; +extern const u8 gText_Chair[]; +extern const u8 gText_Plant[]; +extern const u8 gText_Ornament[]; +extern const u8 gText_Mat[]; +extern const u8 gText_Poster[]; +extern const u8 gText_PutOutSelectedDecorItem[]; +extern const u8 gText_StoreChosenDecorInPC[]; +extern const u8 gText_ThrowAwayUnwantedDecors[]; +extern const u8 gText_Doll[]; +extern const u8 gText_Cushion[]; +extern const u8 gText_Decorate[]; +extern const u8 gText_PutAway[]; +extern const u8 gText_Toss2[]; #endif //GUARD_STRINGS_H diff --git a/src/decoration.c b/src/decoration.c index 11d44693b..0179d36a1 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -40,25 +40,25 @@ // Static type declarations -#define OVERWORLD_DECOR_PAL_TAG 0xbe5 -#define OVERWORLD_DECOR_BOX_PAL_TAG 0x008 +#define OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG 0xbe5 +#define OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG 0x008 -struct UnkStruct_0203A18C { - struct ListMenuItem unk_000[41]; - u8 unk_148[41][24]; +struct DecorPCBuffer { + struct ListMenuItem items[41]; + u8 names[41][24]; u8 unk_520; u8 unk_521; u8 unk_522; }; -struct UnkStruct_0203A190 { +struct PlaceDecorationGraphicsDataBuffer { /*0x000; 0x0203a190*/ const struct Decoration *decoration; /*0x004; 0x0203a194*/ u16 tiles[0x40]; /*0x084; 0x0203a214*/ u8 image[0x800]; /*0x884; 0x0203aa14*/ u16 palette[16]; }; -struct UnkStruct_0203AA44 { +struct DecorRearrangementDataBuffer { u8 idx; u8 width; u8 height; @@ -67,39 +67,39 @@ struct UnkStruct_0203AA44 { // Static RAM declarations -EWRAM_DATA u8 *gUnknown_0203A14C = NULL; -EWRAM_DATA u8 gUnknown_0203A150 = 0; -EWRAM_DATA u8 gUnknown_0203A151 = 0; -EWRAM_DATA u8 gUnknown_0203A152[16] = {}; -EWRAM_DATA u8 gUnknown_0203A162[12] = {}; -EWRAM_DATA u16 gUnknown_0203A16E = 0; -EWRAM_DATA u16 gUnknown_0203A170 = 0; -EWRAM_DATA u8 gUnknown_0203A172 = 0; -EWRAM_DATA u8 gUnknown_0203A173 = 0; +EWRAM_DATA u8 *gCurDecorInventoryItems = NULL; +EWRAM_DATA u8 sSecretBasePCMenuCursorPos = 0; +EWRAM_DATA u8 sCurDecorCatCount = 0; +EWRAM_DATA u8 sSecretBaseItemsIndicesBuffer[16] = {}; +EWRAM_DATA u8 sPlayerRoomItemsIndicesBuffer[12] = {}; +EWRAM_DATA u16 sSecretBasePCSelectDecorLineNo = 0; +EWRAM_DATA u16 sSecretBasePCSelectDecorPageNo = 0; +EWRAM_DATA u8 gCurDecorationIndex = 0; +EWRAM_DATA u8 sCurDecorationCategory = DECORCAT_DESK; EWRAM_DATA u32 filler_0203a174[2] = {}; EWRAM_DATA struct DecorPCPointers gUnknown_0203A17C = {}; -EWRAM_DATA u8 gUnknown_0203A188[4] = {}; -EWRAM_DATA struct UnkStruct_0203A18C *gUnknown_0203A18C = NULL; -EWRAM_DATA struct UnkStruct_0203A190 gUnknown_0203A190 = {}; -EWRAM_DATA u16 gUnknown_0203AA34 = 0; -EWRAM_DATA u16 gUnknown_0203AA36 = 0; -EWRAM_DATA u8 gUnknown_0203AA38 = 0; -EWRAM_DATA u8 gUnknown_0203AA39 = 0; -EWRAM_DATA u8 gUnknown_0203AA3A = 0; -EWRAM_DATA struct OamData gUnknown_0203AA3C = {}; -EWRAM_DATA struct UnkStruct_0203AA44 gUnknown_0203AA44[16] = {}; -EWRAM_DATA u8 gUnknown_0203AAC4 = 0; +EWRAM_DATA u8 sDecorMenuWindowIndices[4] = {}; +EWRAM_DATA struct DecorPCBuffer *sDecorPCBuffer = NULL; +EWRAM_DATA struct PlaceDecorationGraphicsDataBuffer sPlaceDecorationGraphicsDataBuffer = {}; +EWRAM_DATA u16 sCurDecorMapX = 0; +EWRAM_DATA u16 sCurDecorMapY = 0; +EWRAM_DATA u8 sDecor_CameraSpriteObjectIdx1 = 0; +EWRAM_DATA u8 sDecor_CameraSpriteObjectIdx2 = 0; +EWRAM_DATA u8 sDecorationLastDirectionMoved = 0; +EWRAM_DATA struct OamData sDecorSelectorOam = {}; +EWRAM_DATA struct DecorRearrangementDataBuffer sDecorRearrangementDataBuffer[16] = {}; +EWRAM_DATA u8 sCurDecorSelectedInRearrangement = 0; // Static ROM declarations void sub_8126B80(u8 taskId); void sub_8126C08(void); -void sub_8126C48(u8 taskId); -void sub_8126CA4(u8 taskId); -void sub_8126D10(u8 taskId); +void SecretBasePC_Decorate(u8 taskId); +void SecretBasePC_PutAway(u8 taskId); +void SecretBasePC_Toss(u8 taskId); void sub_8126DA4(u8 taskId); -void sub_8126D6C(u8 taskId); -void sub_8126DCC(u8 taskId); +void SecretBasePC_Cancel(u8 taskId); +void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId); void sub_8126DFC(u8 taskId); void sub_8126E8C(u8 taskId); void sub_8126F68(u8 winid, u8 decorCat, u8 x, u8 y, bool8 flag, u8 speed); @@ -119,15 +119,15 @@ void sub_8127744(u32 a0); void sub_81277A8(void); bool8 sub_81277BC(u8 idx); bool8 sub_81277E8(u8 idx); -void sub_81279B4(u8 taskId); +void IdentifyOwnedDecorationsCurrentlyInUse(u8 taskId); void sub_812759C(u8 taskId); void sub_8127718(u8 decorCat); void sub_8127A30(u8 taskId); void sub_8127A8C(u8 taskId); void sub_8127F68(u8 taskId); void sub_8128060(u8 taskId); -void ConfigureCameraObjectForPlacingDecoration(struct UnkStruct_0203A190 *data, u8 decor); -void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct UnkStruct_0203A190 *data); +void ConfigureCameraObjectForPlacingDecoration(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor); +void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphicsDataBuffer *data); void sub_812826C(u8 taskId); void sub_81283BC(u8 taskId); void sub_8128414(u8 taskId); @@ -145,7 +145,7 @@ void sub_8128FD8(u8 taskId); void sub_8129020(u8 taskId); void sub_81292D0(struct Sprite *sprite); void sub_81292E8(struct Sprite *sprite); -u8 gpu_pal_decompress_alloc_tag_and_upload(struct UnkStruct_0203A190 *data, u8 decor); +u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor); const u8 *GetDecorationIconPicOrPalette(u16 decor, u8 mode); bool8 sub_81299AC(u8 taskId); void sub_8129ABC(u8 taskId); @@ -175,37 +175,37 @@ void sub_812A478(u8 taskId); #include "data/decoration/description.h" #include "data/decoration/header.h" -const u8 *const gUnknown_085A6B28[] = { - gUnknown_085EA859, - gUnknown_085EA85E, - gUnknown_085EA864, - gUnknown_085EA86A, - gUnknown_085EA873, - gUnknown_085EA877, - gUnknown_085EA87E, - gUnknown_085EA883 +const u8 *const sDecorCatNames[] = { + gText_Desk, + gText_Chair, + gText_Plant, + gText_Ornament, + gText_Mat, + gText_Poster, + gText_Doll, + gText_Cushion }; -const struct MenuAction gUnknown_085A6B48[] = { +const struct MenuAction sSecretBasePCMenuActions[] = { { - gUnknown_085EA7B1, {.void_u8=sub_8126C48} + gText_Decorate, {.void_u8=SecretBasePC_Decorate} }, { - gUnknown_085EA7BA, {.void_u8=sub_8126CA4} + gText_PutAway, {.void_u8=SecretBasePC_PutAway} }, { - gUnknown_085EA7C3, {.void_u8=sub_8126D10} + gText_Toss2, {.void_u8=SecretBasePC_Toss} }, { - gText_Cancel, {.void_u8=sub_8126D6C} + gText_Cancel, {.void_u8=SecretBasePC_Cancel} } }; -const u8 *const gUnknown_085A6B68[] = { - gUnknown_085EA7CF, - gUnknown_085EA7F5, - gUnknown_085EA81C, +const u8 *const sSecretBasePCMenuItemDescriptions[] = { + gText_PutOutSelectedDecorItem, + gText_StoreChosenDecorInPC, + gText_ThrowAwayUnwantedDecors, gText_GoBackPrevMenu }; -void (*const gUnknown_085A6B78[][2])(u8 taskId) = { +void (*const SecretBasePC_SelectedDecorActions[][2])(u8 taskId) = { { sub_8127F68, sub_8127A8C }, { @@ -259,36 +259,36 @@ const union AnimCmd gUnknown_085A7278[] = { ANIMCMD_END }; -const union AnimCmd *const gUnknown_085A7280[] = { +const union AnimCmd *const sDecorSelectorAnims[] = { gUnknown_085A7278 }; -const struct SpriteFrameImage gUnknown_085A7284 = { - (const u8 *)&gUnknown_0203A190.image, 0x800 +const struct SpriteFrameImage sDecorSelectorSpriteFrameImages = { + (const u8 *)&sPlaceDecorationGraphicsDataBuffer.image, 0x800 }; -const struct SpriteTemplate gUnknown_085A728C = { +const struct SpriteTemplate sDecorSelectorSpriteTemplate = { 0xffff, - OVERWORLD_DECOR_PAL_TAG, - &gUnknown_0203AA3C, - gUnknown_085A7280, - &gUnknown_085A7284, + OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG, + &sDecorSelectorOam, + sDecorSelectorAnims, + &sDecorSelectorSpriteFrameImages, gDummySpriteAffineAnimTable, SpriteCallbackDummy }; -const struct SpriteTemplate gUnknown_085A72A4 = { +const struct SpriteTemplate sDecorWhilePlacingSpriteTemplate = { 0x0000, 0x0000, - &gUnknown_0203AA3C, - gUnknown_085A7280, + &sDecorSelectorOam, + sDecorSelectorAnims, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy }; const struct SpritePalette gUnknown_085A72BC = { - (const u16 *)&gUnknown_0203A190.palette, OVERWORLD_DECOR_PAL_TAG + (const u16 *)&sPlaceDecorationGraphicsDataBuffer.palette, OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG }; const struct YesNoFuncTable gUnknown_085A72C4 = { @@ -340,11 +340,11 @@ const struct YesNoFuncTable gUnknown_085A7350 = { const u8 Unknown_085A7358[] = INCBIN_U8("graphics/misc/decoration_unk_85a7358.4bpp"); const struct SpritePalette gUnknown_085A73D8 = { - Unknown_085A7308, OVERWORLD_DECOR_BOX_PAL_TAG + Unknown_085A7308, OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG }; const struct SpritePalette gUnknown_085A73E0 = { - Unknown_085A7328, OVERWORLD_DECOR_BOX_PAL_TAG + Unknown_085A7328, OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG }; const struct OamData Unknown_085A73E8 = { @@ -366,7 +366,7 @@ const struct SpriteFrameImage Unknown_085A73FC = { const struct SpriteTemplate gUnknown_085A7404 = { 0xFFFF, - OVERWORLD_DECOR_BOX_PAL_TAG, + OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG, &Unknown_085A73E8, Unknown_085A73F8, &Unknown_085A73FC, @@ -383,9 +383,9 @@ const struct YesNoFuncTable gUnknown_085A741C = { void sub_8126968(void) { - if (gUnknown_0203A173 < 8) + if (sCurDecorationCategory < 8) { - gUnknown_0203A14C = gDecorationInventories[gUnknown_0203A173].items; + gCurDecorInventoryItems = gDecorationInventories[sCurDecorationCategory].items; } if (gUnknown_0203A17C.isPlayerRoom == FALSE) { @@ -404,11 +404,11 @@ u8 sub_81269D4(u8 idx) u8 *winidx; struct WindowTemplate template; - winidx = &gUnknown_0203A188[idx]; + winidx = &sDecorMenuWindowIndices[idx]; if (idx == 0) { template = gUnknown_085A6B90[0]; - template.width = GetMaxWidthInMenuTable(gUnknown_085A6B48, 4); + template.width = GetMaxWidthInMenuTable(sSecretBasePCMenuActions, 4); if (template.width > 18) { template.width = 18; @@ -426,9 +426,9 @@ u8 sub_81269D4(u8 idx) void sub_8126A58(u8 idx) { - sub_8198070(gUnknown_0203A188[idx], FALSE); - ClearWindowTilemap(gUnknown_0203A188[idx]); - RemoveWindow(gUnknown_0203A188[idx]); + sub_8198070(sDecorMenuWindowIndices[idx], FALSE); + ClearWindowTilemap(sDecorMenuWindowIndices[idx]); + RemoveWindow(sDecorMenuWindowIndices[idx]); schedule_bg_copy_tilemap_to_vram(0); } @@ -437,13 +437,13 @@ void sub_8126A88(void) u8 idx; idx = sub_81269D4(0); - PrintMenuTable(idx, 4, gUnknown_085A6B48); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(idx, 4, gUnknown_0203A150); + PrintMenuTable(idx, 4, sSecretBasePCMenuActions); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(idx, 4, sSecretBasePCMenuCursorPos); } void sub_8126ABC(void) { - gUnknown_0203A150 = 0; + sSecretBasePCMenuCursorPos = 0; ScriptContext2_Enable(); sub_8126A88(); sub_8126C08(); @@ -480,18 +480,18 @@ void sub_8126B80(u8 taskId) { default: PlaySE(SE_SELECT); - gUnknown_085A6B48[gUnknown_0203A150].func.void_u8(taskId); + sSecretBasePCMenuActions[sSecretBasePCMenuCursorPos].func.void_u8(taskId); break; case -2: - gUnknown_0203A150 = GetMenuCursorPos(); - if ((s8)menuPos != gUnknown_0203A150) + sSecretBasePCMenuCursorPos = GetMenuCursorPos(); + if ((s8)menuPos != sSecretBasePCMenuCursorPos) { sub_8126C08(); } break; case -1: PlaySE(SE_SELECT); - sub_8126D6C(taskId); + SecretBasePC_Cancel(taskId); break; } } @@ -500,10 +500,10 @@ void sub_8126B80(u8 taskId) void sub_8126C08(void) { FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParametrized(0, 1, gUnknown_085A6B68[gUnknown_0203A150], 0, 0, 2, 1, 3); + AddTextPrinterParametrized(0, 1, sSecretBasePCMenuItemDescriptions[sSecretBasePCMenuCursorPos], 0, 0, 2, 1, 3); } -void sub_8126C48(u8 taskId) +void SecretBasePC_Decorate(u8 taskId) { if (CountDecorations() == 0) { @@ -513,12 +513,12 @@ void sub_8126C48(u8 taskId) else { gTasks[taskId].data[11] = 0; - gUnknown_0203A173 = DECORCAT_DESK; - sub_8126DCC(taskId); + sCurDecorationCategory = DECORCAT_DESK; + SecretBasePC_PrepMenuForSelectingStoredDecors(taskId); } } -void sub_8126CA4(u8 taskId) +void SecretBasePC_PutAway(u8 taskId) { if (!sub_81299AC(taskId)) { @@ -535,7 +535,7 @@ void sub_8126CA4(u8 taskId) } } -void sub_8126D10(u8 taskId) +void SecretBasePC_Toss(u8 taskId) { if (CountDecorations() == 0) { @@ -545,12 +545,12 @@ void sub_8126D10(u8 taskId) else { gTasks[taskId].data[11] = 1; - gUnknown_0203A173 = DECORCAT_DESK; - sub_8126DCC(taskId); + sCurDecorationCategory = DECORCAT_DESK; + SecretBasePC_PrepMenuForSelectingStoredDecors(taskId); } } -void sub_8126D6C(u8 taskId) +void SecretBasePC_Cancel(u8 taskId) { sub_8126A58(0); if (!gUnknown_0203A17C.isPlayerRoom) @@ -570,7 +570,7 @@ void sub_8126DA4(u8 taskId) gTasks[taskId].func = sub_8126B80; } -void sub_8126DCC(u8 taskId) +void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId) { LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20); sub_8197434(0, 0); @@ -584,15 +584,15 @@ void sub_8126DFC(u8 taskId) winIdx = sub_81269D4(1); sub_8126E8C(taskId); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(winIdx, 9, gUnknown_0203A173); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(winIdx, 9, sCurDecorationCategory); gTasks[taskId].func = sub_8127088; } void sub_8126E44(u8 taskId) { - FillWindowPixelBuffer(gUnknown_0203A188[1], 0x11); + FillWindowPixelBuffer(sDecorMenuWindowIndices[1], 0x11); sub_8126E8C(taskId); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_0203A188[1], 9, gUnknown_0203A173); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDecorMenuWindowIndices[1], 9, sCurDecorationCategory); gTasks[taskId].func = sub_8127088; } @@ -605,7 +605,7 @@ void sub_8126E8C(u8 taskId) bool8 fl; data = gTasks[taskId].data; - r5 = gUnknown_0203A188[1]; + r5 = sDecorMenuWindowIndices[1]; fl = gUnknown_0203A17C.isPlayerRoom; r8 = FALSE; if (fl == TRUE && data[11] == 0) @@ -636,7 +636,7 @@ void sub_8126F68(u8 winid, u8 decorCat, u8 x, u8 y, bool8 flag, u8 speed) y ++; sub_8127058(gStringVar4, flag); strbuf = StringLength(gStringVar4) + gStringVar4; - StringCopy(strbuf, gUnknown_085A6B28[decorCat]); + StringCopy(strbuf, sDecorCatNames[decorCat]); PrintTextOnWindow(winid, 1, gStringVar4, x, y, speed, NULL); strbuf = ConvertIntToDecimalStringN(strbuf, CountDecorationCategoryN(decorCat), STR_CONV_MODE_RIGHT_ALIGN, 2); *strbuf++ = CHAR_SLASH; @@ -678,7 +678,7 @@ void sub_8127088(u8 taskId) break; default: PlaySE(SE_SELECT); - gUnknown_0203A173 = input; + sCurDecorationCategory = input; sub_81270E8(taskId); break; } @@ -687,14 +687,14 @@ void sub_8127088(u8 taskId) void sub_81270E8(u8 taskId) { - gUnknown_0203A151 = CountDecorationCategoryN(gUnknown_0203A173); - if (gUnknown_0203A151 != 0) + sCurDecorCatCount = CountDecorationCategoryN(sCurDecorationCategory); + if (sCurDecorCatCount != 0) { - CondenseDecorationCategoryN(gUnknown_0203A173); - gUnknown_0203A14C = gDecorationInventories[gUnknown_0203A173].items; - sub_81279B4(taskId); - gUnknown_0203A170 = 0; - gUnknown_0203A16E = 0; + CondenseDecorationCategoryN(sCurDecorationCategory); + gCurDecorInventoryItems = gDecorationInventories[sCurDecorationCategory].items; + IdentifyOwnedDecorationsCurrentlyInUse(taskId); + sSecretBasePCSelectDecorPageNo = 0; + sSecretBasePCSelectDecorLineNo = 0; gTasks[taskId].func = sub_8127620; } else @@ -737,13 +737,13 @@ void sub_8127208(u8 taskId) LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20); sub_8197434(0, 0); gTasks[taskId].data[11] = 2; - gUnknown_0203A173 = DECORCAT_DESK; + sCurDecorationCategory = DECORCAT_DESK; sub_8126DFC(taskId); } void sub_8127250(u8 *dest, u8 decorCat) { - StringCopy(dest, gUnknown_085A6B28[decorCat]); + StringCopy(dest, sDecorCatNames[decorCat]); } void sub_8127268(u8 taskId) @@ -754,25 +754,25 @@ void sub_8127268(u8 taskId) void sub_8127284(void) { - gUnknown_0203A18C->unk_520 = gUnknown_0203A151 + 1; - if (gUnknown_0203A18C->unk_520 > 8) + sDecorPCBuffer->unk_520 = sCurDecorCatCount + 1; + if (sDecorPCBuffer->unk_520 > 8) { - gUnknown_0203A18C->unk_521 = 8; + sDecorPCBuffer->unk_521 = 8; } else { - gUnknown_0203A18C->unk_521 = gUnknown_0203A18C->unk_520; + sDecorPCBuffer->unk_521 = sDecorPCBuffer->unk_520; } } void sub_81272C8(void) { - sub_812225C(&gUnknown_0203A170, &gUnknown_0203A16E, gUnknown_0203A18C->unk_521, gUnknown_0203A18C->unk_520); + sub_812225C(&sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo, sDecorPCBuffer->unk_521, sDecorPCBuffer->unk_520); } void sub_81272F8(void) { - sub_8122298(&gUnknown_0203A170, &gUnknown_0203A16E, gUnknown_0203A18C->unk_521, gUnknown_0203A18C->unk_520, 8); + sub_8122298(&sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo, sDecorPCBuffer->unk_521, sDecorPCBuffer->unk_520, 8); } void sub_8127330(u8 taskId) @@ -781,7 +781,7 @@ void sub_8127330(u8 taskId) u16 i; data = gTasks[taskId].data; - if ((gUnknown_0203A173 < DECORCAT_DOLL || gUnknown_0203A173 > DECORCAT_CUSHION) && gUnknown_0203A17C.isPlayerRoom == TRUE && data[11] == 0) + if ((sCurDecorationCategory < DECORCAT_DOLL || sCurDecorationCategory > DECORCAT_CUSHION) && gUnknown_0203A17C.isPlayerRoom == TRUE && data[11] == 0) { sub_8127058(gStringVar1, TRUE); } @@ -789,20 +789,20 @@ void sub_8127330(u8 taskId) { sub_8127058(gStringVar1, FALSE); } - for (i = 0; i < gUnknown_0203A18C->unk_520 - 1; i ++) + for (i = 0; i < sDecorPCBuffer->unk_520 - 1; i ++) { - sub_8127454(gUnknown_0203A18C->unk_148[i], gUnknown_0203A14C[i]); - gUnknown_0203A18C->unk_000[i].unk_00 = gUnknown_0203A18C->unk_148[i]; - gUnknown_0203A18C->unk_000[i].unk_04 = i; + sub_8127454(sDecorPCBuffer->names[i], gCurDecorInventoryItems[i]); + sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; + sDecorPCBuffer->items[i].unk_04 = i; } - StringCopy(gUnknown_0203A18C->unk_148[i], gText_Cancel); - gUnknown_0203A18C->unk_000[i].unk_00 = gUnknown_0203A18C->unk_148[i]; - gUnknown_0203A18C->unk_000[i].unk_04 = -2; + StringCopy(sDecorPCBuffer->names[i], gText_Cancel); + sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; + sDecorPCBuffer->items[i].unk_04 = -2; gUnknown_03006310 = gUnknown_085A6BD0; - gUnknown_03006310.unk_10 = gUnknown_0203A188[1]; - gUnknown_03006310.unk_0c = gUnknown_0203A18C->unk_520; - gUnknown_03006310.unk_00 = gUnknown_0203A18C->unk_000; - gUnknown_03006310.unk_0e = gUnknown_0203A18C->unk_521; + gUnknown_03006310.unk_10 = sDecorMenuWindowIndices[1]; + gUnknown_03006310.unk_0c = sDecorPCBuffer->unk_520; + gUnknown_03006310.unk_00 = sDecorPCBuffer->items; + gUnknown_03006310.unk_0e = sDecorPCBuffer->unk_521; } void sub_8127454(u8 *dest, u16 decorId) @@ -837,18 +837,18 @@ void sub_81274A0(u8 a0, s32 a1, u8 a2) void sub_8127500(void) { - if (gUnknown_0203A18C->unk_522 == 0xFF) + if (sDecorPCBuffer->unk_522 == 0xFF) { - gUnknown_0203A18C->unk_522 = AddScrollIndicatorArrowPairParametrized(0x02, 0x3c, 0x0c, 0x94, gUnknown_0203A18C->unk_520 - gUnknown_0203A18C->unk_521, 0x6e, 0x6e, &gUnknown_0203A170); + sDecorPCBuffer->unk_522 = AddScrollIndicatorArrowPairParametrized(0x02, 0x3c, 0x0c, 0x94, sDecorPCBuffer->unk_520 - sDecorPCBuffer->unk_521, 0x6e, 0x6e, &sSecretBasePCSelectDecorPageNo); } } void sub_8127554(void) { - if (gUnknown_0203A18C->unk_522 != 0xFF) + if (sDecorPCBuffer->unk_522 != 0xFF) { - RemoveScrollIndicatorArrowPair(gUnknown_0203A18C->unk_522); - gUnknown_0203A18C->unk_522 = 0xFF; + RemoveScrollIndicatorArrowPair(sDecorPCBuffer->unk_522); + sDecorPCBuffer->unk_522 = 0xFF; } } @@ -864,14 +864,14 @@ void sub_812759C(u8 taskId) data = gTasks[taskId].data; sub_81269D4(3); - sub_8127718(gUnknown_0203A173); - gUnknown_0203A18C = calloc(1, sizeof(struct UnkStruct_0203A18C)); - gUnknown_0203A18C->unk_522 = 0xFF; + sub_8127718(sCurDecorationCategory); + sDecorPCBuffer = calloc(1, sizeof(struct DecorPCBuffer)); + sDecorPCBuffer->unk_522 = 0xFF; sub_8127284(); sub_81272C8(); sub_81272F8(); sub_8127330(taskId); - data[13] = ListMenuInit(&gUnknown_03006310, gUnknown_0203A170, gUnknown_0203A16E); + data[13] = ListMenuInit(&gUnknown_03006310, sSecretBasePCSelectDecorPageNo, sSecretBasePCSelectDecorLineNo); sub_8127500(); } @@ -890,24 +890,24 @@ void sub_812764C(u8 taskId) if (!gPaletteFade.active) { input = ListMenuHandleInput(data[13]); - get_coro_args_x18_x1A(data[13], &gUnknown_0203A170, &gUnknown_0203A16E); + get_coro_args_x18_x1A(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); switch (input) { case -1: break; case -2: PlaySE(SE_SELECT); - gUnknown_085A6B78[data[11]][1](taskId); + SecretBasePC_SelectedDecorActions[data[11]][1](taskId); break; default: PlaySE(SE_SELECT); - gUnknown_0203A172 = input; + gCurDecorationIndex = input; sub_8127554(); - sub_81AE6C8(data[13], &gUnknown_0203A170, &gUnknown_0203A16E); + sub_81AE6C8(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); sub_8126A58(1); sub_81277A8(); - free(gUnknown_0203A18C); - gUnknown_085A6B78[data[11]][0](taskId); + free(sDecorPCBuffer); + SecretBasePC_SelectedDecorActions[data[11]][0](taskId); break; } } @@ -923,15 +923,15 @@ void sub_8127744(u32 a0) u8 winidx; const u8 *txt; - winidx = gUnknown_0203A188[3]; + winidx = sDecorMenuWindowIndices[3]; FillWindowPixelBuffer(winidx, 0x11); - if (a0 >= gUnknown_0203A151) + if (a0 >= sCurDecorCatCount) { txt = gText_GoBackPrevMenu; } else { - txt = gDecorations[gUnknown_0203A14C[a0]].description; + txt = gDecorations[gCurDecorInventoryItems[a0]].description; } PrintTextOnWindow(winidx, 1, txt, 0, 1, 0, 0); } @@ -948,7 +948,7 @@ bool8 sub_81277BC(u8 idx) for (i = 0; i < 16; i ++) { - if (gUnknown_0203A152[i] == idx) + if (sSecretBaseItemsIndicesBuffer[i] == idx) { return TRUE; } @@ -962,7 +962,7 @@ bool8 sub_81277E8(u8 idx) for (i = 0; i < 12; i ++) { - if (gUnknown_0203A162[i] == idx) + if (sPlayerRoomItemsIndicesBuffer[i] == idx) { return TRUE; } @@ -970,7 +970,7 @@ bool8 sub_81277E8(u8 idx) return FALSE; } -void sub_8127814(u8 taskId) +void IdentifyOwnedDecorationsCurrentlyInUseInternal(u8 taskId) { u16 i; u16 j; @@ -978,20 +978,20 @@ void sub_8127814(u8 taskId) u16 cnt; cnt = 0; - memset(gUnknown_0203A152, 0, 16); - memset(gUnknown_0203A162, 0, 12); + memset(sSecretBaseItemsIndicesBuffer, 0, 16); + memset(sPlayerRoomItemsIndicesBuffer, 0, 12); for (i = 0; i < 16; i ++) { if (gSaveBlock1Ptr->secretBases[0].decorations[i] != DECOR_NONE) { - for (j = 0; j < gDecorationInventories[gUnknown_0203A173].size; j ++) + for (j = 0; j < gDecorationInventories[sCurDecorationCategory].size; j ++) { - if (gUnknown_0203A14C[j] == gSaveBlock1Ptr->secretBases[0].decorations[i]) + if (gCurDecorInventoryItems[j] == gSaveBlock1Ptr->secretBases[0].decorations[i]) { - for (k = 0; k < cnt && gUnknown_0203A152[k] != j + 1; k ++); + for (k = 0; k < cnt && sSecretBaseItemsIndicesBuffer[k] != j + 1; k ++); if (k == cnt) { - gUnknown_0203A152[cnt] = j + 1; + sSecretBaseItemsIndicesBuffer[cnt] = j + 1; cnt ++; break; } @@ -1004,14 +1004,14 @@ void sub_8127814(u8 taskId) { if (gSaveBlock1Ptr->playerRoomDecor[i] != DECOR_NONE) { - for (j = 0; j < gDecorationInventories[gUnknown_0203A173].size; j ++) + for (j = 0; j < gDecorationInventories[sCurDecorationCategory].size; j ++) { - if (gUnknown_0203A14C[j] == gSaveBlock1Ptr->playerRoomDecor[i] && sub_81277BC(j + 1) != TRUE) + if (gCurDecorInventoryItems[j] == gSaveBlock1Ptr->playerRoomDecor[i] && sub_81277BC(j + 1) != TRUE) { - for (k = 0; k < cnt && gUnknown_0203A162[k] != j + 1; k ++); + for (k = 0; k < cnt && sPlayerRoomItemsIndicesBuffer[k] != j + 1; k ++); if (k == cnt) { - gUnknown_0203A162[cnt] = j + 1; + sPlayerRoomItemsIndicesBuffer[cnt] = j + 1; cnt ++; break; } @@ -1021,21 +1021,21 @@ void sub_8127814(u8 taskId) } } -void sub_81279B4(u8 taskId) +void IdentifyOwnedDecorationsCurrentlyInUse(u8 taskId) { - sub_8127814(taskId); + IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); } -bool8 sub_81279C4(void) +bool8 IsSelectedDecorInThePC(void) { u16 i; for (i = 0; i < 16; i ++) { - if (gUnknown_0203A152[i] == gUnknown_0203A170 + gUnknown_0203A16E + 1) + if (sSecretBaseItemsIndicesBuffer[i] == sSecretBasePCSelectDecorPageNo + sSecretBasePCSelectDecorLineNo + 1) { return FALSE; } - if (i < 12 && gUnknown_0203A162[i] == gUnknown_0203A170 + gUnknown_0203A16E + 1) + if (i < 12 && sPlayerRoomItemsIndicesBuffer[i] == sSecretBasePCSelectDecorPageNo + sSecretBasePCSelectDecorLineNo + 1) { return FALSE; } @@ -1073,7 +1073,7 @@ void sub_8127A8C(u8 taskId) sub_8127554(); sub_81277A8(); sub_81AE6C8(data[13], NULL, NULL); - free(gUnknown_0203A18C); + free(sDecorPCBuffer); sub_8126E44(taskId); } @@ -1210,10 +1210,10 @@ void sub_8127E18(void) break; } } - VarSet(0x3F20 + gMapHeader.events->mapObjects[j].graphicsId, gUnknown_0203A190.decoration->tiles[0]); + VarSet(0x3F20 + gMapHeader.events->mapObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]); gSpecialVar_0x8005 = gMapHeader.events->mapObjects[j].localId; - gSpecialVar_0x8006 = gUnknown_0203AA34; - gSpecialVar_0x8007 = gUnknown_0203AA36; + gSpecialVar_0x8006 = sCurDecorMapX; + gSpecialVar_0x8007 = sCurDecorMapY; show_sprite(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); sub_808EBA8(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); sub_808F254(gSpecialVar_0x8005, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); @@ -1238,12 +1238,12 @@ bool8 sub_8127F38(void) void sub_8127F68(u8 taskId) { - if (gUnknown_0203A17C.isPlayerRoom == TRUE && gUnknown_0203A173 != DECORCAT_DOLL && gUnknown_0203A173 != DECORCAT_CUSHION) + if (gUnknown_0203A17C.isPlayerRoom == TRUE && sCurDecorationCategory != DECORCAT_DOLL && sCurDecorationCategory != DECORCAT_CUSHION) { StringExpandPlaceholders(gStringVar4, gText_CantPlaceInRoom); DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); } - else if (sub_81279C4() == TRUE) + else if (IsSelectedDecorInThePC() == TRUE) { if (sub_8127F38() == TRUE) { @@ -1284,9 +1284,9 @@ void sub_8128060(u8 taskId) break; case 1: gPaletteFade.bufferTransferDisabled = TRUE; - ConfigureCameraObjectForPlacingDecoration(&gUnknown_0203A190, gUnknown_0203A14C[gUnknown_0203A172]); + ConfigureCameraObjectForPlacingDecoration(&sPlaceDecorationGraphicsDataBuffer, gCurDecorInventoryItems[gCurDecorationIndex]); sub_812826C(taskId); - SetUpPlacingDecorationPlayerAvatar(taskId, &gUnknown_0203A190); + SetUpPlacingDecorationPlayerAvatar(taskId, &sPlaceDecorationGraphicsDataBuffer); pal_fill_black(); gPaletteFade.bufferTransferDisabled = FALSE; gTasks[taskId].data[2] = 2; @@ -1301,9 +1301,9 @@ void sub_8128060(u8 taskId) } } -void ConfigureCameraObjectForPlacingDecoration(struct UnkStruct_0203A190 *data, u8 decor) +void ConfigureCameraObjectForPlacingDecoration(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor) { - gUnknown_0203AA38 = gSprites[gUnknown_03005DD0.unk4].data0; + sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data0; gUnknown_03005DD0.unk4 = gpu_pal_decompress_alloc_tag_and_upload(data, decor); gSprites[gUnknown_03005DD0.unk4].oam.priority = 1; gSprites[gUnknown_03005DD0.unk4].callback = sub_81292D0; @@ -1311,7 +1311,7 @@ void ConfigureCameraObjectForPlacingDecoration(struct UnkStruct_0203A190 *data, gSprites[gUnknown_03005DD0.unk4].pos1.y = gUnknown_085A7250[data->decoration->shape].y; } -void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct UnkStruct_0203A190 *data) +void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphicsDataBuffer *data) { u8 v0; @@ -1322,20 +1322,20 @@ void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct UnkStruct_0203A190 *da } if (gSaveBlock2Ptr->playerGender == MALE) { - gUnknown_0203AA39 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, v0, 0x48, 0); + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, v0, 0x48, 0); } else { - gUnknown_0203AA39 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, v0, 0x48, 0); + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, v0, 0x48, 0); } - gSprites[gUnknown_0203AA39].oam.priority = 1; - DestroySprite(&gSprites[gUnknown_0203AA38]); - gUnknown_0203AA38 = gUnknown_03005DD0.unk4; + gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1; + DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]); + sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4; } void sub_812826C(u8 taskId) { - switch (gDecorations[gUnknown_0203A14C[gUnknown_0203A172]].shape) + switch (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].shape) { case DECORSHAPE_1x1: gTasks[taskId].data[5] = 1; @@ -1384,8 +1384,8 @@ void sub_812826C(u8 taskId) void sub_81283BC(u8 taskId) { gTasks[taskId].data[10] = 0; - gSprites[gUnknown_0203AA38].data7 = 1; - gSprites[gUnknown_0203AA39].data7 = 1; + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 1; + gSprites[sDecor_CameraSpriteObjectIdx2].data7 = 1; sub_8128DE0(); sub_8128950(taskId); } @@ -1393,8 +1393,8 @@ void sub_81283BC(u8 taskId) void sub_8128414(u8 taskId) { gTasks[taskId].data[10] = 0; - gSprites[gUnknown_0203AA38].data7 = 1; - gSprites[gUnknown_0203AA39].data7 = 1; + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 1; + gSprites[sDecor_CameraSpriteObjectIdx2].data7 = 1; sub_8128DE0(); StringExpandPlaceholders(gStringVar4, gText_CancelDecorating); DisplayItemMessageOnField(taskId, gStringVar4, sub_8128B80); @@ -1569,7 +1569,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) void sub_8128950(u8 taskId) { - if (sub_812853C(taskId, &gDecorations[gUnknown_0203A14C[gUnknown_0203A172]]) == TRUE) + if (sub_812853C(taskId, &gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]]) == TRUE) { StringExpandPlaceholders(gStringVar4, gText_PlaceItHere); DisplayItemMessageOnField(taskId, gStringVar4, sub_81289D0); @@ -1592,17 +1592,17 @@ void sub_81289F0(u8 taskId) { sub_8197434(0, 0); sub_8128AAC(taskId); - if (gDecorations[gUnknown_0203A14C[gUnknown_0203A172]].permission != DECORPERM_SOLID_MAT) + if (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].permission != DECORPERM_SOLID_MAT) { - sub_8127D38(gTasks[taskId].data[0], gTasks[taskId].data[1], gUnknown_0203A14C[gUnknown_0203A172]); + sub_8127D38(gTasks[taskId].data[0], gTasks[taskId].data[1], gCurDecorInventoryItems[gCurDecorationIndex]); } else { - gUnknown_0203AA34 = gTasks[taskId].data[0] - 7; - gUnknown_0203AA36 = gTasks[taskId].data[1] - 7; + sCurDecorMapX = gTasks[taskId].data[0] - 7; + sCurDecorMapY = gTasks[taskId].data[1] - 7; ScriptContext1_SetupScript(gUnknown_08275D1F); } - gSprites[gUnknown_0203AA38].pos1.y += 2; + gSprites[sDecor_CameraSpriteObjectIdx1].pos1.y += 2; if (gMapHeader.regionMapSectionId == REGION_MAP_SECRET_BASE) { TV_PutSecretBaseVisitOnTheAir(); @@ -1618,7 +1618,7 @@ void sub_8128AAC(u8 taskId) { if (gUnknown_0203A17C.items[i] == DECOR_NONE) { - gUnknown_0203A17C.items[i] = gUnknown_0203A14C[gUnknown_0203A172]; + gUnknown_0203A17C.items[i] = gCurDecorInventoryItems[gCurDecorationIndex]; gUnknown_0203A17C.pos[i] = ((gTasks[taskId].data[0] - 7) << 4) + (gTasks[taskId].data[1] - 7); break; } @@ -1627,9 +1627,9 @@ void sub_8128AAC(u8 taskId) { for (i = 0; i < 16; i ++) { - if (gUnknown_0203A152[i] == 0) + if (sSecretBaseItemsIndicesBuffer[i] == 0) { - gUnknown_0203A152[i] = gUnknown_0203A172 + 1; + sSecretBaseItemsIndicesBuffer[i] = gCurDecorationIndex + 1; break; } } @@ -1638,9 +1638,9 @@ void sub_8128AAC(u8 taskId) { for (i = 0; i < 12; i ++) { - if (gUnknown_0203A162[i] == 0) + if (sPlayerRoomItemsIndicesBuffer[i] == 0) { - gUnknown_0203A162[i] = gUnknown_0203A172 + 1; + sPlayerRoomItemsIndicesBuffer[i] = gCurDecorationIndex + 1; break; } } @@ -1680,7 +1680,7 @@ void c1_overworld_prev_quest(u8 taskId) break; case 1: sub_812A3C8(); - FreeSpritePaletteByTag(OVERWORLD_DECOR_PAL_TAG); + FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG); gFieldCallback = sub_8128CD4; SetMainCallback2(c2_exit_to_overworld_2_switch); DestroyTask(taskId); @@ -1732,22 +1732,22 @@ bool8 sub_8128D10(u8 taskId) s16 *data; data = gTasks[taskId].data; - if (gUnknown_0203AA3A == DIR_SOUTH && data[1] - data[6] - 6 < 0) + if (sDecorationLastDirectionMoved == DIR_SOUTH && data[1] - data[6] - 6 < 0) { data[1] ++; return FALSE; } - if (gUnknown_0203AA3A == DIR_NORTH && data[1] - 7 >= gMapHeader.mapData->height) + if (sDecorationLastDirectionMoved == DIR_NORTH && data[1] - 7 >= gMapHeader.mapData->height) { data[1] --; return FALSE; } - if (gUnknown_0203AA3A == DIR_WEST && data[0] - 7 < 0) + if (sDecorationLastDirectionMoved == DIR_WEST && data[0] - 7 < 0) { data[0] ++; return FALSE; } - if (gUnknown_0203AA3A == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapData->width) + if (sDecorationLastDirectionMoved == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapData->width) { data[0] --; return FALSE; @@ -1769,9 +1769,9 @@ bool8 sub_8128DB4(void) void sub_8128DE0(void) { - gUnknown_0203AA3A = 0; - gSprites[gUnknown_0203AA38].data2 = 0; - gSprites[gUnknown_0203AA38].data3 = 0; + sDecorationLastDirectionMoved = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; } void sub_8128E18(u8 taskId) @@ -1779,7 +1779,7 @@ void sub_8128E18(u8 taskId) s16 *data; data = gTasks[taskId].data; - if (!gSprites[gUnknown_0203AA38].data4) + if (!gSprites[sDecor_CameraSpriteObjectIdx1].data4) { if (data[10] == 1) { @@ -1792,30 +1792,30 @@ void sub_8128E18(u8 taskId) } if ((gMain.heldKeys & 0x0F0) == DPAD_UP) { - gUnknown_0203AA3A = DIR_SOUTH; - gSprites[gUnknown_0203AA38].data2 = 0; - gSprites[gUnknown_0203AA38].data3 = -2; + sDecorationLastDirectionMoved = DIR_SOUTH; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = -2; data[1]--; } if ((gMain.heldKeys & 0x0F0) == DPAD_DOWN) { - gUnknown_0203AA3A = DIR_NORTH; - gSprites[gUnknown_0203AA38].data2 = 0; - gSprites[gUnknown_0203AA38].data3 = 2; + sDecorationLastDirectionMoved = DIR_NORTH; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 2; data[1]++; } if ((gMain.heldKeys & 0x0F0) == DPAD_LEFT) { - gUnknown_0203AA3A = DIR_WEST; - gSprites[gUnknown_0203AA38].data2 = -2; - gSprites[gUnknown_0203AA38].data3 = 0; + sDecorationLastDirectionMoved = DIR_WEST; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = -2; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; data[0]--; } if ((gMain.heldKeys & 0x0F0) == DPAD_RIGHT) { - gUnknown_0203AA3A = DIR_EAST; - gSprites[gUnknown_0203AA38].data2 = 2; - gSprites[gUnknown_0203AA38].data3 = 0; + sDecorationLastDirectionMoved = DIR_EAST; + gSprites[sDecor_CameraSpriteObjectIdx1].data2 = 2; + gSprites[sDecor_CameraSpriteObjectIdx1].data3 = 0; data[0]++; } if (!sub_8128DB4() || !sub_8128D10(taskId)) @@ -1823,10 +1823,10 @@ void sub_8128E18(u8 taskId) sub_8128DE0(); } } - if (gUnknown_0203AA3A) + if (sDecorationLastDirectionMoved) { - gSprites[gUnknown_0203AA38].data4++; - gSprites[gUnknown_0203AA38].data4 &= 7; + gSprites[sDecor_CameraSpriteObjectIdx1].data4++; + gSprites[sDecor_CameraSpriteObjectIdx1].data4 &= 7; } if (!data[10]) { @@ -1844,7 +1844,7 @@ void sub_8128E18(u8 taskId) void sub_8128FD8(u8 taskId) { sub_8197434(0, 1); - gSprites[gUnknown_0203AA38].data7 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 0; gTasks[taskId].data[10] = 0; gTasks[taskId].func = sub_8128E18; } @@ -1857,7 +1857,7 @@ void sub_8129020(u8 taskId) } } -void sub_8129048(struct UnkStruct_0203A190 *data) +void sub_8129048(struct PlaceDecorationGraphicsDataBuffer *data) { CpuFill16(0, data, sizeof(*data)); } @@ -1911,7 +1911,7 @@ void sub_8129088(u8 *dest, u16 tile) } } -void sub_81291A4(struct UnkStruct_0203A190 *data) +void sub_81291A4(struct PlaceDecorationGraphicsDataBuffer *data) { u16 i; for (i = 0; i < 64; i ++) @@ -1925,7 +1925,7 @@ u16 sub_81291CC(u16 tile) return ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[tile] & 0xFFF; } -void sub_81291E8(struct UnkStruct_0203A190 *data) +void sub_81291E8(struct PlaceDecorationGraphicsDataBuffer *data) { u8 i; u8 shape; @@ -1937,20 +1937,20 @@ void sub_81291E8(struct UnkStruct_0203A190 *data) } } -void sub_812925C(u8 decoShape) +void SetDecorSelectionBoxOamAttributes(u8 decorShape) { - gUnknown_0203AA3C.y = 0; - gUnknown_0203AA3C.affineMode = ST_OAM_AFFINE_OFF; - gUnknown_0203AA3C.objMode = ST_OAM_OBJ_NORMAL; - gUnknown_0203AA3C.mosaic = 0; - gUnknown_0203AA3C.bpp = ST_OAM_4BPP; - gUnknown_0203AA3C.shape = gUnknown_085A7250[decoShape].shape; - gUnknown_0203AA3C.x = 0; - gUnknown_0203AA3C.matrixNum = 0; - gUnknown_0203AA3C.size = gUnknown_085A7250[decoShape].size; - gUnknown_0203AA3C.tileNum = 0; - gUnknown_0203AA3C.priority = 0; - gUnknown_0203AA3C.paletteNum = 0; + sDecorSelectorOam.y = 0; + sDecorSelectorOam.affineMode = ST_OAM_AFFINE_OFF; + sDecorSelectorOam.objMode = ST_OAM_OBJ_NORMAL; + sDecorSelectorOam.mosaic = 0; + sDecorSelectorOam.bpp = ST_OAM_4BPP; + sDecorSelectorOam.shape = gUnknown_085A7250[decorShape].shape; + sDecorSelectorOam.x = 0; + sDecorSelectorOam.matrixNum = 0; + sDecorSelectorOam.size = gUnknown_085A7250[decorShape].size; + sDecorSelectorOam.tileNum = 0; + sDecorSelectorOam.priority = 0; + sDecorSelectorOam.paletteNum = 0; } void sub_81292D0(struct Sprite *sprite) @@ -1985,7 +1985,7 @@ void sub_81292E8(struct Sprite *sprite) } } -u8 gpu_pal_decompress_alloc_tag_and_upload(struct UnkStruct_0203A190 *data, u8 decor) +u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor) { sub_8129048(data); data->decoration = &gDecorations[decor]; @@ -1993,13 +1993,13 @@ u8 gpu_pal_decompress_alloc_tag_and_upload(struct UnkStruct_0203A190 *data, u8 d { return AddPseudoFieldObject(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); } - FreeSpritePaletteByTag(OVERWORLD_DECOR_PAL_TAG); + FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG); sub_81291E8(data); - sub_812925C(data->decoration->shape); + SetDecorSelectionBoxOamAttributes(data->decoration->shape); sub_81291A4(data); sub_8129068(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * 8) + 7] >> 12); LoadSpritePalette(&gUnknown_085A72BC); - return CreateSprite(&gUnknown_085A728C, 0, 0, 0); + return CreateSprite(&sDecorSelectorSpriteTemplate, 0, 0, 0); } u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8 decor) @@ -2048,23 +2048,23 @@ u8 AddDecorationIconObjectFromFieldObject(u16 tilesTag, u16 paletteTag, u8 decor struct SpritePalette palette; struct SpriteTemplate *template; - sub_8129048(&gUnknown_0203A190); - gUnknown_0203A190.decoration = &gDecorations[decor]; - if (gUnknown_0203A190.decoration->permission != DECORPERM_SOLID_MAT) + sub_8129048(&sPlaceDecorationGraphicsDataBuffer); + sPlaceDecorationGraphicsDataBuffer.decoration = &gDecorations[decor]; + if (sPlaceDecorationGraphicsDataBuffer.decoration->permission != DECORPERM_SOLID_MAT) { - sub_81291E8(&gUnknown_0203A190); - sub_812925C(gUnknown_0203A190.decoration->shape); - sub_81291A4(&gUnknown_0203A190); - sub_8129068(gUnknown_0203A190.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(gUnknown_0203A190.decoration->tiles[0] * 8) + 7] >> 12); - sheet.data = gUnknown_0203A190.image; - sheet.size = gUnknown_085A72F4[gUnknown_0203A190.decoration->shape] << 5; + sub_81291E8(&sPlaceDecorationGraphicsDataBuffer); + SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape); + sub_81291A4(&sPlaceDecorationGraphicsDataBuffer); + sub_8129068(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * 8) + 7] >> 12); + sheet.data = sPlaceDecorationGraphicsDataBuffer.image; + sheet.size = gUnknown_085A72F4[sPlaceDecorationGraphicsDataBuffer.decoration->shape] << 5; sheet.tag = tilesTag; LoadSpriteSheet(&sheet); - palette.data = gUnknown_0203A190.palette; + palette.data = sPlaceDecorationGraphicsDataBuffer.palette; palette.tag = paletteTag; LoadSpritePalette(&palette); template = Alloc(sizeof(struct SpriteTemplate)); - *template = gUnknown_085A72A4; + *template = sDecorWhilePlacingSpriteTemplate; template->tileTag = tilesTag; template->paletteTag = paletteTag; spriteId = CreateSprite(template, 0, 0, 0); @@ -2072,7 +2072,7 @@ u8 AddDecorationIconObjectFromFieldObject(u16 tilesTag, u16 paletteTag, u8 decor } else { - spriteId = AddPseudoFieldObject(gUnknown_0203A190.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); + spriteId = AddPseudoFieldObject(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); } return spriteId; } @@ -2134,14 +2134,14 @@ void sub_8129708(void) gSpecialVar_0x8005 = 0; gScriptResult = 0; - if (gSpecialVar_0x8004 == gUnknown_0203AAC4) + if (gSpecialVar_0x8004 == sCurDecorSelectedInRearrangement) { gScriptResult = 1; } - else if (gDecorations[gUnknown_0203A17C.items[gUnknown_0203AA44[gSpecialVar_0x8004].idx]].permission == DECORPERM_SOLID_MAT) + else if (gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx]].permission == DECORPERM_SOLID_MAT) { - gSpecialVar_0x8005 = gUnknown_0203AA44[gSpecialVar_0x8004].flagId; - sub_81296EC(gUnknown_0203AA44[gSpecialVar_0x8004].idx); + gSpecialVar_0x8005 = sDecorRearrangementDataBuffer[gSpecialVar_0x8004].flagId; + sub_81296EC(sDecorRearrangementDataBuffer[gSpecialVar_0x8004].idx); for (i = 0; i < gMapHeader.events->mapObjectCount; i ++) { if (gMapHeader.events->mapObjects[i].flagId == gSpecialVar_0x8005) @@ -2176,21 +2176,21 @@ void sub_81297F8(void) int posY; u8 perm; - for (i = 0; i < gUnknown_0203AAC4; i ++) + for (i = 0; i < sCurDecorSelectedInRearrangement; i ++) { - perm = gDecorations[gUnknown_0203A17C.items[gUnknown_0203AA44[i].idx]].permission; - posX = gUnknown_0203A17C.pos[gUnknown_0203AA44[i].idx] >> 4; - posY = gUnknown_0203A17C.pos[gUnknown_0203AA44[i].idx] & 0x0F; + perm = gDecorations[gUnknown_0203A17C.items[sDecorRearrangementDataBuffer[i].idx]].permission; + posX = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] >> 4; + posY = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[i].idx] & 0x0F; if (perm != DECORPERM_SOLID_MAT) { - for (y = 0; y < gUnknown_0203AA44[i].height; y ++) + for (y = 0; y < sDecorRearrangementDataBuffer[i].height; y ++) { - for (x = 0; x < gUnknown_0203AA44[i].width; x ++) + for (x = 0; x < sDecorRearrangementDataBuffer[i].width; x ++) { MapGridSetMetatileEntryAt(posX + 7 + x, posY + 7 - y, gMapHeader.mapData->map[posX + x + gMapHeader.mapData->width * (posY - y)] | 0x3000); } } - sub_81296EC(gUnknown_0203AA44[i].idx); + sub_81296EC(sDecorRearrangementDataBuffer[i].idx); } } } @@ -2213,7 +2213,7 @@ void sub_81298EC(u8 taskId) break; case 2: ScriptContext2_Enable(); - sub_8127814(taskId); + IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); pal_fill_black(); gTasks[taskId].data[2] = 3; break; @@ -2249,21 +2249,21 @@ bool8 sub_81299AC(u8 taskId) void SetUpPuttingAwayDecorationPlayerAvatar(void) { player_get_direction_lower_nybble(); - gUnknown_0203AA38 = gSprites[gUnknown_03005DD0.unk4].data0; + sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data0; sub_812A39C(); gUnknown_03005DD0.unk4 = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0); if (gSaveBlock2Ptr->playerGender == MALE) { - gUnknown_0203AA39 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, 0x88, 0x48, 0); + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, 0x88, 0x48, 0); } else { - gUnknown_0203AA39 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, 0x88, 0x48, 0); + sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC2, SpriteCallbackDummy, 0x88, 0x48, 0); } - gSprites[gUnknown_0203AA39].oam.priority = 1; - DestroySprite(&gSprites[gUnknown_0203AA38]); - gUnknown_0203AA38 = gUnknown_03005DD0.unk4; - gSprites[gUnknown_0203AA38].oam.priority = 1; + gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1; + DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]); + sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4; + gSprites[sDecor_CameraSpriteObjectIdx1].oam.priority = 1; } void sub_8129ABC(u8 taskId) @@ -2300,11 +2300,11 @@ void sub_8129ABC(u8 taskId) void sub_8129B34(u8 taskId) { sub_8197434(0, 1); - gSprites[gUnknown_0203AA38].data7 = 0; - gSprites[gUnknown_0203AA38].invisible = FALSE; - gSprites[gUnknown_0203AA38].callback = sub_812A36C; - gSprites[gUnknown_0203AA39].pos1.x = 0x88; - gSprites[gUnknown_0203AA39].pos1.y = 0x48; + gSprites[sDecor_CameraSpriteObjectIdx1].data7 = 0; + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = sub_812A36C; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.x = 0x88; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.y = 0x48; gTasks[taskId].data[10] = 0; gTasks[taskId].func = sub_8128E18; } @@ -2320,8 +2320,8 @@ void sub_8129BF8(u8 taskId) { gTasks[taskId].data[10] = 0; sub_8128DE0(); - gSprites[gUnknown_0203AA38].invisible = FALSE; - gSprites[gUnknown_0203AA38].callback = SpriteCallbackDummy; + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; StringExpandPlaceholders(gStringVar4, gText_StopPuttingAwayDecorations); DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1F0); } @@ -2332,7 +2332,7 @@ void sub_8129C74(u8 taskId) u8 behavior; sub_812A0E8(taskId); - if (gUnknown_0203AAC4 != 0) + if (sCurDecorSelectedInRearrangement != 0) { StringExpandPlaceholders(gStringVar4, gText_ReturnDecorationToPC); DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1A0); @@ -2343,8 +2343,8 @@ void sub_8129C74(u8 taskId) behavior = MapGridGetMetatileBehaviorAt(data[0], data[1]); if (MetatileBehavior_IsSecretBasePC(behavior) == TRUE || MetatileBehavior_IsMB_C5(behavior) == TRUE) { - gSprites[gUnknown_0203AA38].invisible = FALSE; - gSprites[gUnknown_0203AA38].callback = SpriteCallbackDummy; + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; StringExpandPlaceholders(gStringVar4, gText_StopPuttingAwayDecorations); DisplayItemMessageOnField(taskId, gStringVar4, sub_812A1F0); } @@ -2364,7 +2364,7 @@ void sub_8129D64(u8 taskId) } } -void sub_8129D8C(u8 decor, struct UnkStruct_0203AA44 *data) +void sub_8129D8C(u8 decor, struct DecorRearrangementDataBuffer *data) { if (gDecorations[decor].shape == DECORSHAPE_1x1) { @@ -2411,13 +2411,13 @@ void sub_8129D8C(u8 decor, struct UnkStruct_0203AA44 *data) void sub_8129E0C(u8 x, u8 y) { - gSprites[gUnknown_0203AA38].invisible = TRUE; - gSprites[gUnknown_0203AA38].callback = SpriteCallbackDummy; - gSprites[gUnknown_0203AA39].pos1.x = (x << 4) + 0x88; - gSprites[gUnknown_0203AA39].pos1.y = (y << 4) + 0x48; + gSprites[sDecor_CameraSpriteObjectIdx1].invisible = TRUE; + gSprites[sDecor_CameraSpriteObjectIdx1].callback = SpriteCallbackDummy; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.x = (x << 4) + 0x88; + gSprites[sDecor_CameraSpriteObjectIdx2].pos1.y = (y << 4) + 0x48; } -bool8 sub_8129E74(u8 taskId, u8 idx, struct UnkStruct_0203AA44 *data) +bool8 sub_8129E74(u8 taskId, u8 idx, struct DecorRearrangementDataBuffer *data) { u8 x; u8 y; @@ -2447,14 +2447,14 @@ void sub_8129F20(void) u8 xOff; u8 yOff; u16 i; - - xOff = gUnknown_0203A17C.pos[gUnknown_0203AA44[gUnknown_0203AAC4].idx] >> 4; - yOff = gUnknown_0203A17C.pos[gUnknown_0203AA44[gUnknown_0203AAC4].idx] & 0x0F; + + xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx] >> 4; + yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx] & 0x0F; for (i = 0; i < 0x40; i ++) { if (gSaveBlock1Ptr->mapObjectTemplates[i].x == xOff && gSaveBlock1Ptr->mapObjectTemplates[i].y == yOff && !FlagGet(gSaveBlock1Ptr->mapObjectTemplates[i].flagId)) { - gUnknown_0203AA44[gUnknown_0203AAC4].flagId = gSaveBlock1Ptr->mapObjectTemplates[i].flagId; + sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].flagId = gSaveBlock1Ptr->mapObjectTemplates[i].flagId; break; } } @@ -2470,12 +2470,12 @@ bool8 sub_8129FC8(u8 taskId) { if (gDecorations[gUnknown_0203A17C.items[i]].permission == DECORPERM_SOLID_MAT) { - sub_8129D8C(gUnknown_0203A17C.items[i], gUnknown_0203AA44); - if (sub_8129E74(taskId, i, gUnknown_0203AA44) == TRUE) + sub_8129D8C(gUnknown_0203A17C.items[i], sDecorRearrangementDataBuffer); + if (sub_8129E74(taskId, i, sDecorRearrangementDataBuffer) == TRUE) { - gUnknown_0203AA44->idx = i; + sDecorRearrangementDataBuffer->idx = i; sub_8129F20(); - gUnknown_0203AAC4 = 1; + sCurDecorSelectedInRearrangement = 1; return TRUE; } } @@ -2498,9 +2498,9 @@ void sub_812A040(u8 left, u8 top, u8 right, u8 bottom) yOff = gUnknown_0203A17C.pos[i] & 0x0F; if (decorIdx != 0 && gDecorations[decorIdx].permission == DECORPERM_SOLID_MAT && left <= xOff && top <= yOff && right >= xOff && bottom >= yOff) { - gUnknown_0203AA44[gUnknown_0203AAC4].idx = i; + sDecorRearrangementDataBuffer[sCurDecorSelectedInRearrangement].idx = i; sub_8129F20(); - gUnknown_0203AAC4++; + sCurDecorSelectedInRearrangement++; } } } @@ -2513,9 +2513,9 @@ void sub_812A0E8(u8 taskId) u8 yOff; u8 decor; register u8 decor asm("r1"); - struct UnkStruct_0203AA44 *data; + struct DecorRearrangementDataBuffer *data; - gUnknown_0203AAC4 = 0; + sCurDecorSelectedInRearrangement = 0; if (sub_8129FC8(taskId) != TRUE) { for (i = 0; i < gUnknown_0203A17C.size; i ++) @@ -2523,21 +2523,21 @@ void sub_812A0E8(u8 taskId) decor = gUnknown_0203A17C.items[i]; if (decor != DECOR_NONE) { - data = &gUnknown_0203AA44[0]; + data = &sDecorRearrangementDataBuffer[0]; sub_8129D8C(decor, data); if (sub_8129E74(taskId, i, data) == TRUE) { data->idx = i; - gUnknown_0203AAC4 ++; + sCurDecorSelectedInRearrangement ++; break; } } } - if (gUnknown_0203AAC4 != 0) + if (sCurDecorSelectedInRearrangement != 0) { - xOff = gUnknown_0203A17C.pos[gUnknown_0203AA44[0].idx] >> 4; - yOff = gUnknown_0203A17C.pos[gUnknown_0203AA44[0].idx] & 0x0F; - sub_812A040(xOff, yOff - gUnknown_0203AA44[0].height + 1, xOff + gUnknown_0203AA44[0].width - 1, yOff); // Arithmetic register swap at the r2 argument: `add r2, r0, r2` instead of `add r2, r2, r0` + xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] >> 4; + yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] & 0x0F; + sub_812A040(xOff, yOff - sDecorRearrangementDataBuffer[0].height + 1, xOff + sDecorRearrangementDataBuffer[0].width - 1, yOff); // Arithmetic register swap at the r2 argument: `add r2, r0, r2` instead of `add r2, r2, r0` } } } @@ -2547,7 +2547,7 @@ __attribute__((naked)) void sub_812A0E8(u8 taskId) asm_unified("\tpush {r4-r7,lr}\n" "\tlsls r0, 24\n" "\tlsrs r6, r0, 24\n" - "\tldr r4, =gUnknown_0203AAC4\n" + "\tldr r4, =sCurDecorSelectedInRearrangement\n" "\tmovs r0, 0\n" "\tstrb r0, [r4]\n" "\tadds r0, r6, 0\n" @@ -2568,7 +2568,7 @@ __attribute__((naked)) void sub_812A0E8(u8 taskId) "\tldrb r1, [r0]\n" "\tcmp r1, 0\n" "\tbeq _0812A14C\n" - "\tldr r4, =gUnknown_0203AA44\n" + "\tldr r4, =sDecorRearrangementDataBuffer\n" "\tadds r0, r1, 0\n" "\tadds r1, r4, 0\n" "\tbl sub_8129D8C\n" @@ -2595,12 +2595,12 @@ __attribute__((naked)) void sub_812A0E8(u8 taskId) "\tcmp r5, r1\n" "\tbcc _0812A10E\n" "_0812A15A:\n" - "\tldr r0, =gUnknown_0203AAC4\n" + "\tldr r0, =sCurDecorSelectedInRearrangement\n" "\tldrb r0, [r0]\n" "\tcmp r0, 0\n" "\tbeq _0812A18C\n" "\tldr r0, =gUnknown_0203A17C\n" - "\tldr r2, =gUnknown_0203AA44\n" + "\tldr r2, =sDecorRearrangementDataBuffer\n" "\tldrb r1, [r2]\n" "\tldr r0, [r0, 0x4]\n" "\tadds r0, r1\n" @@ -2746,14 +2746,14 @@ void sub_812A39C(void) void sub_812A3C8(void) { - FreeSpritePaletteByTag(OVERWORLD_DECOR_BOX_PAL_TAG); + FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG); } void sub_812A3D4(u8 taskId) { - if (sub_81279C4() == TRUE) + if (IsSelectedDecorInThePC() == TRUE) { - StringCopy(gStringVar1, gDecorations[gUnknown_0203A14C[gUnknown_0203A172]].name); + StringCopy(gStringVar1, gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].name); StringExpandPlaceholders(gStringVar4, gText_DecorationWillBeDiscarded); DisplayItemMessageOnField(taskId, gStringVar4, sub_812A458); } @@ -2772,10 +2772,10 @@ void sub_812A458(u8 taskId) void sub_812A478(u8 taskId) { - gUnknown_0203A14C[gUnknown_0203A172] = DECOR_NONE; - gUnknown_0203A151 = CountDecorationCategoryN(gUnknown_0203A173); - CondenseDecorationCategoryN(gUnknown_0203A173); - sub_8127814(taskId); + gCurDecorInventoryItems[gCurDecorationIndex] = DECOR_NONE; + sCurDecorCatCount = CountDecorationCategoryN(sCurDecorationCategory); + CondenseDecorationCategoryN(sCurDecorationCategory); + IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId); StringExpandPlaceholders(gStringVar4, gText_DecorationThrownAway); DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); }