Dump items and start decomp item_use

This commit is contained in:
PikalaxALT 2019-06-19 18:03:24 -04:00
parent caa193364b
commit 7eeba327bd
32 changed files with 31611 additions and 1056 deletions

View File

@ -46,6 +46,7 @@ PREPROC := tools/preproc/preproc
RAMSCRGEN := tools/ramscrgen/ramscrgen
FIX := tools/gbafix/gbafix
MAPJSON := tools/mapjson/mapjson
JSONPROC := tools/jsonproc/jsonproc
# Clear the default suffixes
.SUFFIXES:
@ -103,6 +104,7 @@ tools:
@$(MAKE) -C tools/mid2agb
@$(MAKE) -C tools/gbafix
@$(MAKE) -C tools/mapjson
@$(MAKE) -C tools/jsonproc
# For contributors to make sure a change didn't affect the contents of the ROM.
compare: rom
@ -126,6 +128,7 @@ clean: tidy
@$(MAKE) clean -C tools/mid2agb
@$(MAKE) clean -C tools/gbafix
@$(MAKE) clean -C tools/mapjson
@$(MAKE) clean -C tools/jsonproc
tidy:
rm -f $(ROM) $(ELF) $(MAP)
@ -135,6 +138,7 @@ tidy:
include graphics_file_rules.mk
include tileset_rules.mk
include map_data_rules.mk
include json_data_rules.mk
%.s: ;
%.png: ;

View File

