diff --git a/asm/macros/scrcmd.inc b/asm/macros/scrcmd.inc index a742c2ece2..a424111416 100644 --- a/asm/macros/scrcmd.inc +++ b/asm/macros/scrcmd.inc @@ -1785,24 +1785,24 @@ .short \arg1 .endm - .macro ScrCmd_147 arg0 + .macro PokeMartCommon unused .short 327 - .short \arg0 + .short \unused .endm - .macro ScrCmd_148 arg0 + .macro PokeMartSpecialties martID .short 328 - .short \arg0 + .short \martID .endm - .macro ScrCmd_149 arg0 + .macro PokeMartDecor martID .short 329 - .short \arg0 + .short \martID .endm - .macro ScrCmd_14A arg0 + .macro PokeMartSeal martID .short 330 - .short \arg0 + .short \martID .endm .macro ScrCmd_14B @@ -3969,9 +3969,9 @@ .short \arg0 .endm - .macro ScrCmd_2D8 arg0 + .macro PokeMartFrontier martID .short 728 - .byte \arg0 + .byte \martID .endm .macro ScrCmd_2D9 arg0, arg1, arg2 diff --git a/include/unk_02046AD4.h b/include/unk_02046AD4.h index 50a1df43b4..4d26709211 100644 --- a/include/unk_02046AD4.h +++ b/include/unk_02046AD4.h @@ -3,10 +3,10 @@ #include "field_script_context.h" -BOOL ScrCmd_147(ScriptContext *param0); -BOOL ScrCmd_148(ScriptContext *param0); -BOOL ScrCmd_149(ScriptContext *param0); -BOOL ScrCmd_14A(ScriptContext *param0); +BOOL ScrCmd_PokeMartCommon(ScriptContext *ctx); +BOOL ScrCmd_PokeMartSpecialties(ScriptContext *ctx); +BOOL ScrCmd_PokeMartDecor(ScriptContext *ctx); +BOOL ScrCmd_PokeMartSeal(ScriptContext *ctx); BOOL ScrCmd_257(ScriptContext *param0); #endif // POKEPLATINUM_UNK_02046AD4_H diff --git a/res/field/scripts/scripts_battle_frontier.s b/res/field/scripts/scripts_battle_frontier.s index f1bc7f1382..4c10f4bf81 100644 --- a/res/field/scripts/scripts_battle_frontier.s +++ b/res/field/scripts/scripts_battle_frontier.s @@ -274,7 +274,7 @@ _026A: FacePlayer Message 21 ScrCmd_035 - ScrCmd_2D8 1 + PokeMartFrontier 1 ReleaseAll End @@ -297,7 +297,7 @@ _02A6: FacePlayer Message 23 ScrCmd_035 - ScrCmd_2D8 0 + PokeMartFrontier 0 ReleaseAll End diff --git a/res/field/scripts/scripts_battle_park_exchange_service_corner.s b/res/field/scripts/scripts_battle_park_exchange_service_corner.s index ab48016cfb..8ab4d5038e 100644 --- a/res/field/scripts/scripts_battle_park_exchange_service_corner.s +++ b/res/field/scripts/scripts_battle_park_exchange_service_corner.s @@ -25,7 +25,7 @@ _0030: FacePlayer Message 15 ScrCmd_035 - ScrCmd_2D8 0 + PokeMartFrontier 0 ReleaseAll End @@ -35,7 +35,7 @@ _0044: FacePlayer Message 15 ScrCmd_035 - ScrCmd_2D8 1 + PokeMartFrontier 1 ReleaseAll End diff --git a/res/field/scripts/scripts_canalave_city_mart.s b/res/field/scripts/scripts_canalave_city_mart.s index b7b0022709..e9e82b784e 100644 --- a/res/field/scripts/scripts_canalave_city_mart.s +++ b/res/field/scripts/scripts_canalave_city_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 16 + PokeMartSpecialties 16 ReleaseAll End diff --git a/res/field/scripts/scripts_celestic_town_northwest_house.s b/res/field/scripts/scripts_celestic_town_northwest_house.s index c80861f355..af6114ce09 100644 --- a/res/field/scripts/scripts_celestic_town_northwest_house.s +++ b/res/field/scripts/scripts_celestic_town_northwest_house.s @@ -16,7 +16,7 @@ _0012: Message 0 CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -26,7 +26,7 @@ _002B: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -36,7 +36,7 @@ _0041: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 14 + PokeMartSpecialties 14 ReleaseAll End diff --git a/res/field/scripts/scripts_eterna_city_mart.s b/res/field/scripts/scripts_eterna_city_mart.s index ec433436d2..a7e0c38fa7 100644 --- a/res/field/scripts/scripts_eterna_city_mart.s +++ b/res/field/scripts/scripts_eterna_city_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 3 + PokeMartSpecialties 3 ReleaseAll End diff --git a/res/field/scripts/scripts_eterna_city_north_house.s b/res/field/scripts/scripts_eterna_city_north_house.s index 9a8a5f9dbe..734cc55b79 100644 --- a/res/field/scripts/scripts_eterna_city_north_house.s +++ b/res/field/scripts/scripts_eterna_city_north_house.s @@ -14,7 +14,7 @@ _000E: FacePlayer Message 0 ScrCmd_035 - ScrCmd_148 4 + PokeMartSpecialties 4 ReleaseAll End diff --git a/res/field/scripts/scripts_fight_area_mart.s b/res/field/scripts/scripts_fight_area_mart.s index 590cb31777..04cc94a311 100644 --- a/res/field/scripts/scripts_fight_area_mart.s +++ b/res/field/scripts/scripts_fight_area_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End diff --git a/res/field/scripts/scripts_floaroma_town_mart.s b/res/field/scripts/scripts_floaroma_town_mart.s index 0eda268e54..e0d4227009 100644 --- a/res/field/scripts/scripts_floaroma_town_mart.s +++ b/res/field/scripts/scripts_floaroma_town_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 2 + PokeMartSpecialties 2 ReleaseAll End diff --git a/res/field/scripts/scripts_hearthome_city_mart.s b/res/field/scripts/scripts_hearthome_city_mart.s index 308142cb29..0f0ca1503f 100644 --- a/res/field/scripts/scripts_hearthome_city_mart.s +++ b/res/field/scripts/scripts_hearthome_city_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 5 + PokeMartSpecialties 5 ReleaseAll End diff --git a/res/field/scripts/scripts_jubilife_city_mart.s b/res/field/scripts/scripts_jubilife_city_mart.s index 0a19d140a3..349bcdd65c 100644 --- a/res/field/scripts/scripts_jubilife_city_mart.s +++ b/res/field/scripts/scripts_jubilife_city_mart.s @@ -16,7 +16,7 @@ _0016: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -26,7 +26,7 @@ _002C: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 0 + PokeMartSpecialties 0 ReleaseAll End diff --git a/res/field/scripts/scripts_oreburgh_city_mart.s b/res/field/scripts/scripts_oreburgh_city_mart.s index 1c6a664585..cfa37ac7de 100644 --- a/res/field/scripts/scripts_oreburgh_city_mart.s +++ b/res/field/scripts/scripts_oreburgh_city_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 1 + PokeMartSpecialties 1 ReleaseAll End diff --git a/res/field/scripts/scripts_pastoria_city_mart.s b/res/field/scripts/scripts_pastoria_city_mart.s index 8c225b4315..d416ecaad4 100644 --- a/res/field/scripts/scripts_pastoria_city_mart.s +++ b/res/field/scripts/scripts_pastoria_city_mart.s @@ -16,7 +16,7 @@ _0016: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -26,7 +26,7 @@ _002C: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 7 + PokeMartSpecialties 7 ReleaseAll End diff --git a/res/field/scripts/scripts_pokemon_league_north_pokecenter_1f.s b/res/field/scripts/scripts_pokemon_league_north_pokecenter_1f.s index 9b2c31db5f..d9051bf38a 100644 --- a/res/field/scripts/scripts_pokemon_league_north_pokecenter_1f.s +++ b/res/field/scripts/scripts_pokemon_league_north_pokecenter_1f.s @@ -103,7 +103,7 @@ _0128: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -113,7 +113,7 @@ _013E: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 18 + PokeMartSpecialties 18 ReleaseAll End diff --git a/res/field/scripts/scripts_pokemon_league_south_pokecenter_1f.s b/res/field/scripts/scripts_pokemon_league_south_pokecenter_1f.s index 1ec214dd85..5fb5195430 100644 --- a/res/field/scripts/scripts_pokemon_league_south_pokecenter_1f.s +++ b/res/field/scripts/scripts_pokemon_league_south_pokecenter_1f.s @@ -26,7 +26,7 @@ _002C: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -36,7 +36,7 @@ _0042: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 18 + PokeMartSpecialties 18 ReleaseAll End diff --git a/res/field/scripts/scripts_resort_area_mart.s b/res/field/scripts/scripts_resort_area_mart.s index fc214c9d9f..9f86cab2ce 100644 --- a/res/field/scripts/scripts_resort_area_mart.s +++ b/res/field/scripts/scripts_resort_area_mart.s @@ -12,7 +12,7 @@ _000A: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End diff --git a/res/field/scripts/scripts_sandgem_town_mart.s b/res/field/scripts/scripts_sandgem_town_mart.s index b9210a2672..dc04ace3c4 100644 --- a/res/field/scripts/scripts_sandgem_town_mart.s +++ b/res/field/scripts/scripts_sandgem_town_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 0 + PokeMartCommon 0 ReleaseAll End diff --git a/res/field/scripts/scripts_snowpoint_city_mart.s b/res/field/scripts/scripts_snowpoint_city_mart.s index dd755d5d9a..b3e00f693a 100644 --- a/res/field/scripts/scripts_snowpoint_city_mart.s +++ b/res/field/scripts/scripts_snowpoint_city_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 15 + PokeMartSpecialties 15 ReleaseAll End diff --git a/res/field/scripts/scripts_solaceon_town_mart.s b/res/field/scripts/scripts_solaceon_town_mart.s index 3278f76d64..54c306504c 100644 --- a/res/field/scripts/scripts_solaceon_town_mart.s +++ b/res/field/scripts/scripts_solaceon_town_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 6 + PokeMartSpecialties 6 ReleaseAll End diff --git a/res/field/scripts/scripts_sunyshore_city.s b/res/field/scripts/scripts_sunyshore_city.s index 7c3416b392..a54e3a7560 100644 --- a/res/field/scripts/scripts_sunyshore_city.s +++ b/res/field/scripts/scripts_sunyshore_city.s @@ -653,31 +653,31 @@ _0791: End _0806: - ScrCmd_14A 0 + PokeMartSeal 0 GoTo _084C _0810: - ScrCmd_14A 1 + PokeMartSeal 1 GoTo _084C _081A: - ScrCmd_14A 2 + PokeMartSeal 2 GoTo _084C _0824: - ScrCmd_14A 3 + PokeMartSeal 3 GoTo _084C _082E: - ScrCmd_14A 4 + PokeMartSeal 4 GoTo _084C _0838: - ScrCmd_14A 5 + PokeMartSeal 5 GoTo _084C _0842: - ScrCmd_14A 6 + PokeMartSeal 6 GoTo _084C _084C: diff --git a/res/field/scripts/scripts_sunyshore_city_mart.s b/res/field/scripts/scripts_sunyshore_city_mart.s index 6c153e0efd..d3558bfdae 100644 --- a/res/field/scripts/scripts_sunyshore_city_mart.s +++ b/res/field/scripts/scripts_sunyshore_city_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -25,7 +25,7 @@ _0028: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 17 + PokeMartSpecialties 17 ReleaseAll End diff --git a/res/field/scripts/scripts_sunyshore_market.s b/res/field/scripts/scripts_sunyshore_market.s index 01dee0fa73..508bf723e3 100644 --- a/res/field/scripts/scripts_sunyshore_market.s +++ b/res/field/scripts/scripts_sunyshore_market.s @@ -95,31 +95,31 @@ _00E4: End _014B: - ScrCmd_14A 0 + PokeMartSeal 0 Return _0151: - ScrCmd_14A 1 + PokeMartSeal 1 Return _0157: - ScrCmd_14A 2 + PokeMartSeal 2 Return _015D: - ScrCmd_14A 3 + PokeMartSeal 3 Return _0163: - ScrCmd_14A 4 + PokeMartSeal 4 Return _0169: - ScrCmd_14A 5 + PokeMartSeal 5 Return _016F: - ScrCmd_14A 6 + PokeMartSeal 6 Return _0175: diff --git a/res/field/scripts/scripts_survival_area_mart.s b/res/field/scripts/scripts_survival_area_mart.s index 1cc14b3d9c..f2f769ecf3 100644 --- a/res/field/scripts/scripts_survival_area_mart.s +++ b/res/field/scripts/scripts_survival_area_mart.s @@ -15,7 +15,7 @@ _0012: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End diff --git a/res/field/scripts/scripts_unk_1087.s b/res/field/scripts/scripts_unk_1087.s index 20c5b06d9b..27831a2e99 100644 --- a/res/field/scripts/scripts_unk_1087.s +++ b/res/field/scripts/scripts_unk_1087.s @@ -12,7 +12,7 @@ _000A: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_147 1 + PokeMartCommon 1 ReleaseAll End @@ -22,7 +22,7 @@ _0020: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 14 + PokeMartSpecialties 14 ReleaseAll End diff --git a/res/field/scripts/scripts_veilstone_store_1f.s b/res/field/scripts/scripts_veilstone_store_1f.s index 7749ffe9fd..a38917b8a8 100644 --- a/res/field/scripts/scripts_veilstone_store_1f.s +++ b/res/field/scripts/scripts_veilstone_store_1f.s @@ -49,7 +49,7 @@ _005B: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 8 + PokeMartSpecialties 8 ReleaseAll End @@ -59,7 +59,7 @@ _0071: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 9 + PokeMartSpecialties 9 ReleaseAll End diff --git a/res/field/scripts/scripts_veilstone_store_2f.s b/res/field/scripts/scripts_veilstone_store_2f.s index 2c949cfceb..cbace8c0b5 100644 --- a/res/field/scripts/scripts_veilstone_store_2f.s +++ b/res/field/scripts/scripts_veilstone_store_2f.s @@ -163,7 +163,7 @@ _0198: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 10 + PokeMartSpecialties 10 ReleaseAll End @@ -173,7 +173,7 @@ _01AE: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 11 + PokeMartSpecialties 11 ReleaseAll End diff --git a/res/field/scripts/scripts_veilstone_store_3f.s b/res/field/scripts/scripts_veilstone_store_3f.s index 8cc3083f3e..11a3dea5a7 100644 --- a/res/field/scripts/scripts_veilstone_store_3f.s +++ b/res/field/scripts/scripts_veilstone_store_3f.s @@ -111,7 +111,7 @@ _0127: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 12 + PokeMartSpecialties 12 ReleaseAll End @@ -121,7 +121,7 @@ _013D: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 13 + PokeMartSpecialties 13 ReleaseAll End diff --git a/res/field/scripts/scripts_veilstone_store_4f.s b/res/field/scripts/scripts_veilstone_store_4f.s index 26480878c5..9e32ed9730 100644 --- a/res/field/scripts/scripts_veilstone_store_4f.s +++ b/res/field/scripts/scripts_veilstone_store_4f.s @@ -111,7 +111,7 @@ _0127: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_149 0 + PokeMartDecor 0 ReleaseAll End @@ -121,7 +121,7 @@ _013D: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_149 1 + PokeMartDecor 1 ReleaseAll End diff --git a/res/field/scripts/scripts_veilstone_store_b1f.s b/res/field/scripts/scripts_veilstone_store_b1f.s index 8b7dd19532..96e7c02ce6 100644 --- a/res/field/scripts/scripts_veilstone_store_b1f.s +++ b/res/field/scripts/scripts_veilstone_store_b1f.s @@ -109,7 +109,7 @@ _00E8: FacePlayer CallCommonScript 0x7E3 ScrCmd_035 - ScrCmd_148 19 + PokeMartSpecialties 19 ReleaseAll End diff --git a/src/scrcmd.c b/src/scrcmd.c index 86ba2031f0..db752f1a8f 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -6,6 +6,7 @@ #include "constants/battle.h" #include "constants/heap.h" +#include "constants/items.h" #include "constants/overworld_weather.h" #include "constants/scrcmd.h" #include "constants/species.h" @@ -107,6 +108,7 @@ #include "great_marsh_lookout.h" #include "heap.h" #include "inlines.h" +#include "items.h" #include "journal.h" #include "location.h" #include "map_header_data.h" @@ -711,7 +713,7 @@ static BOOL ScrCmd_2CD(ScriptContext *ctx); static BOOL ScrCmd_2CE(ScriptContext *ctx); static BOOL ScrCmd_2D6(ScriptContext *ctx); static BOOL ScrCmd_2D7(ScriptContext *ctx); -static BOOL ScrCmd_2D8(ScriptContext *ctx); +static BOOL ScrCmd_PokeMartFrontier(ScriptContext *ctx); BOOL ScrCmd_2C8(ScriptContext *ctx); BOOL ScrCmd_2E2(ScriptContext *ctx); BOOL ScrCmd_2E3(ScriptContext *ctx); @@ -1090,10 +1092,10 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_144, ScrCmd_145, ScrCmd_146, - ScrCmd_147, - ScrCmd_148, - ScrCmd_149, - ScrCmd_14A, + ScrCmd_PokeMartCommon, + ScrCmd_PokeMartSpecialties, + ScrCmd_PokeMartDecor, + ScrCmd_PokeMartSeal, ScrCmd_14B, ScrCmd_14C, ScrCmd_GetPlayerGender, @@ -1491,7 +1493,7 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_2D5, ScrCmd_2D6, ScrCmd_2D7, - ScrCmd_2D8, + ScrCmd_PokeMartFrontier, ScrCmd_2D9, ScrCmd_2DA, ScrCmd_2DB, @@ -7786,63 +7788,63 @@ static BOOL ScrCmd_2CE(ScriptContext *ctx) return 1; } -static BOOL ScrCmd_2D8(ScriptContext *ctx) +static BOOL ScrCmd_PokeMartFrontier(ScriptContext *ctx) { - u8 v0 = ScriptContext_ReadByte(ctx); - static const u16 v1[] = { - 0x14D, - 0x190, - 0x184, - 0x174, - 0x16F, - 0x166, - 0x14F, - 0x14B, - 0x198, - 0x165, - 0x17C, - 0x16B, - 0x182, - 0x18E, - 0x161, - 0xffff + u8 martID = ScriptContext_ReadByte(ctx); + static const u16 BattleFrontierRightExchangeServiceCorner[] = { + ITEM_TM06, + ITEM_TM73, + ITEM_TM61, + ITEM_TM45, + ITEM_TM40, + ITEM_TM31, + ITEM_TM08, + ITEM_TM04, + ITEM_TM81, + ITEM_TM30, + ITEM_TM53, + ITEM_TM36, + ITEM_TM59, + ITEM_TM71, + ITEM_TM26, + ITEM_RETURN_ID, }; - static const u16 v2[] = { - 0x2E, - 0x31, - 0x2F, - 0x34, - 0x30, - 0x2D, - 0x121, - 0x122, - 0x123, - 0x124, - 0x125, - 0x126, - 0x110, - 0x111, - 0xD6, - 0x10F, - 0xD5, - 0xDC, - 0xE6, - 0xE8, - 0x10A, - 0x113, - 0x11F, - 0x146, - 0x147, - 0x32, - 0xffff + static const u16 BattleFrontierLeftExchangeServiceCorner[] = { + ITEM_PROTEIN, + ITEM_CALCIUM, + ITEM_IRON, + ITEM_ZINC, + ITEM_CARBOS, + ITEM_HP_UP, + ITEM_POWER_BRACER, + ITEM_POWER_BELT, + ITEM_POWER_LENS, + ITEM_POWER_BAND, + ITEM_POWER_ANKLET, + ITEM_POWER_WEIGHT, + ITEM_TOXIC_ORB, + ITEM_FLAME_ORB, + ITEM_WHITE_HERB, + ITEM_POWER_HERB, + ITEM_BRIGHTPOWDER, + ITEM_CHOICE_BAND, + ITEM_FOCUS_BAND, + ITEM_SCOPE_LENS, + ITEM_MUSCLE_BAND, + ITEM_FOCUS_SASH, + ITEM_CHOICE_SCARF, + ITEM_RAZOR_CLAW, + ITEM_RAZOR_FANG, + ITEM_RARE_CANDY, + ITEM_RETURN_ID, }; - static const u16 *v3[] = { - v1, - v2, + static const u16 *BattleFrontierExchangeServiceCorners[] = { + BattleFrontierRightExchangeServiceCorner, + BattleFrontierLeftExchangeServiceCorner, }; - Shop_Start(ctx->task, ctx->fieldSystem, (u16 *)v3[v0], MART_TYPE_FRONTIER, 0); - return 1; + Shop_Start(ctx->task, ctx->fieldSystem, (u16 *)BattleFrontierExchangeServiceCorners[martID], MART_TYPE_FRONTIER, FALSE); + return TRUE; } BOOL ScrCmd_2C8(ScriptContext *ctx) diff --git a/src/unk_02046AD4.c b/src/unk_02046AD4.c index bbe0c308fc..b970c62929 100644 --- a/src/unk_02046AD4.c +++ b/src/unk_02046AD4.c @@ -3,6 +3,8 @@ #include #include +#include "generated/badges.h" + #include "data/mart_items.h" #include "overlay007/shop_menu.h" @@ -12,102 +14,108 @@ #include "trainer_info.h" #include "unk_0203D1B8.h" -BOOL ScrCmd_147(ScriptContext *param0) +BOOL ScrCmd_PokeMartCommon(ScriptContext *ctx) { - u16 v0[64]; - u8 v1, v2, v3, v4; - u16 v5 = ScriptContext_GetVar(param0); + u16 shopItems[64]; + u8 requiredBadges, badgeNum, i, j; + u16 unused = ScriptContext_GetVar(ctx); - v3 = 0; - v2 = 0; - v1 = 0; + i = 0; + badgeNum = 0; + requiredBadges = 0; - for (v4 = 0; v4 < 8; v4++) { - if (TrainerInfo_HasBadge(SaveData_GetTrainerInfo(param0->fieldSystem->saveData), v4) == 1) { - v2++; + for (j = 0; j < MAX_BADGES; j++) { + if (TrainerInfo_HasBadge(SaveData_GetTrainerInfo(ctx->fieldSystem->saveData), j) == TRUE) { + badgeNum++; } } - switch (v2) { + switch (badgeNum) { case 0: - v1 = 1; + requiredBadges = 1; break; case 1: case 2: - v1 = 2; + requiredBadges = 2; break; case 3: case 4: - v1 = 3; + requiredBadges = 3; break; case 5: case 6: - v1 = 4; + requiredBadges = 4; break; case 7: - v1 = 5; + requiredBadges = 5; break; case 8: - v1 = 6; + requiredBadges = 6; break; default: - v1 = 1; + requiredBadges = 1; break; } - for (v4 = 0; v4 < (NELEMS(PokeMartCommonItems)); v4++) { - if (v1 >= PokeMartCommonItems[v4].requiredBadges) { - v0[v3] = PokeMartCommonItems[v4].itemID; - v3++; + for (j = 0; j < (NELEMS(PokeMartCommonItems)); j++) { + if (requiredBadges >= PokeMartCommonItems[j].requiredBadges) { + shopItems[i] = PokeMartCommonItems[j].itemID; + i++; } } - v0[v3] = 0xffff; + shopItems[i] = ITEM_RETURN_ID; - Shop_Start(param0->task, param0->fieldSystem, v0, MART_TYPE_NORMAL, 0); - return 1; + Shop_Start(ctx->task, ctx->fieldSystem, shopItems, MART_TYPE_NORMAL, FALSE); + return TRUE; } -BOOL ScrCmd_148(ScriptContext *param0) +BOOL ScrCmd_PokeMartSpecialties(ScriptContext *ctx) { - u16 v0 = ScriptContext_GetVar(param0); - BOOL v1; + u16 martID = ScriptContext_GetVar(ctx); + BOOL incDeptStoreBuyCount; - if ((v0 == 8) || (v0 == 9) || (v0 == 10) || (v0 == 11) || (v0 == 12) || (v0 == 13) || (v0 == 19)) { - v1 = 1; + if ((martID == 8) || (martID == 9) || (martID == 10) || (martID == 11) || (martID == 12) || (martID == 13) || (martID == 19)) { + incDeptStoreBuyCount = TRUE; } else { - v1 = 0; + incDeptStoreBuyCount = FALSE; } - Shop_Start(param0->task, param0->fieldSystem, (u16 *)PokeMartSpecialties[v0], MART_TYPE_NORMAL, v1); - return 1; + Shop_Start(ctx->task, ctx->fieldSystem, (u16 *)PokeMartSpecialties[martID], MART_TYPE_NORMAL, incDeptStoreBuyCount); + return TRUE; } -BOOL ScrCmd_149(ScriptContext *param0) +// Veilstone +BOOL ScrCmd_PokeMartDecor(ScriptContext *ctx) { - u16 v0 = ScriptContext_GetVar(param0); - BOOL v1; + u16 martID = ScriptContext_GetVar(ctx); + BOOL incDeptStoreBuyCount; - if ((v0 == 0) || (v0 == 1)) { - v1 = 1; + if ((martID == 0) || (martID == 1)) { + incDeptStoreBuyCount = TRUE; } else { - v1 = 0; + // never reached as the only two instances of + // this command only sets martID to 0 and 1 + // respectively. + incDeptStoreBuyCount = FALSE; } - Shop_Start(param0->task, param0->fieldSystem, (u16 *)VeilstoneDeptStoreDecorationStocks[v0], MART_TYPE_DECOR, v1); - return 1; + Shop_Start(ctx->task, ctx->fieldSystem, (u16 *)VeilstoneDeptStoreDecorationStocks[martID], MART_TYPE_DECOR, incDeptStoreBuyCount); + return TRUE; } -BOOL ScrCmd_14A(ScriptContext *param0) +// Sunyshore +BOOL ScrCmd_PokeMartSeal(ScriptContext *ctx) { - u16 v0 = ScriptContext_GetVar(param0); + u16 martID = ScriptContext_GetVar(ctx); - Shop_Start(param0->task, param0->fieldSystem, (u16 *)SunyshoreMarketDailyStocks[v0], MART_TYPE_SEAL, 0); - return 1; + Shop_Start(ctx->task, ctx->fieldSystem, (u16 *)SunyshoreMarketDailyStocks[martID], MART_TYPE_SEAL, FALSE); + return TRUE; } +// does NOT use shop_menu BOOL ScrCmd_257(ScriptContext *param0) { sub_0203E518(param0->fieldSystem->task); - return 1; + return TRUE; }