shop_menu/script: document shop-related scrcmds

This commit is contained in:
mudskipper13 2025-02-23 11:54:58 +07:00
parent a9b8cfb118
commit ba5cdc14ed
32 changed files with 189 additions and 179 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -14,7 +14,7 @@ _000E:
FacePlayer
Message 0
ScrCmd_035
ScrCmd_148 4
PokeMartSpecialties 4
ReleaseAll
End

View File

@ -15,7 +15,7 @@ _0012:
FacePlayer
CallCommonScript 0x7E3
ScrCmd_035
ScrCmd_147 1
PokeMartCommon 1
ReleaseAll
End

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -12,7 +12,7 @@ _000A:
FacePlayer
CallCommonScript 0x7E3
ScrCmd_035
ScrCmd_147 1
PokeMartCommon 1
ReleaseAll
End

View File

@ -15,7 +15,7 @@ _0012:
FacePlayer
CallCommonScript 0x7E3
ScrCmd_035
ScrCmd_147 0
PokeMartCommon 0
ReleaseAll
End

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -15,7 +15,7 @@ _0012:
FacePlayer
CallCommonScript 0x7E3
ScrCmd_035
ScrCmd_147 1
PokeMartCommon 1
ReleaseAll
End

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -109,7 +109,7 @@ _00E8:
FacePlayer
CallCommonScript 0x7E3
ScrCmd_035
ScrCmd_148 19
PokeMartSpecialties 19
ReleaseAll
End

View File

@ -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)

View File

@ -3,6 +3,8 @@
#include <nitro.h>
#include <string.h>
#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;
}