@ -5,608 +5,6 @@
.text
thumb_func_start sub_80A0FBC
sub_80A0FBC: @ 80A0FBC
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r1, _080A0FD8 @ =gSpecialVar_ItemId
ldrh r0, [r1]
cmp r0, 0xAF
bne _080A0FE0
ldr r0, _080A0FDC @ =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldrb r0, [r1, 0x10]
b _080A0FE6
.align 2, 0
_080A0FD8: .4byte gSpecialVar_ItemId
_080A0FDC: .4byte gTasks
_080A0FE0:
ldrh r0, [r1]
bl ItemId_GetType
_080A0FE6:
subs r0, 0x1
lsls r0, 24
lsrs r4, r0, 24
ldr r0, _080A1010 @ =gSpecialVar_ItemId
ldrh r0, [r0]
bl GetPocketByItemId
lsls r0, 24
lsrs r0, 24
cmp r0, 0x5
bne _080A1018
ldr r0, _080A1014 @ =gUnknown_83E2954
lsls r1, r4, 2
adds r1, r0
ldr r0, [r1]
bl sub_813D934
adds r0, r5, 0
bl sub_813D808
b _080A1032
.align 2, 0
_080A1010: .4byte gSpecialVar_ItemId
_080A1014: .4byte gUnknown_83E2954
_080A1018:
ldr r0, _080A1038 @ =gUnknown_83E2954
lsls r1, r4, 2
adds r1, r0
ldr r0, [r1]
bl sub_8108EE0
cmp r4, 0x1
bne _080A102C
bl sub_8108CB4
_080A102C:
adds r0, r5, 0
bl sub_8108B50
_080A1032:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_080A1038: .4byte gUnknown_83E2954
thumb_func_end sub_80A0FBC
thumb_func_start sub_80A103C
sub_80A103C: @ 80A103C
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r1, _080A1064 @ =gTasks
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r0, r1
movs r1, 0xE
ldrsh r0, [r0, r1]
cmp r0, 0x1
beq _080A1070
ldr r1, _080A1068 @ =gFieldCallback
ldr r0, _080A106C @ =sub_80A1084
str r0, [r1]
adds r0, r2, 0
bl sub_80A0FBC
b _080A107A
.align 2, 0
_080A1064: .4byte gTasks
_080A1068: .4byte gFieldCallback
_080A106C: .4byte sub_80A1084
_080A1070:
ldr r0, _080A1080 @ =gUnknown_2039998
ldr r1, [r0]
adds r0, r2, 0
bl _call_via_r1
_080A107A:
pop {r0}
bx r0
.align 2, 0
_080A1080: .4byte gUnknown_2039998
thumb_func_end sub_80A103C
thumb_func_start sub_80A1084
sub_80A1084: @ 80A1084
push {lr}
bl sub_807DC00
ldr r0, _080A1098 @ =sub_80A109C
movs r1, 0x8
bl CreateTask
pop {r0}
bx r0
.align 2, 0
_080A1098: .4byte sub_80A109C
thumb_func_end sub_80A1084
thumb_func_start sub_80A109C
sub_80A109C: @ 80A109C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_807AA70
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _080A10B8
ldr r0, _080A10C0 @ =gUnknown_2039998
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
_080A10B8:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A10C0: .4byte gUnknown_2039998
thumb_func_end sub_80A109C
thumb_func_start sub_80A10C4
sub_80A10C4: @ 80A10C4
push {r4-r7,lr}
adds r4, r1, 0
adds r1, r3, 0
lsls r0, 24
lsrs r7, r0, 24
lsls r4, 24
lsrs r4, 24
lsls r2, 24
lsrs r6, r2, 24
ldr r5, _080A10F0 @ =gStringVar4
adds r0, r5, 0
bl StringExpandPlaceholders
cmp r4, 0
bne _080A10F8
ldr r3, _080A10F4 @ =sub_810A1F8
adds r0, r7, 0
adds r1, r6, 0
adds r2, r5, 0
bl sub_8108E70
b _080A1104
.align 2, 0
_080A10F0: .4byte gStringVar4
_080A10F4: .4byte sub_810A1F8
_080A10F8:
ldr r3, _080A110C @ =sub_80A112C
adds r0, r7, 0
adds r1, r6, 0
adds r2, r5, 0
bl DisplayItemMessageOnField
_080A1104:
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080A110C: .4byte sub_80A112C
thumb_func_end sub_80A10C4
thumb_func_start sub_80A1110
sub_80A1110: @ 80A1110
push {lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
ldr r3, _080A1128 @ =gUnknown_8416425
movs r2, 0x4
bl sub_80A10C4
pop {r0}
bx r0
.align 2, 0
_080A1128: .4byte gUnknown_8416425
thumb_func_end sub_80A1110
thumb_func_start sub_80A112C
sub_80A112C: @ 80A112C
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0
movs r1, 0x1
bl ClearDialogWindowAndFrame
adds r0, r4, 0
bl DestroyTask
bl sub_80696C0
bl ScriptContext2_Disable
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80A112C
thumb_func_start sub_80A1150
sub_80A1150: @ 80A1150
push {r4,lr}
lsls r0, 16
lsrs r4, r0, 16
adds r0, r4, 0
bl ItemId_GetPocket
lsls r0, 24
lsrs r0, 24
cmp r0, 0x4
bne _080A1168
movs r0, 0x1
b _080A117E
_080A1168:
adds r0, r4, 0
bl ItemId_GetFieldFunc
ldr r1, _080A1178 @ =sub_80A1750
cmp r0, r1
beq _080A117C
movs r0, 0
b _080A117E
.align 2, 0
_080A1178: .4byte sub_80A1750
_080A117C:
movs r0, 0x2
_080A117E:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80A1150
thumb_func_start sub_80A1184
sub_80A1184: @ 80A1184
ldr r1, _080A118C @ =gFieldCallback2
ldr r0, _080A1190 @ =sub_80A1194
str r0, [r1]
bx lr
.align 2, 0
_080A118C: .4byte gFieldCallback2
_080A1190: .4byte sub_80A1194
thumb_func_end sub_80A1184
thumb_func_start sub_80A1194
sub_80A1194: @ 80A1194
push {lr}
bl player_bitmagic
bl ScriptContext2_Enable
bl sub_807DC00
ldr r0, _080A11B8 @ =sub_80A11C0
movs r1, 0xA
bl CreateTask
ldr r1, _080A11BC @ =gUnknown_2031DE0
movs r0, 0
strb r0, [r1]
movs r0, 0x1
pop {r1}
bx r1
.align 2, 0
_080A11B8: .4byte sub_80A11C0
_080A11BC: .4byte gUnknown_2031DE0
thumb_func_end sub_80A1194
thumb_func_start sub_80A11C0
sub_80A11C0: @ 80A11C0
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_807AA70
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _080A11E0
bl UnfreezeMapObjects
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
_080A11E0:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80A11C0
thumb_func_start sub_80A11E8
sub_80A11E8: @ 80A11E8
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r0, _080A1204 @ =sub_80A1208
bl sub_8108EE0
adds r0, r4, 0
bl sub_8108B50
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A1204: .4byte sub_80A1208
thumb_func_end sub_80A11E8
thumb_func_start sub_80A1208
sub_80A1208: @ 80A1208
push {lr}
sub sp, 0x24
mov r1, sp
ldr r0, _080A1224 @ =gSpecialVar_ItemId
ldrh r0, [r0]
strh r0, [r1, 0x20]
ldr r1, _080A1228 @ =UseFameCheckerFromMenu
mov r0, sp
movs r2, 0
bl sub_80BEBEC
add sp, 0x24
pop {r0}
bx r0
.align 2, 0
_080A1224: .4byte gSpecialVar_ItemId
_080A1228: .4byte UseFameCheckerFromMenu
thumb_func_end sub_80A1208
thumb_func_start sub_80A122C
sub_80A122C: @ 80A122C
push {r4,r5,lr}
sub sp, 0x4
lsls r0, 24
lsrs r5, r0, 24
mov r4, sp
adds r4, 0x2
mov r0, sp
adds r1, r4, 0
bl PlayerGetDestCoords
mov r0, sp
movs r1, 0
ldrsh r0, [r0, r1]
movs r2, 0
ldrsh r1, [r4, r2]
bl MapGridGetMetatileBehaviorAt
lsls r0, 24
lsrs r4, r0, 24
movs r0, 0x83
lsls r0, 4
bl FlagGet
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080A129A
adds r0, r4, 0
bl MetatileBehavior_ReturnFalse_17
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080A129A
adds r0, r4, 0
bl MetatileBehavior_ReturnFalse_18
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080A129A
adds r0, r4, 0
bl MetatileBehavior_ReturnFalse_15
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080A129A
adds r0, r4, 0
bl MetatileBehavior_ReturnFalse_16
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _080A12BC
_080A129A:
ldr r1, _080A12B4 @ =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
ldrb r1, [r0, 0xE]
ldr r3, _080A12B8 @ =gUnknown_8416451
adds r0, r5, 0
movs r2, 0x2
bl sub_80A10C4
b _080A12F6
.align 2, 0
_080A12B4: .4byte gTasks
_080A12B8: .4byte gUnknown_8416451
_080A12BC:
bl sub_8055C9C
cmp r0, 0x1
bne _080A12E4
bl sub_80BD540
lsls r0, 24
cmp r0, 0
bne _080A12E4
ldr r1, _080A12DC @ =gUnknown_2039998
ldr r0, _080A12E0 @ =sub_80A1304
str r0, [r1]
adds r0, r5, 0
bl sub_80A103C
b _080A12F6
.align 2, 0
_080A12DC: .4byte gUnknown_2039998
_080A12E0: .4byte sub_80A1304
_080A12E4:
ldr r0, _080A1300 @ =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldrb r1, [r1, 0xE]
adds r0, r5, 0
bl sub_80A1110
_080A12F6:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_080A1300: .4byte gTasks
thumb_func_end sub_80A122C
thumb_func_start sub_80A1304
sub_80A1304: @ 80A1304
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
movs r0, 0x6
bl TestPlayerAvatarFlags
lsls r0, 24
cmp r0, 0
bne _080A131C
movs r0, 0xB
bl PlaySE
_080A131C:
movs r0, 0x6
bl sub_80BD5C8
bl sub_80696C0
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80A1304
thumb_func_start sub_80A1338
sub_80A1338: @ 80A1338
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_80A137C
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _080A1360
ldr r1, _080A1358 @ =gUnknown_2039998
ldr r0, _080A135C @ =ItemUseOnFieldCB_Rod
str r0, [r1]
adds r0, r4, 0
bl sub_80A103C
b _080A1372
.align 2, 0
_080A1358: .4byte gUnknown_2039998
_080A135C: .4byte ItemUseOnFieldCB_Rod
_080A1360:
ldr r0, _080A1378 @ =gTasks
lsls r1, r4, 2
adds r1, r4
lsls r1, 3
adds r1, r0
ldrb r1, [r1, 0xE]
adds r0, r4, 0
bl sub_80A1110
_080A1372:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A1378: .4byte gTasks
thumb_func_end sub_80A1338
thumb_func_start sub_80A137C
sub_80A137C: @ 80A137C
push {r4-r6,lr}
sub sp, 0x4
mov r4, sp
adds r4, 0x2
mov r0, sp
adds r1, r4, 0
bl GetXYCoordsOneStepInFrontOfPlayer
mov r0, sp
movs r1, 0
ldrsh r0, [r0, r1]
movs r2, 0
ldrsh r1, [r4, r2]
bl MapGridGetMetatileBehaviorAt
lsls r0, 16
lsrs r6, r0, 16
lsls r0, r6, 24
lsrs r5, r0, 24
adds r0, r5, 0
bl MetatileBehavior_IsWaterfall
lsls r0, 24
cmp r0, 0
bne _080A1404
movs r0, 0x10
bl TestPlayerAvatarFlags
lsls r0, 24
cmp r0, 0
bne _080A1404
movs r0, 0x8
bl TestPlayerAvatarFlags
lsls r0, 24
cmp r0, 0
bne _080A13D4
bl IsPlayerFacingSurfableFishableWater
lsls r0, 24
cmp r0, 0
beq _080A1404
_080A13D0:
movs r0, 0x1
b _080A1406
_080A13D4:
adds r0, r5, 0
bl MetatileBehavior_IsSurfable
lsls r0, 24
cmp r0, 0
beq _080A13F4
mov r0, sp
movs r1, 0
ldrsh r0, [r0, r1]
movs r2, 0
ldrsh r1, [r4, r2]
bl MapGridIsImpassableAt
lsls r0, 24
cmp r0, 0
beq _080A13D0
_080A13F4:
lsls r0, r6, 24
lsrs r0, 24
bl MetatileBehavior_ReturnFalse_6
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080A13D0
_080A1404:
movs r0, 0
_080A1406:
add sp, 0x4
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_80A137C
thumb_func_start ItemUseOnFieldCB_Rod
ItemUseOnFieldCB_Rod: @ 80A1410
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r0, _080A1434 @ =gSpecialVar_ItemId
ldrh r0, [r0]
bl ItemId_GetSecondaryId
lsls r0, 24
lsrs r0, 24
bl sub_805D2C0
adds r0, r4, 0
bl DestroyTask
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A1434: .4byte gSpecialVar_ItemId
thumb_func_end ItemUseOnFieldCB_Rod
thumb_func_start ItemUseOutOfBattle_Itemfinder
ItemUseOutOfBattle_Itemfinder: @ 80A1438
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0x27
bl IncrementGameStat
ldr r1, _080A1458 @ =gUnknown_2039998
ldr r0, _080A145C @ =sub_813EC8C
str r0, [r1]
adds r0, r4, 0
bl sub_80A103C
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A1458: .4byte gUnknown_2039998
_080A145C: .4byte sub_813EC8C
thumb_func_end ItemUseOutOfBattle_Itemfinder
thumb_func_start sub_80A1460
sub_80A1460: @ 80A1460
push {r4,r5,lr}
@ -1534,7 +932,7 @@ ItemUseOutOfBattle_EscapeRope: @ 80A1BAC
movs r0, 0x4
movs r1, 0
bl ItemUse_SetQuestLogEvent
ldr r1, _080A1BE4 @ =gUnknown_2039998
ldr r1, _080A1BE4 @ =sItemUseOnFieldCB
ldr r0, _080A1BE8 @ =sub_80A1C08
str r0, [r1]
adds r0, r4, 0
@ -1543,7 +941,7 @@ ItemUseOutOfBattle_EscapeRope: @ 80A1BAC
.align 2, 0
_080A1BDC: .4byte gSpecialVar_ItemId
_080A1BE0: .4byte gMapHeader
_080A1BE4: .4byte gUnknown_2039998
_080A1BE4: .4byte sItemUseOnFieldCB
_080A1BE8: .4byte sub_80A1C08
_080A1BEC:
ldr r0, _080A1C04 @ =gTasks
@ -1809,7 +1207,7 @@ _080A1DE8: .4byte gMapHeader
_080A1DEC: .4byte gSaveBlock1Ptr
_080A1DF0: .4byte gTasks
_080A1DF4:
ldr r1, _080A1E04 @ =gUnknown_2039998
ldr r1, _080A1E04 @ =sItemUseOnFieldCB
ldr r0, _080A1E08 @ =Task_VsSeeker_0
str r0, [r1]
adds r0, r2, 0
@ -1818,7 +1216,7 @@ _080A1E00:
pop {r0}
bx r0
.align 2, 0
_080A1E04: .4byte gUnknown_2039998
_080A1E04: .4byte sItemUseOnFieldCB
_080A1E08: .4byte Task_VsSeeker_0
thumb_func_end sub_80A1D9C

View File

@ -546,11 +546,9 @@ gUnknown_83D4164:: @ 83D4164
.section .rodata.83D4E4C
gUnknown_83D4E4C::
.incbin "baserom.gba", 0x3D4E54, 0x61D4
gItems:: @ 83DB028
.incbin "baserom.gba", 0x3DB028, 0x4074
.incbin "baserom.gba", 0x3D4E54, 0x78
.section .rodata.83DF09C
gUnknown_83DF09C:: @ 83DF09C
.incbin "baserom.gba", 0x3DF09C, 0x18
@ -780,7 +778,13 @@ gUnknown_83E27AC:: @ 83E27AC
.incbin "baserom.gba", 0x3E27AC, 0x1A8
gUnknown_83E2954:: @ 83E2954
.incbin "baserom.gba", 0x3E2954, 0x134
.4byte sub_8124C8C
.4byte CB2_ReturnToField
.4byte NULL
.4byte NULL
gUnknown_83E2964:: @ 83E2964
.incbin "baserom.gba", 0x3E2964, 0x124
gUnknown_83E2A88:: @ 83E2A88
.incbin "baserom.gba", 0x3E2A88, 0x4F0

View File

@ -341,5 +341,359 @@ gUnknown_84827B4:: @ 84827B4
.include "data/text/move_descriptions.inc"
.align 2, 0
gUnknown_84886E8:: @ 84886E8
.incbin "baserom.gba", 0x4886E8, 0x588
.4byte gMoveDescription_Pound
.4byte gMoveDescription_KarateChop
.4byte gMoveDescription_DoubleSlap
.4byte gMoveDescription_CometPunch
.4byte gMoveDescription_MegaPunch
.4byte gMoveDescription_PayDay
.4byte gMoveDescription_FirePunch
.4byte gMoveDescription_IcePunch
.4byte gMoveDescription_ThunderPunch
.4byte gMoveDescription_Scratch
.4byte gMoveDescription_ViceGrip
.4byte gMoveDescription_Guillotine
.4byte gMoveDescription_RazorWind
.4byte gMoveDescription_SwordsDance
.4byte gMoveDescription_Cut
.4byte gMoveDescription_Gust
.4byte gMoveDescription_WingAttack
.4byte gMoveDescription_Whirlwind
.4byte gMoveDescription_Fly
.4byte gMoveDescription_Bind
.4byte gMoveDescription_Slam
.4byte gMoveDescription_VineWhip
.4byte gMoveDescription_Stomp
.4byte gMoveDescription_DoubleKick
.4byte gMoveDescription_MegaKick
.4byte gMoveDescription_JumpKick
.4byte gMoveDescription_RollingKick
.4byte gMoveDescription_SandAttack
.4byte gMoveDescription_Headbutt
.4byte gMoveDescription_HornAttack
.4byte gMoveDescription_FuryAttack
.4byte gMoveDescription_HornDrill
.4byte gMoveDescription_Tackle
.4byte gMoveDescription_BodySlam
.4byte gMoveDescription_Wrap
.4byte gMoveDescription_TakeDown
.4byte gMoveDescription_Thrash
.4byte gMoveDescription_DoubleEdge
.4byte gMoveDescription_TailWhip
.4byte gMoveDescription_PoisonSting
.4byte gMoveDescription_Twineedle
.4byte gMoveDescription_PinMissile
.4byte gMoveDescription_Leer
.4byte gMoveDescription_Bite
.4byte gMoveDescription_Growl
.4byte gMoveDescription_Roar
.4byte gMoveDescription_Sing
.4byte gMoveDescription_Supersonic
.4byte gMoveDescription_SonicBoom
.4byte gMoveDescription_Disable
.4byte gMoveDescription_Acid
.4byte gMoveDescription_Ember
.4byte gMoveDescription_Flamethrower
.4byte gMoveDescription_Mist
.4byte gMoveDescription_WaterGun
.4byte gMoveDescription_HydroPump
.4byte gMoveDescription_Surf
.4byte gMoveDescription_IceBeam
.4byte gMoveDescription_Blizzard
.4byte gMoveDescription_Psybeam
.4byte gMoveDescription_BubbleBeam
.4byte gMoveDescription_AuroraBeam
.4byte gMoveDescription_HyperBeam
.4byte gMoveDescription_Peck
.4byte gMoveDescription_DrillPeck
.4byte gMoveDescription_Submission
.4byte gMoveDescription_LowKick
.4byte gMoveDescription_Counter
.4byte gMoveDescription_SeismicToss
.4byte gMoveDescription_Strength
.4byte gMoveDescription_Absorb
.4byte gMoveDescription_MegaDrain
.4byte gMoveDescription_LeechSeed
.4byte gMoveDescription_Growth
.4byte gMoveDescription_RazorLeaf
.4byte gMoveDescription_SolarBeam
.4byte gMoveDescription_PoisonPowder
.4byte gMoveDescription_StunSpore
.4byte gMoveDescription_SleepPowder
.4byte gMoveDescription_PetalDance
.4byte gMoveDescription_StringShot
.4byte gMoveDescription_DragonRage
.4byte gMoveDescription_FireSpin
.4byte gMoveDescription_ThunderShock
.4byte gMoveDescription_Thunderbolt
.4byte gMoveDescription_ThunderWave
.4byte gMoveDescription_Thunder
.4byte gMoveDescription_RockThrow
.4byte gMoveDescription_Earthquake
.4byte gMoveDescription_Fissure
.4byte gMoveDescription_Dig
.4byte gMoveDescription_Toxic
.4byte gMoveDescription_Confusion
.4byte gMoveDescription_Psychic
.4byte gMoveDescription_Hypnosis
.4byte gMoveDescription_Meditate
.4byte gMoveDescription_Agility
.4byte gMoveDescription_QuickAttack
.4byte gMoveDescription_Rage
.4byte gMoveDescription_Teleport
.4byte gMoveDescription_NightShade
.4byte gMoveDescription_Mimic
.4byte gMoveDescription_Screech
.4byte gMoveDescription_DoubleTeam
.4byte gMoveDescription_Recover
.4byte gMoveDescription_Harden
.4byte gMoveDescription_Minimize
.4byte gMoveDescription_Smokescreen
.4byte gMoveDescription_ConfuseRay
.4byte gMoveDescription_Withdraw
.4byte gMoveDescription_DefenseCurl
.4byte gMoveDescription_Barrier
.4byte gMoveDescription_LightScreen
.4byte gMoveDescription_Haze
.4byte gMoveDescription_Reflect
.4byte gMoveDescription_FocusEnergy
.4byte gMoveDescription_Bide
.4byte gMoveDescription_Metronome
.4byte gMoveDescription_MirrorMove
.4byte gMoveDescription_SelfDestruct
.4byte gMoveDescription_EggBomb
.4byte gMoveDescription_Lick
.4byte gMoveDescription_Smog
.4byte gMoveDescription_Sludge
.4byte gMoveDescription_BoneClub
.4byte gMoveDescription_FireBlast
.4byte gMoveDescription_Waterfall
.4byte gMoveDescription_Clamp
.4byte gMoveDescription_Swift
.4byte gMoveDescription_SkullBash
.4byte gMoveDescription_SpikeCannon
.4byte gMoveDescription_Constrict
.4byte gMoveDescription_Amnesia
.4byte gMoveDescription_Kinesis
.4byte gMoveDescription_SoftBoiled
.4byte gMoveDescription_HiJumpKick
.4byte gMoveDescription_Glare
.4byte gMoveDescription_DreamEater
.4byte gMoveDescription_PoisonGas
.4byte gMoveDescription_Barrage
.4byte gMoveDescription_LeechLife
.4byte gMoveDescription_LovelyKiss
.4byte gMoveDescription_SkyAttack
.4byte gMoveDescription_Transform
.4byte gMoveDescription_Bubble
.4byte gMoveDescription_DizzyPunch
.4byte gMoveDescription_Spore
.4byte gMoveDescription_Flash
.4byte gMoveDescription_Psywave
.4byte gMoveDescription_Splash
.4byte gMoveDescription_AcidArmor
.4byte gMoveDescription_Crabhammer
.4byte gMoveDescription_Explosion
.4byte gMoveDescription_FurySwipes
.4byte gMoveDescription_Bonemerang
.4byte gMoveDescription_Rest
.4byte gMoveDescription_RockSlide
.4byte gMoveDescription_HyperFang
.4byte gMoveDescription_Sharpen
.4byte gMoveDescription_Conversion
.4byte gMoveDescription_TriAttack
.4byte gMoveDescription_SuperFang
.4byte gMoveDescription_Slash
.4byte gMoveDescription_Substitute
.4byte gMoveDescription_Struggle
.4byte gMoveDescription_Sketch
.4byte gMoveDescription_TripleKick
.4byte gMoveDescription_Thief
.4byte gMoveDescription_SpiderWeb
.4byte gMoveDescription_MindReader
.4byte gMoveDescription_Nightmare
.4byte gMoveDescription_FlameWheel
.4byte gMoveDescription_Snore
.4byte gMoveDescription_Curse
.4byte gMoveDescription_Flail
.4byte gMoveDescription_Conversion2
.4byte gMoveDescription_Aeroblast
.4byte gMoveDescription_CottonSpore
.4byte gMoveDescription_Reversal
.4byte gMoveDescription_Spite
.4byte gMoveDescription_PowderSnow
.4byte gMoveDescription_Protect
.4byte gMoveDescription_MachPunch
.4byte gMoveDescription_ScaryFace
.4byte gMoveDescription_FaintAttack
.4byte gMoveDescription_SweetKiss
.4byte gMoveDescription_BellyDrum
.4byte gMoveDescription_SludgeBomb
.4byte gMoveDescription_MudSlap
.4byte gMoveDescription_Octazooka
.4byte gMoveDescription_Spikes
.4byte gMoveDescription_ZapCannon
.4byte gMoveDescription_Foresight
.4byte gMoveDescription_DestinyBond
.4byte gMoveDescription_PerishSong
.4byte gMoveDescription_IcyWind
.4byte gMoveDescription_Detect
.4byte gMoveDescription_BoneRush
.4byte gMoveDescription_LockOn
.4byte gMoveDescription_Outrage
.4byte gMoveDescription_Sandstorm
.4byte gMoveDescription_GigaDrain
.4byte gMoveDescription_Endure
.4byte gMoveDescription_Charm
.4byte gMoveDescription_Rollout
.4byte gMoveDescription_FalseSwipe
.4byte gMoveDescription_Swagger
.4byte gMoveDescription_MilkDrink
.4byte gMoveDescription_Spark
.4byte gMoveDescription_FuryCutter
.4byte gMoveDescription_SteelWing
.4byte gMoveDescription_MeanLook
.4byte gMoveDescription_Attract
.4byte gMoveDescription_SleepTalk
.4byte gMoveDescription_HealBell
.4byte gMoveDescription_Return
.4byte gMoveDescription_Present
.4byte gMoveDescription_Frustration
.4byte gMoveDescription_Safeguard
.4byte gMoveDescription_PainSplit
.4byte gMoveDescription_SacredFire
.4byte gMoveDescription_Magnitude
.4byte gMoveDescription_DynamicPunch
.4byte gMoveDescription_Megahorn
.4byte gMoveDescription_DragonBreath
.4byte gMoveDescription_BatonPass
.4byte gMoveDescription_Encore
.4byte gMoveDescription_Pursuit
.4byte gMoveDescription_RapidSpin
.4byte gMoveDescription_SweetScent
.4byte gMoveDescription_IronTail
.4byte gMoveDescription_MetalClaw
.4byte gMoveDescription_VitalThrow
.4byte gMoveDescription_MorningSun
.4byte gMoveDescription_Synthesis
.4byte gMoveDescription_Moonlight
.4byte gMoveDescription_HiddenPower
.4byte gMoveDescription_CrossChop
.4byte gMoveDescription_Twister
.4byte gMoveDescription_RainDance
.4byte gMoveDescription_SunnyDay
.4byte gMoveDescription_Crunch
.4byte gMoveDescription_MirrorCoat
.4byte gMoveDescription_PsychUp
.4byte gMoveDescription_ExtremeSpeed
.4byte gMoveDescription_AncientPower
.4byte gMoveDescription_ShadowBall
.4byte gMoveDescription_FutureSight
.4byte gMoveDescription_RockSmash
.4byte gMoveDescription_Whirlpool
.4byte gMoveDescription_BeatUp
.4byte gMoveDescription_FakeOut
.4byte gMoveDescription_Uproar
.4byte gMoveDescription_Stockpile
.4byte gMoveDescription_SpitUp
.4byte gMoveDescription_Swallow
.4byte gMoveDescription_HeatWave
.4byte gMoveDescription_Hail
.4byte gMoveDescription_Torment
.4byte gMoveDescription_Flatter
.4byte gMoveDescription_WillOWisp
.4byte gMoveDescription_Memento
.4byte gMoveDescription_Facade
.4byte gMoveDescription_FocusPunch
.4byte gMoveDescription_SmellingSalt
.4byte gMoveDescription_FollowMe
.4byte gMoveDescription_NaturePower
.4byte gMoveDescription_Charge
.4byte gMoveDescription_Taunt
.4byte gMoveDescription_HelpingHand
.4byte gMoveDescription_Trick
.4byte gMoveDescription_RolePlay
.4byte gMoveDescription_Wish
.4byte gMoveDescription_Assist
.4byte gMoveDescription_Ingrain
.4byte gMoveDescription_Superpower
.4byte gMoveDescription_MagicCoat
.4byte gMoveDescription_Recycle
.4byte gMoveDescription_Revenge
.4byte gMoveDescription_BrickBreak
.4byte gMoveDescription_Yawn
.4byte gMoveDescription_KnockOff
.4byte gMoveDescription_Endeavor
.4byte gMoveDescription_Eruption
.4byte gMoveDescription_SkillSwap
.4byte gMoveDescription_Imprison
.4byte gMoveDescription_Refresh
.4byte gMoveDescription_Grudge
.4byte gMoveDescription_Snatch
.4byte gMoveDescription_SecretPower
.4byte gMoveDescription_Dive
.4byte gMoveDescription_ArmThrust
.4byte gMoveDescription_Camouflage
.4byte gMoveDescription_TailGlow
.4byte gMoveDescription_LusterPurge
.4byte gMoveDescription_MistBall
.4byte gMoveDescription_FeatherDance
.4byte gMoveDescription_TeeterDance
.4byte gMoveDescription_BlazeKick
.4byte gMoveDescription_MudSport
.4byte gMoveDescription_IceBall
.4byte gMoveDescription_NeedleArm
.4byte gMoveDescription_SlackOff
.4byte gMoveDescription_HyperVoice
.4byte gMoveDescription_PoisonFang
.4byte gMoveDescription_CrushClaw
.4byte gMoveDescription_BlastBurn
.4byte gMoveDescription_HydroCannon
.4byte gMoveDescription_MeteorMash
.4byte gMoveDescription_Astonish
.4byte gMoveDescription_WeatherBall
.4byte gMoveDescription_Aromatherapy
.4byte gMoveDescription_FakeTears
.4byte gMoveDescription_AirCutter
.4byte gMoveDescription_Overheat
.4byte gMoveDescription_OdorSleuth
.4byte gMoveDescription_RockTomb
.4byte gMoveDescription_SilverWind
.4byte gMoveDescription_MetalSound
.4byte gMoveDescription_GrassWhistle
.4byte gMoveDescription_Tickle
.4byte gMoveDescription_CosmicPower
.4byte gMoveDescription_WaterSpout
.4byte gMoveDescription_SignalBeam
.4byte gMoveDescription_ShadowPunch
.4byte gMoveDescription_Extrasensory
.4byte gMoveDescription_SkyUppercut
.4byte gMoveDescription_SandTomb
.4byte gMoveDescription_SheerCold
.4byte gMoveDescription_MuddyWater
.4byte gMoveDescription_BulletSeed
.4byte gMoveDescription_AerialAce
.4byte gMoveDescription_IcicleSpear
.4byte gMoveDescription_IronDefense
.4byte gMoveDescription_Block
.4byte gMoveDescription_Howl
.4byte gMoveDescription_DragonClaw
.4byte gMoveDescription_FrenzyPlant
.4byte gMoveDescription_BulkUp
.4byte gMoveDescription_Bounce
.4byte gMoveDescription_MudShot
.4byte gMoveDescription_PoisonTail
.4byte gMoveDescription_Covet
.4byte gMoveDescription_VoltTackle
.4byte gMoveDescription_MagicalLeaf
.4byte gMoveDescription_WaterSport
.4byte gMoveDescription_CalmMind
.4byte gMoveDescription_LeafBlade
.4byte gMoveDescription_DragonDance
.4byte gMoveDescription_RockBlast
.4byte gMoveDescription_ShockWave
.4byte gMoveDescription_WaterPulse
.4byte gMoveDescription_DoomDesire
.4byte gMoveDescription_PsychoBoost

File diff suppressed because it is too large Load Diff

7
include/berry_pouch.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef GUARD_BERRY_POUCH_H
#define GUARD_BERRY_POUCH_H
void sub_813D808(u8 taskId);
void sub_813D934(void (*)(void));
#endif //GUARD_BERRY_POUCH_H

View File

@ -2,5 +2,7 @@
#define GUARD_BIKE_H
void sub_80BD620(u32 unkC, u32 unk10);
bool8 sub_80BD540(void);
void sub_80BD5C8(u8 flags);
#endif //GUARD_BIKE_H

View File

@ -0,0 +1,79 @@
#ifndef GUARD_CONSTANTS_GLOBAL_H
#define GUARD_CONSTANTS_GLOBAL_H
#define POKEMON_SLOTS_NUMBER 412
#define ITEM_NAME_LENGTH 14
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
enum
{
VERSION_SAPPHIRE = 1,
VERSION_RUBY = 2,
VERSION_EMERALD = 3,
VERSION_FIRE_RED = 4,
VERSION_LEAF_GREEN = 5,
};
enum LanguageId {
LANGUAGE_JAPANESE = 1,
LANGUAGE_ENGLISH = 2,
LANGUAGE_FRENCH = 3,
LANGUAGE_ITALIAN = 4,
LANGUAGE_GERMAN = 5,
// 6 goes unused but the theory is it was meant to be Korean
LANGUAGE_SPANISH = 7,
};
#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
#define PC_ITEMS_COUNT 30
#define BAG_ITEMS_COUNT 42
#define BAG_KEYITEMS_COUNT 30
#define BAG_POKEBALLS_COUNT 13
#define BAG_TMHM_COUNT 58
#define BAG_BERRIES_COUNT 43
enum
{
MALE,
FEMALE
};
enum
{
OPTIONS_BUTTON_MODE_NORMAL,
OPTIONS_BUTTON_MODE_LR,
OPTIONS_BUTTON_MODE_L_EQUALS_A
};
enum
{
OPTIONS_TEXT_SPEED_SLOW,
OPTIONS_TEXT_SPEED_MID,
OPTIONS_TEXT_SPEED_FAST
};
enum
{
OPTIONS_SOUND_MONO,
OPTIONS_SOUND_STEREO
};
enum
{
OPTIONS_BATTLE_STYLE_SHIFT,
OPTIONS_BATTLE_STYLE_SET
};
enum
{
POCKET_ITEMS = 1,
POCKET_KEY_ITEMS,
POCKET_POKE_BALLS,
POCKET_TM_CASE,
POCKET_BERRY_POUCH,
};
#endif //GUARD_CONSTANTS_GLOBAL_H

View File

@ -395,11 +395,4 @@
// Check if the item is one that can be used on a Pokemon.
#define IS_POKEMON_ITEM(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
// POCKETS
#define POCKET_ITEMS 1
#define POCKET_KEY_ITEMS 2
#define POCKET_POKE_BALLS 3
#define POCKET_TM_CASE 4
#define POCKET_BERRY_POUCH 5
#endif // GUARD_CONSTANTS_ITEMS_H

View File

@ -14,5 +14,6 @@ void sub_807E500(void);
void sub_807DF64(void);
void sub_807DC18(void);
void FieldCallback_ReturnToEventScript2(void);
void sub_807DC00(void);
#endif // GUARD_FIELD_FADETRANSITION_H

View File

@ -22,5 +22,7 @@ void sub_805D9C4(struct Sprite *sprite);
void sub_805D154(u8 direction);
void sub_805DAE4(u8 direction);
void SetPlayerAvatarTransitionFlags(u16 a);
bool8 IsPlayerFacingSurfableFishableWater(void);
void sub_805D2C0(u8 secondaryId);
#endif //GUARD_FIELD_PLAYER_AVATAR_H

View File

@ -13,5 +13,6 @@ void DoCurrentWeather(void);
void SetSav1WeatherFromCurrMapHeader(void);
void sub_807B0C4(u16 *, u16 *, u32);
void PlayRainStoppingSoundEffect(void);
bool8 sub_807AA70(void);
#endif // GUARD_WEATHER_H

View File

@ -4,6 +4,7 @@
#include "config.h"
#include "gba/gba.h"
#include <string.h>
#include "constants/global.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
@ -39,10 +40,6 @@
// Converts a number to Q4.12 fixed-point format
#define Q_4_12(n) ((s16)((n) * 4096))
#define POKEMON_SLOTS_NUMBER 412
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
@ -79,75 +76,6 @@ extern u8 gStringVar2[];
extern u8 gStringVar3[];
extern u8 gStringVar4[];
enum
{
VERSION_SAPPHIRE = 1,
VERSION_RUBY = 2,
VERSION_EMERALD = 3,
VERSION_FIRE_RED = 4,
VERSION_LEAF_GREEN = 5,
};
enum LanguageId {
LANGUAGE_JAPANESE = 1,
LANGUAGE_ENGLISH = 2,
LANGUAGE_FRENCH = 3,
LANGUAGE_ITALIAN = 4,
LANGUAGE_GERMAN = 5,
// 6 goes unused but the theory is it was meant to be Korean
LANGUAGE_SPANISH = 7,
};
#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
#define PC_ITEMS_COUNT 30
#define BAG_ITEMS_COUNT 42
#define BAG_KEYITEMS_COUNT 30
#define BAG_POKEBALLS_COUNT 13
#define BAG_TMHM_COUNT 58
#define BAG_BERRIES_COUNT 43
enum
{
MALE,
FEMALE
};
enum
{
OPTIONS_BUTTON_MODE_NORMAL,
OPTIONS_BUTTON_MODE_LR,
OPTIONS_BUTTON_MODE_L_EQUALS_A
};
enum
{
OPTIONS_TEXT_SPEED_SLOW,
OPTIONS_TEXT_SPEED_MID,
OPTIONS_TEXT_SPEED_FAST
};
enum
{
OPTIONS_SOUND_MONO,
OPTIONS_SOUND_STEREO
};
enum
{
OPTIONS_BATTLE_STYLE_SHIFT,
OPTIONS_BATTLE_STYLE_SET
};
enum
{
BAG_ITEMS = 1,
BAG_POKEBALLS,
BAG_TMsHMs,
BAG_BERRIES,
BAG_KEYITEMS
};
struct Coords16
{
s16 x;

View File

@ -1,18 +1,20 @@
#ifndef ITEM_H
#define ITEM_H
#ifndef GUARD_ITEM_H
#define GUARD_ITEM_H
#include "global.h"
typedef void (*ItemUseFunc)(u8);
struct Item
{
u8 name[14];
u8 name[ITEM_NAME_LENGTH];
u16 itemId;
u16 price;
u8 holdEffect;
u8 holdEffectParam;
const u8 *description;
u8 importance;
u8 unk19;
u8 exitsBagOnUse;
u8 pocket;
u8 type;
ItemUseFunc fieldUseFunc;
@ -76,4 +78,4 @@ u16 GetBagItemId(u16 *);
void ItemPcCompaction(void);
void RemoveItemFromPC(u16 itemId, u16 quantity);
#endif // ITEM_H
#endif // GUARD_ITEM_H

View File

@ -28,5 +28,10 @@ void sub_8108CF0(void);
void sub_810B108(u8);
void UseFameCheckerFromMenu(void);
void ItemMenu_MoveItemSlotToNewPositionInArray(struct ItemSlot * slots, int pos1, int pos2);
void sub_8108B50(u8 taskId);
void sub_8108CB4(void);
void sub_8108EE0(void (*)(void));
void sub_8108E70(u8, u8, const u8 *, void (*)(u8));
void sub_810A1F8(u8 taskId);
#endif //GUARD_ITEM_MENU_H

View File

@ -6,4 +6,37 @@
void sub_80A1E0C(u8);
void ItemUse_SetQuestLogEvent(u8, struct Pokemon *, u16, u16);
void sub_80A11E8(u8 taskId);
void sub_80A122C(u8 taskId);
void sub_80A1338(u8 taskId);
void sub_80A1460(u8 taskId);
void sub_80A14E8(u8 taskId);
void sub_80A156C(u8 taskId);
void sub_80A16E0(u8 taskId);
void sub_80A16FC(u8 taskId);
void sub_80A1718(u8 taskId);
void sub_80A1734(u8 taskId);
void sub_80A1750(u8 taskId);
void sub_80A176C(u8 taskId);
void sub_80A1788(u8 taskId);
void sub_80A1820(u8 taskId);
void sub_80A18B8(u8 taskId);
void sub_80A18EC(u8 taskId);
void sub_80A1998(u8 taskId);
void sub_80A1A94(u8 taskId);
void sub_80A1C60(u8 taskId);
void sub_80A1CF8(u8 taskId);
void sub_80A1D9C(u8 taskId);
void sub_80A1E1C(u8 taskId);
void sub_80A1E64(u8 taskId);
void sub_80A1E7C(u8 taskId);
void sub_80A1FBC(u8 taskId);
void sub_80A1FF4(u8 taskId);
void sub_80A2010(u8 taskId);
void sub_80A2238(u8 taskId);
void ItemUseOutOfBattle_EscapeRope(u8 taskId);
void ItemUseOutOfBattle_EnigmaBerry(u8 taskId);
void ItemUseInBattle_EnigmaBerry(u8 taskId);
void ItemUseOutOfBattle_Itemfinder(u8 taskId);
#endif //GUARD_ITEM_USE_H

View File

@ -21,5 +21,6 @@ bool8 MonHasMail(struct Pokemon *mon);
void TakeMailFromMon(struct Pokemon *mon);
u8 GiveMailToMon2(struct Pokemon *mon, struct MailStruct *mail);
void ClearMailStruct(struct MailStruct *mail);
void sub_80BEBEC(u16 *, void (*)(void), u8);
#endif // GUARD_MAIL_H

View File

@ -31,6 +31,8 @@ extern MainCallback gFieldCallback;
extern struct WarpData gUnknown_2031DBC;
extern u8 gUnknown_2031DE0;
void IncrementGameStat(u8 index);
void Overworld_SetMapObjTemplateCoords(u8, s16, s16);
@ -112,5 +114,6 @@ void sub_805671C(void);
void sub_8055DC4(void);
bool8 sub_8055FC4(void);
bool8 is_light_level_8_or_9(u8 mapType);
bool32 sub_8055C9C(void);
#endif //GUARD_ROM4_H

View File

@ -161,4 +161,7 @@ extern const u8 gText_WithdrawItem[];
extern const u8 gText_Withdraw[];
extern const u8 gText_ReturnToPC[];
extern const u8 gUnknown_8416425[];
extern const u8 gUnknown_8416451[];
#endif //GUARD_STRINGS_H

9
json_data_rules.mk Normal file
View File

@ -0,0 +1,9 @@
# JSON files are run through jsonproc, which is a tool that converts JSON data to an output file
# based on an Inja template. https://github.com/pantor/inja
AUTO_GEN_TARGETS += src/data/items.h
src/data/items.h: src/data/items.json src/data/items.json.txt
$(JSONPROC) $^ $@
$(BUILD_DIR)/src/item.o: C_DEP += src/data/items.h

View File

@ -153,6 +153,7 @@ SECTIONS {
src/fldeff_berrytree.o(.text);
asm/field_special_scene.o(.text);
asm/safari_zone.o(.text);
src/item_use.o(.text);
asm/item_use.o(.text);
asm/battle_anim_effects_1.o(.text);
asm/battle_anim_effects_2.o(.text);
@ -410,6 +411,8 @@ SECTIONS {
data/data_835B488.o(.rodata);
src/item_menu_icons.o(.rodata);
data/data_835B488.o(.rodata.83D4E4C);
src/item.o(.rodata);
data/data_835B488.o(.rodata.83DF09C);
src/heal_location.o(.rodata);
data/data_835B488.o(.rodata.83EEC98);
src/battle_ai_script_commands.o(.rodata);

6062
src/data/items.json Normal file

File diff suppressed because it is too large Load Diff

31
src/data/items.json.txt Normal file
View File

@ -0,0 +1,31 @@
{{ doNotModifyHeader }}
## for item in items
## if item.pocket == "POCKET_TM_CASE"
extern const u8 gMoveDescription_{{ item.moveId }}[];
## endif
{% if item.itemId != "ITEM_NONE" %}const u8 gItemDescription_{{ item.itemId }}[] = _("{{ item.description_english }}");{% endif %}
## endfor
const u8 gItemDescription_ITEM_NONE[] = _("?????");
const struct Item gItems[] = {
{% for item in items %}{
.name = _("{{ item.english }}"),
.itemId = {{ item.itemId }},
.price = {{ item.price }},
.holdEffect = {{ item.holdEffect }},
.holdEffectParam = {{ item.holdEffectParam }},
## if item.pocket == "POCKET_TM_CASE"
.description = gMoveDescription_{{ item.moveId }},
## else
.description = gItemDescription_{{ item.itemId }},
## endif
.importance = {{ item.importance }},
.exitsBagOnUse = {{ item.exitsBagOnUse }},
.pocket = {{ item.pocket }},
.type = {{ item.type }},
.fieldUseFunc = {{ item.fieldUseFunc }},
.battleUsage = {{ item.battleUsage }},
.battleUseFunc = {{ item.battleUseFunc }},
.secondaryId = {{ item.secondaryId }}
}, {% endfor %}
};

8
src/item.c Normal file
View File

@ -0,0 +1,8 @@
#include "global.h"
#include "item.h"
#include "item_use.h"
#include "constants/hold_effects.h"
#include "constants/items.h"
// Item descriptions and data
#include "data/items.h"

242
src/item_use.c Normal file
View File

@ -0,0 +1,242 @@
#include "global.h"
#include "berry_pouch.h"
#include "bike.h"
#include "event_data.h"
#include "field_fadetransition.h"
#include "field_map_obj_helpers.h"
#include "field_player_avatar.h"
#include "field_weather.h"
#include "fieldmap.h"
#include "item.h"
#include "item_menu.h"
#include "mail.h"
#include "map_obj_80688E4.h"
#include "map_obj_lock.h"
#include "metatile_behavior.h"
#include "new_menu_helpers.h"
#include "overworld.h"
#include "script.h"
#include "sound.h"
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "constants/flags.h"
#include "constants/items.h"
#include "constants/songs.h"
EWRAM_DATA void (*sItemUseOnFieldCB)(u8 taskId) = NULL;
void sub_80A1084(void);
void sub_80A109C(u8 taskId);
void sub_80A112C(u8 taskId);
void sub_80A11C0(u8 taskId);
bool8 sub_80A1194(void);
void sub_80A1208(void);
void ItemUseOnFieldCB_Bicycle(u8 taskId);
bool8 ItemUseCheckFunc_Rod(void);
void ItemUseOnFieldCB_Rod(u8 taskId);
void sub_813EC8C(u8 taskId);
void sub_80A1750(u8 taskId);
extern void (*const gUnknown_83E2954[])(void);
void sub_80A0FBC(u8 taskId)
{
u8 itemType;
if (gSpecialVar_ItemId == ITEM_ENIGMA_BERRY)
itemType = gTasks[taskId].data[4] - 1;
else
itemType = ItemId_GetType(gSpecialVar_ItemId) - 1;
if (GetPocketByItemId(gSpecialVar_ItemId) == POCKET_BERRY_POUCH)
{
sub_813D934(gUnknown_83E2954[itemType]);
sub_813D808(taskId);
}
else
{
sub_8108EE0(gUnknown_83E2954[itemType]);
if (itemType == 1)
sub_8108CB4();
sub_8108B50(taskId);
}
}
void sub_80A103C(u8 taskId)
{
if (gTasks[taskId].data[3] != 1)
{
gFieldCallback = sub_80A1084;
sub_80A0FBC(taskId);
}
else
sItemUseOnFieldCB(taskId);
}
void sub_80A1084(void)
{
sub_807DC00();
CreateTask(sub_80A109C, 8);
}
void sub_80A109C(u8 taskId)
{
if (sub_807AA70() == TRUE)
{
sItemUseOnFieldCB(taskId);
}
}
void sub_80A10C4(u8 taskId, bool8 a1, u8 a2, const u8 * str)
{
StringExpandPlaceholders(gStringVar4, str);
if (a1 == FALSE)
sub_8108E70(taskId, a2, gStringVar4, sub_810A1F8);
else
DisplayItemMessageOnField(taskId, a2, gStringVar4, sub_80A112C);
}
void sub_80A1110(u8 taskId, bool8 a1)
{
sub_80A10C4(taskId, a1, 4, gUnknown_8416425);
}
void sub_80A112C(u8 taskId)
{
ClearDialogWindowAndFrame(0, 1);
DestroyTask(taskId);
sub_80696C0();
ScriptContext2_Disable();
}
u8 sub_80A1150(u16 itemId)
{
if (ItemId_GetPocket(itemId) == POCKET_TM_CASE)
return 1;
else if (ItemId_GetFieldFunc(itemId) == sub_80A1750)
return 2;
else
return 0;
}
void sub_80A1184(void)
{
gFieldCallback2 = sub_80A1194;
}
bool8 sub_80A1194(void)
{
player_bitmagic();
ScriptContext2_Enable();
sub_807DC00();
CreateTask(sub_80A11C0, 10);
gUnknown_2031DE0 = 0;
return TRUE;
}
void sub_80A11C0(u8 taskId)
{
if (sub_807AA70() == TRUE)
{
UnfreezeMapObjects();
ScriptContext2_Disable();
DestroyTask(taskId);
}
}
void sub_80A11E8(u8 taskId)
{
sub_8108EE0(sub_80A1208);
sub_8108B50(taskId);
}
void sub_80A1208(void)
{
u16 buffer[18];
buffer[16] = gSpecialVar_ItemId;
sub_80BEBEC(buffer, UseFameCheckerFromMenu, 0);
}
void sub_80A122C(u8 taskId)
{
s16 x, y;
u8 behavior;
PlayerGetDestCoords(&x, &y);
behavior = MapGridGetMetatileBehaviorAt(x, y);
if (FlagGet(FLAG_0x830) == TRUE
|| MetatileBehavior_ReturnFalse_17(behavior) == TRUE
|| MetatileBehavior_ReturnFalse_18(behavior) == TRUE
|| MetatileBehavior_ReturnFalse_15(behavior) == TRUE
|| MetatileBehavior_ReturnFalse_16(behavior) == TRUE)
sub_80A10C4(taskId, gTasks[taskId].data[3], 2, gUnknown_8416451);
else if (sub_8055C9C() == TRUE && !sub_80BD540())
{
sItemUseOnFieldCB = ItemUseOnFieldCB_Bicycle;
sub_80A103C(taskId);
}
else
sub_80A1110(taskId, gTasks[taskId].data[3]);
}
void ItemUseOnFieldCB_Bicycle(u8 taskId)
{
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
PlaySE(SE_JITENSYA);
sub_80BD5C8(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE);
sub_80696C0();
ScriptContext2_Disable();
DestroyTask(taskId);
}
void sub_80A1338(u8 taskId)
{
if (ItemUseCheckFunc_Rod() == TRUE)
{
sItemUseOnFieldCB = ItemUseOnFieldCB_Rod;
sub_80A103C(taskId);
}
else
sub_80A1110(taskId, gTasks[taskId].data[3]);
}
bool8 ItemUseCheckFunc_Rod(void)
{
s16 x, y;
u16 behavior;
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
behavior = MapGridGetMetatileBehaviorAt(x, y);
if (MetatileBehavior_IsWaterfall(behavior))
return FALSE;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4))
return FALSE;
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
{
if (IsPlayerFacingSurfableFishableWater())
return TRUE;
}
else
{
if (MetatileBehavior_IsSurfable(behavior) && !MapGridIsImpassableAt(x, y))
return TRUE;
if (MetatileBehavior_ReturnFalse_6(behavior) == TRUE)
return TRUE;
}
return FALSE;
}
void ItemUseOnFieldCB_Rod(u8 taskId)
{
sub_805D2C0(ItemId_GetSecondaryId(gSpecialVar_ItemId));
DestroyTask(taskId);
}
void ItemUseOutOfBattle_Itemfinder(u8 taskId)
{
IncrementGameStat(GAME_STAT_USED_ITEMFINDER);
sItemUseOnFieldCB = sub_813EC8C;
sub_80A103C(taskId);
}

View File

@ -985,9 +985,10 @@ gUnknown_2039994: @ 2039994
gUnknown_2039996: @ 2039996
.space 0x2
gUnknown_2039998: @ 2039998
.space 0x4
.align 2
.include "src/item_use.o"
.align 2
gUnknown_203999C: @ 203999C
.space 0x8

1
tools/jsonproc/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
jsonproc

20
tools/jsonproc/Makefile Normal file
View File

@ -0,0 +1,20 @@
CXX := g++
CXXFLAGS := -Wall -std=c++11 -O2
INCLUDES := -I .
SRCS := jsonproc.cpp
HEADERS := jsonproc.h inja.hpp nlohmann/json.hpp
.PHONY: clean
all: jsonproc
@:
jsonproc: $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) -o $@ $(LDFLAGS)
clean:
$(RM) jsonproc jsonproc.exe

3396
tools/jsonproc/inja.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
// jsonproc.cpp
#include "jsonproc.h"
#include <map>
#include <string>
using std::string;
#include <inja.hpp>
using namespace inja;
using json = nlohmann::json;
std::map<string, string> customVars;
void set_custom_var(string key, string value)
{
customVars[key] = value;
}
string get_custom_var(string key)
{
return customVars[key];
}
int main(int argc, char *argv[])
{
if (argc != 4)
FATAL_ERROR("USAGE: jsonproc <json-filepath> <template-filepath> <output-filepath>\n");
string jsonfilepath = argv[1];
string templateFilepath = argv[2];
string outputFilepath = argv[3];
Environment env;
// Add custom command callbacks.
env.add_callback("doNotModifyHeader", 0, [jsonfilepath, templateFilepath](Arguments& args) {
return "//\n// DO NOT MODIFY THIS FILE! IT IS AUTO-GENERATED FROM " + jsonfilepath +" and Inja template " + templateFilepath + "\n//\n";
});
env.add_callback("setVar", 2, [=](Arguments& args) {
string key = args.at(0)->get<string>();
string value = args.at(1)->get<string>();
set_custom_var(key, value);
return "";
});
env.add_callback("getVar", 1, [=](Arguments& args) {
string key = args.at(0)->get<string>();
return get_custom_var(key);
});
env.add_callback("concat", 2, [](Arguments& args) {
string first = args.at(0)->get<string>();
string second = args.at(1)->get<string>();
return first + second;
});
env.add_callback("removePrefix", 2, [](Arguments& args) {
string rawValue = args.at(0)->get<string>();
string prefix = args.at(1)->get<string>();
string::size_type i = rawValue.find(prefix);
if (i != 0)
return rawValue;
return rawValue.erase(0, prefix.length());
});
// Add custom command callbacks.
env.add_callback("removeSuffix", 2, [](Arguments& args) {
string rawValue = args.at(0)->get<string>();
string suffix = args.at(1)->get<string>();
string::size_type i = rawValue.rfind(suffix);
if (i == string::npos)
return rawValue;
return rawValue.substr(0, i);
});
try
{
env.write_with_json_file(templateFilepath, jsonfilepath, outputFilepath);
}
catch (const std::exception& e)
{
FATAL_ERROR("JSONPROC_ERROR: %s\n", e.what());
}
return 0;
}

32
tools/jsonproc/jsonproc.h Normal file
View File

@ -0,0 +1,32 @@
// jsonproc.h
#ifndef JSONPROC_H
#define JSONPROC_H
#include <cstdlib>
#include <cstdio>
using std::fprintf; using std::exit;
#include <cstdlib>
#ifdef _MSC_VER
#define FATAL_ERROR(format, ...) \
do \
{ \
fprintf(stderr, format, __VA_ARGS__); \
exit(1); \
} while (0)
#else
#define FATAL_ERROR(format, ...) \
do \
{ \
fprintf(stderr, format, ##__VA_ARGS__); \
exit(1); \
} while (0)
#endif // _MSC_VER
#endif // JSONPROC_H

File diff suppressed because it is too large Load Diff