Merge pull request #41 from PikalaxALT/pikalax_work

Decompile scrcmd_{2,3} -> scrcmd_mart
This commit is contained in:
PikalaxALT 2022-02-24 13:10:06 -05:00 committed by GitHub
commit 794110052d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 569 additions and 850 deletions

View File

@ -5870,8 +5870,8 @@ ov03_02256D18: ; 0x02256D18
pop {r4, pc}
thumb_func_end ov03_02256D18
thumb_func_start ov03_02256D34
ov03_02256D34: ; 0x02256D34
thumb_func_start InitMartUI
InitMartUI: ; 0x02256D34
push {r3, r4, r5, r6, r7, lr}
add r5, r1, #0
add r7, r0, #0
@ -5985,7 +5985,7 @@ _02256E04:
pop {r3, r4, r5, r6, r7, pc}
nop
_02256E28: .word ov03_02256E2C
thumb_func_end ov03_02256D34
thumb_func_end InitMartUI
thumb_func_start ov03_02256E2C
ov03_02256E2C: ; 0x02256E2C

View File

@ -1,608 +0,0 @@
#include "constants/items.h"
#include "constants/decorations.h"
#include "constants/seals.h"
.include "asm/macros.inc"
.include "global.inc"
.rodata
_020FBA54:
.short ITEM_AIR_MAIL, ITEM_HEAL_BALL, 0xFFFF
_020FBA5A:
.short ITEM_AIR_MAIL, ITEM_QUICK_BALL, 0xFFFF
_020FBA60:
.short ITEM_AIR_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF
_020FBA68:
.short ITEM_AIR_MAIL, ITEM_TUNNEL_MAIL, ITEM_BLOOM_MAIL, 0xFFFF
_020FBA70:
.short ITEM_AIR_MAIL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF
_020FBA78:
.short ITEM_TUNNEL_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF
_020FBA80:
.short ITEM_AIR_MAIL, ITEM_NET_BALL, ITEM_DUSK_BALL, 0xFFFF
_020FBA88:
.short ITEM_HEART_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF
_020FBA90:
.short ITEM_STEEL_MAIL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF
_020FBA98:
.short ITEM_SNOW_MAIL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF
_020FBAA0:
.short ITEM_STEEL_MAIL, ITEM_NEST_BALL, ITEM_QUICK_BALL, 0xFFFF
_020FBAA8:
.short ITEM_STEEL_MAIL, ITEM_NET_BALL, ITEM_HEAL_BALL, 0xFFFF
_020FBAB0:
.short ITEM_BLOOM_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF
_020FBAB8:
.short ITEM_TINYMUSHROOM, ITEM_POKE_BALL, ITEM_POTION, 0xFFFF
_020FBAC0:
.short ITEM_AIR_MAIL, ITEM_NEST_BALL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF
_020FBACA:
.short ITEM_HEAL_POWDER, ITEM_ENERGYPOWDER, ITEM_ENERGY_ROOT, ITEM_REVIVAL_HERB, 0xFFFF
_020FBAD4:
.short ITEM_POTION, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_FULL_HEAL, ITEM_REVIVE, 0xFFFF
_020FBAE0:
.short DECORATION_YELLOW_CUSHION, DECORATION_CUPBOARD, DECORATION_TV, DECORATION_REFRIGERATOR, DECORATION_PRETTY_SINK, 0xFFFF
_020FBAEC:
.short DECORATION_MUNCHLAX_DOLL, DECORATION_BONSLY_DOLL, DECORATION_MIME_JR__DOLL, DECORATION_MANTYKE_DOLL, DECORATION_BUIZEL_DOLL, DECORATION_CHATOT_DOLL, 0xFFFF
_020FBAFA:
.short ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_ZINC, ITEM_CARBOS, ITEM_HP_UP, 0xFFFF
_020FBB08:
.short ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_ZINC, ITEM_CARBOS, ITEM_HP_UP, 0xFFFF
_020FBB16:
.short ITEM_POKE_DOLL, ITEM_FRESH_WATER, ITEM_SODA_POP, ITEM_LEMONADE, ITEM_REPEL, ITEM_HEART_MAIL, 0xFFFF
_020FBB24:
.short SEAL_HEART_B, SEAL_STAR_C, SEAL_FIRE_B, SEAL_FLORA_A, SEAL_SONG_B, SEAL_LINE_D, SEAL_ELE_C, 0xFFFF
_020FBB34:
.short SEAL_HEART_C, SEAL_STAR_D, SEAL_FIRE_C, SEAL_FLORA_B, SEAL_SONG_C, SEAL_SMOKE_A, SEAL_ELE_D, 0xFFFF
_020FBB44:
.short SEAL_HEART_D, SEAL_FOAMY_A, SEAL_FIRE_D, SEAL_FLORA_C, SEAL_SONG_D, SEAL_STAR_E, SEAL_SMOKE_B, 0xFFFF
_020FBB54:
.short SEAL_FOAMY_B, SEAL_PARTY_A, SEAL_FLORA_D, SEAL_SONG_E, SEAL_HEART_E, SEAL_STAR_F, SEAL_SMOKE_C, 0xFFFF
_020FBB64:
.short SEAL_FOAMY_C, SEAL_PARTY_B, SEAL_FLORA_E, SEAL_SONG_F, SEAL_HEART_F, SEAL_LINE_A, SEAL_SMOKE_D, 0xFFFF
_020FBB74:
.short SEAL_STAR_A, SEAL_SONG_G, SEAL_FOAMY_D, SEAL_FLORA_F, SEAL_LINE_B, SEAL_ELE_A, SEAL_PARTY_C, 0xFFFF
_020FBB84:
.short ITEM_ULTRA_BALL, ITEM_MAX_REPEL, ITEM_HYPER_POTION, ITEM_MAX_POTION, ITEM_FULL_RESTORE, ITEM_REVIVE, ITEM_FULL_HEAL, 0xFFFF
_020FBB94:
.short SEAL_HEART_A, SEAL_STAR_B, SEAL_FIRE_A, SEAL_SONG_A, SEAL_LINE_C, SEAL_ELE_B, SEAL_PARTY_D, 0xFFFF
_020FBBA4:
.short ITEM_DATA_CARD_25, 2000,
.short ITEM_DATA_CARD_26, 3000
.short ITEM_DATA_CARD_27, 9999
.short 0xFFFF, 0
_020FBBB4:
.short ITEM_X_SPEED, ITEM_X_ATTACK, ITEM_X_DEFENSE, ITEM_GUARD_SPEC_, ITEM_DIRE_HIT, ITEM_X_ACCURACY, ITEM_X_SPECIAL, ITEM_X_SP__DEF, 0xFFFF
_020FBBC6:
.short ITEM_X_SPEED, ITEM_X_ATTACK, ITEM_X_DEFENSE, ITEM_GUARD_SPEC_, ITEM_DIRE_HIT, ITEM_X_ACCURACY, ITEM_X_SPECIAL, ITEM_X_SP__DEF, 0xFFFF
_020FBBD8:
.short ITEM_GREAT_BALL, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_ANTIDOTE, ITEM_PARLYZ_HEAL, ITEM_SUPER_REPEL, ITEM_REVIVE, ITEM_AIR_MAIL, 0xFFFF
_020FBBEA:
.short ITEM_POTION, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_ANTIDOTE, ITEM_PARLYZ_HEAL, ITEM_BURN_HEAL, ITEM_ICE_HEAL, ITEM_AWAKENING, ITEM_FULL_HEAL, 0xFFFF
_020FBC02:
.short ITEM_POTION, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_ANTIDOTE, ITEM_PARLYZ_HEAL, ITEM_BURN_HEAL, ITEM_ICE_HEAL, ITEM_AWAKENING, ITEM_FULL_HEAL, 0xFFFF
_020FBC1A:
.short ITEM_POKE_BALL, ITEM_GREAT_BALL, ITEM_ULTRA_BALL, ITEM_ESCAPE_ROPE, ITEM_POKE_DOLL, ITEM_REPEL, ITEM_SUPER_REPEL, ITEM_MAX_REPEL, ITEM_GRASS_MAIL, ITEM_FLAME_MAIL, ITEM_BUBBLE_MAIL, ITEM_SPACE_MAIL, 0xFFFF
_020FBC34:
.short ITEM_TM70, ITEM_TM17, ITEM_TM54, ITEM_TM83, ITEM_TM16, ITEM_TM33, ITEM_TM22, ITEM_TM52, ITEM_TM38, ITEM_TM25, ITEM_TM14, ITEM_TM15, 0xFFFF
_020FBC4E:
.short ITEM_POKE_BALL, ITEM_GREAT_BALL, ITEM_ULTRA_BALL, ITEM_ESCAPE_ROPE, ITEM_POKE_DOLL, ITEM_REPEL, ITEM_SUPER_REPEL, ITEM_MAX_REPEL, ITEM_GRASS_MAIL, ITEM_FLAME_MAIL, ITEM_BUBBLE_MAIL, ITEM_SPACE_MAIL, 0xFFFF
_020FBC68:
.short ITEM_TM21, ITEM_TM27, ITEM_TM87, ITEM_TM78, ITEM_TM12, ITEM_TM41, ITEM_TM20, ITEM_TM28, ITEM_TM76, ITEM_TM55, ITEM_TM72, ITEM_TM79, 0xFFFF
_020FBC82:
.short ITEM_RED_APRICORN, 200
.short ITEM_BLU_APRICORN, 200
.short ITEM_BLK_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_KINGS_ROCK, 3000
.short ITEM_HEART_SCALE, 1000
.short 0xFFFF, 0
_020FBC9E:
.short ITEM_DATA_CARD_19, 500
.short ITEM_DATA_CARD_20, 500
.short ITEM_DATA_CARD_21, 2000
.short ITEM_DATA_CARD_22, 2000
.short ITEM_DATA_CARD_23, 1000
.short ITEM_DATA_CARD_24, 1000
.short 0xFFFF, 0
_020FBCBA:
.short ITEM_DATA_CARD_01, 500
.short ITEM_DATA_CARD_02, 500
.short ITEM_DATA_CARD_03, 1000
.short ITEM_DATA_CARD_04, 1000
.short ITEM_DATA_CARD_05, 500
.short ITEM_DATA_CARD_06, 500
.short 0xFFFF, 0
_020FBCD6:
.short ITEM_RED_APRICORN, 200
.short ITEM_BLU_APRICORN, 200
.short ITEM_GRN_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_MOON_STONE, 3000
.short ITEM_RARE_CANDY, 2000
.short 0xFFFF, 0
_020FBCF2:
.short ITEM_YLW_APRICORN, 200
.short ITEM_PNK_APRICORN, 200
.short ITEM_WHT_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_FIRE_STONE, 2500
.short ITEM_PP_UP, 1000
.short 0xFFFF, 0
_020FBD0E:
.short ITEM_DATA_CARD_07, 1000
.short ITEM_DATA_CARD_08, 1000
.short ITEM_DATA_CARD_09, 1000
.short ITEM_DATA_CARD_10, 1000
.short ITEM_DATA_CARD_11, 1000
.short ITEM_DATA_CARD_12, 1000
.short 0xFFFF, 0
_020FBD2A:
.short ITEM_BLU_APRICORN, 200
.short ITEM_PNK_APRICORN, 200
.short ITEM_BLK_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_WATER_STONE, 2500
.short ITEM_HEART_SCALE, 1000
.short 0xFFFF, 0
_020FBD46:
.short ITEM_YLW_APRICORN, 200
.short ITEM_PNK_APRICORN, 200
.short ITEM_WHT_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_THUNDERSTONE, 2500
.short ITEM_PP_UP, 1000
.short 0xFFFF, 0
_020FBD62:
.short ITEM_RED_APRICORN, 200
.short ITEM_YLW_APRICORN, 200
.short ITEM_GRN_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_METAL_COAT, 2500
.short ITEM_NUGGET, 500
.short 0xFFFF, 0
_020FBD7E:
.short ITEM_GRN_APRICORN, 200
.short ITEM_WHT_APRICORN, 200
.short ITEM_BLK_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_LEAF_STONE, 2500
.short ITEM_RARE_CANDY, 2000
.short 0xFFFF, 0
_020FBD9A:
.short ITEM_DATA_CARD_13, 1500
.short ITEM_DATA_CARD_14, 1500
.short ITEM_DATA_CARD_15, 1500
.short ITEM_DATA_CARD_16, 1000
.short ITEM_DATA_CARD_17, 1000
.short ITEM_DATA_CARD_18, 1000
.short 0xFFFF, 0
_020FBDB6:
.short ITEM_RED_APRICORN, 200
.short ITEM_BLU_APRICORN, 200
.short ITEM_BLK_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_KINGS_ROCK, 3000
.short ITEM_HEART_SCALE, 1000
.short ITEM_FULL_RESTORE, 500
.short ITEM_NUGGET, 500
.short ITEM_SUN_STONE, 3000
.short ITEM_FIRE_STONE, 2500
.short ITEM_SHINY_STONE, 3000
.short ITEM_DAWN_STONE, 3000
.short 0xFFFF, 0
_020FBDEA:
.short ITEM_RED_APRICORN, 200
.short ITEM_BLU_APRICORN, 200
.short ITEM_GRN_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_MOON_STONE, 3000
.short ITEM_RARE_CANDY, 2000
.short ITEM_FULL_RESTORE, 500
.short ITEM_KINGS_ROCK, 3000
.short ITEM_SUN_STONE, 3000
.short ITEM_WATER_STONE, 2500
.short ITEM_SHINY_STONE, 3000
.short ITEM_DUSK_STONE, 3000
.short 0xFFFF, 0
_020FBE1E:
.short ITEM_YLW_APRICORN, 200
.short ITEM_PNK_APRICORN, 200
.short ITEM_WHT_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_FIRE_STONE, 2500
.short ITEM_PP_UP, 1000
.short ITEM_FULL_RESTORE, 500
.short ITEM_METAL_COAT, 2500
.short ITEM_WATER_STONE, 2500
.short ITEM_LEAF_STONE, 2500
.short ITEM_DUSK_STONE, 3000
.short ITEM_DAWN_STONE, 3000
.short 0xFFFF, 0
_020FBE52:
.short ITEM_BLU_APRICORN, 200
.short ITEM_PNK_APRICORN, 200
.short ITEM_BLK_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_WATER_STONE, 2500
.short ITEM_HEART_SCALE, 1000
.short ITEM_FULL_RESTORE, 500
.short ITEM_DRAGON_SCALE, 2500
.short ITEM_THUNDERSTONE, 2500
.short ITEM_MOON_STONE, 3000
.short ITEM_SHINY_STONE, 3000
.short ITEM_DAWN_STONE, 3000
.short 0xFFFF, 0
_020FBE86:
.short ITEM_YLW_APRICORN, 200
.short ITEM_PNK_APRICORN, 200
.short ITEM_WHT_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_THUNDERSTONE, 2500
.short ITEM_PP_UP, 1000
.short ITEM_FULL_RESTORE, 500
.short ITEM_KINGS_ROCK, 3000
.short ITEM_FIRE_STONE, 2500
.short ITEM_LEAF_STONE, 2500
.short ITEM_SHINY_STONE, 3000
.short ITEM_DUSK_STONE, 3000
.short 0xFFFF, 0
_020FBEBA:
.short ITEM_RED_APRICORN, 200
.short ITEM_YLW_APRICORN, 200
.short ITEM_GRN_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_METAL_COAT, 2500
.short ITEM_NUGGET, 500
.short ITEM_FULL_RESTORE, 500
.short ITEM_DRAGON_SCALE, 2500
.short ITEM_WATER_STONE, 2500
.short ITEM_SUN_STONE, 3000
.short ITEM_DUSK_STONE, 3000
.short ITEM_DAWN_STONE, 3000
.short 0xFFFF, 0
_020FBEEE:
.short ITEM_GRN_APRICORN, 200
.short ITEM_WHT_APRICORN, 200
.short ITEM_BLK_APRICORN, 200
.short ITEM_MOOMOO_MILK, 100
.short ITEM_LEAF_STONE, 2500
.short ITEM_RARE_CANDY, 2000
.short ITEM_FULL_RESTORE, 500
.short ITEM_METAL_COAT, 2500
.short ITEM_THUNDERSTONE, 2500
.short ITEM_SHINY_STONE, 3000
.short ITEM_DUSK_STONE, 3000
.short ITEM_DAWN_STONE, 3000
.short 0xFFFF, 0
_020FBF22:
.short ITEM_POKE_BALL, 1
.short ITEM_GREAT_BALL, 3
.short ITEM_ULTRA_BALL, 4
.short ITEM_POTION, 1
.short ITEM_SUPER_POTION, 2
.short ITEM_HYPER_POTION, 4
.short ITEM_MAX_POTION, 5
.short ITEM_FULL_RESTORE, 6
.short ITEM_REVIVE, 3
.short ITEM_ANTIDOTE, 1
.short ITEM_PARLYZ_HEAL, 1
.short ITEM_AWAKENING, 2
.short ITEM_BURN_HEAL, 2
.short ITEM_ICE_HEAL, 2
.short ITEM_FULL_HEAL, 4
.short ITEM_ESCAPE_ROPE, 2
.short ITEM_REPEL, 2
.short ITEM_SUPER_REPEL, 3
.short ITEM_MAX_REPEL, 4
.data
.public _0210F9CC
_0210F9CC:
.word _020FBAE0
.word _020FBAEC
.public _0210F9D4
_0210F9D4:
.word _020FBCBA
.word _020FBD0E
.word _020FBD9A
.word _020FBC9E
.word _020FBBA4
.public _0210F9E8
_0210F9E8:
.word _020FBB94
.word _020FBB24
.word _020FBB34
.word _020FBB44
.word _020FBB54
.word _020FBB64
.word _020FBB74
.public _0210FA04
_0210FA04:
.word _020FBC82
.word _020FBCD6
.word _020FBCF2
.word _020FBD2A
.word _020FBD46
.word _020FBD62
.word _020FBD7E
.word _020FBDB6
.word _020FBDEA
.word _020FBE1E
.word _020FBE52
.word _020FBE86
.word _020FBEBA
.word _020FBEEE
.public _0210FA3C
_0210FA3C:
.word _020FBA54
.word _020FBA78
.word _020FBAB0
.word _020FBBEA
.word _020FBC1A
.word _020FBBB4
.word _020FBAFA
.word _020FBC34
.word _020FBACA
.word _020FBA60
.word _020FBA88
.word _020FBAD4
.word _020FBA80
.word _020FBB84
.word _020FBAC0
.word _020FBA70
.word _020FBA98
.word _020FBA5A
.word _020FBC02
.word _020FBC4E
.word _020FBC68
.word _020FBA68
.word _020FBBC6
.word _020FBB08
.word _020FBA90
.word _020FBAA0
.word _020FBAA8
.word _020FBB16
.word _020FBAB8
.word _020FBBD8
.text
thumb_func_start ScrCmd_MartBuy
ScrCmd_MartBuy: ; 0x02048060
push {r4, r5, r6, r7, lr}
sub sp, #0x8c
add r7, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r7, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
mov r4, #0
add r6, r4, #0
add r5, r4, #0
_0204807C:
add r0, r7, #0
add r0, #0x80
ldr r0, [r0]
ldr r0, [r0, #0xc]
bl Sav2_PlayerData_GetProfileAddr
add r1, r5, #0
bl PlayerProfile_TestBadgeFlag
cmp r0, #1
bne _02048098
add r0, r6, #1
lsl r0, r0, #0x18
lsr r6, r0, #0x18
_02048098:
add r0, r5, #1
lsl r0, r0, #0x18
lsr r5, r0, #0x18
cmp r5, #0x10
blo _0204807C
cmp r6, #8
bhi _020480DC
add r0, r6, r6
add r0, pc
ldrh r0, [r0, #6]
lsl r0, r0, #0x10
asr r0, r0, #0x10
add pc, r0
_020480B2: ; jump table
.short _020480C4 - _020480B2 - 2 ; case 0
.short _020480C8 - _020480B2 - 2 ; case 1
.short _020480C8 - _020480B2 - 2 ; case 2
.short _020480CC - _020480B2 - 2 ; case 3
.short _020480CC - _020480B2 - 2 ; case 4
.short _020480D0 - _020480B2 - 2 ; case 5
.short _020480D0 - _020480B2 - 2 ; case 6
.short _020480D4 - _020480B2 - 2 ; case 7
.short _020480D8 - _020480B2 - 2 ; case 8
_020480C4:
mov r1, #1
b _020480DE
_020480C8:
mov r1, #2
b _020480DE
_020480CC:
mov r1, #3
b _020480DE
_020480D0:
mov r1, #4
b _020480DE
_020480D4:
mov r1, #5
b _020480DE
_020480D8:
mov r1, #6
b _020480DE
_020480DC:
mov r1, #6
_020480DE:
ldr r0, _02048124 ; =_020FBF22
mov r2, #0
add r6, sp, #0xc
_020480E4:
lsl r3, r2, #2
add r5, r0, r3
ldrh r3, [r5, #2]
cmp r1, r3
blt _020480FA
ldrh r5, [r5]
lsl r3, r4, #1
strh r5, [r6, r3]
add r3, r4, #1
lsl r3, r3, #0x18
lsr r4, r3, #0x18
_020480FA:
add r2, r2, #1
lsl r2, r2, #0x18
lsr r2, r2, #0x18
cmp r2, #0x13
blo _020480E4
ldr r1, _02048128 ; =0x0000FFFF
lsl r0, r4, #1
add r2, sp, #0xc
strh r1, [r2, r0]
mov r3, #0
str r3, [sp]
str r3, [sp, #4]
str r3, [sp, #8]
ldr r0, [r7, #0x74]
add r7, #0x80
ldr r1, [r7]
bl ov03_02256D34
mov r0, #1
add sp, #0x8c
pop {r4, r5, r6, r7, pc}
.balign 4, 0
_02048124: .word _020FBF22
_02048128: .word 0x0000FFFF
thumb_func_end ScrCmd_MartBuy
thumb_func_start ScrCmd_MartSell
ScrCmd_MartSell: ; 0x0204812C
push {r3, lr}
sub sp, #0x10
ldr r1, _02048154 ; =0x0000FFFF
add r2, r0, #0
add r0, sp, #0xc
strh r1, [r0]
mov r0, #1
str r0, [sp]
mov r3, #0
str r3, [sp, #4]
str r3, [sp, #8]
ldr r0, [r2, #0x74]
add r2, #0x80
ldr r1, [r2]
add r2, sp, #0xc
bl ov03_02256D34
mov r0, #1
add sp, #0x10
pop {r3, pc}
.balign 4, 0
_02048154: .word 0x0000FFFF
thumb_func_end ScrCmd_MartSell
thumb_func_start ScrCmd_SpecialMartBuy
ScrCmd_SpecialMartBuy: ; 0x02048158
push {r3, r4, lr}
sub sp, #0xc
add r4, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r4, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
mov r3, #0
str r3, [sp]
str r3, [sp, #4]
str r3, [sp, #8]
add r2, r0, #0
ldr r0, [r4, #0x74]
add r4, #0x80
ldr r1, [r4]
lsl r4, r2, #2
ldr r2, _02048190 ; =_0210FA3C
ldr r2, [r2, r4]
bl ov03_02256D34
mov r0, #1
add sp, #0xc
pop {r3, r4, pc}
nop
_02048190: .word _0210FA3C
thumb_func_end ScrCmd_SpecialMartBuy
; Sinnoh leftover, unused in HGSS
thumb_func_start ScrCmd_DecorationMart
ScrCmd_DecorationMart: ; 0x02048194
push {r3, r4, lr}
sub sp, #0xc
add r4, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r4, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
add r2, r0, #0
cmp r2, #1
bhi _020481B4
mov r1, #1
b _020481B6
_020481B4:
mov r1, #0
_020481B6:
mov r0, #0
str r0, [sp]
str r1, [sp, #4]
lsl r3, r2, #2
str r0, [sp, #8]
ldr r2, _020481D8 ; =_0210F9CC
ldr r0, [r4, #0x74]
add r4, #0x80
ldr r2, [r2, r3]
ldr r1, [r4]
mov r3, #1
bl ov03_02256D34
mov r0, #1
add sp, #0xc
pop {r3, r4, pc}
nop
_020481D8: .word _0210F9CC
thumb_func_end ScrCmd_DecorationMart
thumb_func_start ScrCmd_SealMart
ScrCmd_SealMart: ; 0x020481DC
push {r3, r4, lr}
sub sp, #0xc
add r4, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r4, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
add r2, r0, #0
mov r0, #0
str r0, [sp]
str r0, [sp, #4]
lsl r3, r2, #2
str r0, [sp, #8]
ldr r2, _02048214 ; =_0210F9E8
ldr r0, [r4, #0x74]
add r4, #0x80
ldr r2, [r2, r3]
ldr r1, [r4]
mov r3, #2
bl ov03_02256D34
mov r0, #1
add sp, #0xc
pop {r3, r4, pc}
.balign 4, 0
_02048214: .word _0210F9E8
thumb_func_end ScrCmd_SealMart

View File

@ -1,236 +0,0 @@
.include "asm/macros.inc"
.include "global.inc"
.public _0210F9CC
.public _0210F9D4
.public _0210F9E8
.public _0210FA04
.text
thumb_func_start ScrCmd_771
ScrCmd_771: ; 0x02048218
push {r3, r4, lr}
sub sp, #0x1c
add r4, r0, #0
add r0, #0x80
ldr r0, [r0]
ldr r0, [r0, #0xc]
bl SavArray_Flags_get
add r0, sp, #0xc
bl GF_RTC_CopyDate
add r0, r4, #0
add r0, #0x80
ldr r0, [r0]
ldr r0, [r0, #0xc]
bl Sav2_Pokedex_get
bl Pokedex_GetNatDexFlag
cmp r0, #0
beq _02048268
ldr r2, [sp, #0x18]
mov r0, #0
str r0, [sp]
str r0, [sp, #4]
add r0, r2, #7
lsl r1, r0, #2
ldr r0, _02048290 ; =_0210FA04
lsl r3, r2, #2
ldr r0, [r0, r1]
ldr r2, _02048294 ; =_0210F9CC
str r0, [sp, #8]
ldr r0, [r4, #0x74]
add r4, #0x80
ldr r2, [r2, r3]
ldr r1, [r4]
mov r3, #3
bl ov03_02256D34
b _02048288
_02048268:
ldr r0, [sp, #0x18]
ldr r3, _02048294 ; =_0210F9CC
lsl r2, r0, #2
mov r0, #0
str r0, [sp]
str r0, [sp, #4]
ldr r0, _02048290 ; =_0210FA04
ldr r0, [r0, r2]
str r0, [sp, #8]
ldr r0, [r4, #0x74]
add r4, #0x80
ldr r2, [r3, r2]
ldr r1, [r4]
mov r3, #3
bl ov03_02256D34
_02048288:
mov r0, #1
add sp, #0x1c
pop {r3, r4, pc}
nop
_02048290: .word _0210FA04
_02048294: .word _0210F9CC
thumb_func_end ScrCmd_771
thumb_func_start ScrCmd_772
ScrCmd_772: ; 0x02048298
push {r3, r4, r5, r6, lr}
sub sp, #0xc
add r6, r0, #0
add r0, #0x80
ldr r0, [r0]
ldr r0, [r0, #0xc]
bl Save_Pokeathlon_get
add r4, r0, #0
mov r5, #0
_020482AC:
add r0, r4, #0
add r1, r5, #0
bl sub_02031A78
cmp r0, #0
beq _020482BE
add r5, r5, #1
cmp r5, #0x1b
blt _020482AC
_020482BE:
add r0, r5, #0
mov r1, #6
bl _s32_div_f
mov r1, #0
str r1, [sp]
str r1, [sp, #4]
lsl r1, r0, #2
ldr r0, _020482EC ; =_0210F9D4
ldr r2, _020482F0 ; =_0210F9CC
ldr r0, [r0, r1]
mov r3, #4
str r0, [sp, #8]
ldr r0, [r6, #0x74]
add r6, #0x80
ldr r1, [r6]
ldr r2, [r2]
bl ov03_02256D34
mov r0, #1
add sp, #0xc
pop {r3, r4, r5, r6, pc}
nop
_020482EC: .word _0210F9D4
_020482F0: .word _0210F9CC
thumb_func_end ScrCmd_772
thumb_func_start ScrCmd_834
ScrCmd_834: ; 0x020482F4
push {r4, r5, r6, r7, lr}
sub sp, #0x14
add r5, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
bl GetVarPointer
str r0, [sp]
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
ldr r0, [r0, #0xc]
bl Save_Pokeathlon_get
add r7, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
mov r6, #0
ldr r0, [r0, #0xc]
add r4, r6, #0
bl SavArray_Flags_get
add r0, sp, #4
bl GF_RTC_CopyDate
add r5, #0x80
ldr r0, [r5]
ldr r0, [r0, #0xc]
bl Sav2_Pokedex_get
bl Pokedex_GetNatDexFlag
cmp r0, #0
beq _0204834C
ldr r0, [sp, #0x10]
add r0, r0, #7
lsl r1, r0, #2
ldr r0, _02048394 ; =_0210FA04
b _02048352
_0204834C:
ldr r0, [sp, #0x10]
lsl r1, r0, #2
ldr r0, _02048394 ; =_0210FA04
_02048352:
ldr r3, [r0, r1]
ldr r0, _02048398 ; =0x0000FFFF
mov r2, #0
_02048358:
ldrh r1, [r3]
cmp r1, r0
beq _02048368
add r2, r2, #1
add r6, r6, #1
add r3, r3, #4
cmp r2, #0xc
blt _02048358
_02048368:
mov r5, #0
_0204836A:
add r0, r7, #0
add r1, r5, #0
bl sub_02031AB8
cmp r0, #0
beq _02048378
add r4, r4, #1
_02048378:
add r5, r5, #1
cmp r5, #0xc
blt _0204836A
cmp r6, r4
bgt _02048388
mov r1, #0
ldr r0, [sp]
b _0204838C
_02048388:
ldr r0, [sp]
mov r1, #1
_0204838C:
strh r1, [r0]
mov r0, #0
add sp, #0x14
pop {r4, r5, r6, r7, pc}
.balign 4, 0
_02048394: .word _0210FA04
_02048398: .word 0x0000FFFF
thumb_func_end ScrCmd_834
thumb_func_start ScrCmd_835
ScrCmd_835: ; 0x0204839C
push {r4, r5, r6, lr}
add r4, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r4, #0
add r0, #0x80
ldr r0, [r0]
bl GetVarPointer
add r4, #0x80
add r6, r0, #0
ldr r0, [r4]
ldr r0, [r0, #0xc]
bl Save_Pokeathlon_get
add r5, r0, #0
mov r4, #0
_020483C0:
add r0, r5, #0
add r1, r4, #0
bl sub_02031A78
cmp r0, #0
beq _020483D2
add r4, r4, #1
cmp r4, #0x1b
blt _020483C0
_020483D2:
strh r4, [r6]
mov r0, #0
pop {r4, r5, r6, pc}
thumb_func_end ScrCmd_835

View File

@ -6290,7 +6290,7 @@
.public ov03_02256C84
.public ov03_02256CB4
.public ov03_02256D18
.public ov03_02256D34
.public InitMartUI
.public ov03_02256E2C
.public ov03_0225706C
.public ov03_02257074

13
include/mart.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef POKEHEARTGOLD_MART_H
#define POKEHEARTGOLD_MART_H
#include "script.h"
struct MartItem {
u16 item_id;
u16 cost;
};
void InitMartUI(TaskManager *taskManager, FieldSystem *fsys, const u16 *items, int kind, int buy_sell, int deco_which, const struct MartItem *price_overrides);
#endif //POKEHEARTGOLD_MART_H

12
include/save_pokeathlon.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef POKEHEARTGOLD_SAVE_POKEATHLON_H
#define POKEHEARTGOLD_SAVE_POKEATHLON_H
#include "save.h"
typedef struct POKEATHLON_SAV POKEATHLON_SAV;
POKEATHLON_SAV *Save_Pokeathlon_get(SAVEDATA *saveData);
BOOL sub_02031A78(POKEATHLON_SAV *pokeathlon, int idx);
BOOL sub_02031AB8(POKEATHLON_SAV *pokeathlon, int idx);
#endif //POKEHEARTGOLD_SAVE_POKEATHLON_H

View File

@ -158,8 +158,7 @@ Static main
Object src/fieldmap.o
Object src/scrcmd_c.o
Object asm/scrcmd.o
Object asm/scrcmd_2.o
Object asm/scrcmd_3.o
Object src/scrcmd_mart.o
Object asm/scrcmd_4.o
Object asm/scrcmd_5.o
Object asm/scrcmd_6.o

539
src/scrcmd_mart.c Normal file
View File

@ -0,0 +1,539 @@
#include "scrcmd.h"
#include "mart.h"
#include "event_data.h"
#include "pokedex.h"
#include "save_pokeathlon.h"
#include "constants/items.h"
#include "constants/decorations.h"
#include "constants/seals.h"
struct BadgeMartItems {
u16 item_id;
u16 tier;
};
const struct BadgeMartItems _020FBF22[] = {
{ ITEM_POKE_BALL, 1 },
{ ITEM_GREAT_BALL, 3 },
{ ITEM_ULTRA_BALL, 4 },
{ ITEM_POTION, 1 },
{ ITEM_SUPER_POTION, 2 },
{ ITEM_HYPER_POTION, 4 },
{ ITEM_MAX_POTION, 5 },
{ ITEM_FULL_RESTORE, 6 },
{ ITEM_REVIVE, 3 },
{ ITEM_ANTIDOTE, 1 },
{ ITEM_PARLYZ_HEAL, 1 },
{ ITEM_AWAKENING, 2 },
{ ITEM_BURN_HEAL, 2 },
{ ITEM_ICE_HEAL, 2 },
{ ITEM_FULL_HEAL, 4 },
{ ITEM_ESCAPE_ROPE, 2 },
{ ITEM_REPEL, 2 },
{ ITEM_SUPER_REPEL, 3 },
{ ITEM_MAX_REPEL, 4 },
};
BOOL ScrCmd_MartBuy(SCRIPTCONTEXT *ctx) {
u16 unused;
u8 badge_count;
u8 i;
u8 tier;
u8 nitems;
u16 items[64];
unused = ScriptGetVar(ctx);
nitems = 0;
badge_count = 0;
for (i = 0; i < 16; i++) {
if (PlayerProfile_TestBadgeFlag(Sav2_PlayerData_GetProfileAddr(ctx->fsys->savedata), i) == TRUE) {
badge_count++;
}
}
switch (badge_count) {
case 0:
tier = 1;
break;
case 1:
case 2:
tier = 2;
break;
case 3:
case 4:
tier = 3;
break;
case 5:
case 6:
tier = 4;
break;
case 7:
tier = 5;
break;
case 8:
tier = 6;
break;
default:
tier = 6;
break;
}
for (i = 0; i < NELEMS(_020FBF22); i++) {
if (tier >= _020FBF22[i].tier) {
items[nitems] = _020FBF22[i].item_id;
nitems++;
}
}
items[nitems] = 0xFFFF;
InitMartUI(ctx->taskman, ctx->fsys, items, 0, 0, 0, 0);
return TRUE;
}
BOOL ScrCmd_MartSell(SCRIPTCONTEXT *ctx) {
u16 dummy[1];
dummy[0] = 0xFFFF;
InitMartUI(ctx->taskman, ctx->fsys, dummy, 0, 1, 0, 0);
return TRUE;
}
const u16 _020FBA54[] = {ITEM_AIR_MAIL, ITEM_HEAL_BALL, 0xFFFF};
const u16 _020FBA78[] = {ITEM_TUNNEL_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF};
const u16 _020FBAB0[] = {ITEM_BLOOM_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF};
const u16 _020FBBEA[] = {ITEM_POTION, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_ANTIDOTE, ITEM_PARLYZ_HEAL, ITEM_BURN_HEAL, ITEM_ICE_HEAL, ITEM_AWAKENING, ITEM_FULL_HEAL, 0xFFFF};
const u16 _020FBC1A[] = {ITEM_POKE_BALL, ITEM_GREAT_BALL, ITEM_ULTRA_BALL, ITEM_ESCAPE_ROPE, ITEM_POKE_DOLL, ITEM_REPEL, ITEM_SUPER_REPEL, ITEM_MAX_REPEL, ITEM_GRASS_MAIL, ITEM_FLAME_MAIL, ITEM_BUBBLE_MAIL, ITEM_SPACE_MAIL, 0xFFFF};
const u16 _020FBBB4[] = {ITEM_X_SPEED, ITEM_X_ATTACK, ITEM_X_DEFENSE, ITEM_GUARD_SPEC_, ITEM_DIRE_HIT, ITEM_X_ACCURACY, ITEM_X_SPECIAL, ITEM_X_SP__DEF, 0xFFFF};
const u16 _020FBAFA[] = {ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_ZINC, ITEM_CARBOS, ITEM_HP_UP, 0xFFFF};
const u16 _020FBC34[] = {ITEM_TM70, ITEM_TM17, ITEM_TM54, ITEM_TM83, ITEM_TM16, ITEM_TM33, ITEM_TM22, ITEM_TM52, ITEM_TM38, ITEM_TM25, ITEM_TM14, ITEM_TM15, 0xFFFF};
const u16 _020FBACA[] = {ITEM_HEAL_POWDER, ITEM_ENERGYPOWDER, ITEM_ENERGY_ROOT, ITEM_REVIVAL_HERB, 0xFFFF};
const u16 _020FBA60[] = {ITEM_AIR_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF};
const u16 _020FBA88[] = {ITEM_HEART_MAIL, ITEM_HEAL_BALL, ITEM_NET_BALL, 0xFFFF};
const u16 _020FBAD4[] = {ITEM_POTION, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_FULL_HEAL, ITEM_REVIVE, 0xFFFF};
const u16 _020FBA80[] = {ITEM_AIR_MAIL, ITEM_NET_BALL, ITEM_DUSK_BALL, 0xFFFF};
const u16 _020FBB84[] = {ITEM_ULTRA_BALL, ITEM_MAX_REPEL, ITEM_HYPER_POTION, ITEM_MAX_POTION, ITEM_FULL_RESTORE, ITEM_REVIVE, ITEM_FULL_HEAL, 0xFFFF};
const u16 _020FBAC0[] = {ITEM_AIR_MAIL, ITEM_NEST_BALL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF};
const u16 _020FBA70[] = {ITEM_AIR_MAIL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF};
const u16 _020FBA98[] = {ITEM_SNOW_MAIL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF};
const u16 _020FBA5A[] = {ITEM_AIR_MAIL, ITEM_QUICK_BALL, 0xFFFF};
const u16 _020FBC02[] = {ITEM_POTION, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_ANTIDOTE, ITEM_PARLYZ_HEAL, ITEM_BURN_HEAL, ITEM_ICE_HEAL, ITEM_AWAKENING, ITEM_FULL_HEAL, 0xFFFF};
const u16 _020FBC4E[] = {ITEM_POKE_BALL, ITEM_GREAT_BALL, ITEM_ULTRA_BALL, ITEM_ESCAPE_ROPE, ITEM_POKE_DOLL, ITEM_REPEL, ITEM_SUPER_REPEL, ITEM_MAX_REPEL, ITEM_GRASS_MAIL, ITEM_FLAME_MAIL, ITEM_BUBBLE_MAIL, ITEM_SPACE_MAIL, 0xFFFF};
const u16 _020FBC68[] = {ITEM_TM21, ITEM_TM27, ITEM_TM87, ITEM_TM78, ITEM_TM12, ITEM_TM41, ITEM_TM20, ITEM_TM28, ITEM_TM76, ITEM_TM55, ITEM_TM72, ITEM_TM79, 0xFFFF};
const u16 _020FBA68[] = {ITEM_AIR_MAIL, ITEM_TUNNEL_MAIL, ITEM_BLOOM_MAIL, 0xFFFF};
const u16 _020FBBC6[] = {ITEM_X_SPEED, ITEM_X_ATTACK, ITEM_X_DEFENSE, ITEM_GUARD_SPEC_, ITEM_DIRE_HIT, ITEM_X_ACCURACY, ITEM_X_SPECIAL, ITEM_X_SP__DEF, 0xFFFF};
const u16 _020FBB08[] = {ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_ZINC, ITEM_CARBOS, ITEM_HP_UP, 0xFFFF};
const u16 _020FBA90[] = {ITEM_STEEL_MAIL, ITEM_DUSK_BALL, ITEM_QUICK_BALL, 0xFFFF};
const u16 _020FBAA0[] = {ITEM_STEEL_MAIL, ITEM_NEST_BALL, ITEM_QUICK_BALL, 0xFFFF};
const u16 _020FBAA8[] = {ITEM_STEEL_MAIL, ITEM_NET_BALL, ITEM_HEAL_BALL, 0xFFFF};
const u16 _020FBB16[] = {ITEM_POKE_DOLL, ITEM_FRESH_WATER, ITEM_SODA_POP, ITEM_LEMONADE, ITEM_REPEL, ITEM_HEART_MAIL, 0xFFFF};
const u16 _020FBAB8[] = {ITEM_TINYMUSHROOM, ITEM_POKE_BALL, ITEM_POTION, 0xFFFF};
const u16 _020FBBD8[] = {ITEM_GREAT_BALL, ITEM_SUPER_POTION, ITEM_HYPER_POTION, ITEM_ANTIDOTE, ITEM_PARLYZ_HEAL, ITEM_SUPER_REPEL, ITEM_REVIVE, ITEM_AIR_MAIL, 0xFFFF};
const u16 *_0210FA3C[] = {
_020FBA54,
_020FBA78,
_020FBAB0,
_020FBBEA,
_020FBC1A,
_020FBBB4,
_020FBAFA,
_020FBC34,
_020FBACA,
_020FBA60,
_020FBA88,
_020FBAD4,
_020FBA80,
_020FBB84,
_020FBAC0,
_020FBA70,
_020FBA98,
_020FBA5A,
_020FBC02,
_020FBC4E,
_020FBC68,
_020FBA68,
_020FBBC6,
_020FBB08,
_020FBA90,
_020FBAA0,
_020FBAA8,
_020FBB16,
_020FBAB8,
_020FBBD8,
};
BOOL ScrCmd_SpecialMartBuy(SCRIPTCONTEXT *ctx) {
u16 which;
which = ScriptGetVar(ctx);
InitMartUI(ctx->taskman, ctx->fsys, _0210FA3C[which], 0, 0, 0, NULL);
return TRUE;
}
// Sinnoh leftover, unused in HGSS
const u16 _020FBAE0[] = {
DECORATION_YELLOW_CUSHION, DECORATION_CUPBOARD, DECORATION_TV, DECORATION_REFRIGERATOR, DECORATION_PRETTY_SINK, 0xFFFF
};
const u16 _020FBAEC[] = {
DECORATION_MUNCHLAX_DOLL, DECORATION_BONSLY_DOLL, DECORATION_MIME_JR__DOLL, DECORATION_MANTYKE_DOLL, DECORATION_BUIZEL_DOLL, DECORATION_CHATOT_DOLL, 0xFFFF
};
const u16 *_0210F9CC[] = {
_020FBAE0,
_020FBAEC,
};
BOOL ScrCmd_DecorationMart(SCRIPTCONTEXT *ctx) {
u16 which;
which = ScriptGetVar(ctx);
InitMartUI(ctx->taskman, ctx->fsys, _0210F9CC[which], 1, 0, which <= 1 ? 1 : 0, NULL);
return TRUE;
}
const u16 _020FBB94[] = {SEAL_HEART_A, SEAL_STAR_B, SEAL_FIRE_A, SEAL_SONG_A, SEAL_LINE_C, SEAL_ELE_B, SEAL_PARTY_D, 0xFFFF};
const u16 _020FBB24[] = {SEAL_HEART_B, SEAL_STAR_C, SEAL_FIRE_B, SEAL_FLORA_A, SEAL_SONG_B, SEAL_LINE_D, SEAL_ELE_C, 0xFFFF};
const u16 _020FBB34[] = {SEAL_HEART_C, SEAL_STAR_D, SEAL_FIRE_C, SEAL_FLORA_B, SEAL_SONG_C, SEAL_SMOKE_A, SEAL_ELE_D, 0xFFFF};
const u16 _020FBB44[] = {SEAL_HEART_D, SEAL_FOAMY_A, SEAL_FIRE_D, SEAL_FLORA_C, SEAL_SONG_D, SEAL_STAR_E, SEAL_SMOKE_B, 0xFFFF};
const u16 _020FBB54[] = {SEAL_FOAMY_B, SEAL_PARTY_A, SEAL_FLORA_D, SEAL_SONG_E, SEAL_HEART_E, SEAL_STAR_F, SEAL_SMOKE_C, 0xFFFF};
const u16 _020FBB64[] = {SEAL_FOAMY_C, SEAL_PARTY_B, SEAL_FLORA_E, SEAL_SONG_F, SEAL_HEART_F, SEAL_LINE_A, SEAL_SMOKE_D, 0xFFFF};
const u16 _020FBB74[] = {SEAL_STAR_A, SEAL_SONG_G, SEAL_FOAMY_D, SEAL_FLORA_F, SEAL_LINE_B, SEAL_ELE_A, SEAL_PARTY_C, 0xFFFF};
const u16 *_0210F9E8[] = {
_020FBB94,
_020FBB24,
_020FBB34,
_020FBB44,
_020FBB54,
_020FBB64,
_020FBB74,
};
BOOL ScrCmd_SealMart(SCRIPTCONTEXT *ctx) {
u16 which;
which = ScriptGetVar(ctx);
InitMartUI(ctx->taskman, ctx->fsys, _0210F9E8[which], 2, 0, 0, NULL);
return TRUE;
}
const struct MartItem _020FBCD6[] = {
{ITEM_RED_APRICORN, 200},
{ITEM_BLU_APRICORN, 200},
{ITEM_GRN_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_MOON_STONE, 3000},
{ITEM_RARE_CANDY, 2000},
{0xFFFF, 0},
};
const struct MartItem _020FBCF2[] = {
{ITEM_YLW_APRICORN, 200},
{ITEM_PNK_APRICORN, 200},
{ITEM_WHT_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_FIRE_STONE, 2500},
{ITEM_PP_UP, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBD2A[] = {
{ITEM_BLU_APRICORN, 200},
{ITEM_PNK_APRICORN, 200},
{ITEM_BLK_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_WATER_STONE, 2500},
{ITEM_HEART_SCALE, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBD46[] = {
{ITEM_YLW_APRICORN, 200},
{ITEM_PNK_APRICORN, 200},
{ITEM_WHT_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_THUNDERSTONE, 2500},
{ITEM_PP_UP, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBD62[] = {
{ITEM_RED_APRICORN, 200},
{ITEM_YLW_APRICORN, 200},
{ITEM_GRN_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_METAL_COAT, 2500},
{ITEM_NUGGET, 500},
{0xFFFF, 0},
};
const struct MartItem _020FBD7E[] = {
{ITEM_GRN_APRICORN, 200},
{ITEM_WHT_APRICORN, 200},
{ITEM_BLK_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_LEAF_STONE, 2500},
{ITEM_RARE_CANDY, 2000},
{0xFFFF, 0},
};
const struct MartItem _020FBC82[] = {
{ITEM_RED_APRICORN, 200},
{ITEM_BLU_APRICORN, 200},
{ITEM_BLK_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_KINGS_ROCK, 3000},
{ITEM_HEART_SCALE, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBDB6[] = {
{ITEM_RED_APRICORN, 200},
{ITEM_BLU_APRICORN, 200},
{ITEM_BLK_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_KINGS_ROCK, 3000},
{ITEM_HEART_SCALE, 1000},
{ITEM_FULL_RESTORE, 500},
{ITEM_NUGGET, 500},
{ITEM_SUN_STONE, 3000},
{ITEM_FIRE_STONE, 2500},
{ITEM_SHINY_STONE, 3000},
{ITEM_DAWN_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem _020FBDEA[] = {
{ITEM_RED_APRICORN, 200},
{ITEM_BLU_APRICORN, 200},
{ITEM_GRN_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_MOON_STONE, 3000},
{ITEM_RARE_CANDY, 2000},
{ITEM_FULL_RESTORE, 500},
{ITEM_KINGS_ROCK, 3000},
{ITEM_SUN_STONE, 3000},
{ITEM_WATER_STONE, 2500},
{ITEM_SHINY_STONE, 3000},
{ITEM_DUSK_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem _020FBE1E[] = {
{ITEM_YLW_APRICORN, 200},
{ITEM_PNK_APRICORN, 200},
{ITEM_WHT_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_FIRE_STONE, 2500},
{ITEM_PP_UP, 1000},
{ITEM_FULL_RESTORE, 500},
{ITEM_METAL_COAT, 2500},
{ITEM_WATER_STONE, 2500},
{ITEM_LEAF_STONE, 2500},
{ITEM_DUSK_STONE, 3000},
{ITEM_DAWN_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem _020FBE52[] = {
{ITEM_BLU_APRICORN, 200},
{ITEM_PNK_APRICORN, 200},
{ITEM_BLK_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_WATER_STONE, 2500},
{ITEM_HEART_SCALE, 1000},
{ITEM_FULL_RESTORE, 500},
{ITEM_DRAGON_SCALE, 2500},
{ITEM_THUNDERSTONE, 2500},
{ITEM_MOON_STONE, 3000},
{ITEM_SHINY_STONE, 3000},
{ITEM_DAWN_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem _020FBE86[] = {
{ITEM_YLW_APRICORN, 200},
{ITEM_PNK_APRICORN, 200},
{ITEM_WHT_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_THUNDERSTONE, 2500},
{ITEM_PP_UP, 1000},
{ITEM_FULL_RESTORE, 500},
{ITEM_KINGS_ROCK, 3000},
{ITEM_FIRE_STONE, 2500},
{ITEM_LEAF_STONE, 2500},
{ITEM_SHINY_STONE, 3000},
{ITEM_DUSK_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem _020FBEBA[] = {
{ITEM_RED_APRICORN, 200},
{ITEM_YLW_APRICORN, 200},
{ITEM_GRN_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_METAL_COAT, 2500},
{ITEM_NUGGET, 500},
{ITEM_FULL_RESTORE, 500},
{ITEM_DRAGON_SCALE, 2500},
{ITEM_WATER_STONE, 2500},
{ITEM_SUN_STONE, 3000},
{ITEM_DUSK_STONE, 3000},
{ITEM_DAWN_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem _020FBEEE[] = {
{ITEM_GRN_APRICORN, 200},
{ITEM_WHT_APRICORN, 200},
{ITEM_BLK_APRICORN, 200},
{ITEM_MOOMOO_MILK, 100},
{ITEM_LEAF_STONE, 2500},
{ITEM_RARE_CANDY, 2000},
{ITEM_FULL_RESTORE, 500},
{ITEM_METAL_COAT, 2500},
{ITEM_THUNDERSTONE, 2500},
{ITEM_SHINY_STONE, 3000},
{ITEM_DUSK_STONE, 3000},
{ITEM_DAWN_STONE, 3000},
{0xFFFF, 0},
};
const struct MartItem *_0210FA04[] = {
_020FBC82,
_020FBCD6,
_020FBCF2,
_020FBD2A,
_020FBD46,
_020FBD62,
_020FBD7E,
_020FBDB6,
_020FBDEA,
_020FBE1E,
_020FBE52,
_020FBE86,
_020FBEBA,
_020FBEEE,
};
BOOL ScrCmd_771(SCRIPTCONTEXT *ctx) {
SCRIPT_STATE *flagsys;
RTCDate date;
flagsys = SavArray_Flags_get(ctx->fsys->savedata);
GF_RTC_CopyDate(&date);
// UB: Possibly illegal access to _0210F9CC between Tuesday and Saturday, inclusive
if (Pokedex_GetNatDexFlag(Sav2_Pokedex_get(ctx->fsys->savedata))) {
InitMartUI(ctx->taskman, ctx->fsys, _0210F9CC[date.week], 3, 0, 0, _0210FA04[date.week + 7]);
} else {
InitMartUI(ctx->taskman, ctx->fsys, _0210F9CC[date.week], 3, 0, 0, _0210FA04[date.week]);
}
return TRUE;
}
const struct MartItem _020FBCBA[] = {
{ITEM_DATA_CARD_01, 500},
{ITEM_DATA_CARD_02, 500},
{ITEM_DATA_CARD_03, 1000},
{ITEM_DATA_CARD_04, 1000},
{ITEM_DATA_CARD_05, 500},
{ITEM_DATA_CARD_06, 500},
{0xFFFF, 0},
};
const struct MartItem _020FBD0E[] = {
{ITEM_DATA_CARD_07, 1000},
{ITEM_DATA_CARD_08, 1000},
{ITEM_DATA_CARD_09, 1000},
{ITEM_DATA_CARD_10, 1000},
{ITEM_DATA_CARD_11, 1000},
{ITEM_DATA_CARD_12, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBD9A[] = {
{ITEM_DATA_CARD_13, 1500},
{ITEM_DATA_CARD_14, 1500},
{ITEM_DATA_CARD_15, 1500},
{ITEM_DATA_CARD_16, 1000},
{ITEM_DATA_CARD_17, 1000},
{ITEM_DATA_CARD_18, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBC9E[] = {
{ITEM_DATA_CARD_19, 500},
{ITEM_DATA_CARD_20, 500},
{ITEM_DATA_CARD_21, 2000},
{ITEM_DATA_CARD_22, 2000},
{ITEM_DATA_CARD_23, 1000},
{ITEM_DATA_CARD_24, 1000},
{0xFFFF, 0},
};
const struct MartItem _020FBBA4[] = {
{ITEM_DATA_CARD_25, 2000},
{ITEM_DATA_CARD_26, 3000},
{ITEM_DATA_CARD_27, 9999},
{0xFFFF, 0},
};
const struct MartItem *_0210F9D4[] = {
_020FBCBA,
_020FBD0E,
_020FBD9A,
_020FBC9E,
_020FBBA4,
};
BOOL ScrCmd_772(SCRIPTCONTEXT *ctx) {
POKEATHLON_SAV *pokeathlon;
int i;
pokeathlon = Save_Pokeathlon_get(ctx->fsys->savedata);
for (i = 0; i < 27; i++) {
if (!sub_02031A78(pokeathlon, i)) {
break;
}
}
InitMartUI(ctx->taskman, ctx->fsys, _0210F9CC[0], 4, 0, 0, _0210F9D4[i / 6]);
return TRUE;
}
BOOL ScrCmd_834(SCRIPTCONTEXT *ctx) {
u16 *sp0;
POKEATHLON_SAV *pokeathlon;
SCRIPT_STATE *scriptState;
int r6;
int r4;
RTCDate date;
const struct MartItem *r3;
int i;
sp0 = ScriptGetVarPointer(ctx);
pokeathlon = Save_Pokeathlon_get(ctx->fsys->savedata);
r6 = 0;
r4 = 0;
scriptState = SavArray_Flags_get(ctx->fsys->savedata);
GF_RTC_CopyDate(&date);
if (Pokedex_GetNatDexFlag(Sav2_Pokedex_get(ctx->fsys->savedata))) {
r3 = _0210FA04[date.week + 7];
} else {
r3 = _0210FA04[date.week];
}
for (i = 0; i < 12; i++) {
if (r3[i].item_id == 0xFFFF) {
break;
}
r6++;
}
for (i = 0; i < 12; i++) {
if (sub_02031AB8(pokeathlon, i)) {
r4++;
}
}
if (r6 <= r4) {
*sp0 = FALSE;
} else {
*sp0 = TRUE;
}
return FALSE;
}
BOOL ScrCmd_835(SCRIPTCONTEXT *ctx) {
u16 *ret_ptr;
int i;
POKEATHLON_SAV *pokeathlon;
ret_ptr = ScriptGetVarPointer(ctx);
pokeathlon = Save_Pokeathlon_get(ctx->fsys->savedata);
for (i = 0; i < 27; i++) {
if (!sub_02031A78(pokeathlon, i)) {
break;
}
}
*ret_ptr = i;
return FALSE;
}